azot 5.0.0-alpha.28 → 5.0.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/azot.mjs +1 -1
- package/dist/context-dQU9jc5L.mjs +3 -0
- package/dist/context.mjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/package.json +4 -4
- package/types/api.d.ts +4 -2
- package/types/extension-v2.d.ts +113 -40
- package/types/manifest.d.ts +55 -6
- package/dist/context-CXpQsIh1.mjs +0 -3
package/dist/azot.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const gA=b;(function(fT,fU){const gz=b,fV=fT();while(!![]){try{const fW=-parseInt(gz(0x30e))/0x1*(-parseInt(gz(0x217))/0x2)+-parseInt(gz(0x2c2))/0x3*(-parseInt(gz(0x1cb))/0x4)+-parseInt(gz(0x21d))/0x5*(parseInt(gz(0x2c5))/0x6)+parseInt(gz(0x1ef))/0x7*(-parseInt(gz(0x2a8))/0x8)+-parseInt(gz(0x2a6))/0x9+parseInt(gz(0x23b))/0xa+-parseInt(gz(0x267))/0xb*(-parseInt(gz(0x2ce))/0xc);if(fW===fU)break;else fV['push'](fV['shift']());}catch(fX){fV['push'](fV['shift']());}}}(a,0x4d023));import{A as c,C as d,D as f,E as g,M as h,N as i,O as j,S as k,T as l,_ as m,a as n,b as o,c as p,d as q,f as r,g as s,h as t,i as u,j as v,k as w,l as x,m as y,n as A,o as B,p as C,r as D,s as E,t as F,u as G,v as H,w as I,x as J,y as K}from'./context-CXpQsIh1.mjs';import{createRequire}from'node:module';import L,{constants,existsSync,readFileSync,readdirSync,rmSync,statSync,writeFileSync}from'node:fs';import*as M from'node:path';import N,{basename,dirname,extname,join,parse,resolve}from'node:path';import O from'yargs';import'urlpattern-polyfill';import P from'picocolors';import*as Q from'node:fs/promises';import R,{open,readFile,readdir,rm,stat,writeFile}from'node:fs/promises';import S,{platform,stdout}from'node:process';import{hideBin}from'yargs/helpers';import{EventEmitter as T}from'node:events';import{z}from'zod';import{DASH_FORMATS,HLS_FORMATS,Input,UrlSource}from'dasha';import U from'ky';import{Agent,ProxyAgent}from'undici';import{checkbox,confirm}from'@inquirer/prompts';import{execFileSync}from'node:child_process';import{createAuthClient}from'better-auth/client';import{deviceAuthorizationClient}from'better-auth/client/plugins';import{tributeClient}from'@tribute-tg/better-auth';import{QueryCache,QueryClient}from'@tanstack/query-core';import{createHash}from'node:crypto';import{inspect}from'node:util';import{ALL_FORMATS as V,EncodedAudioPacketSource,EncodedPacketSink,EncodedVideoPacketSource,Input as W,MkvOutputFormat,Mp4OutputFormat,Output,StreamSource,StreamTarget,TextSubtitleSource,UrlSource as X}from'mediabunny';import{finished,pipeline}from'node:stream/promises';import{Readable}from'node:stream';import{isatty}from'node:tty';import{createSpinner}from'nanospinner';import{RemoteCdm,requestMediaKeySystemAccess}from'okova';import{Decryption,FilePathSource,FilePathTarget,Input as Y,Output as Z}from'shifro';import{convert}from'@transcrobes/subs-convert';import a0 from'open';var a1=Object['create'],a2=Object[gA(0x2dc)],a3=Object[gA(0x243)],a4=Object[gA(0x20c)],a5=Object['getPrototypeOf'],a6=Object['prototype']['hasOwnProperty'],a7=(fT,fU)=>()=>(fU||(fT((fU={'exports':{}})['exports'],fU),fT=null),fU[gA(0x328)]),a8=(fT,fU,fV,fW)=>{if(fU&&typeof fU=='object'||typeof fU=='function'){for(var fX=a4(fU),fY=0x0,fZ=fX['length'],g0;fY<fZ;fY++)g0=fX[fY],!a6['call'](fT,g0)&&g0!==fV&&a2(fT,g0,{'get':(g1=>fU[g1])['bind'](null,g0),'enumerable':!(fW=a3(fU,g0))||fW['enumerable']});}return fT;},a9=(fT,fU,fV)=>(fV=fT==null?{}:a1(a5(fT)),a8(fU||!fT||!fT['__esModule']?a2(fV,'default',{'value':fT,'enumerable':!0x0}):fV,fT)),aa=createRequire(import.meta.url);const ab=()=>{const gB=gA;let fT=[];process['resourcesPath']&&fT[gB(0x265)](join(process['resourcesPath'],gB(0x31c),'winconsole.node'));let fU=join(__dirname,'..','..','..');return fT['push'](join(fU,'assets','bin','win32','winconsole.node')),fT['push'](join(fU,'native','winconsole','build','Release','winconsole.node')),fT['find'](fV=>existsSync(fV))||null;},ac=()=>{if(process['platform']!=='win32')return null;let fT=ab();if(!fT)return null;try{return aa(fT);}catch{return null;}};if(process['platform']==='win32'&&process.env.ELECTRON_RUN_AS_NODE==='1'){let g2=ac();g2&&(g2['attachParentConsole']?.(),g2['enableUtf8']?.());}const ad=(fT=process['argv'],fU=process.env)=>fU['ELECTRON_RUN_AS_NODE']==='1'?fT['slice'](0x2):hideBin(fT),ae={'target':'node','compact':!0x0,'identifierNamesGenerator':'mangled','renameGlobals':!0x0,'simplify':!0x0,'controlFlowFlattening':!0x1,'deadCodeInjection':!0x1,'debugProtection':!0x1,'numbersToExpressions':!0x1,'selfDefending':!0x1,'splitStrings':!0x1,'stringArray':!0x0,'stringArrayCallsTransform':!0x1,'stringArrayEncoding':[],'stringArrayIndexShift':!0x0,'stringArrayRotate':!0x0,'stringArrayShuffle':!0x0,'stringArrayWrappersCount':0x1,'stringArrayWrappersChainedCalls':!0x0,'stringArrayWrappersType':'variable','stringArrayThreshold':0.1,'transformObjectKeys':!0x1,'unicodeEscapeSequence':!0x1},af=fT=>{let fU=['B','KB','MB','GB'],fV=fT,fW=0x0;for(;fV>=0x400&&fW<fU['length']-0x1;)fV/=0x400,fW+=0x1;return fV['toFixed'](fW===0x0?0x0:0x2)+'\x20'+fU[fW];},ag=async(fT,fU)=>{let fV=readFileSync(fT,'utf8'),{default:fW}=await import('javascript-obfuscator');console['log']('Obfuscating\x20'+fT+'...'),console['time']('Obfuscation\x20finished');let fX=fW['obfuscate'](fV,ae);console['timeEnd']('Obfuscation\x20finished');let fY=fX['getObfuscatedCode'](),fZ=Buffer['byteLength'](fV,'utf8'),g0=Buffer['byteLength'](fY,'utf8'),g1=fZ===0x0?0x0:g0/fZ;return console['log']('Size\x20changed\x20from\x20'+af(fZ)+'\x20to\x20'+af(g0)+',\x20'+g1['toFixed'](0x2)+'x\x20increase'),writeFileSync(fU||fT,fY),fY;},ah=new Set(['.ts','.js','.cjs',gA(0x268)]),ai=new Set(['index','main']),aj=fT=>{const gC=gA;if(existsSync(fT))try{if(!statSync(fT)['isDirectory']())return;let fU=readdirSync(fT)['filter'](fX=>!fX[gC(0x2d3)]('.d.ts'))['filter'](fX=>ah['has'](N['extname'](fX))),fV=fX=>N['basename'](fX,N['extname'](fX)),fW=fU['find'](fX=>ai['has'](fV(fX)))||fU[0x0];return fW?N['join'](fT,fW):void 0x0;}catch{return;}},ak=()=>{let fT=[process['cwd'](),N['join'](process['cwd'](),'src'),N['join'](process['cwd'](),'lib')];for(let fU of fT){let fV=aj(fU);if(fV)return fV;}},al=fT=>fT==='esm'?gA(0x1db):'cjs',am=(fT,fU)=>N['join'](process['cwd'](),'dist',N['parse'](fT)[gA(0x2c0)]+'.'+al(fU)),an=fT=>{const gD=gA;let fU=N['relative'](process['cwd'](),fT);if(!fU||fU[gD(0x2d0)]('..'))throw Error(gD(0x209)+fT);return'./'+fU['split'](N['sep'])['join']('/');},ao=fT=>{let fU=fT['input']||fT['entry']||ak();if(!fU)throw Error('No\x20entry\x20file\x20found');return N['resolve'](fU);},ap=()=>{if(c)throw Error('The\x20`build`\x20and\x20`dev`\x20commands\x20are\x20unavailable\x20in\x20the\x20desktop-distributed\x20CLI.\x20Use\x20the\x20npm-installed\x20`azot`\x20package\x20in\x20a\x20Node.js\x20environment\x20instead.');},aq=fT=>fT['positional']('entry',{'describe':'Path\x20to\x20the\x20input\x20file','type':'string'})['option']('input',{'alias':'i','describe':'Path\x20to\x20the\x20input\x20file','type':'string'})['option']('format',{'alias':'f','describe':'Output\x20format','choices':['cjs','esm'],'default':'cjs'})['option']('minify',{'describe':'Minify\x20output','type':'boolean'}),ar=fT=>{const gE=gA;let fU=N['resolve'](fT);for(;;){let fV=N['join'](fU,gE(0x256));if(existsSync(fV))return fV;let fW=N['dirname'](fU);if(fW===fU)return;fU=fW;}},as=fT=>{const gF=gA;let fU=ar(fT);if(!fU){let fV='Could\x20not\x20find\x20package.json\x20starting\x20from\x20'+fT;throw C['error'](fV),Error(fV);}try{let fW=JSON['parse'](readFileSync(fU,'utf8'));if(!fW||typeof fW!=gF(0x23f)||Array['isArray'](fW))throw Error('package.json\x20must\x20contain\x20a\x20JSON\x20object');let fX=fW;if(fX['private']!==void 0x0&&typeof fX['private']!='boolean')throw Error('package.json\x20field\x20\x22private\x22\x20must\x20be\x20a\x20boolean\x20when\x20present');return{'private':fX['private']};}catch(fY){let fZ='Failed\x20to\x20load\x20package.json\x20for\x20build\x20command\x20from\x20'+fU;throw C['error'](fZ),C['debug'](fY),Error(fZ);}},at={'command':'build\x20[entry]','describe':'Bundle\x20a\x20Node.js\x20entry\x20file\x20for\x20distribution','builder':fT=>aq(fT)['option']('watch',{'describe':'Watch\x20file\x20changes','type':gA(0x33a)})['option']('obfuscate',{'describe':'Obfuscate\x20output','type':'boolean'}),'handler':async fT=>{const gG=gA;ap();let fU=ao(fT),fV=typeof fT[gG(0x294)]=='boolean'?fT['minify']:!0x0,fW=fT['watch']===!0x0,fX=fT['format']??'cjs',{build:fY}=await import('tsdown');await fY({'entry':an(fU),'format':fX,'platform':'node','target':'node24','watch':fW,'minify':fV,'inlineOnly':!0x1});let fZ=am(fU,fX),g0=as(process['cwd']());(typeof fT['obfuscate']=='boolean'?fT['obfuscate']:g0['private'])&&await ag(fZ,fZ);}},au={'command':gA(0x24c),'describe':'Watch\x20and\x20rebuild\x20a\x20Node.js\x20entry\x20file\x20during\x20development','builder':fT=>aq(fT),'handler':async fT=>{const gH=gA;ap();let fU=ao(fT),fV=typeof fT['minify']==gH(0x33a)?fT['minify']:!0x1,{build:fW}=await import('tsdown');await fW({'entry':an(fU),'format':fT['format']??'cjs','platform':gH(0x313),'target':'node24','watch':!0x0,'minify':fV});}},av=()=>Intl['DateTimeFormat']()['resolvedOptions']()['locale']['startsWith']('ru')?'ru':'en',aw={'dark':'dark','light':'light','system':'system'},ax={'mp4':'mp4','mkv':'mkv'},ay=z['object']({'downloadDir':z['string']()['default'](H),'binariesDir':z['string']()['default'](I(join(y,'bin'))),'drmDir':z['string']()[gA(0x222)](I(join(y,'drm'))),'language':z['string']()['default'](av()),'theme':z['enum']([aw['dark'],aw['light'],aw['system']])['default'](aw['system']),'preferHardsub':z['coerce']['boolean']()['default'](!0x1),'retry':z['coerce']['number']()['int']()['min'](0x1)['max'](0xa)['default'](0x3),'connections':z['coerce']['number']()['int']()['min'](0x1)['max'](0x40)['default'](0x4),'maxActiveDownloads':z['coerce']['number']()['int']()['min'](0x1)['default'](0x1),'proxy':z['string']()['optional'](),'proxyMeta':z['string']()['optional'](),'proxyMedia':z['string']()['optional'](),'movieFilenameTemplate':z['string']()['default']('{title}\x20({quality},\x20{codec})'),'seriesFilenameTemplate':z['string']()['default']('{title}\x20S{s}E{e}\x20({quality},\x20{codec})'),'developerMode':z[gA(0x24d)]['boolean']()['default'](!0x1),'allowUnknownSources':z[gA(0x24d)][gA(0x33a)]()[gA(0x222)](!0x1),'videoContainerFormat':z['enum']([ax[gA(0x1d4)],ax['mkv']])['default'](ax['mp4']),'useAlternativeServer':z['coerce']['boolean']()['default'](!0x1),'automaticUpdates':z['coerce']['boolean']()['default'](!0x0)}),az=ay['parse']({});var aA=class{#e;constructor(fT){this.#e=x({'defaults':az,'cwd':dirname(fT),'configName':basename(fT,'.json')}),this.#t();}#t(){const gI=gA;let fT=this.#e[gI(0x1d0)],fU=ay['safeParse'](fT),fV='{title}.{audioType}.{quality}.{tag}.{format}.{codec}',fW='{title}.S{s}E{e}.{episodeTitle}.{audioType}.{quality}.{tag}.{format}.{codec}';if(fT['movieFilenameTemplate']==='{title}.{audioType}.{quality}.{tag}.{format}.{codec}'&&this.#e['set'](gI(0x2b9),fT['seriesFilenameTemplate']),fT['seriesFilenameTemplate']==='{title}.S{s}E{e}.{episodeTitle}.{audioType}.{quality}.{tag}.{format}.{codec}'&&this.#e['set']('seriesFilenameTemplate',fT['seriesFilenameTemplate']),!fU['success']){console[gI(0x225)]('Settings\x20validation\x20failed!\x20Resetting\x20to\x20defaults.',fU['error']['flatten']()),this.#e['set'](az);return;}Object['hasOwn'](fT,'askForOptions')&&this.#e['set'](fU['data']);}['getAll'](){return this.#e['store'];}['get'](fT){return this.#e['get'](fT);}['set'](fT){let fU={...this.#e['store'],...fT},fV=ay['safeParse'](fU);if(!fV['success'])throw console['error']('Invalid\x20settings\x20update:',fV['error']['flatten']()),Error('Settings\x20update\x20failed\x20validation.');this.#e['set'](fV['data']);}['onDidChange'](fT){this.#e['onDidAnyChange'](fT);}};function a(){const kg=['Could\x20not\x20find\x20RBC\x20playlist\x20URL.','\x20for\x20stability','1Qebtty','https://mv1.virtualroom.ru/vr/player/records/','replace','activeRunCount','direct_asset_url','node','afterMux','bitrate','indexPath','label','8845758582119845','initSegment','drm','.part','bin','getProgress','subtitle','stat','Invalid\x20format:\x20','https://play-lh.googleusercontent.com/JSSeB3XQtb9sHD5FWTqVM4AksY_Kg2q20eExenxGqPJZdn2uVQxi8eoHkP5MA-IR4w=w480-h960-rw','resource','onJobStatusChanged','execute','drain','aac','json','exports','Public\x20key\x20import\x20failed','update','settings','function','find','matchAll','padStart','strategy','No\x20metadata\x20found','join','getItem','Resolving\x20media\x20entries...','quality','skip-mux','set','import','queueResumeAfterStop','boolean','values','videos','\x20|\x20','IMPORT_INVALID','sleep','GraphQL\x20request\x20failed\x20with\x20status:\x20','edges','isInvalidated','scope','origin','lang','8452tZTBjd','follow','part_','server','(unknown)','store','token','resumeManager','window','mp4','data','get','https://*.weibo.com/*','downloadedBytes','module','/info','mjs','sourceSignature','context','prompt','toLocaleLowerCase','manager','utils','debug','sessionId','emit','green','logout','https://*.vk.com/*','dequeue','https://soundcloud.com/','download','bytesDownloaded','preferredVersion','add','getKeys','7vVDdwx','addEventListener','audio','idle','errorHandler','\x20minutes)...','Login\x20to\x20extension\x20(or\x20if\x20no\x20extension\x20is\x20specified,\x20login\x20to\x20Azot\x20account)','Failed\x20to\x20parse\x20TikTok\x20page\x20JSON','https://github.com/vitalygashkov','Failed\x20to\x20fetch\x20','map','nextTick','authorization_pending','wasClamped','start.film','codec','details','parse','min','stop','navigator','segments','hooks','index','requestHeaders','GitHub\x20release\x20not\x20found','Entry\x20file\x20must\x20be\x20inside\x20the\x20current\x20working\x20directory:\x20','progressive','split','getOwnPropertyNames','segmentCount','Bundle\x20download\x20failed:\x20can\x27t\x20find\x20output\x20file','message','info','NTV\x20page','...','auth','string','mpd','defineExtension','476886aNCypg','title','abk','persistJob','UNSUPPORTED_SOURCE','length','10GJdviW','http2','Polling\x20for\x20authorization','jobs','statusMsg','default','loadCoreExtensions','filter','warn','/serial','aborted','splice','Select\x20video\x20streams','skipVideo','queued','setItem','probe','uninstall','localStorage','retry','path','searchParams','digest','package','resumeState','description','next','subtitles','some','error','3793030cClHwZ','max','/?no_404=true&referer&pver=v2','document','object','Vitaly\x20Gashkov','maxChunkSize','remove-with-file','getOwnPropertyDescriptor','then','https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/41/91/13/419113d2-6246-c557-669e-0f0a5c62bcc5/Prod-0-0-1x_U007epad-0-1-0-sRGB-85-220.png/460x0w.webp','hint','version','cleanup','.cjs','proxy','MP3','dev\x20[entry]','coerce','width','SOURCE_NOT_FOUND','proxyMedia','dirname','https://www.ntv.ru/','stringify','RELEASE_NOT_FOUND','job','package.json','\x20bytes\x20generated\x20for\x20session\x20','trim-begin','240','https://api.github.com/repos/','Extension\x20','bytesWritten','Download\x20manager\x20error:\x20','all','cleanupOnSuccess','number','headers','arrayBuffer','logs','https://azot.mov/','push','forced','12806717eUINUE','.mjs','dir','status','loadExtension','exactPaths','opus','type','Disable\x20merge\x20audio/video/subs\x20into\x20single\x20file','install','columns','clone','isArray','edge_media_to_caption','job-error','seasonNumber','hardsub','480','cookies.txt','key','token_type','sources','head','playAddr','dataUpdatedAt','getActiveJob','media_info','http','sha256','0.0.9','videoContainerFormat','tur','has','legacy-content','callbacks','No\x20client\x20ID','completed','downloadDir',',\x20remoteCdm=','tempFileDir','trim','start','subscription','player','extensions','minify','1080','open','parts','catch','video-hostings','isSpinning','Direct','connections','vitalygashkov@vk.com','infoList','pending','access_token','getTracks','mediumConnectionsCount','code','isExplicitSelection','job-status-changed','5582052ohQbHy','stack','4043176tnRUOF','bytesTotal','pathname','toString','notify','platform','getTime','maxActiveDownloads','create','maxWorkerCount','console','trimEnd','Input\x20is\x20empty','client','Unauthorized','cwd','bold','movieFilenameTemplate','video','option','invalidate','AbortError','input',',\x20providedKeyCount=','name','HLS_FORMATS','105wHYEdW','Azot','source','1244688bfgHAm','(unknown\x20extension)','size','every','resolveMedia','episodeNumber','Failed\x20to\x20resolve\x20customer\x20plan\x20for\x20connection\x20limits.\x20Falling\x20back\x20to\x20Free\x20limits:\x20','Weibo','playready','12iWRCZI','downloadsStorage','startsWith','writeFile','value','endsWith','config','inputTrack','saturated','DASH_FORMATS','Dynamic\x20Adaptive\x20Streaming\x20over\x20HTTP','removeQueries','inputs','ASSET_NOT_FOUND','defineProperty','url','month','text','includes','pathPrefixes','premiumExtensions','DASH','sourceUrl','und','Options:','manifest','Failed\x20to\x20load\x20extension\x20script:\x20','call','urn:ietf:params:oauth:grant-type:device_code','ask','filePath','SIGNATURE_VERIFICATION_FAILED','Resolving\x20DRM\x20keys\x20for\x20PSSH\x20','end','episodeTitle','movieTemplate','output','Resolved\x20output\x20path:\x20','https','reverse','template','speed','ErrorEmptyDownload','keys','cause','\x20failed:\x20','EPERM','Signature\x20verification\x20failed','padEnd','User','prepareContext','fetch','base64','https://play-lh.googleusercontent.com/TTKq2trnzgtoyM0jc1pyrrmXtA_Yd3A2hxubZtDahdZStYf4GPANZa-wjDb1ELHrGqh_=w480-h960-rw','streamyx-extensions','repeat','exec','downloading','from','Video\x20codec\x20-\x20avc\x20|\x20hevc\x20|\x20vp8\x20|\x20vp9\x20|\x20av1\x20|\x20vc1,\x20defaults\x20to\x20any','cookieStore','beforeDownload'];a=function(){return kg;};return a();}const aB=async fT=>{try{return await R['access'](fT),!0x0;}catch(fU){if(fU['code']==='ENOENT')return!0x1;throw fU;}},aC=async(fT,{recursive:fU=!0x1}={})=>await R['readdir'](fT,{'withFileTypes':!0x0,'recursive':fU}),aD=async(fT,{recursive:fU=!0x0,force:fV=!0x0}={})=>{await R['rm'](fT,{'recursive':fU,'force':fV});},aE=async(fT,{recursive:fU=!0x0}={})=>{await R['mkdir'](fT,{'recursive':fU});},aF=async fT=>{const gJ=gA;try{await R['access'](fT,constants['W_OK']);}catch(fU){let fV=fU['code'];throw fV===gJ(0x2fc)||fV==='EACCES'||fV==='ENOENT'?Object['assign'](Error('Download\x20directory\x20is\x20not\x20writable'),{'code':'DOWNLOAD_DIR_NOT_WRITABLE'}):fU;}},aG=async fT=>{try{let fU=await R['readFile'](fT,{'encoding':'utf8'});return JSON['parse'](fU);}catch(fV){throw Error('Failed\x20to\x20read\x20JSON\x20file:\x20'+fT,{'cause':fV});}},aH=async(fT,fU)=>{const gK=gA;let fV=parse(fT)[gK(0x269)];try{let fW=await aB(fV);fV&&!fW&&await R['mkdir'](fV),await R['writeFile'](fT,JSON[gK(0x253)](fU,null,0x2),'utf8');}catch(fX){throw Error('Failed\x20to\x20save\x20data\x20to\x20file:\x20'+fT,{'cause':fX});}},aI={'extract':(fT,fU)=>execFileSync('tar',['-xf',fT,...fU?['-C',fU]:[]],{'stdio':'inherit'})},aJ={'CHANNEL_NOT_FOUND':'EXTENSION_INSTALL_CHANNEL_NOT_FOUND','VERSION_NOT_FOUND':'EXTENSION_INSTALL_VERSION_NOT_FOUND','RELEASE_NOT_FOUND':'EXTENSION_INSTALL_RELEASE_NOT_FOUND','ASSET_NOT_FOUND':'EXTENSION_INSTALL_ASSET_NOT_FOUND','UNSUPPORTED_SOURCE':'EXTENSION_INSTALL_UNSUPPORTED_SOURCE','UNSUPPORTED_PACKAGE_TYPE':'EXTENSION_INSTALL_UNSUPPORTED_PACKAGE_TYPE','IMPORT_INVALID':'EXTENSION_INSTALL_IMPORT_INVALID','SOURCE_NOT_FOUND':'EXTENSION_INSTALL_SOURCE_NOT_FOUND','UNKNOWN':'EXTENSION_INSTALL_UNKNOWN'},aK=new Set(Object['values'](aJ));var aL=class extends Error{['code'];[gA(0x1ff)];['hint'];constructor(fT){super(fT['message']),this['name']='InstallExtensionError',this['code']=fT['code'],this['details']=fT['details'],this['hint']=fT['hint'];}['toPayload'](){const gL=gA;return{'code':this['code'],'message':this['message'],'details':this['details'],'hint':this[gL(0x246)]};}};const aM=(fT,fU,fV,fW)=>new aL({'code':fT,'message':fU,'details':fV,'hint':fW}),aN=fT=>{let fU=(fT?.['startsWith']('v')?fT[0x1]:fT?.[0x0])??'';return Number['isNaN'](parseInt(fU))?fT?.['split']('.')['at'](0x0)||'latest':fT?.['split']('-')['at'](0x1)?.['split']('.')['at'](0x0)||'latest';},aO=fT=>(fT['version']||fT['tag_name']||'')[gA(0x310)](/^v/,''),aP=fT=>[...new Set(fT['filter'](Boolean))],aQ=fT=>({'availableVersions':aP((fT||[])['map'](fU=>aO(fU))),'availableChannels':aP((fT||[])['map'](fU=>aN(aO(fU))))}),aR=(fT,fU,fV)=>{const gM=gA;let fW={'source':fV,'preferredVersion':fT['preferredVersion'],'preferredChannel':fT['preferredChannel'],'appChannel':fT['appChannel'],...aQ(fU)};return fT[gM(0x1ec)]?aM(aJ['VERSION_NOT_FOUND'],'Release\x20not\x20found\x20for\x20requested\x20version:\x20'+fT['preferredVersion'],fW):aM(aJ['CHANNEL_NOT_FOUND'],'Release\x20not\x20found\x20for\x20requested\x20channel:\x20'+fT['preferredChannel'],fW);},aS=(fT,fU,fV)=>{const gN=gA;if(!fT?.['length'])return null;if(fU['preferredVersion'])return fT['find'](fW=>aO(fW)===fU['preferredVersion'])||null;if(!fU['isExplicitSelection']){let fW=fT[gN(0x32d)](fX=>aN(aO(fX))==='latest');if(fW)return fW;}return fT['find'](fX=>aN(aO(fX))===fU['preferredChannel'])||(fU['allowFallback']&&fU['preferredChannel']!=='latest'?(C['debug']('Release\x20'+fU['preferredChannel']+'\x20not\x20found\x20for\x20'+fV+',\x20falling\x20back\x20to\x20latest\x20stable'),fT['find'](fX=>aN(aO(fX))==='latest')||(C['debug']('Latest\x20stable\x20release\x20not\x20found\x20for\x20'+fV+',\x20falling\x20back\x20to\x20latest\x20with\x20any\x20channel'),fT['at'](0x0)||null)):null);},aT=fT=>{const gO=gA;let [,fU='']=fT['split']('@'),fV=fT[gO(0x310)](fU?'@'+fU:'',''),fW=aN(i['version']),fX=!!fU;return{'name':fV,'preferredVersion':Number['isNaN'](parseInt(fU[0x0]??''))?'':fU,'preferredChannel':fX?aN(fU):fW,'appChannel':fW,'isExplicitSelection':fX,'allowFallback':!fX&&fW!=='latest'};},aU=async(fT,fU)=>{const gP=gA;C['info']('Fetching\x20bundle...'),C['debug'](fT);let fV=await fetch(fT);if(!fV['ok'])throw aM(aJ['ASSET_NOT_FOUND'],'Failed\x20to\x20download\x20extension\x20bundle:\x20'+fV[gP(0x26a)]+'\x20'+fV['statusText'],{'url':fT,'status':fV['status'],'statusText':fV['statusText']});let fW=fV[gP(0x261)]['get']('content-disposition')?.['split']('filename=')[0x1]?.['split'](';')[0x0]?.['replaceAll']('\x22',''),fX=N['basename'](fT),fY=fU||fW||fX,fZ=await fV['arrayBuffer'](),g0=N['join'](k,fY);return await R['writeFile'](g0,Buffer['from'](fZ)),await R['stat'](g0)['then'](g1=>{C['debug']('Bundle\x20downloaded\x20('+g1['size']/0x3e8+'\x20KB):\x20'+g0);})[gP(0x298)](()=>{const gQ=gP;C['error'](gQ(0x20e));}),g0;},aV=async(fT,fU)=>{const gR=gA;if(fT['startsWith']('npm:')||fT['startsWith']('@streamyx/'))throw aM(aJ[gR(0x21b)],'NPM\x20extension\x20sources\x20are\x20no\x20longer\x20supported',{'source':fT});let fV=fT,fW=fT,fX=N['dirname'](fT),fY=fX!=='.'&&await R['stat'](fX)['then'](()=>!0x0,()=>!0x1),fZ=fT['startsWith']('./')||fT[gR(0x2d0)]('../')||fT['startsWith']('/')||fT['startsWith']('~')||fY,g0=await R['stat'](fT)['then'](()=>!0x0,()=>!0x1),g1=fT[gR(0x2d0)]('https://'),g3=fT['startsWith']('gl:')||fT['startsWith']('gitlab:'),g4=fT['startsWith']('github:')||fT['startsWith']('gh:');if(fZ&&!g0&&!g1&&!g4&&!g3)throw C['warn']('Installed\x20extension\x20not\x20found:\x20'+fT),C['warn']('Run\x20\x27azot\x20list\x27\x20and\x20remove\x20the\x20extension\x20from\x20the\x20list.'),aM(aJ['SOURCE_NOT_FOUND'],'Installed\x20extension\x20source\x20not\x20found:\x20'+fT,{'source':fT});fT=fT['replace'](/^gl:/,'')[gR(0x310)](/^gitlab:/,'')['replace'](/^gh:/,'')['replace'](/^github:/,'');let g5=aT(fT),{name:g6}=g5;if(g1)fV=await aU(fT);else{if(g4){let [gc,gd]=g6['split']('/'),ge=gR(0x25a)+gc+'/'+gd+'/releases',gf=await fetch(ge)['then'](gk=>gk['json']());if(gf?.['message']&&!Array['isArray'](gf))throw aM(aJ['RELEASE_NOT_FOUND'],'GitHub\x20releases\x20request\x20failed:\x20'+gf['message'],{'source':g6,'provider':'github','apiMessage':gf['message']});let gg=Array['isArray'](gf)?gf:[],gh=aS(gg,g5,g6);if(!gh)throw g5[gR(0x2a4)]?aR(g5,gg,g6):aM(aJ[gR(0x254)],gR(0x208),{'source':g6,'provider':'github',...aQ(gg)});let gi=gh['assets']?.['find'](gk=>gk['name']['endsWith']('.tgz')||gk['name'][gR(0x2d3)]('.zip'));if(!gi)throw C['debug'](gh),aM(aJ[gR(0x2db)],'GitHub\x20release\x20asset\x20not\x20found',{'source':g6,'provider':'github','releaseTag':aO(gh)});let gj=gi['browser_download_url'];fV=await aU(gj);}else{if(!g0){let gk=fU?.['find'](go=>go['name']===g6),gl=gk?.['releases']||[],gm=aS(gl,g5,g6),gn=gm?.['assets']['find'](go=>go['name'][gR(0x2d3)]('.tgz'));if(gk&&!gm&&g5['isExplicitSelection'])throw aR(g5,gl,g6);if(gn)fV=await aU(gn['url'],gn['name']);else{let [go,gp=gR(0x304)]=g6['split']('/')['reverse'](),gq='https://gitlab.com/api/v4/projects/'+gp+'%2F'+go+'/releases',gr=await fetch(gq)['then'](gv=>gv['json']());if(gr?.['message']&&!Array['isArray'](gr))throw aM(aJ['RELEASE_NOT_FOUND'],'GitLab\x20releases\x20request\x20failed:\x20'+gr[gR(0x20f)],{'source':g6,'provider':'gitlab','apiMessage':gr[gR(0x20f)]});let gs=Array['isArray'](gr)?gr:[],gt=aS(gs,g5,g6);if(!gt)throw g5['isExplicitSelection']?aR(g5,gs,g6):aM(aJ['RELEASE_NOT_FOUND'],'GitLab\x20release\x20not\x20found',{'source':g6,'provider':'gitlab',...aQ(gs)});let gu=gt['assets']?.['links']?.[gR(0x32d)](gv=>gv['name']['endsWith']('.tgz'));if(!gu)throw aM(aJ['ASSET_NOT_FOUND'],'GitLab\x20release\x20asset\x20not\x20found',{'source':g6,'provider':'gitlab','releaseTag':aO(gt)});fV=await aU(gu[gR(0x312)]||gu[gR(0x2dd)],gu['name']);}}}}let g7=N['extname'](fV),g8=g7==='.zip',g9=g7==='.tgz',ga=new Set(['.js','.mjs',gR(0x249)])['has'](g7),gb=await R['stat'](fV)['then'](gv=>gv['isDirectory']())['catch'](()=>!0x1);if(ga?fW=N[gR(0x251)](fV):gb?fW=fV:(fW=fV['replace']('.tgz','')['replace']('.zip',''),await aB(fW)||await aE(fW)),g8||g9)aI['extract'](fV,fW),await aD(fV);else{if(!(ga||gb))throw aM(aJ['UNSUPPORTED_PACKAGE_TYPE'],'Unsupported\x20package\x20type',{'source':fT,'extensionSource':fV,'packageType':g7||'unknown'});}return fW;},aW='__matchRules',aX=fT=>typeof fT=='object'&&!!fT&&!Array['isArray'](fT),aY=fT=>{const gS=gA;let fU=fT['trim']()['match'](/^(\*|https?):\/\/([^/]+)(\/.*)$/i);if(!fU)return null;let [,fV,fW,fX]=fU,fY=fV['toLowerCase'](),fZ=fY==='*'?['http',gS(0x2f4)]:fY===gS(0x282)||fY==='https'?[fY]:null;if(!fZ)return null;let g0=fW['trim']()['toLowerCase'](),g1=!0x1,g3=[],g4=[];if(g0==='*')g1=!0x0;else{if(g0['startsWith']('*.')){let g7=g0['slice'](0x1);if(!g7['startsWith']('.')||g7['length']<=0x1)return null;g4=[g7];}else{if(!g0['includes']('*'))g3=[g0];else return null;}}if(!fX['startsWith']('/'))return null;let g5=fX['indexOf']('*');if(g5!==-0x1&&g5!==fX['length']-0x1)return null;let g6=g5===-0x1?fX:fX['slice'](0x0,-0x1);return{'schemes':fZ,'matchAnyHost':g1,'exactHosts':g3,'wildcardHostSuffixes':g4,'exactPaths':g5===-0x1?[g6]:void 0x0,'pathPrefixes':g5===-0x1?void 0x0:[g6]};},aZ=fT=>{if(!Array['isArray'](fT))return;let fU=fT['filter'](fV=>typeof fV=='string'&&!!fV['trim']())['map'](aY)['filter'](fV=>!!fV);return fU['length']?fU:void 0x0;},b0=(fT,fU)=>fU['matchAnyHost']||fU['exactHosts']['includes'](fT)||fU['wildcardHostSuffixes']['some'](fV=>fT['endsWith'](fV)),b1=(fT,fU)=>fU[gA(0x26c)]?.['includes'](fT)||!!fU['pathPrefixes']?.['some'](fV=>fT['startsWith'](fV))||!fU['exactPaths']?.['length']&&!fU[gA(0x2e1)]?.['length'],b2=({manifest:fT,packageJson:fU,fallbackName:fV})=>{const gT=gA;let fW=aX(fU?.['config'])?fU['config']:null,fX=(aX(fT)?fT:null)??fW??{},fY=typeof fX['name']=='string'&&fX['name']||typeof fX['title']=='string'&&fX['title']||fV,fZ={...fX,'name':fY,'title':typeof fX['title']=='string'&&fX['title']?fX[gT(0x218)]:fY};(typeof fZ['icon']!='string'||!fZ['icon'])&&delete fZ['icon'],(typeof fZ['tag']!='string'||!fZ['tag'])&&delete fZ['tag'],Array[gT(0x273)](fZ['permissions'])||delete fZ['permissions'],Array['isArray'](fZ['regions'])||delete fZ['regions'],typeof fZ['manifestVersion']!='number'&&delete fZ['manifestVersion'];let g0=aZ(fX['matches']);return g0?(fZ['matches']=Array['isArray'](fX['matches'])?fX['matches']['filter'](g1=>typeof g1=='string'):void 0x0,Object['defineProperty'](fZ,aW,{'value':g0,'enumerable':!0x1,'configurable':!0x1,'writable':!0x1})):delete fZ['matches'],fZ;},b3=async({dir:fT,packageJson:fU,fallbackName:fV})=>{let fW=join(fT,'manifest.json');return b2({'manifest':await aB(fW)?await aG(fW):null,'packageJson':fU,'fallbackName':fV});},b4=fT=>fT['manifest']?.[gA(0x2c0)]||fT['manifest']?.['title']||fT['package']?.['config']?.['title']||fT['package']?.['name']||fT['name']||gA(0x2c6),b5=fT=>fT['manifest']?.['tag']||fT['package']?.[gA(0x2d4)]?.['tag']||void 0x0,b6=(fT,fU)=>{let fV=fT['manifest']?.[aW];if(!Array['isArray'](fV)||!fV['length'])return!0x1;let fW=fU['protocol']['slice'](0x0,-0x1)['toLowerCase'](),fX=fU['hostname']['toLowerCase'](),fY=fU['pathname'];return fV['some'](fZ=>!(fZ['schemes']?.['length']&&!fZ['schemes']['includes'](fW)||!b0(fX,fZ)||!b1(fY,fZ)));},b7=fT=>{const gU=gA;let fU=fT['manifest']?.[aW];return Array[gU(0x273)](fU)&&fU['length']>0x0;},b8=fT=>fT&&'exports'in fT?fT['exports']:fT,b9=fT=>fT?.[gA(0x234)]?.[gA(0x2c0)]||gA(0x2c6),ba=fT=>{const gV=gA;let fU=b8(fT);return!fU||typeof fU!='object'?null:typeof fU['resolveEntries']=='function'?'v2':typeof fU['getMediaInfo']=='function'?'legacy-media':typeof fU['fetchContentMetadata']=='function'?gV(0x288):null;},bb=fT=>ba(fT)!==null,bc=fT=>{let fU=b8(fT);if(!fU||typeof fU!='object')throw Error('Invalid\x20extension\x20exports');return fU;},bd=async fT=>{const gW=gA;let fU=bc(fT),fV=b9(fT);try{if(typeof fU['setup']=='function'){await fU['setup']();return;}typeof fU['init']==gW(0x32c)&&await fU['init']();}catch(fW){let fX=typeof fU['setup']=='function'?'setup':'init',fY=fW instanceof Error?fW:Error(String(fW));throw C['error']('Extension\x20'+fV+'\x20'+fX+'\x20failed:\x20'+fY['message']),fY['stack']&&C['debug'](fY['stack']),fY;}},be=async(fT,fU)=>{const gX=gA;let fV=bc(fT),fW=b9(fT);try{if(typeof fV[gX(0x213)]?.['login']=='function'){await fV['auth']['login'](fU);return;}typeof fV['login']=='function'&&await fV['login'](fU);}catch(fX){let fY=typeof fV['auth']?.['login']=='function'?'auth.login':'login',fZ=fX instanceof Error?fX:Error(String(fX));throw C['error'](gX(0x25b)+fW+'\x20'+fY+'\x20failed:\x20'+fZ['message']),fZ['stack']&&C['debug'](fZ['stack']),fZ;}},bf=async fT=>{const gY=gA;let fU=bc(fT),fV=b9(fT);try{if(typeof fU['auth']?.['logout']=='function'){await fU['auth']['logout']();return;}typeof fU['logout']=='function'&&await fU['logout']();}catch(fW){let fX=typeof fU['auth']?.['logout']=='function'?'auth.logout':'logout',fY=fW instanceof Error?fW:Error(String(fW));throw C['error']('Extension\x20'+fV+'\x20'+fX+gY(0x2fb)+fY['message']),fY['stack']&&C['debug'](fY['stack']),fY;}},bg=async fT=>{const gZ=gA;let fU=bc(fT);typeof fU['hooks']?.[gZ(0x30b)]==gZ(0x32c)&&await fU['hooks']['beforeDownload']();},bh=async(fT,{skipMux:fU=!0x1}={})=>{const h0=gA;let fV=bc(fT),fW=b9(fT);if(!fU&&typeof fV[h0(0x205)]?.['afterMux']=='function')try{await fV['hooks'][h0(0x314)]();}catch(fX){let fY=fX instanceof Error?fX:Error(String(fX));C['error']('Extension\x20'+fW+'\x20hooks.afterMux\x20failed:\x20'+fY['message']),fY[h0(0x2a7)]&&C['debug'](fY['stack']);}if(typeof fV['onDownloadFinished']=='function')try{await fV['onDownloadFinished']();}catch(fZ){let g0=fZ instanceof Error?fZ:Error(String(fZ));C['error']('Extension\x20'+fW+'\x20onDownloadFinished\x20failed:\x20'+g0['message']),g0['stack']&&C['debug'](g0[h0(0x2a7)]);}},bi=async(fT,{context:fU,dirname:fV,skipValidation:fW})=>{const h1=gA;let fX=await A(fT,{'dirname':fV,'context':fU})['finally'](()=>{});if(!fX)return null;let fY='default'in fX[h1(0x328)]?fX['exports']['default']:fX[h1(0x328)];if(!fW&&!bb(fY))throw C['error']('Incompatible\x20extension\x20interface'),aM(aJ[h1(0x33e)],'Incompatible\x20extension\x20interface',{'extensionPath':fT});return fX['exports']=fY,fX;},bj=fT=>fT['split']('/')[gA(0x2f5)]()[0x0]['replaceAll']('@','')['replace']('extension-','')[gA(0x310)]('-extension',''),bk=async fT=>{const h2=gA;let fU=[join(fT,'package.json'),join(fT,'package','package.json')],fV;for(let g4 of fU)if(await aB(g4)){fV=g4;break;}let fW={},fX='',fY='',fZ='',g0=fT;if(fV){g0=dirname(fV),fW=await aG(fV)||{};let g5=fW['main']||'index.js';fX=join(g0,g5),fY=fW['name'],fZ=g0;}else{let g6=await aC(fT),g7=g6['find'](g8=>g8['name']==='index.js')||g6['find'](g8=>g8['name']==='main.js')||g6['find'](g8=>g8['name']==='service.js')||g6['find'](g8=>g8['name']==='extension.js')||g6['find'](g8=>g8['name']['endsWith']('.js'));g7&&(fX=join(fT,g7['name']),fY=parse(fX)[h2(0x2c0)]);}if(!fX)throw aM(aJ['IMPORT_INVALID'],'Extension\x20main\x20script\x20not\x20found:\x20'+fT,{'dir':fT});fZ||=dirname(fX);let g1=bj(fY),g3=await b3({'dir':g0,'packageJson':fW,'fallbackName':g1});return{'name':g1,'path':fX,'dir':fZ,'package':fW,'manifest':g3};},bl=async(fT,fU)=>{const h3=gA;try{let fV=await bk(fT),fW=b4(fV),fX=F({'name':fV['name'],'title':fW,'dir':K});await fX['cookieStore']['import'](join(K,fV['name'],'cookies.txt'));let fY=await bi(fV['path'],{'context':fX,'dirname':fV['dir']});if(!fY)throw aM(aJ['IMPORT_INVALID'],h3(0x2e8)+fV['path'],{'source':fU,'dir':fT,'path':fV['path']});return{'source':fU,'exports':fY['exports'],'context':fX,...fV};}catch(fZ){throw C['error']('Error\x20importing\x20module:\x20'+fZ['message']),C['debug'](fZ instanceof Error?fZ['stack']||fZ['message']:String(fZ)),fZ;}},bm=f;let bn=bm;const bo=fT=>fT['replace'](/\/+$/,''),bp=()=>bo(bn),bq=(fT,fU)=>{let fV=bo(fT);return fU?fV+'/'+(fU['startsWith']('/')?fU['slice'](0x1):fU):fV;},br=fT=>bq(bp(),fT);let bs=null;async function bt(fT){const h4=gA;if(!bs){C['debug']('Public\x20key\x20not\x20found');let g0=await bv();if(g0)C['debug']('Public\x20key\x20found:\x20'+g0['slice'](0x0,0x32)+h4(0x212));else return C['error']('Public\x20key\x20not\x20found\x20in\x20response'),!0x1;if(bs=await bw(g0)['catch'](()=>null),!bs)return C['error'](h4(0x329)),!0x1;}let fU=fT['headers']['get']('X-Signature-Timestamp'),fV=fT[h4(0x261)]['get']('X-Signature');if(!fU||!fV)return C['error']('Signature\x20headers\x20not\x20found'),!0x1;if(Date['now']()-parseInt(fU)>0x493e0)return!0x1;let fW=fU+':'+await fT['clone']()[h4(0x2df)](),fX=bx(fV),fY=new TextEncoder(),fZ=crypto['subtle']['verify']({'name':'ECDSA','hash':'SHA-256'},bs,fX,fY['encode'](fW));return fZ||(bs=null),fZ;}const bu=()=>atob(j);async function bv(fT='/auth/.well-known/public-key'){try{let fU=await fetch(''+bp()+fT);return fU['ok']?await fU['text']():bu();}catch(fV){return C['error'](fV['message']),bu();}}async function bw(fT){const h5=gA;let fU=bx(fT[h5(0x310)]('-----BEGIN\x20PUBLIC\x20KEY-----','')['replace']('-----END\x20PUBLIC\x20KEY-----','')['trim']());return crypto['subtle']['importKey']('spki',fU,{'name':'ECDSA','namedCurve':'P-256'},!0x0,['verify']);}function bx(fT){let fU=atob(fT),fV=new Uint8Array(fU['length']);for(let fW=0x0;fW<fU['length'];fW++)fV[fW]=fU['charCodeAt'](fW);return fV['buffer'];}const by=fT=>createAuthClient({'baseURL':fT+'/auth','plugins':[deviceAuthorizationClient(),tributeClient()],'fetchOptions':{'retry':0x0,'onSuccess':fU=>{let fV=fU['response']['headers']['get']('set-auth-token');fV&&(bK['accessToken']=fV,bL(bK));},'auth':{'type':'Bearer','token':()=>bK['accessToken']||bM()['then'](fU=>fU?.['accessToken'])},'onResponse':async fU=>await bt(fU['response'])['catch'](()=>!0x1)?(C['debug']('Response\x20verified:\x20'+fU['response']['url']),fU):(C['error']('Response\x20verification\x20failed:\x20'+fU['response']['status']+'\x20'+fU['response']['statusText']+'\x20'+fU['response']['url']),G['emit']('error',{'code':gA(0x2ed)}),new Response(JSON['stringify']({'error':gA(0x2ed),'message':gA(0x2fd)}),{'status':0x191,'statusText':'Unauthorized'}))}});let bz='',bA=by(bp());const bB=()=>{let fT=bp();return(!bA||bz!==fT)&&(bz=fT,bA=by(fT)),bA;},bC=async(fT,fU,fV={})=>{let {signal:fW,timeoutMs:fX=0x2710}=fV,fY=new AbortController(),fZ=()=>fY['abort'](fW?.['reason']);fW?.['addEventListener']('abort',fZ,{'once':!0x0});let g0=!0x1,g1=setTimeout(()=>{g0=!0x0,fY['abort'](Error('Request\x20timeout'));},fX);try{let g3=await fetch(fT,{...fU,'signal':fY['signal']});if(!g3['ok'])throw Error('Request\x20failed:\x20'+g3['status']);return g3['json']();}catch(g4){throw g0&&g4 instanceof DOMException&&g4['name']==='AbortError'?Error('Request\x20timed\x20out\x20after\x20'+fX+'ms',{'cause':g4}):g4;}finally{clearTimeout(g1),fW?.['removeEventListener']('abort',fZ);}},bD={'getExtensions':(fT,fU)=>bC(br(gA(0x293)),{'headers':fT?{'Authorization':'Bearer\x20'+fT}:void 0x0},{'signal':fU}),'getSubscriptions':(fT,fU)=>bC(br('subscriptions'),{'headers':{'Authorization':'Bearer\x20'+fT}},{'signal':fU})},bE=0x12c*0x3e8,bF=0x12c*0x3e8,bG=new QueryClient({'queryCache':new QueryCache(),'defaultOptions':{'queries':{'staleTime':bE,'gcTime':bF}}}),bH={'get':fT=>bG['getQueryData'](fT),'set':(fT,fU)=>bG['setQueryData'](fT,fU),'reset':fT=>{fT?bG['removeQueries']({'queryKey':fT}):bG['clear']();},'invalidate':fT=>bG['invalidateQueries']({'queryKey':fT}),'refresh':async(fT,fU)=>(bG['invalidateQueries']({'queryKey':fT}),bI({'queryKey':fT,'queryFn':fU}))},bI=async({queryKey:fT,queryFn:fU,staleTime:fV,enabled:fW=!0x0})=>{const h6=gA;try{let fX=bG['getQueryState'](fT),fY=fX?fX?.[h6(0x1c7)]||!fX?.[h6(0x27f)]&&!fX?.['errorUpdatedAt']||Date['now']()-fX['dataUpdatedAt']>(fV??bE):!0x0,fZ=()=>bH['reset'](fT),g0=()=>bH[h6(0x2bc)](fT),g1=()=>bH['refresh'](fT,fU);return fW?fX&&!fY?{'data':fX['data'],'reset':fZ,'invalidate':g0,'refresh':g1}:{'data':await bG['fetchQuery']({'queryKey':fT,'queryFn':fU,'staleTime':fV}),'reset':fZ,'invalidate':g0,'refresh':g1}:{'data':null,'reset':fZ,'invalidate':g0,'refresh':g1};}catch(g3){throw bG[h6(0x2d9)]({'queryKey':fT}),g3;}},bJ=new p(join(t,'session.json')),bK={'accessToken':'','tokenType':'','scope':'','createdAt':''},bL=async fT=>{const h7=gA;bJ['setItem']('access_token',fT['access_token']),bJ['setItem']('token_type',fT[h7(0x27b)]||'Bearer'),bJ['setItem'](h7(0x1c8),fT['scope']),bJ[h7(0x22c)]('created_at',new Date()['toISOString']()),bK['accessToken']=fT['access_token'],bK['tokenType']=fT['token_type']||'Bearer',bK['scope']=fT['scope'],bK['createdAt']=new Date()['toISOString']();},bM=async()=>{const h8=gA;let fT=bJ[h8(0x333)](h8(0x2a0)),fU=bJ['getItem']('token_type'),fV=bJ['getItem']('scope'),fW=bJ['getItem']('created_at');return!fT||!fU||!fV||!fW?null:{'accessToken':fT,'tokenType':fU,'scope':fV,'createdAt':new Date(fW)};},bN=async()=>{const h9=gA;let fT=await bI({'queryKey':['session',bp()],'queryFn':()=>bB()['getSession']()});return{'session':fT['data']?.['data']?.['session'],'user':fT['data']?.[h9(0x1d5)]?.['user'],'error':fT[h9(0x1d5)]?.['error']};},bO=async()=>{const ha=gA;let {user:fT,error:fU}=await bN(),fV=await bI({'queryKey':['subscriptions',bp()],'queryFn':async()=>bB()[ha(0x291)]['list'](),'enabled':!!fT?.['id']});return{'data':fV['data']?.['data'],'error':fV['data']?.['error']??fU};},bP=['lowConnectionsCount','oneDevice'],bQ=['mediumConnectionsCount','twoDevices',gA(0x24a),'decryption','customIcon','tags','parallelDownloads','userExtensions','portableBuild'],bR=['highConnectionsCount','threeDevices','customMuxFormat','customDecrypter','customDrmClient',gA(0x2e2)],bS={'basic':bP,'plus':bQ,'pro':[...bP,...bQ,...bR]},bT=()=>bI({'queryKey':['lava-subscriptions',bp()],'queryFn':async()=>{let fT=bK['accessToken']||(await bM())?.['accessToken'];return fT?bD['getSubscriptions'](fT):[];}}),bU=async()=>{let fT=await bO();return{'plan':(await bT())['data']?.[0x0]?.['productTitle']||fT['data']?.['find'](fU=>new Date(fU['expiresAt'])>new Date())?.['tributeSubscriptionName'],'error':fT['error']};},bV=async()=>{let {user:fT,session:fU}=await bN(),{plan:fV,error:fW}=await bU();return{'user':fT,'session':fU,'error':fW,'plan':fV,'grantedBenefits':fV?bS[fV['toLowerCase']()]??[]:[]};};var bW=a7((fT,fU)=>{const hb=gA;fU[hb(0x328)]={'instagram':{'create':fV=>{const hg=hb;let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{const hc=b;let g8=fX??Streamyx??{};g8&&(g8['defineExtension']||=gh=>gh);let g9=g8['defineExtension'];g8[hc(0x247)],g8['sleep'],g8[hc(0x2be)],g8['prompt'],g8['notify'],g8['confirm'],g8[hc(0x2eb)],g8['utils'];let ga=g8['Input'],gb=g8['UrlSource'];g8['ALL_FORMATS'],g8['DASH'],g8['DASH_FORMATS'],g8['HLS'],g8['HLS_FORMATS'],g8['MP4'],g8['MP3'];let gc={'Referer':'https://www.instagram.com/'},gd={'X-IG-App-ID':'936619743392459','User-Agent':'Mozilla/5.0\x20(Windows\x20NT\x2010.0;\x20Win64;\x20x64)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/107.0.0.0\x20Safari/537.36'},ge=async gh=>{const hd=hc;let gi=new URLSearchParams({'doc_id':hd(0x318),'variables':JSON['stringify']({'shortcode':gh,'child_comment_count':0x3,'fetch_comment_count':0x28,'parent_comment_count':0x18,'has_threaded_comments':!0x0})});try{let gj=await fY('https://www.instagram.com/graphql/query/?'+gi['toString'](),{'headers':gd});return gj['ok']?(await gj[hd(0x327)]())[hd(0x1d5)]?.['xdt_shortcode_media']??null:(g1['error'](hd(0x340)+gj['status']),null);}catch(gk){return g1['error']('Error\x20during\x20GraphQL\x20fetch:',gk),null;}},gf=async gh=>{try{let gi=await fY('https://www.instagram.com/p/'+gh+'/embed/captioned/',{'headers':{'User-Agent':gd['User-Agent']}});if(!gi['ok'])return null;let gj=(await gi['text']())['match'](/window\.__additionalDataLoaded\('extra',\s*({.+?})\s*\);/);return gj?.[0x1]?JSON['parse'](gj[0x1])['shortcode_media']??null:null;}catch(gk){return g1['error']('Error\x20during\x20embed\x20page\x20fetch:',gk),null;}},gg=gh=>{const he=hc;let gi=gh[he(0x274)]?.['edges']?.[0x0]?.['node']?.['text']||'Instagram\x20Post',gj=[],gk=gm=>{if(!gm)return;let gn=gm['is_video']&&gm['video_url']?gm['video_url']:gm['display_url'];gn&&gj['push']({'title':gi,'input':new ga({'source':new gb(gn,{'requestInit':{'headers':gc}})})});},gl=gh['edge_sidecar_to_children']?.[he(0x1c6)];if(gl?.['length']){for(let gm of gl)gk(gm['node']);}else gk(gh);return gj;};fW['exports']=g9({async 'resolveEntries'(gh){const hf=hc;let gi=new URLPattern({'pathname':'/:type(p|reel|tv|reels|videos)/:shortcode{/*}?','baseURL':new URL(gh)[hf(0x1c9)]})['exec'](gh)?.['pathname']['groups']['shortcode'];if(!gi)return g1['error']('Could\x20not\x20extract\x20a\x20valid\x20Instagram\x20shortcode\x20from\x20the\x20URL'),g1['debug'](gh),[];try{let gj=await ge(gi);return gj||=(g1['warn']('GraphQL\x20method\x20failed.\x20Falling\x20back\x20to\x20embed\x20page\x20scraping.'),await gf(gi)),gj?gg(gj):(g1[hf(0x23a)]('All\x20extraction\x20methods\x20failed.\x20The\x20post\x20may\x20be\x20private,\x20deleted,\x20or\x20require\x20a\x20login.'),[]);}catch(gk){return g1['error']('A\x20critical\x20error\x20occurred\x20while\x20fetching\x20Instagram\x20metadata:',gk),[];}}});})(fV['Azot'],fV['fetch'],fV['localStorage'],fV['cookieStore'],fV['console'],fV['prompt'],fV['alert'],fV['document'],fV[hg(0x203)],fV[hg(0x1d3)]),fW['exports']['default']||fW[hg(0x328)];},'manifest':{'manifestVersion':0x1,'name':'Instagram','icon':hb(0x245),'matches':['https://instagram.com/*','https://*.instagram.com/*']},'pkg':{'name':'instagram','version':'0.0.1','private':!0x0,'keywords':['social-networks'],'homepage':'https://instagram.com/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'instagram.ts'}},'ntv':{'create':fV=>{const hl=hb;let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{const hk=b;let g8=fX??Streamyx??{};g8&&(g8['defineExtension']||=gh=>gh);let g9=g8['defineExtension'];g8['version'],g8['sleep'],g8['input'],g8['prompt'],g8['notify'],g8['confirm'],g8['ask'],g8['utils'];let ga=g8['Input'],gb=g8['UrlSource'];g8['ALL_FORMATS'],g8['DASH'],g8['DASH_FORMATS'],g8['HLS'],g8['HLS_FORMATS'],g8['MP4'],g8['MP3'];let gc=(gh,gi,gj)=>gh['split'](gi)[0x1]?.['split'](gj)[0x0],gd=(gh,gi)=>{let gj=gc(gh,'<'+gi+'>','</'+gi+'>')?.['trim']();if(!gj)return;let gk=gj['match'](/<!\[CDATA\[(.*?)\]\]>/s);return gk?.[0x1]?gk[0x1]['trim']():gj['split']('DATA[')[0x1]?.['split'](']')[0x0]?.['trim']()||gj;},ge=async(gh,gi)=>{const hh=b;let gj=await fY(gh);return gj['ok']?await gj[hh(0x2df)]():(g1['error'](hh(0x1f8)+gi+'.\x20Status:\x20'+gj[hh(0x26a)]+'\x20'+gj['statusText']),null);},gf=async(gh,gi,gj)=>{const hi=b;let gk=new URL(gh)['pathname'],gl=new Set();for(let gn of gi['split']('href=\x22/serial')){if(!gn['startsWith']('/'))continue;let go=gn['split']('\x22')[0x0];!go||go['length']<=0x1||go['includes']('/issues/')||go['includes']('/about/')||go['split']('/')['length']<=0x2||gl['add'](gh['replace'](gk,hi(0x226)+go));}let gm=[];for(let gp of gl)gm['push'](...await gg(gp,gj));return gm;},gg=async(gh,gi=new Set())=>{const hj=b;if(gi['has'](gh))return[];gi['add'](gh);let gj=await ge(gh,hj(0x211));if(!gj)return[];let gk=gc(gj,'<meta\x20property=\x22ya:ovs:feed_url\x22\x20content=\x22','\x22>')??gc(gj,'<meta\x20property=\x22ya:ovs:feed_url\x22\x20content=\x22','\x22\x20/>');if(!gk)return new URL(gh)['pathname']['includes']('/serial')?gf(gh,gj,gi):(g1['error']('Could\x20not\x20find\x20video\x20link\x20in\x20the\x20page.'),[]);let gl=gk['split']('video/')[0x1]?.['split']('/')[0x0];if(!gl)return g1['error']('Could\x20not\x20parse\x20NTV\x20video\x20id.'),[];let gm=await ge('https://www.ntv.ru/vi'+gl+'/','NTV\x20XML\x20metadata');if(!gm)return[];let gn=gd(gm,'dash')||gd(gm,'hls'),go=gd(gm,'file')||gd(gm,'video'),gp=gd(gm,'hifile')||gd(gm,'hd_video')||gn||go;if(!gp)return g1['error']('Could\x20not\x20resolve\x20NTV\x20media\x20URL.'),[];let gq=gc(gm,'<embed_tag>','</embed_tag>')||'NTV',gr=gc(gj,'\x22name\x22:\x22','\x22'),gs=gr?.['includes']('серия')?gr['split']('-')[0x0]:void 0x0,gt=gs?parseInt(gs,0xa):void 0x0,gu=gc(gm,'<subtitles>','</subtitles>'),gv=gu?'https://www.ntv.ru'+gu:void 0x0;gv&&g1['debug']('Subtitles:\x20'+gv);let gw=new ga({'source':new gb(gp)});return gv&&gw['addSubtitleTrack'](new gb(gv),{'languageCode':'ru','name':'Russian'}),[{'type':gt?'episode':'video','title':gq,'season':gt?0x1:void 0x0,'episode':gt,'input':gw}];};fW[hk(0x328)]=g9({'resolveEntries'(gh){return gg(gh,new Set());}});})(fV['Azot'],fV[hl(0x301)],fV['localStorage'],fV['cookieStore'],fV['console'],fV['prompt'],fV['alert'],fV['document'],fV['navigator'],fV['window']),fW['exports']['default']||fW['exports'];},'manifest':{'manifestVersion':0x1,'name':'НТВ','icon':'https://static.ntv.ru/static/images/logo.png','matches':['https://ntv.ru/*','https://*.ntv.ru/*']},'pkg':{'name':'ntv','version':hb(0x284),'private':!0x0,'keywords':['tv-channels'],'homepage':hb(0x252),'author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':hb(0x240),'email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'ntv.ts'}},'rbc':{'create':fV=>{const ho=hb;let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{const hm=b;let g8=fX??Streamyx??{};g8&&(g8[hm(0x216)]||=gc=>gc);let g9=g8['defineExtension'];g8['version'],g8['sleep'],g8['input'],g8['prompt'],g8['notify'],g8['confirm'],g8['ask'],g8['utils'];let ga=g8['Input'],gb=g8['UrlSource'];g8['ALL_FORMATS'],g8['DASH'],g8['DASH_FORMATS'],g8['HLS'],g8[hm(0x2c1)],g8['MP4'],g8['MP3'],fW['exports']=g9({async 'resolveEntries'(gc){const hn=hm;let gd=await fY(gc);if(!gd['ok'])throw Error('Failed\x20to\x20fetch\x20RBC\x20page:\x20'+gd['status']+'\x20'+gd['statusText']);let ge=(await gd['text']())['match'](/(?:https?:)?\/\/[^\s"'<>]+\.m3u8(?:\?[^\s"'<>]*)?/i)?.[0x0];if(!ge)throw Error(hn(0x30c));return[{'type':'video','input':new ga({'source':new gb(ge['startsWith']('//')?'https:'+ge:ge)})}];}});})(fV['Azot'],fV['fetch'],fV['localStorage'],fV['cookieStore'],fV['console'],fV['prompt'],fV['alert'],fV[ho(0x23e)],fV['navigator'],fV['window']),fW['exports'][ho(0x222)]||fW['exports'];},'manifest':{'manifestVersion':0x1,'name':'РБК','icon':'https://static.rustore.ru/imgproxy/A-G-s2Q1x2iqq3qHCAo66-nllrtlqEr7XNU_JKXt4mQ/preset:web_app_icon_160/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS80MGViMWY3MS1kMDkzLTQ2NDMtOTkyNi0xZWM0ZjkwNzViMTQ=.webp','matches':['https://rbc.ru/*','https://*.rbc.ru/*']},'pkg':{'name':'rbc','version':'0.0.2','private':!0x0,'keywords':['news'],'homepage':'https://rbc.ru/','author':{'name':hb(0x2c3),'url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'rbc.ts'}},'rutube':{'create':fV=>{let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{const hp=b;let g8=fX??Streamyx??{};g8&&(g8[hp(0x216)]||=gf=>gf);let g9=g8['defineExtension'];g8['version'],g8['sleep'],g8['input'],g8['prompt'],g8['notify'],g8['confirm'],g8[hp(0x2eb)],g8['utils'];let ga=g8['Input'],gb=g8['UrlSource'];g8['ALL_FORMATS'],g8[hp(0x2e3)],g8[hp(0x2d7)],g8['HLS'],g8['HLS_FORMATS'],g8['MP4'],g8[hp(0x24b)];let gc=['/video/:id{/}?','/play/embed/:id{/}?','/shorts/:id{/}?','/yappy/:yappyId{/}?','/video/private/:id{/}?'],gd=gf=>{const hq=hp;let gg={'yappyId':'','id':'','key':''};gg['key']=new URL(gf)['searchParams']['get']('p')??'';for(let gh of gc){let gi=new URLPattern(gh,'https://rutube.ru')['exec'](gf);gi&&(Object['assign'](gg,gi[hq(0x2aa)]['groups']),Object['assign'](gg,gi['search']['groups']));}return gg;},ge=async gf=>{const hr=hp;let gg=(await fY('https://rutube.ru/pangolin/api/web/yappy/yappypage/?client=wdp&videoId='+gf+'&page=1&page_size=15')['then'](gh=>gh['json']())['catch'](()=>null))?.['results']?.['find'](gh=>String(gh['id'])===gf)?.['link'];return gg?[{'type':'video','title':'rutube_yappy_'+gf,'input':new ga({'source':new gb(gg)})}]:(g1['error'](hr(0x2f8)),[]);};fW[hp(0x328)]=g9({async 'resolveEntries'(gf){const hs=hp;let gg=gd(gf);if(gg['yappyId'])return ge(gg['yappyId']);if(!gg['id'])return g1['error']('Could\x20not\x20extract\x20Rutube\x20video\x20id'),[];let gh=new URL('https://rutube.ru/api/play/options/'+gg['id']+hs(0x23d));gg['key']&&gh['searchParams']['set']('p',gg['key']);let gi=await fY(gh)['then'](gj=>gj['json']())['catch'](gj=>(gj instanceof Error&&g1[hs(0x1e2)](gj['message']),null));return gi?gi['detail']||!gi['video_balancer']?.['m3u8']?(g1['error']('Play\x20info\x20is\x20empty'),[]):gi['live_streams']?.['hls']?(g1['error']('Live\x20videos\x20are\x20not\x20supported'),[]):[{'type':'video','title':gi['title']?.[hs(0x28f)]()||'rutube_'+gg['id'],'input':new ga({'source':new gb(gi['video_balancer']['m3u8'])})}]:(g1['error']('Cannot\x20fetch\x20play\x20info'),[]);}});})(fV['Azot'],fV['fetch'],fV['localStorage'],fV['cookieStore'],fV['console'],fV['prompt'],fV['alert'],fV['document'],fV['navigator'],fV['window']),fW['exports']['default']||fW['exports'];},'manifest':{'manifestVersion':0x1,'name':'RUTUBE','icon':'https://static.rustore.ru/imgproxy/vcyBc0LG-3ybXcGs_-_OJXH9ULjoegHlLs-DacemG08/preset:app_card_icon/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS9hcGsvMjQ2MjA3L2NvbnRlbnQvSUNPTi9hNTZhZWJlMy01NjVhLTRiZjYtOTQyZC0xZjE0OTk0YjlhNmUucG5n.webp','matches':['https://rutube.ru/*','https://*.rutube.ru/*']},'pkg':{'name':'rutube','version':'0.0.13','private':!0x0,'keywords':[hb(0x299)],'homepage':'https://rutube.ru/','author':{'name':'Azot','url':hb(0x264)},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':hb(0x1f7)}],'type':'module','main':'rutube.ts'}},'soundcloud':{'create':fV=>{const hw=hb;let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{const ht=b;let g8=fX??Streamyx??{};g8&&(g8['defineExtension']||=gg=>gg);let g9=g8['defineExtension'];g8['version'],g8[ht(0x33f)],g8['input'],g8['prompt'],g8['notify'],g8['confirm'],g8['ask'];let ga=g8['utils'],gb=g8['Input'],gc=g8['UrlSource'];g8['ALL_FORMATS'],g8['DASH'],g8['DASH_FORMATS'],g8['HLS'],g8['HLS_FORMATS'],g8['MP4'],g8['MP3'];let gd={'version':'','id':''},ge=async()=>{const hu=ht;try{let gg=await fY('https://soundcloud.com/')['then'](gj=>gj[hu(0x2df)]())['catch'](gj=>{let gk=gj instanceof Error&&gj['cause']!=null?String(gj['cause']):'';return gj instanceof Error&&gk['includes']('ECONNRESET')&&g1['warn']('Soundcloud\x20may\x20be\x20blocked\x20in\x20your\x20region.\x20Use\x20proxy\x20or\x20VPN\x20to\x20bypass\x20restrictions.'),'';}),gh=gg['match'](/window\.__sc_version="([0-9]{10})"/)?.[0x1];if(gh&&gd['version']===gh)return gd['id'];let gi='';for(let gj of gg[hu(0x32e)](/<script.+src="(.+)">/g)){let gk=gj[0x1];if(!gk?.['startsWith']('https://a-v2.sndcdn.com/'))continue;let gl=(await fY(gk)['then'](gm=>gm['text']())['catch'](()=>''))['match'](/\("client_id=[A-Za-z0-9]{32}"\)/)?.[0x0]['match'](/[A-Za-z0-9]{32}/)?.[0x0];if(gl){gi=gl;break;}}return gh&&(gd['version']=gh,gd['id']=gi),gi;}catch{return'';}},gf=gg=>gg['audioCodecs']?.['some'](gh=>gh==='aac'||gh==='mp3')??!0x1;fW['exports']=g9({async 'resolveEntries'(gg,gh){const hv=ht;let {author:gi,song:gj,accessKey:gk,shortLink:gl}=ga['execUrlPatterns'](gg,[':author/:song/s-:accessKey',':author/:song',':shortLink'],['https://soundcloud.com','https://on.soundcloud.com'])['pathname'],gm=await ge();if(!gm)throw Error(hv(0x28a));let gn;if(new URL(gg)['hostname']==='on.soundcloud.com'&&gl&&(gn=await fY('https://on.soundcloud.com/'+gl+'/',{'redirect':'manual'})['then'](gu=>{let gv=gu['headers']['get']('location');if(gu['status']===0x12e&&gv?.['startsWith']('https://soundcloud.com/'))return gv['split']('?',0x1)[0x0];})['catch'](()=>void 0x0)),!gn&&gi&&gj&&(gn=hv(0x1e9)+gi+'/'+gj+(gk?'/s-'+gk:'')),!gn)throw Error('Could\x20not\x20fetch');let go=await fY('https://api-v2.soundcloud.com/resolve?url='+gn+'&client_id='+gm)['then'](gu=>gu[hv(0x26a)]===0xc8?gu['json']():null)['catch'](()=>null);if(!go)throw Error('Could\x20not\x20fetch');let gp=go['media']?.['transcodings'];if(!gp?.['length'])throw Error('Empty\x20download');let gq=gp[hv(0x32d)](gu=>gu['preset']==='opus_0_0'),gr=gp['find'](gu=>gu['preset']==='mp3_0_0');if(gr&&(gf(gh)||!gq)&&(gq=gr),!gq)throw Error('Empty\x20download');let gs=''+gq['url']+(gq['url']['includes']('?')?'&':'?')+'client_id='+gm+'&track_authorization='+go['track_authorization'];if(!gs['startsWith']('https://api-v2.soundcloud.com/media/soundcloud:tracks:'))throw Error('Empty\x20download');let gt=await fY(gs)[hv(0x244)](async gu=>(await gu['json']())['url']??'')['catch'](()=>'');if(!gt)throw Error('Could\x20not\x20fetch');return[{'type':hv(0x1f1),'title':go['title']['trim'](),'author':go['user']['username']['trim'](),'input':new gb({'source':new gc(gt)})}];}});})(fV['Azot'],fV['fetch'],fV['localStorage'],fV['cookieStore'],fV['console'],fV['prompt'],fV['alert'],fV[hw(0x23e)],fV['navigator'],fV['window']),fW['exports']['default']||fW['exports'];},'manifest':{'manifestVersion':0x1,'name':'SoundCloud','icon':hb(0x321),'matches':['https://soundcloud.com/*','https://*.soundcloud.com/*']},'pkg':{'name':'soundcloud','version':'0.0.6','private':!0x0,'keywords':['music'],'homepage':hb(0x1e9),'author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':hb(0x240),'email':hb(0x29d),'url':'https://github.com/vitalygashkov'}],'type':'module','main':'soundcloud.ts'}},'tiktok':{'create':fV=>{const hz=hb;let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{const hx=b;let g8=fX??Streamyx??{};g8&&(g8['defineExtension']||=gc=>gc);let g9=g8['defineExtension'];g8['version'],g8['sleep'],g8['input'],g8['prompt'],g8['notify'],g8['confirm'],g8['ask'],g8[hx(0x1e1)];let ga=g8['Input'],gb=g8['UrlSource'];g8['ALL_FORMATS'],g8['DASH'],g8[hx(0x2d7)],g8['HLS'],g8['HLS_FORMATS'],g8['MP4'],g8[hx(0x24b)],fW['exports']=g9({async 'resolveEntries'(gc){const hy=hx;let gd=await fY(gc);if(!gd['ok'])return g1['error']('Failed\x20to\x20fetch\x20TikTok\x20page.\x20Status:\x20'+gd['status']),[];let ge=(await gd['text']())['split']('<script\x20id=\x22__UNIVERSAL_DATA_FOR_REHYDRATION__\x22\x20type=\x22application/json\x22>')[0x1]?.['split']('</script>')[0x0];if(!ge)return g1['error']('Could\x20not\x20find\x20target\x20script\x20tag.\x20TikTok\x20might\x20have\x20updated\x20their\x20page\x20structure.'),[];let gf;try{gf=JSON['parse'](ge);}catch(gj){return g1['error'](hy(0x1f6),gj,{'url':gc}),[];}let gg=gf['__DEFAULT_SCOPE__']?.['webapp.video-detail'],gh=gg?.['itemInfo']?.['itemStruct'];if(!gh)return g1['error']('Could\x20not\x20find\x20video\x20data\x20in\x20the\x20JSON\x20payload.\x20The\x20content\x20might\x20be\x20unavailable\x20or\x20the\x20structure\x20has\x20changed.'),gg?.['statusMsg']&&g1['error']('Error\x20'+gg['statusCode']+':\x20'+gg[hy(0x221)]),[];let gi=gh['video']?.[hy(0x27e)];return gi?[{'type':'video','title':gh['desc']||'TikTok\x20Video','input':new ga({'source':new gb(gi,{'requestInit':{'headers':{'Referer':'https://www.tiktok.com/','Cookie':g5['cookie']}}})})}]:(g1['error']('Could\x20not\x20find\x20a\x20video\x20URL\x20(playAddr)\x20in\x20the\x20JSON\x20payload.'),[]);}});})(fV['Azot'],fV['fetch'],fV['localStorage'],fV['cookieStore'],fV['console'],fV['prompt'],fV['alert'],fV['document'],fV['navigator'],fV[hz(0x1d3)]),fW['exports']['default']||fW['exports'];},'manifest':{'manifestVersion':0x1,'name':'TikTok','tag':'TT','icon':'https://play-lh.googleusercontent.com/LdBITldj-tJxqLm-CsWSbnt4BMo2gk53cgM7mWIL-zn44m1ywLyQgxRsHKqp8r0qceXs=w480-h960-rw','permissions':[],'matches':['https://tiktok.com/*','https://*.tiktok.com/*']},'pkg':{'name':'tiktok','version':'0.0.2','private':!0x0,'keywords':['social-networks'],'homepage':'https://www.tiktok.com/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':hb(0x1d9),'main':'tiktok.ts'}},'virtualroom':{'create':fV=>{const hC=hb;let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{const hA=b;let g8=fX??Streamyx??{};g8&&(g8['defineExtension']||=gc=>gc);let g9=g8['defineExtension'];g8['version'],g8['sleep'],g8['input'],g8[hA(0x1de)],g8[hA(0x2ac)],g8['confirm'],g8[hA(0x2eb)],g8[hA(0x1e1)];let ga=g8['Input'],gb=g8['UrlSource'];g8['ALL_FORMATS'],g8['DASH'],g8['DASH_FORMATS'],g8['HLS'],g8['HLS_FORMATS'],g8['MP4'],g8['MP3'],fW['exports']=g9({async 'resolveEntries'(gc){const hB=hA;let gd=new URL(gc)[hB(0x232)]['get']('recordId');if(!gd)return g1['error']('Could\x20not\x20extract\x20VirtualRoom\x20recordId.'),[];let ge=await fY('https://mv1.virtualroom.ru/vr/player/records/'+gd+hB(0x1da))['then'](gh=>gh['ok']?gh['json']():null)['catch'](()=>null),gf=await fY(hB(0x30f)+gd+'/events')['then'](gh=>gh['ok']?gh['json']():null)['catch'](()=>null),gg=ge?.['data']?.['roomParameters']?.['name']??'VirtualRoom';return(gf?.['data']?.['translations']??[])['filter'](gh=>!!gh['url'])['map'](gh=>({'title':[gg,gh['type'],gh['source'],gh['start']]['filter'](Boolean)['join']('\x20'),'input':new ga({'source':new gb(gh['url'])})}));}});})(fV[hC(0x2c3)],fV[hC(0x301)],fV['localStorage'],fV['cookieStore'],fV['console'],fV['prompt'],fV['alert'],fV[hC(0x23e)],fV['navigator'],fV['window']),fW['exports']['default']||fW['exports'];},'manifest':{'manifestVersion':0x1,'name':'VirtualRoom','icon':'https://sun9-50.userapi.com/impg/rY5N7sdA93TFdjkeYqPTnPIjvCJ0rALo_V7V8g/zLAaAv0PpvY.jpg?size=400x400&quality=95&sign=5ddcd6358131b204b8619cb8eeff943f&type=album','matches':['https://virtualroom.ru/*','https://*.virtualroom.ru/*']},'pkg':{'name':'virtualroom','version':'0.0.7','private':!0x0,'keywords':['videotelephony'],'homepage':'https://virtualroom.ru/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'virtualroom.ts'}},'vk':{'create':fV=>{const hF=hb;let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{const hD=b;let g8=fX??Streamyx??{};g8&&(g8['defineExtension']||=gg=>gg);let g9=g8['defineExtension'];g8[hD(0x247)],g8['sleep'],g8['input'],g8['prompt'],g8['notify'],g8['confirm'],g8['ask'],g8['utils'];let ga=g8['Input'],gb=g8['UrlSource'];g8['ALL_FORMATS'],g8['DASH'],g8['DASH_FORMATS'],g8['HLS'],g8[hD(0x2c1)],g8['MP4'],g8['MP3'];let gc=['2160','1440',hD(0x295),'720',hD(0x278),'360',hD(0x259),'144'],gd=gg=>{let gh=gg['match'](/video-(\d+)_(\d+)/);return gh?{'ownerId':gh[0x1],'videoId':gh[0x2]}:null;},ge=gg=>{if(!gg)return null;for(let gh of gg)if(Array['isArray'](gh)){for(let gi of gh)if(gi&&typeof gi=='object'&&'player'in gi)return gi;}return null;},gf=(gg,gh)=>{let gi=gh['videoQuality']?.['replace']('p','')['trim'](),gj=gc['filter'](gk=>!!gg['url'+gk]);return gj['length']?gi&&gj['includes'](gi)?gi:gj[0x0]:null;};fW['exports']=g9({async 'resolveEntries'(gg,gh){const hE=hD;let gi=gd(gg);if(!gi)return g1['error']('Could\x20not\x20extract\x20VK\x20video\x20identifiers'),[];let gj=await fY('https://vkvideo.ru/al_video.php?act=show',{'method':'POST','headers':{'content-type':'application/x-www-form-urlencoded;\x20charset=utf-8','accept':'*/*','accept-language':'ru-RU,ru;q=0.9','sec-ch-ua':'\x22Chromium\x22;v=\x22130\x22,\x20\x22Google\x20Chrome\x22;v=\x22130\x22,\x20\x22Not?A_Brand\x22;v=\x2299\x22','sec-ch-ua-mobile':'?0','sec-ch-ua-platform':'\x22macOS\x22','sec-fetch-dest':'empty','sec-fetch-mode':'cors','sec-fetch-site':'same-origin','x-requested-with':'XMLHttpRequest','Referer':gg,'Referrer-Policy':'strict-origin-when-cross-origin'},'body':new URLSearchParams({'al':'1','autoplay':'1','claim':'','force_no_repeat':'true','is_video_page':'true','list':'','module':'direct','t':'','video':'-'+gi['ownerId']+'_'+gi['videoId']})['toString']()});if(!gj['ok'])throw Error('VK\x20request\x20failed:\x20'+gj['status']+'\x20'+gj['statusText']);let gk=ge((await gj['json']())['payload']),gl=gk?.[hE(0x292)]?.['params'],gm=gl&&gl['length']>0x0?gl[0x0]:void 0x0;if(!gk||!gm)return g1['error']('Could\x20not\x20find\x20VK\x20player\x20payload'),[];if(gk['mvData']?.['is_active_live']===0x1||gk['mvData']?.['is_active_live']==='1')return g1['error']('Live\x20videos\x20are\x20not\x20supported'),[];let gn=gf(gm,gh),go=gn?gm['url'+gn]:void 0x0,gp=gm['dash_sep']||go;return gp?[{'type':'video','title':[gm['md_title']?.[hE(0x28f)](),gm['md_author']?.['trim']()]['filter'](Boolean)['join']('\x20'),'input':new ga({'source':new gb(gp,{'requestInit':{'headers':{'Referer':gg,'Cookie':g5['cookie']}}})})}]:(g1['error']('Could\x20not\x20find\x20video\x20URL'),[]);}});})(fV['Azot'],fV['fetch'],fV['localStorage'],fV[hF(0x30a)],fV['console'],fV['prompt'],fV['alert'],fV[hF(0x23e)],fV['navigator'],fV[hF(0x1d3)]),fW['exports']['default']||fW['exports'];},'manifest':{'manifestVersion':0x1,'name':'VK','icon':'https://static.rustore.ru/imgproxy/kSjDiz_MKxD_jzwgEqqaIjQZTE-NEP1Xt8HtJT7EU4s/preset:app_card_icon/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS9hcGsvMjAyNzgyMzI5NS9jb250ZW50L0lDT04vOTc0ODYwMTgtNTc4NS00MjRkLTljYWItNGZlNDk2ZDI3Yzc2LnBuZw==.webp','matches':['https://vk.com/*',hb(0x1e7),'https://vkvideo.ru/*','https://*.vkvideo.ru/*']},'pkg':{'name':'vk','version':'0.0.8','private':!0x0,'keywords':['video-hostings'],'homepage':'https://vkvideo.ru/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'vk.ts'}},'weibo':{'create':fV=>{const hH=hb;let fW={'exports':{}};return((fX,fY,fZ,g0,g1,g3,g4,g5,g6,g7)=>{let g8=fX??Streamyx??{};g8&&(g8['defineExtension']||=gd=>gd);let g9=g8['defineExtension'];g8['version'],g8['sleep'],g8['input'],g8['prompt'],g8['notify'],g8['confirm'],g8['ask'];let ga=g8['utils'],gb=g8['Input'],gc=g8['UrlSource'];g8['ALL_FORMATS'],g8['DASH'],g8['DASH_FORMATS'],g8['HLS'],g8['HLS_FORMATS'],g8['MP4'],g8['MP3'],fW['exports']=g9({async 'resolveEntries'(gd){const hG=b;let ge=ga['execUrlPatterns'](gd,['/:userId(\x5cd+)/:bid','/detail/:mid'],['https://weibo.com/','https://m.weibo.cn']),gf=ge[hG(0x2aa)]['bid']||ge['pathname']['mid'];if(!gf)return[];let gg=await fY('https://m.weibo.cn/statuses/show?id='+gf,{'credentials':'include','referrer':'https://m.weibo.cn/status/'+(ge['pathname']['bid']??gf)+'?jumpfrom=weibocom','method':'GET','mode':'cors'})['then'](gk=>gk['json']())['catch'](()=>null);if(!gg?.[hG(0x1d5)])return g1['error']('Could\x20not\x20resolve\x20Weibo\x20post\x20metadata'),[];let gh=[],gi=gg['data']['pics'],gj=gg['data']['page_info'];if(gi?.['length']){for(let gk of gi['filter'](gl=>gl['type']==='video'||gl[hG(0x26e)]==='livephoto'))gk['videoSrc']&&gh['push']({'type':'video','title':gk['pid'],'input':new gb({'source':new gc(gk['videoSrc'])})});}else{if(gj?.['type']==='video'){let gl=Object['values'](gj['urls']??{})[0x0],gm=gj['media_info']?.['stream_url_hd']||gj[hG(0x281)]?.['stream_url'],gn=gl||gm;gn&&gh['push']({'type':'video','title':gj['title']||gj['page_title'],'input':new gb({'source':new gc(gn)})});}}return gh;}});})(fV[hH(0x2c3)],fV['fetch'],fV['localStorage'],fV['cookieStore'],fV[hH(0x2b2)],fV['prompt'],fV['alert'],fV['document'],fV['navigator'],fV['window']),fW['exports']['default']||fW['exports'];},'manifest':{'manifestVersion':0x1,'name':hb(0x2cc),'icon':hb(0x303),'matches':['https://weibo.com/*',hb(0x1d7),'https://weibo.cn/*','https://*.weibo.cn/*']},'pkg':{'name':'weibo','version':'0.0.6','private':!0x0,'keywords':['social-networks'],'homepage':'https://weibo.com/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'weibo.ts'}}};}),bX=a9(bW(),0x1);const bY=fT=>({'name':fT['name'],'source':fT['source'],'dir':fT[gA(0x269)],'path':fT[gA(0x231)],'package':fT['package'],'manifest':fT[gA(0x2e7)],'installedAt':fT['installedAt']||new Date()['toISOString']()});var bZ=class gx extends T{['extensions']=new Map();['extensionDirs'];['indexPath'];[gA(0x29e)]=[];constructor({dirs:fT,indexPath:fU}={}){const hI=gA;super(),this['extensionDirs']=fT??[process['cwd']()],this['indexPath']=fU??M['join'](process[hI(0x2b7)](),'index.json');}async['init'](){return await this['ensureValidIndexPath'](),await this['loadInfo'](),this;}async['loadInfo'](){return this['infoList']=await aG(this['indexPath'])['catch'](()=>[]),this['infoList'];}async['saveInfo'](){return await this['ensureValidIndexPath'](),await aH(this['indexPath'],this['infoList']);}async['ensureValidIndexPath'](){const hJ=gA;(await Q['stat'](this['indexPath'])['catch'](()=>null))?.['isDirectory']()&&(C['warn']('Invalid\x20extensions\x20index\x20path\x20repaired:\x20'+this['indexPath']),await aD(this[hJ(0x316)]),await Q[hJ(0x2d1)](this['indexPath'],'[]','utf8'));}static async['getAvailableExtensions'](){try{return(await bD['getExtensions'](bK['accessToken'],AbortSignal['timeout'](0x1f40)))['data'];}catch(fT){return C['warn']('Failed\x20to\x20fetch\x20extensions\x20catalog:\x20'+(fT instanceof Error?fT['message']:String(fT))),[];}}async['discover'](){for(let fT of this['extensionDirs']){C['debug']('Loading\x20extensions\x20from\x20'+fT);let fU=await Q['readdir'](fT,{'withFileTypes':!0x0})['catch'](()=>[]);for(let fV of fU)if(fV['isDirectory']()){let fW=M['join'](fT,fV['name']);if(await Q['readdir'](fW)['then'](fX=>fX['filter'](fY=>!fY['startsWith']('.')))['then'](fX=>!fX['length']))continue;await this['loadExtension'](fW);}}for(let fX of this['infoList'])this['extensionDirs']['some'](fY=>fX['dir']?.['includes'](fY))||!fX['dir']||(C['debug']('Loading\x20dev\x20extension\x20from\x20'+fX['dir']),await this['loadExtension'](fX['dir']));}async #e(fT,fU){const fV=await Q['readFile'](fT,'utf8'),{Azot:fW,fetch:fX,console:fY,localStorage:fZ,cookieStore:g0,window:g1,document:g3,navigator:g4}=fU,g5={'exports':{}};eval('(()\x20=>\x20{'+fV+'})();');const g6=g5['exports'];return{'exports':g6,'context':fU};}async[gA(0x300)](fT,fU){const hK=gA;let fV=F({'name':fT,'dir':K,'title':fU});return await fV['cookieStore'][hK(0x338)](M['join'](K,fT,hK(0x279))),fV;}async['loadScript'](fT,fU){let fV=fU['name'],fW=b4(fU),fX=await this['prepareContext'](fV,fW),fY=await A(fT,{'dirname':fU['dir'],'context':fX});if(fY)return fY['exports']='default'in fY['exports']?fY['exports']['default']:fY['exports'],fY;}async['loadCoreExtensions'](){const hL=gA;let fT=Object['keys'](bX['default']);C[hL(0x1e2)]('Loading\x20'+fT['length']+'\x20built-in\x20extensions:\x20'+fT['join'](',\x20'));for(let fU of Object['values'](bX['default'])){let fV=fU['pkg']['name'],fW=b2({'manifest':fU['manifest'],'packageJson':fU['pkg'],'fallbackName':fV}),fX=fW['name'];try{let fY=await this['prepareContext'](fV,fX),fZ={'exports':fU[hL(0x2b0)](fY),'package':fU['pkg'],'manifest':fW,'context':fY};this['validate'](fZ),this['extensions']['set'](fV,fZ),this[hL(0x1e4)]('loaded',fV);}catch(g0){C[hL(0x1e2)](g0 instanceof Error?g0['message']:String(g0)),this['emit']('error',g0,fV);}}}async[gA(0x26b)](fT){const hM=gA;try{C['debug']('Loading\x20extension\x20from\x20'+fT);let fU=await bk(fT)['catch'](fX=>C['error'](fX));if(!fU)return;fU['package']['dir']=fU['dir'];let fV=await this['loadScript'](fU['path'],fU);if(!fV)return;let fW={'package':fU[hM(0x234)],'manifest':fU['manifest'],'exports':fV['exports'],'context':fV['context']};this['validate'](fW),this['extensions']['set'](fU[hM(0x234)]['name'],fW),this['emit']('loaded',fU['package']['name']);}catch(fX){this['emit'](hM(0x23a),fX,fT);}}['validate'](fT){const hN=gA;if(typeof fT!='object'||!fT||!bb(fT['exports']))throw Error('Invalid\x20extension\x20interface:\x20'+fT[hN(0x234)]['name']);}['getExtension'](fT){const hO=gA;return this['extensions']['get'](fT)??Array[hO(0x308)](this['extensions']['values']())['find'](fU=>fU['package'][hO(0x2c0)]===fT)??null;}async['getExtensionForUrl'](fT){const hP=gA;let fU;try{fU=new URL(fT);}catch(fV){return C['debug']('Invalid\x20extension\x20URL:\x20'+fT),C['debug'](fV instanceof Error?fV['message']:String(fV)),null;}for(let fW of this['extensions'][hP(0x33b)]()){let fX=null,fY=fW['exports']['canHandle'],fZ=fU['hostname']['includes'](fW[hP(0x234)]['name']);if(fX=b7(fW)?b6(fW,fU):typeof fY=='function'?await fY(fT):typeof fY=='string'?new URLPattern(fY)['test'](fT):fZ,fX)return fW;}return null;}async[gA(0x270)](fT){const hQ=gA;let fU=await gx['getAvailableExtensions'](),fV=[];for(let fW of fT){let fX=await stat(fW)['then'](g0=>g0['isDirectory']())['catch'](()=>!0x1)?fW:await aV(fW,fU);if(!fX)throw aM(aJ[hQ(0x24f)],'Extension\x20source\x20not\x20found:\x20'+fW,{'source':fW});let fY=await bl(fX,fW);if(!fY)throw aM(aJ['IMPORT_INVALID'],'Extension\x20import\x20failed:\x20'+fW,{'source':fW,'dir':fX});fV['push'](fY);let fZ=this[hQ(0x29e)]['find'](({name:g0})=>g0===fY['name']);if(fZ){let g0=fZ['source'];g0!==fY['source']&&await aD(g0);let g1=fZ[hQ(0x269)]?this.#t(fZ['dir']):null,g3=fY['dir']?this.#t(fY['dir']):null;g1&&g1!==g3&&await aD(g1),fZ['installedAt']=new Date()['toISOString'](),Object['assign'](fZ,bY(fY)),C['info']('Extension\x20'+fY['name']+'\x20updated');}else this[hQ(0x29e)][hQ(0x265)](bY(fY)),C['info']('Extension\x20'+fY['name']+'\x20added');}if(await this['saveInfo'](),fV['length']){for(let g4 of fV)this['extensions']['set'](g4['name'],g4);}}#t(fT){let fU=M['parse'](fT);return fU['dir']===k?fT:fU['dir'];}async[gA(0x22e)](fT){const hR=gA;for(let fU of fT){let fV=this['infoList']['find'](fY=>fY['name']===fU);if(!fV){C['error']('Extension\x20'+fU+'\x20not\x20found');return;}let fW=fV['dir']??'',fX=fW?.['includes'](k);await aB(fW)?(fX&&await aD(this.#t(fW)),this[hR(0x29e)]=this['infoList'][hR(0x224)](fY=>fY['name']!==fU),C['info']('Extension\x20'+fU+'\x20removed'),this['extensions']['delete'](fU)):C['warn']('Extension\x20'+fU+'\x20directory\x20not\x20found:\x20'+fW);}await this['saveInfo']();}async['importCookies'](fT,fU){const hS=gA;let fV=this['getExtension'](fT);if(!fV)throw Error('Extension\x20'+fT+'\x20not\x20found');return await fV['context']['cookieStore'][hS(0x338)](fU,{'removeSource':!0x1});}async['login'](fT,fU={}){let fV=this['getExtension'](fT);fV&&await be(fV,fU);}async[gA(0x1e6)](fT){const hT=gA;for(let fU of fT){let fV=this['getExtension'](fU);if(!fV)return;C[hT(0x210)]('Logging\x20out...'),await bf(fV),C['debug']('Clearing\x20localStorage...'),fV['context'][hT(0x22f)]['clear'](),C['debug']('Clearing\x20cookies\x20store...');let fW=await fV['context']['cookieStore']['getAll']();for(let fX of fW)await fV[hT(0x1dd)]['cookieStore']['delete'](fX);C['info']('Logged\x20out\x20from\x20extension\x20'+fU);}}['list'](){const hU=gA;return Array['from'](this['extensions'][hU(0x33b)]())['map'](fT=>({'name':fT['package']['name'],'version':fT['package']['version'],'description':fT['package'][hU(0x236)],'manifest':fT['manifest'],'package':fT['package']}));}};const c0=(fT,fU)=>!fT||'payload'in fT||'keys'in fT?fT:{...fT,'headers':{...fT['headers'],...fU?.['context']['http']['headers']}},c1=async(fT,fU)=>{if(!fU)return fT;let fV=await fT['clone']()['arrayBuffer'](),fW=Buffer['from'](fV)['toString']('base64'),fX=fU['replace']('{{challenge}}',fW);return new Request(fT['url'],{'method':fT['method'],'headers':fT['headers'],'body':fX});},c2=async fT=>{let fU=await fT['clone']()['arrayBuffer']();if(fU[0x0]===0x7b){let fV=null;try{fV=JSON['parse'](Buffer['from'](fU)['toString']('utf8'));}catch(fW){C['error']('Can\x27t\x20parse\x20license\x20response\x20as\x20JSON'),C['debug'](fW['message']),C['debug']('Base64\x20response\x20data:\x20'+Buffer['from'](fU)['toString']('base64'));}if(!fV)return fT;try{let fX='CAIS',fY=fX+Buffer['from'](fU)['toString']('utf8')['split']('\x22'+fX)[0x1]['split']('\x22')[0x0],fZ=Buffer['from'](fY,'base64');return new Response(fZ,{'status':fT['status'],'headers':fT['headers']});}catch{C['error']('Can\x27t\x20recognize\x20license\x20response'),C['error']('Response:\x20'+JSON['stringify'](fV));}}return fT;},c3=fT=>typeof fT=='string'?[{'sources':[{'url':fT}]}]:Array['isArray'](fT)&&typeof fT[0x0]=='string'?fT['map'](fU=>({'sources':[{'url':fU}]})):Array['isArray'](fT)?fT:fT&&typeof fT=='object'?[fT]:[],c4=fT=>fT[gA(0x27c)]??fT['streams']??[],c5=(fT,fU)=>({'id':fT['id'],'title':fT['title'],'tag':b5(fU),'seasonNumber':fT[gA(0x276)]??fT['season'],'episodeNumber':fT['episodeNumber']??fT['episode'],'episodeTitle':fT['episodeTitle']}),c6=async(fT,fU,fV)=>{const hV=gA;let fW=bc(fV);if(typeof fW['getMediaInfo']=='function'){let fZ=c3(await fW['getMediaInfo'](fT,fU));if(!fZ['length'])return C['info']('No\x20metadata\x20found'),[];let g0=[];for(let g1 of fZ){if(typeof fW['refreshMediaInfo']=='function'){let g4=await fW['refreshMediaInfo'](g1,fU);g4&&typeof g4=='object'&&Object['assign'](g1,g4);}let g3=c4(g1);for(let g5 of g3){let g6=typeof g5=='string'?{'url':g5}:g5;g0['push']({'source':{'url':g6['url'],'headers':g6['headers'],'drm':g6['drm']&&!Array['isArray'](g6[hV(0x31a)])&&typeof g6['drm']=='object'?{'server':g6[hV(0x31a)][hV(0x1ce)]}:void 0x0},'metadata':c5(g1,fV),'drm':g6['drm']&&!Array['isArray'](g6['drm'])&&typeof g6[hV(0x31a)]==hV(0x23f)?{'server':g6['drm']['server']}:void 0x0});}}return C['info']('Fetching\x20metadata\x20finished'),g0;}let fX=await fW['fetchContentMetadata']?.(fT,fU);if(!fX?.['length'])return C['info'](hV(0x331)),[];let fY=[];for(let g7 of fX){let g8={...g7},g9;if(!g8['source']&&fV['exports']['fetchContentSource']&&g8['id']){let gd=await fV['exports']['fetchContentSource'](g8['id'],fU);gd&&(g8['source']=gd);}if(!g8['source']?.['url']){C['error']('Can\x27t\x20find\x20content\x20source');continue;}g8['source']['drm']&&'payload'in g8['source']['drm']&&fV['exports']['fetchContentDrm']&&(g9=g8['source']['drm']['payload'],g8['source']['drm']=void 0x0);let {source:ga,...gb}=g8,gc=c0(g8['source']['drm'],fV);ga['drm']=gc,ga['headers']={...ga['headers'],...fV['context']['http']['headers']},fV['exports']['tag']&&(gb['tag']=fV['exports']['tag']),fY['push']({'source':ga,'metadata':gb,'drm':gc,'drmPayload':g9});}return C['info']('Fetching\x20metadata\x20finished'),fY;},c7=async(fT,fU,fV)=>{const hW=gA;if(fT['drmPayload']&&fV?.['exports']['fetchContentDrm']){let fX=c0(await fV['exports']['fetchContentDrm'](fT['drmPayload'],fU),fV);return fT['source']['drm']=fX,fT['drm']=fX,fX;}let fW=c0(fT['source']['drm']??fT[hW(0x31a)],fV);return fT['source']['drm']=fW,fT['drm']=fW,fW;},c8=fT=>{const hX=gA;let fU=fT[hX(0x2f6)]?c1:void 0x0,fV=c2,fW=new D();return async({url:fX,data:fY})=>{const hY=hX;let fZ=new Request(fX,{'body':Buffer['from'](fY),'method':'POST','headers':fT['headers']}),g0=await fU?.(fZ,fT['template'])||fZ,g1=await fW['fetch'](g0['url'],{'body':await g0['arrayBuffer'](),'headers':g0['headers'],'method':g0['method']}),g3=await fV?.(g1)||g1;return new Uint8Array(await g3[hY(0x262)]());};},c9=new Map(),ca=fT=>{const hZ=gA;if(!fT)return;let fU=Object['fromEntries'](new Headers(fT)['entries']());return Object[hZ(0x2f9)](fU)['length']?fU:void 0x0;},cb=fT=>{let {input:fU,...fV}=fT;return fV;},cc=(fT,fU,fV)=>createHash('sha1')['update'](JSON['stringify']({'extension':fT['package']['name'],'url':fU,'id':fV['id']??null,'title':fV['title']??null,'season':fV['season']??null,'episode':fV['episode']??null}))['digest']('hex'),cd=(fT,fU)=>{const i0=gA;let fV=fT['source']??fT['_rootSource'],fW=fV?.['rootPath'];if(typeof fW!=i0(0x214)||!fW)return fU??null;let fX=fV?.['_url']instanceof Request?fV['_url']['headers']:void 0x0,fY=fV?.['_options']?.['requestInit']?.['headers'],fZ={...ca(fX),...ca(fY)};return{...fU??{},'url':fW,'headers':Object['keys'](fZ)['length']?fZ:fU?.['headers']};},ce=(fT,fU)=>{const i1=gA;let fV=fT['id']??fT[i1(0x1ff)]?.['id'];return{'id':fV==null?void 0x0:String(fV),'title':fT['title'],'tag':b5(fU),'seasonNumber':fT['season'],'episodeNumber':fT['episode'],'episodeTitle':fT['episodeTitle']};},cf=fT=>fT['length']?fT[gA(0x21c)]===0x1?fT[0x0]:fT:null,cg=fT=>{const i2=gA;let fU;try{fU=new URL(fT);}catch{throw Error('Invalid\x20direct\x20media\x20URL:\x20'+fT);}let fV=fU['pathname'][i2(0x310)](/\/+$/,'')['split']('/')['filter'](Boolean)['pop'](),fW=fV?.['split']('.')['slice'](0x0,-0x1)[i2(0x332)]('.')||fV||fU['hostname']||i2(0x1ea);return{'source':{'url':fT},'metadata':{'title':fW}};},ch=async(fT,fU)=>{let fV=fU['proxy']||fU['proxyMeta'];fV&&(await fT['context']['http']['configure']({'proxyUrl':fV}),await u['configure']({'proxyUrl':fV}));},ci=async(fT,fU,fV)=>{const i3=gA;if(!fV){C['warn']('No\x20suitable\x20extension\x20available.\x20Downloading\x20as\x20a\x20direct\x20link...');let {source:fW,metadata:fX}=cg(fT);return fW['audioLanguage']=fU['languages']?.[0x0],fW['http2']=fU[i3(0x21e)],{'source':fW,'metadata':fX};}if(await ch(fV,fU),await bd(fV),ba(fV)==='v2'){let fY=bc(fV);C[i3(0x210)](i3(0x334));let fZ=await fY['resolveEntries'](fT,fU);if(!fZ?.[i3(0x21c)])return C[i3(0x210)]('No\x20metadata\x20found'),null;let g0=fZ['map'](g1=>{const i4=i3;let g3=g1,g4=cb(g1),g5=g1[i4(0x2be)]?cc(fV,fT,g3):void 0x0;g5&&g1['input']&&c9['set'](g5,g1['input']);let g6=g1['input']?cd(g1[i4(0x2be)]):null;return{'source':g6??{'url':fT},'metadata':ce(g4,fV),'extension':{'api':'v2','entry':g4,'cacheKey':g5,'hasResolvedSource':!!g6}};});return C['info']('Resolving\x20media\x20entries\x20finished'),cf(g0);}return C['info']('Fetching\x20content\x20metadata...'),cf(await c6(fT,fU,fV));},cj=async({resource:fT,url:fU,options:fV,extension:fW})=>{const i5=gA;if(!fW||!fT['extension']||fT['extension']['api']!=='v2'||ba(fW)!=='v2')return{'source':fT['source']};await ch(fW,fV),await bd(fW);let fX=bc(fW),fY=fT['extension']['entry'],fZ=fT['extension']['cacheKey']?c9['get'](fT['extension']['cacheKey']):void 0x0;if(!fZ&&typeof fX['resolveMedia']=='function'&&(fZ=await fX[i5(0x2c9)](fU,fV,fY)??void 0x0,fZ&&fT['extension']['cacheKey']&&c9['set'](fT['extension']['cacheKey'],fZ)),!fZ){if(fT['extension']['hasResolvedSource'])return{'source':fT[i5(0x2c4)],'entry':fY};throw Error('Extension\x20'+fW['package']['name']+'\x20could\x20not\x20materialize\x20media\x20entry.\x20Provide\x20resolveMedia()\x20or\x20an\x20inline\x20input\x20rooted\x20in\x20UrlSource.');}return{'source':cd(fZ,fT['source'])??fT['source'],'input':fZ,'entry':fY};},ck=async(fT,fU,fV)=>c7(fT,fU,fV);var cl=class{#e=[];#t=new Set();#n=new Map();#r=new Map();#i=new Set();get['activeRunCount'](){const i6=gA;return this.#r[i6(0x2c7)];}get['queuedCount'](){return this.#e['length'];}['getActiveRun'](fT){return this.#r['get'](fT);}['setActiveRun'](fT,fU){this.#r['set'](fT,fU);}['deleteActiveRun'](fT){this.#r['delete'](fT);}[gA(0x280)](fT){return this.#n['get'](fT);}['setActiveJob'](fT){const i7=gA;this.#n[i7(0x337)](fT['id'],fT);}['deleteActiveJob'](fT){this.#n['delete'](fT);}[gA(0x339)](fT){this.#i['add'](fT);}['consumeResumeAfterStop'](fT){let fU=this.#i['has'](fT);return fU&&this.#i['delete'](fT),fU;}['enqueue'](fT){this.#t['has'](fT['id'])||this.#r['has'](fT['id'])||(this.#e['push'](fT['id']),this.#t['add'](fT['id']));}['dequeue'](fT){if(!this.#t['has'](fT))return!0x1;let fU=this.#e['indexOf'](fT);return fU!==-0x1&&this.#e['splice'](fU,0x1),this.#t['delete'](fT),!0x0;}['dequeueNext'](fT){for(;this.#e['length']>0x0;){let fU=this.#e['shift']();if(!fU)return;this.#t['delete'](fU);let fV=fT(fU);if(fV&&fV['status']==='queued')return fV;}}};const cm=['code','errno','syscall','address','port','host','hostname','path','type'],cn=fT=>typeof fT=='object'&&!!fT&&gA(0x26a)in fT&&'statusText'in fT&&'url'in fT,co=fT=>{let fU=[],fV=fT;for(let fW of cm){let fX=fV[fW];fX==null||fX===''||fU['push'](fW+'='+String(fX));}return fU;},cp=(fT,fU=0x0)=>{const i8=gA;if(fU>0x3)return'[max-depth]';if(fT instanceof Error){let fV=co(fT),fW='cause'in fT?fT[i8(0x2fa)]:void 0x0,fX=[fT['name']+':\x20'+fT['message']];return fV['length']&&fX['push']('details='+fV['join'](',\x20')),fW!==void 0x0&&fW!==fT&&fX['push']('cause='+cp(fW,fU+0x1)),fX['join']('\x20|\x20');}return cn(fT)?'Response\x20'+fT['status']+'\x20'+fT['statusText']+'\x20url='+fT['url']:inspect(fT,{'depth':0x2,'breakLength':0x1/0x0});},cq=(fT,fU)=>{const i9=gA;C['debug'](fT+':\x20'+cp(fU)),fU instanceof Error&&fU[i9(0x2a7)]&&C['debug'](fU['stack']);},cr=(fT,fU)=>{const ia=gA;let fV=fU+'\x20∙\x20';return fT[ia(0x26e)]==='subtitle'?fV+='SUBTITLES':fV+=fT['type']?.['toUpperCase'](),fT[ia(0x26e)]==='video'&&(fT['width']&&(fV+='\x20∙\x20'+fT['width']+'x'+fT['height']),fT['bitrate']&&(fV+='\x20∙\x20'+Math['round'](fT['bitrate']/0x3e8)+'\x20KiB/s')),fT['type']==='audio'&&(fT['languageCode']&&(fV+='\x20∙\x20'+fT['languageCode']['toUpperCase']()),fT[ia(0x2c0)]&&(fV+='\x20('+fT['name']+')'),fT['sampleRate']&&(fV+='\x20∙\x20'+fT['sampleRate']+'\x20kHz'),fT['bitrate']&&(fV+='\x20∙\x20'+Math['round'](fT[ia(0x315)]/0x3e8)+'\x20KiB/s')),fT[ia(0x26e)]==='subtitle'&&(fT['languageCode']&&(fV+='\x20∙\x20'+fT['languageCode']['toUpperCase']()),fT['name']&&(fV+='\x20('+fT['name']+')'),fT['forced']&&(fV+='\x20FORCED')),fV;},cs=fT=>fT['id'],ct=fT=>{let fU=new Map();for(let fV of fT){let fW=cs(fV),fX=fU['get'](fW);if(fX){fX['push'](fV);continue;}fU['set'](fW,[fV]);}return Array['from'](fU['entries']())['filter'](([,fY])=>fY['length']>0x1);},cu=fT=>{const ib=gA;let fU=ct(fT);if(!fU[ib(0x21c)])return;let fV=fU['map'](([fW,fX])=>fW+'\x20('+fX['length']+'\x20copies)')['join'](',\x20');throw Object['assign'](Error('Duplicate\x20tracks\x20selected:\x20'+fV),{'code':'DUPLICATE_TRACKS_SELECTED'});},cv=fT=>{const ic=gA;if(!fT||typeof fT!='object'||!('code'in fT))return;let fU=fT['code'];return typeof fU==ic(0x214)?fU:void 0x0;};var cw=class extends Error{['code'];constructor(fT,fU=fT,fV){super(fU,fV),this['name']='DownloaderError',this['code']=fT;}};const cx=(fT,fU='DOWNLOAD_FAILED')=>{const id=gA;if(fT instanceof cw||fT instanceof Error&&fT['name']==='AbortError')return fT;if(fT instanceof Error){let fV=new cw(cv(fT)??fU,fT['message'],{'cause':fT});return fT['stack']&&(fV['stack']=fT['stack']),fV;}return new cw(fU,typeof fT==id(0x214)?fT:'Unknown\x20error');},cy=fT=>{const ie=gA;let fU=fT['replace'](/[<>:"/\\|?*\x00-\x1F]/g,'');fU=fU['replace'](/^[\s.]+|[\s.]+$/g,''),fU=fU['replace'](/\s+/g,'\x20');let fV=fU['lastIndexOf']('.'),fW=fV>0x0,fX=fW?fU['slice'](fV):'',fY=fW?fU['slice'](0x0,fV):fU;if(fX['length']>=0xff)fU=fU['slice'](0x0,0xff);else{let g0=0xff-fX['length'];fY[ie(0x21c)]>g0&&(fY=fY['slice'](0x0,g0)),fU=fY+fX;}let fZ=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;if(fX['length']<0xff){let g1=fU['lastIndexOf']('.'),g3=g1>0x0;if(fX=g3?fU['slice'](g1):'',fY=g3?fU['slice'](0x0,g1):fU,fZ['test'](fY)){let g4=0xff-fX['length'];fU=('_'+fY)['slice'](0x0,g4)+fX;}}return fU['length']===0x0?'untitled':fU;},cz=(fT,fU)=>Object['keys'](fU)['reduce']((fV,fW)=>{let fX='{'+fW+'}',fY=fU[fW];if(!fY){let fZ=RegExp('(?:\x5c.|^)\x5c{'+fW+'\x5c}(?=\x5c.|$)|\x5c{'+fW+'\x5c}(\x5c.|$)|\x5c{'+fW+'\x5c}','g');return fV['replace'](fZ,(g0,g1)=>'')['replaceAll']('....','...');}return fV['replaceAll'](fX,fY);},fT)['replaceAll']('\x20\x20','\x20'),cA=fT=>typeof fT==gA(0x214)&&fT['trim']()||'mp4',cB=fT=>{const ig=gA;let fU='seasonNumber'in fT?''+fT['seasonNumber']:'',fV=ig(0x2ca)in fT?''+fT['episodeNumber']:'',fW=fU?'S'+fU:'',fX=fV?'E'+fV:'',fY=fU&&fV?fW+':'+fX:'',fZ='episodeTitle'in fT&&fT['episodeTitle']?.['trim']()?'\x22'+fT['episodeTitle']+'\x22':'';return{'title':((fT['title']??'')+'\x20'+fY+'\x20'+fZ)['trim']()};},cC=({settings:fT,options:fU,source:fV,meta:fW,allTracks:fX})=>{const ih=gA;let fY=fW['title'],fZ=fW['tag'],g0=ih(0x276)in fW?fW['seasonNumber']:void 0x0,g1='episodeNumber'in fW?fW['episodeNumber']:void 0x0,g3='episodeTitle'in fW?fW['episodeTitle']:'',g4=fX['find'](gb=>gb['type']==='video')?.['codec']??'',g5=fT['get'](ih(0x28c)),g6=fU[ih(0x2f1)]||fT['get']('movieFilenameTemplate'),g7=fU['episodeTemplate']||fT['get']('seriesFilenameTemplate'),g8=cy(cz(g1?g7:g6,{'title':fY??'','s':g0?g0['toString']()[ih(0x32f)](0x2,'0'):'','e':g1?g1['toString']()[ih(0x32f)](0x2,'0'):'','quality':fU['videoQuality']??'','codec':g4,'tag':fZ??'','episodeTitle':g3??'','audioType':fV['audioType']?fV['audioType']['toUpperCase']():'','format':'WEB-DL'}))+'.'+cA(fU['format']||fT['get'](ih(0x285))),g9=fU['outputPath']||join(g5,g8),ga=parse(g9);return{'downloadDir':g5,'outputPath':g9,'resolvedFilenameWithoutExtension':ga['name'],'filenameWithExtension':ga['base'],'outputDirectory':ga['dir']||g5,'downloadMetadata':cB(fW)};},cD=async(fT,fU,fV)=>fV??open(fT,fU),cE=fT=>{let fU=null;return new StreamSource({'getSize':async()=>(fU=await cD(fT,'r',fU),(await fU['stat']())['size']),'read':async(fV,fW)=>{fU=await cD(fT,'r',fU);let fX=new Uint8Array(fW-fV);return await fU['read'](fX,0x0,fW-fV,fV),fX;},'dispose':async()=>{let fV=fU;fU=null,await fV?.['close']();},'prefetchProfile':'fileSystem'});},cF=fT=>{let fU=null;return new StreamTarget(new WritableStream({'start':async()=>{fU=await cD(fT,'w',fU);},'write':async fV=>{const ii=b;if(!fU)throw Error('MediaBunny\x20output\x20handle\x20was\x20not\x20initialized\x20for\x20'+fT);await fU['write'](fV['data'],0x0,fV[ii(0x1d5)]['byteLength'],fV['position']);},'close':async()=>{let fV=fU;fU=null,await fV?.['close']();},'abort':async()=>{let fV=fU;fU=null,await fV?.['close']();}}),{'chunked':!0x0});},cG=async(fT,fU)=>{const ij=gA;let fV=new W({'formats':V,'source':fT['startsWith']('https')?new X(fT,{'requestInit':{'headers':fU}}):cE(fT)});return{'tracks':await fV[ij(0x2a1)](),'primaryVideoTrack':await fV['getPrimaryVideoTrack'](),'primaryAudioTrack':await fV['getPrimaryAudioTrack']()};},cH=[...DASH_FORMATS,...HLS_FORMATS],cI=new Set(['authorization','cookie','set-cookie','api-key']),cJ=fT=>Object['fromEntries'](Object['keys'](fT)['map'](fU=>[fU,cI['has'](fU['toLowerCase']())?'[REDACTED]':fT[fU]])),cK=fT=>fT===gA(0x215)?DASH_FORMATS:fT==='m3u8'?HLS_FORMATS:cH,cL=({http:fT,source:fU,detection:fV})=>(C['debug']('Fetching\x20manifest...'),C[gA(0x1e2)](fU['url']),fU['headers']&&C['debug'](JSON['stringify'](cJ(fU['headers']))),new Input({'source':new UrlSource(fU['url'],{'requestInit':{'headers':fU['headers']},'fetchFn':fT['fetch']['bind'](fT)}),'formats':cK(fV['kind'])})),cM=fT=>createHash('sha1')['update'](fT)[gA(0x233)]('hex'),cN=(fT,fU)=>{const ik=gA;if(fT)switch(fT){case'aar':case ik(0x219):return'rus';case'ave':return'eng';case'zu':return fU?.['includes'](ik(0x1fd))?'ru':'zu';default:return fT;}},cO=({origin:fT,type:fU,sourceUrl:fV,languageCode:fW,name:fX,codec:fY})=>fT+':'+fU+':'+cM([fV??'',fW??'',fX??'',fY??'']['join']('|')),cP=async(fT,fU)=>{const il=gA;let [fV,fW,fX,fY,fZ,g0]=await Promise['all']([fT['getCodec'](),fT['getBitrate'](),fT['getLanguageCode'](),fT['getName'](),fT['getDisposition'](),fT['hasOnlyKeyPackets']()]),g1={'id':'manifest:'+fT['type']+':'+fT['id'],'origin':'manifest','type':fT['type'],'codec':fV,'bitrate':fW,'languageCode':cN(fX,fU),'name':fY,'forced':fZ['forced'],'hearingImpaired':fZ['hearingImpaired'],'visuallyImpaired':fZ['visuallyImpaired'],'isDefault':fZ['default'],'isIFrameOnly':g0,'inputTrack':fT};if(fT['isVideoTrack']()){let [g3,g4]=await Promise['all']([fT['getDisplayWidth'](),fT['getDisplayHeight']()]);g1[il(0x24e)]=g3,g1['height']=g4;}if(fT['isAudioTrack']()){let [g5,g6]=await Promise['all']([fT['getNumberOfChannels'](),fT['getSampleRate']()]);g1['numberOfChannels']=g5,g1['sampleRate']=g6;}return g1;},cQ=async fT=>fT['segments']?fT['segments']:fT['inputTrack']?(fT['segmentsPromise']??=fT['inputTrack']['getSegments']()['then'](fU=>(fT['segments']=fU,fT['segmentCount']=fU['length'],fU)),fT['segmentsPromise']):(fT[gA(0x204)]=[],fT['segmentCount']=0x0,fT['segments']),cR=(fT,fU)=>{let fV=fT['filter'](fW=>fU['some'](fX=>fX===fW['codec']));return fV['length']?fV:fT['toSorted']((fW,fX)=>(fX['bitrate']??0x0)-(fW['bitrate']??0x0));},cS=(fT,fU)=>{let fV=fU?parseInt(String(fU),0xa)*0x10/0x9:void 0x0,fW=fT['toSorted']((fZ,g0)=>(g0['bitrate']??0x0)-(fZ['bitrate']??0x0));if(!fU)return fW;let fX=fT['filter'](fZ=>Number(fZ['height'])===Number(fU));if(fX['length'])return fX;let fY=fT['filter'](fZ=>Number(fZ['width'])===Number(fV));return fY['length']?fY:fW;},cT=(fT,fU)=>fT['filter'](fV=>fV['numberOfChannels']===Number(fU)),cU=fT=>fT?.['trim']()['toLowerCase']()??'',cV=fT=>cU(fT)['slice'](0x0,0x2),cW=fT=>cU(fT)||'und',cX=(fT,fU)=>{let fV=cU(fT),fW=cU(fU);return!fV||!fW?!0x1:fV===fW||fV['startsWith'](fW+'-')?!0x0:cV(fV)===cV(fW);},cY=fT=>Array['from'](new Map(fT['map'](fU=>cU(fU))['filter'](Boolean)['map'](fU=>[cV(fU),fU]))[gA(0x33b)]()),cZ=(fT,fU)=>{const im=gA;let fV=new Map();for(let fW of fT){let fX=cW(fW['languageCode']),fY=fV[im(0x1d6)](fX);if(!fY){fV['set'](fX,[fW]);continue;}fY[im(0x21c)]<fU&&fY['push'](fW);}return Array['from'](fV['values']())['flat']();},d0=(fT,fU,fV=0x1)=>{const io=gA;let fW=fT['toSorted']((g0,g1)=>(g1['bitrate']??0x0)-(g0['bitrate']??0x0)),fX=cY(fU),fY=[];for(let g0 of fX){let g1=fW['filter'](g3=>cX(g3['languageCode'],g0));g1['length']&&fY['push'](...cZ(g1,fV));}let fZ=cY(fT['map'](g3=>g3['languageCode']||'und'));if(!fY['length'])for(let g3 of fZ){let g4=fW['filter'](g5=>cX(g5['languageCode']??io(0x2e5),g3));g4['length']&&fY['push'](...cZ(g4,fV));}return fY;},d1=(fT,fU)=>{const ip=gA;if(!fU?.['inputTrack'])return fT;let fV=fU['inputTrack'],fW=fT['filter'](fX=>fX['inputTrack']?fX[ip(0x2d5)]['canBePairedWith'](fV):!0x0);return fW['length']?fW:fT;},d2=fT=>(fT??0x0)/0x3e8,d3=async fT=>{const iq=gA;if(typeof fT['segmentCount']=='number')return fT[iq(0x20d)]+'\x20Segments';if(!fT['inputTrack'])return iq(0x29b);try{return(await cQ(fT))['length']+'\x20Segments';}catch{return'?\x20Segments';}},d4=({videos:fT,audios:fU,subtitles:fV})=>({'videos':fT,'audios':fU,'subtitles':fV,'all':[...fT,...fU,...fV]});async function d5(fT,fU,fV){const ir=gA;let fW=fU['videoQuality'],fX=fT['filter'](g9=>g9['type']==='video'&&!g9['isIFrameOnly']),fY=fT['filter'](g9=>g9['type']==='audio'),fZ=fT['filter'](g9=>g9['type']===ir(0x31e));if(fU['select']){let g9=await Promise['all'](fX['map'](async(gh,gi)=>({'name':(gh['width']??'?')+'x'+(gh['height']??'?')+'\x20|\x20'+(d2(gh['bitrate'])||'?')+'\x20Kbps\x20|\x20'+(gh['codec']??'?')+'\x20|\x20'+await d3(gh),'value':gh['id'],'checked':gi===0x0}))),ga=fX['length']?await checkbox({'message':ir(0x229),'pageSize':0xc,'choices':g9,'loop':!0x1}):[],gb=fX['filter'](gh=>ga['includes'](gh['id'])),gc=await Promise['all'](fY['map'](async(gh,gi)=>({'name':''+(gh['name']?gh['name']+'\x20|\x20':'')+(d2(gh['bitrate'])||'?')+'\x20Kbps\x20|\x20'+(gh['codec']?gh['codec']+'\x20|\x20':'')+(gh['languageCode']||'und')+'\x20|\x20'+(gh['numberOfChannels']??'?')+'CH\x20|\x20'+await d3(gh),'value':gh['id'],'checked':gi===0x0}))),gd=fY['length']?await checkbox({'message':'Select\x20audio\x20streams','pageSize':0xc,'choices':gc,'loop':!0x1}):[],ge=fY['filter'](gh=>gd['includes'](gh['id'])),gf=await Promise['all'](fZ['map'](async(gh,gi)=>({'name':(gh['codec']??'?')+'\x20|\x20'+(gh['languageCode']||ir(0x2e5))+ir(0x33d)+await d3(gh),'value':gh['id'],'checked':gi===0x0}))),gg=fZ['length']?await checkbox({'message':'Select\x20subtitles','pageSize':0xc,'choices':gf,'loop':!0x1}):[];return d4({'videos':gb,'audios':ge,'subtitles':fZ['filter'](gh=>gg['includes'](gh['id']))});}fU['videoCodecs']&&(fX=cR(fX,fU['videoCodecs'])),fX=cS(fX,fW||NaN);let g0=fX[0x0],g1=[...fU['languages']||[]],g3=fV['audioLanguage']?.['slice'](0x0,0x2);!g1['length']&&g3&&g1['push'](g3);let g4=d1(fY,g0);fU['audioChannels']&&(g4=cT(g4,fU['audioChannels'])),fU['audioCodecs']&&(g4=cR(g4,fU['audioCodecs']));let g5=d0(g4,g1,0x1);g5['length']&&(g4=g5);let g6=g1['at'](-0x1),g7=g6?g4['map'](gh=>!gh['languageCode']||gh['languageCode']==='und'?{...gh,'languageCode':g6}:gh):g4,g8=fZ['filter'](gh=>fU['subtitleLanguages']?.['length']?fU['subtitleLanguages'][ir(0x239)](gi=>cX(gh['languageCode']||'und',gi)):!0x1);return d4({'videos':fU['skipVideo']||!g0?[]:[g0],'audios':fU['skipAudio']?[]:g7,'subtitles':fU['skipSubtitles']?[]:g8});}const d6=()=>({'videos':[],'audios':[],'subtitles':[],'all':[]}),d7={'aac':'aac','mp4a':'aac','mp4a.40.2':gA(0x326),'ac3':'ac3','ac-3':'ac3','eac3':'eac3','ec-3':'eac3','opus':gA(0x26d),'vorbis':'vorbis','flac':'flac'},d8=fT=>{if(!fT)return null;try{return new URL(fT);}catch{return null;}},d9=fT=>{let fU=d8(fT);if(fU)try{return decodeURIComponent(fU['pathname']);}catch{return fU['pathname'];}},da=fT=>{const is=gA;if(!fT)return'aac';let fU=fT['toLowerCase']();return d7[fU]??d7[fU['split']('.')[0x0]??'']??is(0x326);},db=(fT,fU)=>fT['filter'](fV=>fV['type']===fU)['length'],dc=fT=>{let fU='Extracted,\x20there\x20are\x20';if(fT['length']===0x0)fU+='no\x20tracks';else{fU+=fT['length']+'\x20tracks';let fV=db(fT,'video');fV&&(fU+=',\x20'+fV+'\x20video\x20tracks');let fW=db(fT,'audio');fW&&(fU+=',\x20'+fW+'\x20audio\x20tracks');let fX=db(fT,'subtitle');fX&&(fU+=',\x20'+fX+'\x20subtitle\x20tracks');}C['info'](fU);},dd=(fT,fU=[])=>{const iu=gA;let fV=[...fU];for(let fW of fT['subtitles']??[]){let fX=d9(fW['url']),fY=cN(fW['language'],fT['url']);fV['some'](fZ=>{const it=b;let g0=d9(fZ[it(0x2e4)]);return!fX||!g0?!0x1:fX===g0;})||fV['push']({'id':cO({'origin':'external-subtitle','type':'subtitle','sourceUrl':fW[iu(0x2dd)],'languageCode':fY,'name':fW[iu(0x317)]||fW['title'],'codec':fW['format']}),'origin':'external-subtitle','type':'subtitle','sourceUrl':fW['url'],'languageCode':fY,'codec':fW['format'],'forced':fW['forced'],'name':fW['label']||fW['title']});}return fV;},de=async({options:fT,source:fU,meta:fV,detection:fW})=>{const iv=gA;let fX={...fT},fY={...fV};if(!fY['title']){let g6=d8(fU['url'])?.['pathname'][iv(0x20b)]('/')['pop']();g6&&(fY['title']=g6);}let {primaryVideoTrack:fZ,primaryAudioTrack:g0}=await cG(fU['url'],fU['headers']),g1=await fZ?.['getCodec'](),g3=await fZ?.['getCodedWidth'](),g4=await fZ?.['getCodedHeight']();fX['videoQuality']||=g4?g4+'p':void 0x0;let g5=d6();if(g5[iv(0x238)]=dd(fU),g5['all']['push'](...g5[iv(0x238)]),fW['isAudio']&&!fX['skipAudio']){let g7={'id':cO({'origin':'progressive','type':'audio','sourceUrl':fU['url'],'languageCode':fU['audioLanguage'],'codec':await g0?.['getCodec']()}),'origin':'progressive','type':'audio','codec':da(await g0?.['getCodec']()),'languageCode':cN(await g0?.['getLanguageCode'](),fU['url'])??cN(fU['audioLanguage'],fU['url'])??'und','numberOfChannels':await g0?.['getNumberOfChannels'](),'sampleRate':await g0?.['getSampleRate'](),'sourceUrl':fU[iv(0x2dd)]};return g5['audios']['push'](g7),g5[iv(0x25e)]['push'](g7),{'options':fX,'source':fU,'meta':fY,'allTracks':[g7],'tracks':g5};}if(!fX[iv(0x22a)]){let g8=parseInt((fX['videoQuality']??'')['replace']('p',''),0xa),g9={'id':cO({'origin':'progressive','type':'video','sourceUrl':fU[iv(0x2dd)],'codec':g1}),'origin':'progressive','type':'video','codec':g1??'avc','width':g3??void 0x0,'height':g4??(g8||void 0x0),'sourceUrl':fU['url']};return g5[iv(0x33c)]['push'](g9),g5['all']['push'](g9),{'options':fX,'source':fU,'meta':fY,'allTracks':[g9],'tracks':g5};}return{'options':fX,'source':fU,'meta':fY,'allTracks':[],'tracks':g5};},df=async({options:fT,source:fU,meta:fV,input:fW,disposeInput:fX=!0x0})=>{const iw=gA;let fY={...fT},fZ={...fV},g0=fX;try{let g1=await fW['getTracks']();if(!g1['length'])throw new cw('MANIFEST_PARSE_FAILED','Failed\x20to\x20parse\x20manifest');let g3=await Promise['all'](g1['map'](g6=>cP(g6,fU[iw(0x2dd)])));dc(g3);let g4=await d5(g3,fY,fU),g5=g4['videos'][0x0]?.['height'];if(g5&&(fY['videoQuality']=g5+'p'),!fZ['title']){let g6=d8(fU['url'])?.['host'];g6&&(fZ['title']=g6+'_'+B());}return g0=!0x1,{'options':fY,'source':fU,'meta':fZ,'allTracks':g3,'tracks':g4,'dispose':fX?()=>fW['dispose']?.():void 0x0};}finally{g0&&fW['dispose']?.();}},dg=async({http:fT,options:fU,source:fV,meta:fW,detection:fX})=>df({'options':fU,'source':fV,'meta':fW,'input':cL({'http':fT,'source':fV,'detection':fX})}),dh=async({http:fT,options:fU,source:fV,meta:fW,input:fX,detection:fY})=>fX?df({'options':fU,'source':fV,'meta':fW,'input':fX,'disposeInput':!0x1}):fY['strategy']==='progressive'?de({'options':fU,'source':fV,'meta':fW,'detection':fY}):dg({'http':fT,'options':fU,'source':fV,'meta':fW,'detection':fY}),di=(fT,fU)=>{const ix=gA;try{let fV=new URL(fT);return fV['pathname'][ix(0x2d3)](fU)||fV['search']['endsWith'](fU);}catch{return!0x1;}},dj=async(fT,fU)=>{const iy=gA;let fV=di(fU['url'],'.m3u8'),fW=di(fU['url'],'.mpd'),fX=di(fU['url'],'.mp4'),fY=di(fU[iy(0x2dd)],'.mov'),fZ=!0x1,g0=!0x1;if(!fV&&!fW&&!fX&&!fY)try{let g1=await fT['fetch'](fU['url'],{'method':'HEAD','headers':fU['headers']});if(!g1['ok'])C['warn']('HEAD\x20request\x20for\x20'+fU['url']+'\x20returned\x20'+g1[iy(0x26a)]+'\x20'+g1['statusText']);else{let g3=g1['headers'][iy(0x1d6)]('content-type');fZ=!!g3?.['includes']('audio'),g0=!!g3?.['includes'](iy(0x2ba));}}catch(g4){let g5=g4 instanceof Error?g4[iy(0x20f)]:String(g4);C['warn']('HEAD\x20request\x20failed\x20for\x20'+fU[iy(0x2dd)]+':\x20'+g5);}return fW?{'strategy':'manifest','kind':'mpd','isAudio':fZ,'isVideo':g0,'matchedContentLabel':iy(0x2d8)}:fV?{'strategy':'manifest','kind':'m3u8','isAudio':fZ,'isVideo':g0,'matchedContentLabel':'HTTP\x20Live\x20Streaming'}:fZ||g0||fX||fY?{'strategy':iy(0x20a),'kind':'progressive','isAudio':fZ,'isVideo':g0,'matchedContentLabel':'Progressive\x20Stream'}:{'strategy':'manifest','kind':'unknown','isAudio':fZ,'isVideo':g0};};var dk=a7((fT,fU)=>{function fV(fW){var fX=new fW(),fY=fX;function fZ(){var g1=fX;return g1['next']?fX=g1['next']:(fX=new fW(),fY=fX),g1['next']=null,g1;}function g0(g1){fY['next']=g1,fY=g1;}return{'get':fZ,'release':g0};}fU['exports']=fV;}),dl=a7((fT,fU)=>{var fV=dk();function fW(g0,g1,g3){if(typeof g0=='function'&&(g3=g1,g1=g0,g0=null),!(g3>=0x1))throw Error('fastqueue\x20concurrency\x20must\x20be\x20equal\x20to\x20or\x20greater\x20than\x201');var g4=fV(fY),g5=null,g6=null,g7=0x0,g8=null,g9={'push':gg,'drain':fX,'saturated':fX,'pause':gb,'paused':!0x1,get 'concurrency'(){return g3;},set 'concurrency'(gn){if(!(gn>=0x1))throw Error('fastqueue\x20concurrency\x20must\x20be\x20equal\x20to\x20or\x20greater\x20than\x201');if(g3=gn,!g9['paused']){for(;g5&&g7<g3;)g7++,gi();}},'running':ga,'resume':ge,'idle':gf,'length':gc,'getQueue':gd,'unshift':gh,'empty':fX,'kill':gj,'killAndDrain':gk,'error':gm,'abort':gl};return g9;function ga(){return g7;}function gb(){g9['paused']=!0x0;}function gc(){for(var gn=g5,go=0x0;gn;)gn=gn['next'],go++;return go;}function gd(){for(var gn=g5,go=[];gn;)go['push'](gn['value']),gn=gn['next'];return go;}function ge(){if(g9['paused']){if(g9['paused']=!0x1,g5===null){g7++,gi();return;}for(;g5&&g7<g3;)g7++,gi();}}function gf(){return g7===0x0&&g9['length']()===0x0;}function gg(gn,go){const iz=b;var gp=g4['get']();gp['context']=g0,gp['release']=gi,gp['value']=gn,gp['callback']=go||fX,gp[iz(0x1f3)]=g8,g7>=g3||g9['paused']?g6?(g6[iz(0x237)]=gp,g6=gp):(g5=gp,g6=gp,g9['saturated']()):(g7++,g1[iz(0x2e9)](g0,gp['value'],gp['worked']));}function gh(gn,go){const iA=b;var gp=g4['get']();gp['context']=g0,gp['release']=gi,gp[iA(0x2d2)]=gn,gp['callback']=go||fX,gp['errorHandler']=g8,g7>=g3||g9['paused']?g5?(gp['next']=g5,g5=gp):(g5=gp,g6=gp,g9[iA(0x2d6)]()):(g7++,g1['call'](g0,gp['value'],gp['worked']));}function gi(gn){gn&&g4['release'](gn);var go=g5;go&&g7<=g3?g9['paused']?g7--:(g6===g5&&(g6=null),g5=go['next'],go['next']=null,g1['call'](g0,go['value'],go['worked']),g6===null&&g9['empty']()):--g7===0x0&&g9['drain']();}function gj(){g5=null,g6=null,g9['drain']=fX;}function gk(){g5=null,g6=null,g9['drain'](),g9['drain']=fX;}function gl(){const iB=b;var gn=g5;for(g5=null,g6=null;gn;){var go=gn[iB(0x237)],gp=gn['callback'],gq=gn['errorHandler'],gr=gn['value'],gs=gn[iB(0x1dd)];gn[iB(0x2d2)]=null,gn['callback']=fX,gn['errorHandler']=null,gq&&gq(Error('abort'),gr),gp[iB(0x2e9)](gs,Error('abort')),gn['release'](gn),gn=go;}g9['drain']=fX;}function gm(gn){g8=gn;}}function fX(){}function fY(){this['value']=null,this['callback']=fX,this['next']=null,this['release']=fX,this['context']=null,this['errorHandler']=null;var g0=this;this['worked']=function(g1,g3){var g4=g0['callback'],g5=g0['errorHandler'],g6=g0['value'];g0['value']=null,g0['callback']=fX,g0['errorHandler']&&g5(g1,g6),g4['call'](g0['context'],g1,g3),g0['release'](g0);};}function fZ(g0,g1,g3){typeof g0=='function'&&(g3=g1,g1=g0,g0=null);function g4(gb,gc){g1['call'](this,gb)['then'](function(gd){gc(null,gd);},gc);}var g5=fW(g0,g4,g3),g6=g5['push'],g7=g5['unshift'];return g5['push']=g8,g5['unshift']=g9,g5['drained']=ga,g5;function g8(gb){const iC=b;var gc=new Promise(function(gd,ge){g6(gb,function(gf,gg){if(gf){ge(gf);return;}gd(gg);});});return gc[iC(0x298)](fX),gc;}function g9(gb){const iD=b;var gc=new Promise(function(gd,ge){g7(gb,function(gf,gg){if(gf){ge(gf);return;}gd(gg);});});return gc[iD(0x298)](fX),gc;}function ga(){return new Promise(function(gb){const iE=b;process[iE(0x1fa)](function(){const iF=iE;if(g5['idle']())gb();else{var gc=g5[iF(0x325)];g5['drain']=function(){typeof gc=='function'&&gc(),gb(),g5['drain']=gc;};}});});}}fU['exports']=fW,fU['exports']['promise']=fZ;}),dm=a9(dl(),0x1);const dn=0x493e0,dp=(fT={})=>{const iG=gA;let fU=fT['maxRetries']??0x5,fV=!0x1,fW=!0x1,fX=null,{proxy:fY}=fT,fZ=fY?new ProxyAgent({'uri':fY,'allowH2':!0x0}):new Agent({'allowH2':!0x0}),g0=U['create']({'fetch':fT['fetch'],'dispatcher':fZ,'proxy':fY,'timeout':dn,'retry':{'limit':fU,'methods':['get','head'],'statusCodes':[0x198,0x19d,0x1ad,0x1f4,0x1f6,0x1f7,0x1f8],'backoffLimit':0x7530},'throwHttpErrors':!0x0,'redirect':iG(0x1cc),'headers':{'user-agent':'Mozilla/5.0\x20(Windows\x20NT\x2010.0;\x20Win64;\x20x64)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/127.0.0.0\x20Safari/537.36'}});return Object['assign'](g0,{'close':async()=>{if(fX)return fX;fV||fW||(fV=!0x0,fX=fZ['close'](),await fX);},'destroy':async g1=>{if(fX)return fX;fV||fW||(fV=!0x0,fW=!0x0,fX=fZ['destroy'](g1??null),await fX);}});},dq=fT=>new Promise(fU=>setTimeout(fU,fT)),dr=async(fT,fU)=>{const iH=gA;let fV=await R['stat'](fU)['catch'](()=>null);(!fV||!fV['isDirectory']())&&await R['mkdir'](fU,{'recursive':!0x0});let fW=ds(fT,fU),fX=await R[iH(0x31f)](fW)['catch'](()=>null);return(!fX||!fX['isDirectory']())&&await R['mkdir'](fW,{'recursive':!0x0}),fW;},ds=(fT,fU)=>{let fV=N['resolve'](fT),fW=N['parse'](fT)['name'],fX=createHash('sha1')['update'](fV)['digest']('hex')['slice'](0x0,0xa);return N['join'](fU,fW+'-'+fX);},dt=async fT=>{const iI=gA;let fU=N['dirname'](fT),fV=N['resolve'](fU);N['parse'](fV)['root']!==fV&&(await R[iI(0x31f)](fU)['then'](()=>!0x0)['catch'](()=>!0x1)||await R['mkdir'](fU,{'recursive':!0x0}));},du=async(...fT)=>{let fU=[];for(let fV of fT)fV&&fU['push'](R['rm'](fV,{'recursive':!0x0,'force':!0x0})['catch'](()=>void 0x0));await Promise['all'](fU);},dv=fT=>fT+'.part.json',dw=fT=>{const iJ=gA;if(fT[iJ(0x2ec)])return fT['filePath'];if(fT['output'])return dv(fT['output']);throw Error('Either\x20output\x20or\x20filePath\x20is\x20required\x20for\x20FileResumeStore');},dx=fT=>{const iK=gA;if(!fT||typeof fT!=iK(0x23f))return!0x1;let fU='code'in fT?fT[iK(0x2a3)]:void 0x0;return fU==='EPERM'||fU==='EACCES'||fU==='EBUSY';},dy=async(fT,fU)=>{const iL=gA;let fV=S[iL(0x2ad)]==='win32'?[0x0,0x32,0x96,0x12c,0x1f4]:[0x0],fW;for(let fX of fV){fX>0x0&&await dq(fX);try{await R['rename'](fT,fU);return;}catch(fY){if(fW=fY,!dx(fY))break;await R['rm'](fU,{'force':!0x0})['catch'](()=>void 0x0);try{await R['rename'](fT,fU);return;}catch(fZ){if(fW=fZ,!dx(fZ))break;}}}throw fW;};var dz=class{async['get'](fT){let fU=dw(fT);if(!await R['stat'](fU)['then'](()=>!0x0)['catch'](()=>!0x1))return null;try{let fV=await R['readFile'](fU,'utf8');return JSON['parse'](fV);}catch{return null;}}async['set'](fT,fU){let fV=dw(fT);await dt(fV);let fW=fV+'.'+S['pid']+'.'+Date['now']()['toString'](0x24)+'.tmp';await R['writeFile'](fW,JSON['stringify'](fU));try{await dy(fW,fV);}finally{try{await R['rm'](fW,{'force':!0x0});}catch{}}}async['delete'](fT){let fU=dw(fT);await R['rm'](fU,{'force':!0x0})['catch'](()=>void 0x0);}};const dA=fT=>N['resolve'](fT),dB=fT=>createHash('sha1')['update'](dA(fT))['digest']('hex'),dC=fT=>fT['map']((fU,fV)=>({'index':fV,'start':fU['start'],'end':fU['end'],'output':fU[gA(0x2f2)],'completed':!0x1,'bytesWritten':0x0})),dD=(fT,fU)=>fT['parts']['length']===fU['length']?fT['parts']['every']((fV,fW)=>{let fX=fU[fW];return fX?fV['start']===fX['start']&&fV['end']===fX['end']&&(fV['output']??null)===(fX['output']??null):!0x1;}):!0x1,dE=(fT,fU)=>!fU||!fT['sourceSignature']?!0x0:fT['sourceSignature']===fU,dF=fT=>{const iM=gA;let fU=fT[iM(0x297)]['reduce']((fV,fW)=>fV+fW['bytesWritten'],0x0);return fU>0x0?fU:fT['bytesDownloaded'];},dG=fT=>{if(!fT||typeof fT!='object')return!0x1;let fU=fT;return fU['version']===0x2&&typeof fU['key']=='string'&&Array['isArray'](fU['parts'])&&typeof fU['bytesDownloaded']=='number';};var dH=class{['key'];['output'];['filePath'];['cleanupOnSuccess'];['store'];['target'];['trustExplicitKey'];constructor(fT={}){const iN=gA;if(this['output']=fT['output'],this['filePath']=fT['filePath'],this['key']=fT['key']??(this['output']?dB(this[iN(0x2f2)]):''),!this['key'])throw Error('Resume\x20key\x20is\x20required\x20when\x20output\x20is\x20not\x20provided');this['store']=fT['store']??new dz(),this['cleanupOnSuccess']=fT['cleanupOnSuccess']??!0x0,this['target']={'key':this['key'],'output':this['output'],'filePath':this['filePath']},this['trustExplicitKey']=typeof fT['key']==iN(0x214)&&fT[iN(0x27a)]['length']>0x0;}async['read'](){let fT=await this['store']['get'](this['target']);return dG(fT)?fT:null;}async['write'](fT){let fU=new Date()['toISOString'](),fV={...fT,'version':0x2,'key':this['key'],'output':fT['output']??this['output'],'bytesDownloaded':dF(fT),'createdAt':fT['createdAt']||fU,'updatedAt':fU};await this['store']['set'](this['target'],fV);}async['delete'](){const iO=gA;await this[iO(0x1d0)]['delete'](this['target']);}['createState'](fT){const iP=gA;let fU=new Date()['toISOString']();return{'version':0x2,'key':this['key'],'output':this[iP(0x2f2)],'input':fT['input'],'bytesTotal':fT[iP(0x2a9)],'bytesDownloaded':0x0,'parts':dC(fT[iP(0x297)]),'sourceSignature':fT['sourceSignature'],'planner':fT['planner'],'createdAt':fU,'updatedAt':fU};}['reconcileState'](fT,fU){const iQ=gA;let fV=fT['version']!==0x2,fW=fT['key']!==this['key'],fX=!this['trustExplicitKey']&&!dE(fT,fU[iQ(0x1dc)]),fY=!dD(fT,fU['parts']);if(fV||fW||fX||fY)return{'state':this['createState'](fU),'reset':!0x0};let fZ={...fT,'key':this['key'],'output':this['output'],'input':fU['input'],'bytesTotal':fU['bytesTotal'],'sourceSignature':fU[iQ(0x1dc)],'planner':fU['planner'],'parts':fU['parts']['map']((g0,g1)=>{let g3=fT['parts'][g1];return{'index':g1,'start':g0['start'],'end':g0['end'],'output':g0['output'],'completed':g3?.['completed']??!0x1,'bytesWritten':g3?.['bytesWritten']??0x0};}),'createdAt':fT['createdAt'],'updatedAt':fT['updatedAt']};return fZ['bytesDownloaded']=dF(fZ),{'state':fZ,'reset':!0x1};}['markPartCompleted'](fT,fU,fV){const iR=gA;let fW=fT['parts'][fU];if(!fW)return fT;let fX=fW['bytesWritten'];return fW[iR(0x28b)]=!0x0,fW[iR(0x25c)]=fV,fT['bytesDownloaded']=Math['max'](0x0,fT['bytesDownloaded']-fX+fV),fT['updatedAt']=new Date()['toISOString'](),fT;}async[gA(0x31d)](){const iS=gA;let fT=await this['read']();if(!fT)return null;let fU=fT[iS(0x1eb)];if(fT['bytesTotal']){let fX=fT['bytesTotal'];return{'bytesDownloaded':fU,'totalBytes':fX,'percentComplete':fX>0x0?Math['round'](fU/fX*0x64):0x0};}let fV=fT['parts']['length'],fW=fT['parts']['filter'](fY=>fY['completed'])['length'];return{'bytesDownloaded':fU,'totalBytes':null,'percentComplete':fV>0x0?Math['round'](fW/fV*0x64):0x0,'segmentsCompleted':fW,'segmentsTotal':fV};}};const dI=0x8*0x2**0x14,dJ=(fT,fU,fV)=>{const iT=gA;let fW=iT(0x1cd)+fV+iT(0x31b);return N['join'](fU,fW);},dK=(fT,fU,fV)=>{const iU=gA;let fW=Math['ceil'](fT/Math['max'](0x1,fU));return Math[iU(0x23c)](0x1,Math['min'](fW,Math['max'](0x1,fV)));},dL=(fT,fU,fV)=>{let fW=dK(fT,fU,fV),fX=[],fY=0x0;for(;fY<fT;){let fZ=Math['min'](fT-0x1,fY+fW-0x1);fX['push']([fY,fZ]),fY=fZ+0x1;}return fX;},dM=fT=>{let [fU,fV]=fT;return'bytes='+fU+'-'+(fV||'');},dN=fT=>dL(fT['contentLength'],fT['maxWorkerCount'],fT[gA(0x241)]??dI)[gA(0x1f9)](fU=>{let [fV,fW]=fU,fX=new Headers(fT['requestInit']?.['headers']);return fX['set']('Range',dM([fV,fW])),{'url':fT['url'],'headers':fX,'start':fV,'end':fW};}),dO=fT=>{let fU=fT?Error('The\x20operation\x20was\x20aborted',{'cause':fT}):Error('The\x20operation\x20was\x20aborted');return fU['name']='AbortError',fU;},dP=fT=>{const iV=gA;if(!(fT instanceof Error))return!0x1;if(fT['name']===iV(0x2bd)||fT['code']==='ABORT_ERR')return!0x0;let fU=fT['cause'];return fU instanceof Error&&fU['name']==='AbortError';},dQ=async fT=>await fT['client']['get'](fT[gA(0x2dd)],{'redirect':gA(0x1cc),...fT['requestInit']}),dR=(fT,fU,fV)=>async fW=>{const iW=gA;if(fV?.[iW(0x227)])throw dO();let fX=typeof fU=='number'?{'flags':'r+','start':fU}:{'flags':'w'},fY=L['createWriteStream'](fT,fX),fZ=Readable['fromWeb'](fW['body']);try{await pipeline(fZ,fY,{'signal':fV});}catch(g0){throw dP(g0)?dO(g0):g0;}if(fV?.['aborted'])throw dO();return fW;},dS=(fT,fU,fV)=>fW=>{if(fV?.['aborted'])throw dO();let fX=parseInt(fW['headers']['get']('content-length')||'0');if(fT['increase'](fX),fV?.['aborted'])throw dO();return fU&&!fV?.['aborted']?fU(fT['toProgressInfo']()):fT['log'](),fW;},dT=fT=>typeof fT=='boolean'?{'enabled':fT,'cleanupOnSuccess':!0x0}:fT?{'enabled':fT['enabled']??!0x0,'key':fT['key'],'store':fT['store'],'filePath':fT['filePath'],'cleanupOnSuccess':fT['cleanupOnSuccess']??!0x0}:{'enabled':!0x1,'cleanupOnSuccess':!0x0},dU=fT=>({'tempDir':fT['tempDir']??process['cwd'](),'maxRetries':fT['maxRetries']??0x5,'maxChunkSize':fT['maxChunkSize']??dI,'maxWorkerCount':fT['maxWorkerCount']??0x4,'resume':dT(fT['resume']),'proxy':fT[gA(0x24a)],'requestInit':fT['requestInit'],'fetchFn':fT['fetchFn']}),dV={'total':{'b':0x0,'mb':0x0},'current':{'b':0x0,'mb':0x0},'chunkSize':0x0,'chunkSizes':[],'averageSize':{'b':0x0,'mb':0x0},'averageTotal':{'b':0x0,'mb':0x0},'speed':{'bps':0x0,'mbps':0x0}},dW=fT=>{let fU=Math['floor'](fT/0xe10),fV=Math['floor'](fT%0xe10/0x3c),fW=fT%0x3c,fX=fU>0x0?fU+'h':'',fY=fV>0x0?fV+'m':'',fZ=fW>0x0?fW+'s':'';return fU>0x0?fX+'\x20'+(fY||'0m')+'\x20'+(fZ&&''+fZ):!fU&&fV>0x0?fY+'\x20'+(fZ&&''+fZ):fZ;},dX=(fT=0x0)=>{let fU=structuredClone(dV),fV=0x0,fW=setInterval(()=>{fV>0x1&&(fU['speed']['bps']=fU['current']['b']/fV),fV+=0.5;},0x1f4);return{'state':fU,'setTotal':fX=>{fU['total']['b']=fX,fU['total']['mb']=fX/0x400/0x400;},'setCurrent'(fX){fU['current']['b']=fX,fU['current']['mb']=fX/0x400/0x400;},'increase'(fX){const iX=b;fU['current']['b']+=fX,fU['current']['mb']=fU['current']['b']/0x400/0x400,fU['speed']['mbps']=fU['speed']['bps']/0x400/0x400,fU['chunkSize']=fX,fU['chunkSizes']['push'](fX),fU['averageSize']['b']=fU['current']['b']/fU['chunkSizes'][iX(0x21c)],fU['averageSize']['mb']=fU['averageSize']['b']/0x400/0x400,fU['averageTotal']['b']=fT*fU['averageSize']['b'],fU['averageTotal']['mb']=fU['averageTotal']['b']/0x400/0x400;},'stop'(){clearInterval(fW),Object['assign'](fU,dV);},'log'(){let fX=fU['current']['b'],fY=fU['total']['b'],fZ=fX+(fY?'/'+fY:'');stdout['write']('\x0dDownloading\x20['+fZ+']');},'stopLog'(){stdout['write']('\x0a');},'toString'(){const iY=b;let fX='';fU['speed']['bps']&&(fX+=fU['speed']['mbps']['toFixed'](0x1)+'\x20MB/s\x20–\x20'),fX+=''+fU['current']['mb']['toFixed'](0x1),fU['total']['b']?fX+='\x20of\x20'+fU['total']['mb']['toFixed'](0x1)+'\x20MB':fX+='\x20MB';let fY=fU['total']['b']||fU['averageTotal']['b'];if(fY){let fZ=fY-fU[iY(0x2f7)]['bps']*fV,g0=Math['round'](fZ/fU['speed']['bps']),g1=dW(g0);g0&&isFinite(g0)&&g1&&(fX+=',\x20'+g1+'\x20left');}return fX;},'toProgressInfo'(){let fX=fU['total']['b']||null;return{'bytesDownloaded':fU['current']['b'],'totalBytes':fX,'percentComplete':fX?fU['current']['b']/fX*0x64:null,'bytesPerSecond':fU['speed']['bps'],'estimatedSecondsRemaining':fU['speed']['bps']>0x0&&fX?(fX-fU['current']['b'])/fU['speed']['bps']:null};}};},dY=new Set(['authorization','cookie','set-cookie','x-amz-date','x-amz-security-token','x-amz-content-sha256','x-goog-date','x-goog-security-token']),dZ=(fT,fU={})=>{if(!fT)return[];let fV=fU['includeVolatile']??!0x1,fW=[];return new Headers(fT)['forEach']((fX,fY)=>{!fV&&dY['has'](fY['toLowerCase']())||fW['push']([fY,fX]);}),fW['sort'](([fX],[fY])=>fX['localeCompare'](fY)),fW;},e0=fT=>{const iZ=gA;try{let fU=new URL(fT),fV=fU['pathname']['split']('/')['map'](fW=>fW&&(fW['includes']('=')||fW[iZ(0x2e0)](',')?':volatile':fW))['join']('/');return''+fU['origin']+fV;}catch{let fW=String(fT);return(fW['split']('#')[0x0]??fW)['split']('?')[0x0]||fW;}},e1=fT=>({'url':e0(fT[gA(0x2dd)]),'start':fT['start'],'end':fT['end'],'output':fT['output'],'headers':dZ(fT['headers'])}),e2=fT=>{const j0=gA;let fU={'input':Array['isArray'](fT['input'])?fT['input']['map'](fV=>e1(fV)):e0(String(fT['resolvedUrl'])),'requestHeaders':dZ(fT[j0(0x207)]),'parts':fT['parts']['map'](fV=>e1(fV)),'maxWorkerCount':fT['maxWorkerCount'],'maxChunkSize':fT['maxChunkSize']};return createHash('sha1')['update'](JSON['stringify'](fU))['digest']('hex');},e3=async fT=>{const j1=gA;if(!fT[j1(0x1e0)])return null;let fU={'input':Array['isArray'](fT['input'])?fT['input']:fT['resolvedUrl'],'parts':fT['parts'],'bytesTotal':fT[j1(0x2a9)],'sourceSignature':fT['sourceSignature'],'planner':{'maxWorkerCount':fT['maxWorkerCount'],'maxChunkSize':fT['maxChunkSize']}},fV=await fT['manager']['read'](),fW=(fV?fT['manager']['reconcileState'](fV,fU):null)?.['state']??fT['manager']['createState'](fU);return await fT['manager']['write'](fW),fW;},e4=fT=>{const j2=gA;if(fT&&!fT['parts'][j2(0x2c8)](fU=>fU['completed']))throw Error('Not\x20all\x20segments\x20were\x20downloaded\x20successfully.\x20Try\x20resuming\x20later.');},e5=fT=>{const j3=gA;if(Array['isArray'](fT['input']))return fT['input']['map']((fU,fV)=>({...fU,'output':dJ(fT['url'],fT['tempFileDir'],fV)}));if(!fT['acceptsRanges'])throw Error('Unable\x20to\x20get\x20parts');if(!fT['size'])throw Error('Size\x20is\x20not\x20known');return dN({'url':fT['url'],'requestInit':fT['requestInit'],'contentLength':fT[j3(0x2c7)],'maxWorkerCount':fT['maxWorkerCount'],'maxChunkSize':fT['maxChunkSize']});},e6=async fT=>{const j4=gA;if(!fT['parts']['some'](fV=>typeof fV['start']=='number'&&(fV['output']??fT['output'])===fT[j4(0x2f2)])||await R['stat'](fT['output'])['then'](()=>!0x0)[j4(0x298)](()=>!0x1))return;let fU=await R[j4(0x296)](fT[j4(0x2f2)],'w');fT['size']&&fT['size']>0x0&&await fU['truncate'](fT['size']),await fU['close']();},e7=()=>{let fT=Error('The\x20operation\x20was\x20aborted');return fT['name']='AbortError',fT;},e8=fT=>{let fU=fT['match'](/bytes\s+(\d+)-(\d+)\/(\d+|\*)/i);if(!fU||!fU[0x1]||!fU[0x2]||!fU[0x3])return null;let fV=parseInt(fU[0x1],0xa),fW=parseInt(fU[0x2],0xa),fX=fU[0x3];if(!Number['isFinite'](fV)||!Number['isFinite'](fW)||fW<fV)return null;if(fX==='*')return{'start':fV,'end':fW,'total':null};let fY=parseInt(fX,0xa);return!Number['isFinite'](fY)||fY<=0x0?null:{'start':fV,'end':fW,'total':fY};},e9=(fT,fU)=>{const j5=gA;if(typeof fU['start']!='number'||typeof fU[j5(0x2ef)]!='number')return;if(fT['status']!==0xce)throw Error('Range\x20request\x20failed\x20for\x20bytes='+fU['start']+'-'+fU['end']+':\x20expected\x20206,\x20got\x20'+fT['status']);let fV=fT['headers']['get']('content-range');if(!fV)throw Error('Range\x20request\x20failed\x20for\x20bytes='+fU[j5(0x290)]+'-'+fU['end']+':\x20missing\x20Content-Range\x20header');let fW=e8(fV);if(!fW)throw Error('Range\x20request\x20failed\x20for\x20bytes='+fU['start']+'-'+fU['end']+':\x20invalid\x20Content-Range\x20\x22'+fV+'\x22');if(fW['start']!==fU['start']||fW['end']!==fU['end'])throw Error('Range\x20request\x20failed\x20for\x20bytes='+fU['start']+'-'+fU['end']+':\x20got\x20bytes='+fW['start']+'-'+fW['end']);},ea=async(fT,fU,fV)=>{const j6=gA;let fW=fT['headers']['get']('content-length');if(fW){let fY=parseInt(fW,0xa);if(Number['isFinite'](fY)&&fY>0x0)return fY;}let fX=fT['headers']['get']('content-range');if(fX){let fZ=fX['match'](/bytes\s+(\d+)-(\d+)\//i);if(fZ&&fZ[0x1]&&fZ[0x2]){let g0=parseInt(fZ[0x1],0xa),g1=parseInt(fZ[0x2],0xa);if(Number['isFinite'](g0)&&Number['isFinite'](g1)&&g1>=g0)return g1-g0+0x1;}}return typeof fU['start']=='number'&&typeof fU['end']==j6(0x260)?Math['max'](0x0,fU['end']-fU['start']+0x1):fU['output']&&fU['output']!==fV?R[j6(0x31f)](fU['output'])['then'](g3=>g3['size'])['catch'](()=>0x0):0x0;},eb=(fT,fU)=>fT['map']((fV,fW)=>fW)['filter'](fV=>!(fU?.['parts'][fV]?.['completed']??!0x1)),ec=fT=>{let fU=Promise['resolve']();return{'enqueue':()=>(fU=fU['then'](fT),fU),'onIdle':()=>fU};},ed=async fT=>{const j7=gA;let fU=fT['signal']??fT['requestInit']?.['signal']??void 0x0,fV=()=>{if(fU?.['aborted'])throw e7();};fV();let fW=eb(fT['parts'],fT[j7(0x235)]),fX=dm['promise'](async g6=>{let {index:g7,part:g8}=g6;fV();let g9=await dQ({'index':g7,'client':fT['client'],'url':g8['url'],'requestInit':{...fT['requestInit'],'signal':fU,'headers':g8['headers']??fT['requestInit']?.['headers']}});if(fV(),e9(g9,g8),await dR(g8['output']??fT['output'],g8['start'],fU)(g9),dS(fT['progress'],fT['onProgress'],fU)(g9),fV(),fT['resumeState']&&fT['resumeManager']){let ga=await ea(g9,g8,fT['output']);fT['resumeManager']['markPartCompleted'](fT['resumeState'],g7,ga),await g1['enqueue']();}},fT[j7(0x2b1)]),fY=()=>{fX['pause'](),fX['killAndDrain'](),fX['kill']();};if(fU?.['aborted'])throw fY(),e7();let fZ=()=>{},g0=fU?new Promise((g6,g7)=>{let g8=()=>{fY(),g7(e7());};fU['addEventListener']('abort',g8,{'once':!0x0}),fZ=()=>fU['removeEventListener']('abort',g8);}):null,g1=ec(async()=>{const j8=j7;!fT['resumeState']||!fT['resumeManager']||await fT[j8(0x1d2)]['write'](fT['resumeState']);}),g3=fW['map'](g6=>{let g7=fT['parts'][g6];return g7?(fV(),fX['push']({'index':g6,'part':g7})):Promise['resolve']();}),g4=[];try{let g6=Promise['allSettled'](g3);g0&&(await Promise['race']([g6,g0]),fV()),g4=await g6;}finally{fZ(),await g1['onIdle']();}let g5=g4['find'](g7=>g7['status']==='rejected');if(g5?.['status']==='rejected')throw g5['reason'];},ee=async(fT,fU)=>{await new Promise((fV,fW)=>{const j9=b;let fX=L['createReadStream'](fT),fY=()=>{fU['off']('error',fZ),fX['off']('error',g0),fX['off']('end',g1);},fZ=g3=>{fY(),fW(Error('Output\x20write\x20stream\x20error',{'cause':g3}));},g0=g3=>{fY(),fW(Error('Segment\x20read\x20stream\x20error',{'cause':g3}));},g1=()=>{fY(),fV();};fU['on'](j9(0x23a),fZ),fX['on']('error',g0),fX['on']('end',g1),fX['pipe'](fU,{'end':!0x1});});},ef=async fT=>{let fU=fT['parts']['map'](fW=>fW['output'])['filter'](fW=>!!fW&&fW!==fT['output']);if(!fU['length'])return;let fV=L['createWriteStream'](fT['output']);for(let fW of fU)await ee(fW,fV);fV['end'](),await finished(fV);},eg=async fT=>{const ja=gA;if(!fT['expectedSize'])return;let fU=await R[ja(0x31f)](fT['output'])['then'](fV=>fV['size'])['catch'](()=>null);if(fU&&fU!==fT['expectedSize'])throw Error('Actual\x20size\x20'+fU+'\x20doesn\x27t\x20match\x20expected\x20size\x20'+fT['expectedSize']);},eh=async fT=>{const jb=gA;fT['resumeManager']&&fT['resumeManager'][jb(0x25f)]&&await fT['resumeManager']['delete'](),await du(fT[jb(0x28e)]);},ei=async fT=>{const jc=gA;let fU=e2({'input':fT['input'],'resolvedUrl':fT['url'],'parts':fT[jc(0x297)],'requestHeaders':fT['requestInit']?.['headers'],'maxWorkerCount':fT['maxWorkerCount'],'maxChunkSize':fT['maxChunkSize']}),fV=await e3({'manager':fT['resumeManager'],'input':fT[jc(0x2be)],'resolvedUrl':fT['url'],'parts':fT['parts'],'bytesTotal':fT[jc(0x2c7)]??void 0x0,'sourceSignature':fU,'maxWorkerCount':fT['maxWorkerCount'],'maxChunkSize':fT['maxChunkSize']}),fW=dX(fT['parts']['length']);fT['size']&&fW['setTotal'](fT['size']),fV?.['bytesDownloaded']&&fW['setCurrent'](fV['bytesDownloaded']),await e6({'output':fT['output'],'size':fT['size'],'parts':fT['parts']});try{await ed({'parts':fT['parts'],'output':fT['output'],'maxWorkerCount':fT['maxWorkerCount'],'client':fT[jc(0x2b5)],'requestInit':fT['requestInit'],'progress':fW,'onProgress':fT['onProgress'],'resumeState':fV,'resumeManager':fT['resumeManager'],'signal':fT['signal']});}finally{fW['stop'](),fT['onProgress']||fW['stopLog']();}e4(fV),await ef({'output':fT['output'],'parts':fT['parts']}),await eg({'output':fT['output'],'expectedSize':Array['isArray'](fT['input'])?null:fT[jc(0x2c7)]}),await eh({'tempFileDir':fT['tempFileDir'],'resumeManager':fT[jc(0x1d2)]});},ej=async fT=>{const jd=gA;let fU=new Headers(fT['requestInit']?.['headers']);fU[jd(0x337)]('Range','bytes=0-0');let fV=Array['isArray'](fT[jd(0x2be)])?fT[jd(0x2be)][0x0]?.['url']:fT['input'];if(!fV)throw Error(jd(0x2b4));let fW=await fT['client'][jd(0x27d)](fV,{...fT['requestInit'],'headers':fU}),fX=fW['headers']['get']('content-type'),fY=fW['headers']['get']('content-length'),fZ=fW['headers']['get']('content-range'),g0=fZ?.['split']('/')?.[0x1]||fY,g1=g0&&!Array[jd(0x273)](fT['input'])?parseInt(g0,0xa):null,g3=fW['headers']['get']('accept-ranges')==='bytes'||!!fZ?.['includes']('bytes')||!!fX?.['includes']('video')||!!fX?.['includes']('audio')||!!fX?.['includes']('octet-stream');return{'url':fW['url'],'size':g1,'acceptsRanges':g3};};var ek=class gy{['input'];['output'];['resume'];['onProgress'];['config'];['client'];['resumeManager'];['executed']=!0x1;['probe'];['tempFileDir'];constructor(fT){const je=gA;this['input']=fT['input'],this['output']=fT['output'],this['resume']=fT['resume'],this['onProgress']=fT['onProgress'],this['config']=dU(fT),this['client']=dp({'maxRetries':this['config']['maxRetries'],'proxy':this[je(0x2d4)]['proxy'],'fetch':this['config']['fetchFn']}),this[je(0x2d4)]['resume']['enabled']&&(this['resumeManager']=new dH({'output':this[je(0x2f2)],'key':this['config']['resume']['key'],'filePath':this[je(0x2d4)]['resume']['filePath'],'store':this['config']['resume']['store'],'cleanupOnSuccess':this['config']['resume'][je(0x25f)]}));}static async['init'](fT){let fU=new gy(fT);return await fU['_init'](),fU;}async['_init'](){const jf=gA;this['probe']=await ej({'client':this['client'],'input':this['input'],'requestInit':this['config']['requestInit']}),await dt(this['output']),this['tempFileDir']=await dr(this['output'],this['config']['tempDir']),this[jf(0x2d4)]['resume']['enabled']||(await du(this[jf(0x2f2)],dv(this['output']),this['tempFileDir']),this['tempFileDir']=await dr(this['output'],this['config']['tempDir']));}async['execute'](){const jg=gA;if(!this['probe']||!this[jg(0x28e)])throw Error('Download\x20was\x20not\x20initialized.\x20Use\x20Download.init(options).');if(this['executed'])throw Error('Download.execute()\x20can\x20only\x20be\x20called\x20once\x20per\x20instance.');this['executed']=!0x0;try{let fT=e5({'input':this[jg(0x2be)],'url':this['probe']['url'],'size':this['probe']['size'],'acceptsRanges':this['probe']['acceptsRanges'],'requestInit':this['config']['requestInit'],'tempFileDir':this['tempFileDir'],'maxWorkerCount':this[jg(0x2d4)]['maxWorkerCount'],'maxChunkSize':this['config'][jg(0x241)]});await ei({'input':this['input'],'output':this['output'],'url':this[jg(0x22d)]['url'],'size':this['probe'][jg(0x2c7)],'requestInit':this['config']['requestInit'],'maxWorkerCount':this['config']['maxWorkerCount'],'maxChunkSize':this['config']['maxChunkSize'],'onProgress':this['onProgress'],'client':this['client'],'parts':fT,'tempFileDir':this['tempFileDir'],'resumeManager':this['resumeManager'],'signal':this['config']['requestInit']?.['signal']??void 0x0});}finally{try{await this['close']();}catch{}}}async['getSize'](){if(this['probe']||=await ej({'client':this['client'],'input':this['input'],'requestInit':this['config']['requestInit']}),!this['probe']['size'])throw Error('Size\x20is\x20not\x20known');return this['probe']['size'];}async['close'](){const jh=gA;await this[jh(0x2b5)]['close']();}};const el=async({attempts:fT,fn:fU,shouldRetry:fV,onRetry:fW})=>{const ji=gA;let fX=Math[ji(0x23c)](0x1,Math['trunc'](fT)),fY;for(let fZ=0x1;fZ<=fX;fZ+=0x1)try{return await fU(fZ);}catch(g0){if(fY=g0,fZ>=fX||!fV?.(g0,fZ))throw g0;await fW?.(g0,fZ);}throw fY instanceof Error?fY:Error(String(fY));},em=()=>{if(!(process['platform']!=='win32'||process.env.ELECTRON_RUN_AS_NODE!=='1')&&!isatty(process['stderr']['fd'])&&ac()?.['getConsoleSize']?.()?.['columns'])try{let fT=aa('nanospinner/dist/consts.js');fT&&fT['isTTY']===!0x1&&(fT['isTTY']=!0x0,fT['symbols']?.['frames']?.['length']===0x1&&(fT['symbols']['frames']=['-','\x5c','|','/']));}catch{}},en=fT=>{const jj=gA;let fU=process['stderr'];if(!fT||process['platform']!=='win32'||process.env.ELECTRON_RUN_AS_NODE!=='1')return fU;if(!fU['columns']||fU['columns']!==fT){let fV=Object[jj(0x243)](fU,'columns')??Object['getOwnPropertyDescriptor'](Object['getPrototypeOf'](fU),jj(0x271));if(!fV||fV['writable']||fV['set'])try{fU['columns']=fT;}catch{}if(fU['columns']!==fT){let fW=Object['create'](fU);return Object['defineProperty'](fW,'columns',{'value':fT,'configurable':!0x0,'enumerable':!0x0,'writable':!0x0}),C['warn']('Unable\x20to\x20override\x20stderr.columns;\x20using\x20spinner-local\x20width\x20'+fT+'.'),fW;}}return fU;},eo={'debug':'gray','info':'green','warn':'yellow','error':'red'},ep=fT=>{let fU=fT['toUpperCase'](),fV=P[eo[fT]];return fV(fU);},eq=(fT,fU)=>typeof fU=='string'?fT+'\x20'+fU:fU&&{...fU,'text':(fT+'\x20'+(fU['text']??''))['trimEnd']()},er=(fT,fU)=>{const jk=gA;em();let fV=E(ep(jk(0x210))),fW=createSpinner(fT,{'stream':en(ac()?.['getConsoleSize']?.()?.['columns']??process['stderr']['columns']??process['stdout']['columns']??(process[jk(0x2ad)]==='win32'?0x78:0x50))})['start']({'text':fV+'\x20'+fT,'color':fU}),fX=fW['update']['bind'](fW),fY=fW['success']['bind'](fW),fZ=fW['error']['bind'](fW);return fW['update']=g0=>fX(eq(fV,g0)),fW['success']=g0=>fY(eq(fV,g0)),fW['error']=g0=>fZ(eq(fV,g0)),fW;},es=0x10,et=fT=>{if(!(!fT||typeof fT!='object'||!('drm'in fT)))return fT['drm']?.['widevine']?.['pssh'];},eu=(fT,fU)=>createHash('sha1')['update'](fT+':'+cs(fU))['digest']('hex'),ev=({outputDirectory:fT,resolvedFilenameWithoutExtension:fU,track:fV})=>join(fT,fU+'.'+createHash(gA(0x283))[gA(0x32a)](cs(fV))['digest']('hex')['slice'](0x0,0x6)+'.'+(fV['type']==='subtitle'?'vtt':fV['type']==='audio'?'m4a':'mp4')),ew=(fT,fU)=>{if(fU)return{'Range':'bytes='+fT+'-'+(fT+fU-0x1)};},ex=async fT=>{const jl=gA;if(fT['sourceUrl']&&!fT['inputTrack'])return fT[jl(0x2e4)];let fU=[],fV=await cQ(fT),fW=fV[0x0];fW?.['initSegment']&&fU['push']({'url':fW[jl(0x319)]['location']['path'],'headers':ew(fW[jl(0x319)]['location']['offset'],fW['initSegment']['location']['length'])});for(let fX of fV)fU['push']({'url':fX['location']['path'],'headers':ew(fX['location']['offset'],fX['location']['length'])});return!fU['length']&&fT['sourceUrl']?fT['sourceUrl']:fU['length']===0x1&&!fU[0x0]?.['headers']?fU[0x0]['url']:fU;},ey=fT=>{let fU=Math['max'](0x1,Math['trunc'](fT)),fV=Math['min'](es,fU);return{'normalizedRequestedConnections':fU,'maxWorkerCount':fV,'wasClamped':fU!==fV};},ez=fT=>Math['max'](0x1,Math['trunc'](fT)+0x1),eA=(fT,fU)=>fU['origin']==='manifest'?{'enabled':!0x0,'key':eu(fT,fU)}:!0x0,eB=({title:fT,progress:fU,track:fV,filepath:fW,target:fX})=>{const jm=gA;let fY={'b':fU['totalBytes']??NaN,'mb':(fU['totalBytes']??NaN)/0x400/0x400},fZ={'b':fU['bytesDownloaded']??NaN,'mb':(fU['bytesDownloaded']??NaN)/0x400/0x400},g0=fU['totalBytes']?Math['round'](fU['bytesDownloaded']/fU['totalBytes']*0x64):void 0x0;return{'title':fT,'total':fY,'current':fZ,'percentage':g0,'speed':{'bps':fU['bytesPerSecond']??NaN,'mbps':(fU['bytesPerSecond']??NaN)/0x400/0x400},'trackName':basename(fW),'trackPath':fW,'finalName':fX['finalName'],'finalPath':fX['finalPath'],'state':g0===0x64?'downloaded':jm(0x307),'quality':fV['type']==='video'&&fV['width']?fV['width']+'x'+fV['height']:void 0x0,'codec':fV['type']==='video'?fV['codec']??void 0x0:void 0x0};},eC=fT=>'Downloading\x20∙\x20'+((fT['bytesDownloaded']/0x400/0x400)['toFixed'](0x2)+'\x20MB')+(fT['totalBytes']?'\x20of\x20'+(fT['totalBytes']/0x400/0x400)['toFixed'](0x2)+'\x20MB':''),eD=fT=>fT['flatMap'](fU=>{let fV=fU['segments']?.[0x0],fW=et(fV?.['initSegment']?.['encryption'])??et(fV?.['encryption']);return fW?[fW]:[];})['map'](fU=>{const jn=gA;let fV=fU;return typeof fV=='string'?fV:fV instanceof Uint8Array||fV instanceof ArrayBuffer?Buffer['from'](fV)['toString']('base64'):ArrayBuffer['isView'](fV)?Buffer['from'](fV['buffer'])[jn(0x2ab)]('base64'):String(fV);}),eE=(fT,fU)=>({'path':fU,'type':fT['type'],'language':fT['languageCode'],'label':fT['name']??void 0x0,'forced':fT['type']==='subtitle'?fT[gA(0x266)]:!0x1}),eF=async({track:fT,filepath:fU,description:fV,target:fW,source:fX,options:fY,settings:fZ,abortSignal:g0,title:g1,emitProgress:g3})=>{const jo=gA;C['info'](fV),C['debug']('Path:\x20'+fU);let g4=fY['connections']??fZ['get'](jo(0x29c))??0x1,{maxWorkerCount:g5,wasClamped:g6}=ey(g4);g6&&C['warn']('Connections\x20value\x20'+g4+'\x20was\x20clamped\x20to\x20'+g5+jo(0x30d)),C[jo(0x1e2)]('Max\x20worker\x20count:\x20'+g5);let g7=er('Downloading','yellow'),g8='',g9=await ex(fT),ga=ez(fY['retry']??fZ['get'](jo(0x230))??0x1);try{await el({'attempts':ga,'fn':async()=>{let gb=await ek['init']({'input':g9,'output':fU,'tempDir':m,'requestInit':{'headers':fX['headers'],'signal':g0},'proxy':fY['proxyMedia']||fY['proxy']||void 0x0,'resume':eA(fX['url'],fT),'maxRetries':fY['retry'],'maxWorkerCount':g5,'onProgress':gc=>{g3(eB({'title':g1,'progress':gc,'track':fT,'filepath':fU,'target':fW})),g8=eC(gc),g7['update'](g8);}});if(g0?.['aborted']){C['debug']('Track\x20download\x20skipped,\x20already\x20aborted:\x20'+fU);let gc=Error('The\x20operation\x20was\x20aborted');throw gc['name']='AbortError',gc;}await gb['execute']();},'shouldRetry':gb=>!(gb instanceof Error&&gb['name']==='AbortError'),'onRetry':async(gb,gc)=>{let gd=gb instanceof Error?gb['message']:String(gb);C['warn']('Track\x20download\x20retry\x20'+gc+'/'+(ga-0x1)+'\x20scheduled\x20for\x20'+fU+':\x20'+gd);}}),g7['success'](g8);}catch(gb){if(g7[jo(0x23a)](fV),gb instanceof Error&&gb['name']==='AbortError')throw gb;let gc=gb instanceof Error?gb['message']:String(gb);throw C['error']('Download\x20track\x20failed:\x20'+gc),gb instanceof Error&&gb['stack']?C['debug'](gb['stack']):C['debug'](gc),gb instanceof Error?gb:Error(gc);}},eG=fT=>fT instanceof Error&&fT['name']==='AbortError',eH=fT=>!!fT&&typeof fT=='object'&&'aborted'in fT&&gA(0x1f0)in fT&&typeof fT[gA(0x1f0)]=='function';var eI=class extends T{#e;#t;#n;#r;#i;#a;constructor({settings:fT,downloadsStorage:fU}){super(),this.#i=fT,this.#a=fU;}async['start'](fT,fU,fV={'id':crypto['randomUUID']()},fW,fX){eH(fW)?(this.#r=new AbortController(),fW['addEventListener']('abort',()=>{this.#r?.['abort']();})):this.#r=void 0x0;let fY=new D({'proxyUrl':fT['proxy']||fT['proxyMeta']||void 0x0});this.#e={...fT},this.#t=fU,this.#n={...fV};let fZ;try{this.#o();let g0=await dj(fY,this.#t);g0['matchedContentLabel']&&C['info']('Content\x20Matched:\x20'+g0['matchedContentLabel']),C['info']('Parsing\x20streams...'),fZ=await dh({'http':fY,'options':this.#e,'source':this.#t,'meta':this.#n,'input':fX,'detection':g0}),this.#e=fZ['options'],this.#n=fZ['meta'],await aF(this.#i['get']('downloadDir'));let g1=cC({'settings':this.#i,'options':this.#e,'source':this.#t,'meta':this.#n,'allTracks':fZ['allTracks']});return this.#s(g1['outputPath'],g1['resolvedFilenameWithoutExtension']),await this.#c(fZ,g1);}catch(g3){if(eG(g3))throw g3;let g4=cx(g3);throw this['emit']('error',g4),g4;}finally{await fZ?.['dispose']?.();}}#o(){const jp=gA;C['debug']('URL:\x20'+this.#t['url']);let fT='seasonNumber'in this.#n?this.#n['seasonNumber']:void 0x0,fU='episodeNumber'in this.#n?this.#n['episodeNumber']:void 0x0,fV='episodeTitle'in this.#n?this.#n[jp(0x2f0)]:'',fW=[this.#n['title'],fT?'S'+fT:'',fU?'E'+fU:'',fV]['filter'](Boolean)['join']('\x20∙\x20');fW&&C['info'](fW);}#s(fT,fU){const jq=gA;this['emit']('output-path',fT),C['debug'](jq(0x2f3)+fT);let fV=cB(this.#n),fW=this.#a['getByFilePath'](fT);fW&&(fW['title']=fV['title']||fU),C['debug']('Emit\x20download\x20start'),this['emit']('start',this.#a['jobs']);}async #c(fT,fU){const jr=gA;C['debug']('Downloading\x20tracks');let fV=[];cu(fT['tracks']['all']);for(let fW of fT['tracks'][jr(0x25e)]){let fX=ev({'outputDirectory':fU['outputDirectory'],'resolvedFilenameWithoutExtension':fU['resolvedFilenameWithoutExtension'],'track':fW}),fY=cr(fW,fU['resolvedFilenameWithoutExtension']);fW['type']==='subtitle'&&C['debug']('URL:\x20'+(fW['sourceUrl']??'manifest\x20subtitle\x20track')),await eF({'track':fW,'filepath':fX,'description':fY,'target':{'finalName':fU['filenameWithExtension'],'finalPath':fU['outputPath']},'source':this.#t,'options':this.#e,'settings':this.#i,'abortSignal':this.#r?.['signal'],'title':cB(this.#n)['title'],'emitProgress':fZ=>{this['emit']('progress',fZ,fU['outputPath']);}}),await aB(fX)&&fV['push'](eE(fW,fX));}return{'downloaded':fV,'psshList':eD(fT['tracks']['all']),'selectedTracks':fT['tracks']['all']};}};const eJ=fT=>{try{let fU=new URL(fT),fV=[...new Set(fU['searchParams']['keys']())],fW=fV['length']?'?'+fV['join'](','):'';return''+fU['origin']+fU['pathname']+fW;}catch{return fT;}},eK=async(fT,fU)=>{const js=gA;let {verbose:fV,url:fW,resolveLicense:fX}=fU,fY=Buffer['from'](fT,'base64'),fZ='cenc',g0=bq(bp(),'drm'),g1=new RemoteCdm({'keySystem':'com.widevine.alpha','baseUrl':g0,'headers':{'Authorization':'Bearer\x20'+bK['accessToken']}}),g3='initializing',g4=null;try{C['debug']('DRM\x20key\x20request\x20started:\x20license='+eJ(fW)+js(0x28d)+eJ(g0)+',\x20psshLength='+fT['length']+',\x20initDataBytes='+fY['length']),g3='requesting-media-key-system-access';let g5=requestMediaKeySystemAccess(g1['keySystem'],[]);g3='creating-media-keys';let g6=await g5['createMediaKeys']({'cdm':g1});g3='creating-session',g4=g6['createSession'](),g3='generating-license-request',C['debug']('Generating\x20license\x20request...');let g7=g4['waitForLicenseRequest']();await g4['generateRequest']('cenc',fY);let g8=await g7;C['debug']('License\x20request\x20of\x20'+g8[js(0x21c)]+js(0x257)+g4['sessionId']),g3='requesting-license',C['debug']('Requesting\x20license\x20at\x20'+fW);let g9=await fX({'url':fW,'pssh':fT,'data':new Uint8Array(g8),'sessionId':g4[js(0x1e3)]});if(g9[0x0]===0x7b||g9[0x0]===0x3c){C['debug']('License\x20response\x20is\x20not\x20binary');let gb=Buffer['from'](g9)['toString']('utf8');if(C['debug'](gb),gb['includes']('<html>'))throw Error('Invalid\x20license\x20response');}g3='updating-session',C['debug']('Updating\x20session...'),await g4['update'](new Uint8Array(g9)),g3='waiting-for-key-statuses-change',C['debug']('Waiting\x20for\x20key\x20statuses\x20change...');let ga=await g4['waitForKeyStatusesChange']();C['debug']('Keys\x20count:\x20'+ga['length']),g3='closing-session',await g4['close'](),await g4['remove']();for(let gc of ga){let gd='Key:\x20'+gc['keyId']+':'+gc['key'];fV?C['info'](gd):C['debug'](gd);}return ga['map'](ge=>({'kid':ge['keyId'],'key':ge[js(0x27a)]}));}catch(ge){throw C['error']('Failed\x20to\x20get\x20DRM\x20content\x20keys\x20at\x20stage='+g3+'\x20for\x20license='+eJ(fW)+'\x20via\x20remoteCdm='+eJ(g0)),cq('DRM\x20content\x20key\x20error',ge),ge;}finally{if(g4){try{await g4['close']();}catch{}try{await g4['remove']();}catch{}}}},eL=async({keys:fT,drm:fU,psshList:fV,drmDir:fW,resolveLicense:fX,licenseUrl:fY})=>{const jt=gA;C['debug']('Extracting\x20decryption\x20keys');let fZ=[],g0=fU&&'keys'in fU?fU[jt(0x2f9)]:[],g1=[...fT||[],...g0];g1['length']&&fZ['push'](...g1);let g3=fY??(fU&&'server'in fU?fU['server']:void 0x0);if(fX&&g3){let g4=[...new Set(fV??[])];for(let [g5,g6]of g4['entries']()){C[jt(0x1e2)](jt(0x2ee)+(g5+0x1)+'/'+g4['length']+'\x20using\x20'+eJ(g3)),C['debug']('PSSH:\x20'+g6);let g7=await eK(g6,{'url':g3,'resolveLicense':fX,'clientDir':fW});g7&&g7['length']&&fZ['push'](...g7);}fZ['length']||(C['warn']('Can\x27t\x20get\x20decryption\x20keys'),C['debug']('PSSH:\x20'+g4['join'](',\x20')));}return fZ;};var eM=class{['strategy'];constructor(fT){this['strategy']=fT;}async['prepare'](){await this['strategy']['prepare']?.();}async['process'](fT){const ju=gA;let fU=await this['strategy']['decryptFile'](fT);return fT[ju(0x248)]&&await rm(fT['input'],{'force':!0x0}),fU;}};const eN=fT=>fT['replaceAll']('-','')['toLowerCase']();var eO=class{async['decryptFile'](fT){const jv=gA;let fU=new Map();for(let fV of fT['keys']){if(!fV['kid'])throw Error('Shifro\x20requires\x20a\x20KID\x20for\x20every\x20decryption\x20key');fU['set'](eN(fV['kid']),eN(fV['key']));}return C['debug']('Decrypting\x20via\x20shifro:\x20'+fT['input']),await(await Decryption['init']({'input':new Y({'source':new FilePathSource(fT['input']),'keys':fU}),'output':new Z({'target':new FilePathTarget(fT['output'])})}))[jv(0x324)](),fT['output'];}};const eP=/(?:(.+?)\n)?((?:\d{2}:)?\d{2}:\d{2}\.\d{3})\s+-->\s+((?:\d{2}:)?\d{2}:\d{2}\.\d{3})([^\n]*)/g,eQ=/^\uFEFF?WEBVTT(?:.|\n)*?\n{2}/,eR=/(?:(\d{2}):)?(\d{2}):(\d{2})\.(\d{3})/,eS={'ar':'ara','de':'deu','en':'eng','es':'spa','fr':'fra','hi':'hin','it':'ita','ja':'jpn','ko':'kor','pl':'pol','pt':'por','ru':'rus','th':'tha','tr':gA(0x286),'uk':'ukr','und':'und','vi':'vie','zh':'zho'},eT=fT=>fT===gA(0x31e)||fT==='text',eU=fT=>{const jw=gA;let fU=fT[jw(0x28f)]()['split'](':');if(fU['length']<0x2||fU['length']>0x3)throw Error('Invalid\x20trim\x20timestamp:\x20'+fT);let fV=Number(fU['at'](-0x1)),fW=Number(fU['at'](-0x2)),fX=fU['length']===0x3?Number(fU[0x0]):0x0;if(![fX,fW,fV]['every'](fY=>Number['isFinite'](fY)&&fY>=0x0))throw Error('Invalid\x20trim\x20timestamp:\x20'+fT);return fX*0xe10+fW*0x3c+fV;},eV=fT=>{let fU=eR['exec'](fT);if(!fU)throw Error('Invalid\x20WebVTT\x20timestamp:\x20'+fT);return 0xe10*0x3e8*Number(fU[0x1]||'0')+0x3c*0x3e8*Number(fU[0x2])+0x3e8*Number(fU[0x3])+Number(fU[0x4]);},eW=fT=>{let fU=Math['floor'](fT/(0xe10*0x3e8)),fV=Math['floor'](fT%(0xe10*0x3e8)/(0x3c*0x3e8)),fW=Math['floor'](fT%(0x3c*0x3e8)/0x3e8),fX=fT%0x3e8;return fU['toString']()['padStart'](0x2,'0')+':'+fV['toString']()['padStart'](0x2,'0')+':'+fW['toString']()['padStart'](0x2,'0')+'.'+fX['toString']()['padStart'](0x3,'0');},eX=fT=>{let fU=[fT['invalidEntries']?.['length']?fT['invalidEntries']['length']+'\x20invalid\x20entries':void 0x0,fT['invalidTimecodes']?.['length']?fT['invalidTimecodes']['length']+'\x20invalid\x20timecodes':void 0x0,fT['invalidIndices']?.['length']?fT['invalidIndices']['length']+'\x20invalid\x20indices':void 0x0,fT['timecodeIssues']?.['reversedTimecodes']?.['length']?fT['timecodeIssues']['reversedTimecodes']['length']+'\x20reversed\x20timecodes':void 0x0,fT['timecodeIssues']?.['overlappingTimecodes']?.['length']?fT['timecodeIssues']['overlappingTimecodes']['length']+'\x20overlapping\x20timecodes':void 0x0]['filter'](Boolean);return fU['length']?'\x20('+fU['join'](',\x20')+')':'';},eY=fT=>{const jx=gA;let fU=fT['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')[jx(0x28f)]();if(eQ['test'](fU))return fU;let {subtitle:fV,status:fW}=convert(fT,'.vtt');if(!fW['success'])throw Error('Failed\x20to\x20convert\x20subtitle\x20to\x20WebVTT'+eX(fW)+'.');return fV['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')['trim']();},eZ=fT=>{if(!fT)return;let fU=fT['trim']()['toLowerCase']();if(!fU)return;let fV=fU['split']('-')[0x0]??fU;return/^[a-z]{3}$/['test'](fV)?fV:eS[fV];},f0=fT=>{switch(extname(fT)['toLowerCase']()){case'.mp4':return new Mp4OutputFormat();case'.mkv':return new MkvOutputFormat();default:throw Error('Unsupported\x20mux\x20output\x20format:\x20'+fT);}},f1=fT=>new W({'formats':V,'source':cE(fT)}),f2=fT=>{const jy=gA;let fU=fT['trimBegin']?eU(fT['trimBegin']):void 0x0,fV=fT['trimEnd']?eU(fT[jy(0x2b3)]):void 0x0;if(fU!==void 0x0&&fV!==void 0x0&&fV<=fU)throw Error('trimEnd\x20must\x20be\x20greater\x20than\x20trimBegin');return{'trimBegin':fU,'trimEnd':fV};},f3=async(fT,fU,fV,fW,fX)=>{let fY=f1(fU),fZ=await fY['getPrimaryVideoTrack']();if(!fZ)throw Error('Missing\x20video\x20track\x20in\x20'+fU);let g0=fZ['codec'];if(!g0)throw Error('Unknown\x20video\x20codec\x20in\x20'+fU);if(fX!==void 0x0&&fX>=await fZ['computeDuration']())throw Error('trimBegin\x20excludes\x20the\x20full\x20video\x20track\x20in\x20'+fU);let g1=new EncodedPacketSink(fZ),g3=fX===void 0x0?await g1['getFirstKeyPacket']({'verifyKeyPackets':!0x0}):await g1['getKeyPacket'](fX,{'verifyKeyPackets':!0x0})??await g1['getFirstKeyPacket']({'verifyKeyPackets':!0x0});if(!g3)throw Error('No\x20video\x20packets\x20found\x20in\x20'+fU);let g4=new EncodedVideoPacketSource(g0);return fT['addVideoTrack'](g4,{'disposition':fZ['disposition'],'name':fV??fZ['name']??void 0x0,'rotation':fW['supportsVideoRotationMetadata']?fZ['rotation']:void 0x0}),{'kind':'video','input':fY,'sink':g1,'source':g4,'startPacket':g3,'startTimestamp':g3['timestamp'],'emit':async g5=>{let g6={'decoderConfig':await fZ['getDecoderConfig']()??void 0x0},g7=!0x0;for await(let g8 of g1['packets'](g3,void 0x0,{'verifyKeyPackets':!0x0}))await g4['add'](g8['clone']({'timestamp':g8['timestamp']-g5}),g7?g6:void 0x0),g7=!0x1;g4['close']();}};},f4=async(fT,fU,fV,fW,fX)=>{let fY=f1(fU),fZ=await fY['getPrimaryAudioTrack']();if(!fZ)throw Error('Missing\x20audio\x20track\x20in\x20'+fU);let g0=fZ['codec'];if(!g0)throw Error('Unknown\x20audio\x20codec\x20in\x20'+fU);if(fX!==void 0x0&&fX>=await fZ['computeDuration']())throw Error('trimBegin\x20excludes\x20the\x20full\x20audio\x20track\x20in\x20'+fU);let g1=new EncodedPacketSink(fZ),g3=fX===void 0x0?await g1['getFirstPacket']():await g1['getPacket'](fX)??await g1['getFirstPacket']();if(!g3)throw Error('No\x20audio\x20packets\x20found\x20in\x20'+fU);let g4=new EncodedAudioPacketSource(g0);return fT['addAudioTrack'](g4,{'disposition':fZ['disposition'],'languageCode':eZ(fV)??eZ(fZ['languageCode']),'name':fW??fZ['name']??void 0x0}),{'kind':'audio','input':fY,'sink':g1,'source':g4,'startPacket':g3,'startTimestamp':g3['timestamp'],'emit':async g5=>{const jz=b;let g6={'decoderConfig':await fZ['getDecoderConfig']()??void 0x0},g7=!0x0;for await(let g8 of g1['packets'](g3))await g4['add'](g8[jz(0x272)]({'timestamp':g8['timestamp']-g5}),g7?g6:void 0x0),g7=!0x1;g4['close']();}};},f5=(fT,{trimBegin:fU,trimEnd:fV,commonStart:fW})=>{const jA=gA;let fX=fT['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')['trim']();if(!eQ['test'](fX))throw Error('Only\x20WebVTT\x20subtitles\x20are\x20supported\x20by\x20the\x20MediaBunny\x20muxer.');let fY=fU===void 0x0?void 0x0:Math['round'](fU*0x3e8),fZ=fV===void 0x0?void 0x0:Math['round'](fV*0x3e8),g0=Math['round'](fW*0x3e8);eP['lastIndex']=0x0;let g1=eP['exec'](fX),g3=fX['slice'](0x0,g1?.[jA(0x206)]??fX['length'])['trimEnd'](),g4=[],g5=g1?fX['slice'](g1['index']):'';for(;;){eP['lastIndex']=0x0;let g6=eP[jA(0x306)](g5);if(!g6)break;let g7=g6['index']+g6[0x0]['length'],g8=g5['indexOf']('\x0a',g7)+0x1,g9=g5['indexOf']('\x0a\x0a',g7);g9===-0x1&&(g9=g5['length']);let ga=g6[0x1]?.['trim'](),gb=g6[0x4]?.['trim'](),gc=g5['slice'](g8,g9)['trim'](),gd=eV(g6[0x2]),ge=eV(g6[0x3]),gf=Math['max'](gd,fY??gd)-g0,gg=Math['min'](ge,fZ??ge)-g0;if(gg>gf){let gh=eW(gf)+'\x20-->\x20'+eW(gg)+(gb?'\x20'+gb:'');g4['push']([ga,gh,gc]['filter'](Boolean)['join']('\x0a'));}g5=g5['slice'](g9)['trimStart']();}return[g3,...g4]['filter'](Boolean)['join']('\x0a\x0a');},f6=async(fT,fU,fV,fW,fX)=>{const jB=gA;if(fV['type']==='video')return f3(fT,fV[jB(0x231)],fV[jB(0x317)],fU,fW);if(fV['type']==='audio')return f4(fT,fV['path'],fV['language'],fV['label'],fW);if(eT(fV['type'])){let fY=eY(await readFile(fV['path'],'utf8')),fZ=new TextSubtitleSource('webvtt');return fT['addSubtitleTrack'](fZ,{'disposition':fV['forced']?{'forced':!0x0}:void 0x0,'languageCode':eZ(fV['language']),'name':fV['label']}),{'kind':'subtitle','source':fZ,'emit':async g0=>{let g1=f5(fY,{'trimBegin':fW,'trimEnd':fX,'commonStart':g0});await fZ['add'](g1),fZ['close']();}};}throw Error('Unsupported\x20mux\x20input\x20type:\x20'+fV[jB(0x26e)]);};var f7=class{async['mux'](fT){const jC=gA;let {trimBegin:fU,trimEnd:fV}=f2(fT),fW=f0(fT['output']),fX=new Output({'format':fW,'target':cF(fT['output'])}),fY=[];try{for(let g1 of fT['inputs'])fY['push'](await f6(fX,fW,g1,fU,fV));let fZ=fY['filter'](g3=>g3['kind']!==jC(0x31e));if(!fY['length'])throw Error('No\x20tracks\x20provided\x20for\x20muxing.');let g0=fZ['length']>0x0?Math[jC(0x201)](...fZ['map'](g3=>g3['startTimestamp'])):fU??0x0;await fX['start']();for(let g3 of fY){if(g3['kind']==='subtitle'){await g3['emit'](g0);continue;}await g3['emit'](g0);}return await fX['finalize'](),fT['output'];}catch(g4){throw await fX['cancel']()['catch'](()=>void 0x0),g4;}finally{for(let g5 of fY)g5['kind']!=='subtitle'&&g5['input']['dispose']();}}},f8=class{['strategy'];constructor(fT){const jD=gA;this[jD(0x330)]=fT;}async['prepare'](){await this['strategy']['prepare']?.();}async['process'](fT){let fU=await this['strategy']['mux'](fT);if(fT['cleanup']){for(let fV of new Set(fT['inputs']['map'](fW=>fW['path'])))await rm(fV,{'force':!0x0});}return fU;}},f9=class{['fn'];['next']=null;constructor(fT){this['fn']=fT,this['next']=null;}},fa=class{['first']=null;['last']=null;constructor(){this['first']=null,this['last']=null;}['add'](fT){let fU=new f9(fT);return this['first']?this['last']['next']=fU:this['first']=fU,this['last']=fU,this;}async['process'](fT){let fU=this['first'],fV=async()=>await fU['fn'](fT,async()=>{if(fU=fU['next'],fU)return await fV();throw Error('No\x20handler\x20detected');});return await fV();}};const fb=async(fT,fU)=>{const jE=gA;if(!fT['keys']['length'])return fU();let fV=er('Decrypting'),fW=new eM(new eO());await fW['prepare']();for(let fX of fT[jE(0x2da)]){let fY=extname(fX['path']),fZ=fX['path']['replace'](fY,'.dec'+fY);if(!(fX['type']!=='video'&&fX['type']!=='audio')){if(await fW['process']({'input':fX['path'],'output':fZ,'keys':fT['keys'],'type':fX['type'],'cleanup':!0x0}),!existsSync(fZ))throw Error('Decryption\x20failed\x20for\x20file\x20'+fX['path']+'.\x20Unable\x20to\x20find\x20'+fZ);fX['path']=fZ;}}fV['success']('Decrypted'),await fU();},fc=async(fT,fU)=>{const jF=gA;if(fT['skipMux'])return fU();let fV=er('Muxing'),fW=new f8(new f7());await fW['prepare'](),await fW['process']({'inputs':fT[jF(0x2da)],'output':fT['output'],'trimBegin':fT['trimBegin'],'trimEnd':fT['trimEnd'],'cleanup':!0x0}),existsSync(fT['output'])?(fV['success']('Muxed'),C['debug']('Muxed:\x20'+fT['output'])):fV['error']('Muxing\x20failed.\x20Output\x20file\x20not\x20found:\x20'+fT['output']);},fd=0x1,fe=0x4,ff=0x8,fg=0x10,fh=(fT,fU)=>Math['max'](fd,Math['trunc'](typeof fT=='number'&&Number['isFinite'](fT)?fT:fU)),fi=fT=>fT['includes']('highConnectionsCount')?fg:fT['includes'](gA(0x2a2))?ff:fe,fj=({requestedConnections:fT,fallbackConnections:fU=fd,grantedBenefits:fV})=>{let fW=fh(fT,fh(fU,fd)),fX=fi(fV),fY=Math['min'](fW,fX);return{'connections':fY,'normalizedRequestedConnections':fW,'maxAllowedConnections':fX,'wasClamped':fY<fW};},fk=async fT=>{const jG=gA;let {grantedBenefits:fU}=await bV(),fV=null,fW=fU['includes']('parallelDownloads'),fX=fT['maxActiveDownloads']&&fT['maxActiveDownloads']>0x1;if(!fW&&fX&&(fV=Error('PARALLEL_DOWNLOADS_NOT_ALLOWED'),fT['maxActiveDownloads']=0x1),fT[jG(0x24a)]||fT['proxyMeta']||fT[jG(0x250)]){let fY=fU['includes']('proxy'),fZ=fT['proxy']||fT['proxyMeta']||fT['proxyMedia'];!fY&&fZ&&(fV=Error('PROXY_NOT_ALLOWED'),delete fT['proxy'],delete fT['proxyMeta'],delete fT['proxyMedia']);}if(fT['videoContainerFormat']&&fT['videoContainerFormat']!=='mp4'&&(fU['includes']('customMuxFormat')||(fV=Error('CUSTOM_MUX_FORMAT_NOT_ALLOWED'),fT[jG(0x285)]='mp4')),typeof fT['connections']=='number'){let {connections:g0}=fj({'requestedConnections':fT[jG(0x29c)],'grantedBenefits':fU});fT['connections']=g0;}return{'error':fV,'data':fT};},fl=fT=>({'retry':fT['get']('retry'),'connections':fT['get']('connections'),'proxy':fT['get'](gA(0x24a)),'proxyMeta':fT['get']('proxyMeta'),'proxyMedia':fT['get'](gA(0x250)),'movieTemplate':fT['get']('movieFilenameTemplate'),'episodeTemplate':fT['get']('seriesFilenameTemplate'),'hardsub':fT['get']('preferHardsub'),'format':fT['get']('videoContainerFormat')}),fm=({options:fT,fallbackConnections:fU,grantedBenefits:fV})=>{let fW=fj({'requestedConnections':fT['connections'],'fallbackConnections':fU,'grantedBenefits':fV});return{'options':{...fT,'connections':fW['connections']},'limit':fW};},fn=({settings:fT,requestedOptions:fU,filePath:fV,grantedBenefits:fW})=>{let fX=fl(fT),{options:fY,limit:fZ}=fm({'options':{...fX,...fU},'fallbackConnections':fX['connections'],'grantedBenefits':fW});return fV&&(fY['outputPath']=fV),{'baseOptions':fX,'options':fY,'limit':fZ};};var fo=class{['settings'];['extensionManager'];['downloadsStorage'];['callbacks'];constructor(fT,fU,fV,fW){this['settings']=fT,this['extensionManager']=fU,this['downloadsStorage']=fV,this['callbacks']=fW;}async['run'](fT,fU,fV){const jH=gA;let fW;try{fT['status']='downloading',await this['callbacks'][jH(0x21a)](fT),this[jH(0x289)]['emitStatusChanged'](fT);let {options:fX,limit:fY}=fn({'settings':this['settings'],'requestedOptions':fT['options'],'filePath':fT['filePath'],'grantedBenefits':fV});fY[jH(0x1fc)]&&C['warn']('Connections\x20value\x20'+fY['normalizedRequestedConnections']+'\x20exceeds\x20tier\x20limit\x20('+fY['maxAllowedConnections']+').\x20Using\x20'+fY['connections']+'.');let fZ=new eI({'settings':this['settings'],'downloadsStorage':this[jH(0x2cf)]});this.#e(fT,fU,fZ);let g0=fT[jH(0x322)];if(!g0)throw Error('Download\x20job\x20is\x20missing\x20a\x20media\x20resource');let g1=fT['url']?await this['extensionManager']['getExtensionForUrl'](fT['url']):null,g3=fT['url']?await cj({'resource':g0,'url':fT[jH(0x2dd)],'options':fX,'extension':g1}):{'source':g0['source']};fW=g3['input'],g0['source']=g3[jH(0x2c4)],await this['callbacks']['persistJob'](fT),g1&&await bg(g1);let {downloaded:g4=[],psshList:g5,selectedTracks:g6}=await fZ['start'](fX,g3['source'],g0['metadata'],fU['signal'],g3[jH(0x2be)]);if(fU['signal'][jH(0x227)])return;if(!g4['length'])throw G['emit']('error',{'code':'NO_FILES_DOWNLOADED'}),Error('No\x20files\x20were\x20downloaded');g4['length']&&!fT['filePath']&&(fT['filePath']=g4[0x0]?.['path']),this['callbacks']['trackArtifact'](fT['id'],fT['filePath']);for(let g9 of g4)this['callbacks']['trackArtifact'](fT['id'],g9['path']);if(fT['status']!==jH(0x307))return;fT['status']='processing',this['callbacks']['emitStatusChanged'](fT);let g7=await this.#r({'job':fT,'options':fX,'psshList':g5??[],'selectedTracks':g6,'extension':g1,'resolvedEntry':g3['entry'],'resolvedInput':g3[jH(0x2be)]}),g8=new fa();g8['add'](fb)[jH(0x1ed)](fc),await g8['process']({'inputs':g4,'output':fT['filePath'],'keys':g7,'trimBegin':fX['trimBegin'],'trimEnd':fX['trimEnd'],'binariesDir':this['settings']['get']('binariesDir'),'skipMux':fX['skipMux']}),g1&&await bh(g1,{'skipMux':fX['skipMux']}),fT['status']=jH(0x28b),fT['progress']=0x64,this['callbacks']['emitStatusChanged'](fT),this['callbacks']['emitJobCompleted'](fT);}catch(ga){if(ga instanceof Error&&ga['name']==='AbortError'){C['debug']('Download\x20was\x20aborted\x20(paused):\x20'+fT['id']);return;}let {normalizedError:gb,alreadyHandled:gc}=this.#t(fT,ga);if(this.#n(gb),gc)return;C['error']('Download\x20job\x20failed:\x20'+gb),cq('Download\x20job\x20failure',gb),this['callbacks']['emitStatusChanged'](fT),this['callbacks']['emitJobError'](fT,gb);}finally{await fW?.['dispose']?.();}}#e(fT,fU,fV){fV['on']('output-path',fX=>{const jI=b;fT['filePath']=fX,this['callbacks']['trackArtifact'](fT['id'],fX),this[jI(0x289)][jI(0x21a)](fT),C[jI(0x1e2)]('Job\x20output\x20path\x20persisted\x20early:\x20id='+fT['id']+',\x20path='+fX);});let fW={};fV['on']('progress',fX=>{const jJ=b;if(fU['signal']['aborted']||fT['status']!=='downloading')return;fW[fX['trackPath']]=fX,this['callbacks']['trackArtifact'](fT['id'],fX['trackPath']),this['callbacks']['trackArtifact'](fT['id'],fX['finalPath']);let fY=0x0,fZ=0x0;for(let g1 in fW)fY+=fW[g1]['current']['b'],fZ+=fW[g1]['total']['b'];let g0=fZ>0x0?fY/fZ*0x64:0x0;fT[jJ(0x2ec)]=fX['finalPath'],fT['progress']=g0,fT[jJ(0x1d8)]=fY,fT['totalBytes']=fZ,fX['quality']&&(fT['quality']=fX['quality']),fX['codec']&&(fT[jJ(0x1fe)]=fX[jJ(0x1fe)]),this['callbacks']['emitProgress'](fT),this['callbacks']['persistJob'](fT);}),fV['on']('error',fX=>{const jK=b;if(fT['status']==='paused'||fU['signal'][jK(0x227)])return;let {normalizedError:fY,alreadyHandled:fZ}=this.#t(fT,fX);fZ||(C['error']('Downloader\x20process\x20failed:\x20'+fY['message']),fY['stack']&&C['debug'](fY['stack']),this['callbacks']['emitStatusChanged'](fT),this['callbacks']['emitJobError'](fT,fY));});}#t(fT,fU){const jL=gA;let fV=fU instanceof Error?fU:Error(String(fU)),fW=fT['status']==='error'&&fT['error']===fV['message'];return fW||(fT[jL(0x26a)]='error',fT['error']=fV['message']),{'normalizedError':fV,'alreadyHandled':fW};}#n(fT){const jM=gA;(fT&&typeof fT=='object'&&'code'in fT?String(fT['code']):'')==='DOWNLOAD_DIR_NOT_WRITABLE'&&G[jM(0x1e4)]('error',{'code':'DOWNLOAD_DIR_NOT_WRITABLE'});}async #r({job:fT,options:fU,psshList:fV,selectedTracks:fW,extension:fX,resolvedEntry:fY,resolvedInput:fZ}){let g0=fT['resource']?.['source']?.['drm']??fT['resource']?.['drm'];fT['resource']?.['drmPayload']&&fT['url']&&(g0=await ck(fT['resource'],fU,fX));let g1=await this.#i({'extension':fX,'selectedTracks':fW,'resolvedEntry':fY,'resolvedInput':fZ,'options':fU}),g3=await this.#a({'extension':fX,'selectedTracks':fW,'resolvedEntry':fY,'resolvedInput':fZ,'options':fU}),g4=g0&&'server'in g0?c8(g0):void 0x0,g5=g3['resolveLicense']??g4,g6=g3['licenseUrl']??(g0&&'server'in g0?g0['server']:void 0x0);return eL({'keys':[...fU['keys']??[],...g1],'drm':g0,'psshList':fV,'drmDir':this['settings']['get']('drmDir'),'resolveLicense':g5,'licenseUrl':g6})['catch'](g7=>{const jN=b;throw C['error']('Failed\x20to\x20extract\x20decryption\x20keys\x20for\x20job\x20'+fT['id']),C['debug']('DRM\x20extraction\x20context:\x20title='+(fT['title']||fT['resource']?.['metadata']?.['title']||jN(0x1cf))+',\x20drmServer='+(g0&&'server'in g0?g0['server']:'(none)')+',\x20psshCount='+fV['length']+jN(0x2bf)+(fU['keys']?.['length']??0x0)),g7 instanceof Error?(cq('DRM\x20extraction\x20failure',g7),g7['message']===jN(0x2b6)&&G['emit']('error',{'code':'DRM_UNAUTHORIZED'}),g7['message']==='Forbidden'&&G['emit']('error',{'code':'DRM_FORBIDDEN'})):C['debug'](String(g7)),g7;});}async #i({extension:fT,selectedTracks:fU,resolvedEntry:fV,resolvedInput:fW,options:fX}){const jO=gA;if(!fT||!fV||!fW)return[];let fY=bc(fT);if(typeof fY['drm']?.[jO(0x1ee)]!='function')return[];let fZ=new Map(),g0={...fV,'input':fW};for(let g1 of fU){if(!g1['inputTrack'])continue;let g3=(await cQ(g1)['catch'](()=>[]))[0x0],g4=g3?.['initSegment']?.['encryption']??g3?.['encryption'],g5=[g4?.['drm']?.['widevine']?'widevine':null,g4?.['drm']?.[jO(0x2cd)]?'playready':null,g4?.['drm']?.['fairplay']?'fairplay':null]['filter'](Boolean)[0x0];if(!g5)continue;let g6=await fY['drm']['getKeys']({'system':g5,'entry':g0,'track':g1['inputTrack'],'options':fX});for(let [g7,g8]of g6??[])fZ['set'](g7,g8);}return Array['from'](fZ,([g9,ga])=>({'kid':g9,'key':ga}));}async #a({extension:fT,selectedTracks:fU,resolvedEntry:fV,resolvedInput:fW,options:fX}){const jP=gA;if(!fT||!fV||!fW)return{};let fY=bc(fT);if(typeof fY['drm']?.['getLicense']!='function')return{};let fZ=await this.#o(fU);if(!fZ['size'])return{};let g0={...fV,'input':fW};return{'licenseUrl':'extension://'+fT['package'][jP(0x2c0)]+'/license','resolveLicense':async({pssh:g1,data:g3})=>{let g4=fZ['get'](g1);if(!g4)throw Error('No\x20DRM\x20track\x20binding\x20found\x20for\x20PSSH\x20'+g1);return await fY['drm']['getLicense']({'system':g4['system'],'entry':g0,'track':g4['track'],'options':fX,'data':g3});}};}async #o(fT){const jQ=gA;let fU=new Map();for(let fV of fT){if(!fV['inputTrack'])continue;let fW=(await cQ(fV)['catch'](()=>[]))[0x0],fX=fW?.['initSegment']?.['encryption']??fW?.['encryption'];for(let fY of[this.#s(fV,'widevine',fX?.['drm']?.['widevine']?.['pssh']),this.#s(fV,'playready',fX?.['drm']?.['playready']?.['pssh']),this.#s(fV,'fairplay',fX?.['drm']?.['fairplay']?.['pssh'])])!fY||fU[jQ(0x287)](fY['pssh'])||fU['set'](fY['pssh'],fY);}return fU;}#s(fT,fU,fV){const jR=gA;if(!fT['inputTrack']||!fV)return null;let fW=typeof fV==jR(0x214)?fV:fV instanceof Uint8Array||fV instanceof ArrayBuffer?Buffer['from'](fV)['toString'](jR(0x302)):null;return fW?{'pssh':fW,'system':fU,'track':fT['inputTrack']}:null;}},fp=class extends T{[gA(0x32b)];['extensionManager'];['downloadsStorage'];#e=new cl();#t=new Map();#n=null;#r;['maxActiveDownloads'];constructor(fT,fU,fV){const jS=gA;super(),this['settings']=fT,this['extensionManager']=fU,this['downloadsStorage']=fV,this['maxActiveDownloads']=fT['get'](jS(0x2af)),this.#r=new fo(fT,fU,fV,{'persistJob':fW=>this['downloadsStorage']['update'](fW),'emitStatusChanged':fW=>this['emit']('job-status-changed',fW),'emitProgress':fW=>this['emit']('job-progress',fW),'emitJobError':(fW,fX)=>this['emit']('job-error',fW,fX),'emitJobCompleted':fW=>this['emit']('job-completed',fW),'trackArtifact':(fW,fX)=>this.#m(fW,fX)}),C['debug']('Created\x20download\x20manager\x20with\x20max\x20active\x20downloads:\x20'+this['maxActiveDownloads']);}async['initializeFromStorage'](){const jT=gA;let fT=new Set(['downloading','queued','processing',jT(0x29f),'analyzing']);for(let fU of this['downloadsStorage']['jobs'])fU['status']==='paused'||fU['status']==='completed'||fU['status']==='error'||fT['has'](fU['status'])&&(fU['status']!=='queued'&&(fU['status']='queued',fU['error']=void 0x0,await this['downloadsStorage']['update'](fU)),this.#d(fU));this.#s();}async['analyze'](fT,fU={}){if(!fT){let fW=Error('Cannot\x20prepare\x20job\x20without\x20a\x20URL.');throw this['emit']('error',fW),fW;}let fV=await ci(fT,fU,await this['extensionManager']['getExtensionForUrl'](fT));if(!fV)throw Error('No\x20media\x20resource\x20found');return fV;}async['add'](fT){const jU=gA;if(!fT['url']&&!fT['resource'])throw Error('Job\x20must\x20have\x20either\x20a\x20URL\x20or\x20a\x20pre-prepared\x20resource.');let fU={'id':crypto['randomUUID'](),'status':'queued','progress':0x0,'downloadedBytes':0x0,'createdAt':new Date()['toISOString'](),...fT};C['debug']('Adding\x20new\x20job:\x20'+fU['id']),C['debug']('URL:\x20'+fU['url']),await this['downloadsStorage'][jU(0x1ed)](fU),this['emit']('job-added',fU),this.#d(fU),this.#s();}async['pause'](fT){let fU=await this.#i(fT,'pause');fU&&C['debug']('Paused\x20download:\x20'+fU['id']);}async['resume'](fT){const jV=gA;let fU=this.#e['getActiveRun'](fT);if(fU){fU['cancellationReason']==='pause'||fU['controller']['signal']['aborted']?(this.#e['queueResumeAfterStop'](fT),C['debug']('Resume\x20queued\x20until\x20stop\x20completes:\x20'+fT)):C['debug']('Resume\x20skipped\x20while\x20job\x20is\x20active:\x20'+fT);return;}let fV=this.#y(fT);if(!fV){C['warn']('Resume\x20failed:\x20Job\x20'+fT+'\x20not\x20found');return;}if(fV['status']==='paused'){await this.#a(fV),C[jV(0x1e2)]('Resumed\x20download:\x20'+fV['id']);return;}fV[jV(0x26a)]===jV(0x23a)&&await this.#o(fV)&&C['debug']('Retried\x20download:\x20'+fV['id']);}async['remove'](fT){await this.#i(fT,'remove'),await this['downloadsStorage']['delete'](fT),this.#t['delete'](fT);}async['removeWithFile'](fT){let fU=this.#y(fT),fV=await this.#i(fT,'remove-with-file')||fU,fW=this.#h(fT,fV);await this['downloadsStorage']['delete'](fT),await this.#_(fW),this.#t['delete'](fT);}async #i(fT,fU){const jW=gA;let fV=this.#f(fT),fW=this.#e['getActiveRun'](fT),fX=this.#y(fT);return fW?fU==='pause'&&fW['job']['status']!=='downloading'?(C['debug']('Pause\x20ignored\x20for\x20non-downloading\x20stage:\x20id='+fT+',\x20stage='+fW['job']['status']),fW['job']):(fW['cancellationReason']=fU,fU==='pause'&&(fW['job']['status']='paused',fW['job']['error']=void 0x0,await this['downloadsStorage']['update'](fW['job']),this['emit'](jW(0x2a5),fW['job'])),fW['controller']['abort'](),await fW['runPromise'],fW[jW(0x255)]):(fU==='pause'&&fX&&(fV||fX['status']==='queued')&&(fX['status']='paused',fX['error']=void 0x0,await this['downloadsStorage']['update'](fX),this['emit']('job-status-changed',fX)),fX??void 0x0);}async #a(fT){const jX=gA;fT['status']=jX(0x22b),fT[jX(0x23a)]=void 0x0,await this['downloadsStorage']['update'](fT),this['emit']('job-status-changed',fT),this.#d(fT),this.#s();}async #o(fT){const jY=gA;let fU=this.#h(fT['id'],fT);this.#t['delete'](fT['id']),await this.#_(fU),fT['status']='analyzing',fT['error']=void 0x0,fT['progress']=0x0,fT['downloadedBytes']=0x0,fT['totalBytes']=void 0x0,fT['quality']=void 0x0,fT['codec']=void 0x0,await this['downloadsStorage']['update'](fT),this['emit']('job-status-changed',fT);try{if(fT['url']){let fV=await this['analyze'](fT['url'],fT['options']??{}),fW=this.#g(fT,fV);if(!fW)throw Error('No\x20media\x20resource\x20found');fT['resource']=fW;}return await this.#a(fT),!0x0;}catch(fX){return fT['status']='error',fT['error']=fX instanceof Error?fX['message']:String(fX),await this['downloadsStorage']['update'](fT),this['emit']('job-status-changed',fT),this[jY(0x1e4)](jY(0x275),fT,fX),!0x1;}}#s(){const jZ=gA;for(this['maxActiveDownloads']=this['settings']['get']('maxActiveDownloads');this.#e[jZ(0x311)]<this[jZ(0x2af)];){let fT=this.#p();if(!fT)break;this.#c(fT);}this.#e['queuedCount']===0x0&&this.#e['activeRunCount']===0x0&&this['emit'](jZ(0x1f2));}#c(fT){if(fT['status']!=='queued'){C['warn']('Skipping\x20non-queued\x20job\x20start:\x20'+fT['id']+'\x20('+fT['status']+')');return;}let fU=new AbortController(),fV={'controller':fU,'job':fT,'runPromise':Promise['resolve']()};this.#e['setActiveRun'](fT['id'],fV),fV['runPromise']=this.#u(fT,fU)['catch'](fW=>{const k0=b;let fX=fW instanceof Error?fW:Error('Download\x20run\x20failed:\x20'+String(fW));C['error'](fX['message']),this['emit'](k0(0x23a),fX);});}async #l(){const k1=gA;if(this.#n)return this.#n;try{let {grantedBenefits:fT}=await bV();this.#n=fT;}catch(fU){let fV=fU instanceof Error?fU[k1(0x20f)]:String(fU);C['warn'](k1(0x2cb)+fV),this.#n=[];}return this.#n;}async #u(fT,fU){const k2=gA;this.#e['setActiveJob'](fT);try{let fV=await this.#l();await this.#r['run'](fT,fU,fV);}finally{let fW=this.#e['getActiveRun'](fT['id']);if(fW){let fX=fW?.['cancellationReason'],fY=fX==='pause'&&this.#e['consumeResumeAfterStop'](fT['id']);fX==='pause'?(fT['status']='paused',fT['error']=void 0x0,await this['downloadsStorage']['update'](fT),this['emit']('job-status-changed',fT)):fX!=='remove'&&fX!==k2(0x242)&&await this['downloadsStorage']['update'](fT),this.#e['deleteActiveJob'](fT['id']),this.#e['deleteActiveRun'](fT['id']),fY&&fT['status']==='paused'&&(fT['status']='queued',fT['error']=void 0x0,await this['downloadsStorage']['update'](fT),this['emit']('job-status-changed',fT),this.#d(fT)),this.#s();}}}#d(fT){this.#e['enqueue'](fT);}#f(fT){const k3=gA;return this.#e[k3(0x1e8)](fT);}#p(){return this.#e['dequeueNext'](fT=>this.#y(fT));}#m(fT,fU){if(!fU)return;let fV=this.#t['get'](fT);fV||(fV=new Set(),this.#t['set'](fT,fV)),fV['add'](fU);}#h(fT,fU){let fV=new Set();for(let fX of this.#t['get'](fT)??[])fV['add'](fX);fU?.['filePath']&&fV['add'](fU['filePath']);let fW=new Set();for(let fY of fV)fW['add'](fY),fW['add'](fY+'.part.json'),fW['add'](this.#v(fY));return fW;}#g(fT,fU){const k4=gA;let fV=Array['isArray'](fU)?fU:[fU];if(fV['length']<=0x1)return fV[0x0];let fW=fT['resource']?.['metadata'],fX=fT['resource']?.['source'][k4(0x2dd)],fY=fW&&'seasonNumber'in fW?fW['seasonNumber']:null,fZ=fW&&'episodeNumber'in fW?fW['episodeNumber']:null,g0=fW&&'episodeTitle'in fW?fW['episodeTitle']:null;return fV['find'](g1=>{let g3=g1['metadata'];if(fW?.['id']&&g3?.['id'])return fW['id']===g3['id'];let g4=g3&&'seasonNumber'in g3?g3['seasonNumber']:null,g5=g3&&'episodeNumber'in g3?g3['episodeNumber']:null,g6=g3&&'episodeTitle'in g3?g3['episodeTitle']:null;return fW?.['title']&&g3?.['title']&&fW['title']===g3['title']&&fY===g4&&fZ===g5&&g0===g6?!0x0:!!fX&&fX===g1['source']['url'];})??fV[0x0];}async #_(fT){fT['size']!==0x0&&await Promise['all']([...fT]['map'](fU=>rm(fU,{'recursive':!0x0,'force':!0x0})['catch'](()=>void 0x0)));}#v(fT){let fU=resolve(fT),fV=parse(fT)['name'];return join(m,fV+'-'+createHash('sha1')['update'](fU)['digest']('hex')['slice'](0x0,0xa));}#y(fT){return this.#e['getActiveJob'](fT)||this['downloadsStorage']['get'](fT);}['onJobAdded'](fT){return this['on']('job-added',fT),()=>this['removeListener']('job-added',fT);}[gA(0x323)](fT){return this['on']('job-status-changed',fT),()=>this['removeListener']('job-status-changed',fT);}['onJobProgress'](fT){return this['on']('job-progress',fT),()=>this['removeListener']('job-progress',fT);}['onJobCompleted'](fT){return this['on']('job-completed',fT),()=>this['removeListener']('job-completed',fT);}['onJobError'](fT){return this['on']('job-error',fT),()=>this['removeListener']('job-error',fT);}['onIdle'](fT){return this['on']('idle',fT),()=>this['removeListener']('idle',fT);}['onError'](fT){return this['on']('error',fT),()=>this['removeListener']('error',fT);}['waitForIdle'](){return new Promise(fT=>this['onIdle'](fT));}};const fq=fT=>{if(!fT)return null;let [fU,fV]=fT['toLowerCase']()['split']('e');return[parseInt(fU['trim']()['toLowerCase']()['replace']('s','')),parseFloat(fV?.['trim']())];},fr=fT=>{let fU=0x0,fV=0x270f,fW=[],fX=fT['split'](',');for(let fZ of fX){let [g0,g1]=fZ['split']('-'),g3=fq(g0),g4=fq(g1);if(g3&&!g1){let [g5,g6]=g3;if(isNaN(g6)){for(let g7=0x0;g7<=fV;g7++)fW['push']([g5,g7]);}else fW['push']([g5,g6]);}else{if(g3&&g4){let [g8,g9]=g3,[ga,gb]=g4;for(let gc=g8;gc<=ga;gc++){let gd=g9||0x0,ge=gc===ga?gb:fV;for(let gf=gd;gf<=ge;gf++)fW['push']([gc,gf]);}}}}let fY=new Map();for(let [gg,gh]of fW)fY['has'](gg)||fY['set'](gg,new Set()),fY['get'](gg)?.['add'](gh);return fY;},ft=fT=>{if(!fT)return{};let fU={},fV=typeof fT=='string'?fT['split']('|'):fT;for(let fW of fV){let [fX,...fY]=fW['split'](':'),fZ=fY['join'](':');if(!fZ)throw Error('Can\x27t\x20parse\x20header:\x20'+fW);fU[fX['trim']()]=fZ['trim']();}return fU;},fu=async fT=>{const k5=gA;let fU=!0x1,fV=fT;do try{fV?fU=!!new URL(fV):fV=(await n['ask']({'fields':{'url':{'label':'URL'}}}))['url'];}catch{fV=(await n['ask']({'fields':{'url':{'label':'URL'}}}))[k5(0x2dd)];}while(!fU);return fV!==fT&&C['debug']('URL:\x20'+fV),fV;},fv=(fT,fU)=>new Date(fU['createdAt']??0x0)['getTime']()-new Date(fT['createdAt']??0x0)[gA(0x2ae)]();var fw=class{['filePath'];['jobs']=[];#e=Promise['resolve']();constructor(fT){this['filePath']=fT;}[gA(0x200)](fT){let fU=JSON['parse'](fT),fV=Object['entries'](fU);return new Map(fV);}async['load'](){await this.#e;try{let fT=await readFile(this['filePath'],{'encoding':'utf8'});this['jobs']=JSON['parse'](fT)['toSorted'](fv);}catch{this['jobs']=[];}return this;}get['size'](){return this['jobs']['length'];}async['add'](fT){await this.#t(async()=>{this['jobs']['unshift'](fT),await this['save']();});}async['update'](fT){await this.#t(async()=>{let fU=this['jobs']['findIndex'](fV=>fV['id']===fT['id']);fU!==-0x1&&(this['jobs'][fU]=fT,await this['save']());});}['getByFilePath'](fT){return this['jobs']['find'](fU=>fU['filePath']===fT);}[gA(0x1d6)](fT){const k6=gA;return this[k6(0x220)]['find'](fU=>fU['id']===fT);}['has'](fT){return this['jobs']['some'](fU=>fU['id']===fT);}async['delete'](fT){await this.#t(async()=>{const k7=b;let fU=this['jobs']['findIndex'](fV=>fV['id']===fT);fU!==-0x1&&(this['jobs'][k7(0x228)](fU,0x1),await this['save']());});}async['deleteWithFile'](fT){let fU=await this.#t(async()=>{let fV=this['jobs']['findIndex'](fX=>fX['id']===fT);if(fV===-0x1)return null;let [fW]=this['jobs']['splice'](fV,0x1);return await this['save'](),fW??null;});fU?.['filePath']&&await rm(fU['filePath'],{'recursive':!0x0,'force':!0x0});}async['clear'](){await this.#t(async()=>{this['jobs']=[],await this['save']();});}async['save'](){const k8=gA;return writeFile(this['filePath'],JSON['stringify'](this[k8(0x220)],null,0x2));}#t(fT){let fU=this.#e['then'](fT,fT);return this.#e=fU['then'](()=>void 0x0,()=>void 0x0),fU;}};const fx={'command':['download\x20[urls..]','$0\x20[urls..]'],'aliases':['dl'],'describe':'Download\x20media\x20content\x20by\x20URL','builder':fT=>fT['option'](gA(0x335),{'alias':'q','describe':'Video\x20resolution\x20quality\x20-\x202160p/1080p/720p/...,\x20defaults\x20to\x20highest\x20available','type':'string'})['option']('video-codec',{'alias':'v','describe':gA(0x309),'type':'string'})['option']('video-range',{'alias':'r','describe':'Video\x20color\x20range\x20-\x20sdr\x20|\x20hlg\x20|\x20hdr10\x20|\x20hdr10+\x20|\x20dv,\x20defaults\x20to\x20sdr','type':'string'})['option']('video-bitrate',{'describe':'Video\x20bitrate\x20(in\x20kbps),\x20defaults\x20to\x20highest\x20available','type':'number'})['option']('video-dimension',{'describe':'Video\x20dimension\x20-\x202D/3D\x20(HSBS/HOU/FSBS/OU),\x20defaults\x20to\x202D','default':'2D','type':'string'})['option']('audio-codec',{'alias':'a','describe':'Audio\x20codec\x20-\x20aac\x20|\x20opus\x20|\x20mp3\x20|\x20vorbis\x20|\x20flac\x20|\x20alac\x20|\x20ac3\x20|\x20eac3\x20|\x20dts,\x20defaults\x20to\x20any','type':'string'})['option']('audio-channels',{'alias':'c','describe':'Audio\x20channels,\x20matches\x20sub-channel\x20layouts\x20like\x205.1\x20with\x206.0','type':'number'})['option']('audio-bitrate',{'describe':'Audio\x20bitrate\x20(in\x20kbps),\x20defaults\x20to\x20highest\x20available','type':'number'})['option']('subs-format',{'alias':'s','describe':'Subtitle\x20format\x20-\x20SRT/SSA/ASS/TTML/VTT/STPP/WVTT','type':'string'})['option']('subs-lang',{'alias':'S','describe':'Subtitles\x20language(s)','type':'string'})['option'](gA(0x1ca),{'alias':'l','describe':'Video/audio\x20language(s)','type':gA(0x214)})['option']('skip-video',{'describe':'do\x20not\x20download\x20video','type':'boolean'})['option']('skip-audio',{'describe':'do\x20not\x20download\x20audio','type':gA(0x33a)})['option']('skip-subtitles',{'describe':'do\x20not\x20download\x20subtitles','type':'boolean'})['option'](gA(0x336),{'describe':gA(0x26f),'type':'boolean'})['option']('select',{'describe':'Select\x20audio/video/subtitle\x20streams\x20from\x20manifest\x20manually','type':'boolean'})['option']('episodes',{'alias':'e','describe':'Seasons/episodes\x20to\x20download,\x20e.g.\x20`S01E01`,\x20`S01-S05,S07`,\x20`S01E01-S02E03`,\x20`S02-S02E03`,\x20etc.','type':'string','coerce':fU=>fr(fU)})['option']('retry',{'alias':'R','describe':'Number\x20of\x20retries\x20in\x20case\x20of\x20unsuccessful\x20request','type':'number','default':az['retry']})[gA(0x2bb)]('connections',{'alias':'C','describe':'Number\x20of\x20parallel\x20http\x20connections\x20per\x20download','type':'number','default':az[gA(0x29c)]})['option']('proxy',{'describe':'Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20all\x20requests','type':'string'})['option']('proxy-meta',{'describe':'Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20metadata\x20fetching','type':'string'})['option']('proxy-media',{'describe':'Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20media\x20downloading','type':'string'})['option']('movie-template',{'describe':'Movie\x20filename\x20template','type':'string','default':az['movieFilenameTemplate']})['option']('episode-template',{'describe':'Episode\x20filename\x20template','type':'string','default':az['seriesFilenameTemplate']})['option'](gA(0x277),{'describe':'Download\x20hardsubbed\x20video\x20if\x20available','type':'boolean'})['option'](gA(0x258),{'describe':'Trim\x20video\x20at\x20the\x20beginning;\x20example:\x2000:00:06','type':'string'})['option']('trim-end',{'describe':'Trim\x20video\x20at\x20the\x20end;\x20example:\x2000:01:30','type':'string'})['option']('key',{'describe':'Set\x20content\x20decryption\x20key\x20(if\x20manifest\x20URL\x20as\x20main\x20URL\x20passed),\x20format:\x20KID:KEY','type':'array','string':!0x0,'coerce':fU=>fU['map'](fV=>{let [fW,fX]=fV['split'](':');return{'kid':fW,'key':fX};})})[gA(0x2bb)]('header',{'alias':'H','describe':'Pass\x20custom\x20header(s)\x20for\x20manifest\x20request','type':'array','string':!0x0,'coerce':fU=>ft(fU)})['option']('format',{'alias':'f','describe':'Video\x20container\x20format\x20-\x20mp4\x20|\x20mkv\x20(Pro\x20only)','type':'string','choices':[gA(0x1d4),'mkv']}),'handler':async fT=>{const k9=gA;let fU=fT;fU['videoQuality']=fT['quality'];let fV=new aA(d);if(fU['format']){let {error:g9}=await fk({'videoContainerFormat':fU['format']});g9&&(C['error'](k9(0x320)+g9['message']),C['info']('Learn\x20more:\x20https://azot.mov/pricing'),process['exit'](0x1));}let fW=[];try{({grantedBenefits:fW}=await bV());}catch(ga){let gb=ga instanceof Error?ga[k9(0x20f)]:String(ga);C['warn']('Failed\x20to\x20resolve\x20customer\x20plan\x20for\x20connection\x20limits.\x20Falling\x20back\x20to\x20Free\x20limits:\x20'+gb);}let {options:fX,limit:{normalizedRequestedConnections:fY,maxAllowedConnections:fZ,wasClamped:g0,connections:g1}}=fm({'options':fU,'fallbackConnections':fV['get']('connections'),'grantedBenefits':fW});Object['assign'](fU,fX),g0&&C['warn']('Connections\x20value\x20'+fY+'\x20exceeds\x20tier\x20limit\x20('+fZ+').\x20Using\x20'+g1+'.');let g3=new bZ({'dirs':[k],'indexPath':J});await g3['init'](),await g3[k9(0x223)](),await g3['discover']();let g4=new fw(join(y,'downloads.json'));await g4['load']();let g5=new fp(fV,g3,g4);bM()['then'](gc=>Object['assign'](bK,gc)),g5['onJobCompleted'](gc=>{C['debug']('Job\x20completed:\x20'+gc['id']);}),g5['onJobError'](gc=>{C['debug']('Job\x20failed:\x20'+gc['error']);}),g5['onError'](gc=>{const ka=k9;C['error'](ka(0x25d)+gc['message']);});let g6=Array['isArray'](fT['urls'])?fT['urls']:[],g7=process.env.ELECTRON_RUN_AS_NODE==='1'?g6['filter'](gc=>gc!==process['argv'][0x1]):g6,g8=g7['length']>0x0?g7:[''];for(let gc of g8){let gd=await fu(gc),ge=await g5['analyze'](gd,fU),gf=Array['isArray'](ge)?ge:[ge];for(let gg of gf)g5['add']({'url':gd,'options':fU,'resource':gg});}await g5['waitForIdle']();}},fy='azot-desktop',fz=async()=>{const kb=gA;if(await bM()&&!await confirm({'message':'You\x27re\x20already\x20logged\x20in.\x20Do\x20you\x20want\x20to\x20log\x20in\x20again?','default':!0x1})){C['debug']('Login\x20cancelled');return;}let fT=createSpinner('Requesting\x20device\x20authorization...');fT['start']();try{let fU=bB(),{data:fV,error:fW}=await fU['device']['code']({'client_id':fy,'scope':'openid\x20profile\x20email'});if(fT['stop'](),fW||!fV)C['error']('Failed\x20to\x20request\x20device\x20authorization:\x20'+(fW?.['error_description']||fW?.['statusText']||'Unknown\x20error')),C['debug'](fW);else{let {device_code:fX,user_code:fY,verification_uri:fZ,verification_uri_complete:g0,interval:g1=0x5,expires_in:g3}=fV;console['log'](''),console['log'](P['cyan']('📱\x20Device\x20Authorization\x20Required')),console['log'](''),console['log']('Please\x20visit:\x20'+P['underline'](P['blue'](fZ))),console['log']('Enter\x20code:\x20'+P['bold'](P[kb(0x1e5)](fY))),console['log'](''),await confirm({'message':'Open\x20browser\x20automatically?','default':!0x0})&&await a0(g0||fZ),console['log'](P['gray']('Waiting\x20for\x20authorization\x20(expires\x20in\x20'+Math['floor'](g3/0x3c)+kb(0x1f4)));let g4=await fA(fU,fX,fy,g1);if(g4){await bL(g4);let {data:g5}=await fU['getSession']({'fetchOptions':{'headers':{'Authorization':'Bearer\x20'+g4['access_token']}}});console['log'](P['green']('✅\x20Login\x20successful!\x20Logged\x20in\x20as\x20'+(g5?.['user']?.['name']||g5?.['user']?.['email']||kb(0x2ff))));}}}catch(g6){fT['stop'](),C['error']('Login\x20failed:\x20'+(g6 instanceof Error?g6['message']:'Unknown\x20error'));}};async function fA(fT,fU,fV,fW){let fX=fW,fY=createSpinner('',{'color':'cyan'}),fZ=0x0;return new Promise(g0=>{let g1=async()=>{const kc=b;fZ=(fZ+0x1)%0x4,fY['update'](P['gray'](kc(0x21f)+'.'['repeat'](fZ)+'\x20'[kc(0x305)](0x3-fZ))),fY[kc(0x29a)]()||fY['start']();try{let {data:g3,error:g4}=await fT['device'][kc(0x1d1)]({'grant_type':kc(0x2ea),'device_code':fU,'client_id':fV,'fetchOptions':{'headers':{'user-agent':'Azot\x20Desktop'}}});if(g3?.['access_token']){fY[kc(0x202)](),g0(g3);return;}else{if(g4)switch(g4['error']){case kc(0x1fb):break;case'slow_down':fX+=0x5,fY['update'](P['yellow']('Slowing\x20down\x20polling\x20to\x20'+fX+'s'));break;case'access_denied':fY['stop'](),C['error']('Access\x20was\x20denied\x20by\x20the\x20user');break;case'expired_token':fY[kc(0x202)](),C['error']('The\x20device\x20code\x20has\x20expired.\x20Please\x20try\x20again.');break;default:fY[kc(0x202)](),C['error']('Error:\x20'+g4['error_description']);}}}catch(g5){fY['stop'](),C[kc(0x23a)]('Network\x20error:\x20'+(g5 instanceof Error?g5[kc(0x20f)]:'Unknown\x20error'));return;}setTimeout(g1,fX*0x3e8);};setTimeout(g1,fX*0x3e8);});}const fB=async()=>{C['info']('Logging\x20out...');let fT=await bB()['signOut']();fT['error']?C['error']('Logout\x20failed:\x20'+fT['error']['message']):(C['info']('Logout\x20successful'),await bL({}));},fC={'command':'login\x20[extension]','describe':gA(0x1f5),'builder':fT=>fT['option']('username',{'alias':'u','describe':'Username','type':'string'})['option']('password',{'alias':'p','describe':'Password','type':'string'})['option']('otp',{'alias':'o','describe':'One-time\x20password','type':'string'}),'handler':async fT=>{let fU=fT['extension'],fV={'username':fT['username'],'password':fT['password'],'otp':fT['otp']};if(fU){let fW=new bZ({'dirs':[k],'indexPath':J});await fW['init'](),await fW['discover'](),await fW['login'](fU,fV);}else fz();}},fD={'command':'list','aliases':['ls'],'describe':'Lists\x20information\x20about\x20installed/active\x20extensions','handler':async()=>{let fT=await new bZ({'indexPath':J})['init']();if(!fT['infoList']['length'])return console['log']('No\x20added\x20extensions\x20found');for(let fU of fT['infoList']){let fV=''+P['bold'](P['blue'](fU['name']['padEnd'](0xf))),fW=P['green'](fU['package']?.['version']);console['log'](fV+fW);}console['log']('\x0a'+P['dim']('Location:\x20'+o));}},fE=new Intl['RelativeTimeFormat']('en',{'style':'long'}),fF=fT=>{const kd=gA;let fU=Math['floor'](fT/0x18),fV=Math['abs'](fU);return fV>0x16d?fE['format'](Math['floor'](fU/0x16d),'year'):fV>0x1e?fE['format'](Math['floor'](fU/0x1e),kd(0x2de)):fV>0x7?fE['format'](Math['floor'](fU/0x7),'week'):fV>0x1?fE['format'](Math['floor'](fU),'day'):fE['format'](Math['floor'](fT),'hour');},fG=(fT,fU,fV)=>{const ke=gA;let fW=''+P['bold'](P['blue'](fT[ke(0x2fe)](0xf))),fX=P['green'](fU['padEnd'](0xa)),fY=P['dim'](fV);console['log'](fW+fX+fY);},fH={'command':'list-remote','aliases':['ls-remote'],'describe':'List\x20all\x20available\x20extensions','handler':async()=>{bM()['then'](fV=>Object['assign'](bK,fV));let fT=await bZ['getAvailableExtensions'](),fU=Date['now']();for(let fV of fT){let fW=fV['releases']['toSorted']((g0,g1)=>new Date(g1['createdAt'])['getTime']()-new Date(g0['createdAt'])['getTime']())['at'](0x0);if(!fW)continue;let fX=fW['createdAt'],fY=new Date(fX)['getTime']()-fU,fZ=fF(Math['floor'](fY/0x36ee80));fG(fV['name'],fW['version'],fZ);}}},fI={'command':'logout\x20[extensions..]','describe':'Logout\x20from\x20extension\x20(or\x20if\x20no\x20extension\x20is\x20specified,\x20logout\x20from\x20Azot\x20account)','handler':async fT=>{let fU=fT['extensions'];if(fU?.['length']){let fV=new bZ({'dirs':[k],'indexPath':J});await fV['init'](),await fV['discover'](),await fV['logout'](fU);}else fB();}},fJ={'command':'settings\x20[key]\x20[value]','describe':'CLI\x20access\x20to\x20get/set\x20configuration\x20settings','handler':async fT=>{let fU=new aA(d),fV=fT['key'],fW=fT['value'];if(fV&&fW){fU['set']({[fV]:fW}),console['log']('Setting\x20'+P['bold'](P['blue'](fV))+'\x20set\x20to\x20'+P['green'](fW));return;}else{if(fV){let fY=fU['get'](fV);console['log'](fY?'Setting\x20'+P['bold'](P['blue'](fV))+'\x20is\x20'+P['green'](fY):'Setting\x20'+P['bold'](P['blue'](fV))+'\x20is\x20not\x20found');return;}}let fX=fU['getAll']();for(let [fZ,g0]of Object['entries'](fX)){let g1=(''+fZ)['padEnd'](0x19),g3=String(g0)['replaceAll']('{','{{')['replaceAll']('}','}}');console['log'](P['bold'](P['blue'](g1))+'\x20'+g3);}console['log']('\x0a'+P['dim']('Location:\x20'+d));}},fK={'command':'uninstall\x20<extensions..>','aliases':['rm'],'describe':'Uninstall\x20an\x20extension','handler':async fT=>{let fU=fT['extensions'],fV=new bZ({'dirs':[k],'indexPath':J});await fV['init'](),await fV['uninstall'](fU);}},fL={'command':'install\x20<extensions..>','aliases':['i'],'describe':'Install\x20extension','handler':async fT=>{const kf=gA;let fU=fT['extensions'],fV=new bZ({'dirs':[k],'indexPath':J});await fV['init'](),await fV[kf(0x270)](fU);}},fM={'command':gA(0x263),'describe':'Show\x20logs\x20list','handler':async()=>{let fT=s,fU=await readdir(fT)['then'](fW=>fW['filter'](fX=>fX['endsWith']('.log'))),fV=fW=>join(fT,fW);fU['length']||C['info']('No\x20logs\x20found');for(let fW of fU)C['info'](fV(fW));}};C[gA(0x1e2)](w);const fN=ad(process['argv']);C['debug'](l+'\x20'+fN['join']('\x20'));function b(c,d){c=c-0x1c6;const e=a();let f=e[c];return f;}const fO=new Set(['build','dev']);G['on']('error',fT=>{let fU=q(fT);C['error'](fU['message']);});const fP=P['magenta'](P['bold'](g))+'\x20is\x20'+i['description'][gA(0x1df)](),fQ=P[gA(0x2b8)]('Usage:\x20$0\x20<command>\x20'+P['cyan']('[...options]')),fR=(fT,fU)=>{let fV=fU instanceof Error?fU:Error(String(fU));C['fatal'](fT+':\x20'+fV['message']),fV['stack']&&C['debug'](fV['stack']),rmSync(m,{'recursive':!0x0,'force':!0x0}),process['exit'](0x1);};process['on']('uncaughtException',fT=>{fR('Unexpected\x20error',fT);}),process['on']('unhandledRejection',fT=>{fR('Unhandled\x20promise\x20rejection',fT);}),!v&&fO['has'](fN[0x0]??'')&&fR('CLI\x20error',Error('The\x20`build`\x20and\x20`dev`\x20commands\x20are\x20unavailable\x20in\x20the\x20desktop-distributed\x20CLI.\x20Use\x20the\x20npm-installed\x20`azot`\x20package\x20in\x20a\x20Node.js\x20environment\x20instead.'));const fS=O(fN)['scriptName'](l)['usage'](fP+'\x0a\x0a'+fQ)['command'](fx)['command'](fD)['command'](fH)['command'](fL)['command'](fK)['command'](fC)['command'](fI)['command'](fJ)['command'](fM)['option']('debug',{'describe':'Debug\x20mode','type':'boolean'})['wrap'](O()['terminalWidth']())['help']()['alias']('h','help')['showHelpOnFail'](!0x1)['version'](h)['updateStrings']({'Commands:':P['bold']('Commands:'),'Options:':P['bold'](gA(0x2e6)),'default':P['dim']('default'),'aliases':P['dim']('aliases'),'boolean':P['dim']('boolean'),'string':P['dim']('string'),'number':P['dim']('number')})['epilogue']('Learn\x20more\x20about\x20Azot:\x20'+P['magenta']('https://azot.mov')+'.');v&&fS['command'](at)['command'](au),fS['parseAsync']()['then'](async fT=>{await r(s);let fU=String(fT['_'][0x0]??'');fU==='dev'||fU==='build'&&fT['watch']===!0x0||process['exit'](0x0);})['catch'](fT=>{fR('CLI\x20error',fT);});export{};
|
|
2
|
+
const gP=b;(function(g4,g5){const gJ=b,g6=g4();while(!![]){try{const g7=-parseInt(gJ(0x1aa))/0x1*(parseInt(gJ(0x133))/0x2)+parseInt(gJ(0x16b))/0x3*(parseInt(gJ(0x244))/0x4)+parseInt(gJ(0x150))/0x5+parseInt(gJ(0x1a7))/0x6*(-parseInt(gJ(0x226))/0x7)+parseInt(gJ(0x1f6))/0x8+parseInt(gJ(0x1a0))/0x9*(parseInt(gJ(0x26e))/0xa)+parseInt(gJ(0x12c))/0xb*(-parseInt(gJ(0x111))/0xc);if(g7===g5)break;else g6['push'](g6['shift']());}catch(g8){g6['push'](g6['shift']());}}}(a,0x40b93));function b(c,d){c=c-0x10e;const e=a();let f=e[c];return f;}import{A as c,C as d,D as f,E as g,M as h,O as i,S as j,T as k,_ as l,a as m,b as n,c as o,d as p,f as q,g as r,h as s,i as t,j as u,k as v,l as w,m as x,n as y,o as A,p as B,r as C,s as D,t as E,u as F,v as G,w as H,x as I,y as J}from'./context-dQU9jc5L.mjs';import{createRequire}from'node:module';import K,{constants,existsSync,readFileSync,readdirSync,rmSync,statSync,writeFileSync}from'node:fs';import*as L from'node:path';import M,{basename,dirname,extname,join,parse,resolve}from'node:path';import N from'yargs';import'urlpattern-polyfill';import O from'picocolors';function a(){const l1=['isArray','preferHardsub','DRM_UNAUTHORIZED','connections','No\x20entry\x20file\x20found','applyProgress','resolve','source','includes','columns','finalPath','getName','\x20built-in\x20extensions:\x20','getEntries','entry','2304UCllMR','pid','all','ls-remote','getQueryState','fairplay','getCodec','290886ykxmLc','url','customDrmClient','1GNIQPM','type','info','finish','proxyMeta','DASH','part_','clone','splice','execUrlPatterns','update','number','\x20∙\x20','ara','parse','createdAt','getTracks','totalBytes','latest','enabled','subtitleLanguages','default','indexPath','startsWith','\x20doesn\x27t\x20match\x20expected\x20size\x20','defineProperty','package.json','discover','failure','wildcardHostSuffixes','blue','ec-3','getRecord','toUpperCase','No\x20client\x20ID','replace','beforeDownload','forced','ask','statusMsg','boolean','showHelpOnFail','\x20FORCED','skipVideo','stat','https://*.rbc.ru/*','Subtitles:\x20','getActiveJob','code','Failed\x20to\x20convert\x20subtitle\x20to\x20WebVTT','version','getLanguageCode','probe','do\x20not\x20download\x20video','Extension\x20','isSpinning','rutube_','clear','array','tag_name','endsWith','stream_url','getBitrate','decryptFile','format','reset','close','weibo','getFirstPacket','trim-begin','text','video_url','parts','repeat','HLS_FORMATS','customMuxFormat','2885808puXyCf','notify','cookieStore','function','includeVolatile','configure','length','reconcileState','message','\x20url=','toString','legacy','\x20is\x20','payload','\x20directory\x20not\x20found:\x20','Azot','paused','transferring','select','do\x20not\x20download\x20subtitles','Could\x20not\x20find\x20RBC\x20playlist\x20URL.','some','/about/','onDownloadFinished','defineExtension','set','<meta\x20property=\x22ya:ovs:feed_url\x22\x20content=\x22','mp3_0_0','toLowerCase','template','getActiveRun','installedAt','SoundCloud','phase-changed','Invalid\x20license\x20response','unhandledRejection','console','vitalygashkov@vk.com','yappyId','video','averageTotal','retry','value','baseName','store','catch','sessionId','assign','7euNBEh','snapshot','year','resumeManager','current','init','hint','slice','Obfuscation\x20finished','queued','maxActiveDownloads','yellow','toLocaleLowerCase','skipAudio','{title}.S{s}E{e}.{episodeTitle}.{audioType}.{quality}.{tag}.{format}.{codec}','tokenType','bytesWritten','log','Only\x20WebVTT\x20subtitles\x20are\x20supported\x20by\x20the\x20MediaBunny\x20muxer.','persistJob','user','status','https://rutube.ru','readdir','emit','build\x20[entry]','hex','package','stream_url_hd','command','36PDQqEA','markQueued','split','MediaBunny\x20output\x20handle\x20was\x20not\x20initialized\x20for\x20','Subtitles\x20language(s)','DASH_FORMATS','auth.logout','include','runPromise','markFailed','/events','strategy','matches','UrlSource','off','MP3','getSegments','\x5c}(?=\x5c.|$)|\x5c{','Trim\x20video\x20at\x20the\x20beginning;\x20example:\x2000:00:06','vorbis','getAll','Either\x20output\x20or\x20filePath\x20is\x20required\x20for\x20FileResumeStore','bold','location','exec','getTime','setFilePath','URL:\x20','key','removeQueries','has','nextTick','proxy','https://api.github.com/repos/','progress','http','rutube','icon','uninstall','setItem','access_token','Subtitle\x20format\x20-\x20SRT/SSA/ASS/TTML/VTT/STPP/WVTT','10140waCmSA','request','completed','errorHandler','join','cause','prompt','getExtensions','winconsole','preferredChannel','https://rbc.ru/','\x20failed:\x20','context','132pOUYkt','start','debug','size','isDirectory','strict-origin-when-cross-origin','https://azot.mov/','base64','then','mkdir','movieFilenameTemplate','tempDir','delete','Learn\x20more:\x20https://azot.mov/pricing','extensions','option','getObfuscatedCode','hasState','minify','trim','cleanupOnSuccess','get','subtitle','averageSize','opus','browser_download_url','pssh','805959XxZhST','input','soundcloud','extract','Download.execute()\x20can\x20only\x20be\x20called\x20once\x20per\x20instance.','display_url','finally','314582ArtMeI','navigator','title','DRM_FORBIDDEN','updateRecord','stack','\x22Chromium\x22;v=\x22130\x22,\x20\x22Google\x20Chrome\x22;v=\x22130\x22,\x20\x22Not?A_Brand\x22;v=\x2299\x22','green','map','head','trimBegin','\x20Kbps\x20|\x20','otp','No\x20files\x20were\x20downloaded','EXTENSION_INSTALL_UNKNOWN','trimEnd','aborted','name','RELEASE_NOT_FOUND','push','filePath','logout','statusText','save','ave','downloaded','utf8','filter','setLanguageCode','1789405KmhANo','no\x20tracks','dispose','Failed\x20to\x20load\x20extension\x20script:\x20','path','charCodeAt','fetch','readFile','match','bytesDownloaded','prepareContext','running','record','error','label','document','AbortError','sort','\x20of\x20','keys','headers','main',',\x20path=','dim','240','ENOENT','callbacks','99549iRKCSm','obfuscate','audioLanguage','computeDuration','requestInit','exports','GitHub\x20release\x20asset\x20not\x20found','toSorted','HLS','video-hostings','trackArtifact','filename=','cenc','Set\x20content\x20decryption\x20key\x20(if\x20manifest\x20URL\x20as\x20main\x20URL\x20passed),\x20format:\x20KID:KEY','getAudioTracks','x\x20increase','EACCES','stringify','dir','accessToken','find','records','sourceSignature','recordId','kid','analyze','Track\x20download\x20skipped,\x20already\x20aborted:\x20','_options','next','tv-channels','kind','warn','dirname','total','tur','run','string','output'];a=function(){return l1;};return a();}import*as P from'node:fs/promises';import Q,{open,readFile,readdir,rm,stat,writeFile}from'node:fs/promises';import R,{platform,stdout}from'node:process';import{hideBin}from'yargs/helpers';import{EventEmitter as S}from'node:events';import{z}from'zod';import{ALL_FORMATS,DASH,HLS,Input,UrlSource,desc,prefer}from'dasha';import T from'ky';import{Agent,ProxyAgent}from'undici';import{checkbox,confirm}from'@inquirer/prompts';import{execFileSync}from'node:child_process';import{createAuthClient}from'better-auth/client';import{deviceAuthorizationClient}from'better-auth/client/plugins';import{tributeClient}from'@tribute-tg/better-auth';import{QueryCache,QueryClient}from'@tanstack/query-core';import{createHash}from'node:crypto';import{inspect}from'node:util';import{RemoteCdm,requestMediaKeySystemAccess}from'okova';import{Decryption,FilePathSource,FilePathTarget,Input as U,Output}from'shifro';import{convert}from'@transcrobes/subs-convert';import{ALL_FORMATS as V,EncodedAudioPacketSource,EncodedPacketSink,EncodedVideoPacketSource,Input as W,MkvOutputFormat,Mp4OutputFormat,Output as X,StreamSource,StreamTarget,TextSubtitleSource}from'mediabunny';import{isatty}from'node:tty';import{createSpinner}from'nanospinner';import{finished,pipeline}from'node:stream/promises';import{Readable}from'node:stream';import Y from'open';var Z=Object['create'],a0=Object['defineProperty'],a1=Object['getOwnPropertyDescriptor'],a2=Object['getOwnPropertyNames'],a3=Object['getPrototypeOf'],a4=Object['prototype']['hasOwnProperty'],a5=(g4,g5)=>()=>(g5||(g4((g5={'exports':{}})['exports'],g5),g4=null),g5['exports']),a6=(g4,g5,g6,g7)=>{const gK=b;if(g5&&typeof g5=='object'||typeof g5=='function'){for(var g8=a2(g5),g9=0x0,ga=g8[gK(0x1fc)],gb;g9<ga;g9++)gb=g8[g9],!a4['call'](g4,gb)&&gb!==g6&&a0(g4,gb,{'get':(gc=>g5[gc])['bind'](null,gb),'enumerable':!(g7=a1(g5,gb))||g7['enumerable']});}return g4;},a7=(g4,g5,g6)=>(g6=g4==null?{}:Z(a3(g4)),a6(g5||!g4||!g4['__esModule']?a0(g6,'default',{'value':g4,'enumerable':!0x0}):g6,g4)),a8=createRequire(import.meta.url);const a9=()=>{const gL=b;let g4=[];process['resourcesPath']&&g4[gL(0x146)](join(process['resourcesPath'],'bin','winconsole.node'));let g5=join(__dirname,'..','..','..');return g4['push'](join(g5,'assets','bin','win32','winconsole.node')),g4['push'](join(g5,'native',gL(0x276),'build','Release','winconsole.node')),g4['find'](g6=>existsSync(g6))||null;},aa=()=>{if(process['platform']!=='win32')return null;let g4=a9();if(!g4)return null;try{return a8(g4);}catch{return null;}};if(process['platform']==='win32'&&process.env.ELECTRON_RUN_AS_NODE==='1'){let gd=aa();gd&&(gd['attachParentConsole']?.(),gd['enableUtf8']?.());}const ab=(g4=process['argv'],g5=process.env)=>g5['ELECTRON_RUN_AS_NODE']==='1'?g4['slice'](0x2):hideBin(g4),ac={'target':'node','compact':!0x0,'identifierNamesGenerator':'mangled','renameGlobals':!0x0,'simplify':!0x0,'controlFlowFlattening':!0x1,'deadCodeInjection':!0x1,'debugProtection':!0x1,'numbersToExpressions':!0x1,'selfDefending':!0x1,'splitStrings':!0x1,'stringArray':!0x0,'stringArrayCallsTransform':!0x1,'stringArrayEncoding':[],'stringArrayIndexShift':!0x0,'stringArrayRotate':!0x0,'stringArrayShuffle':!0x0,'stringArrayWrappersCount':0x1,'stringArrayWrappersChainedCalls':!0x0,'stringArrayWrappersType':'variable','stringArrayThreshold':0.1,'transformObjectKeys':!0x1,'unicodeEscapeSequence':!0x1},ad=g4=>{let g5=['B','KB','MB','GB'],g6=g4,g7=0x0;for(;g6>=0x400&&g7<g5['length']-0x1;)g6/=0x400,g7+=0x1;return g6['toFixed'](g7===0x0?0x0:0x2)+'\x20'+g5[g7];},ae=async(g4,g5)=>{const gM=b;let g6=readFileSync(g4,'utf8'),{default:g7}=await import('javascript-obfuscator');console['log']('Obfuscating\x20'+g4+'...'),console['time'](gM(0x22e));let g8=g7['obfuscate'](g6,ac);console['timeEnd']('Obfuscation\x20finished');let g9=g8[gM(0x121)](),ga=Buffer['byteLength'](g6,gM(0x14d)),gb=Buffer['byteLength'](g9,'utf8'),gc=ga===0x0?0x0:gb/ga;return console['log']('Size\x20changed\x20from\x20'+ad(ga)+'\x20to\x20'+ad(gb)+',\x20'+gc['toFixed'](0x2)+gM(0x17a)),writeFileSync(g5||g4,g9),g9;},af=new Set(['.ts','.js','.cjs','.mjs']),ag=new Set(['index','main']),ah=g4=>{const gN=b;if(existsSync(g4))try{if(!statSync(g4)['isDirectory']())return;let g5=readdirSync(g4)['filter'](g8=>!g8['endsWith']('.d.ts'))['filter'](g8=>af['has'](M['extname'](g8))),g6=g8=>M['basename'](g8,M['extname'](g8)),g7=g5['find'](g8=>ag[gN(0x262)](g6(g8)))||g5[0x0];return g7?M['join'](g4,g7):void 0x0;}catch{return;}},ai=()=>{let g4=[process['cwd'](),M['join'](process['cwd'](),'src'),M['join'](process['cwd'](),'lib')];for(let g5 of g4){let g6=ah(g5);if(g6)return g6;}},aj=g4=>g4==='esm'?'mjs':'cjs',ak=(g4,g5)=>M['join'](process['cwd'](),'dist',M['parse'](g4)['name']+'.'+aj(g5)),al=g4=>{let g5=M['relative'](process['cwd'](),g4);if(!g5||g5['startsWith']('..'))throw Error('Entry\x20file\x20must\x20be\x20inside\x20the\x20current\x20working\x20directory:\x20'+g4);return'./'+g5['split'](M['sep'])['join']('/');},am=g4=>{const gO=b;let g5=g4['input']||g4['entry']||ai();if(!g5)throw Error(gO(0x195));return M['resolve'](g5);},an=()=>{if(v)throw Error('The\x20`build`\x20and\x20`dev`\x20commands\x20are\x20unavailable\x20in\x20the\x20desktop-distributed\x20CLI.\x20Use\x20the\x20npm-installed\x20`azot`\x20package\x20in\x20a\x20Node.js\x20environment\x20instead.');},ao=g4=>g4['positional']('entry',{'describe':'Path\x20to\x20the\x20input\x20file','type':'string'})['option']('input',{'alias':'i','describe':'Path\x20to\x20the\x20input\x20file','type':'string'})[gP(0x120)](gP(0x1ea),{'alias':'f','describe':'Output\x20format','choices':['cjs','esm'],'default':'cjs'})['option']('minify',{'describe':'Minify\x20output','type':'boolean'}),ap=g4=>{const gQ=gP;let g5=M[gQ(0x197)](g4);for(;;){let g6=M['join'](g5,'package.json');if(existsSync(g6))return g6;let g7=M['dirname'](g5);if(g7===g5)return;g5=g7;}},aq=g4=>{let g5=ap(g4);if(!g5){let g6='Could\x20not\x20find\x20package.json\x20starting\x20from\x20'+g4;throw q['error'](g6),Error(g6);}try{let g7=JSON['parse'](readFileSync(g5,'utf8'));if(!g7||typeof g7!='object'||Array['isArray'](g7))throw Error('package.json\x20must\x20contain\x20a\x20JSON\x20object');let g8=g7;if(g8['private']!==void 0x0&&typeof g8['private']!='boolean')throw Error('package.json\x20field\x20\x22private\x22\x20must\x20be\x20a\x20boolean\x20when\x20present');return{'private':g8['private']};}catch(g9){let ga='Failed\x20to\x20load\x20package.json\x20for\x20build\x20command\x20from\x20'+g5;throw q['error'](ga),q['debug'](g9),Error(ga);}},ar={'command':gP(0x23f),'describe':'Bundle\x20a\x20Node.js\x20entry\x20file\x20for\x20distribution','builder':g4=>ao(g4)['option']('watch',{'describe':'Watch\x20file\x20changes','type':'boolean'})['option']('obfuscate',{'describe':'Obfuscate\x20output','type':'boolean'}),'handler':async g4=>{const gR=gP;an();let g5=am(g4),g6=typeof g4[gR(0x123)]=='boolean'?g4['minify']:!0x0,g7=g4['watch']===!0x0,g8=g4['format']??'cjs',{build:g9}=await import('tsdown');await g9({'entry':al(g5),'format':g8,'platform':'node','target':'node24','watch':g7,'minify':g6,'inlineOnly':!0x1});let ga=ak(g5,g8),gb=aq(process['cwd']());(typeof g4[gR(0x16c)]=='boolean'?g4['obfuscate']:gb['private'])&&await ae(ga,ga);}},as={'command':'dev\x20[entry]','describe':'Watch\x20and\x20rebuild\x20a\x20Node.js\x20entry\x20file\x20during\x20development','builder':g4=>ao(g4),'handler':async g4=>{const gS=gP;an();let g5=am(g4),g6=typeof g4['minify']=='boolean'?g4['minify']:!0x1,{build:g7}=await import('tsdown');await g7({'entry':al(g5),'format':g4[gS(0x1ea)]??'cjs','platform':'node','target':'node24','watch':!0x0,'minify':g6});}},at=()=>Intl['DateTimeFormat']()['resolvedOptions']()['locale']['startsWith']('ru')?'ru':'en',au={'dark':'dark','light':'light','system':'system'},av={'mp4':'mp4','mkv':'mkv'},aw=z['object']({'downloadDir':z[gP(0x18f)]()['default'](l),'binariesDir':z[gP(0x18f)]()['default'](d(join(B,'bin'))),'drmDir':z['string']()['default'](d(join(B,'drm'))),'language':z['string']()['default'](at()),'theme':z['enum']([au['dark'],au['light'],au['system']])['default'](au['system']),'preferHardsub':z['coerce']['boolean']()['default'](!0x1),'retry':z['coerce']['number']()['int']()['min'](0x1)['max'](0xa)['default'](0x3),'connections':z['coerce']['number']()['int']()['min'](0x1)['max'](0x40)['default'](0x4),'maxActiveDownloads':z['coerce']['number']()['int']()['min'](0x1)['default'](0x1),'proxy':z['string']()['optional'](),'proxyMeta':z['string']()['optional'](),'proxyMedia':z['string']()['optional'](),'movieFilenameTemplate':z['string']()['default']('{title}\x20({quality},\x20{codec})'),'seriesFilenameTemplate':z['string']()['default']('{title}\x20S{s}E{e}\x20({quality},\x20{codec})'),'developerMode':z['coerce']['boolean']()['default'](!0x1),'allowUnknownSources':z['coerce']['boolean']()['default'](!0x1),'videoContainerFormat':z['enum']([av['mp4'],av['mkv']])['default'](av['mp4']),'useAlternativeServer':z['coerce']['boolean']()['default'](!0x1),'automaticUpdates':z['coerce']['boolean']()['default'](!0x0)}),ax=aw[gP(0x1b8)]({});var ay=class{#e;constructor(g4){this.#e=o({'defaults':ax,'cwd':dirname(g4),'configName':basename(g4,'.json')}),this.#t();}#t(){const gT=gP;let g4=this.#e['store'],g5=aw['safeParse'](g4),g6='{title}.{audioType}.{quality}.{tag}.{format}.{codec}',g7=gT(0x234);if(g4['movieFilenameTemplate']==='{title}.{audioType}.{quality}.{tag}.{format}.{codec}'&&this.#e['set'](gT(0x11b),g4['seriesFilenameTemplate']),g4['seriesFilenameTemplate']===gT(0x234)&&this.#e['set']('seriesFilenameTemplate',g4['seriesFilenameTemplate']),!g5['success']){console['warn']('Settings\x20validation\x20failed!\x20Resetting\x20to\x20defaults.',g5['error']['flatten']()),this.#e['set'](ax);return;}Object['hasOwn'](g4,'askForOptions')&&this.#e['set'](g5['data']);}['getAll'](){return this.#e['store'];}['get'](g4){return this.#e['get'](g4);}['set'](g4){const gU=gP;let g5={...this.#e['store'],...g4},g6=aw['safeParse'](g5);if(!g6['success'])throw console['error']('Invalid\x20settings\x20update:',g6[gU(0x15d)]['flatten']()),Error('Settings\x20update\x20failed\x20validation.');this.#e['set'](g6['data']);}['onDidChange'](g4){this.#e['onDidAnyChange'](g4);}};const az=async g4=>{try{return await Q['access'](g4),!0x0;}catch(g5){if(g5['code']==='ENOENT')return!0x1;throw g5;}},aA=async(g4,{recursive:g5=!0x1}={})=>await Q[gP(0x23d)](g4,{'withFileTypes':!0x0,'recursive':g5}),aB=async(g4,{recursive:g5=!0x0,force:g6=!0x0}={})=>{await Q['rm'](g4,{'recursive':g5,'force':g6});},aC=async(g4,{recursive:g5=!0x0}={})=>{const gV=gP;await Q[gV(0x11a)](g4,{'recursive':g5});},aD=async g4=>{const gW=gP;try{await Q['access'](g4,constants['W_OK']);}catch(g5){let g6=g5['code'];throw g6==='EPERM'||g6==='EACCES'||g6===gW(0x169)?Object['assign'](Error('Download\x20directory\x20is\x20not\x20writable'),{'code':'DOWNLOAD_DIR_NOT_WRITABLE'}):g5;}},aE=async g4=>{try{let g5=await Q['readFile'](g4,{'encoding':'utf8'});return JSON['parse'](g5);}catch(g6){throw Error('Failed\x20to\x20read\x20JSON\x20file:\x20'+g4,{'cause':g6});}},aF=async(g4,g5)=>{const gX=gP;let g6=parse(g4)[gX(0x17d)];try{let g7=await az(g6);g6&&!g7&&await Q['mkdir'](g6),await Q['writeFile'](g4,JSON['stringify'](g5,null,0x2),'utf8');}catch(g8){throw Error('Failed\x20to\x20save\x20data\x20to\x20file:\x20'+g4,{'cause':g8});}},aG={'extract':(g4,g5)=>execFileSync('tar',['-xf',g4,...g5?['-C',g5]:[]],{'stdio':'inherit'})},aH={'CHANNEL_NOT_FOUND':'EXTENSION_INSTALL_CHANNEL_NOT_FOUND','VERSION_NOT_FOUND':'EXTENSION_INSTALL_VERSION_NOT_FOUND','RELEASE_NOT_FOUND':'EXTENSION_INSTALL_RELEASE_NOT_FOUND','ASSET_NOT_FOUND':'EXTENSION_INSTALL_ASSET_NOT_FOUND','UNSUPPORTED_SOURCE':'EXTENSION_INSTALL_UNSUPPORTED_SOURCE','UNSUPPORTED_PACKAGE_TYPE':'EXTENSION_INSTALL_UNSUPPORTED_PACKAGE_TYPE','IMPORT_INVALID':'EXTENSION_INSTALL_IMPORT_INVALID','SOURCE_NOT_FOUND':'EXTENSION_INSTALL_SOURCE_NOT_FOUND','UNKNOWN':gP(0x141)},aI=new Set(Object['values'](aH));var aJ=class extends Error{['code'];['details'];['hint'];constructor(g4){const gY=gP;super(g4['message']),this['name']='InstallExtensionError',this[gY(0x1da)]=g4['code'],this['details']=g4['details'],this[gY(0x22c)]=g4['hint'];}['toPayload'](){return{'code':this['code'],'message':this['message'],'details':this['details'],'hint':this['hint']};}};const aK=(g4,g5,g6,g7)=>new aJ({'code':g4,'message':g5,'details':g6,'hint':g7}),aL=g4=>{const gZ=gP;let g5=(g4?.['startsWith']('v')?g4[0x1]:g4?.[0x0])??'';return Number['isNaN'](parseInt(g5))?g4?.['split']('.')['at'](0x0)||'latest':g4?.['split']('-')['at'](0x1)?.[gZ(0x246)]('.')['at'](0x0)||gZ(0x1bc);},aM=g4=>(g4['version']||g4[gP(0x1e5)]||'')['replace'](/^v/,''),aN=g4=>[...new Set(g4['filter'](Boolean))],aO=g4=>({'availableVersions':aN((g4||[])[gP(0x13b)](g5=>aM(g5))),'availableChannels':aN((g4||[])['map'](g5=>aL(aM(g5))))}),aP=(g4,g5,g6)=>{const h0=gP;let g7={'source':g6,'preferredVersion':g4['preferredVersion'],'preferredChannel':g4[h0(0x277)],'appChannel':g4['appChannel'],...aO(g5)};return g4['preferredVersion']?aK(aH['VERSION_NOT_FOUND'],'Release\x20not\x20found\x20for\x20requested\x20version:\x20'+g4['preferredVersion'],g7):aK(aH['CHANNEL_NOT_FOUND'],'Release\x20not\x20found\x20for\x20requested\x20channel:\x20'+g4['preferredChannel'],g7);},aQ=(g4,g5,g6)=>{const h1=gP;if(!g4?.[h1(0x1fc)])return null;if(g5['preferredVersion'])return g4['find'](g7=>aM(g7)===g5['preferredVersion'])||null;if(!g5['isExplicitSelection']){let g7=g4[h1(0x17f)](g8=>aL(aM(g8))==='latest');if(g7)return g7;}return g4['find'](g8=>aL(aM(g8))===g5['preferredChannel'])||(g5['allowFallback']&&g5['preferredChannel']!=='latest'?(q['debug']('Release\x20'+g5['preferredChannel']+'\x20not\x20found\x20for\x20'+g6+',\x20falling\x20back\x20to\x20latest\x20stable'),g4['find'](g8=>aL(aM(g8))==='latest')||(q['debug']('Latest\x20stable\x20release\x20not\x20found\x20for\x20'+g6+',\x20falling\x20back\x20to\x20latest\x20with\x20any\x20channel'),g4['at'](0x0)||null)):null);},aR=g4=>{const h2=gP;let [,g5='']=g4[h2(0x246)]('@'),g6=g4['replace'](g5?'@'+g5:'',''),g7=aL(h[h2(0x1dc)]),g8=!!g5;return{'name':g6,'preferredVersion':Number['isNaN'](parseInt(g5[0x0]??''))?'':g5,'preferredChannel':g8?aL(g5):g7,'appChannel':g7,'isExplicitSelection':g8,'allowFallback':!g8&&g7!=='latest'};},aS=async(g4,g5)=>{const h3=gP;q['info']('Fetching\x20bundle...'),q['debug'](g4);let g6=await fetch(g4);if(!g6['ok'])throw aK(aH['ASSET_NOT_FOUND'],'Failed\x20to\x20download\x20extension\x20bundle:\x20'+g6['status']+'\x20'+g6['statusText'],{'url':g4,'status':g6['status'],'statusText':g6['statusText']});let g7=g6['headers']['get']('content-disposition')?.['split'](h3(0x176))[0x1]?.['split'](';')[0x0]?.['replaceAll']('\x22',''),g8=M['basename'](g4),g9=g5||g7||g8,ga=await g6['arrayBuffer'](),gb=M['join'](I,g9);return await Q['writeFile'](gb,Buffer['from'](ga)),await Q['stat'](gb)[h3(0x119)](gc=>{q['debug']('Bundle\x20downloaded\x20('+gc['size']/0x3e8+'\x20KB):\x20'+gb);})['catch'](()=>{const h4=h3;q[h4(0x15d)]('Bundle\x20download\x20failed:\x20can\x27t\x20find\x20output\x20file');}),gb;},aT=async(g4,g5)=>{const h5=gP;if(g4['startsWith']('npm:')||g4['startsWith']('@streamyx/'))throw aK(aH['UNSUPPORTED_SOURCE'],'NPM\x20extension\x20sources\x20are\x20no\x20longer\x20supported',{'source':g4});let g6=g4,g7=g4,g8=M['dirname'](g4),g9=g8!=='.'&&await Q[h5(0x1d6)](g8)['then'](()=>!0x0,()=>!0x1),ga=g4['startsWith']('./')||g4['startsWith']('../')||g4['startsWith']('/')||g4['startsWith']('~')||g9,gb=await Q['stat'](g4)['then'](()=>!0x0,()=>!0x1),gc=g4['startsWith']('https://'),ge=g4['startsWith']('gl:')||g4['startsWith']('gitlab:'),gf=g4['startsWith']('github:')||g4['startsWith']('gh:');if(ga&&!gb&&!gc&&!gf&&!ge)throw q['warn']('Installed\x20extension\x20not\x20found:\x20'+g4),q['warn']('Run\x20\x27azot\x20list\x27\x20and\x20remove\x20the\x20extension\x20from\x20the\x20list.'),aK(aH['SOURCE_NOT_FOUND'],'Installed\x20extension\x20source\x20not\x20found:\x20'+g4,{'source':g4});g4=g4['replace'](/^gl:/,'')['replace'](/^gitlab:/,'')['replace'](/^gh:/,'')['replace'](/^github:/,'');let gg=aR(g4),{name:gh}=gg;if(gc)g6=await aS(g4);else{if(gf){let [gn,go]=gh['split']('/'),gp=h5(0x265)+gn+'/'+go+'/releases',gq=await fetch(gp)['then'](gv=>gv['json']());if(gq?.['message']&&!Array['isArray'](gq))throw aK(aH['RELEASE_NOT_FOUND'],'GitHub\x20releases\x20request\x20failed:\x20'+gq['message'],{'source':gh,'provider':'github','apiMessage':gq[h5(0x1fe)]});let gr=Array['isArray'](gq)?gq:[],gs=aQ(gr,gg,gh);if(!gs)throw gg['isExplicitSelection']?aP(gg,gr,gh):aK(aH[h5(0x145)],'GitHub\x20release\x20not\x20found',{'source':gh,'provider':'github',...aO(gr)});let gt=gs['assets']?.['find'](gv=>gv[h5(0x144)]['endsWith']('.tgz')||gv['name']['endsWith']('.zip'));if(!gt)throw q[h5(0x113)](gs),aK(aH['ASSET_NOT_FOUND'],h5(0x171),{'source':gh,'provider':'github','releaseTag':aM(gs)});let gu=gt[h5(0x12a)];g6=await aS(gu);}else{if(!gb){let gv=g5?.['find'](gz=>gz[h5(0x144)]===gh),gw=gv?.['releases']||[],gx=aQ(gw,gg,gh),gy=gx?.['assets'][h5(0x17f)](gz=>gz['name']['endsWith']('.tgz'));if(gv&&!gx&&gg['isExplicitSelection'])throw aP(gg,gw,gh);if(gy)g6=await aS(gy['url'],gy['name']);else{let [gz,gA='streamyx-extensions']=gh['split']('/')['reverse'](),gB='https://gitlab.com/api/v4/projects/'+gA+'%2F'+gz+'/releases',gC=await fetch(gB)['then'](gG=>gG['json']());if(gC?.['message']&&!Array['isArray'](gC))throw aK(aH['RELEASE_NOT_FOUND'],'GitLab\x20releases\x20request\x20failed:\x20'+gC['message'],{'source':gh,'provider':'gitlab','apiMessage':gC['message']});let gD=Array['isArray'](gC)?gC:[],gE=aQ(gD,gg,gh);if(!gE)throw gg['isExplicitSelection']?aP(gg,gD,gh):aK(aH['RELEASE_NOT_FOUND'],'GitLab\x20release\x20not\x20found',{'source':gh,'provider':'gitlab',...aO(gD)});let gF=gE['assets']?.['links']?.['find'](gG=>gG[h5(0x144)]['endsWith']('.tgz'));if(!gF)throw aK(aH['ASSET_NOT_FOUND'],'GitLab\x20release\x20asset\x20not\x20found',{'source':gh,'provider':'gitlab','releaseTag':aM(gE)});g6=await aS(gF['direct_asset_url']||gF['url'],gF['name']);}}}}let gi=M['extname'](g6),gj=gi==='.zip',gk=gi==='.tgz',gl=new Set(['.js','.mjs','.cjs'])['has'](gi),gm=await Q['stat'](g6)[h5(0x119)](gG=>gG['isDirectory']())['catch'](()=>!0x1);if(gl?g7=M[h5(0x18b)](g6):gm?g7=g6:(g7=g6['replace']('.tgz','')['replace']('.zip',''),await az(g7)||await aC(g7)),gj||gk)aG[h5(0x12f)](g6,g7),await aB(g6);else{if(!(gl||gm))throw aK(aH['UNSUPPORTED_PACKAGE_TYPE'],'Unsupported\x20package\x20type',{'source':g4,'extensionSource':g6,'packageType':gi||'unknown'});}return g7;},aU='__matchRules',aV=g4=>typeof g4=='object'&&!!g4&&!Array['isArray'](g4),aW=g4=>{const h6=gP;if(Array[h6(0x191)](g4)){let g7=g4['filter'](g9=>typeof g9==h6(0x18f)&&g9['length']>0x0&&!g9[h6(0x1c1)]('-')),g8=g4['filter'](g9=>typeof g9=='string'&&g9['startsWith']('-'))['map'](g9=>g9['slice'](0x1))['filter'](Boolean);return!g7['length']&&!g8[h6(0x1fc)]?void 0x0:{'include':g7['length']?g7:void 0x0,'exclude':g8['length']?g8:void 0x0};}if(!aV(g4))return;let g5=Array['isArray'](g4[h6(0x24b)])?g4[h6(0x24b)][h6(0x14e)](g9=>typeof g9=='string'&&!!g9):void 0x0,g6=Array[h6(0x191)](g4['exclude'])?g4['exclude']['filter'](g9=>typeof g9=='string'&&!!g9):void 0x0;if(!(!g5?.['length']&&!g6?.['length']))return{'include':g5?.['length']?g5:void 0x0,'exclude':g6?.['length']?g6:void 0x0};},aX=g4=>{const h7=gP;let g5=g4['trim']()['match'](/^(\*|https?):\/\/([^/]+)(\/.*)$/i);if(!g5)return null;let [,g6,g7,g8]=g5,g9=g6['toLowerCase'](),ga=g9==='*'?[h7(0x267),'https']:g9==='http'||g9==='https'?[g9]:null;if(!ga)return null;let gb=g7['trim']()['toLowerCase'](),gc=!0x1,ge=[],gf=[];if(gb==='*')gc=!0x0;else{if(gb['startsWith']('*.')){let gi=gb['slice'](0x1);if(!gi[h7(0x1c1)]('.')||gi['length']<=0x1)return null;gf=[gi];}else{if(!gb['includes']('*'))ge=[gb];else return null;}}if(!g8[h7(0x1c1)]('/'))return null;let gg=g8['indexOf']('*');if(gg!==-0x1&&gg!==g8['length']-0x1)return null;let gh=gg===-0x1?g8:g8['slice'](0x0,-0x1);return{'schemes':ga,'matchAnyHost':gc,'exactHosts':ge,'wildcardHostSuffixes':gf,'exactPaths':gg===-0x1?[gh]:void 0x0,'pathPrefixes':gg===-0x1?void 0x0:[gh]};},aY=g4=>{if(!Array['isArray'](g4))return;let g5=g4['filter'](g6=>typeof g6=='string'&&!!g6['trim']())['map'](aX)['filter'](g6=>!!g6);return g5['length']?g5:void 0x0;},aZ=(g4,g5)=>g5['matchAnyHost']||g5['exactHosts'][gP(0x199)](g4)||g5[gP(0x1c7)]['some'](g6=>g4['endsWith'](g6)),b0=(g4,g5)=>g5['exactPaths']?.['includes'](g4)||!!g5['pathPrefixes']?.['some'](g6=>g4['startsWith'](g6))||!g5['exactPaths']?.['length']&&!g5['pathPrefixes']?.['length'],b1=({manifest:g4,packageJson:g5,fallbackName:g6})=>{const h8=gP;let g7=aV(g5?.['config'])?g5['config']:null,g8=(aV(g4)?g4:null)??g7??{},g9=typeof g8['displayName']=='string'&&g8['displayName']||typeof g8['name']=='string'&&g8['name']||typeof g8['title']=='string'&&g8['title']||g6,ga=typeof g8['shortName']=='string'&&g8['shortName']||typeof g8['tag']=='string'&&g8['tag']||void 0x0,gb={...g8,'displayName':g9,'shortName':ga,'name':g9,'title':typeof g8['title']=='string'&&g8['title']?g8['title']:g9,'tag':ga};(typeof gb['icon']!='string'||!gb[h8(0x269)])&&delete gb['icon'],(typeof gb['displayName']!='string'||!gb['displayName'])&&(gb['displayName']=g6),(typeof gb['shortName']!='string'||!gb['shortName'])&&delete gb['shortName'],(typeof gb['tag']!='string'||!gb['tag'])&&delete gb['tag'],Array['isArray'](gb['permissions'])||delete gb['permissions'],gb['regions']=aW(g8['regions']),typeof gb['manifestVersion']!='number'&&(gb['manifestVersion']=0x1),aV(gb['capabilities'])||delete gb['capabilities'],aV(gb['settings'])||delete gb['settings'],aV(gb['secrets'])||delete gb['secrets'];let gc=aY(g8['matches']);return gc?(gb['matches']=Array['isArray'](g8['matches'])?g8[h8(0x250)]['filter'](ge=>typeof ge=='string'):void 0x0,Object[h8(0x1c3)](gb,aU,{'value':gc,'enumerable':!0x1,'configurable':!0x1,'writable':!0x1})):delete gb['matches'],gb;},b2=async({dir:g4,packageJson:g5,fallbackName:g6})=>{let g7=join(g4,'manifest.json');return b1({'manifest':await az(g7)?await aE(g7):null,'packageJson':g5,'fallbackName':g6});},b3=g4=>g4['manifest']?.['displayName']||g4['manifest']?.['name']||g4['manifest']?.['title']||g4['package']?.['config']?.['title']||g4['package']?.['name']||g4['name']||'(unknown\x20extension)',b4=g4=>g4['manifest']?.['shortName']||g4['manifest']?.['tag']||g4['package']?.['config']?.['tag']||void 0x0,b5=(g4,g5)=>{let g6=g4['manifest']?.[aU];if(!Array['isArray'](g6)||!g6['length'])return!0x1;let g7=g5['protocol']['slice'](0x0,-0x1)['toLowerCase'](),g8=g5['hostname']['toLowerCase'](),g9=g5['pathname'];return g6['some'](ga=>!(ga['schemes']?.['length']&&!ga['schemes']['includes'](g7)||!aZ(g8,ga)||!b0(g9,ga)));},b6=g4=>{let g5=g4['manifest']?.[aU];return Array['isArray'](g5)&&g5['length']>0x0;},b7=g4=>g4['exports'],b8=g4=>{if(!g4)return;let g5=Object['fromEntries'](new Headers(g4)['entries']());return Object['keys'](g5)['length']?g5:void 0x0;},b9=(...g4)=>{let g5=Object['assign']({},...g4['map'](g6=>b8(g6)));return Object['keys'](g5)['length']?g5:void 0x0;},ba=async(g4,g5)=>{if(!g5)return g4;let g6=await g4['clone']()['arrayBuffer'](),g7=Buffer['from'](g6)['toString']('base64'),g8=g5['replace']('{{challenge}}',g7);return new Request(g4['url'],{'method':g4['method'],'headers':g4['headers'],'body':g8});},bb=async g4=>{const h9=gP;let g5=await g4['clone']()['arrayBuffer']();if(g5[0x0]===0x7b){let g6=null;try{g6=JSON['parse'](Buffer['from'](g5)['toString']('utf8'));}catch(g7){q['error']('Can\x27t\x20parse\x20license\x20response\x20as\x20JSON'),q['debug'](g7['message']),q['debug']('Base64\x20response\x20data:\x20'+Buffer['from'](g5)['toString']('base64'));}if(!g6)return g4;try{let g8='CAIS',g9=g8+Buffer['from'](g5)['toString']('utf8')['split']('\x22'+g8)[0x1]['split']('\x22')[0x0],ga=Buffer['from'](g9,'base64');return new Response(ga,{'status':g4[h9(0x23b)],'headers':g4[h9(0x164)]});}catch{q['error']('Can\x27t\x20recognize\x20license\x20response'),q['error']('Response:\x20'+JSON[h9(0x17c)](g6));}}return g4;},bc=g4=>({'url':g4['url'],'headers':g4['headers'],'http2':g4['http2'],'audioLanguage':g4[gP(0x16d)],'audioType':g4['audioType'],'subtitles':Array['isArray'](g4['subtitles'])?g4['subtitles']['filter'](g5=>!!g5&&typeof g5=='object'&&typeof g5['url']=='string')['map'](g5=>({...g5})):void 0x0}),bd=g4=>({'url':g4['url'],'headers':g4['headers']}),be=g4=>{const ha=gP;if(g4)return'server'in g4?{'kind':'server','server':g4['server'],'headers':g4['headers'],'template':g4[ha(0x213)],'http2':g4['http2']}:'payload'in g4?{'kind':'payload','payload':g4['payload']}:{'kind':'keys','keys':g4['keys']['map'](g5=>({...g5}))};},bf=g4=>{const hb=gP;let g5=g4['source']?bc(g4[hb(0x198)]):void 0x0,g6=g4['source']?.['drm']?be(g4['source']['drm']):void 0x0;return{'id':g4['id'],'type':'episodeNumber'in g4?'episode':'movie','title':g4['title'],'seasonNumber':g4['seasonNumber'],'episodeNumber':g4['episodeNumber'],'episodeTitle':g4['episodeTitle'],'source':g5?bd(g5):void 0x0,'context':g4['id']||g5||g6?{'legacy':{'contentId':g4['id'],'source':g5,'drm':g6}}:void 0x0};},bg=(g4,g5)=>{const hc=gP;let g6=new Input({'source':new UrlSource(g4['url'],{'requestInit':{'headers':g4['headers']},'fetchFn':g5['context']['http']['fetch']['bind'](g5['context']['http'])}),'formats':ALL_FORMATS});for(let g7 of g4['subtitles']??[])g6['addSubtitleTrack'](new UrlSource(g7['url']),{'name':g7[hc(0x15e)]||g7[hc(0x135)],'languageCode':g7['language'],'codec':g7[hc(0x1ea)],'disposition':{'default':g7['default'],'forced':g7['forced']}});return g6;},bh=async(g4,g5)=>{const hd=gP;if(!g5?.['trim']())return;let g6=await g4[hd(0x179)]({'filter':async g7=>{let g8=await g7['getLanguageCode']();return!g8||g8==='und';}});for(let g7 of g6)g7[hd(0x14f)](g5);},bi=async({entry:g4,extension:g5,options:g6})=>{const he=gP;let g7=g4['context']?.[he(0x201)];if(g7?.['source']?.[he(0x1a8)])return{'source':g7['source'],'drm':g7['drm']};let g8=g7?.['contentId']??g4['id'];if(!g8)return g4['source']?{'source':{'url':g4['source']['url'],'headers':g4['source']['headers']},'drm':g7?.['drm']}:null;let g9=await b7(g5)['fetchContentSource']?.(String(g8),g6);return g9?{'source':bc(g9),'drm':be(g9['drm'])}:null;},bj=async({entry:g4,extension:g5,options:g6})=>{const hf=gP;let g7=b7(g5),g8=g4['context']?.['legacy']?.['drm'];if(g8)return g8['kind']===hf(0x203)?be(await g7['fetchContentDrm']?.(g8['payload'],g6)):g8;},bk=g4=>({async 'requestLicense'({data:g5,options:g6,resource:g7}){const hg=gP;let g8=await bj({'entry':g7['entry'],'extension':g4,'options':g6});if(!g8||g8[hg(0x189)]!=='server')throw Error('Legacy\x20extension\x20did\x20not\x20provide\x20a\x20DRM\x20license\x20server');let g9=new Request(g8['server'],{'method':'POST','headers':b9(g8['headers'],g4['context']['http']['headers']),'body':Buffer['from'](g5)}),ga=await ba(g9,g8['template'])||g9,gb=await g4['context']['http']['fetch'](ga[hg(0x1a8)],{'body':await ga['arrayBuffer'](),'headers':ga['headers'],'method':ga['method']}),gc=await bb(gb)||gb;return new Uint8Array(await gc['arrayBuffer']());},async 'resolveKeys'({options:g5,resource:g6}){const hh=gP;let g7=await bj({'entry':g6['entry'],'extension':g4,'options':g5});return g7?.[hh(0x189)]==='keys'?g7['keys']:[];}}),bl=g4=>({async 'initialize'(){await b7(g4)['init']?.();},async 'getEntries'({url:g5,options:g6}){return(await b7(g4)['fetchContentMetadata']?.(g5,g6)??[])['map'](bf);},async 'resolveEntry'({entry:g5,options:g6}){const hi=gP;let g7=await bi({'entry':g5,'extension':g4,'options':g6});if(!g7?.['source']?.[hi(0x1a8)])throw Error('Legacy\x20extension\x20did\x20not\x20provide\x20a\x20media\x20source');let g8=g7['source'],g9=g7['drm']??g5['context']?.[hi(0x201)]?.['drm'],ga={...g5,'source':bd(g8),'context':{...g5['context'],'legacy':{...g5['context']?.['legacy'],'source':g8,'drm':g9}}},gb=bg(g8,g4);return await bh(gb,g8['audioLanguage']),{'entry':ga,'input':gb};},'drm':bk(g4)}),bm=g4=>g4&&'exports'in g4?g4['exports']:g4,bn=g4=>g4?.['package']?.['name']||'(unknown\x20extension)',bo=g4=>{const hj=gP;let g5=bm(g4);return!g5||typeof g5!='object'?null:hj(0x19e)in g5&&typeof g5['getEntries']==hj(0x1f9)?'v2':'fetchContentMetadata'in g5&&typeof g5['fetchContentMetadata']=='function'?'legacy-content':null;},bp=g4=>bo(g4)!==null,bq=g4=>{let g5=bm(g4);if(!g5||typeof g5!='object')throw Error('Invalid\x20extension\x20exports');return g5;},br=g4=>{const hk=gP;let g5=bq(g4),g6=bo(g5);if(g6==='v2')return g5;if(g6==='legacy-content')return bl(g4);throw Error('Unsupported\x20extension\x20interface:\x20'+g4[hk(0x241)][hk(0x144)]);},bs=async g4=>{let g5=bq(g4),g6=bn(g4),g7=bo(g5);try{if(g7==='v2'&&typeof g5['initialize']=='function'){await g5['initialize']?.();return;}g7==='legacy-content'&&typeof g5['init']=='function'&&await g5['init']?.();}catch(g8){let g9=g7==='v2'?'initialize':'init',ga=g8 instanceof Error?g8:Error(String(g8));throw q['error']('Extension\x20'+g6+'\x20'+g9+'\x20failed:\x20'+ga['message']),ga['stack']&&q['debug'](ga['stack']),ga;}},bt=g4=>g4['username']||g4['password']||g4['otp']?{'method':'password','username':g4['username']??'','password':g4['password']??'','otp':g4['otp']}:{'method':'interactive'},bu=async(g4,g5)=>{const hl=gP;let g6=bq(g4),g7=bn(g4);try{if(typeof g6['auth']?.['login']=='function'){await g6['auth']?.['login']?.(bt(g5));return;}typeof g6['login']=='function'&&await g6['login']?.(g5);}catch(g8){let g9=typeof g6['auth']?.['login']=='function'?'auth.login':'login',ga=g8 instanceof Error?g8:Error(String(g8));throw q['error']('Extension\x20'+g7+'\x20'+g9+hl(0x10f)+ga['message']),ga['stack']&&q['debug'](ga['stack']),ga;}},bv=async g4=>{const hm=gP;let g5=bq(g4),g6=bn(g4);try{if(typeof g5['auth']?.['logout']=='function'){await g5['auth']?.[hm(0x148)]?.();return;}typeof g5['logout']=='function'&&await g5['logout']?.();}catch(g7){let g8=typeof g5['auth']?.['logout']=='function'?hm(0x24a):hm(0x148),g9=g7 instanceof Error?g7:Error(String(g7));throw q['error']('Extension\x20'+g6+'\x20'+g8+'\x20failed:\x20'+g9[hm(0x1fe)]),g9['stack']&&q['debug'](g9['stack']),g9;}},bw=({url:g4,options:g5,resource:g6,signal:g7})=>({'url':g4,'options':g5,'resource':g6,'signal':g7}),bx=async(g4,g5)=>{const hn=gP;let g6=bq(g4);if(bo(g6)!=='v2')return;let g7=g6;typeof g7['hooks']?.[hn(0x1ce)]=='function'&&await g7['hooks']['beforeDownload'](bw(g5));},by=async(g4,g5)=>{const ho=gP;let g6=bq(g4),g7=bn(g4),g8=bo(g6);if(!g5['skipMux']&&g8==='v2'&&typeof g6['hooks']?.['afterMux']=='function')try{await g6['hooks']?.['afterMux']?.(bw(g5));}catch(g9){let ga=g9 instanceof Error?g9:Error(String(g9));q['error']('Extension\x20'+g7+'\x20hooks.afterMux\x20failed:\x20'+ga['message']),ga['stack']&&q['debug'](ga['stack']);}if(g8==='legacy-content'&&typeof g6['onDownloadFinished']=='function')try{await g6[ho(0x20d)]?.();}catch(gb){let gc=gb instanceof Error?gb:Error(String(gb));q['error']('Extension\x20'+g7+'\x20onDownloadFinished\x20failed:\x20'+gc[ho(0x1fe)]),gc['stack']&&q['debug'](gc[ho(0x138)]);}},bz=async(g4,{context:g5,dirname:g6,skipValidation:g7})=>{const hp=gP;let g8=await y(g4,{'dirname':g6,'context':g5})[hp(0x132)](()=>{});if(!g8)return null;let g9='default'in g8['exports']?g8['exports'][hp(0x1bf)]:g8['exports'];if(!g7&&!bp(g9))throw q[hp(0x15d)]('Incompatible\x20extension\x20interface'),aK(aH['IMPORT_INVALID'],'Incompatible\x20extension\x20interface',{'extensionPath':g4});return g8[hp(0x170)]=g9,g8;},bA=g4=>g4['split']('/')['reverse']()[0x0]['replaceAll']('@','')['replace']('extension-','')['replace']('-extension',''),bB=async g4=>{const hq=gP;let g5=[join(g4,'package.json'),join(g4,'package',hq(0x1c4))],g6;for(let gf of g5)if(await az(gf)){g6=gf;break;}let g7={},g8='',g9='',ga='',gb=g4;if(g6){gb=dirname(g6),g7=await aE(g6)||{};let gg=g7[hq(0x165)]||'index.js';g8=join(gb,gg),g9=g7['name'],ga=gb;}else{let gh=await aA(g4),gi=gh['find'](gj=>gj['name']==='index.js')||gh['find'](gj=>gj['name']==='main.js')||gh['find'](gj=>gj['name']==='service.js')||gh['find'](gj=>gj['name']==='extension.js')||gh['find'](gj=>gj['name']['endsWith']('.js'));gi&&(g8=join(g4,gi['name']),g9=parse(g8)['name']);}if(!g8)throw aK(aH['IMPORT_INVALID'],'Extension\x20main\x20script\x20not\x20found:\x20'+g4,{'dir':g4});ga||=dirname(g8);let gc=bA(g9),ge=await b2({'dir':gb,'packageJson':g7,'fallbackName':gc});return{'name':gc,'path':g8,'dir':ga,'package':g7,'manifest':ge};},bC=async(g4,g5)=>{const hr=gP;try{let g6=await bB(g4),g7=b3(g6),g8=E({'name':g6['name'],'title':g7,'dir':G});await g8[hr(0x1f8)]['import'](join(G,g6['name'],'cookies.txt'));let g9=await bz(g6['path'],{'context':g8,'dirname':g6['dir']});if(!g9)throw aK(aH['IMPORT_INVALID'],hr(0x153)+g6['path'],{'source':g5,'dir':g4,'path':g6['path']});return{'source':g5,'exports':g9['exports'],'context':g8,...g6};}catch(ga){throw q['error']('Error\x20importing\x20module:\x20'+ga['message']),q['debug'](ga instanceof Error?ga['stack']||ga['message']:String(ga)),ga;}},bD=g;let bE=bD;const bF=g4=>g4[gP(0x1cd)](/\/+$/,''),bG=()=>bF(bE),bH=(g4,g5)=>{let g6=bF(g4);return g5?g6+'/'+(g5['startsWith']('/')?g5['slice'](0x1):g5):g6;},bI=g4=>bH(bG(),g4);let bJ=null;async function bK(g4){const hs=gP;if(!bJ){q[hs(0x113)]('Public\x20key\x20not\x20found');let gb=await bM();if(gb)q['debug']('Public\x20key\x20found:\x20'+gb['slice'](0x0,0x32)+'...');else return q['error']('Public\x20key\x20not\x20found\x20in\x20response'),!0x1;if(bJ=await bN(gb)[hs(0x223)](()=>null),!bJ)return q['error']('Public\x20key\x20import\x20failed'),!0x1;}let g5=g4['headers']['get']('X-Signature-Timestamp'),g6=g4[hs(0x164)]['get']('X-Signature');if(!g5||!g6)return q['error']('Signature\x20headers\x20not\x20found'),!0x1;if(Date['now']()-parseInt(g5)>0x493e0)return!0x1;let g7=g5+':'+await g4[hs(0x1b1)]()[hs(0x1f0)](),g8=bO(g6),g9=new TextEncoder(),ga=crypto['subtle']['verify']({'name':'ECDSA','hash':'SHA-256'},bJ,g8,g9['encode'](g7));return ga||(bJ=null),ga;}const bL=()=>atob(f);async function bM(g4='/auth/.well-known/public-key'){try{let g5=await fetch(''+bG()+g4);return g5['ok']?await g5['text']():bL();}catch(g6){return q['error'](g6['message']),bL();}}async function bN(g4){let g5=bO(g4['replace']('-----BEGIN\x20PUBLIC\x20KEY-----','')['replace']('-----END\x20PUBLIC\x20KEY-----','')['trim']());return crypto['subtle']['importKey']('spki',g5,{'name':'ECDSA','namedCurve':'P-256'},!0x0,['verify']);}function bO(g4){const ht=gP;let g5=atob(g4),g6=new Uint8Array(g5['length']);for(let g7=0x0;g7<g5[ht(0x1fc)];g7++)g6[g7]=g5[ht(0x155)](g7);return g6['buffer'];}const bP=g4=>createAuthClient({'baseURL':g4+'/auth','plugins':[deviceAuthorizationClient(),tributeClient()],'fetchOptions':{'retry':0x0,'onSuccess':g5=>{let g6=g5['response']['headers']['get']('set-auth-token');g6&&(c1['accessToken']=g6,c2(c1));},'auth':{'type':'Bearer','token':()=>c1['accessToken']||c3()['then'](g5=>g5?.['accessToken'])},'onResponse':async g5=>await bK(g5['response'])['catch'](()=>!0x1)?(q['debug']('Response\x20verified:\x20'+g5['response']['url']),g5):(q['error']('Response\x20verification\x20failed:\x20'+g5['response']['status']+'\x20'+g5['response']['statusText']+'\x20'+g5['response']['url']),w[gP(0x23e)]('error',{'code':'SIGNATURE_VERIFICATION_FAILED'}),new Response(JSON['stringify']({'error':'SIGNATURE_VERIFICATION_FAILED','message':'Signature\x20verification\x20failed'}),{'status':0x191,'statusText':'Unauthorized'}))}});let bQ='',bR=bP(bG());const bS=()=>{let g4=bG();return(!bR||bQ!==g4)&&(bQ=g4,bR=bP(g4)),bR;},bT=async(g4,g5,g6={})=>{let {signal:g7,timeoutMs:g8=0x2710}=g6,g9=new AbortController(),ga=()=>g9['abort'](g7?.['reason']);g7?.['addEventListener']('abort',ga,{'once':!0x0});let gb=!0x1,gc=setTimeout(()=>{gb=!0x0,g9['abort'](Error('Request\x20timeout'));},g8);try{let ge=await fetch(g4,{...g5,'signal':g9['signal']});if(!ge['ok'])throw Error('Request\x20failed:\x20'+ge['status']);return ge['json']();}catch(gf){throw gb&&gf instanceof DOMException&&gf['name']==='AbortError'?Error('Request\x20timed\x20out\x20after\x20'+g8+'ms',{'cause':gf}):gf;}finally{clearTimeout(gc),g7?.['removeEventListener']('abort',ga);}},bU={'getExtensions':(g4,g5)=>bT(bI('extensions'),{'headers':g4?{'Authorization':'Bearer\x20'+g4}:void 0x0},{'signal':g5}),'getSubscriptions':(g4,g5)=>bT(bI('subscriptions'),{'headers':{'Authorization':'Bearer\x20'+g4}},{'signal':g5})},bV=0x12c*0x3e8,bW=0x12c*0x3e8,bX=new QueryClient({'queryCache':new QueryCache(),'defaultOptions':{'queries':{'staleTime':bV,'gcTime':bW}}}),bY={'get':g4=>bX['getQueryData'](g4),'set':(g4,g5)=>bX['setQueryData'](g4,g5),'reset':g4=>{g4?bX['removeQueries']({'queryKey':g4}):bX['clear']();},'invalidate':g4=>bX['invalidateQueries']({'queryKey':g4}),'refresh':async(g4,g5)=>(bX['invalidateQueries']({'queryKey':g4}),bZ({'queryKey':g4,'queryFn':g5}))},bZ=async({queryKey:g4,queryFn:g5,staleTime:g6,enabled:g7=!0x0})=>{const hu=gP;try{let g8=bX[hu(0x1a4)](g4),g9=g8?g8?.['isInvalidated']||!g8?.['dataUpdatedAt']&&!g8?.['errorUpdatedAt']||Date['now']()-g8['dataUpdatedAt']>(g6??bV):!0x0,ga=()=>bY[hu(0x1eb)](g4),gb=()=>bY['invalidate'](g4),gc=()=>bY['refresh'](g4,g5);return g7?g8&&!g9?{'data':g8['data'],'reset':ga,'invalidate':gb,'refresh':gc}:{'data':await bX['fetchQuery']({'queryKey':g4,'queryFn':g5,'staleTime':g6}),'reset':ga,'invalidate':gb,'refresh':gc}:{'data':null,'reset':ga,'invalidate':gb,'refresh':gc};}catch(ge){throw bX[hu(0x261)]({'queryKey':g4}),ge;}},c0=new D(join(x,'session.json')),c1={'accessToken':'','tokenType':'','scope':'','createdAt':''},c2=async g4=>{const hv=gP;c0['setItem']('access_token',g4['access_token']),c0['setItem']('token_type',g4['token_type']||'Bearer'),c0[hv(0x26b)]('scope',g4['scope']),c0['setItem']('created_at',new Date()['toISOString']()),c1['accessToken']=g4['access_token'],c1[hv(0x235)]=g4['token_type']||'Bearer',c1['scope']=g4['scope'],c1[hv(0x1b9)]=new Date()['toISOString']();},c3=async()=>{let g4=c0['getItem']('access_token'),g5=c0['getItem']('token_type'),g6=c0['getItem']('scope'),g7=c0['getItem']('created_at');return!g4||!g5||!g6||!g7?null:{'accessToken':g4,'tokenType':g5,'scope':g6,'createdAt':new Date(g7)};},c4=async()=>{let g4=await bZ({'queryKey':['session',bG()],'queryFn':()=>bS()['getSession']()});return{'session':g4['data']?.['data']?.['session'],'user':g4['data']?.['data']?.['user'],'error':g4['data']?.['error']};},c5=async()=>{let {user:g4,error:g5}=await c4(),g6=await bZ({'queryKey':['subscriptions',bG()],'queryFn':async()=>bS()['subscription']['list'](),'enabled':!!g4?.['id']});return{'data':g6['data']?.['data'],'error':g6['data']?.['error']??g5};},c6=['lowConnectionsCount','oneDevice'],c7=['mediumConnectionsCount','twoDevices','proxy','decryption','customIcon','tags','parallelDownloads','userExtensions','portableBuild'],c8=['highConnectionsCount','threeDevices',gP(0x1f5),'customDecrypter',gP(0x1a9),'premiumExtensions'],c9={'basic':c6,'plus':c7,'pro':[...c6,...c7,...c8]},ca=()=>bZ({'queryKey':['lava-subscriptions',bG()],'queryFn':async()=>{const hw=gP;let g4=c1['accessToken']||(await c3())?.[hw(0x17e)];return g4?bU['getSubscriptions'](g4):[];}}),cb=async()=>{let g4=await c5();return{'plan':(await ca())['data']?.[0x0]?.['productTitle']||g4['data']?.['find'](g5=>new Date(g5['expiresAt'])>new Date())?.['tributeSubscriptionName'],'error':g4['error']};},cc=async()=>{const hx=gP;let {user:g4,session:g5}=await c4(),{plan:g6,error:g7}=await cb();return{'user':g4,'session':g5,'error':g7,'plan':g6,'grantedBenefits':g6?c9[g6[hx(0x212)]()]??[]:[]};};var cd=a5((g4,g5)=>{const hE=gP;g5['exports']={'instagram':{'create':g6=>{const hD=b;let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const hy=b;let gj=g8??Streamyx??{};gj&&(gj['defineExtension']||=gq=>gq);let gk=gj['defineExtension'];gj['version'],gj['sleep'],gj['input'],gj['prompt'],gj[hy(0x1f7)],gj['confirm'],gj[hy(0x1d0)],gj['utils'],gj['Input'],gj['UrlSource'],gj['ALL_FORMATS'],gj['DASH'],gj[hy(0x249)],gj['HLS'],gj['HLS_FORMATS'],gj['MP4'],gj[hy(0x253)];let gl={'Referer':'https://www.instagram.com/'},gm={'X-IG-App-ID':'936619743392459','User-Agent':'Mozilla/5.0\x20(Windows\x20NT\x2010.0;\x20Win64;\x20x64)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/107.0.0.0\x20Safari/537.36'},gn=async gq=>{const hz=hy;let gr=new URLSearchParams({'doc_id':'8845758582119845','variables':JSON['stringify']({'shortcode':gq,'child_comment_count':0x3,'fetch_comment_count':0x28,'parent_comment_count':0x18,'has_threaded_comments':!0x0})});try{let gs=await g9('https://www.instagram.com/graphql/query/?'+gr[hz(0x200)](),{'headers':gm});return gs['ok']?(await gs['json']())['data']?.['xdt_shortcode_media']??null:(gc['error']('GraphQL\x20request\x20failed\x20with\x20status:\x20'+gs['status']),null);}catch(gt){return gc['error']('Error\x20during\x20GraphQL\x20fetch:',gt),null;}},go=async gq=>{const hA=hy;try{let gr=await g9('https://www.instagram.com/p/'+gq+'/embed/captioned/',{'headers':{'User-Agent':gm['User-Agent']}});if(!gr['ok'])return null;let gs=(await gr['text']())[hA(0x158)](/window\.__additionalDataLoaded\('extra',\s*({.+?})\s*\);/);return gs?.[0x1]?JSON['parse'](gs[0x1])['shortcode_media']??null:null;}catch(gt){return gc['error']('Error\x20during\x20embed\x20page\x20fetch:',gt),null;}},gp=gq=>{let gr=gq['edge_media_to_caption']?.['edges']?.[0x0]?.['node']?.['text']||'Instagram\x20Post',gs=[],gt=gv=>{const hB=b;if(!gv)return;let gw=gv['is_video']&&gv['video_url']?gv[hB(0x1f1)]:gv[hB(0x131)];gw&&gs['push']({'title':gr,'source':{'url':gw,'headers':gl}});},gu=gq['edge_sidecar_to_children']?.['edges'];if(gu?.['length']){for(let gv of gu)gt(gv['node']);}else gt(gq);return gs;};g7['exports']=gk({async 'getEntries'({url:gq}){const hC=hy;let gr=new URLPattern({'pathname':'/:type(p|reel|tv|reels|videos)/:shortcode{/*}?','baseURL':new URL(gq)['origin']})['exec'](gq)?.['pathname']['groups']['shortcode'];if(!gr)return gc['error']('Could\x20not\x20extract\x20a\x20valid\x20Instagram\x20shortcode\x20from\x20the\x20URL'),gc[hC(0x113)](gq),[];try{let gs=await gn(gr);return gs||=(gc['warn']('GraphQL\x20method\x20failed.\x20Falling\x20back\x20to\x20embed\x20page\x20scraping.'),await go(gr)),gs?gp(gs):(gc['error']('All\x20extraction\x20methods\x20failed.\x20The\x20post\x20may\x20be\x20private,\x20deleted,\x20or\x20require\x20a\x20login.'),[]);}catch(gt){return gc['error']('A\x20critical\x20error\x20occurred\x20while\x20fetching\x20Instagram\x20metadata:',gt),[];}}});})(g6['Azot'],g6[hD(0x156)],g6['localStorage'],g6['cookieStore'],g6['console'],g6[hD(0x274)],g6['alert'],g6['document'],g6['navigator'],g6['window']),g7['exports']['default']||g7['exports'];},'manifest':{'manifestVersion':0x1,'name':'Instagram','icon':'https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/41/91/13/419113d2-6246-c557-669e-0f0a5c62bcc5/Prod-0-0-1x_U007epad-0-1-0-sRGB-85-220.png/460x0w.webp','matches':['https://instagram.com/*','https://*.instagram.com/*']},'pkg':{'name':'instagram','version':'0.0.1','private':!0x0,'keywords':['social-networks'],'homepage':'https://instagram.com/','author':{'name':'Azot','url':hE(0x117)},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'instagram.ts'}},'ntv':{'create':g6=>{const hJ=hE;let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const hF=b;let gj=g8??Streamyx??{};gj&&(gj['defineExtension']||=gs=>gs);let gk=gj['defineExtension'];gj['version'],gj['sleep'],gj['input'],gj['prompt'],gj['notify'],gj['confirm'],gj['ask'],gj['utils'];let gl=gj['Input'],gm=gj[hF(0x251)];gj['ALL_FORMATS'],gj['DASH'],gj['DASH_FORMATS'],gj['HLS'],gj['HLS_FORMATS'],gj['MP4'],gj['MP3'];let gn=(gs,gt,gu)=>gs['split'](gt)[0x1]?.['split'](gu)[0x0],go=(gs,gt)=>{const hG=hF;let gu=gn(gs,'<'+gt+'>','</'+gt+'>')?.['trim']();if(!gu)return;let gv=gu['match'](/<!\[CDATA\[(.*?)\]\]>/s);return gv?.[0x1]?gv[0x1][hG(0x124)]():gu[hG(0x246)]('DATA[')[0x1]?.['split'](']')[0x0]?.['trim']()||gu;},gp=async(gs,gt)=>{let gu=await g9(gs);return gu['ok']?await gu['text']():(gc['error']('Failed\x20to\x20fetch\x20'+gt+'.\x20Status:\x20'+gu['status']+'\x20'+gu['statusText']),null);},gq=async(gs,gt,gu)=>{const hH=hF;let gv=new URL(gs)['pathname'],gw=new Set();for(let gy of gt['split']('href=\x22/serial')){if(!gy['startsWith']('/'))continue;let gz=gy['split']('\x22')[0x0];!gz||gz['length']<=0x1||gz['includes']('/issues/')||gz['includes'](hH(0x20c))||gz['split']('/')['length']<=0x2||gw['add'](gs['replace'](gv,'/serial'+gz));}let gx=[];for(let gA of gw)gx['push'](...await gr(gA,gu));return gx;},gr=async(gs,gt=new Set())=>{const hI=hF;if(gt['has'](gs))return[];gt['add'](gs);let gu=await gp(gs,'NTV\x20page');if(!gu)return[];let gv=gn(gu,'<meta\x20property=\x22ya:ovs:feed_url\x22\x20content=\x22','\x22>')??gn(gu,hI(0x210),'\x22\x20/>');if(!gv)return new URL(gs)['pathname']['includes']('/serial')?gq(gs,gu,gt):(gc['error']('Could\x20not\x20find\x20video\x20link\x20in\x20the\x20page.'),[]);let gw=gv[hI(0x246)]('video/')[0x1]?.['split']('/')[0x0];if(!gw)return gc['error']('Could\x20not\x20parse\x20NTV\x20video\x20id.'),[];let gx=await gp('https://www.ntv.ru/vi'+gw+'/','NTV\x20XML\x20metadata');if(!gx)return[];let gy=go(gx,'dash')||go(gx,'hls'),gz=go(gx,'file')||go(gx,'video'),gA=go(gx,'hifile')||go(gx,'hd_video')||gy||gz;if(!gA)return gc['error']('Could\x20not\x20resolve\x20NTV\x20media\x20URL.'),[];let gB=gn(gx,'<embed_tag>','</embed_tag>')||'NTV',gC=gn(gu,'\x22name\x22:\x22','\x22'),gD=gC?.['includes']('серия')?gC['split']('-')[0x0]:void 0x0,gE=gD?parseInt(gD,0xa):void 0x0,gF=gn(gx,'<subtitles>','</subtitles>'),gG=gF?'https://www.ntv.ru'+gF:void 0x0;return gG&&gc[hI(0x113)](hI(0x1d8)+gG),[{'type':gE?'episode':'video','title':gB,'seasonNumber':gE?0x1:void 0x0,'episodeNumber':gE,'source':{'url':gA},'context':gG?{'subtitles':[{'url':gG,'language':'ru','label':'Russian'}]}:void 0x0}];};g7['exports']=gk({'getEntries'({url:gs}){return gr(gs,new Set());},'resolveEntry'({entry:gs}){if(!gs['source']?.['url'])throw Error('NTV\x20entry\x20is\x20missing\x20source\x20URL');let gt=new gl({'source':new gm(gs['source']['url'])}),gu=gs['context']?.['subtitles']??[];for(let gv of gu)gt['addSubtitleTrack'](new gm(gv['url']),{'languageCode':gv['language'],'name':gv['label']});return{'entry':gs,'input':gt};}});})(g6['Azot'],g6['fetch'],g6['localStorage'],g6['cookieStore'],g6['console'],g6['prompt'],g6['alert'],g6[hJ(0x15f)],g6['navigator'],g6['window']),g7['exports'][hJ(0x1bf)]||g7['exports'];},'manifest':{'manifestVersion':0x1,'name':'НТВ','icon':'https://static.ntv.ru/static/images/logo.png','matches':['https://ntv.ru/*','https://*.ntv.ru/*']},'pkg':{'name':'ntv','version':'0.0.9','private':!0x0,'keywords':[hE(0x188)],'homepage':'https://www.ntv.ru/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'ntv.ts'}},'rbc':{'create':g6=>{const hM=hE;let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const hK=b;let gj=g8??Streamyx??{};gj&&(gj['defineExtension']||=gl=>gl);let gk=gj['defineExtension'];gj['version'],gj['sleep'],gj['input'],gj['prompt'],gj['notify'],gj['confirm'],gj['ask'],gj['utils'],gj['Input'],gj['UrlSource'],gj['ALL_FORMATS'],gj['DASH'],gj['DASH_FORMATS'],gj['HLS'],gj['HLS_FORMATS'],gj['MP4'],gj[hK(0x253)],g7['exports']=gk({async 'getEntries'({url:gl}){const hL=hK;let gm=await g9(gl);if(!gm['ok'])throw Error('Failed\x20to\x20fetch\x20RBC\x20page:\x20'+gm['status']+'\x20'+gm['statusText']);let gn=(await gm['text']())['match'](/(?:https?:)?\/\/[^\s"'<>]+\.m3u8(?:\?[^\s"'<>]*)?/i)?.[0x0];if(!gn)throw Error(hL(0x20a));return[{'type':'video','source':{'url':gn['startsWith']('//')?'https:'+gn:gn}}];}});})(g6[hM(0x205)],g6['fetch'],g6['localStorage'],g6['cookieStore'],g6['console'],g6['prompt'],g6['alert'],g6['document'],g6['navigator'],g6['window']),g7['exports']['default']||g7['exports'];},'manifest':{'manifestVersion':0x1,'name':'РБК','icon':'https://static.rustore.ru/imgproxy/A-G-s2Q1x2iqq3qHCAo66-nllrtlqEr7XNU_JKXt4mQ/preset:web_app_icon_160/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS80MGViMWY3MS1kMDkzLTQ2NDMtOTkyNi0xZWM0ZjkwNzViMTQ=.webp','matches':['https://rbc.ru/*',hE(0x1d7)]},'pkg':{'name':'rbc','version':'0.0.2','private':!0x0,'keywords':['news'],'homepage':hE(0x10e),'author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'rbc.ts'}},'rutube':{'create':g6=>{let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const hN=b;let gj=g8??Streamyx??{};gj&&(gj['defineExtension']||=go=>go);let gk=gj['defineExtension'];gj['version'],gj['sleep'],gj['input'],gj['prompt'],gj['notify'],gj['confirm'],gj['ask'],gj['utils'],gj['Input'],gj['UrlSource'],gj['ALL_FORMATS'],gj[hN(0x1af)],gj['DASH_FORMATS'],gj['HLS'],gj['HLS_FORMATS'],gj['MP4'],gj['MP3'];let gl=['/video/:id{/}?','/play/embed/:id{/}?','/shorts/:id{/}?','/yappy/:yappyId{/}?','/video/private/:id{/}?'],gm=go=>{const hO=hN;let gp={'yappyId':'','id':'','key':''};gp['key']=new URL(go)['searchParams']['get']('p')??'';for(let gq of gl){let gr=new URLPattern(gq,hO(0x23c))['exec'](go);gr&&(Object['assign'](gp,gr['pathname']['groups']),Object['assign'](gp,gr['search']['groups']));}return gp;},gn=async go=>{const hP=hN;let gp=(await g9('https://rutube.ru/pangolin/api/web/yappy/yappypage/?client=wdp&videoId='+go+'&page=1&page_size=15')['then'](gq=>gq['json']())['catch'](()=>null))?.['results']?.['find'](gq=>String(gq['id'])===go)?.['link'];return gp?[{'type':hP(0x21d),'title':'rutube_yappy_'+go,'source':{'url':gp}}]:(gc[hP(0x15d)]('ErrorEmptyDownload'),[]);};g7['exports']=gk({async 'getEntries'({url:go}){const hQ=hN;let gp=gm(go);if(gp[hQ(0x21c)])return gn(gp['yappyId']);if(!gp['id'])return gc['error']('Could\x20not\x20extract\x20Rutube\x20video\x20id'),[];let gq=new URL('https://rutube.ru/api/play/options/'+gp['id']+'/?no_404=true&referer&pver=v2');gp['key']&&gq['searchParams'][hQ(0x20f)]('p',gp['key']);let gr=await g9(gq)[hQ(0x119)](gs=>gs['json']())[hQ(0x223)](gs=>(gs instanceof Error&&gc['debug'](gs['message']),null));return gr?gr['detail']||!gr['video_balancer']?.['m3u8']?(gc['error']('Play\x20info\x20is\x20empty'),[]):gr['live_streams']?.['hls']?(gc['error']('Live\x20videos\x20are\x20not\x20supported'),[]):[{'type':'video','title':gr['title']?.['trim']()||hQ(0x1e2)+gp['id'],'source':{'url':gr['video_balancer']['m3u8']}}]:(gc['error']('Cannot\x20fetch\x20play\x20info'),[]);}});})(g6['Azot'],g6['fetch'],g6['localStorage'],g6['cookieStore'],g6['console'],g6['prompt'],g6['alert'],g6['document'],g6['navigator'],g6['window']),g7['exports']['default']||g7['exports'];},'manifest':{'manifestVersion':0x1,'name':'RUTUBE','icon':'https://static.rustore.ru/imgproxy/vcyBc0LG-3ybXcGs_-_OJXH9ULjoegHlLs-DacemG08/preset:app_card_icon/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS9hcGsvMjQ2MjA3L2NvbnRlbnQvSUNPTi9hNTZhZWJlMy01NjVhLTRiZjYtOTQyZC0xZjE0OTk0YjlhNmUucG5n.webp','matches':['https://rutube.ru/*','https://*.rutube.ru/*']},'pkg':{'name':hE(0x268),'version':'0.0.13','private':!0x0,'keywords':['video-hostings'],'homepage':'https://rutube.ru/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':hE(0x21b),'url':'https://github.com/vitalygashkov'}],'type':'module','main':'rutube.ts'}},'soundcloud':{'create':g6=>{const hV=hE;let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const hR=b;let gj=g8??Streamyx??{};gj&&(gj['defineExtension']||=gp=>gp);let gk=gj[hR(0x20e)];gj['version'],gj['sleep'],gj[hR(0x12d)],gj['prompt'],gj['notify'],gj['confirm'],gj['ask'];let gl=gj['utils'];gj['Input'],gj['UrlSource'],gj['ALL_FORMATS'],gj['DASH'],gj['DASH_FORMATS'],gj['HLS'],gj['HLS_FORMATS'],gj['MP4'],gj['MP3'];let gm={'version':'','id':''},gn=async()=>{const hS=hR;try{let gp=await g9('https://soundcloud.com/')['then'](gs=>gs['text']())['catch'](gs=>{let gt=gs instanceof Error&&gs['cause']!=null?String(gs['cause']):'';return gs instanceof Error&>['includes']('ECONNRESET')&&gc['warn']('Soundcloud\x20may\x20be\x20blocked\x20in\x20your\x20region.\x20Use\x20proxy\x20or\x20VPN\x20to\x20bypass\x20restrictions.'),'';}),gq=gp['match'](/window\.__sc_version="([0-9]{10})"/)?.[0x1];if(gq&&gm[hS(0x1dc)]===gq)return gm['id'];let gr='';for(let gs of gp['matchAll'](/<script.+src="(.+)">/g)){let gt=gs[0x1];if(!gt?.['startsWith']('https://a-v2.sndcdn.com/'))continue;let gu=(await g9(gt)['then'](gv=>gv['text']())['catch'](()=>''))['match'](/\("client_id=[A-Za-z0-9]{32}"\)/)?.[0x0]['match'](/[A-Za-z0-9]{32}/)?.[0x0];if(gu){gr=gu;break;}}return gq&&(gm['version']=gq,gm['id']=gr),gr;}catch{return'';}},go=gp=>gp['audioCodecs']?.['some'](gq=>gq==='aac'||gq==='mp3')??!0x1;g7['exports']=gk({async 'getEntries'({url:gp,options:gq}){const hT=hR;let {author:gr,song:gs,accessKey:gt,shortLink:gu}=gl['execUrlPatterns'](gp,[':author/:song/s-:accessKey',':author/:song',':shortLink'],['https://soundcloud.com','https://on.soundcloud.com'])['pathname'],gv=await gn();if(!gv)throw Error(hT(0x1cc));let gw;if(new URL(gp)['hostname']==='on.soundcloud.com'&&gu&&(gw=await g9('https://on.soundcloud.com/'+gu+'/',{'redirect':'manual'})['then'](gD=>{const hU=hT;let gE=gD[hU(0x164)]['get']('location');if(gD[hU(0x23b)]===0x12e&&gE?.['startsWith']('https://soundcloud.com/'))return gE['split']('?',0x1)[0x0];})['catch'](()=>void 0x0)),!gw&&gr&&gs&&(gw='https://soundcloud.com/'+gr+'/'+gs+(gt?'/s-'+gt:'')),!gw)throw Error('Could\x20not\x20fetch');let gx=await g9('https://api-v2.soundcloud.com/resolve?url='+gw+'&client_id='+gv)['then'](gD=>gD['status']===0xc8?gD['json']():null)['catch'](()=>null);if(!gx)throw Error('Could\x20not\x20fetch');let gy=gx['media']?.['transcodings'];if(!gy?.['length'])throw Error('Empty\x20download');let gz=gy['find'](gD=>gD['preset']==='opus_0_0'),gA=gy['find'](gD=>gD['preset']===hT(0x211));if(gA&&(go(gq)||!gz)&&(gz=gA),!gz)throw Error('Empty\x20download');let gB=''+gz['url']+(gz['url']['includes']('?')?'&':'?')+'client_id='+gv+'&track_authorization='+gx['track_authorization'];if(!gB['startsWith']('https://api-v2.soundcloud.com/media/soundcloud:tracks:'))throw Error('Empty\x20download');let gC=await g9(gB)['then'](async gD=>(await gD['json']())['url']??'')['catch'](()=>'');if(!gC)throw Error('Could\x20not\x20fetch');return[{'type':'audio','title':gx['title']['trim'](),'author':gx[hT(0x23a)]['username']['trim'](),'source':{'url':gC}}];}});})(g6[hV(0x205)],g6[hV(0x156)],g6['localStorage'],g6[hV(0x1f8)],g6['console'],g6['prompt'],g6['alert'],g6['document'],g6['navigator'],g6['window']),g7['exports']['default']||g7[hV(0x170)];},'manifest':{'manifestVersion':0x1,'name':hE(0x216),'icon':'https://play-lh.googleusercontent.com/JSSeB3XQtb9sHD5FWTqVM4AksY_Kg2q20eExenxGqPJZdn2uVQxi8eoHkP5MA-IR4w=w480-h960-rw','matches':['https://soundcloud.com/*','https://*.soundcloud.com/*']},'pkg':{'name':hE(0x12e),'version':'0.0.6','private':!0x0,'keywords':['music'],'homepage':'https://soundcloud.com/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'soundcloud.ts'}},'tiktok':{'create':g6=>{const hY=hE;let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const hW=b;let gj=g8??Streamyx??{};gj&&(gj['defineExtension']||=gl=>gl);let gk=gj['defineExtension'];gj['version'],gj['sleep'],gj['input'],gj[hW(0x274)],gj['notify'],gj['confirm'],gj['ask'],gj['utils'],gj['Input'],gj['UrlSource'],gj['ALL_FORMATS'],gj[hW(0x1af)],gj[hW(0x249)],gj[hW(0x173)],gj[hW(0x1f4)],gj['MP4'],gj['MP3'],g7['exports']=gk({async 'getEntries'({url:gl}){const hX=hW;let gm=await g9(gl);if(!gm['ok'])return gc['error']('Failed\x20to\x20fetch\x20TikTok\x20page.\x20Status:\x20'+gm['status']),[];let gn=(await gm['text']())['split']('<script\x20id=\x22__UNIVERSAL_DATA_FOR_REHYDRATION__\x22\x20type=\x22application/json\x22>')[0x1]?.['split']('</script>')[0x0];if(!gn)return gc['error']('Could\x20not\x20find\x20target\x20script\x20tag.\x20TikTok\x20might\x20have\x20updated\x20their\x20page\x20structure.'),[];let go;try{go=JSON['parse'](gn);}catch(gs){return gc['error']('Failed\x20to\x20parse\x20TikTok\x20page\x20JSON',gs,{'url':gl}),[];}let gp=go['__DEFAULT_SCOPE__']?.['webapp.video-detail'],gq=gp?.['itemInfo']?.['itemStruct'];if(!gq)return gc['error']('Could\x20not\x20find\x20video\x20data\x20in\x20the\x20JSON\x20payload.\x20The\x20content\x20might\x20be\x20unavailable\x20or\x20the\x20structure\x20has\x20changed.'),gp?.[hX(0x1d1)]&&gc['error']('Error\x20'+gp['statusCode']+':\x20'+gp['statusMsg']),[];let gr=gq['video']?.['playAddr'];return gr?[{'type':'video','title':gq['desc']||'TikTok\x20Video','source':{'url':gr,'headers':{'Referer':'https://www.tiktok.com/','Cookie':gg['cookie']}}}]:(gc['error']('Could\x20not\x20find\x20a\x20video\x20URL\x20(playAddr)\x20in\x20the\x20JSON\x20payload.'),[]);}});})(g6['Azot'],g6['fetch'],g6['localStorage'],g6[hY(0x1f8)],g6['console'],g6['prompt'],g6['alert'],g6['document'],g6['navigator'],g6['window']),g7['exports']['default']||g7['exports'];},'manifest':{'manifestVersion':0x1,'name':'TikTok','tag':'TT','icon':'https://play-lh.googleusercontent.com/LdBITldj-tJxqLm-CsWSbnt4BMo2gk53cgM7mWIL-zn44m1ywLyQgxRsHKqp8r0qceXs=w480-h960-rw','permissions':[],'matches':['https://tiktok.com/*','https://*.tiktok.com/*']},'pkg':{'name':'tiktok','version':'0.0.2','private':!0x0,'keywords':['social-networks'],'homepage':'https://www.tiktok.com/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'tiktok.ts'}},'virtualroom':{'create':g6=>{const i1=hE;let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const hZ=b;let gj=g8??Streamyx??{};gj&&(gj[hZ(0x20e)]||=gl=>gl);let gk=gj['defineExtension'];gj['version'],gj['sleep'],gj[hZ(0x12d)],gj['prompt'],gj['notify'],gj['confirm'],gj['ask'],gj['utils'],gj['Input'],gj[hZ(0x251)],gj['ALL_FORMATS'],gj['DASH'],gj['DASH_FORMATS'],gj['HLS'],gj['HLS_FORMATS'],gj['MP4'],gj['MP3'],g7['exports']=gk({async 'getEntries'({url:gl}){const i0=hZ;let gm=new URL(gl)['searchParams']['get'](i0(0x182));if(!gm)return gc['error']('Could\x20not\x20extract\x20VirtualRoom\x20recordId.'),[];let gn=await g9('https://mv1.virtualroom.ru/vr/player/records/'+gm+'/info')[i0(0x119)](gq=>gq['ok']?gq['json']():null)['catch'](()=>null),go=await g9('https://mv1.virtualroom.ru/vr/player/records/'+gm+i0(0x24e))[i0(0x119)](gq=>gq['ok']?gq['json']():null)['catch'](()=>null),gp=gn?.['data']?.['roomParameters']?.['name']??'VirtualRoom';return(go?.['data']?.['translations']??[])['filter'](gq=>!!gq['url'])['map'](gq=>({'title':[gp,gq['type'],gq['source'],gq[i0(0x112)]]['filter'](Boolean)[i0(0x272)]('\x20'),'source':{'url':gq['url']}}));}});})(g6['Azot'],g6['fetch'],g6['localStorage'],g6['cookieStore'],g6[i1(0x21a)],g6['prompt'],g6['alert'],g6[i1(0x15f)],g6['navigator'],g6['window']),g7['exports']['default']||g7['exports'];},'manifest':{'manifestVersion':0x1,'name':'VirtualRoom','icon':'https://sun9-50.userapi.com/impg/rY5N7sdA93TFdjkeYqPTnPIjvCJ0rALo_V7V8g/zLAaAv0PpvY.jpg?size=400x400&quality=95&sign=5ddcd6358131b204b8619cb8eeff943f&type=album','matches':['https://virtualroom.ru/*','https://*.virtualroom.ru/*']},'pkg':{'name':'virtualroom','version':'0.0.7','private':!0x0,'keywords':['videotelephony'],'homepage':'https://virtualroom.ru/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'virtualroom.ts'}},'vk':{'create':g6=>{let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const i2=b;let gj=g8??Streamyx??{};gj&&(gj[i2(0x20e)]||=gp=>gp);let gk=gj['defineExtension'];gj[i2(0x1dc)],gj['sleep'],gj['input'],gj['prompt'],gj['notify'],gj['confirm'],gj['ask'],gj['utils'],gj['Input'],gj['UrlSource'],gj['ALL_FORMATS'],gj['DASH'],gj['DASH_FORMATS'],gj['HLS'],gj['HLS_FORMATS'],gj['MP4'],gj['MP3'];let gl=['2160','1440','1080','720','480','360',i2(0x168),'144'],gm=gp=>{let gq=gp['match'](/video-(\d+)_(\d+)/);return gq?{'ownerId':gq[0x1],'videoId':gq[0x2]}:null;},gn=gp=>{if(!gp)return null;for(let gq of gp)if(Array['isArray'](gq)){for(let gr of gq)if(gr&&typeof gr=='object'&&'player'in gr)return gr;}return null;},go=(gp,gq)=>{const i3=i2;let gr=gq['videoQuality']?.[i3(0x1cd)]('p','')['trim'](),gs=gl['filter'](gt=>!!gp['url'+gt]);return gs['length']?gr&&gs['includes'](gr)?gr:gs[0x0]:null;};g7['exports']=gk({async 'getEntries'({url:gp,options:gq}){const i4=i2;let gr=gm(gp);if(!gr)return gc[i4(0x15d)]('Could\x20not\x20extract\x20VK\x20video\x20identifiers'),[];let gs=await g9('https://vkvideo.ru/al_video.php?act=show',{'method':'POST','headers':{'content-type':'application/x-www-form-urlencoded;\x20charset=utf-8','accept':'*/*','accept-language':'ru-RU,ru;q=0.9','sec-ch-ua':i4(0x139),'sec-ch-ua-mobile':'?0','sec-ch-ua-platform':'\x22macOS\x22','sec-fetch-dest':'empty','sec-fetch-mode':'cors','sec-fetch-site':'same-origin','x-requested-with':'XMLHttpRequest','Referer':gp,'Referrer-Policy':i4(0x116)},'body':new URLSearchParams({'al':'1','autoplay':'1','claim':'','force_no_repeat':'true','is_video_page':'true','list':'','module':'direct','t':'','video':'-'+gr['ownerId']+'_'+gr['videoId']})['toString']()});if(!gs['ok'])throw Error('VK\x20request\x20failed:\x20'+gs['status']+'\x20'+gs[i4(0x149)]);let gt=gn((await gs['json']())[i4(0x203)]),gu=gt?.['player']?.['params'],gv=gu&&gu['length']>0x0?gu[0x0]:void 0x0;if(!gt||!gv)return gc['error']('Could\x20not\x20find\x20VK\x20player\x20payload'),[];if(gt['mvData']?.['is_active_live']===0x1||gt['mvData']?.['is_active_live']==='1')return gc['error']('Live\x20videos\x20are\x20not\x20supported'),[];let gw=go(gv,gq),gx=gw?gv[i4(0x1a8)+gw]:void 0x0,gy=gv['dash_sep']||gx;return gy?[{'type':'video','title':[gv['md_title']?.['trim'](),gv['md_author']?.['trim']()]['filter'](Boolean)['join']('\x20'),'source':{'url':gy,'headers':{'Referer':gp,'Cookie':gg['cookie']}}}]:(gc['error']('Could\x20not\x20find\x20video\x20URL'),[]);}});})(g6['Azot'],g6['fetch'],g6['localStorage'],g6['cookieStore'],g6['console'],g6['prompt'],g6['alert'],g6['document'],g6['navigator'],g6['window']),g7['exports']['default']||g7['exports'];},'manifest':{'manifestVersion':0x1,'name':'VK','icon':'https://static.rustore.ru/imgproxy/kSjDiz_MKxD_jzwgEqqaIjQZTE-NEP1Xt8HtJT7EU4s/preset:app_card_icon/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS9hcGsvMjAyNzgyMzI5NS9jb250ZW50L0lDT04vOTc0ODYwMTgtNTc4NS00MjRkLTljYWItNGZlNDk2ZDI3Yzc2LnBuZw==.webp','matches':['https://vk.com/*','https://*.vk.com/*','https://vkvideo.ru/*','https://*.vkvideo.ru/*']},'pkg':{'name':'vk','version':'0.0.8','private':!0x0,'keywords':[hE(0x174)],'homepage':'https://vkvideo.ru/','author':{'name':'Azot','url':hE(0x117)},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'vk.ts'}},'weibo':{'create':g6=>{const i7=hE;let g7={'exports':{}};return((g8,g9,ga,gb,gc,ge,gf,gg,gh,gi)=>{const i5=b;let gj=g8??Streamyx??{};gj&&(gj['defineExtension']||=gm=>gm);let gk=gj['defineExtension'];gj['version'],gj['sleep'],gj['input'],gj['prompt'],gj['notify'],gj['confirm'],gj['ask'];let gl=gj['utils'];gj['Input'],gj['UrlSource'],gj['ALL_FORMATS'],gj['DASH'],gj[i5(0x249)],gj['HLS'],gj['HLS_FORMATS'],gj['MP4'],gj['MP3'],g7[i5(0x170)]=gk({async 'getEntries'({url:gm}){const i6=i5;let gn=gl[i6(0x1b3)](gm,['/:userId(\x5cd+)/:bid','/detail/:mid'],['https://weibo.com/','https://m.weibo.cn']),go=gn['pathname']['bid']||gn['pathname']['mid'];if(!go)return[];let gp=await g9('https://m.weibo.cn/statuses/show?id='+go,{'credentials':'include','referrer':'https://m.weibo.cn/status/'+(gn['pathname']['bid']??go)+'?jumpfrom=weibocom','method':'GET','mode':'cors'})['then'](gt=>gt['json']())['catch'](()=>null);if(!gp?.['data'])return gc['error']('Could\x20not\x20resolve\x20Weibo\x20post\x20metadata'),[];let gq=[],gr=gp['data']['pics'],gs=gp['data']['page_info'];if(gr?.[i6(0x1fc)]){for(let gt of gr['filter'](gu=>gu['type']==='video'||gu['type']==='livephoto'))gt['videoSrc']&&gq['push']({'type':'video','title':gt['pid'],'source':{'url':gt['videoSrc']}});}else{if(gs?.['type']===i6(0x21d)){let gu=Object['values'](gs['urls']??{})[0x0],gv=gs['media_info']?.[i6(0x242)]||gs['media_info']?.[i6(0x1e7)],gw=gu||gv;gw&&gq['push']({'type':'video','title':gs['title']||gs['page_title'],'source':{'url':gw}});}}return gq;}});})(g6['Azot'],g6['fetch'],g6['localStorage'],g6['cookieStore'],g6['console'],g6['prompt'],g6['alert'],g6['document'],g6[i7(0x134)],g6['window']),g7['exports']['default']||g7['exports'];},'manifest':{'manifestVersion':0x1,'name':'Weibo','icon':'https://play-lh.googleusercontent.com/TTKq2trnzgtoyM0jc1pyrrmXtA_Yd3A2hxubZtDahdZStYf4GPANZa-wjDb1ELHrGqh_=w480-h960-rw','matches':['https://weibo.com/*','https://*.weibo.com/*','https://weibo.cn/*','https://*.weibo.cn/*']},'pkg':{'name':hE(0x1ed),'version':'0.0.6','private':!0x0,'keywords':['social-networks'],'homepage':'https://weibo.com/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'weibo.ts'}}};}),ce=a7(cd(),0x1);const cf=g4=>({'name':g4['name'],'source':g4['source'],'dir':g4['dir'],'path':g4['path'],'package':g4['package'],'manifest':g4['manifest'],'installedAt':g4['installedAt']||new Date()['toISOString']()});var cg=class gH extends S{[gP(0x11f)]=new Map();['extensionDirs'];[gP(0x1c0)];['infoList']=[];constructor({dirs:g4,indexPath:g5}={}){super(),this['extensionDirs']=g4??[process['cwd']()],this['indexPath']=g5??L['join'](process['cwd'](),'index.json');}async['init'](){return await this['ensureValidIndexPath'](),await this['loadInfo'](),this;}async['loadInfo'](){return this['infoList']=await aE(this['indexPath'])['catch'](()=>[]),this['infoList'];}async['saveInfo'](){return await this['ensureValidIndexPath'](),await aF(this['indexPath'],this['infoList']);}async['ensureValidIndexPath'](){const i8=gP;(await P[i8(0x1d6)](this['indexPath'])['catch'](()=>null))?.['isDirectory']()&&(q['warn']('Invalid\x20extensions\x20index\x20path\x20repaired:\x20'+this['indexPath']),await aB(this['indexPath']),await P['writeFile'](this['indexPath'],'[]','utf8'));}static async['getAvailableExtensions'](){const i9=gP;try{return(await bU[i9(0x275)](c1['accessToken'],AbortSignal['timeout'](0x1f40)))['data'];}catch(g4){let g5=g4&&typeof g4=='object'&&'code'in g4?g4['code']:g4&&typeof g4=='object'&&i9(0x273)in g4?g4['cause']?.['code']:void 0x0;return q['warn']('Failed\x20to\x20fetch\x20extensions\x20catalog:\x20'+(g4 instanceof Error?g4['message']:String(g4))+'\x20('+g5+')'),[];}}async[gP(0x1c5)](){for(let g4 of this['extensionDirs']){q['debug']('Loading\x20extensions\x20from\x20'+g4);let g5=await P['readdir'](g4,{'withFileTypes':!0x0})['catch'](()=>[]);for(let g6 of g5)if(g6['isDirectory']()){let g7=L['join'](g4,g6['name']);if(await P['readdir'](g7)['then'](g8=>g8['filter'](g9=>!g9['startsWith']('.')))['then'](g8=>!g8['length']))continue;await this['loadExtension'](g7);}}for(let g8 of this['infoList'])this['extensionDirs']['some'](g9=>g8['dir']?.['includes'](g9))||!g8['dir']||(q['debug']('Loading\x20dev\x20extension\x20from\x20'+g8['dir']),await this['loadExtension'](g8['dir']));}async #e(g4,g5){const g6=await P['readFile'](g4,'utf8'),{Azot:g7,fetch:g8,console:g9,localStorage:ga,cookieStore:gb,window:gc,document:ge,navigator:gf}=g5,gg={'exports':{}};eval('(()\x20=>\x20{'+g6+'})();');const gh=gg['exports'];return{'exports':gh,'context':g5};}async['prepareContext'](g4,g5){let g6=E({'name':g4,'dir':G,'title':g5});return await g6['cookieStore']['import'](L['join'](G,g4,'cookies.txt')),g6;}async['loadScript'](g4,g5){const ia=gP;let g6=g5['name'],g7=b3(g5),g8=await this[ia(0x15a)](g6,g7),g9=await y(g4,{'dirname':g5['dir'],'context':g8});if(g9)return g9['exports']='default'in g9['exports']?g9[ia(0x170)]['default']:g9['exports'],g9;}async['loadCoreExtensions'](){const ib=gP;let g4=Object['keys'](ce['default']);q['debug']('Loading\x20'+g4['length']+ib(0x19d)+g4['join'](',\x20'));for(let g5 of Object['values'](ce[ib(0x1bf)])){let g6=g5['pkg']['name'],g7=b1({'manifest':g5['manifest'],'packageJson':g5['pkg'],'fallbackName':g6}),g8=g7['displayName'];try{let g9=await this[ib(0x15a)](g6,g8),ga={'exports':g5['create'](g9),'package':g5['pkg'],'manifest':g7,'context':g9};this['validate'](ga),this['extensions']['set'](g6,ga),this['emit']('loaded',g6);}catch(gb){q['debug'](gb instanceof Error?gb['message']:String(gb)),this['emit']('error',gb,g6);}}}async['loadExtension'](g4){const ic=gP;try{q['debug']('Loading\x20extension\x20from\x20'+g4);let g5=await bB(g4)['catch'](g8=>q['error'](g8));if(!g5)return;g5['package']['dir']=g5['dir'];let g6=await this['loadScript'](g5['path'],g5);if(!g6)return;let g7={'package':g5['package'],'manifest':g5['manifest'],'exports':g6['exports'],'context':g6['context']};this['validate'](g7),this['extensions']['set'](g5['package'][ic(0x144)],g7),this['emit']('loaded',g5['package']['name']);}catch(g8){this['emit']('error',g8,g4);}}['validate'](g4){const id=gP;if(typeof g4!='object'||!g4||!bp(g4['exports']))throw Error('Invalid\x20extension\x20interface:\x20'+g4[id(0x241)]['name']);}['getExtension'](g4){const ie=gP;return this['extensions'][ie(0x126)](g4)??Array['from'](this['extensions']['values']())['find'](g5=>g5['package']['name']===g4)??null;}async['getExtensionForUrl'](g4){const ig=gP;let g5;try{g5=new URL(g4);}catch(g6){return q['debug']('Invalid\x20extension\x20URL:\x20'+g4),q['debug'](g6 instanceof Error?g6['message']:String(g6)),null;}for(let g7 of this['extensions']['values']()){let g8=null,g9=g7['exports']['canHandle'],ga=g5['hostname']['includes'](g7['package']['name']);if(g8=b6(g7)?b5(g7,g5):typeof g9==ig(0x1f9)?await g9(g4):typeof g9=='string'?new URLPattern(g9)['test'](g4):ga,g8)return g7;}return null;}async['install'](g4){const ih=gP;let g5=await gH['getAvailableExtensions'](),g6=[];for(let g7 of g4){let g8=await stat(g7)['then'](gb=>gb[ih(0x115)]())['catch'](()=>!0x1)?g7:await aT(g7,g5);if(!g8)throw aK(aH['SOURCE_NOT_FOUND'],'Extension\x20source\x20not\x20found:\x20'+g7,{'source':g7});let g9=await bC(g8,g7);if(!g9)throw aK(aH['IMPORT_INVALID'],'Extension\x20import\x20failed:\x20'+g7,{'source':g7,'dir':g8});g6['push'](g9);let ga=this['infoList']['find'](({name:gb})=>gb===g9['name']);if(ga){let gb=ga['source'];gb!==g9[ih(0x198)]&&await aB(gb);let gc=ga['dir']?this.#t(ga['dir']):null,ge=g9['dir']?this.#t(g9['dir']):null;gc&&gc!==ge&&await aB(gc),ga[ih(0x215)]=new Date()['toISOString'](),Object[ih(0x225)](ga,cf(g9)),q['info']('Extension\x20'+g9['name']+'\x20updated');}else this['infoList']['push'](cf(g9)),q['info'](ih(0x1e0)+g9['name']+'\x20added');}if(await this['saveInfo'](),g6['length']){for(let gf of g6)this['extensions']['set'](gf['name'],gf);}}#t(g4){let g5=L['parse'](g4);return g5['dir']===I?g4:g5['dir'];}async[gP(0x26a)](g4){const ii=gP;for(let g5 of g4){let g6=this['infoList']['find'](g9=>g9['name']===g5);if(!g6){q['error']('Extension\x20'+g5+'\x20not\x20found');return;}let g7=g6['dir']??'',g8=g7?.['includes'](I);await az(g7)?(g8&&await aB(this.#t(g7)),this['infoList']=this['infoList']['filter'](g9=>g9['name']!==g5),q['info']('Extension\x20'+g5+'\x20removed'),this['extensions']['delete'](g5)):q['warn']('Extension\x20'+g5+ii(0x204)+g7);}await this['saveInfo']();}async['importCookies'](g4,g5){const ij=gP;let g6=this['getExtension'](g4);if(!g6)throw Error(ij(0x1e0)+g4+'\x20not\x20found');return await g6['context']['cookieStore']['import'](g5,{'removeSource':!0x1});}async['login'](g4,g5={}){let g6=this['getExtension'](g4);g6&&await bu(g6,g5);}async['logout'](g4){const ik=gP;for(let g5 of g4){let g6=this['getExtension'](g5);if(!g6)return;q['info']('Logging\x20out...'),await bv(g6),q['debug']('Clearing\x20localStorage...'),g6['context']['localStorage']['clear'](),q['debug']('Clearing\x20cookies\x20store...');let g7=await g6['context']['cookieStore'][ik(0x258)]();for(let g8 of g7)await g6['context']['cookieStore']['delete'](g8);q['info']('Logged\x20out\x20from\x20extension\x20'+g5);}}['list'](){return Array['from'](this['extensions']['values']())['map'](g4=>({'name':g4['package']['name'],'version':g4['package']['version'],'description':g4['package']['description'],'manifest':g4['manifest'],'package':g4['package']}));}};const ch=(g4,g5)=>new Input({'source':new UrlSource(g4['url'],{'requestInit':{'headers':g4['headers']},'fetchFn':g5}),'formats':ALL_FORMATS}),ci=g4=>{const il=gP;let g5;try{g5=new URL(g4);}catch{throw Error('Invalid\x20direct\x20media\x20URL:\x20'+g4);}let g6=g5['pathname']['replace'](/\/+$/,'')['split']('/')['filter'](Boolean)['pop']();return{'type':il(0x21d),'title':g6?.['split']('.')['slice'](0x0,-0x1)['join']('.')||g6||g5['hostname']||'download','source':{'url':g4}};},cj=async(g4,g5)=>{const im=gP;let g6=g5['proxy']||g5['proxyMeta'];g6&&(await g4['context']['http']['configure']({'proxyUrl':g6}),await C[im(0x1fb)]({'proxyUrl':g6}));},ck=async(g4,g5,g6)=>{const io=gP;if(!g6)return q['warn']('No\x20suitable\x20extension\x20available.\x20Downloading\x20as\x20a\x20direct\x20link...'),[ci(g4)];await cj(g6,g5),await bs(g6),q['info']('Analyzing\x20URL...');let g7=await br(g6)[io(0x19e)]({'url':g4,'options':g5});return g7['length']?[...g7]:(q['info']('No\x20media\x20entries\x20found'),[]);},cl=async({entry:g4,url:g5,options:g6,extension:g7,signal:g8})=>{const ip=gP;if(!g7){let ga=g4['source']??{'url':g5},gb=g6['proxy']||g6['proxyMeta'];return gb&&await C['configure']({'proxyUrl':gb}),{'entry':{...g4,'source':ga},'input':ch(ga,gb?C['fetch']['bind'](C):void 0x0)};}await cj(g7,g6),await bs(g7);let g9=br(g7);if(typeof g9['resolveEntry']=='function')return await g9['resolveEntry']({'url':g5,'options':g6,'entry':g4,'signal':g8});if(!g4[ip(0x198)]?.['url'])throw Error('Extension\x20'+g7['package']['name']+'\x20must\x20provide\x20entry.source\x20or\x20implement\x20resolveEntry()');return{'entry':g4,'input':ch(g4['source'],g7[ip(0x110)]['http']['fetch']['bind'](g7['context']['http']))};};var cm=class{['tempDir'];#e=new Map();constructor(g4=r){this['tempDir']=g4;}['track'](g4,g5){if(!g5)return;let g6=this.#e['get'](g4);g6||(g6=new Set(),this.#e['set'](g4,g6)),g6['add'](g5);}['forget'](g4){this.#e['delete'](g4);}['collect'](g4,g5){let g6=new Set();for(let g8 of this.#e['get'](g4)??[])g6['add'](g8);g5?.['output']['filePath']&&g6['add'](g5['output']['filePath']);let g7=new Set();for(let g9 of g6)g7['add'](g9),g7['add'](g9+'.part.json'),g7['add'](this.#t(g9));return g7;}async['purge'](g4){const iq=gP;g4['size']!==0x0&&await Promise[iq(0x1a2)]([...g4]['map'](g5=>rm(g5,{'recursive':!0x0,'force':!0x0})['catch'](()=>void 0x0)));}#t(g4){const ir=gP;let g5=resolve(g4),g6=parse(g4)['name'],g7=createHash('sha1')['update'](g5)['digest']('hex')['slice'](0x0,0xa);return join(this[ir(0x11c)],g6+'-'+g7);}};const cn=g4=>{const is=gP;switch(g4){case'analyzing':case'pending':return{'state':'queued','phase':'analyzing'};case'queued':return{'state':'queued','phase':null};case'downloading':return{'state':'running','phase':'transferring'};case'processing':return{'state':is(0x15b),'phase':'processing'};case'paused':return{'state':'paused','phase':null};case is(0x270):return{'state':'completed','phase':null};case'error':return{'state':'failed','phase':null};}},co=g4=>{const it=gP;let {state:g5,phase:g6}=cn(g4['status']);return{'id':g4['id'],'request':{'entry':g4['entry'],'url':g4[it(0x1a8)],'options':g4['options']},'state':g5,'phase':g6,'progress':{'percent':g4['progress'],'downloadedBytes':g4['downloadedBytes'],'totalBytes':g4['totalBytes']},'output':{'title':g4['title'],'filePath':g4['filePath'],'quality':g4['quality'],'codec':g4['codec']},'failure':g4['error']?{'message':g4['error']}:void 0x0,'createdAt':g4['createdAt']};},cp=({id:g4,request:g5,createdAt:g6})=>({'id':g4,'request':g5,'state':'queued','phase':null,'progress':{'percent':0x0,'downloadedBytes':0x0},'output':{},'createdAt':g6}),cq=g4=>g4['state']===gP(0x22f)||g4['state']==='running',cr=[gP(0x1da),'errno','syscall','address','port','host','hostname','path','type'],cs=g4=>typeof g4=='object'&&!!g4&&'status'in g4&&'statusText'in g4&&'url'in g4,ct=g4=>{let g5=[],g6=g4;for(let g7 of cr){let g8=g6[g7];g8==null||g8===''||g5['push'](g7+'='+String(g8));}return g5;},cu=(g4,g5=0x0)=>{const iu=gP;if(g5>0x3)return'[max-depth]';if(g4 instanceof Error){let g6=ct(g4),g7='cause'in g4?g4['cause']:void 0x0,g8=[g4['name']+':\x20'+g4['message']];return g6['length']&&g8['push']('details='+g6['join'](',\x20')),g7!==void 0x0&&g7!==g4&&g8['push']('cause='+cu(g7,g5+0x1)),g8['join']('\x20|\x20');}return cs(g4)?'Response\x20'+g4['status']+'\x20'+g4['statusText']+iu(0x1ff)+g4['url']:inspect(g4,{'depth':0x2,'breakLength':0x1/0x0});},cv=(g4,g5)=>{q['debug'](g4+':\x20'+cu(g5)),g5 instanceof Error&&g5['stack']&&q['debug'](g5['stack']);},cw=g4=>{let g5=0x0,g6=0x0,g7=!0x1;for(let g9 of g4){if(g5+=g9['current']['b'],g9['total']['b']===void 0x0){g7=!0x0;continue;}g6+=g9['total']['b'];}let g8=g7?void 0x0:g6;return{'totalDownloaded':g5,'totalSize':g8,'percent':g8&&g8>0x0?g5/g8*0x64:0x0};},cx=g4=>{const iv=gP;let g5=g4['replace'](/[<>:"/\\|?*\x00-\x1F]/g,'');g5=g5['replace'](/^[\s.]+|[\s.]+$/g,''),g5=g5['replace'](/\s+/g,'\x20');let g6=g5['lastIndexOf']('.'),g7=g6>0x0,g8=g7?g5['slice'](g6):'',g9=g7?g5['slice'](0x0,g6):g5;if(g8['length']>=0xff)g5=g5['slice'](0x0,0xff);else{let gb=0xff-g8['length'];g9['length']>gb&&(g9=g9['slice'](0x0,gb)),g5=g9+g8;}let ga=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;if(g8['length']<0xff){let gc=g5['lastIndexOf']('.'),ge=gc>0x0;if(g8=ge?g5['slice'](gc):'',g9=ge?g5['slice'](0x0,gc):g5,ga['test'](g9)){let gf=0xff-g8['length'];g5=('_'+g9)[iv(0x22d)](0x0,gf)+g8;}}return g5['length']===0x0?'untitled':g5;},cy=(g4,g5)=>Object[gP(0x163)](g5)['reduce']((g6,g7)=>{const iw=gP;let g8='{'+g7+'}',g9=g5[g7];if(!g9){let ga=RegExp('(?:\x5c.|^)\x5c{'+g7+iw(0x255)+g7+'\x5c}(\x5c.|$)|\x5c{'+g7+'\x5c}','g');return g6['replace'](ga,(gb,gc)=>'')['replaceAll']('....','...');}return g6['replaceAll'](g8,g9);},g4)['replaceAll']('\x20\x20','\x20'),cz=g4=>typeof g4=='string'&&g4['trim']()||'mp4',cA=async g4=>{const ix=gP;if(!g4)return'';let g5=(await g4['getCodec']())?.['toLowerCase']();if(!g5)return'';switch(g5['split']('.')[0x0]??g5){case ix(0x1c9):case'eac3':return'DDP';case'ac-3':case'ac3':return'DD';case'aac':case'mp4a':return'AAC';case ix(0x129):return'OPUS';case ix(0x257):return'VORBIS';case'flac':return'FLAC';default:return g5['toUpperCase']();}},cB=g4=>{let g5=g4['seasonNumber']?''+g4['seasonNumber']:'',g6=g4['episodeNumber']?''+g4['episodeNumber']:'',g7=g5?'S'+g5:'',g8=g6?'E'+g6:'',g9=g5&&g6?g7+':'+g8:'',ga=g4['episodeTitle']?.['trim']()?'\x22'+g4['episodeTitle']+'\x22':'';return((g4['title']??'')+'\x20'+g9+'\x20'+ga)['trim']();},cC=async({settings:g4,options:g5,entry:g6,tag:g7,tracks:g8})=>{const iy=gP;let [g9,ga]=await Promise['all']([g8['videos'][0x0]?.['getCodec']()??Promise['resolve'](''),cA(g8['audios'][0x0])]),gb=g4['get']('downloadDir'),gc=g5['movieTemplate']||g4['get'](iy(0x11b)),ge=g5['episodeTemplate']||g4['get']('seriesFilenameTemplate'),gf=cx(cy(g6['episodeNumber']?ge:gc,{'title':g6['title']??'','s':g6['seasonNumber']?g6['seasonNumber']['toString']()['padStart'](0x2,'0'):'','e':g6['episodeNumber']?g6['episodeNumber']['toString']()['padStart'](0x2,'0'):'','quality':g5['videoQuality']??'','codec':g9??'','tag':g7??'','episodeTitle':g6['episodeTitle']??'','audioType':ga,'format':'WEB-DL'}))+'.'+cz(g5['format']||g4['get']('videoContainerFormat')),gg=g5['outputPath']||join(gb,gf),gh=parse(gg);return{'outputPath':gg,'outputDirectory':gh['dir']||gb,'fileName':gh['base'],'baseName':gh['name']};};var cD=class extends Error{['code'];constructor(g4,g5=g4,g6){super(g5,g6),this['name']='DownloaderError',this['code']=g4;}};const cE=g4=>{if(!g4)return;let g5=Object['fromEntries'](new Headers(g4)['entries']());return Object['keys'](g5)['length']?g5:void 0x0;},cF=g4=>{const iz=gP;let g5=g4['source'],g6=g5['rootPath'];if(typeof g6!='string'||!g6)throw Error('Resolved\x20media\x20resource\x20is\x20missing\x20a\x20usable\x20input\x20source\x20URL');return{'url':g6,'headers':cE(g5[iz(0x186)]?.['requestInit']?.['headers'])};},cG=g4=>g4?.[gP(0x124)]()['toLowerCase']()??'',cH=g4=>cG(g4)['slice'](0x0,0x2),cI=g4=>cG(g4)||'und',cJ=(g4,g5)=>{let g6=cG(g4),g7=cG(g5);return!g6||!g7?!0x1:g6===g7||g6['startsWith'](g7+'-')?!0x0:cH(g6)===cH(g7);},cK=g4=>Array['from'](new Map(g4[gP(0x13b)](g5=>cG(g5))['filter'](Boolean)['map'](g5=>[cH(g5),g5]))['values']()),cL=({videos:g4,audios:g5,subtitles:g6})=>({'videos':g4,'audios':g5,'subtitles':g6,'all':[...g4,...g5,...g6]}),cM=g4=>(g4??0x0)/0x3e8,cN=async g4=>{try{return(await g4['getSegments']())['length']+'\x20Segments';}catch{return'?\x20Segments';}},cO=async(g4,g5)=>{const iA=gP;let g6=new Map();for(let g7 of g4){let g8=cI(await g7['getLanguageCode']()),g9=g6['get'](g8);if(!g9){g6['set'](g8,[g7]);continue;}g9[iA(0x1fc)]<g5&&g9['push'](g7);}return Array['from'](g6['values']())['flat']();},cP=async(g4,g5,g6=0x1)=>{const iB=gP;let g7=(await Promise['all'](g4['map'](async gb=>({'audio':gb,'bitrate':await gb['getBitrate']()}))))[iB(0x161)]((gb,gc)=>(gc['bitrate']??0x0)-(gb['bitrate']??0x0))['map'](({audio:gb})=>gb),g8=cK(g5),g9=[];for(let gb of g8){let gc=[];for(let ge of g7)cJ(await ge['getLanguageCode'](),gb)&&gc['push'](ge);gc['length']&&g9['push'](...await cO(gc,g6));}let ga=cK(await Promise['all'](g7['map'](async gf=>await gf['getLanguageCode']()||'und')));if(!g9['length'])for(let gf of ga){let gg=[];for(let gh of g7)cJ(await gh[iB(0x1dd)]()??'und',gf)&&gg['push'](gh);gg['length']&&g9[iB(0x146)](...await cO(gg,g6));}return g9;},cQ=async(g4,g5)=>{let g6=g5?parseInt(String(g5),0xa)*0x10/0x9:void 0x0;return await g4['getVideoTracks']({'filter':async g7=>!await g7['hasOnlyKeyPackets'](),'sortBy':async g7=>[prefer(!!g5&&Number(await g7['getDisplayHeight']())===Number(g5)),prefer(!!g6&&Number(await g7['getDisplayWidth']())===Number(g6)),desc(await g7['getBitrate']())]});},cR=async(g4,g5)=>{if(!g5?.['length'])return g4;let g6=[];for(let g7 of g4)g5['includes'](await g7['getCodec']()??'')&&g6['push'](g7);return g6['length']?g6:g4;},cS=async(g4,g5)=>{const iC=gP;if(!g5)return g4;let g6=[];for(let g7 of g4)await g7['getNumberOfChannels']()===Number(g5)&&g6[iC(0x146)](g7);return g6;},cT=async({input:g4,video:g5,requirePairable:g6})=>await g4['getAudioTracks']({'filter':async g7=>!g6||!g5||g7['canBePairedWith'](g5),'sortBy':async g7=>[prefer(!g5||g7['canBePairedWith'](g5)),desc(await g7['getBitrate']())]}),cU=async g4=>await g4['getSubtitleTracks']({'sortBy':async g5=>[desc(await g5['getBitrate']())]}),cV=async(g4,g5)=>{let g6=g5['videoQuality'],g7=await cQ(g4,g6||NaN);g7=await cR(g7,g5['videoCodecs']);let g8=await cT({'input':g4,'requirePairable':!0x1}),g9=await cU(g4);return{'videos':g7,'audios':g8,'subtitles':g9};},cW=async({input:g4,options:g5,inventory:g6})=>{const iD=gP;let {videos:g7,audios:g8,subtitles:g9}=g6,ga=g7[0x0],gb=[...g5['languages']||[]],gc=await cT({'input':g4,'video':ga,'requirePairable':!0x0});gc['length']||(gc=g8),gc=await cS(gc,g5['audioChannels']),gc=await cR(gc,g5['audioCodecs']);let ge=await cP(gc,gb,0x1);ge['length']&&(gc=ge);let gf=gb['at'](-0x1);gf&&await Promise['all'](gc['map'](async gh=>{let gi=await gh['getLanguageCode']();(!gi||gi==='und')&&gh['setLanguageCode'](gf);}));let gg=[];for(let gh of g9){if(!g5['subtitleLanguages']?.['length'])continue;let gi=await gh['getLanguageCode']()||'und';g5[iD(0x1be)]['some'](gj=>cJ(gi,gj))&&gg['push'](gh);}return cL({'videos':g5[iD(0x1d5)]||!ga?[]:[ga],'audios':g5['skipAudio']?[]:gc,'subtitles':g5['skipSubtitles']?[]:gg});},cX={'selectTracks':async({input:g4,options:g5,inventory:g6})=>await cW({'input':g4,'options':g5,'inventory':g6})},cY=async({input:g4,options:g5,strategy:g6})=>{let g7=await cV(g4,g5);return await g6['selectTracks']({'input':g4,'options':g5,'inventory':g7});},cZ=g4=>{if(!g4)return null;try{return new URL(g4);}catch{return null;}},d0=(g4,g5)=>{if(!g5['languages']?.['length'])return(g4['context']?.['legacy']?.['source'])?.['audioLanguage']?.['trim']()||void 0x0;},d1=(g4,g5)=>{const iE=gP;if(g4)switch(g4){case'aar':case'abk':return'rus';case iE(0x14b):return'eng';case'zu':return g5?.['includes']('start.film')?'ru':'zu';default:return g4;}},d2=async(g4,g5)=>{let g6=await g4['getLanguageCode']()['catch'](()=>void 0x0),g7=d1(g6,g5);g7&&g7!==g6&&g4['setLanguageCode'](g7);},d3=async(g4,g5)=>{await Promise['all'](g4['map'](g6=>d2(g6,g5)));},d4=(g4,g5)=>g4['filter'](g6=>g6['type']===g5)['length'],d5=g4=>{const iF=gP;let g5='Extracted,\x20there\x20are\x20';if(g4['length']===0x0)g5+=iF(0x151);else{g5+=g4['length']+'\x20tracks';let g6=d4(g4,'video');g6&&(g5+=',\x20'+g6+'\x20video\x20tracks');let g7=d4(g4,'audio');g7&&(g5+=',\x20'+g7+'\x20audio\x20tracks');let g8=d4(g4,iF(0x127));g8&&(g5+=',\x20'+g8+'\x20subtitle\x20tracks');}q['info'](g5);},d6=async(g4,g5)=>{let g6=await g4['getSubtitleTracks']();return await d3(g6,g5),g6;},d7=(g4,g5)=>{q['debug']('URL:\x20'+cF(g4['input'])['url']);let g6=g5['seasonNumber'],g7=g5['episodeNumber'],g8=g5['episodeTitle']??'',g9=[g5['title'],g6?'S'+g6:'',g7?'E'+g7:'',g8]['filter'](Boolean)['join']('\x20∙\x20');g9&&q['info'](g9);},d8=(g4,g5)=>{if(g4['title'])return;let g6=cZ(g5)?.['pathname']['split']('/')['pop']();g6&&(g4['title']=g6);},d9=(g4,g5)=>{if(g4['title'])return;let g6=cZ(g5)?.['host'];g6&&(g4['title']=g6+'_'+m());},da=(g4,g5)=>{g4['videoQuality']||=g5?g5+'p':void 0x0;};var db=class{#e;#t;constructor({settings:g4,trackSelectionStrategy:g5=cX}={}){this.#e=g4,this.#t=g5;}async['prepareSource']({options:g4,resource:g5,entry:g6}){const iG=gP;let g7=await g5['input']['getFormat']();return q['info']('Content\x20Matched:\x20'+g7[iG(0x144)]),g7===HLS||g7===DASH?await this.#r({'options':g4,'resource':g5,'entry':g6}):await this.#n({'options':g4,'resource':g5,'entry':g6});}async['prepareDownloadPlan']({options:g4,resource:g5,extensionTag:g6}){if(!this.#e)throw Error('DownloadPlanner\x20settings\x20are\x20required\x20to\x20prepare\x20a\x20download\x20plan');let g7={...g5['entry'],'id':g5['entry']['id']??crypto['randomUUID']()};d7(g5,g7),q['info']('Parsing\x20streams...');let g8=await this['prepareSource']({'options':{...g4},'resource':g5,'entry':g7}),g9=await cC({'settings':this.#e,'options':g8['options'],'entry':g8['entry'],'tag':g6,'tracks':g8['tracks']});return await aD(g9['outputDirectory']),{...g8,'output':g9,'downloadTitle':cB(g8['entry'])||g9['baseName']};}async #n({options:g4,resource:g5,entry:g6}){const iH=gP;let g7=g5['input'],g8=cF(g7)['url'],g9={...g4},ga={...g6};d8(ga,g8);let [gb,gc,ge]=await Promise['all']([g7['getPrimaryVideoTrack'](),g7['getPrimaryAudioTrack'](),d6(g7,g8)]);da(g9,await gb?.['getCodedHeight']());let gf=gb&&!g9['skipVideo']?[gb]:[],gg=[];!gb&&gc&&!g9[iH(0x233)]&&(await d2(gc,g8),gg=[gc]);let gh={'videos':gf,'audios':gg,'subtitles':ge,'all':[...ge,...gf,...gg]};return d5(gh['all']),{'options':g9,'resource':g5,'entry':ga,'tracks':gh,'isSegmented':!0x1};}async #r({options:g4,resource:g5,entry:g6}){const iI=gP;let g7=g5['input'],g8=cF(g7)['url'],g9={...g4},ga={...g6};await d3(await g7[iI(0x1ba)](),g8),d9(ga,g8);let gb={...g9},gc=d0(ga,gb);gc&&(gb['languages']=[gc]);let ge=await cY({'input':g7,'options':gb,'strategy':this.#t});if(d5(ge['all']),!ge['videos']['length']&&!ge['audios']['length']&&!ge['subtitles']['length'])throw new cD('No\x20tracks\x20selected');return ge['videos'][0x0]&&da(g9,await ge['videos'][0x0]['getDisplayHeight']()),{'options':g9,'resource':g5,'entry':ga,'tracks':ge,'isSegmented':!0x0};}};const dc=0x1,dd=0x4,de=0x8,df=0x10,dg=(g4,g5)=>Math['max'](dc,Math['trunc'](typeof g4=='number'&&Number['isFinite'](g4)?g4:g5)),dh=g4=>g4['includes']('highConnectionsCount')?df:g4['includes']('mediumConnectionsCount')?de:dd,di=({requestedConnections:g4,fallbackConnections:g5=dc,grantedBenefits:g6})=>{let g7=dg(g4,dg(g5,dc)),g8=dh(g6),g9=Math['min'](g7,g8);return{'connections':g9,'normalizedRequestedConnections':g7,'maxAllowedConnections':g8,'wasClamped':g9<g7};},dj=async g4=>{const iJ=gP;let {grantedBenefits:g5}=await cc(),g6=null,g7=g5['includes']('parallelDownloads'),g8=g4['maxActiveDownloads']&&g4['maxActiveDownloads']>0x1;if(!g7&&g8&&(g6=Error('PARALLEL_DOWNLOADS_NOT_ALLOWED'),g4['maxActiveDownloads']=0x1),g4['proxy']||g4[iJ(0x1ae)]||g4['proxyMedia']){let g9=g5['includes'](iJ(0x264)),ga=g4[iJ(0x264)]||g4['proxyMeta']||g4['proxyMedia'];!g9&&ga&&(g6=Error('PROXY_NOT_ALLOWED'),delete g4['proxy'],delete g4['proxyMeta'],delete g4['proxyMedia']);}if(g4['videoContainerFormat']&&g4['videoContainerFormat']!=='mp4'&&(g5['includes'](iJ(0x1f5))||(g6=Error('CUSTOM_MUX_FORMAT_NOT_ALLOWED'),g4['videoContainerFormat']='mp4')),typeof g4['connections']=='number'){let {connections:gb}=di({'requestedConnections':g4['connections'],'grantedBenefits':g5});g4['connections']=gb;}return{'error':g6,'data':g4};},dk=g4=>({'retry':g4['get']('retry'),'connections':g4['get']('connections'),'proxy':g4[gP(0x126)]('proxy'),'proxyMeta':g4['get'](gP(0x1ae)),'proxyMedia':g4['get']('proxyMedia'),'movieTemplate':g4['get']('movieFilenameTemplate'),'episodeTemplate':g4['get']('seriesFilenameTemplate'),'hardsub':g4['get'](gP(0x192)),'format':g4[gP(0x126)]('videoContainerFormat')}),dl=({options:g4,fallbackConnections:g5,grantedBenefits:g6})=>{const iK=gP;let g7=di({'requestedConnections':g4['connections'],'fallbackConnections':g5,'grantedBenefits':g6});return{'options':{...g4,'connections':g7[iK(0x194)]},'limit':g7};},dm=({settings:g4,requestedOptions:g5,filePath:g6,grantedBenefits:g7})=>{let g8=dk(g4),{options:g9,limit:ga}=dl({'options':{...g8,...g5},'fallbackConnections':g8['connections'],'grantedBenefits':g7});return g6&&(g9['outputPath']=g6),{'baseOptions':g8,'options':g9,'limit':ga};},dn=async({extensionManager:g4,entry:g5,url:g6,options:g7,signal:g8})=>{let g9=g6?await g4['getExtensionForUrl'](g6):null,ga=await cl({'entry':g5,'url':g6??g5['source']?.['url']??'','options':g7,'extension':g9,'signal':g8});return{'resource':ga,'extension':g9,'extensionTag':g9?b4(g9):void 0x0,'beforeDownload':async()=>{!g9||!g6||await bx(g9,{'url':g6,'options':g7,'resource':ga,'signal':g8});},'afterDownload':async gb=>{!g9||!g6||await by(g9,{'url':g6,'options':g7,'resource':ga,'signal':g8,'skipMux':gb});},'dispose':async()=>{if(ga['dispose']){await ga['dispose']();return;}await ga['input']['dispose']?.();}};},dp=g4=>'manifest:'+g4['type']+':'+g4['id'],dq=g4=>{const iL=gP;let g5=new Map();for(let g6 of g4){let g7=dp(g6),g8=g5['get'](g7);if(g8){g8['push'](g6);continue;}g5['set'](g7,[g6]);}return Array['from'](g5['entries']())[iL(0x14e)](([,g9])=>g9['length']>0x1);},dr=g4=>{let g5=dq(g4);if(!g5['length'])return;let g6=g5['map'](([g7,g8])=>g7+'\x20('+g8['length']+'\x20copies)')['join'](',\x20');throw Object['assign'](Error('Duplicate\x20tracks\x20selected:\x20'+g6),{'code':'DUPLICATE_TRACKS_SELECTED'});},ds=g4=>{try{let g5=new URL(g4),g6=[...new Set(g5['searchParams']['keys']())],g7=g6['length']?'?'+g6['join'](','):'';return''+g5['origin']+g5['pathname']+g7;}catch{return g4;}},dt=g4=>g4?typeof g4=='string'?g4:g4 instanceof Uint8Array||g4 instanceof ArrayBuffer?Buffer['from'](g4)['toString']('base64'):null:null,du=async g4=>{const iM=gP;let g5=(await g4[iM(0x254)]()['catch'](()=>[]))[0x0];return g5?.['initSegment']?.['encryption']??g5?.['encryption'];},dv=async g4=>{const iN=gP;let g5=await du(g4);return[{'system':'widevine','pssh':dt(g5?.['drm']?.['widevine']?.['pssh'])},{'system':'playready','pssh':dt(g5?.['drm']?.['playready']?.['pssh'])},{'system':'fairplay','pssh':dt(g5?.['drm']?.[iN(0x1a5)]?.['pssh'])}]['filter'](g6=>g6['pssh']);},dw=async g4=>{let g5=await du(g4),g6=await dv(g4),g7=g5?.['drm']?.['widevine']&&'widevine'||g5?.['drm']?.['playready']&&'playready'||g5?.['drm']?.['fairplay']&&'fairplay'||null;if(!g7)return null;let g8=g6['find'](g9=>g9['system']===g7);return{'system':g7,'cacheKey':g8?.['pssh']?g7+':'+g8['pssh']:'track:'+dp(g4)};},dx=async g4=>{let g5=new Map();for(let g6 of g4){let g7=await dv(g6);for(let g8 of g7)!g8['pssh']||g5['has'](g8['pssh'])||g5['set'](g8['pssh'],{'pssh':g8['pssh'],'system':g8['system'],'track':g6});}return g5;},dy=({jobId:g4,title:g5,entryTitle:g6,psshList:g7,options:g8,error:g9})=>{const iO=gP;q['error']('Failed\x20to\x20extract\x20decryption\x20keys\x20for\x20job\x20'+g4),q['debug']('DRM\x20extraction\x20context:\x20title='+(g5||g6||'(unknown)')+',\x20psshCount='+g7['length']+',\x20providedKeyCount='+(g8['keys']?.['length']??0x0)),g9 instanceof Error?(cv('DRM\x20extraction\x20failure',g9),g9['message']==='Unauthorized'&&w['emit']('error',{'code':iO(0x193)}),g9['message']==='Forbidden'&&w['emit']('error',{'code':iO(0x136)})):q['debug'](String(g9));},dz=async({psshList:g4,requestLicense:g5})=>{const iP=gP;q['debug']('Extracting\x20decryption\x20keys');let g6=[],g7=[...new Set(g4??[])];for(let g8 of g7){q['debug']('Resolving\x20DRM\x20keys\x20for\x20PSSH\x20'+g8),q['debug']('PSSH:\x20'+g8);let g9=Buffer['from'](g8,'base64'),ga=iP(0x177),gb=bH(bG(),'drm'),gc=new RemoteCdm({'keySystem':'com.widevine.alpha','baseUrl':gb,'headers':{'Authorization':'Bearer\x20'+c1['accessToken']}}),ge=null;try{ge=(await requestMediaKeySystemAccess(gc['keySystem'],[])['createMediaKeys']({'cdm':gc}))['createSession'](),q[iP(0x113)]('Generating\x20license\x20request...');let gf=ge['waitForLicenseRequest']();await ge['generateRequest']('cenc',g9);let gg=await gf;q['debug']('License\x20request\x20of\x20'+gg['length']+'\x20bytes\x20generated\x20for\x20session\x20'+ge[iP(0x224)]),q[iP(0x113)]('Requesting\x20license...');let gh=await g5({'pssh':g8,'data':new Uint8Array(gg)});if(gh[0x0]===0x7b||gh[0x0]===0x3c){q[iP(0x113)]('License\x20response\x20is\x20not\x20binary');let gj=Buffer['from'](gh)['toString']('utf8');if(q['debug'](gj),gj[iP(0x199)]('<html>'))throw Error(iP(0x218));}q['debug']('Updating\x20session...'),await ge['update'](new Uint8Array(gh)),q['debug']('Waiting\x20for\x20key\x20statuses\x20change...');let gi=await ge['waitForKeyStatusesChange']();q['debug']('Keys\x20count:\x20'+gi['length']),await ge['close'](),await ge['remove']();for(let gk of gi){let gl='Key:\x20'+gk['keyId']+':'+gk['key'];q['debug'](gl),g6['push']({'kid':gk['keyId'],'key':gk['key']});}}catch(gm){throw q['error']('Failed\x20to\x20get\x20DRM\x20content\x20keys\x20for\x20license\x20via\x20remoteCdm='+ds(gb)),cv('DRM\x20content\x20key\x20error',gm),gm;}finally{if(ge){try{await ge['close']();}catch{}try{await ge['remove']();}catch{}}}}return g6['length']||(q['warn']('Can\x27t\x20get\x20decryption\x20keys'),q['debug']('PSSH:\x20'+g7['join'](',\x20'))),g6;},dA=async({jobId:g4,title:g5,entryTitle:g6,options:g7,psshList:g8,selectedTracks:g9,extension:ga,resource:gb})=>{let gc=g7['keys']??[];if(gc['length'])return gc;if(!ga)return[];let ge=br(ga);if(!ge['drm'])return[];if(typeof ge['drm']['resolveKeys']=='function'){let gh=new Map(),gi=new Map();for(let gj of g9){let gk=await dw(gj);if(!gk)continue;let gl=gi['get'](gk['cacheKey']);gl||(gl=await ge['drm']['resolveKeys']({'system':gk['system'],'resource':gb,'track':gj,'options':g7}),gi['set'](gk['cacheKey'],gl));for(let gm of gl)gh['has'](gm['kid'])||gh['set'](gm['kid'],gm);}return Array['from'](gh['values']());}if(typeof ge['drm']['requestLicense']!='function')return[];let gf=ge['drm']['requestLicense'],gg=await dx(g9);if(!gg['size'])return[];try{return await dz({'psshList':g8,'requestLicense':async({pssh:gn,data:go})=>{const iQ=b;let gp=gg[iQ(0x126)](gn);if(!gp)throw Error('No\x20DRM\x20track\x20binding\x20found\x20for\x20PSSH\x20'+gn);return await gf({'system':gp['system'],'resource':gb,'track':gp['track'],'options':g7,'data':go});}});}catch(gn){throw dy({'jobId':g4,'title':g5,'entryTitle':g6,'psshList':g8,'options':g7,'error':gn}),gn;}};var dB=class{['strategy'];constructor(g4){this['strategy']=g4;}async['prepare'](){await this['strategy']['prepare']?.();}async['process'](g4){let g5=await this['strategy']['decryptFile'](g4);return g4['cleanup']&&await rm(g4['input'],{'force':!0x0}),g5;}};const dC=g4=>g4['replaceAll']('-','')['toLowerCase']();var dD=class{async[gP(0x1e9)](g4){const iR=gP;let g5=new Map();for(let g6 of g4['keys']){if(!g6['kid'])throw Error('Shifro\x20requires\x20a\x20KID\x20for\x20every\x20decryption\x20key');g5['set'](dC(g6[iR(0x183)]),dC(g6['key']));}return q['debug']('Decrypting\x20via\x20shifro:\x20'+g4['input']),await(await Decryption['init']({'input':new U({'source':new FilePathSource(g4[iR(0x12d)]),'keys':g5}),'output':new Output({'target':new FilePathTarget(g4['output'])})}))['execute'](),g4['output'];}};const dE=async(g4,g5,g6)=>g6??open(g4,g5),dF=g4=>{let g5=null;return new StreamSource({'getSize':async()=>(g5=await dE(g4,'r',g5),(await g5['stat']())['size']),'read':async(g6,g7)=>{g5=await dE(g4,'r',g5);let g8=new Uint8Array(g7-g6);return await g5['read'](g8,0x0,g7-g6,g6),g8;},'dispose':async()=>{let g6=g5;g5=null,await g6?.['close']();},'prefetchProfile':'fileSystem'});},dG=g4=>{let g5=null;return new StreamTarget(new WritableStream({'start':async()=>{g5=await dE(g4,'w',g5);},'write':async g6=>{const iS=b;if(!g5)throw Error(iS(0x247)+g4);await g5['write'](g6['data'],0x0,g6['data']['byteLength'],g6['position']);},'close':async()=>{const iT=b;let g6=g5;g5=null,await g6?.[iT(0x1ec)]();},'abort':async()=>{let g6=g5;g5=null,await g6?.['close']();}}),{'chunked':!0x0});},dH=/(?:(.+?)\n)?((?:\d{2}:)?\d{2}:\d{2}\.\d{3})\s+-->\s+((?:\d{2}:)?\d{2}:\d{2}\.\d{3})([^\n]*)/g,dI=/^\uFEFF?WEBVTT(?:.|\n)*?\n{2}/,dJ=/(?:(\d{2}):)?(\d{2}):(\d{2})\.(\d{3})/,dK={'ar':gP(0x1b7),'de':'deu','en':'eng','es':'spa','fr':'fra','hi':'hin','it':'ita','ja':'jpn','ko':'kor','pl':'pol','pt':'por','ru':'rus','th':'tha','tr':gP(0x18d),'uk':'ukr','und':'und','vi':'vie','zh':'zho'},dL=g4=>g4==='subtitle'||g4==='text',dM=g4=>{let g5=g4['trim']()['split'](':');if(g5['length']<0x2||g5['length']>0x3)throw Error('Invalid\x20trim\x20timestamp:\x20'+g4);let g6=Number(g5['at'](-0x1)),g7=Number(g5['at'](-0x2)),g8=g5['length']===0x3?Number(g5[0x0]):0x0;if(![g8,g7,g6]['every'](g9=>Number['isFinite'](g9)&&g9>=0x0))throw Error('Invalid\x20trim\x20timestamp:\x20'+g4);return g8*0xe10+g7*0x3c+g6;},dN=g4=>{const iU=gP;let g5=dJ[iU(0x25c)](g4);if(!g5)throw Error('Invalid\x20WebVTT\x20timestamp:\x20'+g4);return 0xe10*0x3e8*Number(g5[0x1]||'0')+0x3c*0x3e8*Number(g5[0x2])+0x3e8*Number(g5[0x3])+Number(g5[0x4]);},dO=g4=>{let g5=Math['floor'](g4/(0xe10*0x3e8)),g6=Math['floor'](g4%(0xe10*0x3e8)/(0x3c*0x3e8)),g7=Math['floor'](g4%(0x3c*0x3e8)/0x3e8),g8=g4%0x3e8;return g5['toString']()['padStart'](0x2,'0')+':'+g6['toString']()['padStart'](0x2,'0')+':'+g7['toString']()['padStart'](0x2,'0')+'.'+g8['toString']()['padStart'](0x3,'0');},dP=g4=>{const iV=gP;let g5=[g4['invalidEntries']?.[iV(0x1fc)]?g4['invalidEntries']['length']+'\x20invalid\x20entries':void 0x0,g4['invalidTimecodes']?.['length']?g4['invalidTimecodes']['length']+'\x20invalid\x20timecodes':void 0x0,g4['invalidIndices']?.[iV(0x1fc)]?g4['invalidIndices']['length']+'\x20invalid\x20indices':void 0x0,g4['timecodeIssues']?.['reversedTimecodes']?.['length']?g4['timecodeIssues']['reversedTimecodes']['length']+'\x20reversed\x20timecodes':void 0x0,g4['timecodeIssues']?.['overlappingTimecodes']?.['length']?g4['timecodeIssues']['overlappingTimecodes']['length']+'\x20overlapping\x20timecodes':void 0x0]['filter'](Boolean);return g5['length']?'\x20('+g5['join'](',\x20')+')':'';},dQ=g4=>{const iW=gP;let g5=g4['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')['trim']();if(dI['test'](g5))return g5;let {subtitle:g6,status:g7}=convert(g4,'.vtt');if(!g7['success'])throw Error(iW(0x1db)+dP(g7)+'.');return g6['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')['trim']();},dR=g4=>{const iX=gP;if(!g4)return;let g5=g4[iX(0x124)]()['toLowerCase']();if(!g5)return;let g6=g5[iX(0x246)]('-')[0x0]??g5;return/^[a-z]{3}$/['test'](g6)?g6:dK[g6];},dS=g4=>{switch(extname(g4)['toLowerCase']()){case'.mp4':return new Mp4OutputFormat();case'.mkv':return new MkvOutputFormat();default:throw Error('Unsupported\x20mux\x20output\x20format:\x20'+g4);}},dT=g4=>new W({'formats':V,'source':dF(g4)}),dU=g4=>{const iY=gP;let g5=g4['trimBegin']?dM(g4['trimBegin']):void 0x0,g6=g4[iY(0x142)]?dM(g4['trimEnd']):void 0x0;if(g5!==void 0x0&&g6!==void 0x0&&g6<=g5)throw Error('trimEnd\x20must\x20be\x20greater\x20than\x20trimBegin');return{'trimBegin':g5,'trimEnd':g6};},dV=async(g4,g5,g6,g7,g8)=>{const iZ=gP;let g9=dT(g5),ga=await g9['getPrimaryVideoTrack']();if(!ga)throw Error('Missing\x20video\x20track\x20in\x20'+g5);let gb=ga['codec'];if(!gb)throw Error('Unknown\x20video\x20codec\x20in\x20'+g5);if(g8!==void 0x0&&g8>=await ga[iZ(0x16e)]())throw Error('trimBegin\x20excludes\x20the\x20full\x20video\x20track\x20in\x20'+g5);let gc=new EncodedPacketSink(ga),ge=g8===void 0x0?await gc['getFirstKeyPacket']({'verifyKeyPackets':!0x0}):await gc['getKeyPacket'](g8,{'verifyKeyPackets':!0x0})??await gc['getFirstKeyPacket']({'verifyKeyPackets':!0x0});if(!ge)throw Error('No\x20video\x20packets\x20found\x20in\x20'+g5);let gf=new EncodedVideoPacketSource(gb);return g4['addVideoTrack'](gf,{'disposition':ga['disposition'],'name':g6??ga['name']??void 0x0,'rotation':g7['supportsVideoRotationMetadata']?ga['rotation']:void 0x0}),{'kind':'video','input':g9,'sink':gc,'source':gf,'startPacket':ge,'startTimestamp':ge['timestamp'],'emit':async gg=>{let gh={'decoderConfig':await ga['getDecoderConfig']()??void 0x0},gi=!0x0;for await(let gj of gc['packets'](ge,void 0x0,{'verifyKeyPackets':!0x0}))await gf['add'](gj['clone']({'timestamp':gj['timestamp']-gg}),gi?gh:void 0x0),gi=!0x1;gf['close']();}};},dW=async(g4,g5,g6,g7,g8)=>{const j0=gP;let g9=dT(g5),ga=await g9['getPrimaryAudioTrack']();if(!ga)throw Error('Missing\x20audio\x20track\x20in\x20'+g5);let gb=ga['codec'];if(!gb)throw Error('Unknown\x20audio\x20codec\x20in\x20'+g5);if(g8!==void 0x0&&g8>=await ga['computeDuration']())throw Error('trimBegin\x20excludes\x20the\x20full\x20audio\x20track\x20in\x20'+g5);let gc=new EncodedPacketSink(ga),ge=g8===void 0x0?await gc['getFirstPacket']():await gc['getPacket'](g8)??await gc[j0(0x1ee)]();if(!ge)throw Error('No\x20audio\x20packets\x20found\x20in\x20'+g5);let gf=new EncodedAudioPacketSource(gb);return g4['addAudioTrack'](gf,{'disposition':ga['disposition'],'languageCode':dR(g6)??dR(ga['languageCode']),'name':g7??ga['name']??void 0x0}),{'kind':'audio','input':g9,'sink':gc,'source':gf,'startPacket':ge,'startTimestamp':ge['timestamp'],'emit':async gg=>{let gh={'decoderConfig':await ga['getDecoderConfig']()??void 0x0},gi=!0x0;for await(let gj of gc['packets'](ge))await gf['add'](gj['clone']({'timestamp':gj['timestamp']-gg}),gi?gh:void 0x0),gi=!0x1;gf['close']();}};},dX=(g4,{trimBegin:g5,trimEnd:g6,commonStart:g7})=>{const j1=gP;let g8=g4['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')[j1(0x124)]();if(!dI['test'](g8))throw Error(j1(0x238));let g9=g5===void 0x0?void 0x0:Math['round'](g5*0x3e8),ga=g6===void 0x0?void 0x0:Math['round'](g6*0x3e8),gb=Math['round'](g7*0x3e8);dH['lastIndex']=0x0;let gc=dH['exec'](g8),ge=g8[j1(0x22d)](0x0,gc?.['index']??g8['length'])['trimEnd'](),gf=[],gg=gc?g8['slice'](gc['index']):'';for(;;){dH['lastIndex']=0x0;let gh=dH[j1(0x25c)](gg);if(!gh)break;let gi=gh['index']+gh[0x0]['length'],gj=gg['indexOf']('\x0a',gi)+0x1,gk=gg['indexOf']('\x0a\x0a',gi);gk===-0x1&&(gk=gg['length']);let gl=gh[0x1]?.['trim'](),gm=gh[0x4]?.['trim'](),gn=gg['slice'](gj,gk)['trim'](),go=dN(gh[0x2]),gp=dN(gh[0x3]),gq=Math['max'](go,g9??go)-gb,gr=Math['min'](gp,ga??gp)-gb;if(gr>gq){let gs=dO(gq)+'\x20-->\x20'+dO(gr)+(gm?'\x20'+gm:'');gf['push']([gl,gs,gn]['filter'](Boolean)['join']('\x0a'));}gg=gg['slice'](gk)['trimStart']();}return[ge,...gf]['filter'](Boolean)['join']('\x0a\x0a');},dY=async(g4,g5,g6,g7,g8)=>{const j2=gP;if(g6['type']==='video')return dV(g4,g6[j2(0x154)],g6['label'],g5,g7);if(g6['type']==='audio')return dW(g4,g6['path'],g6['language'],g6['label'],g7);if(dL(g6[j2(0x1ab)])){let g9=dQ(await readFile(g6['path'],'utf8')),ga=new TextSubtitleSource('webvtt');return g4['addSubtitleTrack'](ga,{'disposition':g6['forced']?{'forced':!0x0}:void 0x0,'languageCode':dR(g6['language']),'name':g6['label']}),{'kind':'subtitle','source':ga,'emit':async gb=>{let gc=dX(g9,{'trimBegin':g7,'trimEnd':g8,'commonStart':gb});await ga['add'](gc),ga['close']();}};}throw Error('Unsupported\x20mux\x20input\x20type:\x20'+g6['type']);};var dZ=class{async['mux'](g4){const j3=gP;let {trimBegin:g5,trimEnd:g6}=dU(g4),g7=dS(g4['output']),g8=new X({'format':g7,'target':dG(g4['output'])}),g9=[];try{for(let gc of g4['inputs'])g9['push'](await dY(g8,g7,gc,g5,g6));let ga=g9['filter'](ge=>ge['kind']!=='subtitle');if(!g9['length'])throw Error('No\x20tracks\x20provided\x20for\x20muxing.');let gb=ga['length']>0x0?Math['min'](...ga['map'](ge=>ge['startTimestamp'])):g5??0x0;await g8['start']();for(let ge of g9){if(ge['kind']==='subtitle'){await ge['emit'](gb);continue;}await ge[j3(0x23e)](gb);}return await g8['finalize'](),g4['output'];}catch(gf){throw await g8['cancel']()['catch'](()=>void 0x0),gf;}finally{for(let gg of g9)gg['kind']!=='subtitle'&&gg['input']['dispose']();}}},e0=class{[gP(0x24f)];constructor(g4){this['strategy']=g4;}async['prepare'](){await this['strategy']['prepare']?.();}async['process'](g4){let g5=await this['strategy']['mux'](g4);if(g4['cleanup']){for(let g6 of new Set(g4['inputs']['map'](g7=>g7['path'])))await rm(g6,{'force':!0x0});}return g5;}};const e1=()=>{if(!(process['platform']!=='win32'||process.env.ELECTRON_RUN_AS_NODE!=='1')&&!isatty(process['stderr']['fd'])&&aa()?.['getConsoleSize']?.()?.['columns'])try{let g4=a8('nanospinner/dist/consts.js');g4&&g4['isTTY']===!0x1&&(g4['isTTY']=!0x0,g4['symbols']?.['frames']?.['length']===0x1&&(g4['symbols']['frames']=['-','\x5c','|','/']));}catch{}},e2=g4=>{let g5=process['stderr'];if(!g4||process['platform']!=='win32'||process.env.ELECTRON_RUN_AS_NODE!=='1')return g5;if(!g5['columns']||g5['columns']!==g4){let g6=Object['getOwnPropertyDescriptor'](g5,'columns')??Object['getOwnPropertyDescriptor'](Object['getPrototypeOf'](g5),'columns');if(!g6||g6['writable']||g6['set'])try{g5['columns']=g4;}catch{}if(g5['columns']!==g4){let g7=Object['create'](g5);return Object['defineProperty'](g7,'columns',{'value':g4,'configurable':!0x0,'enumerable':!0x0,'writable':!0x0}),q['warn']('Unable\x20to\x20override\x20stderr.columns;\x20using\x20spinner-local\x20width\x20'+g4+'.'),g7;}}return g5;},e3={'debug':'gray','info':gP(0x13a),'warn':'yellow','error':'red'},e4=g4=>{let g5=g4['toUpperCase'](),g6=O[e3[g4]];return g6(g5);},e5=(g4,g5)=>typeof g5=='string'?g4+'\x20'+g5:g5&&{...g5,'text':(g4+'\x20'+(g5[gP(0x1f0)]??''))['trimEnd']()},e6=(g4,g5)=>{const j4=gP;e1();let g6=A(e4('info')),g7=createSpinner(g4,{'stream':e2(aa()?.['getConsoleSize']?.()?.['columns']??process['stderr'][j4(0x19a)]??process['stdout']['columns']??(process['platform']==='win32'?0x78:0x50))})['start']({'text':g6+'\x20'+g4,'color':g5}),g8=g7['update']['bind'](g7),g9=g7['success']['bind'](g7),ga=g7['error']['bind'](g7);return g7['update']=gb=>g8(e5(g6,gb)),g7['success']=gb=>g9(e5(g6,gb)),g7['error']=gb=>ga(e5(g6,gb)),g7;},e7=async g4=>{const j5=gP;if(!g4['keys']['length'])return;let g5=e6('Decrypting'),g6=new dB(new dD());await g6['prepare']();for(let g7 of g4['inputs']){let g8=extname(g7['path']),g9=g7[j5(0x154)]['replace'](g8,'.dec'+g8);if(!(g7['type']!=='video'&&g7['type']!=='audio')){if(await g6['process']({'input':g7['path'],'output':g9,'keys':g4['keys'],'type':g7['type'],'cleanup':!0x0}),!existsSync(g9))throw Error('Decryption\x20failed\x20for\x20file\x20'+g7['path']+'.\x20Unable\x20to\x20find\x20'+g9);g7['path']=g9;}}g5['success']('Decrypted');},e8=async g4=>{if(g4['skipMux'])return;let g5=e6('Muxing'),g6=new e0(new dZ());await g6['prepare'](),await g6['process']({'inputs':g4['inputs'],'output':g4['output'],'trimBegin':g4['trimBegin'],'trimEnd':g4['trimEnd'],'cleanup':!0x0}),existsSync(g4['output'])?(g5['success']('Muxed'),q['debug']('Muxed:\x20'+g4['output'])):g5['error']('Muxing\x20failed.\x20Output\x20file\x20not\x20found:\x20'+g4['output']);},e9=async g4=>{await e7(g4),await e8(g4);};var ea=class{async['process'](g4){const j6=gP;let g5=await dA({'jobId':g4['jobId'],'title':g4['title'],'entryTitle':g4['entryTitle'],'options':g4['options'],'psshList':g4['transferResult']['psshList']??[],'selectedTracks':g4['transferResult']['selectedTracks'],'extension':g4['extension'],'resource':g4['resource']});return await e9({'inputs':g4['transferResult']['downloaded'],'output':g4['outputPath'],'keys':g5,'trimBegin':g4['options'][j6(0x13d)],'trimEnd':g4['options']['trimEnd'],'binariesDir':g4['settings']['get']('binariesDir'),'skipMux':g4['options']['skipMux']}),await g4['afterDownload'](),{'outputPath':g4['outputPath'],'contentKeys':g5};}};const eb=async({message:g4,choices:g5})=>g5['length']?await checkbox({'message':g4,'pageSize':0xc,'choices':g5,'loop':!0x1}):[],ec={'selectTracks':async({inventory:g4})=>{const j7=gP;let g5=await eb({'message':'Select\x20video\x20streams','choices':await Promise['all'](g4['videos']['map'](async(ga,gb)=>({'name':await ga['getDisplayWidth']()+'x'+await ga['getDisplayHeight']()+'\x20|\x20'+(cM(await ga['getBitrate']())||'?')+j7(0x13e)+(await ga['getCodec']()??'?')+'\x20|\x20'+await cN(ga),'value':dp(ga),'checked':gb===0x0})))}),g6=g4['videos']['filter'](ga=>g5['includes'](dp(ga))),g7=await eb({'message':'Select\x20audio\x20streams','choices':await Promise['all'](g4['audios']['map'](async(ga,gb)=>({'name':''+(await ga['getName']()?await ga[j7(0x19c)]()+'\x20|\x20':'')+(cM(await ga[j7(0x1e8)]())||'?')+'\x20Kbps\x20|\x20'+(await ga['getCodec']()?await ga[j7(0x1a6)]()+'\x20|\x20':'')+(await ga['getLanguageCode']()||'und')+'\x20|\x20'+(await ga['getNumberOfChannels']()??'?')+'CH\x20|\x20'+await cN(ga),'value':dp(ga),'checked':gb===0x0})))}),g8=g4['audios']['filter'](ga=>g7['includes'](dp(ga))),g9=await eb({'message':'Select\x20subtitles','choices':await Promise['all'](g4['subtitles']['map'](async(ga,gb)=>({'name':(await ga['getCodec']()??'?')+'\x20|\x20'+(await ga['getLanguageCode']()||'und')+'\x20|\x20'+await cN(ga),'value':dp(ga),'checked':gb===0x0})))});return cL({'videos':g6,'audios':g8,'subtitles':g4['subtitles']['filter'](ga=>g9['includes'](dp(ga)))});}},ed=g4=>g4['select']?ec:cX,ee=async(g4,g5)=>{const j8=gP;let g6=g5+'\x20∙\x20';if(g4['type']==='subtitle'?g6+='SUBTITLES':g6+=g4['type']['toUpperCase'](),g4['isVideoTrack']()){let [g7,g8,g9]=await Promise['all']([g4['getDisplayWidth'](),g4['getDisplayHeight'](),g4['getBitrate']()]);g7&&(g6+='\x20∙\x20'+g7+'x'+g8),g9&&(g6+='\x20∙\x20'+Math['round'](g9/0x3e8)+'\x20KiB/s');}if(g4['isAudioTrack']()){let [ga,gb,gc,ge]=await Promise['all']([g4['getLanguageCode'](),g4['getName'](),g4['getSampleRate'](),g4['getBitrate']()]);ga&&(g6+='\x20∙\x20'+ga['toUpperCase']()),gb&&(g6+='\x20('+gb+')'),gc&&(g6+='\x20∙\x20'+gc+'\x20kHz'),ge&&(g6+='\x20∙\x20'+Math['round'](ge/0x3e8)+'\x20KiB/s');}if(g4['type']==='subtitle'){let [gf,gg,gh]=await Promise['all']([g4['getLanguageCode'](),g4['getName'](),g4['getDisposition']()]);gf&&(g6+=j8(0x1b6)+gf[j8(0x1cb)]()),gg&&(g6+='\x20('+gg+')'),gh[j8(0x1cf)]&&(g6+=j8(0x1d4));}return g6;};var ef=a5((g4,g5)=>{function g6(g7){var g8=new g7(),g9=g8;function ga(){var gc=g8;return gc['next']?g8=gc['next']:(g8=new g7(),g9=g8),gc['next']=null,gc;}function gb(gc){g9['next']=gc,g9=gc;}return{'get':ga,'release':gb};}g5['exports']=g6;}),eg=a5((g4,g5)=>{var g6=ef();function g7(gb,gc,ge){if(typeof gb=='function'&&(ge=gc,gc=gb,gb=null),!(ge>=0x1))throw Error('fastqueue\x20concurrency\x20must\x20be\x20equal\x20to\x20or\x20greater\x20than\x201');var gf=g6(g9),gg=null,gh=null,gi=0x0,gj=null,gk={'push':gr,'drain':g8,'saturated':g8,'pause':gm,'paused':!0x1,get 'concurrency'(){return ge;},set 'concurrency'(gy){if(!(gy>=0x1))throw Error('fastqueue\x20concurrency\x20must\x20be\x20equal\x20to\x20or\x20greater\x20than\x201');if(ge=gy,!gk['paused']){for(;gg&&gi<ge;)gi++,gt();}},'running':gl,'resume':gp,'idle':gq,'length':gn,'getQueue':go,'unshift':gs,'empty':g8,'kill':gu,'killAndDrain':gv,'error':gx,'abort':gw};return gk;function gl(){return gi;}function gm(){const j9=b;gk[j9(0x206)]=!0x0;}function gn(){const ja=b;for(var gy=gg,gz=0x0;gy;)gy=gy[ja(0x187)],gz++;return gz;}function go(){for(var gy=gg,gz=[];gy;)gz['push'](gy['value']),gy=gy['next'];return gz;}function gp(){if(gk['paused']){if(gk['paused']=!0x1,gg===null){gi++,gt();return;}for(;gg&&gi<ge;)gi++,gt();}}function gq(){return gi===0x0&&gk['length']()===0x0;}function gr(gy,gz){const jb=b;var gA=gf['get']();gA['context']=gb,gA['release']=gt,gA[jb(0x220)]=gy,gA['callback']=gz||g8,gA['errorHandler']=gj,gi>=ge||gk['paused']?gh?(gh['next']=gA,gh=gA):(gg=gA,gh=gA,gk['saturated']()):(gi++,gc['call'](gb,gA['value'],gA['worked']));}function gs(gy,gz){var gA=gf['get']();gA['context']=gb,gA['release']=gt,gA['value']=gy,gA['callback']=gz||g8,gA['errorHandler']=gj,gi>=ge||gk['paused']?gg?(gA['next']=gg,gg=gA):(gg=gA,gh=gA,gk['saturated']()):(gi++,gc['call'](gb,gA['value'],gA['worked']));}function gt(gy){const jc=b;gy&&gf['release'](gy);var gz=gg;gz&&gi<=ge?gk['paused']?gi--:(gh===gg&&(gh=null),gg=gz['next'],gz['next']=null,gc['call'](gb,gz[jc(0x220)],gz['worked']),gh===null&&gk['empty']()):--gi===0x0&&gk['drain']();}function gu(){gg=null,gh=null,gk['drain']=g8;}function gv(){gg=null,gh=null,gk['drain'](),gk['drain']=g8;}function gw(){const jd=b;var gy=gg;for(gg=null,gh=null;gy;){var gz=gy['next'],gA=gy['callback'],gB=gy[jd(0x271)],gC=gy['value'],gD=gy['context'];gy['value']=null,gy['callback']=g8,gy['errorHandler']=null,gB&&gB(Error('abort'),gC),gA['call'](gD,Error('abort')),gy['release'](gy),gy=gz;}gk['drain']=g8;}function gx(gy){gj=gy;}}function g8(){}function g9(){this['value']=null,this['callback']=g8,this['next']=null,this['release']=g8,this['context']=null,this['errorHandler']=null;var gb=this;this['worked']=function(gc,ge){var gf=gb['callback'],gg=gb['errorHandler'],gh=gb['value'];gb['value']=null,gb['callback']=g8,gb['errorHandler']&&gg(gc,gh),gf['call'](gb['context'],gc,ge),gb['release'](gb);};}function ga(gb,gc,ge){typeof gb=='function'&&(ge=gc,gc=gb,gb=null);function gf(gm,gn){gc['call'](this,gm)['then'](function(go){gn(null,go);},gn);}var gg=g7(gb,gf,ge),gh=gg['push'],gi=gg['unshift'];return gg['push']=gj,gg['unshift']=gk,gg['drained']=gl,gg;function gj(gm){var gn=new Promise(function(go,gp){gh(gm,function(gq,gr){if(gq){gp(gq);return;}go(gr);});});return gn['catch'](g8),gn;}function gk(gm){const je=b;var gn=new Promise(function(go,gp){gi(gm,function(gq,gr){if(gq){gp(gq);return;}go(gr);});});return gn[je(0x223)](g8),gn;}function gl(){return new Promise(function(gm){const jf=b;process[jf(0x263)](function(){if(gg['idle']())gm();else{var gn=gg['drain'];gg['drain']=function(){const jg=b;typeof gn==jg(0x1f9)&&gn(),gm(),gg['drain']=gn;};}});});}}g5['exports']=g7,g5['exports']['promise']=ga;}),eh=a7(eg(),0x1);const ei=T[gP(0x1bf)]??T,ej=0x493e0,ek=(g4={})=>{const jh=gP;let g5=g4['maxRetries']??0x5,g6=!0x1,g7=!0x1,g8=null,{proxy:g9}=g4,ga=g9?new ProxyAgent({'uri':g9,'allowH2':!0x0}):new Agent({'allowH2':!0x0}),gb=ei['create']({'fetch':g4['fetch'],'dispatcher':ga,'proxy':g9,'timeout':ej,'retry':{'limit':g5,'methods':['get',jh(0x13c)],'statusCodes':[0x198,0x19d,0x1ad,0x1f4,0x1f6,0x1f7,0x1f8],'backoffLimit':0x7530},'throwHttpErrors':!0x0,'redirect':'follow','headers':{'user-agent':'Mozilla/5.0\x20(Windows\x20NT\x2010.0;\x20Win64;\x20x64)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/127.0.0.0\x20Safari/537.36'}});return Object['assign'](gb,{'close':async()=>{if(g8)return g8;g6||g7||(g6=!0x0,g8=ga['close'](),await g8);},'destroy':async gc=>{if(g8)return g8;g6||g7||(g6=!0x0,g7=!0x0,g8=ga['destroy'](gc??null),await g8);}});},el=g4=>new Promise(g5=>setTimeout(g5,g4)),em=async(g4,g5)=>{const ji=gP;let g6=await Q['stat'](g5)[ji(0x223)](()=>null);(!g6||!g6['isDirectory']())&&await Q['mkdir'](g5,{'recursive':!0x0});let g7=en(g4,g5),g8=await Q['stat'](g7)['catch'](()=>null);return(!g8||!g8[ji(0x115)]())&&await Q[ji(0x11a)](g7,{'recursive':!0x0}),g7;},en=(g4,g5)=>{const jj=gP;let g6=M[jj(0x197)](g4),g7=M['parse'](g4)['name'],g8=createHash('sha1')['update'](g6)['digest']('hex')['slice'](0x0,0xa);return M['join'](g5,g7+'-'+g8);},eo=async g4=>{const jk=gP;let g5=M['dirname'](g4),g6=M['resolve'](g5);M['parse'](g6)['root']!==g6&&(await Q['stat'](g5)['then'](()=>!0x0)[jk(0x223)](()=>!0x1)||await Q['mkdir'](g5,{'recursive':!0x0}));},ep=async(...g4)=>{let g5=[];for(let g6 of g4)g6&&g5['push'](Q['rm'](g6,{'recursive':!0x0,'force':!0x0})['catch'](()=>void 0x0));await Promise['all'](g5);},eq=g4=>g4+'.part.json',er=g4=>{const jl=gP;if(g4['filePath'])return g4['filePath'];if(g4['output'])return eq(g4['output']);throw Error(jl(0x259));},es=g4=>{const jm=gP;if(!g4||typeof g4!='object')return!0x1;let g5='code'in g4?g4['code']:void 0x0;return g5==='EPERM'||g5===jm(0x17b)||g5==='EBUSY';},et=async(g4,g5)=>{let g6=R['platform']==='win32'?[0x0,0x32,0x96,0x12c,0x1f4]:[0x0],g7;for(let g8 of g6){g8>0x0&&await el(g8);try{await Q['rename'](g4,g5);return;}catch(g9){if(g7=g9,!es(g9))break;await Q['rm'](g5,{'force':!0x0})['catch'](()=>void 0x0);try{await Q['rename'](g4,g5);return;}catch(ga){if(g7=ga,!es(ga))break;}}}throw g7;};var eu=class{async['get'](g4){const jn=gP;let g5=er(g4);if(!await Q[jn(0x1d6)](g5)['then'](()=>!0x0)['catch'](()=>!0x1))return null;try{let g6=await Q[jn(0x157)](g5,'utf8');return JSON['parse'](g6);}catch{return null;}}async['set'](g4,g5){const jo=gP;let g6=er(g4);await eo(g6);let g7=g6+'.'+R[jo(0x1a1)]+'.'+Date['now']()['toString'](0x24)+'.tmp';await Q['writeFile'](g7,JSON['stringify'](g5));try{await et(g7,g6);}finally{try{await Q['rm'](g7,{'force':!0x0});}catch{}}}async['delete'](g4){let g5=er(g4);await Q['rm'](g5,{'force':!0x0})['catch'](()=>void 0x0);}};const ev=g4=>M['resolve'](g4),ew=g4=>createHash('sha1')[gP(0x1b4)](ev(g4))['digest'](gP(0x240)),ex=g4=>g4['map']((g5,g6)=>({'index':g6,'start':g5[gP(0x112)],'end':g5['end'],'output':g5['output'],'completed':!0x1,'bytesWritten':0x0})),ey=(g4,g5)=>g4['parts']['length']===g5['length']?g4['parts']['every']((g6,g7)=>{const jp=gP;let g8=g5[g7];return g8?g6['start']===g8[jp(0x112)]&&g6['end']===g8['end']&&(g6['output']??null)===(g8[jp(0x190)]??null):!0x1;}):!0x1,ez=(g4,g5)=>!g5||!g4['sourceSignature']?!0x0:g4[gP(0x181)]===g5,eA=g4=>{const jq=gP;let g5=g4['parts']['reduce']((g6,g7)=>g6+g7['bytesWritten'],0x0);return g5>0x0?g5:g4[jq(0x159)];},eB=g4=>{const jr=gP;if(!g4||typeof g4!='object')return!0x1;let g5=g4;return g5['version']===0x2&&typeof g5[jr(0x260)]=='string'&&Array['isArray'](g5['parts'])&&typeof g5['bytesDownloaded']=='number';};var eC=class{['key'];['output'];['filePath'];[gP(0x125)];['store'];['target'];['trustExplicitKey'];constructor(g4={}){const js=gP;if(this['output']=g4[js(0x190)],this['filePath']=g4['filePath'],this['key']=g4['key']??(this['output']?ew(this['output']):''),!this['key'])throw Error('Resume\x20key\x20is\x20required\x20when\x20output\x20is\x20not\x20provided');this[js(0x222)]=g4['store']??new eu(),this['cleanupOnSuccess']=g4['cleanupOnSuccess']??!0x0,this['target']={'key':this['key'],'output':this['output'],'filePath':this['filePath']},this['trustExplicitKey']=typeof g4['key']=='string'&&g4['key']['length']>0x0;}async['read'](){let g4=await this['store']['get'](this['target']);return eB(g4)?g4:null;}async['write'](g4){const jt=gP;let g5=new Date()['toISOString'](),g6={...g4,'version':0x2,'key':this['key'],'output':g4['output']??this[jt(0x190)],'bytesDownloaded':eA(g4),'createdAt':g4['createdAt']||g5,'updatedAt':g5};await this['store']['set'](this['target'],g6);}async['delete'](){await this['store']['delete'](this['target']);}['createState'](g4){const ju=gP;let g5=new Date()['toISOString']();return{'version':0x2,'key':this['key'],'output':this['output'],'input':g4['input'],'bytesTotal':g4['bytesTotal'],'bytesDownloaded':0x0,'parts':ex(g4['parts']),'sourceSignature':g4[ju(0x181)],'planner':g4['planner'],'createdAt':g5,'updatedAt':g5};}[gP(0x1fd)](g4,g5){const jv=gP;let g6=g4['version']!==0x2,g7=g4['key']!==this['key'],g8=!this['trustExplicitKey']&&!ez(g4,g5['sourceSignature']),g9=!ey(g4,g5['parts']);if(g6||g7||g8||g9)return{'state':this['createState'](g5),'reset':!0x0};let ga={...g4,'key':this['key'],'output':this['output'],'input':g5['input'],'bytesTotal':g5['bytesTotal'],'sourceSignature':g5['sourceSignature'],'planner':g5['planner'],'parts':g5[jv(0x1f2)]['map']((gb,gc)=>{const jw=jv;let ge=g4[jw(0x1f2)][gc];return{'index':gc,'start':gb['start'],'end':gb['end'],'output':gb['output'],'completed':ge?.['completed']??!0x1,'bytesWritten':ge?.['bytesWritten']??0x0};}),'createdAt':g4['createdAt'],'updatedAt':g4['updatedAt']};return ga['bytesDownloaded']=eA(ga),{'state':ga,'reset':!0x1};}['markPartCompleted'](g4,g5,g6){const jx=gP;let g7=g4['parts'][g5];if(!g7)return g4;let g8=g7['bytesWritten'];return g7['completed']=!0x0,g7[jx(0x236)]=g6,g4['bytesDownloaded']=Math['max'](0x0,g4['bytesDownloaded']-g8+g6),g4['updatedAt']=new Date()['toISOString'](),g4;}async['getProgress'](){const jy=gP;let g4=await this['read']();if(!g4)return null;let g5=g4[jy(0x159)];if(g4['bytesTotal']){let g8=g4['bytesTotal'];return{'bytesDownloaded':g5,'totalBytes':g8,'percentComplete':g8>0x0?Math['round'](g5/g8*0x64):0x0};}let g6=g4['parts']['length'],g7=g4['parts']['filter'](g9=>g9['completed'])['length'];return{'bytesDownloaded':g5,'totalBytes':null,'percentComplete':g6>0x0?Math['round'](g7/g6*0x64):0x0,'segmentsCompleted':g7,'segmentsTotal':g6};}};const eD=0x8*0x2**0x14,eE=(g4,g5,g6)=>{const jz=gP;let g7=jz(0x1b0)+g6+'.part';return M['join'](g5,g7);},eF=(g4,g5,g6)=>{let g7=Math['ceil'](g4/Math['max'](0x1,g5));return Math['max'](0x1,Math['min'](g7,Math['max'](0x1,g6)));},eG=(g4,g5,g6)=>{let g7=eF(g4,g5,g6),g8=[],g9=0x0;for(;g9<g4;){let ga=Math['min'](g4-0x1,g9+g7-0x1);g8['push']([g9,ga]),g9=ga+0x1;}return g8;},eH=g4=>{let [g5,g6]=g4;return'bytes='+g5+'-'+(g6||'');},eI=g4=>eG(g4['contentLength'],g4['maxWorkerCount'],g4['maxChunkSize']??eD)['map'](g5=>{const jA=gP;let [g6,g7]=g5,g8=new Headers(g4['requestInit']?.[jA(0x164)]);return g8['set']('Range',eH([g6,g7])),{'url':g4['url'],'headers':g8,'start':g6,'end':g7};}),eJ=g4=>{const jB=gP;let g5=g4?Error('The\x20operation\x20was\x20aborted',{'cause':g4}):Error('The\x20operation\x20was\x20aborted');return g5['name']=jB(0x160),g5;},eK=g4=>{if(!(g4 instanceof Error))return!0x1;if(g4['name']==='AbortError'||g4['code']==='ABORT_ERR')return!0x0;let g5=g4['cause'];return g5 instanceof Error&&g5['name']==='AbortError';},eL=async g4=>await g4['client'][gP(0x126)](g4['url'],{'redirect':'follow',...g4['requestInit']}),eM=(g4,g5,g6)=>async g7=>{if(g6?.['aborted'])throw eJ();let g8=typeof g5=='number'?{'flags':'r+','start':g5}:{'flags':'w'},g9=K['createWriteStream'](g4,g8),ga=Readable['fromWeb'](g7['body']);try{await pipeline(ga,g9,{'signal':g6});}catch(gb){throw eK(gb)?eJ(gb):gb;}if(g6?.['aborted'])throw eJ();return g7;},eN=(g4,g5,g6)=>g7=>{const jC=gP;if(g6?.['aborted'])throw eJ();let g8=parseInt(g7['headers'][jC(0x126)]('content-length')||'0');if(g4['increase'](g8),g6?.['aborted'])throw eJ();return g5&&!g6?.['aborted']?g5(g4['toProgressInfo']()):g4['log'](),g7;},eO=g4=>typeof g4=='boolean'?{'enabled':g4,'cleanupOnSuccess':!0x0}:g4?{'enabled':g4[gP(0x1bd)]??!0x0,'key':g4['key'],'store':g4['store'],'filePath':g4['filePath'],'cleanupOnSuccess':g4['cleanupOnSuccess']??!0x0}:{'enabled':!0x1,'cleanupOnSuccess':!0x0},eP=g4=>({'tempDir':g4['tempDir']??process['cwd'](),'maxRetries':g4['maxRetries']??0x5,'maxChunkSize':g4['maxChunkSize']??eD,'maxWorkerCount':g4['maxWorkerCount']??0x4,'resume':eO(g4['resume']),'proxy':g4['proxy'],'requestInit':g4['requestInit'],'fetchFn':g4['fetchFn']}),eQ={'total':{'b':0x0,'mb':0x0},'current':{'b':0x0,'mb':0x0},'chunkSize':0x0,'chunkSizes':[],'averageSize':{'b':0x0,'mb':0x0},'averageTotal':{'b':0x0,'mb':0x0},'speed':{'bps':0x0,'mbps':0x0}},eR=g4=>{let g5=Math['floor'](g4/0xe10),g6=Math['floor'](g4%0xe10/0x3c),g7=g4%0x3c,g8=g5>0x0?g5+'h':'',g9=g6>0x0?g6+'m':'',ga=g7>0x0?g7+'s':'';return g5>0x0?g8+'\x20'+(g9||'0m')+'\x20'+(ga&&''+ga):!g5&&g6>0x0?g9+'\x20'+(ga&&''+ga):ga;},eS=(g4=0x0)=>{let g5=structuredClone(eQ),g6=0x0,g7=setInterval(()=>{g6>0x1&&(g5['speed']['bps']=g5['current']['b']/g6),g6+=0.5;},0x1f4);return{'state':g5,'setTotal':g8=>{g5['total']['b']=g8,g5['total']['mb']=g8/0x400/0x400;},'setCurrent'(g8){const jD=b;g5[jD(0x22a)]['b']=g8,g5['current']['mb']=g8/0x400/0x400;},'increase'(g8){const jE=b;g5['current']['b']+=g8,g5['current']['mb']=g5['current']['b']/0x400/0x400,g5['speed']['mbps']=g5['speed']['bps']/0x400/0x400,g5['chunkSize']=g8,g5['chunkSizes']['push'](g8),g5[jE(0x128)]['b']=g5['current']['b']/g5['chunkSizes'][jE(0x1fc)],g5['averageSize']['mb']=g5[jE(0x128)]['b']/0x400/0x400,g5['averageTotal']['b']=g4*g5['averageSize']['b'],g5['averageTotal']['mb']=g5[jE(0x21e)]['b']/0x400/0x400;},'stop'(){clearInterval(g7),Object['assign'](g5,eQ);},'log'(){const jF=b;let g8=g5[jF(0x22a)]['b'],g9=g5[jF(0x18c)]['b'],ga=g8+(g9?'/'+g9:'');stdout['write']('\x0dDownloading\x20['+ga+']');},'stopLog'(){stdout['write']('\x0a');},'toString'(){const jG=b;let g8='';g5['speed']['bps']&&(g8+=g5['speed']['mbps']['toFixed'](0x1)+'\x20MB/s\x20–\x20'),g8+=''+g5['current']['mb']['toFixed'](0x1),g5['total']['b']?g8+=jG(0x162)+g5['total']['mb']['toFixed'](0x1)+'\x20MB':g8+='\x20MB';let g9=g5['total']['b']||g5['averageTotal']['b'];if(g9){let ga=g9-g5['speed']['bps']*g6,gb=Math['round'](ga/g5['speed']['bps']),gc=eR(gb);gb&&isFinite(gb)&&gc&&(g8+=',\x20'+gc+'\x20left');}return g8;},'toProgressInfo'(){let g8=g5['total']['b']||null;return{'bytesDownloaded':g5['current']['b'],'totalBytes':g8,'percentComplete':g8?g5['current']['b']/g8*0x64:null,'bytesPerSecond':g5['speed']['bps'],'estimatedSecondsRemaining':g5['speed']['bps']>0x0&&g8?(g8-g5['current']['b'])/g5['speed']['bps']:null};}};},eT=new Set(['authorization','cookie','set-cookie','x-amz-date','x-amz-security-token','x-amz-content-sha256','x-goog-date','x-goog-security-token']),eU=(g4,g5={})=>{const jH=gP;if(!g4)return[];let g6=g5[jH(0x1fa)]??!0x1,g7=[];return new Headers(g4)['forEach']((g8,g9)=>{const jI=jH;!g6&&eT['has'](g9[jI(0x212)]())||g7['push']([g9,g8]);}),g7['sort'](([g8],[g9])=>g8['localeCompare'](g9)),g7;},eV=g4=>{try{let g5=new URL(g4),g6=g5['pathname']['split']('/')['map'](g7=>g7&&(g7['includes']('=')||g7['includes'](',')?':volatile':g7))['join']('/');return''+g5['origin']+g6;}catch{let g7=String(g4);return(g7['split']('#')[0x0]??g7)['split']('?')[0x0]||g7;}},eW=g4=>({'url':eV(g4[gP(0x1a8)]),'start':g4[gP(0x112)],'end':g4['end'],'output':g4[gP(0x190)],'headers':eU(g4['headers'])}),eX=g4=>{const jJ=gP;let g5={'input':Array['isArray'](g4[jJ(0x12d)])?g4['input'][jJ(0x13b)](g6=>eW(g6)):eV(String(g4['resolvedUrl'])),'requestHeaders':eU(g4['requestHeaders']),'parts':g4['parts']['map'](g6=>eW(g6)),'maxWorkerCount':g4['maxWorkerCount'],'maxChunkSize':g4['maxChunkSize']};return createHash('sha1')[jJ(0x1b4)](JSON['stringify'](g5))['digest']('hex');},eY=async g4=>{const jK=gP;if(!g4['manager'])return null;let g5={'input':Array['isArray'](g4[jK(0x12d)])?g4['input']:g4['resolvedUrl'],'parts':g4['parts'],'bytesTotal':g4['bytesTotal'],'sourceSignature':g4['sourceSignature'],'planner':{'maxWorkerCount':g4['maxWorkerCount'],'maxChunkSize':g4['maxChunkSize']}},g6=await g4['manager']['read'](),g7=(g6?g4['manager']['reconcileState'](g6,g5):null)?.['state']??g4['manager']['createState'](g5);return await g4['manager']['write'](g7),g7;},eZ=g4=>{const jL=gP;if(g4&&!g4[jL(0x1f2)]['every'](g5=>g5['completed']))throw Error('Not\x20all\x20segments\x20were\x20downloaded\x20successfully.\x20Try\x20resuming\x20later.');},f0=g4=>{const jM=gP;if(Array['isArray'](g4[jM(0x12d)]))return g4[jM(0x12d)]['map']((g5,g6)=>({...g5,'output':eE(g4['url'],g4['tempFileDir'],g6)}));if(!g4['acceptsRanges'])throw Error('Unable\x20to\x20get\x20parts');if(!g4['size'])throw Error('Size\x20is\x20not\x20known');return eI({'url':g4['url'],'requestInit':g4['requestInit'],'contentLength':g4[jM(0x114)],'maxWorkerCount':g4['maxWorkerCount'],'maxChunkSize':g4['maxChunkSize']});},f1=async g4=>{const jN=gP;if(!g4['parts'][jN(0x20b)](g6=>typeof g6['start']=='number'&&(g6['output']??g4['output'])===g4['output'])||await Q['stat'](g4['output'])['then'](()=>!0x0)['catch'](()=>!0x1))return;let g5=await Q['open'](g4['output'],'w');g4['size']&&g4['size']>0x0&&await g5['truncate'](g4['size']),await g5['close']();},f2=()=>{const jO=gP;let g4=Error('The\x20operation\x20was\x20aborted');return g4['name']=jO(0x160),g4;},f3=g4=>{let g5=g4['match'](/bytes\s+(\d+)-(\d+)\/(\d+|\*)/i);if(!g5||!g5[0x1]||!g5[0x2]||!g5[0x3])return null;let g6=parseInt(g5[0x1],0xa),g7=parseInt(g5[0x2],0xa),g8=g5[0x3];if(!Number['isFinite'](g6)||!Number['isFinite'](g7)||g7<g6)return null;if(g8==='*')return{'start':g6,'end':g7,'total':null};let g9=parseInt(g8,0xa);return!Number['isFinite'](g9)||g9<=0x0?null:{'start':g6,'end':g7,'total':g9};},f4=(g4,g5)=>{const jP=gP;if(typeof g5[jP(0x112)]!='number'||typeof g5['end']!=jP(0x1b5))return;if(g4['status']!==0xce)throw Error('Range\x20request\x20failed\x20for\x20bytes='+g5['start']+'-'+g5['end']+':\x20expected\x20206,\x20got\x20'+g4['status']);let g6=g4['headers']['get']('content-range');if(!g6)throw Error('Range\x20request\x20failed\x20for\x20bytes='+g5['start']+'-'+g5['end']+':\x20missing\x20Content-Range\x20header');let g7=f3(g6);if(!g7)throw Error('Range\x20request\x20failed\x20for\x20bytes='+g5['start']+'-'+g5['end']+':\x20invalid\x20Content-Range\x20\x22'+g6+'\x22');if(g7['start']!==g5['start']||g7['end']!==g5['end'])throw Error('Range\x20request\x20failed\x20for\x20bytes='+g5['start']+'-'+g5['end']+':\x20got\x20bytes='+g7['start']+'-'+g7['end']);},f5=async(g4,g5,g6)=>{const jQ=gP;let g7=g4[jQ(0x164)][jQ(0x126)]('content-length');if(g7){let g9=parseInt(g7,0xa);if(Number['isFinite'](g9)&&g9>0x0)return g9;}let g8=g4['headers']['get']('content-range');if(g8){let ga=g8['match'](/bytes\s+(\d+)-(\d+)\//i);if(ga&&ga[0x1]&&ga[0x2]){let gb=parseInt(ga[0x1],0xa),gc=parseInt(ga[0x2],0xa);if(Number['isFinite'](gb)&&Number['isFinite'](gc)&&gc>=gb)return gc-gb+0x1;}}return typeof g5['start']=='number'&&typeof g5['end']=='number'?Math['max'](0x0,g5['end']-g5['start']+0x1):g5['output']&&g5['output']!==g6?Q[jQ(0x1d6)](g5[jQ(0x190)])['then'](ge=>ge['size'])['catch'](()=>0x0):0x0;},f6=(g4,g5)=>g4['map']((g6,g7)=>g7)['filter'](g6=>!(g5?.['parts'][g6]?.['completed']??!0x1)),f7=g4=>{let g5=Promise['resolve']();return{'enqueue':()=>(g5=g5['then'](g4),g5),'onIdle':()=>g5};},f8=async g4=>{const jR=gP;let g5=g4['signal']??g4[jR(0x16f)]?.['signal']??void 0x0,g6=()=>{if(g5?.['aborted'])throw f2();};g6();let g7=f6(g4['parts'],g4['resumeState']),g8=eh['promise'](async gh=>{const jS=jR;let {index:gi,part:gj}=gh;g6();let gk=await eL({'index':gi,'client':g4['client'],'url':gj['url'],'requestInit':{...g4['requestInit'],'signal':g5,'headers':gj['headers']??g4['requestInit']?.[jS(0x164)]}});if(g6(),f4(gk,gj),await eM(gj['output']??g4['output'],gj['start'],g5)(gk),eN(g4['progress'],g4['onProgress'],g5)(gk),g6(),g4['resumeState']&&g4['resumeManager']){let gl=await f5(gk,gj,g4['output']);g4['resumeManager']['markPartCompleted'](g4['resumeState'],gi,gl),await gc['enqueue']();}},g4['maxWorkerCount']),g9=()=>{g8['pause'](),g8['killAndDrain'](),g8['kill']();};if(g5?.[jR(0x143)])throw g9(),f2();let ga=()=>{},gb=g5?new Promise((gh,gi)=>{let gj=()=>{g9(),gi(f2());};g5['addEventListener']('abort',gj,{'once':!0x0}),ga=()=>g5['removeEventListener']('abort',gj);}):null,gc=f7(async()=>{const jT=jR;!g4['resumeState']||!g4[jT(0x229)]||await g4['resumeManager']['write'](g4['resumeState']);}),ge=g7['map'](gh=>{let gi=g4['parts'][gh];return gi?(g6(),g8['push']({'index':gh,'part':gi})):Promise['resolve']();}),gf=[];try{let gh=Promise['allSettled'](ge);gb&&(await Promise['race']([gh,gb]),g6()),gf=await gh;}finally{ga(),await gc['onIdle']();}let gg=gf['find'](gi=>gi[jR(0x23b)]==='rejected');if(gg?.['status']==='rejected')throw gg['reason'];},f9=async(g4,g5)=>{await new Promise((g6,g7)=>{const jV=b;let g8=K['createReadStream'](g4),g9=()=>{const jU=b;g5['off']('error',ga),g8[jU(0x252)]('error',gb),g8['off']('end',gc);},ga=ge=>{g9(),g7(Error('Output\x20write\x20stream\x20error',{'cause':ge}));},gb=ge=>{g9(),g7(Error('Segment\x20read\x20stream\x20error',{'cause':ge}));},gc=()=>{g9(),g6();};g5['on'](jV(0x15d),ga),g8['on']('error',gb),g8['on']('end',gc),g8['pipe'](g5,{'end':!0x1});});},fa=async g4=>{let g5=g4['parts']['map'](g7=>g7['output'])['filter'](g7=>!!g7&&g7!==g4['output']);if(!g5['length'])return;let g6=K['createWriteStream'](g4['output']);for(let g7 of g5)await f9(g7,g6);g6['end'](),await finished(g6);},fb=async g4=>{const jW=gP;if(!g4['expectedSize'])return;let g5=await Q['stat'](g4['output'])['then'](g6=>g6['size'])['catch'](()=>null);if(g5&&g5!==g4['expectedSize'])throw Error('Actual\x20size\x20'+g5+jW(0x1c2)+g4['expectedSize']);},fc=async g4=>{const jX=gP;g4['resumeManager']&&g4['resumeManager'][jX(0x125)]&&await g4['resumeManager']['delete'](),await ep(g4['tempFileDir']);},fd=async g4=>{const jY=gP;let g5=eX({'input':g4['input'],'resolvedUrl':g4['url'],'parts':g4['parts'],'requestHeaders':g4[jY(0x16f)]?.['headers'],'maxWorkerCount':g4['maxWorkerCount'],'maxChunkSize':g4['maxChunkSize']}),g6=await eY({'manager':g4['resumeManager'],'input':g4['input'],'resolvedUrl':g4[jY(0x1a8)],'parts':g4['parts'],'bytesTotal':g4['size']??void 0x0,'sourceSignature':g5,'maxWorkerCount':g4['maxWorkerCount'],'maxChunkSize':g4['maxChunkSize']}),g7=eS(g4['parts']['length']);g4['size']&&g7['setTotal'](g4['size']),g6?.['bytesDownloaded']&&g7['setCurrent'](g6[jY(0x159)]),await f1({'output':g4['output'],'size':g4['size'],'parts':g4['parts']});try{await f8({'parts':g4['parts'],'output':g4['output'],'maxWorkerCount':g4['maxWorkerCount'],'client':g4['client'],'requestInit':g4['requestInit'],'progress':g7,'onProgress':g4['onProgress'],'resumeState':g6,'resumeManager':g4[jY(0x229)],'signal':g4['signal']});}finally{g7['stop'](),g4['onProgress']||g7['stopLog']();}eZ(g6),await fa({'output':g4['output'],'parts':g4['parts']}),await fb({'output':g4['output'],'expectedSize':Array[jY(0x191)](g4['input'])?null:g4['size']}),await fc({'tempFileDir':g4['tempFileDir'],'resumeManager':g4['resumeManager']});},fe=async g4=>{const jZ=gP;let g5=new Headers(g4['requestInit']?.['headers']);g5['set']('Range','bytes=0-0');let g6=Array['isArray'](g4['input'])?g4['input'][0x0]?.['url']:g4[jZ(0x12d)];if(!g6)throw Error('Input\x20is\x20empty');let g7=await g4['client']['head'](g6,{...g4['requestInit'],'headers':g5}),g8=g7['headers'][jZ(0x126)]('content-type'),g9=g7['headers']['get']('content-length'),ga=g7['headers']['get']('content-range'),gb=ga?.['split']('/')?.[0x1]||g9,gc=gb&&!Array['isArray'](g4['input'])?parseInt(gb,0xa):null,ge=g7['headers']['get']('accept-ranges')==='bytes'||!!ga?.['includes']('bytes')||!!g8?.['includes']('video')||!!g8?.['includes']('audio')||!!g8?.['includes']('octet-stream');return{'url':g7['url'],'size':gc,'acceptsRanges':ge};};var ff=class gI{[gP(0x12d)];['output'];['resume'];['onProgress'];['config'];['client'];['resumeManager'];['executed']=!0x1;[gP(0x1de)];['tempFileDir'];constructor(g4){const k0=gP;this['input']=g4['input'],this['output']=g4[k0(0x190)],this['resume']=g4['resume'],this['onProgress']=g4['onProgress'],this['config']=eP(g4),this['client']=ek({'maxRetries':this['config']['maxRetries'],'proxy':this['config'][k0(0x264)],'fetch':this['config']['fetchFn']}),this['config']['resume']['enabled']&&(this['resumeManager']=new eC({'output':this['output'],'key':this['config']['resume'][k0(0x260)],'filePath':this['config']['resume'][k0(0x147)],'store':this['config']['resume']['store'],'cleanupOnSuccess':this['config']['resume']['cleanupOnSuccess']}));}static async[gP(0x22b)](g4){let g5=new gI(g4);return await g5['_init'](),g5;}async['_init'](){this['probe']=await fe({'client':this['client'],'input':this['input'],'requestInit':this['config']['requestInit']}),await eo(this['output']),this['tempFileDir']=await em(this['output'],this['config']['tempDir']),this['config']['resume']['enabled']||(await ep(this['output'],eq(this['output']),this['tempFileDir']),this['tempFileDir']=await em(this['output'],this['config']['tempDir']));}async['execute'](){const k1=gP;if(!this['probe']||!this['tempFileDir'])throw Error('Download\x20was\x20not\x20initialized.\x20Use\x20Download.init(options).');if(this['executed'])throw Error(k1(0x130));this['executed']=!0x0;try{let g4=f0({'input':this['input'],'url':this['probe']['url'],'size':this['probe']['size'],'acceptsRanges':this['probe']['acceptsRanges'],'requestInit':this['config']['requestInit'],'tempFileDir':this['tempFileDir'],'maxWorkerCount':this['config']['maxWorkerCount'],'maxChunkSize':this['config']['maxChunkSize']});await fd({'input':this[k1(0x12d)],'output':this[k1(0x190)],'url':this['probe']['url'],'size':this['probe']['size'],'requestInit':this['config']['requestInit'],'maxWorkerCount':this['config']['maxWorkerCount'],'maxChunkSize':this['config']['maxChunkSize'],'onProgress':this['onProgress'],'client':this['client'],'parts':g4,'tempFileDir':this['tempFileDir'],'resumeManager':this['resumeManager'],'signal':this['config']['requestInit']?.['signal']??void 0x0});}finally{try{await this['close']();}catch{}}}async['getSize'](){const k2=gP;if(this[k2(0x1de)]||=await fe({'client':this['client'],'input':this['input'],'requestInit':this['config']['requestInit']}),!this['probe']['size'])throw Error('Size\x20is\x20not\x20known');return this['probe']['size'];}async[gP(0x1ec)](){const k3=gP;await this['client'][k3(0x1ec)]();}};const fg=async({attempts:g4,fn:g5,shouldRetry:g6,onRetry:g7})=>{let g8=Math['max'](0x1,Math['trunc'](g4)),g9;for(let ga=0x1;ga<=g8;ga+=0x1)try{return await g5(ga);}catch(gb){if(g9=gb,ga>=g8||!g6?.(gb,ga))throw gb;await g7?.(gb,ga);}throw g9 instanceof Error?g9:Error(String(g9));},fh=0x10,fi=(g4,g5)=>{if(g5)return{'Range':'bytes='+g4+'-'+(g4+g5-0x1)};},fj=async g4=>{const k4=gP;let g5=[],g6=await g4['getSegments'](),g7=g6[0x0];g7?.['initSegment']&&g5['push']({'url':g7['initSegment']['location']['path'],'headers':fi(g7['initSegment']['location']['offset'],g7['initSegment']['location']['length'])});for(let g8 of g6)g5['push']({'url':g8['location']['path'],'headers':fi(g8['location']['offset'],g8[k4(0x25b)]['length'])});return g5['length']===0x1&&!g5[0x0]?.['headers']?g5[0x0]['url']:g5;},fk=g4=>{let g5=Math['max'](0x1,Math['trunc'](g4)),g6=Math['min'](fh,g5);return{'normalizedRequestedConnections':g5,'maxWorkerCount':g6,'wasClamped':g5!==g6};},fl=g4=>Math['max'](0x1,Math['trunc'](g4)+0x1),fm=({title:g4,progress:g5,filepath:g6,target:g7,quality:g8,codec:g9})=>{let ga=g5['totalBytes']??void 0x0,gb=g5['bytesPerSecond']??void 0x0,gc={'b':ga,'mb':ga===void 0x0?void 0x0:ga/0x400/0x400},ge={'b':g5['bytesDownloaded'],'mb':g5['bytesDownloaded']/0x400/0x400},gf=ga?Math['round'](g5['bytesDownloaded']/ga*0x64):void 0x0;return{'title':g4,'total':gc,'current':ge,'percentage':gf,'speed':{'bps':gb,'mbps':gb===void 0x0?void 0x0:gb/0x400/0x400},'trackName':basename(g6),'trackPath':g6,'finalName':g7['finalName'],'finalPath':g7['finalPath'],'state':gf===0x64?'downloaded':'downloading','quality':g8,'codec':g9};},fn=g4=>'Downloading\x20∙\x20'+((g4['bytesDownloaded']/0x400/0x400)['toFixed'](0x2)+'\x20MB')+(g4[gP(0x1bb)]?'\x20of\x20'+(g4['totalBytes']/0x400/0x400)['toFixed'](0x2)+'\x20MB':''),fo=async({input:g4,resume:g5,filepath:g6,description:g7,target:g8,resource:g9,options:ga,settings:gb,abortSignal:gc,title:ge,quality:gf,codec:gg,emitProgress:gh})=>{const k5=gP;q['info'](g7),q['debug']('Path:\x20'+g6);let gi=cF(g9['input']),gj=ga['connections']??gb['get']('connections')??0x1,{maxWorkerCount:gk,wasClamped:gl}=fk(gj);gl&&q['warn']('Connections\x20value\x20'+gj+'\x20was\x20clamped\x20to\x20'+gk+'\x20for\x20stability'),q['debug']('Max\x20worker\x20count:\x20'+gk);let gm=e6('Downloading',k5(0x231)),gn='',go=fl(ga['retry']??gb['get']('retry')??0x1);try{await fg({'attempts':go,'fn':async()=>{const k6=k5;let gp=await ff[k6(0x22b)]({'input':g4,'output':g6,'tempDir':r,'requestInit':{'headers':gi[k6(0x164)],'signal':gc},'proxy':ga['proxyMedia']||ga['proxy']||void 0x0,'resume':g5,'maxRetries':ga['retry'],'maxWorkerCount':gk,'onProgress':gq=>{gh(fm({'title':ge,'progress':gq,'filepath':g6,'target':g8,'quality':gf,'codec':gg})),gn=fn(gq),gm['update'](gn);}});if(gc?.['aborted']){q['debug'](k6(0x185)+g6);let gq=Error('The\x20operation\x20was\x20aborted');throw gq[k6(0x144)]='AbortError',gq;}await gp['execute']();},'shouldRetry':gp=>!(gp instanceof Error&&gp['name']==='AbortError'),'onRetry':async(gp,gq)=>{let gr=gp instanceof Error?gp['message']:String(gp);q['warn']('Track\x20download\x20retry\x20'+gq+'/'+(go-0x1)+'\x20scheduled\x20for\x20'+g6+':\x20'+gr);}}),gm['success'](gn);}catch(gp){if(gm['error'](g7),gp instanceof Error&&gp['name']==='AbortError')throw gp;let gq=gp instanceof Error?gp['message']:String(gp);throw q['error']('Download\x20track\x20failed:\x20'+gq),gp instanceof Error&&gp['stack']?q['debug'](gp[k5(0x138)]):q['debug'](gq),gp instanceof Error?gp:Error(gq);}},fp=g4=>{const k7=gP;if(!(!g4||typeof g4!='object'||!('drm'in g4)))return g4['drm']?.['widevine']?.[k7(0x12b)];},fq=async g4=>{let g5;try{g5=await g4['getSegments']();}catch(g7){if(g7 instanceof Error&&g7['message']['toLowerCase']()['includes']('no\x20segments')){q['debug']('Track\x20segments\x20unavailable\x20for\x20URL\x20logging:\x20'+g7['message']);return;}throw g7;}let g6=g5[0x0];return g6?.['location']['path']??g6?.['initSegment']?.['location']['path'];},fr=({outputDirectory:g4,baseName:g5,track:g6})=>join(g4,g5+'.'+createHash('sha256')['update'](dp(g6))['digest']('hex')['slice'](0x0,0x6)+'.'+(g6['type']==='subtitle'?'vtt':g6['type']==='audio'?'m4a':'mp4')),ft=(g4,g5)=>({'enabled':!0x0,'key':createHash('sha1')['update'](g4+':'+dp(g5))['digest']('hex')}),fu=async g4=>{const k8=gP;let g5=[];for(let g6 of g4){let g7=(await g6['getSegments']()[k8(0x223)](()=>[]))[0x0],g8=fp(g7?.['initSegment']?.['encryption'])??fp(g7?.['encryption']);g8&&g5['push'](g8);}return g5[k8(0x13b)](g9=>{const k9=k8;let ga=g9;return typeof ga=='string'?ga:ga instanceof Uint8Array||ga instanceof ArrayBuffer?Buffer['from'](ga)['toString'](k9(0x118)):ArrayBuffer['isView'](ga)?Buffer['from'](ga['buffer'])['toString'](k9(0x118)):String(ga);});},fv=async(g4,g5)=>{const ka=gP;let [g6,g7,g8]=await Promise['all']([g4['getLanguageCode']()['catch'](()=>void 0x0),g4['getName']()['catch'](()=>void 0x0),g4['getDisposition']()[ka(0x223)](()=>void 0x0)]);return{'path':g5,'type':g4['type'],'language':g6,'label':g7??void 0x0,'forced':g4['type']==='subtitle'?g8?.['forced']:void 0x0};},fw=async(g4,g5)=>{if(!g4['isVideoTrack']())return{'quality':void 0x0,'codec':void 0x0};let [g6,g7,g8]=await Promise['all']([g4['getCodec'](),g5?g4['getDisplayWidth']():g4['getCodedWidth'](),g5?g4['getDisplayHeight']():g4['getCodedHeight']()]);return{'quality':g7?g7+'x'+g8:void 0x0,'codec':g6??void 0x0};};var fx=class{async['execute']({settings:g4,plan:g5,abortSignal:g6,callbacks:g7}){q['debug']('Downloading\x20tracks'),dr(g5['tracks']['all']);let g8=cF(g5['resource']['input']);if(g5['isSegmented']){let gb=[];for(let gc of g5['tracks']['all']){gc['type']==='subtitle'&&q['debug']('URL:\x20'+(await fq(gc)??'manifest\x20subtitle\x20track'));let ge=await this.#e({'settings':g4,'plan':g5,'track':gc,'input':await fj(gc),'resume':ft(g8['url'],gc),'isSegmented':!0x0,'abortSignal':g6,'callbacks':g7});ge&&gb['push'](ge);}return{'downloaded':gb,'psshList':await fu(g5['tracks']['all']),'selectedTracks':g5['tracks']['all']};}let g9=[],ga=g5['tracks']['videos'][0x0]??g5['tracks']['audios'][0x0];if(ga){let gf=await this.#e({'settings':g4,'plan':g5,'track':ga,'input':g8['url'],'resume':!0x0,'isSegmented':!0x1,'abortSignal':g6,'callbacks':g7});gf&&g9['push'](gf);}for(let gg of g5['tracks']['subtitles']){q['debug']('URL:\x20'+(await fq(gg)??'manifest\x20subtitle\x20track'));let gh=await this.#e({'settings':g4,'plan':g5,'track':gg,'input':await fj(gg),'resume':!0x0,'isSegmented':!0x1,'abortSignal':g6,'callbacks':g7});gh&&g9['push'](gh);}return{'downloaded':g9,'psshList':[],'selectedTracks':g5['tracks']['all']};}async #e({settings:g4,plan:g5,track:g6,input:g7,resume:g8,isSegmented:g9,abortSignal:ga,callbacks:gb}){const kb=gP;let gc=fr({'outputDirectory':g5['output']['outputDirectory'],'baseName':g5[kb(0x190)][kb(0x221)],'track':g6}),ge=await ee(g6,g5['output'][kb(0x221)]),{quality:gf,codec:gg}=await fw(g6,g9);return await fo({'input':g7,'resume':g8,'filepath':gc,'description':ge,'target':{'finalName':g5['output']['fileName'],'finalPath':g5['output']['outputPath']},'resource':g5['resource'],'options':g5['options'],'settings':g4,'abortSignal':ga,'title':g5['downloadTitle'],'quality':gf,'codec':gg,'emitProgress':gh=>{gb?.['onProgress']?.(gh);}}),await az(gc)?await fv(g6,gc):null;}},fy=class{['settings'];['extensionManager'];#e=new fx();#t=new ea();constructor(g4,g5){this['settings']=g4,this['extensionManager']=g5;}async['run']({jobId:g4,title:g5,entry:g6,url:g7,requestedOptions:g8,filePath:g9,grantedBenefits:ga,signal:gb,emit:gc}){const kc=gP;let {options:ge,limit:gf}=dm({'settings':this['settings'],'requestedOptions':g8,'filePath':g9,'grantedBenefits':ga});gf['wasClamped']&&q['warn']('Connections\x20value\x20'+gf['normalizedRequestedConnections']+'\x20exceeds\x20tier\x20limit\x20('+gf['maxAllowedConnections']+').\x20Using\x20'+gf['connections']+'.');let gg=await dn({'extensionManager':this['extensionManager'],'entry':g6,'url':g7,'options':ge,'signal':gb});try{let {resource:gh,extension:gi,extensionTag:gj}=gg;gc?.({'type':'resource-prepared','entry':gh['entry']}),await gg['beforeDownload']();let gk=await new db({'settings':this['settings'],'trackSelectionStrategy':ed(ge)})['prepareDownloadPlan']({'options':ge,'resource':gh,'extensionTag':gj});gc?.({'type':'output-resolved','outputPath':gk['output']['outputPath'],'title':gk['downloadTitle']}),gc?.({'type':'phase-changed','phase':kc(0x207)});let gl=await this.#e['execute']({'settings':this['settings'],'plan':gk,'abortSignal':gb,'callbacks':{'onProgress':gm=>{gc?.({'type':'progress','progress':gm});}}});if(gb?.['aborted']){let gm=Error('The\x20operation\x20was\x20aborted');throw gm['name']='AbortError',gm;}return gl[kc(0x14c)]['length']>0x0&&(gc?.({'type':'artifacts-produced','artifacts':gl['downloaded']}),gc?.({'type':kc(0x217),'phase':'processing'}),await this.#t['process']({'jobId':g4,'title':g5??gk['downloadTitle'],'entryTitle':gh['entry']['title'],'options':ge,'outputPath':gk['output']['outputPath'],'transferResult':{'downloaded':gl[kc(0x14c)],'psshList':gl['psshList']??[],'selectedTracks':gl['selectedTracks']},'extension':gi,'resource':gh,'settings':this['settings'],'afterDownload':async()=>{await gg['afterDownload'](ge['skipMux']);}})),{'entry':gh['entry'],'outputPath':gk['output']['outputPath'],'title':gk['downloadTitle'],'transferResult':gl,'effectiveOptions':ge};}finally{await gg[kc(0x152)]();}}},fz=class{['settings'];['extensionManager'];['callbacks'];#e;constructor(g4,g5,g6){this['settings']=g4,this['extensionManager']=g5,this['callbacks']=g6,this.#e=new fy(g4,g5);}async['run'](g4,g5,g6){const kd=gP;try{if(g4['markDownloading'](),await this['callbacks'][kd(0x239)](g4),this['callbacks']['emitStatusChanged'](g4),!g4['entry'])throw Error('Download\x20job\x20is\x20missing\x20a\x20media\x20entry');let g7=await this.#e['run']({'jobId':g4['id'],'title':g4['title'],'entry':g4[kd(0x19f)],'url':g4['url'],'requestedOptions':g4['options'],'filePath':g4['filePath'],'grantedBenefits':g6,'signal':g5['signal'],'emit':this.#t(g4,g5)});if(g5['signal']['aborted'])return;let {entry:g8,transferResult:{downloaded:g9=[]}}=g7;if(g4['setEntry'](g8),!g9['length'])throw w['emit']('error',{'code':'NO_FILES_DOWNLOADED'}),Error(kd(0x140));g9['length']&&!g4['filePath']&&g4[kd(0x25e)](g9[0x0]?.['path']),this[kd(0x16a)]['trackArtifact'](g4['id'],g4['filePath']);for(let ga of g9)this['callbacks']['trackArtifact'](g4['id'],ga['path']);g4['markCompleted'](),this['callbacks']['emitStatusChanged'](g4),this['callbacks']['emitJobCompleted'](g4);}catch(gb){if(gb instanceof Error&&gb['name']==='AbortError'){q['debug']('Download\x20was\x20aborted\x20(paused):\x20'+g4['id']);return;}let {normalizedError:gc,alreadyHandled:ge}=this.#n(g4,gb);if(this.#r(gc),ge)return;q['error']('Download\x20job\x20failed:\x20'+gc),cv('Download\x20job\x20failure',gc),this['callbacks']['emitStatusChanged'](g4),this['callbacks']['emitJobError'](g4,gc);}}#t(g4,g5){let g6={};return g7=>{const ke=b;switch(g7['type']){case'resource-prepared':g4['setEntry'](g7['entry']),this['callbacks']['persistJob'](g4);return;case'output-resolved':g4['setOutputResolved'](g7['title'],g7['outputPath']),this['callbacks']['trackArtifact'](g4['id'],g7['outputPath']),this['callbacks']['persistJob'](g4),q['debug']('Job\x20output\x20path\x20persisted\x20early:\x20id='+g4['id']+ke(0x166)+g7['outputPath']);return;case'progress':{let g8=g7['progress'];if(g5['signal']['aborted']||!g4['hasState']('running','transferring'))return;g6[g8['trackPath']]=g8,this['callbacks']['trackArtifact'](g4['id'],g8['trackPath']),this['callbacks']['trackArtifact'](g4['id'],g8['finalPath']);let {totalDownloaded:g9,totalSize:ga,percent:gb}=cw(Object['values'](g6));g4['applyProgress']({'percent':gb,'downloadedBytes':g9,'totalBytes':ga,'filePath':g8[ke(0x19b)],'quality':g8['quality'],'codec':g8['codec']}),this['callbacks']['emitProgress'](g4),this['callbacks']['persistJob'](g4);return;}case'artifacts-produced':for(let gc of g7['artifacts'])this['callbacks'][ke(0x175)](g4['id'],gc['path']);return;case'phase-changed':if(g7['phase']!=='processing')return;g4['markProcessing'](),this['callbacks']['emitStatusChanged'](g4);}};}#n(g4,g5){const kf=gP;let g6=g5 instanceof Error?g5:Error(String(g5)),g7=g4['hasFailureMessage'](g6['message']);return g7||g4[kf(0x24d)](g6['message']),{'normalizedError':g6,'alreadyHandled':g7};}#r(g4){(g4&&typeof g4=='object'&&'code'in g4?String(g4['code']):'')==='DOWNLOAD_DIR_NOT_WRITABLE'&&w['emit']('error',{'code':'DOWNLOAD_DIR_NOT_WRITABLE'});}},fA=class{['record'];constructor(g4){this['record']=g4;}get['id'](){return this['record']['id'];}get['state'](){return this['record']['state'];}get['phase'](){return this['record']['phase'];}get['stage'](){return this['record']['phase']??this['record']['state'];}get['entry'](){const kg=gP;return this['record']['request'][kg(0x19f)];}get['filePath'](){const kh=gP;return this[kh(0x15c)][kh(0x190)][kh(0x147)];}get['url'](){return this['record']['request']['url'];}get['options'](){const ki=gP;return this['record'][ki(0x26f)]['options'];}get['title'](){const kj=gP;return this[kj(0x15c)]['output']['title'];}get['snapshot'](){return this['record'];}['hasState'](g4,g5){const kk=gP;return this[kk(0x15c)]['state']===g4?g5===void 0x0?!0x0:this['record']['phase']===g5:!0x1;}['hasFailureMessage'](g4){const kl=gP;return this[kl(0x15c)]['state']==='failed'&&this['record'][kl(0x1c6)]?.[kl(0x1fe)]===g4;}['setEntry'](g4){const km=gP;this['record'][km(0x26f)]['entry']=g4;}['setOutputResolved'](g4,g5){this['record']['output']['title']=g4,this['record']['output']['filePath']=g5;}['setFilePath'](g4){this['record']['output']['filePath']=g4;}[gP(0x196)]({percent:g4,downloadedBytes:g5,totalBytes:g6,filePath:g7,quality:g8,codec:g9}){const kn=gP;this['record']['output']['filePath']=g7,this['record']['progress']['percent']=g4,this['record']['progress']['downloadedBytes']=g5,this['record'][kn(0x266)]['totalBytes']=g6,g8&&(this['record']['output']['quality']=g8),g9&&(this['record']['output']['codec']=g9);}['markQueued'](){this['record']['state']='queued',this['record']['phase']=null,this['record']['failure']=void 0x0;}['markAnalyzing'](){this['record']['state']='queued',this['record']['phase']='analyzing',this['record']['failure']=void 0x0;}['markDownloading'](){this['record']['state']='running',this['record']['phase']='transferring';}['markProcessing'](){this['record']['state']='running',this['record']['phase']='processing';}['markPaused'](){this['record']['state']='paused',this['record']['phase']=null,this['record']['failure']=void 0x0;}['markCompleted'](){this['record']['state']='completed',this['record']['phase']=null,this['record']['progress']['percent']=0x64;}['markFailed'](g4){this['record']['state']='failed',this['record']['phase']=null,this['record']['failure']={'message':g4};}['resetForRetry'](){const ko=gP;this['record'][ko(0x266)]['percent']=0x0,this['record']['progress']['downloadedBytes']=0x0,this['record']['progress']['totalBytes']=void 0x0,this['record']['output']['quality']=void 0x0,this['record']['output']['codec']=void 0x0;}},fB=class{#e=[];#t=new Set();#n=new Map();#r=new Map();#i=new Set();get['activeRunCount'](){return this.#r['size'];}get['queuedCount'](){return this.#e['length'];}['getActiveRun'](g4){return this.#r['get'](g4);}[gP(0x1d9)](g4){return this.#n['get'](g4);}['queueResumeAfterStop'](g4){this.#i['add'](g4);}['consumeResumeAfterStop'](g4){const kp=gP;let g5=this.#i['has'](g4);return g5&&this.#i[kp(0x11d)](g4),g5;}['enqueue'](g4){const kq=gP;this.#t['has'](g4['id'])||this.#r[kq(0x262)](g4['id'])||(this.#e['push'](g4['id']),this.#t['add'](g4['id']));}['dequeue'](g4){const kr=gP;if(!this.#t['has'](g4))return!0x1;let g5=this.#e['indexOf'](g4);return g5!==-0x1&&this.#e[kr(0x1b2)](g5,0x1),this.#t['delete'](g4),!0x0;}['dequeueNext'](g4){const ks=gP;for(;this.#e['length']>0x0;){let g5=this.#e['shift']();if(!g5)return;this.#t['delete'](g5);let g6=g4(g5);if(g6&&g6[ks(0x122)]('queued'))return g6;}}['start'](g4,g5,g6){let g7={'controller':g5,'job':g4,'runPromise':g6};return this.#n['set'](g4['id'],g4),this.#r['set'](g4['id'],g7),g7;}[gP(0x1ad)](g4){this.#n['delete'](g4),this.#r['delete'](g4);}},fC=class{['settings'];['extensionManager'];['downloadStore'];#e=new fB();#t=new cm();#n=new Set();#r;#i=null;#a;#o=0x0;constructor(g4,g5,g6){const kt=gP;this['settings']=g4,this['extensionManager']=g5,this['downloadStore']=g6,this.#a=g4['get'](kt(0x230)),this.#r=new fz(g4,g5,{'persistJob':g7=>this['downloadStore']['updateRecord'](g7['snapshot']),'emitStatusChanged':g7=>this.#y({'type':'job-status-changed','record':g7['snapshot']}),'emitProgress':g7=>this.#y({'type':'job-progress','record':g7['snapshot']}),'emitJobError':(g7,g8)=>this.#y({'type':'job-error','record':g7[kt(0x227)],'error':g8}),'emitJobCompleted':g7=>this.#y({'type':'job-completed','record':g7['snapshot']}),'trackArtifact':(g7,g8)=>this.#t['track'](g7,g8)}),q['debug']('Created\x20download\x20engine\x20with\x20max\x20active\x20downloads:\x20'+this.#a);}get['maxActiveDownloads'](){return this.#a;}[gP(0x1ca)](g4){return this['downloadStore']['getRecord'](g4);}['listRecords'](){return this['downloadStore']['listRecords']();}['subscribe'](g4){return this.#n['add'](g4),()=>this.#n['delete'](g4);}async['initializeFromStorage'](){const ku=gP;for(let g4 of this['downloadStore']['listRecords']()){if(!cq(g4))continue;let g5=new fA(g4);g5['hasState']('queued')&&g5['phase']===null||(g5[ku(0x245)](),await this['downloadStore']['updateRecord'](g5['snapshot'])),this.#e['enqueue'](g5);}this.#u();}async['analyze'](g4,g5={}){if(!g4){let g7=Error('Cannot\x20prepare\x20job\x20without\x20a\x20URL.');throw this.#y({'type':'error','error':g7}),g7;}let g6=await ck(g4,g5,await this['extensionManager']['getExtensionForUrl'](g4));if(!g6?.['length'])throw Error('No\x20media\x20entries\x20found');return g6;}async['add'](g4){const kv=gP;if(!g4['url']&&!g4['entry']?.['source']?.[kv(0x1a8)])throw Error('Job\x20must\x20have\x20either\x20a\x20URL\x20or\x20a\x20pre-prepared\x20media\x20entry.');let g5=cp({'id':crypto['randomUUID'](),'request':g4,'createdAt':new Date()['toISOString']()});q['debug']('Adding\x20new\x20job:\x20'+g5['id']),q['debug'](kv(0x25f)+g5['request']['url']),this.#o+=0x1;let g6=new fA(g5);try{return await this['downloadStore']['addRecord'](g6['snapshot']),this.#y({'type':'job-added','record':g6['snapshot']}),this.#e['enqueue'](g6),this.#u(),structuredClone(g6['snapshot']);}finally{--this.#o,this.#v();}}async['pause'](g4){let g5=await this.#s(g4,'pause');g5&&q['debug']('Paused\x20download:\x20'+g5['id']);}async['resume'](g4){const kw=gP;let g5=this.#e[kw(0x214)](g4);if(g5){g5['cancellationReason']==='pause'||g5['controller']['signal']['aborted']?(this.#e['queueResumeAfterStop'](g4),q['debug']('Resume\x20queued\x20until\x20stop\x20completes:\x20'+g4)):q['debug']('Resume\x20skipped\x20while\x20job\x20is\x20active:\x20'+g4);return;}let g6=this.#h(g4);if(!g6){q['warn']('Resume\x20failed:\x20Job\x20'+g4+'\x20not\x20found');return;}if(g6[kw(0x122)]('paused')){await this.#c(g6),q['debug']('Resumed\x20download:\x20'+g6['id']);return;}g6['hasState']('failed')&&await this.#l(g6)&&q[kw(0x113)]('Retried\x20download:\x20'+g6['id']);}async['remove'](g4){await this.#s(g4,'remove'),await this['downloadStore']['deleteRecord'](g4),this.#t['forget'](g4);}async['removeWithFile'](g4){let g5=this.#h(g4),g6=await this.#s(g4,'remove-with-file')||g5,g7=this.#t['collect'](g4,g6?.['snapshot']);await this['downloadStore']['deleteRecord'](g4),await this.#t['purge'](g7),this.#t['forget'](g4);}async['drain'](){await new Promise(g4=>{let g5=!0x1,g6=()=>void 0x0,g7=()=>{g5||(g5=!0x0,g6(),g4());};g6=this['subscribe'](g8=>{g8['type']==='idle'&&g7();}),this.#_()&&g7();});}async #s(g4,g5){const kx=gP;let g6=this.#e['dequeue'](g4),g7=this.#e['getActiveRun'](g4),g8=this.#h(g4);return g7?g5==='pause'&&!g7['job'][kx(0x122)]('running','transferring')?(q['debug']('Pause\x20ignored\x20for\x20non-downloading\x20stage:\x20id='+g4+',\x20stage='+g7['job']['stage']),g7['job']):(g7['cancellationReason']=g5,g5==='pause'&&(g7['job']['markPaused'](),await this['downloadStore']['updateRecord'](g7['job']['snapshot']),this.#y({'type':'job-status-changed','record':g7['job']['snapshot']})),g7['controller']['abort'](),await g7[kx(0x24c)],g7['job']):(g5==='pause'&&g8&&(g6||g8['hasState']('queued'))&&(g8['markPaused'](),await this['downloadStore']['updateRecord'](g8['snapshot']),this.#y({'type':'job-status-changed','record':g8['snapshot']})),g8);}async #c(g4){const kz=gP;g4[kz(0x245)](),await this['downloadStore']['updateRecord'](g4['snapshot']),this.#y({'type':'job-status-changed','record':g4['snapshot']}),this.#e['enqueue'](g4),this.#u();}async #l(g4){let g5=this.#t['collect'](g4['id'],g4['snapshot']);this.#t['forget'](g4['id']),await this.#t['purge'](g5),g4['markAnalyzing'](),g4['resetForRetry'](),await this['downloadStore']['updateRecord'](g4['snapshot']),this.#y({'type':'job-status-changed','record':g4['snapshot']});try{if(g4['url']){let g6=await this['analyze'](g4['url'],g4['options']??{}),g7=this.#m(g4,g6);if(!g7)throw Error('No\x20media\x20entry\x20found');g4['setEntry'](g7);}return await this.#c(g4),!0x0;}catch(g8){return g4['markFailed'](g8 instanceof Error?g8['message']:String(g8)),await this['downloadStore']['updateRecord'](g4['snapshot']),this.#y({'type':'job-status-changed','record':g4['snapshot']}),this.#y({'type':'job-error','record':g4['snapshot'],'error':g8}),!0x1;}}#u(){const kA=gP;for(this.#a=this['settings'][kA(0x126)]('maxActiveDownloads');this.#e['activeRunCount']<this.#a;){let g4=this.#e['dequeueNext'](g5=>this.#h(g5));if(!g4)break;this.#d(g4);}this.#v();}#d(g4){if(!g4['hasState']('queued')){q['warn']('Skipping\x20non-queued\x20job\x20start:\x20'+g4['id']+'\x20('+g4['stage']+')');return;}let g5=new AbortController(),g6=this.#p(g4,g5)['catch'](g7=>{let g8=g7 instanceof Error?g7:Error('Download\x20run\x20failed:\x20'+String(g7));q['error'](g8['message']),this.#y({'type':'error','error':g8});});this.#e['start'](g4,g5,g6);}async #f(){const kB=gP;if(this.#i)return this.#i;try{let {grantedBenefits:g4}=await cc();this.#i=g4;}catch(g5){let g6=g5 instanceof Error?g5['message']:String(g5);q[kB(0x18a)]('Failed\x20to\x20resolve\x20customer\x20plan\x20for\x20connection\x20limits.\x20Falling\x20back\x20to\x20Free\x20limits:\x20'+g6),this.#i=[];}return this.#i;}async #p(g4,g5){const kC=gP;try{let g6=await this.#f();await this.#r[kC(0x18e)](g4,g5,g6);}finally{let g7=this.#e[kC(0x214)](g4['id']);if(!g7)return;let g8=g7['cancellationReason'],g9=g8==='pause'&&this.#e['consumeResumeAfterStop'](g4['id']);g8==='pause'?(g4['markPaused'](),await this['downloadStore']['updateRecord'](g4[kC(0x227)]),this.#y({'type':'job-status-changed','record':g4[kC(0x227)]})):g8!=='remove'&&g8!=='remove-with-file'&&await this['downloadStore'][kC(0x137)](g4['snapshot']),this.#e['finish'](g4['id']),g9&&g4['hasState']('paused')&&(g4['markQueued'](),await this['downloadStore']['updateRecord'](g4['snapshot']),this.#y({'type':'job-status-changed','record':g4['snapshot']}),this.#e['enqueue'](g4)),this.#u();}}#m(g4,g5){const kD=gP;if(g5['length']<=0x1)return g5[0x0];let g6=g4['entry'],g7=g6?.['source']?.['url'];return g5['find'](g8=>g6?.['id']&&g8['id']?g6['id']===g8['id']:g6?.['title']&&g8['title']&&g6[kD(0x135)]===g8['title']&&g6['seasonNumber']===g8['seasonNumber']&&g6['episodeNumber']===g8['episodeNumber']&&g6['episodeTitle']===g8['episodeTitle']?!0x0:!!g7&&g7===g8['source']?.['url'])??g5[0x0];}#h(g4){const kE=gP;return this.#e['getActiveJob'](g4)??this.#g(this['downloadStore'][kE(0x1ca)](g4));}#g(g4){return g4?new fA(g4):void 0x0;}#_(){return this.#o===0x0&&this.#e['queuedCount']===0x0&&this.#e['activeRunCount']===0x0;}#v(){this.#_()&&this.#y({'type':'idle'});}#y(g4){for(let g5 of this.#n)g5(g4);}};const fD=g4=>{if(!g4)return null;let [g5,g6]=g4['toLowerCase']()['split']('e');return[parseInt(g5['trim']()['toLowerCase']()['replace']('s','')),parseFloat(g6?.['trim']())];},fE=g4=>{const kF=gP;let g5=0x0,g6=0x270f,g7=[],g8=g4['split'](',');for(let ga of g8){let [gb,gc]=ga['split']('-'),ge=fD(gb),gf=fD(gc);if(ge&&!gc){let [gg,gh]=ge;if(isNaN(gh)){for(let gi=0x0;gi<=g6;gi++)g7[kF(0x146)]([gg,gi]);}else g7[kF(0x146)]([gg,gh]);}else{if(ge&&gf){let [gj,gk]=ge,[gl,gm]=gf;for(let gn=gj;gn<=gl;gn++){let go=gk||0x0,gp=gn===gl?gm:g6;for(let gq=go;gq<=gp;gq++)g7['push']([gn,gq]);}}}}let g9=new Map();for(let [gr,gs]of g7)g9['has'](gr)||g9[kF(0x20f)](gr,new Set()),g9['get'](gr)?.['add'](gs);return g9;},fF=g4=>{const kG=gP;if(!g4)return{};let g5={},g6=typeof g4=='string'?g4['split']('|'):g4;for(let g7 of g6){let [g8,...g9]=g7['split'](':'),ga=g9['join'](':');if(!ga)throw Error('Can\x27t\x20parse\x20header:\x20'+g7);g5[g8['trim']()]=ga[kG(0x124)]();}return g5;},fG=async g4=>{const kH=gP;let g5=!0x1,g6=g4;do try{g6?g5=!!new URL(g6):g6=(await t['ask']({'fields':{'url':{'label':'URL'}}}))['url'];}catch{g6=(await t['ask']({'fields':{'url':{'label':'URL'}}}))[kH(0x1a8)];}while(!g5);return g6!==g4&&q['debug']('URL:\x20'+g6),g6;};var fH=class{['filePath'];['records']=[];#e=Promise['resolve']();constructor(g4){this['filePath']=g4;}async['load'](){const kI=gP;await this.#e;try{let g4=await readFile(this['filePath'],{'encoding':'utf8'}),g5=JSON['parse'](g4);this['records']=g5['map'](g6=>this.#n(g6))[kI(0x172)]((g6,g7)=>new Date(g7['createdAt']??0x0)['getTime']()-new Date(g6['createdAt']??0x0)[kI(0x25d)]());}catch{this['records']=[];}return this;}get['size'](){const kJ=gP;return this['records'][kJ(0x1fc)];}async['addRecord'](g4){await this.#t(async()=>{const kK=b;this['records']['unshift'](g4),await this[kK(0x14a)]();});}async['updateRecord'](g4){await this.#t(async()=>{let g5=this['records']['findIndex'](g6=>g6['id']===g4['id']);g5!==-0x1&&(this['records'][g5]=g4,await this['save']());});}['getRecord'](g4){const kL=gP;return this[kL(0x180)]['find'](g5=>g5['id']===g4);}['listRecords'](){return this['records'];}['has'](g4){return this['records']['some'](g5=>g5['id']===g4);}async['deleteRecord'](g4){await this.#t(async()=>{const kM=b;let g5=this[kM(0x180)]['findIndex'](g6=>g6['id']===g4);g5!==-0x1&&(this['records']['splice'](g5,0x1),await this['save']());});}async[gP(0x1e3)](){await this.#t(async()=>{this['records']=[],await this['save']();});}async['save'](){return writeFile(this['filePath'],JSON['stringify'](this['records'],null,0x2));}#t(g4){let g5=this.#e['then'](g4,g4);return this.#e=g5['then'](()=>void 0x0,()=>void 0x0),g5;}#n(g4){if('request'in g4&&'state'in g4&&'progress'in g4&&'output'in g4)return g4;if(g4['entry'])return co(g4);let g5=g4['resource'];return co({...g4,'entry':{'id':g5?.['metadata']?.['id'],'title':g5?.['metadata']?.['title'],'seasonNumber':g5?.['metadata']?.['seasonNumber'],'episodeNumber':g5?.['metadata']?.['episodeNumber'],'episodeTitle':g5?.['metadata']?.['episodeTitle'],'source':g5?.['source']}});}};const fI={'command':['download\x20[urls..]','$0\x20[urls..]'],'aliases':['dl'],'describe':'Download\x20media\x20content\x20by\x20URL','builder':g4=>g4['option']('quality',{'alias':'q','describe':'Video\x20resolution\x20quality\x20-\x202160p/1080p/720p/...,\x20defaults\x20to\x20highest\x20available','type':'string'})['option']('video-codec',{'alias':'v','describe':'Video\x20codec\x20-\x20avc\x20|\x20hevc\x20|\x20vp8\x20|\x20vp9\x20|\x20av1\x20|\x20vc1,\x20defaults\x20to\x20any','type':'string'})['option']('video-range',{'alias':'r','describe':'Video\x20color\x20range\x20-\x20sdr\x20|\x20hlg\x20|\x20hdr10\x20|\x20hdr10+\x20|\x20dv,\x20defaults\x20to\x20sdr','type':'string'})['option']('video-bitrate',{'describe':'Video\x20bitrate\x20(in\x20kbps),\x20defaults\x20to\x20highest\x20available','type':'number'})['option']('video-dimension',{'describe':'Video\x20dimension\x20-\x202D/3D\x20(HSBS/HOU/FSBS/OU),\x20defaults\x20to\x202D','default':'2D','type':'string'})['option']('audio-codec',{'alias':'a','describe':'Audio\x20codec\x20-\x20aac\x20|\x20opus\x20|\x20mp3\x20|\x20vorbis\x20|\x20flac\x20|\x20alac\x20|\x20ac3\x20|\x20eac3\x20|\x20dts,\x20defaults\x20to\x20any','type':'string'})['option']('audio-channels',{'alias':'c','describe':'Audio\x20channels,\x20matches\x20sub-channel\x20layouts\x20like\x205.1\x20with\x206.0','type':'number'})['option']('audio-bitrate',{'describe':'Audio\x20bitrate\x20(in\x20kbps),\x20defaults\x20to\x20highest\x20available','type':'number'})[gP(0x120)]('subs-format',{'alias':'s','describe':gP(0x26d),'type':'string'})[gP(0x120)]('subs-lang',{'alias':'S','describe':gP(0x248),'type':'string'})['option']('lang',{'alias':'l','describe':'Video/audio\x20language(s)','type':'string'})['option']('skip-video',{'describe':gP(0x1df),'type':'boolean'})['option']('skip-audio',{'describe':'do\x20not\x20download\x20audio','type':'boolean'})['option']('skip-subtitles',{'describe':gP(0x209),'type':'boolean'})['option']('skip-mux',{'describe':'Disable\x20merge\x20audio/video/subs\x20into\x20single\x20file','type':'boolean'})['option'](gP(0x208),{'describe':'Select\x20audio/video/subtitle\x20streams\x20from\x20manifest\x20manually','type':'boolean'})['option']('episodes',{'alias':'e','describe':'Seasons/episodes\x20to\x20download,\x20e.g.\x20`S01E01`,\x20`S01-S05,S07`,\x20`S01E01-S02E03`,\x20`S02-S02E03`,\x20etc.','type':'string','coerce':g5=>fE(g5)})['option'](gP(0x21f),{'alias':'R','describe':'Number\x20of\x20retries\x20in\x20case\x20of\x20unsuccessful\x20request','type':gP(0x1b5),'default':ax['retry']})['option']('connections',{'alias':'C','describe':'Number\x20of\x20parallel\x20http\x20connections\x20per\x20download','type':'number','default':ax['connections']})['option'](gP(0x264),{'describe':'Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20all\x20requests','type':'string'})[gP(0x120)]('proxy-meta',{'describe':'Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20metadata\x20fetching','type':gP(0x18f)})['option']('proxy-media',{'describe':'Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20media\x20downloading','type':'string'})['option']('movie-template',{'describe':'Movie\x20filename\x20template','type':'string','default':ax['movieFilenameTemplate']})['option']('episode-template',{'describe':'Episode\x20filename\x20template','type':'string','default':ax['seriesFilenameTemplate']})['option']('hardsub',{'describe':'Download\x20hardsubbed\x20video\x20if\x20available','type':gP(0x1d2)})['option'](gP(0x1ef),{'describe':gP(0x256),'type':'string'})['option']('trim-end',{'describe':'Trim\x20video\x20at\x20the\x20end;\x20example:\x2000:01:30','type':'string'})['option']('key',{'describe':gP(0x178),'type':gP(0x1e4),'string':!0x0,'coerce':g5=>g5['map'](g6=>{let [g7,g8]=g6['split'](':');return{'kid':g7,'key':g8};})})['option']('header',{'alias':'H','describe':'Pass\x20custom\x20header(s)\x20for\x20manifest\x20request','type':'array','string':!0x0,'coerce':g5=>fF(g5)})['option']('format',{'alias':'f','describe':'Video\x20container\x20format\x20-\x20mp4\x20|\x20mkv\x20(Pro\x20only)','type':'string','choices':['mp4','mkv']}),'handler':async g4=>{const kN=gP;let g5=g4;g5['videoQuality']=g4['quality'];let g6=new ay(j);if(g5['format']){let {error:gl}=await dj({'videoContainerFormat':g5['format']});gl&&(q['error']('Invalid\x20format:\x20'+gl['message']),q['info'](kN(0x11e)),process['exit'](0x1));}let g7=[];try{({grantedBenefits:g7}=await cc());}catch(gm){let gn=gm instanceof Error?gm['message']:String(gm);q[kN(0x18a)]('Failed\x20to\x20resolve\x20customer\x20plan\x20for\x20connection\x20limits.\x20Falling\x20back\x20to\x20Free\x20limits:\x20'+gn);}let {options:g8,limit:{normalizedRequestedConnections:g9,maxAllowedConnections:ga,wasClamped:gb,connections:gc}}=dl({'options':g5,'fallbackConnections':g6['get']('connections'),'grantedBenefits':g7});Object['assign'](g5,g8),gb&&q['warn']('Connections\x20value\x20'+g9+'\x20exceeds\x20tier\x20limit\x20('+ga+').\x20Using\x20'+gc+'.');let ge=new cg({'dirs':[I],'indexPath':n});await ge['init'](),await ge['loadCoreExtensions'](),await ge['discover']();let gf=new fH(join(B,'downloads.json'));await gf['load']();let gg=new fC(g6,ge,gf);c3()['then'](go=>Object['assign'](c1,go)),gg['subscribe'](go=>{const kO=kN;if(go['type']==='job-completed'){q['debug']('Job\x20completed:\x20'+go['record']['id']);return;}if(go['type']==='job-error'){q['debug']('Job\x20failed:\x20'+go['record']['failure']?.[kO(0x1fe)]);return;}go[kO(0x1ab)]===kO(0x15d)&&q['error']('Download\x20engine\x20error:\x20'+go['error']['message']);});let gh=Array['isArray'](g4['urls'])?g4['urls']:[],gi=process.env.ELECTRON_RUN_AS_NODE==='1'?gh['filter'](go=>go!==process['argv'][0x1]):gh,gj=gi['length']>0x0?gi:[''],gk=[];for(let go of gj){let gp=await fG(go),gq=await gg[kN(0x184)](gp,g5);for(let gr of gq)gk['push'](gg['add']({'url':gp,'options':g5,'entry':gr}));}await Promise['all'](gk),await gg['drain']();}},fJ='azot-desktop',fK=async()=>{const kP=gP;if(await c3()&&!await confirm({'message':'You\x27re\x20already\x20logged\x20in.\x20Do\x20you\x20want\x20to\x20log\x20in\x20again?','default':!0x1})){q['debug']('Login\x20cancelled');return;}let g4=createSpinner('Requesting\x20device\x20authorization...');g4['start']();try{let g5=bS(),{data:g6,error:g7}=await g5['device']['code']({'client_id':fJ,'scope':'openid\x20profile\x20email'});if(g4['stop'](),g7||!g6)q['error']('Failed\x20to\x20request\x20device\x20authorization:\x20'+(g7?.['error_description']||g7?.['statusText']||'Unknown\x20error')),q['debug'](g7);else{let {device_code:g8,user_code:g9,verification_uri:ga,verification_uri_complete:gb,interval:gc=0x5,expires_in:ge}=g6;console['log'](''),console[kP(0x237)](O['cyan']('📱\x20Device\x20Authorization\x20Required')),console[kP(0x237)](''),console['log']('Please\x20visit:\x20'+O['underline'](O[kP(0x1c8)](ga))),console['log']('Enter\x20code:\x20'+O['bold'](O['green'](g9))),console['log'](''),await confirm({'message':'Open\x20browser\x20automatically?','default':!0x0})&&await Y(gb||ga),console['log'](O['gray']('Waiting\x20for\x20authorization\x20(expires\x20in\x20'+Math['floor'](ge/0x3c)+'\x20minutes)...'));let gf=await fL(g5,g8,fJ,gc);if(gf){await c2(gf);let {data:gg}=await g5['getSession']({'fetchOptions':{'headers':{'Authorization':'Bearer\x20'+gf[kP(0x26c)]}}});console['log'](O['green']('✅\x20Login\x20successful!\x20Logged\x20in\x20as\x20'+(gg?.['user']?.['name']||gg?.['user']?.['email']||'User')));}}}catch(gh){g4['stop'](),q['error']('Login\x20failed:\x20'+(gh instanceof Error?gh[kP(0x1fe)]:'Unknown\x20error'));}};async function fL(g4,g5,g6,g7){let g8=g7,g9=createSpinner('',{'color':'cyan'}),ga=0x0;return new Promise(gb=>{let gc=async()=>{const kQ=b;ga=(ga+0x1)%0x4,g9['update'](O['gray']('Polling\x20for\x20authorization'+'.'[kQ(0x1f3)](ga)+'\x20'['repeat'](0x3-ga))),g9[kQ(0x1e1)]()||g9['start']();try{let {data:ge,error:gf}=await g4['device']['token']({'grant_type':'urn:ietf:params:oauth:grant-type:device_code','device_code':g5,'client_id':g6,'fetchOptions':{'headers':{'user-agent':'Azot\x20Desktop'}}});if(ge?.[kQ(0x26c)]){g9['stop'](),gb(ge);return;}else{if(gf)switch(gf['error']){case'authorization_pending':break;case'slow_down':g8+=0x5,g9['update'](O[kQ(0x231)]('Slowing\x20down\x20polling\x20to\x20'+g8+'s'));break;case'access_denied':g9['stop'](),q['error']('Access\x20was\x20denied\x20by\x20the\x20user');break;case'expired_token':g9['stop'](),q['error']('The\x20device\x20code\x20has\x20expired.\x20Please\x20try\x20again.');break;default:g9['stop'](),q['error']('Error:\x20'+gf['error_description']);}}}catch(gg){g9['stop'](),q[kQ(0x15d)]('Network\x20error:\x20'+(gg instanceof Error?gg['message']:'Unknown\x20error'));return;}setTimeout(gc,g8*0x3e8);};setTimeout(gc,g8*0x3e8);});}const fM=async()=>{const kR=gP;q['info']('Logging\x20out...');let g4=await bS()['signOut']();g4['error']?q[kR(0x15d)]('Logout\x20failed:\x20'+g4['error']['message']):(q['info']('Logout\x20successful'),await c2({}));},fN={'command':'login\x20[extension]','describe':'Login\x20to\x20extension\x20(or\x20if\x20no\x20extension\x20is\x20specified,\x20login\x20to\x20Azot\x20account)','builder':g4=>g4['option']('username',{'alias':'u','describe':'Username','type':'string'})['option']('password',{'alias':'p','describe':'Password','type':'string'})['option']('otp',{'alias':'o','describe':'One-time\x20password','type':'string'}),'handler':async g4=>{const kS=gP;let g5=g4['extension'],g6={'username':g4['username'],'password':g4['password'],'otp':g4[kS(0x13f)]};if(g5){let g7=new cg({'dirs':[I],'indexPath':n});await g7['init'](),await g7['discover'](),await g7['login'](g5,g6);}else fK();}},fO={'command':'list','aliases':['ls'],'describe':'Lists\x20information\x20about\x20installed/active\x20extensions','handler':async()=>{const kT=gP;let g4=await new cg({'indexPath':n})[kT(0x22b)]();if(!g4['infoList']['length'])return console[kT(0x237)]('No\x20added\x20extensions\x20found');for(let g5 of g4['infoList']){let g6=''+O['bold'](O['blue'](g5['name']['padEnd'](0xf))),g7=O['green'](g5['package']?.['version']);console['log'](g6+g7);}console['log']('\x0a'+O['dim']('Location:\x20'+J));}},fP=new Intl['RelativeTimeFormat']('en',{'style':'long'}),fQ=g4=>{const kU=gP;let g5=Math['floor'](g4/0x18),g6=Math['abs'](g5);return g6>0x16d?fP['format'](Math['floor'](g5/0x16d),kU(0x228)):g6>0x1e?fP['format'](Math['floor'](g5/0x1e),'month'):g6>0x7?fP['format'](Math['floor'](g5/0x7),'week'):g6>0x1?fP['format'](Math['floor'](g5),'day'):fP['format'](Math['floor'](g4),'hour');},fR=(g4,g5,g6)=>{const kV=gP;let g7=''+O['bold'](O['blue'](g4['padEnd'](0xf))),g8=O['green'](g5['padEnd'](0xa)),g9=O[kV(0x167)](g6);console['log'](g7+g8+g9);},fS={'command':'list-remote','aliases':[gP(0x1a3)],'describe':'List\x20all\x20available\x20extensions','handler':async()=>{const kW=gP;c3()['then'](g6=>Object[kW(0x225)](c1,g6));let g4=await cg['getAvailableExtensions'](),g5=Date['now']();for(let g6 of g4){let g7=g6['releases']['toSorted']((gb,gc)=>new Date(gc['createdAt'])['getTime']()-new Date(gb['createdAt'])['getTime']())['at'](0x0);if(!g7)continue;let g8=g7['createdAt'],g9=new Date(g8)['getTime']()-g5,ga=fQ(Math['floor'](g9/0x36ee80));fR(g6['name'],g7['version'],ga);}}},fT={'command':'logout\x20[extensions..]','describe':'Logout\x20from\x20extension\x20(or\x20if\x20no\x20extension\x20is\x20specified,\x20logout\x20from\x20Azot\x20account)','handler':async g4=>{let g5=g4['extensions'];if(g5?.['length']){let g6=new cg({'dirs':[I],'indexPath':n});await g6['init'](),await g6['discover'](),await g6['logout'](g5);}else fM();}},fU={'command':'settings\x20[key]\x20[value]','describe':'CLI\x20access\x20to\x20get/set\x20configuration\x20settings','handler':async g4=>{const kX=gP;let g5=new ay(j),g6=g4['key'],g7=g4['value'];if(g6&&g7){g5['set']({[g6]:g7}),console['log']('Setting\x20'+O['bold'](O['blue'](g6))+'\x20set\x20to\x20'+O['green'](g7));return;}else{if(g6){let g9=g5['get'](g6);console['log'](g9?'Setting\x20'+O[kX(0x25a)](O['blue'](g6))+kX(0x202)+O['green'](g9):'Setting\x20'+O['bold'](O['blue'](g6))+'\x20is\x20not\x20found');return;}}let g8=g5['getAll']();for(let [ga,gb]of Object['entries'](g8)){let gc=(''+ga)['padEnd'](0x19),ge=String(gb)['replaceAll']('{','{{')['replaceAll']('}','}}');console['log'](O['bold'](O['blue'](gc))+'\x20'+ge);}console['log']('\x0a'+O['dim']('Location:\x20'+j));}},fV={'command':'uninstall\x20<extensions..>','aliases':['rm'],'describe':'Uninstall\x20an\x20extension','handler':async g4=>{const kY=gP;let g5=g4['extensions'],g6=new cg({'dirs':[I],'indexPath':n});await g6[kY(0x22b)](),await g6['uninstall'](g5);}},fW={'command':'install\x20<extensions..>','aliases':['i'],'describe':'Install\x20extension','handler':async g4=>{let g5=g4['extensions'],g6=new cg({'dirs':[I],'indexPath':n});await g6['init'](),await g6['install'](g5);}},fX={'command':'logs','describe':'Show\x20logs\x20list','handler':async()=>{const kZ=gP;let g4=s,g5=await readdir(g4)['then'](g7=>g7['filter'](g8=>g8[kZ(0x1e6)]('.log'))),g6=g7=>join(g4,g7);g5['length']||q['info']('No\x20logs\x20found');for(let g7 of g5)q[kZ(0x1ac)](g6(g7));}};q['debug'](i);const fY=ab(process['argv']);q['debug'](H+'\x20'+fY['join']('\x20'));const fZ=new Set(['build','dev']);w['on']('error',g4=>{let g5=F(g4);q['error'](g5['message']);});const g0=O['magenta'](O['bold'](k))+'\x20is\x20'+h['description'][gP(0x232)](),g1=O['bold']('Usage:\x20$0\x20<command>\x20'+O['cyan']('[...options]')),g2=(g4,g5)=>{const l0=gP;let g6=g5 instanceof Error?g5:Error(String(g5));q['fatal'](g4+':\x20'+g6['message']),g6['stack']&&q[l0(0x113)](g6['stack']),rmSync(r,{'recursive':!0x0,'force':!0x0}),process['exit'](0x1);};process['on']('uncaughtException',g4=>{g2('Unexpected\x20error',g4);}),process['on'](gP(0x219),g4=>{g2('Unhandled\x20promise\x20rejection',g4);}),!c&&fZ['has'](fY[0x0]??'')&&g2('CLI\x20error',Error('The\x20`build`\x20and\x20`dev`\x20commands\x20are\x20unavailable\x20in\x20the\x20desktop-distributed\x20CLI.\x20Use\x20the\x20npm-installed\x20`azot`\x20package\x20in\x20a\x20Node.js\x20environment\x20instead.'));const g3=N(fY)['scriptName'](H)['usage'](g0+'\x0a\x0a'+g1)['command'](fI)['command'](fO)['command'](fS)['command'](fW)['command'](fV)[gP(0x243)](fN)['command'](fT)['command'](fU)['command'](fX)['option']('debug',{'describe':'Debug\x20mode','type':'boolean'})['wrap'](N()['terminalWidth']())['help']()['alias']('h','help')[gP(0x1d3)](!0x1)['version'](u)['updateStrings']({'Commands:':O['bold']('Commands:'),'Options:':O['bold']('Options:'),'default':O['dim']('default'),'aliases':O['dim']('aliases'),'boolean':O['dim']('boolean'),'string':O['dim']('string'),'number':O[gP(0x167)]('number')})['epilogue']('Learn\x20more\x20about\x20Azot:\x20'+O['magenta']('https://azot.mov')+'.');c&&g3['command'](ar)[gP(0x243)](as),g3['parseAsync']()['then'](async g4=>{await p(s);let g5=String(g4['_'][0x0]??'');g5==='dev'||g5==='build'&&g4['watch']===!0x0||process['exit'](0x0);})['catch'](g4=>{g2('CLI\x20error',g4);});export{};
|