azot 5.0.0-alpha.29 → 5.0.0-alpha.30
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-BfWcJYPg.mjs +3 -0
- package/dist/context.mjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/package.json +3 -3
- package/dist/context-dQU9jc5L.mjs +0 -3
package/dist/azot.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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{};
|
|
2
|
+
const hQ=b;(function(ha,hb){const hP=b,hc=ha();while(!![]){try{const hd=-parseInt(hP(0x1cc))/0x1+-parseInt(hP(0x20b))/0x2*(parseInt(hP(0x1bf))/0x3)+parseInt(hP(0x2b6))/0x4+-parseInt(hP(0x27b))/0x5+-parseInt(hP(0x298))/0x6+-parseInt(hP(0x2dd))/0x7+parseInt(hP(0x2c9))/0x8*(parseInt(hP(0x220))/0x9);if(hd===hb)break;else hc['push'](hc['shift']());}catch(he){hc['push'](hc['shift']());}}}(a,0x53b72));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-BfWcJYPg.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';import*as P from'node:fs/promises';import Q,{open,readFile,readdir,rm,stat}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';function b(c,d){c=c-0x1b2;const e=a();let f=e[c];return f;}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,Transform}from'node:stream';import Y from'open';var Z=Object['create'],a0=Object[hQ(0x25d)],a1=Object[hQ(0x242)],a2=Object['getOwnPropertyNames'],a3=Object['getPrototypeOf'],a4=Object['prototype'][hQ(0x1fe)],a5=(ha,hb)=>()=>(hb||(ha((hb={'exports':{}})['exports'],hb),ha=null),hb['exports']),a6=(ha,hb,hc,hd)=>{const hR=hQ;if(hb&&typeof hb=='object'||typeof hb==hR(0x231)){for(var he=a2(hb),hf=0x0,hg=he['length'],hh;hf<hg;hf++)hh=he[hf],!a4[hR(0x1c1)](ha,hh)&&hh!==hc&&a0(ha,hh,{'get':(hi=>hb[hi])['bind'](null,hh),'enumerable':!(hd=a1(hb,hh))||hd['enumerable']});}return ha;},a7=(ha,hb,hc)=>(hc=ha==null?{}:Z(a3(ha)),a6(hb||!ha||!ha['__esModule']?a0(hc,'default',{'value':ha,'enumerable':!0x0}):hc,ha)),a8=createRequire(import.meta.url);const a9=()=>{const hS=hQ;let ha=[];process['resourcesPath']&&ha['push'](join(process['resourcesPath'],'bin','winconsole.node'));let hb=join(__dirname,'..','..','..');return ha['push'](join(hb,'assets','bin','win32','winconsole.node')),ha['push'](join(hb,'native','winconsole','build',hS(0x1dc),'winconsole.node')),ha['find'](hc=>existsSync(hc))||null;},aa=()=>{if(process['platform']!=='win32')return null;let ha=a9();if(!ha)return null;try{return a8(ha);}catch{return null;}};if(process['platform']==='win32'&&process.env.ELECTRON_RUN_AS_NODE==='1'){let hj=aa();hj&&(hj['attachParentConsole']?.(),hj['enableUtf8']?.());}const ab=(ha=process['argv'],hb=process.env)=>hb[hQ(0x206)]==='1'?ha['slice'](0x2):hideBin(ha),ac=new Set();let ad;const ae=ha=>(ac[hQ(0x2aa)](ha),()=>{const hT=hQ;ac[hT(0x25c)](ha);}),af=async()=>{if(ad){await ad;return;}ad=Promise['all']([...ac]['map'](ha=>Promise['resolve'](ha())['catch'](()=>void 0x0)))['then'](()=>void 0x0)['finally'](()=>{ad=void 0x0;}),await ad;},ag={'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},ah=ha=>{const hU=hQ;let hb=['B','KB','MB','GB'],hc=ha,hd=0x0;for(;hc>=0x400&&hd<hb[hU(0x264)]-0x1;)hc/=0x400,hd+=0x1;return hc['toFixed'](hd===0x0?0x0:0x2)+'\x20'+hb[hd];},ai=async(ha,hb)=>{const hV=hQ;let hc=readFileSync(ha,'utf8'),{default:hd}=await import('javascript-obfuscator');console[hV(0x22b)]('Obfuscating\x20'+ha+hV(0x252)),console['time']('Obfuscation\x20finished');let he=hd['obfuscate'](hc,ag);console['timeEnd'](hV(0x214));let hf=he['getObfuscatedCode'](),hg=Buffer['byteLength'](hc,'utf8'),hh=Buffer['byteLength'](hf,'utf8'),hi=hg===0x0?0x0:hh/hg;return console['log']('Size\x20changed\x20from\x20'+ah(hg)+'\x20to\x20'+ah(hh)+',\x20'+hi['toFixed'](0x2)+hV(0x2d0)),writeFileSync(hb||ha,hf),hf;},aj=new Set(['.ts','.js','.cjs','.mjs']),ak=new Set([hQ(0x2ec),'main']),al=ha=>{const hW=hQ;if(existsSync(ha))try{if(!statSync(ha)['isDirectory']())return;let hb=readdirSync(ha)['filter'](he=>!he['endsWith']('.d.ts'))[hW(0x233)](he=>aj['has'](M['extname'](he))),hc=he=>M['basename'](he,M['extname'](he)),hd=hb['find'](he=>ak[hW(0x222)](hc(he)))||hb[0x0];return hd?M['join'](ha,hd):void 0x0;}catch{return;}},am=()=>{let ha=[process['cwd'](),M['join'](process['cwd'](),'src'),M['join'](process['cwd'](),'lib')];for(let hb of ha){let hc=al(hb);if(hc)return hc;}},an=ha=>ha==='esm'?'mjs':'cjs',ao=(ha,hb)=>M['join'](process['cwd'](),'dist',M['parse'](ha)['name']+'.'+an(hb)),ap=ha=>{let hb=M['relative'](process['cwd'](),ha);if(!hb||hb['startsWith']('..'))throw Error('Entry\x20file\x20must\x20be\x20inside\x20the\x20current\x20working\x20directory:\x20'+ha);return'./'+hb['split'](M['sep'])['join']('/');},aq=ha=>{let hb=ha['input']||ha['entry']||am();if(!hb)throw Error('No\x20entry\x20file\x20found');return M['resolve'](hb);},ar=()=>{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.');},as=ha=>ha['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'}),at=ha=>{const hX=hQ;let hb=M['resolve'](ha);for(;;){let hc=M[hX(0x276)](hb,'package.json');if(existsSync(hc))return hc;let hd=M['dirname'](hb);if(hd===hb)return;hb=hd;}},au=ha=>{const hY=hQ;let hb=at(ha);if(!hb){let hc='Could\x20not\x20find\x20package.json\x20starting\x20from\x20'+ha;throw q['error'](hc),Error(hc);}try{let hd=JSON['parse'](readFileSync(hb,'utf8'));if(!hd||typeof hd!='object'||Array['isArray'](hd))throw Error('package.json\x20must\x20contain\x20a\x20JSON\x20object');let he=hd;if(he['private']!==void 0x0&&typeof he[hY(0x26c)]!=hY(0x299))throw Error('package.json\x20field\x20\x22private\x22\x20must\x20be\x20a\x20boolean\x20when\x20present');return{'private':he['private']};}catch(hf){let hg='Failed\x20to\x20load\x20package.json\x20for\x20build\x20command\x20from\x20'+hb;throw q['error'](hg),q[hY(0x2a4)](hf),Error(hg);}},av={'command':'build\x20[entry]','describe':'Bundle\x20a\x20Node.js\x20entry\x20file\x20for\x20distribution','builder':ha=>as(ha)['option'](hQ(0x27e),{'describe':'Watch\x20file\x20changes','type':'boolean'})['option']('obfuscate',{'describe':'Obfuscate\x20output','type':'boolean'}),'handler':async ha=>{const hZ=hQ;ar();let hb=aq(ha),hc=typeof ha['minify']==hZ(0x299)?ha['minify']:!0x0,hd=ha[hZ(0x27e)]===!0x0,he=ha['format']??'cjs',{build:hf}=await import('tsdown');await hf({'entry':ap(hb),'format':he,'platform':'node','target':'node24','watch':hd,'minify':hc,'inlineOnly':!0x1});let hg=ao(hb,he),hh=au(process[hZ(0x2f7)]());(typeof ha[hZ(0x2a0)]=='boolean'?ha['obfuscate']:hh['private'])&&await ai(hg,hg);}},aw={'command':'dev\x20[entry]','describe':'Watch\x20and\x20rebuild\x20a\x20Node.js\x20entry\x20file\x20during\x20development','builder':ha=>as(ha),'handler':async ha=>{const i0=hQ;ar();let hb=aq(ha),hc=typeof ha['minify']=='boolean'?ha['minify']:!0x1,{build:hd}=await import('tsdown');await hd({'entry':ap(hb),'format':ha['format']??'cjs','platform':'node','target':i0(0x325),'watch':!0x0,'minify':hc});}},ax=()=>Intl[hQ(0x23e)]()['resolvedOptions']()['locale']['startsWith']('ru')?'ru':'en',ay={'dark':'dark','light':'light','system':'system'},az={'mp4':'mp4','mkv':'mkv'},aA=z['object']({'downloadDir':z['string']()['default'](l),'binariesDir':z['string']()['default'](d(join(B,'bin'))),'drmDir':z['string']()['default'](d(join(B,'drm'))),'language':z['string']()['default'](ax()),'theme':z[hQ(0x26d)]([ay['dark'],ay['light'],ay['system']])['default'](ay['system']),'preferHardsub':z['coerce']['boolean']()['default'](!0x1),'retry':z[hQ(0x1e1)]['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[hQ(0x282)]()[hQ(0x2c8)]('{title}\x20S{s}E{e}\x20({quality},\x20{codec})'),'developerMode':z['coerce']['boolean']()['default'](!0x1),'allowUnknownSources':z[hQ(0x1e1)]['boolean']()['default'](!0x1),'videoContainerFormat':z['enum']([az['mp4'],az['mkv']])['default'](az['mp4']),'useAlternativeServer':z['coerce']['boolean']()['default'](!0x1),'automaticUpdates':z['coerce']['boolean']()['default'](!0x0)}),aB=aA['parse']({});var aC=class{#e;constructor(ha){this.#e=o({'defaults':aB,'cwd':dirname(ha),'configName':basename(ha,'.json')}),this.#t();}#t(){const i1=hQ;let ha=this.#e['store'],hb=aA['safeParse'](ha),hc='{title}.{audioType}.{quality}.{tag}.{format}.{codec}',hd='{title}.S{s}E{e}.{episodeTitle}.{audioType}.{quality}.{tag}.{format}.{codec}';if(ha['movieFilenameTemplate']==='{title}.{audioType}.{quality}.{tag}.{format}.{codec}'&&this.#e['set']('movieFilenameTemplate',ha['seriesFilenameTemplate']),ha['seriesFilenameTemplate']==='{title}.S{s}E{e}.{episodeTitle}.{audioType}.{quality}.{tag}.{format}.{codec}'&&this.#e[i1(0x255)]('seriesFilenameTemplate',ha['seriesFilenameTemplate']),!hb[i1(0x1be)]){console['warn']('Settings\x20validation\x20failed!\x20Resetting\x20to\x20defaults.',hb['error']['flatten']()),this.#e['set'](aB);return;}Object['hasOwn'](ha,'askForOptions')&&this.#e['set'](hb[i1(0x223)]);}['getAll'](){return this.#e['store'];}['get'](ha){return this.#e['get'](ha);}[hQ(0x255)](ha){let hb={...this.#e['store'],...ha},hc=aA['safeParse'](hb);if(!hc['success'])throw console['error']('Invalid\x20settings\x20update:',hc['error']['flatten']()),Error('Settings\x20update\x20failed\x20validation.');this.#e['set'](hc['data']);}['onDidChange'](ha){this.#e['onDidAnyChange'](ha);}};const aD=async ha=>{try{return await Q['access'](ha),!0x0;}catch(hb){if(hb['code']==='ENOENT')return!0x1;throw hb;}},aE=async(ha,{recursive:hb=!0x1}={})=>await Q['readdir'](ha,{'withFileTypes':!0x0,'recursive':hb}),aF=async(ha,{recursive:hb=!0x0,force:hc=!0x0}={})=>{await Q['rm'](ha,{'recursive':hb,'force':hc});},aG=async(ha,{recursive:hb=!0x0}={})=>{await Q['mkdir'](ha,{'recursive':hb});},aH=async ha=>{try{await Q['access'](ha,constants['W_OK']);}catch(hb){let hc=hb['code'];throw hc==='EPERM'||hc==='EACCES'||hc==='ENOENT'?Object['assign'](Error('Download\x20directory\x20is\x20not\x20writable'),{'code':'DOWNLOAD_DIR_NOT_WRITABLE'}):hb;}},aI=async ha=>{try{let hb=await Q['readFile'](ha,{'encoding':'utf8'});return JSON['parse'](hb);}catch(hc){throw Error('Failed\x20to\x20read\x20JSON\x20file:\x20'+ha,{'cause':hc});}},aJ=async(ha,hb)=>{let hc=parse(ha)['dir'];try{let hd=await aD(hc);hc&&!hd&&await Q['mkdir'](hc),await Q['writeFile'](ha,JSON['stringify'](hb,null,0x2),'utf8');}catch(he){throw Error('Failed\x20to\x20save\x20data\x20to\x20file:\x20'+ha,{'cause':he});}},aK={'extract':(ha,hb)=>execFileSync('tar',['-xf',ha,...hb?['-C',hb]:[]],{'stdio':'inherit'})},aL={'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':hQ(0x1d9)},aM=new Set(Object['values'](aL));function a(){const lX=['widevine','promise','exports','Trim\x20video\x20at\x20the\x20beginning;\x20example:\x2000:00:06','\x20KiB/s','prepare','race','discover','exit','https://m.weibo.cn/status/','tasks','shortName','then','%2F','<script\x20id=\x22__UNIVERSAL_DATA_FOR_REHYDRATION__\x22\x20type=\x22application/json\x22>','maxActiveDownloads','columns','quality','base64','media','hasOwnProperty','proxyMeta','current','bold','tracks','Vitaly\x20Gashkov','access_token','video','ELECTRON_RUN_AS_NODE','number','percent','videoContainerFormat','IMPORT_INVALID','154UUUPLk','Max\x20worker\x20count:\x20','preferredVersion','target','createState','role','ukr','subtitles','pssh','Obfuscation\x20finished','Logging\x20out...','document','clear','content-length','.js','\x20kHz','purgeRecordArtifacts','stack','total','processing','host','13329DOfAwR','command','has','data','bytesWritten','extensionDirs','assign','yappyId','window','playready','Usage:\x20$0\x20<command>\x20','log','CUSTOM_MUX_FORMAT_NOT_ALLOWED','resource','download','defineExtension','url','function','otp','filter','format','system','get','ASSET_NOT_FOUND','dim','vorbis','build','No\x20files\x20were\x20downloaded','totalBytesEstimated','output','DateTimeFormat','\x20|\x20','subtitleLanguages','retry','getOwnPropertyDescriptor','Failed\x20to\x20resolve\x20customer\x20plan\x20for\x20connection\x20limits.\x20Falling\x20back\x20to\x20Free\x20limits:\x20','\x20∙\x20','trim','downloadedBytes','module','refresh','config','/releases','setLanguageCode','episodes','\x20built-in\x20extensions:\x20','Can\x27t\x20recognize\x20license\x20response','threeDevices','scope','twoDevices','...','transferring','releases','set','probe','randomUUID','Could\x20not\x20extract\x20a\x20valid\x20Instagram\x20shortcode\x20from\x20the\x20URL','matches','off','values','delete','defineProperty','mvData','Free\x20DRM\x20usage\x20is\x20limited\x20to\x20one\x20successful\x20key\x20retrieval\x20every\x2024\x20hours.','inputs','json','end','type','length','progress','Decrypting','read','track','tempFileDir','toLowerCase','addSubtitleTrack','private','enum','location','login\x20[extension]','language','running','write','catch','some','skip-audio','join','push','.\x20Unable\x20to\x20find\x20','Response\x20verified:\x20','includes','2034060YaNveP','user','paused','watch','Could\x20not\x20find\x20VK\x20player\x20payload','manifest','allSettled','string','toISOString','Password','subscription','skipAudio','interactive','latest','\x20directory\x20not\x20found:\x20','Extension\x20','Output\x20write\x20stream\x20error','/:userId(\x5cd+)/:bid','Only\x20WebVTT\x20subtitles\x20are\x20supported\x20by\x20the\x20MediaBunny\x20muxer.','password','auth.login','requestInit','page_title','bytesTotal','https://weibo.com/*','close','720','EBUSY','match','1708542vmCOul','boolean','reporter','job-progress','canBePairedWith','pathname','follow','endsWith','obfuscate','getExtension','message','localStorage','debug','Forbidden','status','customDrmClient','remove-with-file','findIndex','add','Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20media\x20downloading','outputPath','https://tiktok.com/*','pause','console','yellow','&page=1&page_size=15','Public\x20key\x20import\x20failed','Paused\x20download:\x20','kind','startsWith','728596JXFvUu','reset','Could\x20not\x20extract\x20Rutube\x20video\x20id','fastqueue\x20concurrency\x20must\x20be\x20equal\x20to\x20or\x20greater\x20than\x201','updateStrings','getTime','shortcode','kor','settings','extensions','/shorts/:id{/}?','list','all','padStart','https://github.com/vitalygashkov','isFinite','m3u8','slice','default','11736qNXaiO','stderr','http','The\x20device\x20code\x20has\x20expired.\x20Please\x20try\x20again.','package','getDisplayHeight','toSorted','x\x20increase','template','indexPath','edge_media_to_caption','bytes=','cleanupOnSuccess','Input','map','stop','dir','instagram.ts','blue','device','1418039vyvehA','start','https://soundcloud.com/','mp4a','navigator','Could\x20not\x20resolve\x20NTV\x20media\x20URL.','frames','social-networks','Bearer','WEB-DL','usage','vitalygashkov@vk.com','downloaded','unknown','getDecoderConfig','index','getItem','code','\x20must\x20provide\x20entry.source\x20or\x20implement\x20resolveEntry()','content-range','processedMedia','RELEASE_NOT_FOUND','partial','getLanguageCode','errorUpdatedAt','createdAt','cwd','pairableWithPrimaryVideo','round','fromWeb','videoQuality','videos','context','toString','input','logout','Login\x20to\x20extension\x20(or\x20if\x20no\x20extension\x20is\x20specified,\x20login\x20to\x20Azot\x20account)','bytesDownloaded','aborted','connections','assets','path','auth','utils','abort','created_at','content-disposition','writeFile','lastIndexOf','name','finalName','client','value','Number\x20of\x20retries\x20in\x20case\x20of\x20unsuccessful\x20request','regions','loadInfo','size','Job\x20completed:\x20','key','filePath','accessToken','DDP','headers','No\x20video\x20packets\x20found\x20in\x20','icon','proxy','cookies.txt','split','preferredChannel','PSSH:\x20','maxAllowedConnections','transferResult','node24','strict-origin-when-cross-origin','keys','empty','slow_down','from','array','extension','track_authorization','expectedSize','forced','getPrimaryAudioTrack','UrlSource','update','uninstall\x20<extensions..>','floor','getCodec','alert','removeEventListener','cors','signal','records','sha1','strategy','success','20598EvUdwP','queued','call','login','\x20video\x20tracks','hostname','title','Could\x20not\x20extract\x20VirtualRoom\x20recordId.','dispose','/?no_404=true&referer&pver=v2','weibo','state','getQueryData','589050BkifAS','find','sourceSignature','getVideoTracks','Decryption\x20failed\x20for\x20file\x20','error','DASH','store','https','AbortError','Unsupported\x20package\x20type','option','gitlab','EXTENSION_INSTALL_UNKNOWN','min','isArray','Release','Video\x20dimension\x20-\x202D/3D\x20(HSBS/HOU/FSBS/OU),\x20defaults\x20to\x202D','drm','MP4','totalBytes','coerce','averageTotal','Request\x20timed\x20out\x20after\x20','replace','240','completed','record','https://*.instagram.com/*','tag'];a=function(){return lX;};return a();}var aN=class extends Error{['code'];['details'];['hint'];constructor(ha){super(ha['message']),this['name']='InstallExtensionError',this['code']=ha['code'],this['details']=ha['details'],this['hint']=ha['hint'];}['toPayload'](){return{'code':this['code'],'message':this['message'],'details':this['details'],'hint':this['hint']};}};const aO=(ha,hb,hc,hd)=>new aN({'code':ha,'message':hb,'details':hc,'hint':hd}),aP=ha=>{const i2=hQ;let hb=(ha?.['startsWith']('v')?ha[0x1]:ha?.[0x0])??'';return Number['isNaN'](parseInt(hb))?ha?.['split']('.')['at'](0x0)||'latest':ha?.['split']('-')['at'](0x1)?.['split']('.')['at'](0x0)||i2(0x288);},aQ=ha=>(ha['version']||ha['tag_name']||'')['replace'](/^v/,''),aR=ha=>[...new Set(ha['filter'](Boolean))],aS=ha=>({'availableVersions':aR((ha||[])['map'](hb=>aQ(hb))),'availableChannels':aR((ha||[])['map'](hb=>aP(aQ(hb))))}),aT=(ha,hb,hc)=>{const i3=hQ;let hd={'source':hc,'preferredVersion':ha['preferredVersion'],'preferredChannel':ha[i3(0x321)],'appChannel':ha['appChannel'],...aS(hb)};return ha['preferredVersion']?aO(aL['VERSION_NOT_FOUND'],'Release\x20not\x20found\x20for\x20requested\x20version:\x20'+ha[i3(0x20d)],hd):aO(aL['CHANNEL_NOT_FOUND'],'Release\x20not\x20found\x20for\x20requested\x20channel:\x20'+ha['preferredChannel'],hd);},aU=(ha,hb,hc)=>{if(!ha?.['length'])return null;if(hb['preferredVersion'])return ha['find'](hd=>aQ(hd)===hb['preferredVersion'])||null;if(!hb['isExplicitSelection']){let hd=ha['find'](he=>aP(aQ(he))==='latest');if(hd)return hd;}return ha['find'](he=>aP(aQ(he))===hb['preferredChannel'])||(hb['allowFallback']&&hb['preferredChannel']!=='latest'?(q['debug']('Release\x20'+hb['preferredChannel']+'\x20not\x20found\x20for\x20'+hc+',\x20falling\x20back\x20to\x20latest\x20stable'),ha['find'](he=>aP(aQ(he))==='latest')||(q['debug']('Latest\x20stable\x20release\x20not\x20found\x20for\x20'+hc+',\x20falling\x20back\x20to\x20latest\x20with\x20any\x20channel'),ha['at'](0x0)||null)):null);},aV=ha=>{const i4=hQ;let [,hb='']=ha[i4(0x320)]('@'),hc=ha[i4(0x1e4)](hb?'@'+hb:'',''),hd=aP(h['version']),he=!!hb;return{'name':hc,'preferredVersion':Number['isNaN'](parseInt(hb[0x0]??''))?'':hb,'preferredChannel':he?aP(hb):hd,'appChannel':hd,'isExplicitSelection':he,'allowFallback':!he&&hd!=='latest'};},aW=async(ha,hb)=>{const i5=hQ;q['info']('Fetching\x20bundle...'),q['debug'](ha);let hc=await fetch(ha);if(!hc['ok'])throw aO(aL['ASSET_NOT_FOUND'],'Failed\x20to\x20download\x20extension\x20bundle:\x20'+hc['status']+'\x20'+hc['statusText'],{'url':ha,'status':hc['status'],'statusText':hc['statusText']});let hd=hc['headers']['get'](i5(0x30b))?.['split']('filename=')[0x1]?.['split'](';')[0x0]?.['replaceAll']('\x22',''),he=M['basename'](ha),hf=hb||hd||he,hg=await hc['arrayBuffer'](),hh=M['join'](I,hf);return await Q['writeFile'](hh,Buffer['from'](hg)),await Q['stat'](hh)['then'](hi=>{q['debug']('Bundle\x20downloaded\x20('+hi['size']/0x3e8+'\x20KB):\x20'+hh);})['catch'](()=>{q['error']('Bundle\x20download\x20failed:\x20can\x27t\x20find\x20output\x20file');}),hh;},aX=async(ha,hb)=>{const i6=hQ;if(ha['startsWith']('npm:')||ha['startsWith']('@streamyx/'))throw aO(aL['UNSUPPORTED_SOURCE'],'NPM\x20extension\x20sources\x20are\x20no\x20longer\x20supported',{'source':ha});let hc=ha,hd=ha,he=M['dirname'](ha),hf=he!=='.'&&await Q['stat'](he)['then'](()=>!0x0,()=>!0x1),hg=ha['startsWith']('./')||ha['startsWith']('../')||ha[i6(0x2b5)]('/')||ha['startsWith']('~')||hf,hh=await Q['stat'](ha)['then'](()=>!0x0,()=>!0x1),hi=ha['startsWith']('https://'),hk=ha['startsWith']('gl:')||ha['startsWith']('gitlab:'),hl=ha['startsWith']('github:')||ha['startsWith']('gh:');if(hg&&!hh&&!hi&&!hl&&!hk)throw q['warn']('Installed\x20extension\x20not\x20found:\x20'+ha),q['warn']('Run\x20\x27azot\x20list\x27\x20and\x20remove\x20the\x20extension\x20from\x20the\x20list.'),aO(aL['SOURCE_NOT_FOUND'],'Installed\x20extension\x20source\x20not\x20found:\x20'+ha,{'source':ha});ha=ha[i6(0x1e4)](/^gl:/,'')['replace'](/^gitlab:/,'')['replace'](/^gh:/,'')['replace'](/^github:/,'');let hm=aV(ha),{name:hn}=hm;if(hi)hc=await aW(ha);else{if(hl){let [ht,hu]=hn['split']('/'),hv='https://api.github.com/repos/'+ht+'/'+hu+'/releases',hw=await fetch(hv)['then'](hB=>hB['json']());if(hw?.[i6(0x2a2)]&&!Array['isArray'](hw))throw aO(aL[i6(0x2f2)],'GitHub\x20releases\x20request\x20failed:\x20'+hw['message'],{'source':hn,'provider':'github','apiMessage':hw['message']});let hx=Array['isArray'](hw)?hw:[],hy=aU(hx,hm,hn);if(!hy)throw hm['isExplicitSelection']?aT(hm,hx,hn):aO(aL['RELEASE_NOT_FOUND'],'GitHub\x20release\x20not\x20found',{'source':hn,'provider':'github',...aS(hx)});let hz=hy['assets']?.['find'](hB=>hB['name']['endsWith']('.tgz')||hB['name']['endsWith']('.zip'));if(!hz)throw q['debug'](hy),aO(aL['ASSET_NOT_FOUND'],'GitHub\x20release\x20asset\x20not\x20found',{'source':hn,'provider':'github','releaseTag':aQ(hy)});let hA=hz['browser_download_url'];hc=await aW(hA);}else{if(!hh){let hB=hb?.['find'](hF=>hF['name']===hn),hC=hB?.[i6(0x254)]||[],hD=aU(hC,hm,hn),hE=hD?.[i6(0x305)]['find'](hF=>hF['name']['endsWith']('.tgz'));if(hB&&!hD&&hm['isExplicitSelection'])throw aT(hm,hC,hn);if(hE)hc=await aW(hE[i6(0x230)],hE['name']);else{let [hF,hG='streamyx-extensions']=hn['split']('/')['reverse'](),hH='https://gitlab.com/api/v4/projects/'+hG+i6(0x1f7)+hF+i6(0x24a),hI=await fetch(hH)['then'](hM=>hM['json']());if(hI?.['message']&&!Array['isArray'](hI))throw aO(aL['RELEASE_NOT_FOUND'],'GitLab\x20releases\x20request\x20failed:\x20'+hI['message'],{'source':hn,'provider':i6(0x1d8),'apiMessage':hI['message']});let hJ=Array['isArray'](hI)?hI:[],hK=aU(hJ,hm,hn);if(!hK)throw hm['isExplicitSelection']?aT(hm,hJ,hn):aO(aL['RELEASE_NOT_FOUND'],'GitLab\x20release\x20not\x20found',{'source':hn,'provider':'gitlab',...aS(hJ)});let hL=hK['assets']?.['links']?.['find'](hM=>hM['name']['endsWith']('.tgz'));if(!hL)throw aO(aL[i6(0x237)],'GitLab\x20release\x20asset\x20not\x20found',{'source':hn,'provider':'gitlab','releaseTag':aQ(hK)});hc=await aW(hL['direct_asset_url']||hL['url'],hL['name']);}}}}let ho=M['extname'](hc),hp=ho==='.zip',hq=ho==='.tgz',hr=new Set(['.js','.mjs','.cjs'])['has'](ho),hs=await Q['stat'](hc)['then'](hM=>hM['isDirectory']())['catch'](()=>!0x1);if(hr?hd=M['dirname'](hc):hs?hd=hc:(hd=hc[i6(0x1e4)]('.tgz','')['replace']('.zip',''),await aD(hd)||await aG(hd)),hp||hq)aK['extract'](hc,hd),await aF(hc);else{if(!(hr||hs))throw aO(aL['UNSUPPORTED_PACKAGE_TYPE'],i6(0x1d6),{'source':ha,'extensionSource':hc,'packageType':ho||i6(0x2ea)});}return hd;},aY='__matchRules',aZ=ha=>typeof ha=='object'&&!!ha&&!Array['isArray'](ha),b0=ha=>{const i7=hQ;if(Array['isArray'](ha)){let hd=ha['filter'](hf=>typeof hf=='string'&&hf['length']>0x0&&!hf['startsWith']('-')),he=ha['filter'](hf=>typeof hf=='string'&&hf['startsWith']('-'))['map'](hf=>hf['slice'](0x1))['filter'](Boolean);return!hd['length']&&!he[i7(0x264)]?void 0x0:{'include':hd['length']?hd:void 0x0,'exclude':he[i7(0x264)]?he:void 0x0};}if(!aZ(ha))return;let hb=Array['isArray'](ha['include'])?ha['include']['filter'](hf=>typeof hf=='string'&&!!hf):void 0x0,hc=Array['isArray'](ha['exclude'])?ha['exclude']['filter'](hf=>typeof hf==i7(0x282)&&!!hf):void 0x0;if(!(!hb?.['length']&&!hc?.['length']))return{'include':hb?.[i7(0x264)]?hb:void 0x0,'exclude':hc?.['length']?hc:void 0x0};},b1=ha=>{const i8=hQ;let hb=ha['trim']()['match'](/^(\*|https?):\/\/([^/]+)(\/.*)$/i);if(!hb)return null;let [,hc,hd,he]=hb,hf=hc['toLowerCase'](),hg=hf==='*'?['http','https']:hf==='http'||hf===i8(0x1d4)?[hf]:null;if(!hg)return null;let hh=hd['trim']()['toLowerCase'](),hi=!0x1,hk=[],hl=[];if(hh==='*')hi=!0x0;else{if(hh['startsWith']('*.')){let ho=hh['slice'](0x1);if(!ho['startsWith']('.')||ho['length']<=0x1)return null;hl=[ho];}else{if(!hh['includes']('*'))hk=[hh];else return null;}}if(!he['startsWith']('/'))return null;let hm=he['indexOf']('*');if(hm!==-0x1&&hm!==he[i8(0x264)]-0x1)return null;let hn=hm===-0x1?he:he['slice'](0x0,-0x1);return{'schemes':hg,'matchAnyHost':hi,'exactHosts':hk,'wildcardHostSuffixes':hl,'exactPaths':hm===-0x1?[hn]:void 0x0,'pathPrefixes':hm===-0x1?void 0x0:[hn]};},b2=ha=>{const i9=hQ;if(!Array['isArray'](ha))return;let hb=ha['filter'](hc=>typeof hc=='string'&&!!hc['trim']())[i9(0x2d7)](b1)['filter'](hc=>!!hc);return hb['length']?hb:void 0x0;},b3=(ha,hb)=>hb['matchAnyHost']||hb['exactHosts']['includes'](ha)||hb['wildcardHostSuffixes']['some'](hc=>ha['endsWith'](hc)),b4=(ha,hb)=>hb['exactPaths']?.['includes'](ha)||!!hb['pathPrefixes']?.['some'](hc=>ha['startsWith'](hc))||!hb['exactPaths']?.['length']&&!hb['pathPrefixes']?.['length'],b5=({manifest:ha,packageJson:hb,fallbackName:hc})=>{const ia=hQ;let hd=aZ(hb?.['config'])?hb['config']:null,he=(aZ(ha)?ha:null)??hd??{},hf=typeof he['displayName']=='string'&&he['displayName']||typeof he['name']=='string'&&he['name']||typeof he['title']=='string'&&he['title']||hc,hg=typeof he[ia(0x1f5)]=='string'&&he['shortName']||typeof he[ia(0x1e9)]=='string'&&he['tag']||void 0x0,hh={...he,'displayName':hf,'shortName':hg,'name':hf,'title':typeof he[ia(0x1c5)]=='string'&&he['title']?he['title']:hf,'tag':hg};(typeof hh['icon']!='string'||!hh[ia(0x31d)])&&delete hh[ia(0x31d)],(typeof hh['displayName']!='string'||!hh['displayName'])&&(hh['displayName']=hc),(typeof hh['shortName']!='string'||!hh['shortName'])&&delete hh['shortName'],(typeof hh['tag']!='string'||!hh[ia(0x1e9)])&&delete hh[ia(0x1e9)],Array['isArray'](hh['permissions'])||delete hh['permissions'],hh[ia(0x313)]=b0(he['regions']),typeof hh['manifestVersion']!='number'&&(hh['manifestVersion']=0x1),aZ(hh['capabilities'])||delete hh['capabilities'],aZ(hh[ia(0x2be)])||delete hh['settings'],aZ(hh['secrets'])||delete hh['secrets'];let hi=b2(he['matches']);return hi?(hh['matches']=Array['isArray'](he['matches'])?he['matches']['filter'](hk=>typeof hk=='string'):void 0x0,Object['defineProperty'](hh,aY,{'value':hi,'enumerable':!0x1,'configurable':!0x1,'writable':!0x1})):delete hh[ia(0x259)],hh;},b6=async({dir:ha,packageJson:hb,fallbackName:hc})=>{let hd=join(ha,'manifest.json');return b5({'manifest':await aD(hd)?await aI(hd):null,'packageJson':hb,'fallbackName':hc});},b7=ha=>ha[hQ(0x280)]?.['displayName']||ha['manifest']?.['name']||ha['manifest']?.['title']||ha['package']?.['config']?.['title']||ha['package']?.['name']||ha['name']||'(unknown\x20extension)',b8=ha=>ha['manifest']?.[hQ(0x1f5)]||ha['manifest']?.[hQ(0x1e9)]||ha['package']?.['config']?.['tag']||void 0x0,b9=(ha,hb)=>{let hc=ha['manifest']?.[aY];if(!Array['isArray'](hc)||!hc['length'])return!0x1;let hd=hb['protocol']['slice'](0x0,-0x1)['toLowerCase'](),he=hb['hostname']['toLowerCase'](),hf=hb['pathname'];return hc['some'](hg=>!(hg['schemes']?.['length']&&!hg['schemes']['includes'](hd)||!b3(he,hg)||!b4(hf,hg)));},ba=ha=>{let hb=ha['manifest']?.[aY];return Array['isArray'](hb)&&hb['length']>0x0;},bb=ha=>ha['exports'],bc=ha=>{const ib=hQ;if(!ha)return;let hb=Object['fromEntries'](new Headers(ha)['entries']());return Object['keys'](hb)[ib(0x264)]?hb:void 0x0;},bd=(...ha)=>{let hb=Object['assign']({},...ha['map'](hc=>bc(hc)));return Object['keys'](hb)['length']?hb:void 0x0;},be=async(ha,hb)=>{if(!hb)return ha;let hc=await ha['clone']()['arrayBuffer'](),hd=Buffer['from'](hc)['toString']('base64'),he=hb['replace']('{{challenge}}',hd);return new Request(ha['url'],{'method':ha['method'],'headers':ha['headers'],'body':he});},bf=async ha=>{const ic=hQ;let hb=await ha['clone']()['arrayBuffer']();if(hb[0x0]===0x7b){let hc=null;try{hc=JSON['parse'](Buffer['from'](hb)['toString']('utf8'));}catch(hd){q[ic(0x1d1)]('Can\x27t\x20parse\x20license\x20response\x20as\x20JSON'),q['debug'](hd['message']),q['debug']('Base64\x20response\x20data:\x20'+Buffer['from'](hb)['toString']('base64'));}if(!hc)return ha;try{let he='CAIS',hf=he+Buffer['from'](hb)['toString']('utf8')['split']('\x22'+he)[0x1]['split']('\x22')[0x0],hg=Buffer['from'](hf,'base64');return new Response(hg,{'status':ha['status'],'headers':ha['headers']});}catch{q['error'](ic(0x24e)),q['error']('Response:\x20'+JSON['stringify'](hc));}}return ha;},bg=ha=>({'url':ha['url'],'headers':ha['headers'],'http2':ha['http2'],'audioLanguage':ha['audioLanguage'],'audioType':ha['audioType'],'subtitles':Array['isArray'](ha[hQ(0x212)])?ha['subtitles']['filter'](hb=>!!hb&&typeof hb=='object'&&typeof hb['url']=='string')['map'](hb=>({...hb})):void 0x0}),bh=ha=>({'url':ha['url'],'headers':ha['headers']}),bi=ha=>{const id=hQ;if(ha)return'server'in ha?{'kind':'server','server':ha['server'],'headers':ha['headers'],'template':ha[id(0x2d1)],'http2':ha['http2']}:'payload'in ha?{'kind':'payload','payload':ha['payload']}:{'kind':'keys','keys':ha['keys']['map'](hb=>({...hb}))};},bj=ha=>{let hb=ha['source']?bg(ha['source']):void 0x0,hc=ha['source']?.['drm']?bi(ha['source']['drm']):void 0x0;return{'id':ha['id'],'type':'episodeNumber'in ha?'episode':'movie','title':ha['title'],'seasonNumber':ha['seasonNumber'],'episodeNumber':ha['episodeNumber'],'episodeTitle':ha['episodeTitle'],'source':hb?bh(hb):void 0x0,'context':ha['id']||hb||hc?{'legacy':{'contentId':ha['id'],'source':hb,'drm':hc}}:void 0x0};},bk=(ha,hb)=>{const ie=hQ;let hc=new Input({'source':new UrlSource(ha['url'],{'requestInit':{'headers':ha['headers']},'fetchFn':hb['context'][ie(0x2cb)]['fetch']['bind'](hb[ie(0x2fd)]['http'])}),'formats':ALL_FORMATS});for(let hd of ha['subtitles']??[])hc['addSubtitleTrack'](new UrlSource(hd['url']),{'name':hd['label']||hd['title'],'languageCode':hd['language'],'codec':hd['format'],'disposition':{'default':hd['default'],'forced':hd[ie(0x32f)]}});return hc;},bl=async(ha,hb)=>{if(!hb?.['trim']())return;let hc=await ha['getAudioTracks']({'filter':async hd=>{let he=await hd['getLanguageCode']();return!he||he==='und';}});for(let hd of hc)hd['setLanguageCode'](hb);},bm=async({entry:ha,extension:hb,options:hc})=>{const ig=hQ;let hd=ha[ig(0x2fd)]?.['legacy'];if(hd?.['source']?.['url'])return{'source':hd['source'],'drm':hd['drm']};let he=hd?.['contentId']??ha['id'];if(!he)return ha['source']?{'source':{'url':ha['source']['url'],'headers':ha['source']['headers']},'drm':hd?.['drm']}:null;let hf=await bb(hb)['fetchContentSource']?.(String(he),hc);return hf?{'source':bg(hf),'drm':bi(hf['drm'])}:null;},bn=async({entry:ha,extension:hb,options:hc})=>{const ih=hQ;let hd=bb(hb),he=ha['context']?.['legacy']?.[ih(0x1de)];if(he)return he['kind']==='payload'?bi(await hd['fetchContentDrm']?.(he['payload'],hc)):he;},bo=ha=>({async 'requestLicense'({data:hb,options:hc,resource:hd}){const ii=hQ;let he=await bn({'entry':hd['entry'],'extension':ha,'options':hc});if(!he||he['kind']!=='server')throw Error('Legacy\x20extension\x20did\x20not\x20provide\x20a\x20DRM\x20license\x20server');let hf=new Request(he['server'],{'method':'POST','headers':bd(he['headers'],ha['context']['http']['headers']),'body':Buffer['from'](hb)}),hg=await be(hf,he['template'])||hf,hh=await ha['context'][ii(0x2cb)]['fetch'](hg['url'],{'body':await hg['arrayBuffer'](),'headers':hg['headers'],'method':hg['method']}),hi=await bf(hh)||hh;return new Uint8Array(await hi['arrayBuffer']());},async 'resolveKeys'({options:hb,resource:hc}){let hd=await bn({'entry':hc['entry'],'extension':ha,'options':hb});return hd?.['kind']==='keys'?hd['keys']:[];}}),bp=ha=>({async 'initialize'(){await bb(ha)['init']?.();},async 'getEntries'({url:hb,options:hc}){return(await bb(ha)['fetchContentMetadata']?.(hb,hc)??[])['map'](bj);},async 'resolveEntry'({entry:hb,options:hc}){const ij=hQ;let hd=await bm({'entry':hb,'extension':ha,'options':hc});if(!hd?.['source']?.['url'])throw Error('Legacy\x20extension\x20did\x20not\x20provide\x20a\x20media\x20source');let he=hd['source'],hf=hd['drm']??hb['context']?.['legacy']?.[ij(0x1de)],hg={...hb,'source':bh(he),'context':{...hb['context'],'legacy':{...hb['context']?.['legacy'],'source':he,'drm':hf}}},hh=bk(he,ha);return await bl(hh,he['audioLanguage']),{'entry':hg,'input':hh};},'drm':bo(ha)}),bq=ha=>ha&&'exports'in ha?ha['exports']:ha,br=ha=>ha?.['package']?.['name']||'(unknown\x20extension)',bs=ha=>{const ik=hQ;let hb=bq(ha);return!hb||typeof hb!='object'?null:'getEntries'in hb&&typeof hb['getEntries']==ik(0x231)?'v2':'fetchContentMetadata'in hb&&typeof hb['fetchContentMetadata']=='function'?'legacy-content':null;},bt=ha=>bs(ha)!==null,bu=ha=>{let hb=bq(ha);if(!hb||typeof hb!='object')throw Error('Invalid\x20extension\x20exports');return hb;},bv=ha=>{const il=hQ;let hb=bu(ha),hc=bs(hb);if(hc==='v2')return hb;if(hc==='legacy-content')return bp(ha);throw Error('Unsupported\x20extension\x20interface:\x20'+ha[il(0x2cd)]['name']);},bw=async ha=>{const im=hQ;let hb=bu(ha),hc=br(ha),hd=bs(hb);try{if(hd==='v2'&&typeof hb['initialize']=='function'){await hb['initialize']?.();return;}hd==='legacy-content'&&typeof hb['init']=='function'&&await hb['init']?.();}catch(he){let hf=hd==='v2'?'initialize':'init',hg=he instanceof Error?he:Error(String(he));throw q[im(0x1d1)]('Extension\x20'+hc+'\x20'+hf+'\x20failed:\x20'+hg['message']),hg['stack']&&q['debug'](hg['stack']),hg;}},bx=ha=>ha['username']||ha['password']||ha['otp']?{'method':'password','username':ha['username']??'','password':ha['password']??'','otp':ha['otp']}:{'method':hQ(0x287)},by=async(ha,hb)=>{const io=hQ;let hc=bu(ha),hd=br(ha);try{if(typeof hc[io(0x307)]?.['login']=='function'){await hc['auth']?.['login']?.(bx(hb));return;}typeof hc[io(0x1c2)]=='function'&&await hc['login']?.(hb);}catch(he){let hf=typeof hc['auth']?.['login']=='function'?io(0x28f):io(0x1c2),hg=he instanceof Error?he:Error(String(he));throw q['error']('Extension\x20'+hd+'\x20'+hf+'\x20failed:\x20'+hg['message']),hg['stack']&&q['debug'](hg['stack']),hg;}},bz=async ha=>{const ip=hQ;let hb=bu(ha),hc=br(ha);try{if(typeof hb['auth']?.['logout']=='function'){await hb['auth']?.['logout']?.();return;}typeof hb[ip(0x300)]=='function'&&await hb['logout']?.();}catch(hd){let he=typeof hb['auth']?.['logout']=='function'?'auth.logout':'logout',hf=hd instanceof Error?hd:Error(String(hd));throw q['error']('Extension\x20'+hc+'\x20'+he+'\x20failed:\x20'+hf['message']),hf['stack']&&q['debug'](hf['stack']),hf;}},bA=({url:ha,options:hb,resource:hc,signal:hd})=>({'url':ha,'options':hb,'resource':hc,'signal':hd}),bB=async(ha,hb)=>{let hc=bu(ha);if(bs(hc)!=='v2')return;let hd=hc;typeof hd['hooks']?.['beforeDownload']=='function'&&await hd['hooks']['beforeDownload'](bA(hb));},bC=async(ha,hb)=>{const iq=hQ;let hc=bu(ha),hd=br(ha),he=bs(hc);if(!hb['skipMux']&&he==='v2'&&typeof hc['hooks']?.['afterMux']=='function')try{await hc['hooks']?.['afterMux']?.(bA(hb));}catch(hf){let hg=hf instanceof Error?hf:Error(String(hf));q['error']('Extension\x20'+hd+'\x20hooks.afterMux\x20failed:\x20'+hg['message']),hg['stack']&&q['debug'](hg['stack']);}if(he==='legacy-content'&&typeof hc['onDownloadFinished']=='function')try{await hc['onDownloadFinished']?.();}catch(hh){let hi=hh instanceof Error?hh:Error(String(hh));q['error']('Extension\x20'+hd+'\x20onDownloadFinished\x20failed:\x20'+hi['message']),hi[iq(0x21c)]&&q['debug'](hi['stack']);}},bD=async(ha,{context:hb,dirname:hc,skipValidation:hd})=>{const ir=hQ;let he=await y(ha,{'dirname':hc,'context':hb})['finally'](()=>{});if(!he)return null;let hf='default'in he['exports']?he['exports']['default']:he['exports'];if(!hd&&!bt(hf))throw q['error']('Incompatible\x20extension\x20interface'),aO(aL[ir(0x20a)],'Incompatible\x20extension\x20interface',{'extensionPath':ha});return he['exports']=hf,he;},bE=ha=>ha['split']('/')['reverse']()[0x0]['replaceAll']('@','')['replace']('extension-','')['replace']('-extension',''),bF=async ha=>{const is=hQ;let hb=[join(ha,'package.json'),join(ha,'package','package.json')],hc;for(let hl of hb)if(await aD(hl)){hc=hl;break;}let hd={},he='',hf='',hg='',hh=ha;if(hc){hh=dirname(hc),hd=await aI(hc)||{};let hm=hd['main']||'index.js';he=join(hh,hm),hf=hd['name'],hg=hh;}else{let hn=await aE(ha),ho=hn[is(0x1cd)](hp=>hp['name']==='index.js')||hn['find'](hp=>hp['name']==='main.js')||hn['find'](hp=>hp['name']==='service.js')||hn['find'](hp=>hp['name']==='extension.js')||hn['find'](hp=>hp['name']['endsWith'](is(0x219)));ho&&(he=join(ha,ho['name']),hf=parse(he)[is(0x30e)]);}if(!he)throw aO(aL['IMPORT_INVALID'],'Extension\x20main\x20script\x20not\x20found:\x20'+ha,{'dir':ha});hg||=dirname(he);let hi=bE(hf),hk=await b6({'dir':hh,'packageJson':hd,'fallbackName':hi});return{'name':hi,'path':he,'dir':hg,'package':hd,'manifest':hk};},bG=async(ha,hb)=>{const it=hQ;try{let hc=await bF(ha),hd=b7(hc),he=E({'name':hc['name'],'title':hd,'dir':G});await he['cookieStore']['import'](join(G,hc['name'],'cookies.txt'));let hf=await bD(hc[it(0x306)],{'context':he,'dirname':hc['dir']});if(!hf)throw aO(aL['IMPORT_INVALID'],'Failed\x20to\x20load\x20extension\x20script:\x20'+hc['path'],{'source':hb,'dir':ha,'path':hc['path']});return{'source':hb,'exports':hf['exports'],'context':he,...hc};}catch(hg){throw q['error']('Error\x20importing\x20module:\x20'+hg['message']),q['debug'](hg instanceof Error?hg['stack']||hg['message']:String(hg)),hg;}},bH=g;let bI=bH;const bJ=ha=>ha['replace'](/\/+$/,''),bK=()=>bJ(bI),bL=(ha,hb)=>{let hc=bJ(ha);return hb?hc+'/'+(hb['startsWith']('/')?hb['slice'](0x1):hb):hc;},bM=ha=>bL(bK(),ha);let bN=null;async function bO(ha){const iu=hQ;if(!bN){q['debug']('Public\x20key\x20not\x20found');let hh=await bQ();if(hh)q['debug']('Public\x20key\x20found:\x20'+hh['slice'](0x0,0x32)+'...');else return q['error']('Public\x20key\x20not\x20found\x20in\x20response'),!0x1;if(bN=await bR(hh)['catch'](()=>null),!bN)return q['error'](iu(0x2b2)),!0x1;}let hb=ha['headers']['get']('X-Signature-Timestamp'),hc=ha['headers']['get']('X-Signature');if(!hb||!hc)return q['error']('Signature\x20headers\x20not\x20found'),!0x1;if(Date['now']()-parseInt(hb)>0x493e0)return!0x1;let hd=hb+':'+await ha['clone']()['text'](),he=bS(hc),hf=new TextEncoder(),hg=crypto['subtle']['verify']({'name':'ECDSA','hash':'SHA-256'},bN,he,hf['encode'](hd));return hg||(bN=null),hg;}const bP=()=>atob(f);async function bQ(ha='/auth/.well-known/public-key'){try{let hb=await fetch(''+bK()+ha);return hb['ok']?await hb['text']():bP();}catch(hc){return q['error'](hc['message']),bP();}}async function bR(ha){let hb=bS(ha['replace']('-----BEGIN\x20PUBLIC\x20KEY-----','')['replace']('-----END\x20PUBLIC\x20KEY-----','')['trim']());return crypto['subtle']['importKey']('spki',hb,{'name':'ECDSA','namedCurve':'P-256'},!0x0,['verify']);}function bS(ha){let hb=atob(ha),hc=new Uint8Array(hb['length']);for(let hd=0x0;hd<hb['length'];hd++)hc[hd]=hb['charCodeAt'](hd);return hc['buffer'];}const bT=ha=>createAuthClient({'baseURL':ha+'/auth','plugins':[deviceAuthorizationClient(),tributeClient()],'fetchOptions':{'retry':0x0,'onSuccess':hb=>{const iv=hQ;let hc=hb['response'][iv(0x31b)][iv(0x236)]('set-auth-token');hc&&(c5['accessToken']=hc,c6(c5));},'auth':{'type':hQ(0x2e5),'token':()=>c5['accessToken']||c7()['then'](hb=>hb?.['accessToken'])},'onResponse':async hb=>await bO(hb['response'])['catch'](()=>!0x1)?(q['debug'](hQ(0x279)+hb['response']['url']),hb):(q['error']('Response\x20verification\x20failed:\x20'+hb['response']['status']+'\x20'+hb['response']['statusText']+'\x20'+hb['response'][hQ(0x230)]),w['emit']('error',{'code':'SIGNATURE_VERIFICATION_FAILED'}),new Response(JSON['stringify']({'error':'SIGNATURE_VERIFICATION_FAILED','message':'Signature\x20verification\x20failed'}),{'status':0x191,'statusText':'Unauthorized'}))}});let bU='',bV=bT(bK());const bW=()=>{let ha=bK();return(!bV||bU!==ha)&&(bU=ha,bV=bT(ha)),bV;},bX=async(ha,hb,hc={})=>{const iw=hQ;let {signal:hd,timeoutMs:he=0x2710}=hc,hf=new AbortController(),hg=()=>hf['abort'](hd?.['reason']);hd?.['addEventListener']('abort',hg,{'once':!0x0});let hh=!0x1,hi=setTimeout(()=>{hh=!0x0,hf['abort'](Error('Request\x20timeout'));},he);try{let hk=await fetch(ha,{...hb,'signal':hf['signal']});if(!hk['ok'])throw Error('Request\x20failed:\x20'+hk['status']);return hk['json']();}catch(hl){throw hh&&hl instanceof DOMException&&hl['name']==='AbortError'?Error(iw(0x1e3)+he+'ms',{'cause':hl}):hl;}finally{clearTimeout(hi),hd?.['removeEventListener'](iw(0x309),hg);}},bY={'getExtensions':(ha,hb)=>bX(bM('extensions'),{'headers':ha?{'Authorization':'Bearer\x20'+ha}:void 0x0},{'signal':hb}),'getSubscriptions':(ha,hb)=>bX(bM('subscriptions'),{'headers':{'Authorization':'Bearer\x20'+ha}},{'signal':hb})},bZ=0x12c*0x3e8,c0=0x12c*0x3e8,c1=new QueryClient({'queryCache':new QueryCache(),'defaultOptions':{'queries':{'staleTime':bZ,'gcTime':c0}}}),c2={'get':ha=>c1[hQ(0x1cb)](ha),'set':(ha,hb)=>c1['setQueryData'](ha,hb),'reset':ha=>{ha?c1['removeQueries']({'queryKey':ha}):c1['clear']();},'invalidate':ha=>c1['invalidateQueries']({'queryKey':ha}),'refresh':async(ha,hb)=>(c1['invalidateQueries']({'queryKey':ha}),c3({'queryKey':ha,'queryFn':hb}))},c3=async({queryKey:ha,queryFn:hb,staleTime:hc,enabled:hd=!0x0})=>{const ix=hQ;try{let he=c1['getQueryState'](ha),hf=he?he?.['isInvalidated']||!he?.['dataUpdatedAt']&&!he?.[ix(0x2f5)]||Date['now']()-he['dataUpdatedAt']>(hc??bZ):!0x0,hg=()=>c2[ix(0x2b7)](ha),hh=()=>c2['invalidate'](ha),hi=()=>c2[ix(0x248)](ha,hb);return hd?he&&!hf?{'data':he['data'],'reset':hg,'invalidate':hh,'refresh':hi}:{'data':await c1['fetchQuery']({'queryKey':ha,'queryFn':hb,'staleTime':hc}),'reset':hg,'invalidate':hh,'refresh':hi}:{'data':null,'reset':hg,'invalidate':hh,'refresh':hi};}catch(hk){throw c1['removeQueries']({'queryKey':ha}),hk;}},c4=new D(join(x,'session.json')),c5={'accessToken':'','tokenType':'','scope':'','createdAt':''},c6=async ha=>{const iy=hQ;c4['setItem']('access_token',ha['access_token']),c4['setItem']('token_type',ha['token_type']||'Bearer'),c4['setItem']('scope',ha['scope']),c4['setItem'](iy(0x30a),new Date()['toISOString']()),c5['accessToken']=ha['access_token'],c5['tokenType']=ha['token_type']||'Bearer',c5['scope']=ha[iy(0x250)],c5[iy(0x2f6)]=new Date()[iy(0x283)]();},c7=async()=>{const iz=hQ;let ha=c4['getItem'](iz(0x204)),hb=c4['getItem']('token_type'),hc=c4[iz(0x2ed)]('scope'),hd=c4['getItem']('created_at');return!ha||!hb||!hc||!hd?null:{'accessToken':ha,'tokenType':hb,'scope':hc,'createdAt':new Date(hd)};},c8=async()=>{let ha=await c3({'queryKey':['session',bK()],'queryFn':()=>bW()['getSession']()});return{'session':ha['data']?.['data']?.['session'],'user':ha['data']?.['data']?.['user'],'error':ha['data']?.['error']};},c9=async()=>{const iA=hQ;let {user:ha,error:hb}=await c8(),hc=await c3({'queryKey':['subscriptions',bK()],'queryFn':async()=>bW()[iA(0x285)][iA(0x2c1)](),'enabled':!!ha?.['id']});return{'data':hc['data']?.['data'],'error':hc['data']?.['error']??hb};},ca=['lowConnectionsCount','oneDevice'],cb=['mediumConnectionsCount',hQ(0x251),'proxy','decryption','customIcon','tags','parallelDownloads','userExtensions','portableBuild'],cc=['highConnectionsCount',hQ(0x24f),'customMuxFormat','customDecrypter',hQ(0x2a7),'premiumExtensions'],cd={'basic':ca,'plus':cb,'pro':[...ca,...cb,...cc]},ce=()=>c3({'queryKey':['lava-subscriptions',bK()],'queryFn':async()=>{const iB=hQ;let ha=c5['accessToken']||(await c7())?.[iB(0x319)];return ha?bY['getSubscriptions'](ha):[];}}),cf=async()=>{const iC=hQ;let ha=await c9();return{'plan':(await ce())['data']?.[0x0]?.['productTitle']||ha['data']?.['find'](hb=>new Date(hb['expiresAt'])>new Date())?.['tributeSubscriptionName'],'error':ha[iC(0x1d1)]};},cg=async()=>{const iD=hQ;let {user:ha,session:hb}=await c8(),{plan:hc,error:hd}=await cf();return{'user':ha,'session':hb,'error':hd,'plan':hc,'grantedBenefits':hc?cd[hc[iD(0x26a)]()]??[]:[]};};var ch=a5((ha,hb)=>{const iJ=hQ;hb['exports']={'instagram':{'create':hc=>{const iI=b;let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{const iE=b;let hp=he??Streamyx??{};hp&&(hp['defineExtension']||=hw=>hw);let hq=hp[iE(0x22f)];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'],hp['utils'],hp['Input'],hp['UrlSource'],hp['ALL_FORMATS'],hp['DASH'],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp['MP4'],hp['MP3'];let hr={'Referer':'https://www.instagram.com/'},hs={'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'},ht=async hw=>{const iF=iE;let hx=new URLSearchParams({'doc_id':'8845758582119845','variables':JSON['stringify']({'shortcode':hw,'child_comment_count':0x3,'fetch_comment_count':0x28,'parent_comment_count':0x18,'has_threaded_comments':!0x0})});try{let hy=await hf('https://www.instagram.com/graphql/query/?'+hx['toString'](),{'headers':hs});return hy['ok']?(await hy['json']())['data']?.['xdt_shortcode_media']??null:(hi['error']('GraphQL\x20request\x20failed\x20with\x20status:\x20'+hy[iF(0x2a6)]),null);}catch(hz){return hi['error']('Error\x20during\x20GraphQL\x20fetch:',hz),null;}},hu=async hw=>{try{let hx=await hf('https://www.instagram.com/p/'+hw+'/embed/captioned/',{'headers':{'User-Agent':hs['User-Agent']}});if(!hx['ok'])return null;let hy=(await hx['text']())['match'](/window\.__additionalDataLoaded\('extra',\s*({.+?})\s*\);/);return hy?.[0x1]?JSON['parse'](hy[0x1])['shortcode_media']??null:null;}catch(hz){return hi['error']('Error\x20during\x20embed\x20page\x20fetch:',hz),null;}},hv=hw=>{const iG=iE;let hx=hw[iG(0x2d3)]?.['edges']?.[0x0]?.['node']?.['text']||'Instagram\x20Post',hy=[],hz=hB=>{if(!hB)return;let hC=hB['is_video']&&hB['video_url']?hB['video_url']:hB['display_url'];hC&&hy['push']({'title':hx,'source':{'url':hC,'headers':hr}});},hA=hw['edge_sidecar_to_children']?.['edges'];if(hA?.['length']){for(let hB of hA)hz(hB['node']);}else hz(hw);return hy;};hd['exports']=hq({async 'getEntries'({url:hw}){const iH=iE;let hx=new URLPattern({'pathname':'/:type(p|reel|tv|reels|videos)/:shortcode{/*}?','baseURL':new URL(hw)['origin']})['exec'](hw)?.['pathname']['groups'][iH(0x2bc)];if(!hx)return hi['error'](iH(0x258)),hi['debug'](hw),[];try{let hy=await ht(hx);return hy||=(hi['warn']('GraphQL\x20method\x20failed.\x20Falling\x20back\x20to\x20embed\x20page\x20scraping.'),await hu(hx)),hy?hv(hy):(hi[iH(0x1d1)]('All\x20extraction\x20methods\x20failed.\x20The\x20post\x20may\x20be\x20private,\x20deleted,\x20or\x20require\x20a\x20login.'),[]);}catch(hz){return hi['error']('A\x20critical\x20error\x20occurred\x20while\x20fetching\x20Instagram\x20metadata:',hz),[];}}});})(hc['Azot'],hc['fetch'],hc[iI(0x2a3)],hc['cookieStore'],hc['console'],hc['prompt'],hc['alert'],hc['document'],hc['navigator'],hc['window']),hd['exports']['default']||hd['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/*',iJ(0x1e8)]},'pkg':{'name':'instagram','version':'0.0.1','private':!0x0,'keywords':[iJ(0x2e4)],'homepage':'https://instagram.com/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':iJ(0x2c4)}],'type':'module','main':iJ(0x2da)}},'ntv':{'create':hc=>{const iO=iJ;let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{const iK=b;let hp=he??Streamyx??{};hp&&(hp['defineExtension']||=hy=>hy);let hq=hp['defineExtension'];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'],hp['utils'];let hr=hp['Input'],hs=hp['UrlSource'];hp['ALL_FORMATS'],hp['DASH'],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp[iK(0x1df)],hp['MP3'];let ht=(hy,hz,hA)=>hy['split'](hz)[0x1]?.['split'](hA)[0x0],hu=(hy,hz)=>{let hA=ht(hy,'<'+hz+'>','</'+hz+'>')?.['trim']();if(!hA)return;let hB=hA['match'](/<!\[CDATA\[(.*?)\]\]>/s);return hB?.[0x1]?hB[0x1]['trim']():hA['split']('DATA[')[0x1]?.['split'](']')[0x0]?.['trim']()||hA;},hv=async(hy,hz)=>{const iL=iK;let hA=await hf(hy);return hA['ok']?await hA['text']():(hi[iL(0x1d1)]('Failed\x20to\x20fetch\x20'+hz+'.\x20Status:\x20'+hA['status']+'\x20'+hA['statusText']),null);},hw=async(hy,hz,hA)=>{const iM=iK;let hB=new URL(hy)['pathname'],hC=new Set();for(let hE of hz[iM(0x320)]('href=\x22/serial')){if(!hE['startsWith']('/'))continue;let hF=hE['split']('\x22')[0x0];!hF||hF['length']<=0x1||hF['includes']('/issues/')||hF['includes']('/about/')||hF['split']('/')['length']<=0x2||hC['add'](hy['replace'](hB,'/serial'+hF));}let hD=[];for(let hG of hC)hD['push'](...await hx(hG,hA));return hD;},hx=async(hy,hz=new Set())=>{const iN=iK;if(hz[iN(0x222)](hy))return[];hz['add'](hy);let hA=await hv(hy,'NTV\x20page');if(!hA)return[];let hB=ht(hA,'<meta\x20property=\x22ya:ovs:feed_url\x22\x20content=\x22','\x22>')??ht(hA,'<meta\x20property=\x22ya:ovs:feed_url\x22\x20content=\x22','\x22\x20/>');if(!hB)return new URL(hy)['pathname']['includes']('/serial')?hw(hy,hA,hz):(hi['error']('Could\x20not\x20find\x20video\x20link\x20in\x20the\x20page.'),[]);let hC=hB['split']('video/')[0x1]?.['split']('/')[0x0];if(!hC)return hi['error']('Could\x20not\x20parse\x20NTV\x20video\x20id.'),[];let hD=await hv('https://www.ntv.ru/vi'+hC+'/','NTV\x20XML\x20metadata');if(!hD)return[];let hE=hu(hD,'dash')||hu(hD,'hls'),hF=hu(hD,'file')||hu(hD,'video'),hG=hu(hD,'hifile')||hu(hD,'hd_video')||hE||hF;if(!hG)return hi['error'](iN(0x2e2)),[];let hH=ht(hD,'<embed_tag>','</embed_tag>')||'NTV',hI=ht(hA,'\x22name\x22:\x22','\x22'),hJ=hI?.['includes']('серия')?hI['split']('-')[0x0]:void 0x0,hK=hJ?parseInt(hJ,0xa):void 0x0,hL=ht(hD,'<subtitles>','</subtitles>'),hM=hL?'https://www.ntv.ru'+hL:void 0x0;return hM&&hi['debug']('Subtitles:\x20'+hM),[{'type':hK?'episode':'video','title':hH,'seasonNumber':hK?0x1:void 0x0,'episodeNumber':hK,'source':{'url':hG},'context':hM?{'subtitles':[{'url':hM,'language':'ru','label':'Russian'}]}:void 0x0}];};hd['exports']=hq({'getEntries'({url:hy}){return hx(hy,new Set());},'resolveEntry'({entry:hy}){if(!hy['source']?.['url'])throw Error('NTV\x20entry\x20is\x20missing\x20source\x20URL');let hz=new hr({'source':new hs(hy['source']['url'])}),hA=hy['context']?.['subtitles']??[];for(let hB of hA)hz['addSubtitleTrack'](new hs(hB['url']),{'languageCode':hB['language'],'name':hB['label']});return{'entry':hy,'input':hz};}});})(hc['Azot'],hc['fetch'],hc['localStorage'],hc['cookieStore'],hc['console'],hc['prompt'],hc['alert'],hc['document'],hc['navigator'],hc['window']),hd['exports']['default']||hd[iO(0x1ec)];},'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':['tv-channels'],'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':hc=>{let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{const iP=b;let hp=he??Streamyx??{};hp&&(hp['defineExtension']||=hr=>hr);let hq=hp['defineExtension'];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'],hp[iP(0x308)],hp['Input'],hp['UrlSource'],hp['ALL_FORMATS'],hp['DASH'],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp['MP4'],hp['MP3'],hd['exports']=hq({async 'getEntries'({url:hr}){let hs=await hf(hr);if(!hs['ok'])throw Error('Failed\x20to\x20fetch\x20RBC\x20page:\x20'+hs['status']+'\x20'+hs['statusText']);let ht=(await hs['text']())['match'](/(?:https?:)?\/\/[^\s"'<>]+\.m3u8(?:\?[^\s"'<>]*)?/i)?.[0x0];if(!ht)throw Error('Could\x20not\x20find\x20RBC\x20playlist\x20URL.');return[{'type':'video','source':{'url':ht['startsWith']('//')?'https:'+ht:ht}}];}});})(hc['Azot'],hc['fetch'],hc['localStorage'],hc['cookieStore'],hc['console'],hc['prompt'],hc['alert'],hc['document'],hc['navigator'],hc['window']),hd['exports']['default']||hd['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':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':iJ(0x2e8),'url':'https://github.com/vitalygashkov'}],'type':'module','main':'rbc.ts'}},'rutube':{'create':hc=>{const iU=iJ;let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{const iQ=b;let hp=he??Streamyx??{};hp&&(hp[iQ(0x22f)]||=hu=>hu);let hq=hp['defineExtension'];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'],hp['utils'],hp['Input'],hp['UrlSource'],hp['ALL_FORMATS'],hp['DASH'],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp['MP4'],hp['MP3'];let hr=['/video/:id{/}?','/play/embed/:id{/}?',iQ(0x2c0),'/yappy/:yappyId{/}?','/video/private/:id{/}?'],hs=hu=>{const iR=iQ;let hv={'yappyId':'','id':'','key':''};hv['key']=new URL(hu)['searchParams']['get']('p')??'';for(let hw of hr){let hx=new URLPattern(hw,'https://rutube.ru')['exec'](hu);hx&&(Object['assign'](hv,hx[iR(0x29d)]['groups']),Object['assign'](hv,hx['search']['groups']));}return hv;},ht=async hu=>{const iS=iQ;let hv=(await hf('https://rutube.ru/pangolin/api/web/yappy/yappypage/?client=wdp&videoId='+hu+iS(0x2b1))[iS(0x1f6)](hw=>hw['json']())[iS(0x273)](()=>null))?.['results']?.['find'](hw=>String(hw['id'])===hu)?.['link'];return hv?[{'type':'video','title':'rutube_yappy_'+hu,'source':{'url':hv}}]:(hi['error']('ErrorEmptyDownload'),[]);};hd['exports']=hq({async 'getEntries'({url:hu}){const iT=iQ;let hv=hs(hu);if(hv[iT(0x227)])return ht(hv['yappyId']);if(!hv['id'])return hi['error'](iT(0x2b8)),[];let hw=new URL('https://rutube.ru/api/play/options/'+hv['id']+iT(0x1c8));hv[iT(0x317)]&&hw['searchParams'][iT(0x255)]('p',hv['key']);let hx=await hf(hw)['then'](hy=>hy['json']())['catch'](hy=>(hy instanceof Error&&hi['debug'](hy['message']),null));return hx?hx['detail']||!hx['video_balancer']?.['m3u8']?(hi['error']('Play\x20info\x20is\x20empty'),[]):hx['live_streams']?.['hls']?(hi['error']('Live\x20videos\x20are\x20not\x20supported'),[]):[{'type':'video','title':hx['title']?.['trim']()||'rutube_'+hv['id'],'source':{'url':hx['video_balancer'][iT(0x2c6)]}}]:(hi[iT(0x1d1)]('Cannot\x20fetch\x20play\x20info'),[]);}});})(hc['Azot'],hc['fetch'],hc['localStorage'],hc['cookieStore'],hc['console'],hc['prompt'],hc[iU(0x1b7)],hc['document'],hc['navigator'],hc['window']),hd[iU(0x1ec)]['default']||hd['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':['video-hostings'],'homepage':'https://rutube.ru/','author':{'name':'Azot','url':'https://azot.mov/'},'contributors':[{'name':'Vitaly\x20Gashkov','email':'vitalygashkov@vk.com','url':'https://github.com/vitalygashkov'}],'type':'module','main':'rutube.ts'}},'soundcloud':{'create':hc=>{let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{const iV=b;let hp=he??Streamyx??{};hp&&(hp['defineExtension']||=hv=>hv);let hq=hp['defineExtension'];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'];let hr=hp['utils'];hp[iV(0x2d6)],hp['UrlSource'],hp['ALL_FORMATS'],hp['DASH'],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp['MP4'],hp['MP3'];let hs={'version':'','id':''},ht=async()=>{const iW=iV;try{let hv=await hf(iW(0x2df))['then'](hy=>hy['text']())['catch'](hy=>{let hz=hy instanceof Error&&hy['cause']!=null?String(hy['cause']):'';return hy instanceof Error&&hz['includes']('ECONNRESET')&&hi['warn']('Soundcloud\x20may\x20be\x20blocked\x20in\x20your\x20region.\x20Use\x20proxy\x20or\x20VPN\x20to\x20bypass\x20restrictions.'),'';}),hw=hv['match'](/window\.__sc_version="([0-9]{10})"/)?.[0x1];if(hw&&hs['version']===hw)return hs['id'];let hx='';for(let hy of hv['matchAll'](/<script.+src="(.+)">/g)){let hz=hy[0x1];if(!hz?.['startsWith']('https://a-v2.sndcdn.com/'))continue;let hA=(await hf(hz)['then'](hB=>hB['text']())['catch'](()=>''))['match'](/\("client_id=[A-Za-z0-9]{32}"\)/)?.[0x0]['match'](/[A-Za-z0-9]{32}/)?.[0x0];if(hA){hx=hA;break;}}return hw&&(hs['version']=hw,hs['id']=hx),hx;}catch{return'';}},hu=hv=>hv['audioCodecs']?.['some'](hw=>hw==='aac'||hw==='mp3')??!0x1;hd['exports']=hq({async 'getEntries'({url:hv,options:hw}){const iY=iV;let {author:hx,song:hy,accessKey:hz,shortLink:hA}=hr['execUrlPatterns'](hv,[':author/:song/s-:accessKey',':author/:song',':shortLink'],['https://soundcloud.com','https://on.soundcloud.com'])['pathname'],hB=await ht();if(!hB)throw Error('No\x20client\x20ID');let hC;if(new URL(hv)['hostname']==='on.soundcloud.com'&&hA&&(hC=await hf('https://on.soundcloud.com/'+hA+'/',{'redirect':'manual'})['then'](hJ=>{const iX=b;let hK=hJ['headers'][iX(0x236)]('location');if(hJ[iX(0x2a6)]===0x12e&&hK?.['startsWith']('https://soundcloud.com/'))return hK['split']('?',0x1)[0x0];})['catch'](()=>void 0x0)),!hC&&hx&&hy&&(hC='https://soundcloud.com/'+hx+'/'+hy+(hz?'/s-'+hz:'')),!hC)throw Error('Could\x20not\x20fetch');let hD=await hf('https://api-v2.soundcloud.com/resolve?url='+hC+'&client_id='+hB)['then'](hJ=>hJ['status']===0xc8?hJ['json']():null)['catch'](()=>null);if(!hD)throw Error('Could\x20not\x20fetch');let hE=hD[iY(0x1fd)]?.['transcodings'];if(!hE?.['length'])throw Error('Empty\x20download');let hF=hE['find'](hJ=>hJ['preset']==='opus_0_0'),hG=hE['find'](hJ=>hJ['preset']==='mp3_0_0');if(hG&&(hu(hw)||!hF)&&(hF=hG),!hF)throw Error('Empty\x20download');let hH=''+hF['url']+(hF['url'][iY(0x27a)]('?')?'&':'?')+'client_id='+hB+'&track_authorization='+hD[iY(0x32d)];if(!hH['startsWith']('https://api-v2.soundcloud.com/media/soundcloud:tracks:'))throw Error('Empty\x20download');let hI=await hf(hH)['then'](async hJ=>(await hJ[iY(0x261)]())[iY(0x230)]??'')['catch'](()=>'');if(!hI)throw Error('Could\x20not\x20fetch');return[{'type':'audio','title':hD['title']['trim'](),'author':hD[iY(0x27c)]['username'][iY(0x245)](),'source':{'url':hI}}];}});})(hc['Azot'],hc['fetch'],hc['localStorage'],hc['cookieStore'],hc['console'],hc['prompt'],hc['alert'],hc['document'],hc['navigator'],hc['window']),hd['exports']['default']||hd['exports'];},'manifest':{'manifestVersion':0x1,'name':'SoundCloud','icon':'https://play-lh.googleusercontent.com/JSSeB3XQtb9sHD5FWTqVM4AksY_Kg2q20eExenxGqPJZdn2uVQxi8eoHkP5MA-IR4w=w480-h960-rw','matches':['https://soundcloud.com/*','https://*.soundcloud.com/*']},'pkg':{'name':'soundcloud','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':hc=>{const j1=iJ;let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{const iZ=b;let hp=he??Streamyx??{};hp&&(hp['defineExtension']||=hr=>hr);let hq=hp['defineExtension'];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'],hp['utils'],hp['Input'],hp['UrlSource'],hp['ALL_FORMATS'],hp[iZ(0x1d2)],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp['MP4'],hp['MP3'],hd['exports']=hq({async 'getEntries'({url:hr}){const j0=iZ;let hs=await hf(hr);if(!hs['ok'])return hi['error']('Failed\x20to\x20fetch\x20TikTok\x20page.\x20Status:\x20'+hs['status']),[];let ht=(await hs['text']())['split'](j0(0x1f8))[0x1]?.['split']('</script>')[0x0];if(!ht)return hi['error']('Could\x20not\x20find\x20target\x20script\x20tag.\x20TikTok\x20might\x20have\x20updated\x20their\x20page\x20structure.'),[];let hu;try{hu=JSON['parse'](ht);}catch(hy){return hi['error']('Failed\x20to\x20parse\x20TikTok\x20page\x20JSON',hy,{'url':hr}),[];}let hv=hu['__DEFAULT_SCOPE__']?.['webapp.video-detail'],hw=hv?.['itemInfo']?.['itemStruct'];if(!hw)return hi['error']('Could\x20not\x20find\x20video\x20data\x20in\x20the\x20JSON\x20payload.\x20The\x20content\x20might\x20be\x20unavailable\x20or\x20the\x20structure\x20has\x20changed.'),hv?.['statusMsg']&&hi['error']('Error\x20'+hv['statusCode']+':\x20'+hv['statusMsg']),[];let hx=hw[j0(0x205)]?.['playAddr'];return hx?[{'type':'video','title':hw['desc']||'TikTok\x20Video','source':{'url':hx,'headers':{'Referer':'https://www.tiktok.com/','Cookie':hm['cookie']}}}]:(hi['error']('Could\x20not\x20find\x20a\x20video\x20URL\x20(playAddr)\x20in\x20the\x20JSON\x20payload.'),[]);}});})(hc['Azot'],hc['fetch'],hc['localStorage'],hc['cookieStore'],hc['console'],hc['prompt'],hc['alert'],hc['document'],hc['navigator'],hc[j1(0x228)]),hd[j1(0x1ec)]['default']||hd['exports'];},'manifest':{'manifestVersion':0x1,'name':'TikTok','tag':'TT','icon':'https://play-lh.googleusercontent.com/LdBITldj-tJxqLm-CsWSbnt4BMo2gk53cgM7mWIL-zn44m1ywLyQgxRsHKqp8r0qceXs=w480-h960-rw','permissions':[],'matches':[iJ(0x2ad),'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':hc=>{const j4=iJ;let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{const j2=b;let hp=he??Streamyx??{};hp&&(hp['defineExtension']||=hr=>hr);let hq=hp['defineExtension'];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'],hp['utils'],hp['Input'],hp['UrlSource'],hp['ALL_FORMATS'],hp['DASH'],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp['MP4'],hp['MP3'],hd[j2(0x1ec)]=hq({async 'getEntries'({url:hr}){const j3=j2;let hs=new URL(hr)['searchParams']['get']('recordId');if(!hs)return hi['error'](j3(0x1c6)),[];let ht=await hf('https://mv1.virtualroom.ru/vr/player/records/'+hs+'/info')['then'](hw=>hw['ok']?hw['json']():null)['catch'](()=>null),hu=await hf('https://mv1.virtualroom.ru/vr/player/records/'+hs+'/events')['then'](hw=>hw['ok']?hw['json']():null)['catch'](()=>null),hv=ht?.['data']?.['roomParameters']?.['name']??'VirtualRoom';return(hu?.['data']?.['translations']??[])['filter'](hw=>!!hw['url'])[j3(0x2d7)](hw=>({'title':[hv,hw['type'],hw['source'],hw['start']]['filter'](Boolean)['join']('\x20'),'source':{'url':hw['url']}}));}});})(hc['Azot'],hc['fetch'],hc['localStorage'],hc['cookieStore'],hc[j4(0x2af)],hc['prompt'],hc['alert'],hc['document'],hc['navigator'],hc['window']),hd['exports']['default']||hd['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':iJ(0x203),'email':'vitalygashkov@vk.com','url':iJ(0x2c4)}],'type':'module','main':'virtualroom.ts'}},'vk':{'create':hc=>{const j7=iJ;let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{const j5=b;let hp=he??Streamyx??{};hp&&(hp['defineExtension']||=hv=>hv);let hq=hp['defineExtension'];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'],hp['utils'],hp[j5(0x2d6)],hp[j5(0x1b2)],hp['ALL_FORMATS'],hp['DASH'],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp['MP4'],hp['MP3'];let hr=['2160','1440','1080',j5(0x295),'480','360',j5(0x1e5),'144'],hs=hv=>{let hw=hv['match'](/video-(\d+)_(\d+)/);return hw?{'ownerId':hw[0x1],'videoId':hw[0x2]}:null;},ht=hv=>{if(!hv)return null;for(let hw of hv)if(Array['isArray'](hw)){for(let hx of hw)if(hx&&typeof hx=='object'&&'player'in hx)return hx;}return null;},hu=(hv,hw)=>{let hx=hw['videoQuality']?.['replace']('p','')['trim'](),hy=hr['filter'](hz=>!!hv['url'+hz]);return hy['length']?hx&&hy['includes'](hx)?hx:hy[0x0]:null;};hd['exports']=hq({async 'getEntries'({url:hv,options:hw}){const j6=j5;let hx=hs(hv);if(!hx)return hi['error']('Could\x20not\x20extract\x20VK\x20video\x20identifiers'),[];let hy=await hf('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':j6(0x328),'sec-fetch-mode':j6(0x1b9),'sec-fetch-site':'same-origin','x-requested-with':'XMLHttpRequest','Referer':hv,'Referrer-Policy':j6(0x326)},'body':new URLSearchParams({'al':'1','autoplay':'1','claim':'','force_no_repeat':'true','is_video_page':'true','list':'','module':'direct','t':'','video':'-'+hx['ownerId']+'_'+hx['videoId']})['toString']()});if(!hy['ok'])throw Error('VK\x20request\x20failed:\x20'+hy['status']+'\x20'+hy['statusText']);let hz=ht((await hy[j6(0x261)]())['payload']),hA=hz?.['player']?.['params'],hB=hA&&hA['length']>0x0?hA[0x0]:void 0x0;if(!hz||!hB)return hi['error'](j6(0x27f)),[];if(hz['mvData']?.['is_active_live']===0x1||hz[j6(0x25e)]?.['is_active_live']==='1')return hi['error']('Live\x20videos\x20are\x20not\x20supported'),[];let hC=hu(hB,hw),hD=hC?hB['url'+hC]:void 0x0,hE=hB['dash_sep']||hD;return hE?[{'type':'video','title':[hB['md_title']?.[j6(0x245)](),hB['md_author']?.['trim']()]['filter'](Boolean)['join']('\x20'),'source':{'url':hE,'headers':{'Referer':hv,'Cookie':hm['cookie']}}}]:(hi[j6(0x1d1)]('Could\x20not\x20find\x20video\x20URL'),[]);}});})(hc['Azot'],hc['fetch'],hc['localStorage'],hc['cookieStore'],hc['console'],hc['prompt'],hc['alert'],hc['document'],hc[j7(0x2e1)],hc['window']),hd['exports']['default']||hd['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':['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':hc=>{const j9=iJ;let hd={'exports':{}};return((he,hf,hg,hh,hi,hk,hl,hm,hn,ho)=>{let hp=he??Streamyx??{};hp&&(hp['defineExtension']||=hs=>hs);let hq=hp['defineExtension'];hp['version'],hp['sleep'],hp['input'],hp['prompt'],hp['notify'],hp['confirm'],hp['ask'];let hr=hp['utils'];hp['Input'],hp['UrlSource'],hp['ALL_FORMATS'],hp['DASH'],hp['DASH_FORMATS'],hp['HLS'],hp['HLS_FORMATS'],hp['MP4'],hp['MP3'],hd['exports']=hq({async 'getEntries'({url:hs}){const j8=b;let ht=hr['execUrlPatterns'](hs,[j8(0x28c),'/detail/:mid'],['https://weibo.com/','https://m.weibo.cn']),hu=ht['pathname']['bid']||ht['pathname']['mid'];if(!hu)return[];let hv=await hf('https://m.weibo.cn/statuses/show?id='+hu,{'credentials':'include','referrer':j8(0x1f3)+(ht['pathname']['bid']??hu)+'?jumpfrom=weibocom','method':'GET','mode':'cors'})['then'](hz=>hz['json']())['catch'](()=>null);if(!hv?.['data'])return hi[j8(0x1d1)]('Could\x20not\x20resolve\x20Weibo\x20post\x20metadata'),[];let hw=[],hx=hv['data']['pics'],hy=hv['data']['page_info'];if(hx?.['length']){for(let hz of hx[j8(0x233)](hA=>hA['type']==='video'||hA['type']==='livephoto'))hz['videoSrc']&&hw['push']({'type':'video','title':hz['pid'],'source':{'url':hz['videoSrc']}});}else{if(hy?.['type']==='video'){let hA=Object['values'](hy['urls']??{})[0x0],hB=hy['media_info']?.['stream_url_hd']||hy['media_info']?.['stream_url'],hC=hA||hB;hC&&hw['push']({'type':j8(0x205),'title':hy['title']||hy[j8(0x291)],'source':{'url':hC}});}}return hw;}});})(hc['Azot'],hc['fetch'],hc['localStorage'],hc['cookieStore'],hc['console'],hc['prompt'],hc['alert'],hc[j9(0x216)],hc['navigator'],hc['window']),hd['exports']['default']||hd['exports'];},'manifest':{'manifestVersion':0x1,'name':'Weibo','icon':'https://play-lh.googleusercontent.com/TTKq2trnzgtoyM0jc1pyrrmXtA_Yd3A2hxubZtDahdZStYf4GPANZa-wjDb1ELHrGqh_=w480-h960-rw','matches':[iJ(0x293),'https://*.weibo.com/*','https://weibo.cn/*','https://*.weibo.cn/*']},'pkg':{'name':iJ(0x1c9),'version':'0.0.6','private':!0x0,'keywords':[iJ(0x2e4)],'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':iJ(0x247),'main':'weibo.ts'}}};}),ci=a7(ch(),0x1);const cj=ha=>({'name':ha['name'],'source':ha['source'],'dir':ha['dir'],'path':ha[hQ(0x306)],'package':ha['package'],'manifest':ha['manifest'],'installedAt':ha['installedAt']||new Date()['toISOString']()});var ck=class hN extends S{[hQ(0x2bf)]=new Map();['extensionDirs'];[hQ(0x2d2)];['infoList']=[];constructor({dirs:ha,indexPath:hb}={}){const ja=hQ;super(),this[ja(0x225)]=ha??[process['cwd']()],this['indexPath']=hb??L['join'](process['cwd'](),'index.json');}async['init'](){return await this['ensureValidIndexPath'](),await this['loadInfo'](),this;}async[hQ(0x314)](){return this['infoList']=await aI(this['indexPath'])['catch'](()=>[]),this['infoList'];}async['saveInfo'](){const jb=hQ;return await this['ensureValidIndexPath'](),await aJ(this[jb(0x2d2)],this['infoList']);}async['ensureValidIndexPath'](){const jc=hQ;(await P['stat'](this['indexPath'])['catch'](()=>null))?.['isDirectory']()&&(q['warn']('Invalid\x20extensions\x20index\x20path\x20repaired:\x20'+this['indexPath']),await aF(this['indexPath']),await P[jc(0x30c)](this['indexPath'],'[]','utf8'));}static async['getAvailableExtensions'](){const jd=hQ;try{return(await bY['getExtensions'](c5['accessToken'],AbortSignal['timeout'](0x1f40)))['data'];}catch(ha){let hb=ha&&typeof ha=='object'&&'code'in ha?ha['code']:ha&&typeof ha=='object'&&'cause'in ha?ha['cause']?.['code']:void 0x0;return q['warn']('Failed\x20to\x20fetch\x20extensions\x20catalog:\x20'+(ha instanceof Error?ha[jd(0x2a2)]:String(ha))+'\x20('+hb+')'),[];}}async['discover'](){const je=hQ;for(let ha of this['extensionDirs']){q['debug']('Loading\x20extensions\x20from\x20'+ha);let hb=await P['readdir'](ha,{'withFileTypes':!0x0})['catch'](()=>[]);for(let hc of hb)if(hc['isDirectory']()){let hd=L['join'](ha,hc['name']);if(await P['readdir'](hd)['then'](he=>he[je(0x233)](hf=>!hf['startsWith']('.')))['then'](he=>!he['length']))continue;await this['loadExtension'](hd);}}for(let he of this['infoList'])this['extensionDirs'][je(0x274)](hf=>he['dir']?.['includes'](hf))||!he['dir']||(q['debug']('Loading\x20dev\x20extension\x20from\x20'+he['dir']),await this['loadExtension'](he[je(0x2d9)]));}async #e(ha,hb){const hc=await P['readFile'](ha,'utf8'),{Azot:hd,fetch:he,console:hf,localStorage:hg,cookieStore:hh,window:hi,document:hk,navigator:hl}=hb,hm={'exports':{}};eval('(()\x20=>\x20{'+hc+'})();');const hn=hm['exports'];return{'exports':hn,'context':hb};}async['prepareContext'](ha,hb){const jf=hQ;let hc=E({'name':ha,'dir':G,'title':hb});return await hc['cookieStore']['import'](L['join'](G,ha,jf(0x31f))),hc;}async['loadScript'](ha,hb){const jg=hQ;let hc=hb[jg(0x30e)],hd=b7(hb),he=await this['prepareContext'](hc,hd),hf=await y(ha,{'dirname':hb['dir'],'context':he});if(hf)return hf['exports']='default'in hf['exports']?hf['exports'][jg(0x2c8)]:hf['exports'],hf;}async['loadCoreExtensions'](){const jh=hQ;let ha=Object['keys'](ci['default']);q['debug']('Loading\x20'+ha['length']+jh(0x24d)+ha['join'](',\x20'));for(let hb of Object[jh(0x25b)](ci['default'])){let hc=hb['pkg']['name'],hd=b5({'manifest':hb['manifest'],'packageJson':hb['pkg'],'fallbackName':hc}),he=hd['displayName'];try{let hf=await this['prepareContext'](hc,he),hg={'exports':hb['create'](hf),'package':hb['pkg'],'manifest':hd,'context':hf};this['validate'](hg),this['extensions']['set'](hc,hg),this['emit']('loaded',hc);}catch(hh){q['debug'](hh instanceof Error?hh['message']:String(hh)),this['emit']('error',hh,hc);}}}async['loadExtension'](ha){const ji=hQ;try{q['debug']('Loading\x20extension\x20from\x20'+ha);let hb=await bF(ha)['catch'](he=>q['error'](he));if(!hb)return;hb['package']['dir']=hb['dir'];let hc=await this['loadScript'](hb[ji(0x306)],hb);if(!hc)return;let hd={'package':hb['package'],'manifest':hb['manifest'],'exports':hc['exports'],'context':hc['context']};this['validate'](hd),this['extensions']['set'](hb['package']['name'],hd),this['emit']('loaded',hb['package']['name']);}catch(he){this['emit']('error',he,ha);}}['validate'](ha){const jj=hQ;if(typeof ha!='object'||!ha||!bt(ha['exports']))throw Error('Invalid\x20extension\x20interface:\x20'+ha[jj(0x2cd)]['name']);}[hQ(0x2a1)](ha){const jk=hQ;return this['extensions']['get'](ha)??Array['from'](this['extensions']['values']())['find'](hb=>hb['package'][jk(0x30e)]===ha)??null;}async['getExtensionForUrl'](ha){const jl=hQ;let hb;try{hb=new URL(ha);}catch(hc){return q[jl(0x2a4)]('Invalid\x20extension\x20URL:\x20'+ha),q['debug'](hc instanceof Error?hc['message']:String(hc)),null;}for(let hd of this['extensions']['values']()){let he=null,hf=hd['exports']['canHandle'],hg=hb[jl(0x1c4)]['includes'](hd['package']['name']);if(he=ba(hd)?b9(hd,hb):typeof hf=='function'?await hf(ha):typeof hf=='string'?new URLPattern(hf)['test'](ha):hg,he)return hd;}return null;}async['install'](ha){const jm=hQ;let hb=await hN['getAvailableExtensions'](),hc=[];for(let hd of ha){let he=await stat(hd)['then'](hh=>hh['isDirectory']())['catch'](()=>!0x1)?hd:await aX(hd,hb);if(!he)throw aO(aL['SOURCE_NOT_FOUND'],'Extension\x20source\x20not\x20found:\x20'+hd,{'source':hd});let hf=await bG(he,hd);if(!hf)throw aO(aL['IMPORT_INVALID'],'Extension\x20import\x20failed:\x20'+hd,{'source':hd,'dir':he});hc['push'](hf);let hg=this['infoList']['find'](({name:hh})=>hh===hf[jm(0x30e)]);if(hg){let hh=hg['source'];hh!==hf['source']&&await aF(hh);let hi=hg['dir']?this.#t(hg['dir']):null,hk=hf['dir']?this.#t(hf['dir']):null;hi&&hi!==hk&&await aF(hi),hg['installedAt']=new Date()['toISOString'](),Object['assign'](hg,cj(hf)),q['info'](jm(0x28a)+hf['name']+'\x20updated');}else this['infoList'][jm(0x277)](cj(hf)),q['info']('Extension\x20'+hf['name']+'\x20added');}if(await this['saveInfo'](),hc['length']){for(let hl of hc)this['extensions']['set'](hl['name'],hl);}}#t(ha){const jn=hQ;let hb=L['parse'](ha);return hb[jn(0x2d9)]===I?ha:hb[jn(0x2d9)];}async['uninstall'](ha){const jo=hQ;for(let hb of ha){let hc=this['infoList']['find'](hf=>hf['name']===hb);if(!hc){q['error']('Extension\x20'+hb+'\x20not\x20found');return;}let hd=hc['dir']??'',he=hd?.['includes'](I);await aD(hd)?(he&&await aF(this.#t(hd)),this['infoList']=this['infoList']['filter'](hf=>hf[jo(0x30e)]!==hb),q['info']('Extension\x20'+hb+'\x20removed'),this['extensions']['delete'](hb)):q['warn']('Extension\x20'+hb+jo(0x289)+hd);}await this['saveInfo']();}async['importCookies'](ha,hb){let hc=this['getExtension'](ha);if(!hc)throw Error('Extension\x20'+ha+'\x20not\x20found');return await hc['context']['cookieStore']['import'](hb,{'removeSource':!0x1});}async['login'](ha,hb={}){let hc=this['getExtension'](ha);hc&&await by(hc,hb);}async['logout'](ha){const jp=hQ;for(let hb of ha){let hc=this['getExtension'](hb);if(!hc)return;q['info'](jp(0x215)),await bz(hc),q['debug']('Clearing\x20localStorage...'),hc['context']['localStorage'][jp(0x217)](),q['debug']('Clearing\x20cookies\x20store...');let hd=await hc['context']['cookieStore']['getAll']();for(let he of hd)await hc['context']['cookieStore']['delete'](he);q['info']('Logged\x20out\x20from\x20extension\x20'+hb);}}['list'](){const jq=hQ;return Array['from'](this['extensions'][jq(0x25b)]())['map'](ha=>({'name':ha['package']['name'],'version':ha['package']['version'],'description':ha['package']['description'],'manifest':ha['manifest'],'package':ha['package']}));}};const cl=(ha,hb)=>{const jr=hQ;let hc=resolve(ha),hd=parse(ha)['name'];return join(hb,hd+'-'+createHash('sha1')[jr(0x1b3)](hc)['digest']('hex')['slice'](0x0,0xa));},cm=(ha,hb=r)=>{const js=hQ;let hc=new Set();ha?.['output'][js(0x318)]&&hc['add'](ha[js(0x23d)]['filePath']);for(let he of ha?.['artifacts']??[])he['path']&&hc['add'](he['path']);let hd=new Set();for(let hf of hc)hd[js(0x2aa)](hf),hd['add'](hf+'.part.json'),hd['add'](cl(hf,hb));return hd;},cn=async ha=>{ha['size']!==0x0&&await Promise['all']([...ha]['map'](hb=>rm(hb,{'recursive':!0x0,'force':!0x0})['catch'](()=>void 0x0)));},co=(ha=r)=>({async 'purgeRecordArtifacts'(hb){await cn(cm(hb,ha));}}),cp=0x1,cq=0x4,cr=0x8,cs=0x10,ct=(ha,hb)=>Math['max'](cp,Math['trunc'](typeof ha=='number'&&Number['isFinite'](ha)?ha:hb)),cu=ha=>ha['includes']('highConnectionsCount')?cs:ha[hQ(0x27a)]('mediumConnectionsCount')?cr:cq,cv=({requestedConnections:ha,fallbackConnections:hb=cp,grantedBenefits:hc})=>{let hd=ct(ha,ct(hb,cp)),he=cu(hc),hf=Math['min'](hd,he);return{'connections':hf,'normalizedRequestedConnections':hd,'maxAllowedConnections':he,'wasClamped':hf<hd};},cw=async ha=>{const jt=hQ;let {grantedBenefits:hb}=await cg(),hc=null,hd=hb['includes']('parallelDownloads'),he=ha['maxActiveDownloads']&&ha['maxActiveDownloads']>0x1;if(!hd&&he&&(hc=Error('PARALLEL_DOWNLOADS_NOT_ALLOWED'),ha['maxActiveDownloads']=0x1),ha['proxy']||ha['proxyMeta']||ha['proxyMedia']){let hf=hb['includes']('proxy'),hg=ha[jt(0x31e)]||ha[jt(0x1ff)]||ha['proxyMedia'];!hf&&hg&&(hc=Error('PROXY_NOT_ALLOWED'),delete ha['proxy'],delete ha[jt(0x1ff)],delete ha['proxyMedia']);}if(ha['videoContainerFormat']&&ha['videoContainerFormat']!=='mp4'&&(hb['includes']('customMuxFormat')||(hc=Error(jt(0x22c)),ha['videoContainerFormat']='mp4')),typeof ha['connections']=='number'){let {connections:hh}=cv({'requestedConnections':ha['connections'],'grantedBenefits':hb});ha['connections']=hh;}return{'error':hc,'data':ha};},cx=async()=>{const ju=hQ;try{let {grantedBenefits:ha}=await cg();return ha;}catch(hb){let hc=hb instanceof Error?hb['message']:String(hb);return q['warn'](ju(0x243)+hc),[];}},cy=(ha=cx)=>{let hb;return async()=>(hb||=ha(),hb);},cz=ha=>({'retry':ha['get']('retry'),'connections':ha['get']('connections'),'proxy':ha['get']('proxy'),'proxyMeta':ha['get']('proxyMeta'),'proxyMedia':ha['get']('proxyMedia'),'movieTemplate':ha['get']('movieFilenameTemplate'),'episodeTemplate':ha['get']('seriesFilenameTemplate'),'hardsub':ha['get']('preferHardsub'),'format':ha['get']('videoContainerFormat')}),cA=({options:ha,fallbackConnections:hb,grantedBenefits:hc})=>{let hd=cv({'requestedConnections':ha['connections'],'fallbackConnections':hb,'grantedBenefits':hc});return{'options':{...ha,'connections':hd['connections']},'limit':hd};},cB=({settings:ha,requestedOptions:hb,filePath:hc,grantedBenefits:hd})=>{let he=cz(ha),{options:hf,limit:hg}=cA({'options':{...he,...hb},'fallbackConnections':he['connections'],'grantedBenefits':hd});return hc&&(hf['outputPath']=hc),{'baseOptions':he,'options':hf,'limit':hg};},cC=ha=>{const jv=hQ;if(!ha||typeof ha!='object'||!(jv(0x2ee)in ha))return;let hb=ha['code'];return typeof hb=='string'?hb:void 0x0;},cD='NO_FILES_DOWNLOADED';var cE=class extends Error{['code'];constructor(ha,hb=ha,hc){super(hb,hc),this['name']='DownloaderError',this['code']=ha;}};const cF=()=>new cE(cD,hQ(0x23b)),cG=(ha,hb='DOWNLOAD_FAILED')=>{if(ha instanceof cE||ha instanceof Error&&ha['name']==='AbortError')return ha;if(ha instanceof Error){let hc=new cE(cC(ha)??hb,ha['message'],{'cause':ha});return ha['stack']&&(hc['stack']=ha['stack']),hc;}return new cE(hb,typeof ha=='string'?ha:'Unknown\x20error');},cH=ha=>{const jw=hQ;switch(ha){case'analyzing':case'pending':return{'state':'queued','phase':'analyzing'};case'queued':return{'state':'queued','phase':null};case'downloading':return{'state':jw(0x271),'phase':'transferring'};case'processing':return{'state':jw(0x271),'phase':'processing'};case'paused':return{'state':'paused','phase':null};case'completed':return{'state':'completed','phase':null};case'error':return{'state':'failed','phase':null};}},cI=ha=>{const jx=hQ;let {state:hb,phase:hc}=cH(ha['status']);return{'id':ha['id'],'request':{'entry':ha['entry'],'url':ha['url'],'options':ha['options']},'state':hb,'phase':hc,'progress':{'percent':ha['progress'],'downloadedBytes':ha['downloadedBytes'],'totalBytes':ha['totalBytes'],'totalBytesEstimated':ha['totalBytesEstimated']},'output':{'title':ha['title'],'filePath':ha['filePath'],'quality':ha['quality'],'codec':ha['codec']},'artifacts':ha['filePath']?[{'path':ha['filePath'],'role':'output'}]:[],'failure':ha['error']?{'message':ha['error']}:void 0x0,'createdAt':ha[jx(0x2f6)]};},cJ=({id:ha,request:hb,createdAt:hc})=>({'id':ha,'request':hb,'state':'queued','phase':null,'progress':{'percent':0x0,'downloadedBytes':0x0},'output':{},'artifacts':[],'createdAt':hc}),cK=ha=>ha['state']===hQ(0x1c0)||ha['state']==='running',cL=(ha,hb,hc)=>ha['state']===hb?hc===void 0x0?!0x0:ha['phase']===hc:!0x1,cM=(ha,hb)=>ha['state']==='failed'&&ha['failure']?.[hQ(0x2a2)]===hb,cN=(ha,hb)=>{const jy=hQ;let hc=ha['findIndex'](he=>he['path']===hb[jy(0x306)]);if(hc===-0x1)return ha['push'](hb),ha;let hd=ha[hc];return ha[hc]={...hd,...hb,'role':hd['role']&&hb['role']==='partial'?hd[jy(0x210)]:hb['role']??hd['role']},ha;},cO=(ha,hb)=>{if(hb?.['length']){for(let hc of hb)hc['path']&&cN(ha['artifacts'],hc);}},cP=ha=>ha['phase']??ha[hQ(0x1ca)],cQ=(ha,hb)=>({'ok':!0x1,'reason':'Cannot\x20apply\x20'+hb['type']+'\x20while\x20download\x20is\x20'+cP(ha)}),cR=ha=>ha['state']==='queued'||ha['state']==='running'||ha['state']==='paused',cS=ha=>ha['state']==='failed',cT=ha=>ha['state']==='queued',cU=ha=>ha['state']==='queued'||ha['state']==='running'&&ha['phase']==='analyzing',cV=ha=>ha['state']==='queued'||ha['state']==='running'&&(ha['phase']==='analyzing'||ha['phase']==='transferring'),cW=ha=>ha[hQ(0x1ca)]==='queued'||ha['state']==='running',cX=ha=>ha[hQ(0x1ca)]==='running'&&ha['phase']==='transferring',cY=ha=>ha['state']==='running',cZ=ha=>ha['state']==='queued'||ha['state']==='running',d0=(ha,hb)=>{const jz=hQ;switch(hb['type']){case'queued':return cR(ha);case'retrying':return cS(ha);case'analyzing':return cT(ha);case'transferring':return cU(ha);case'processing':return cX(ha);case jz(0x27d):return cV(ha);case'completed':return cY(ha);case'failed':return cW(ha);case'entry-resolved':return cZ(ha);case'output-resolved':case'file-path-resolved':case'artifact-recorded':case'artifacts-recorded':return cY(ha);case'progress':return cX(ha);}},d1=(ha,hb)=>{const jA=hQ;if(!d0(ha,hb))return cQ(ha,hb);let hc=structuredClone(ha);switch(hb['type']){case jA(0x1c0):return hc['state']='queued',hc['phase']=null,hc['failure']=void 0x0,{'ok':!0x0,'record':hc};case'retrying':return hc['state']='queued',hc['phase']='analyzing',hc['failure']=void 0x0,hc['progress']['percent']=0x0,hc['progress']['downloadedBytes']=0x0,hc['progress'][jA(0x1e0)]=void 0x0,hc['progress'][jA(0x23c)]=void 0x0,hc['output']['quality']=void 0x0,hc['output']['codec']=void 0x0,hc['artifacts']=[],{'ok':!0x0,'record':hc};case'analyzing':return hc['state']=jA(0x271),hc['phase']='analyzing',hc['failure']=void 0x0,{'ok':!0x0,'record':hc};case'transferring':return hc['state']='running',hc['phase']='transferring',hc['failure']=void 0x0,{'ok':!0x0,'record':hc};case jA(0x21e):return hc['state']='running',hc['phase']=jA(0x21e),{'ok':!0x0,'record':hc};case'paused':return hc['state']='paused',hc['phase']=null,hc['failure']=void 0x0,{'ok':!0x0,'record':hc};case'completed':return hc['state']='completed',hc['phase']=null,hc['progress']['percent']=0x64,hb['progress']&&(hc['progress']['downloadedBytes']=hb['progress'][jA(0x246)],hc['progress']['totalBytes']=hb['progress']['totalBytes'],hc['progress']['totalBytesEstimated']=hb['progress']['totalBytesEstimated']),hc['failure']=void 0x0,{'ok':!0x0,'record':hc};case'failed':return hc['state']='failed',hc['phase']=null,hc['failure']={'message':hb['message'],'code':hb['code']},{'ok':!0x0,'record':hc};case'entry-resolved':return hc['request']['entry']=hb['entry'],{'ok':!0x0,'record':hc};case'output-resolved':return hc['output']['title']=hb['title'],hc['output']['filePath']=hb['filePath'],{'ok':!0x0,'record':hc};case'file-path-resolved':return hc['output']['filePath']=hb['filePath'],{'ok':!0x0,'record':hc};case jA(0x265):return hb['progress']['filePath']&&(hc['output']['filePath']=hb['progress']['filePath']),hc['progress']['percent']=hb['progress'][jA(0x208)],hc['progress'][jA(0x246)]=hb['progress']['downloadedBytes'],hc['progress']['totalBytes']=hb['progress']['totalBytes'],hc['progress']['totalBytesEstimated']=hb['progress']['totalBytesEstimated'],hb['progress']['quality']&&(hc[jA(0x23d)]['quality']=hb['progress']['quality']),hb['progress']['codec']&&(hc[jA(0x23d)]['codec']=hb['progress']['codec']),cO(hc,hb['artifacts']),{'ok':!0x0,'record':hc};case'artifact-recorded':return cO(hc,[hb['artifact']]),{'ok':!0x0,'record':hc};case'artifacts-recorded':return cO(hc,hb['artifacts']),{'ok':!0x0,'record':hc};}},d2=(ha,hb)=>{let hc=d1(ha,hb);if(hc['ok']===!0x1)throw Error(hc['reason']);return hc['record'];},d3=ha=>ha instanceof Error&&ha['name']==='AbortError',d4=async ha=>{const jB=hQ;if(ha)try{return(await stat(ha))['size'];}catch(hb){q[jB(0x2a4)]('Unable\x20to\x20read\x20downloaded\x20file\x20size\x20for\x20'+ha+':\x20'+String(hb));return;}},d5=async ha=>{const jC=hQ;let hb=[...new Set(ha[jC(0x233)](Boolean))];if(!hb['length'])return;let hc=0x0,hd=!0x1;for(let he of hb){let hf=await d4(he);if(hf===void 0x0){hd=!0x0;continue;}hc+=hf;}return{'downloadedBytes':hc,'totalBytes':hc,'totalBytesEstimated':hd};},d6=ha=>ha&&typeof ha=='object'&&'code'in ha?String(ha['code']):void 0x0,d7=()=>void 0x0,d8=(ha,hb)=>(ha??[])[hQ(0x233)](Boolean)['map'](hc=>({'path':hc,'role':hb}));var d9=class{#e=new Set();#t;#n;#r;#i;#a;#o;#s=new Set();#c=[];#l=new Map();#u=new Set();#d;#f=0x0;constructor({settings:ha,store:hb,workflow:hc,analyzer:hd,artifacts:he=co(),resolveBenefits:hf=cy()}){this.#t=ha,this.#n=hb,this.#r=hc,this.#i=hd,this.#a=he,this.#o=hf,this.#d=ha['get']('maxActiveDownloads'),q['debug']('Created\x20download\x20engine\x20with\x20max\x20active\x20downloads:\x20'+this.#d);}get[hQ(0x1f9)](){return this.#d;}['getRecord'](ha){return this.#n['getRecord'](ha);}['listRecords'](){return this.#n['listRecords']();}['subscribe'](ha){return this.#e['add'](ha),()=>this.#e['delete'](ha);}async['initializeFromStorage'](){for(let ha of this.#n['listRecords']()){if(!cK(ha))continue;let hb=ha;cL(ha,'queued',null)||(hb=await this.#E(ha,{'type':'queued'})),this.#A(hb['id']);}this.#g();}async['analyze'](ha,hb={}){if(!ha){let hc=Error('Cannot\x20prepare\x20job\x20without\x20a\x20URL.');throw this.#I({'type':'error','error':hc}),hc;}return await this.#i['analyze'](ha,hb);}async['add'](ha){if(!ha['url']&&!ha['entry']?.['source']?.['url'])throw Error('Job\x20must\x20have\x20either\x20a\x20URL\x20or\x20a\x20pre-prepared\x20media\x20entry.');let hb=cJ({'id':crypto['randomUUID'](),'request':ha,'createdAt':new Date()['toISOString']()});q['debug']('Adding\x20new\x20job:\x20'+hb['id']),q['debug']('URL:\x20'+hb['request']['url']),this.#f+=0x1;try{return await this.#n['addRecord'](hb),this.#I({'type':'job-added','record':hb}),this.#A(hb['id']),this.#g(),structuredClone(hb);}finally{--this.#f,this.#F();}}async['pause'](ha){const jD=hQ;let hb=await this.#p(ha,jD(0x2ae));hb&&q['debug'](jD(0x2b3)+hb['id']);}async['resume'](ha){let hb=this.#l['get'](ha);if(hb){hb['cancellationReason']==='pause'||hb['controller']['signal']['aborted']?(this.#u['add'](ha),q['debug']('Resume\x20queued\x20until\x20stop\x20completes:\x20'+ha)):q['debug']('Resume\x20skipped\x20while\x20job\x20is\x20active:\x20'+ha);return;}let hc=this.#k(ha);if(!hc){q['warn']('Resume\x20failed:\x20Job\x20'+ha+'\x20not\x20found');return;}if(cL(hc,'paused')){await this.#m(hc),q['debug']('Resumed\x20download:\x20'+hc['id']);return;}cL(hc,'failed')&&await this.#h(hc)&&q['debug']('Retried\x20download:\x20'+hc['id']);}async['remove'](ha){await this.#p(ha,'remove'),await this.#n['deleteRecord'](ha);}async['removeWithFile'](ha){const jE=hQ;let hb=this.#k(ha),hc=await this.#p(ha,jE(0x2a8))??hb;await this.#n['deleteRecord'](ha),await this.#a['purgeRecordArtifacts'](hc);}async['drain'](){await new Promise(ha=>{let hb=!0x1,hc=d7,hd=()=>{hb||(hb=!0x0,hc(),ha());};hc=this['subscribe'](he=>{he['type']==='idle'&&hd();}),this.#P()&&hd();});}async #p(ha,hb){const jF=hQ;let hc=this.#j(ha),hd=this.#l['get'](ha),he=this.#k(ha);return hd?hb==='pause'&&!cL(hd['record'],'running','analyzing')&&!cL(hd['record'],'running',jF(0x253))?(q['debug']('Pause\x20ignored\x20for\x20non-downloading\x20stage:\x20id='+ha+',\x20stage='+(hd['record']['phase']??hd[jF(0x1e7)]['state'])),hd['record']):(hd['cancellationReason']=hb,hb==='pause'&&(hd['record']=await this.#D(hd['record'],{'type':'paused'})),hd['controller']['abort'](),await hd['runPromise'],this.#k(ha)):hb==='pause'&&he&&(hc||cL(he,'queued'))?await this.#D(he,{'type':'paused'}):he;}async #m(ha){let hb=await this.#D(ha,{'type':'queued'});this.#A(hb['id']),this.#g();}async #h(ha){await this.#a['purgeRecordArtifacts'](ha);let hb=await this.#D(ha,{'type':'retrying'});try{if(hb['request']['url']){let hc=await this['analyze'](hb['request']['url'],hb['request']['options']??{}),hd=this.#T(hb,hc);if(!hd)throw Error('No\x20media\x20entry\x20found');hb=await this.#E(hb,{'type':'entry-resolved','entry':hd});}return await this.#m(hb),!0x0;}catch(he){let hf=cG(he);return hb=await this.#D(hb,{'type':'failed','message':hf['message'],'code':d6(hf)}),this.#I({'type':'job-error','record':hb,'error':hf}),!0x1;}}#g(){const jG=hQ;for(this.#d=this.#t['get']('maxActiveDownloads');this.#l[jG(0x315)]<this.#d;){let ha=this.#M();if(!ha)break;this.#_(ha);}this.#F();}#_(ha){if(!cL(ha,'queued')){q['warn']('Skipping\x20non-queued\x20job\x20start:\x20'+ha['id']+'\x20('+(ha['phase']??ha['state'])+')');return;}let hb={'controller':new AbortController(),'record':ha,'runPromise':Promise['resolve']()};hb['runPromise']=this.#v(hb)['catch'](hc=>{let hd=hc instanceof Error?hc:Error('Download\x20run\x20failed:\x20'+String(hc));q['error'](hd['message']),this.#I({'type':'error','error':hd});}),this.#l['set'](ha['id'],hb);}async #v(ha){const jH=hQ;try{ha['record']=await this.#D(ha['record'],{'type':'analyzing'});let hb=await this.#o(),hc=await this.#r['run']({'jobId':ha['record']['id'],'request':ha['record']['request'],'filePath':ha[jH(0x1e7)]['output']['filePath'],'grantedBenefits':hb,'signal':ha['controller']['signal'],'emit':async hd=>{ha['record']=await this.#S(ha,hd);}});ha['record']=await this.#y(ha['record'],hc);}catch(hd){if(d3(hd))return;ha['record']=await this.#b(ha[jH(0x1e7)],hd);}finally{await this.#x(ha);}}async #y(ha,hb){const jI=hQ;let hc=await this.#E(ha,{'type':'entry-resolved','entry':hb['entry']});if(!hb['transferResult']['downloaded']['length'])throw cF();let hd=hb['processedMedia']['outputPath']??hb[jI(0x2f1)]['artifacts'][0x0]?.['path']??hb[jI(0x324)]['downloaded'][0x0]?.['path'];hc['output']['filePath']||(hc=await this.#E(hc,{'type':'file-path-resolved','filePath':hd})),hc=await this.#E(hc,{'type':'artifacts-recorded','artifacts':hb['processedMedia']['artifacts']['map'](hf=>({...hf,'role':'track'}))});let he=hb['processedMedia']['outputPath']?await d5([hb['processedMedia']['outputPath']]):await d5(hb[jI(0x2f1)]['artifacts']['length']?hb['processedMedia']['artifacts']['map'](hf=>hf['path']):hb['transferResult']['downloaded']['map'](hf=>hf['path']));return hc=await this.#D(hc,{'type':'completed','progress':he}),this.#I({'type':'job-completed','record':hc}),hc;}async #b(ha,hb){let hc=cG(hb),hd=cM(ha,hc['message']);if(this.#O(hc),hd)return ha;q['error']('Download\x20job\x20failed:\x20'+hc);let he=await this.#D(ha,{'type':'failed','message':hc['message'],'code':d6(hc)});return this.#I({'type':'job-error','record':he,'error':hc}),he;}async #x(ha){const jJ=hQ;let hb=ha['cancellationReason'],hc=hb===jJ(0x2ae)&&this.#N(ha[jJ(0x1e7)]['id']);if(hb==='pause'&&!cL(ha['record'],'paused')&&(ha['record']=await this.#D(ha['record'],{'type':'paused'})),this.#l['delete'](ha['record']['id']),hc&&cL(ha['record'],'paused')){let hd=await this.#D(ha['record'],{'type':jJ(0x1c0)});this.#A(hd['id']);}this.#g();}async #S(ha,hb){const jK=hQ;let hc=ha['record'];switch(hb['type']){case'entry-resolved':return await this.#E(hc,hb);case'output-resolved':{let hd=await this.#E(hc,hb);return hd=await this.#E(hd,{'type':'artifact-recorded','artifact':{'path':hb['filePath'],'role':'output'}}),hd;}case'artifact-created':return await this.#E(hc,{'type':'artifact-recorded','artifact':{'path':hb['path'],'role':jK(0x2f3)}});case'progress':{if(!this.#C(ha))return hc;let he=await this.#E(hc,{'type':'progress','progress':hb['progress'],'artifacts':d8(hb['artifactPaths'],'partial')});return this.#I({'type':jK(0x29b),'record':he}),he;}case'phase-changed':return this.#w(ha,hb['phase'])?await this.#D(hc,{'type':hb['phase']}):hc;}}#C(ha){return!ha['cancellationReason']&&!ha['controller']['signal']['aborted']&&cL(ha['record'],'running','transferring');}#w(ha,hb){const jL=hQ;let hc=ha['record'];return hb===jL(0x253)?!ha['cancellationReason']&&!ha['controller'][jL(0x1ba)]['aborted']&&cL(hc,jL(0x271),'analyzing'):!ha['cancellationReason']&&!ha['controller']['signal']['aborted']&&cL(hc,jL(0x271),'transferring');}#T(ha,hb){const jM=hQ;if(hb['length']<=0x1)return hb[0x0];let hc=ha['request']['entry'],hd=hc?.['source']?.[jM(0x230)];return hb['find'](he=>hc?.['id']&&he['id']?hc['id']===he['id']:hc?.['title']&&he['title']&&hc['title']===he['title']&&hc['seasonNumber']===he['seasonNumber']&&hc['episodeNumber']===he['episodeNumber']&&hc['episodeTitle']===he['episodeTitle']?!0x0:!!hd&&hd===he['source']?.['url'])??hb[0x0];}async #E(ha,hb){let hc=d2(ha,hb);await this.#n['updateRecord'](hc);let hd=this.#l['get'](hc['id']);return hd&&(hd['record']=hc),hc;}async #D(ha,hb){let hc=await this.#E(ha,hb);return this.#I({'type':'job-status-changed','record':hc}),hc;}#O(ha){let hb=d6(ha);hb&&(hb==='DOWNLOAD_DIR_NOT_WRITABLE'||hb==='NO_FILES_DOWNLOADED')&&w['emit']('error',{'code':hb});}#k(ha){return this.#l['get'](ha)?.['record']??this.#n['getRecord'](ha);}#A(ha){this.#s['has'](ha)||this.#l['has'](ha)||(this.#c['push'](ha),this.#s['add'](ha));}#j(ha){if(!this.#s['has'](ha))return!0x1;let hb=this.#c['indexOf'](ha);return hb!==-0x1&&this.#c['splice'](hb,0x1),this.#s['delete'](ha),!0x0;}#M(){const jN=hQ;for(;this.#c['length']>0x0;){let ha=this.#c['shift']();if(!ha)return;this.#s[jN(0x25c)](ha);let hb=this.#k(ha);if(hb&&cL(hb,jN(0x1c0)))return hb;}}#N(ha){let hb=this.#u['has'](ha);return hb&&this.#u['delete'](ha),hb;}#P(){return this.#f===0x0&&this.#c['length']===0x0&&this.#l['size']===0x0;}#F(){this.#P()&&this.#I({'type':'idle'});}#I(ha){for(let hb of this.#e)hb(ha);}};const da=(ha,hb)=>new Input({'source':new UrlSource(ha['url'],{'requestInit':{'headers':ha['headers']},'fetchFn':hb}),'formats':ALL_FORMATS}),db=ha=>{const jO=hQ;let hb;try{hb=new URL(ha);}catch{throw Error('Invalid\x20direct\x20media\x20URL:\x20'+ha);}let hc=hb['pathname'][jO(0x1e4)](/\/+$/,'')[jO(0x320)]('/')['filter'](Boolean)['pop']();return{'type':'video','title':hc?.['split']('.')['slice'](0x0,-0x1)['join']('.')||hc||hb['hostname']||jO(0x22e),'source':{'url':ha}};},dc=async(ha,hb)=>{let hc=hb['proxy']||hb['proxyMeta'];hc&&(await ha['context']['http']['configure']({'proxyUrl':hc}),await C['configure']({'proxyUrl':hc}));},dd=async(ha,hb,hc)=>{if(!hc)return q['warn']('No\x20suitable\x20extension\x20available.\x20Downloading\x20as\x20a\x20direct\x20link...'),[db(ha)];await dc(hc,hb),await bw(hc),q['info']('Analyzing\x20URL...');let hd=await bv(hc)['getEntries']({'url':ha,'options':hb});return hd['length']?[...hd]:(q['info']('No\x20media\x20entries\x20found'),[]);},de=async({entry:ha,url:hb,options:hc,extension:hd,signal:he})=>{const jP=hQ;if(!hd){let hg=ha['source']??{'url':hb},hh=hc['proxy']||hc['proxyMeta'];return hh&&await C['configure']({'proxyUrl':hh}),{'entry':{...ha,'source':hg},'input':da(hg,hh?C['fetch']['bind'](C):void 0x0)};}await dc(hd,hc),await bw(hd);let hf=bv(hd);if(typeof hf['resolveEntry']=='function')return await hf['resolveEntry']({'url':hb,'options':hc,'entry':ha,'signal':he});if(!ha['source']?.['url'])throw Error('Extension\x20'+hd['package']['name']+jP(0x2ef));return{'entry':ha,'input':da(ha['source'],hd['context']['http']['fetch']['bind'](hd['context'][jP(0x2cb)]))};},df=ha=>({async 'analyze'(hb,hc={}){let hd=await dd(hb,hc,await ha['getExtensionForUrl'](hb));if(!hd?.['length'])throw Error('No\x20media\x20entries\x20found');return hd;}}),dg=['code','errno','syscall','address','port',hQ(0x21f),'hostname','path','type'],dh=ha=>typeof ha=='object'&&!!ha&&'status'in ha&&'statusText'in ha&&hQ(0x230)in ha,di=ha=>{let hb=[],hc=ha;for(let hd of dg){let he=hc[hd];he==null||he===''||hb['push'](hd+'='+String(he));}return hb;},dj=(ha,hb=0x0)=>{const jQ=hQ;if(hb>0x3)return'[max-depth]';if(ha instanceof Error){let hc=di(ha),hd='cause'in ha?ha['cause']:void 0x0,he=[ha['name']+':\x20'+ha['message']];return hc['length']&&he['push']('details='+hc['join'](',\x20')),hd!==void 0x0&&hd!==ha&&he['push']('cause='+dj(hd,hb+0x1)),he['join']('\x20|\x20');}return dh(ha)?'Response\x20'+ha['status']+'\x20'+ha['statusText']+'\x20url='+ha[jQ(0x230)]:inspect(ha,{'depth':0x2,'breakLength':0x1/0x0});},dk=(ha,hb)=>{q['debug'](ha+':\x20'+dj(hb)),hb instanceof Error&&hb['stack']&&q['debug'](hb['stack']);},dl=ha=>'manifest:'+ha['type']+':'+ha['id'],dm=ha=>{const jR=hQ;let hb=new Map();for(let hc of ha){let hd=dl(hc),he=hb['get'](hd);if(he){he['push'](hc);continue;}hb[jR(0x255)](hd,[hc]);}return Array['from'](hb['entries']())['filter'](([,hf])=>hf['length']>0x1);},dn=ha=>{const jS=hQ;let hb=dm(ha);if(!hb[jS(0x264)])return;let hc=hb['map'](([hd,he])=>hd+'\x20('+he['length']+'\x20copies)')['join'](',\x20');throw Object['assign'](Error('Duplicate\x20tracks\x20selected:\x20'+hc),{'code':'DUPLICATE_TRACKS_SELECTED'});},dp='DRM_FREE_TIER_RATE_LIMIT',dq=hQ(0x25f),dr=ha=>ha instanceof Error&&ha[hQ(0x2a2)]===dq?new cE(dp,ha['message'],{'cause':ha}):ha,ds=ha=>ha?typeof ha=='string'?ha:ha instanceof Uint8Array||ha instanceof ArrayBuffer?Buffer['from'](ha)[hQ(0x2fe)]('base64'):null:null,dt=async ha=>{let hb=(await ha['getSegments']()['catch'](()=>[]))[0x0];return hb?.['initSegment']?.['encryption']??hb?.['encryption'];},du=async ha=>{let hb=await dt(ha);return[{'system':'widevine','pssh':ds(hb?.['drm']?.['widevine']?.['pssh'])},{'system':'playready','pssh':ds(hb?.['drm']?.['playready']?.['pssh'])},{'system':'fairplay','pssh':ds(hb?.['drm']?.['fairplay']?.['pssh'])}]['filter'](hc=>hc['pssh']);},dv=async ha=>{const jT=hQ;let hb=await dt(ha),hc=await du(ha),hd=hb?.['drm']?.['widevine']&&'widevine'||hb?.['drm']?.[jT(0x229)]&&'playready'||hb?.['drm']?.['fairplay']&&'fairplay'||null;if(!hd)return null;let he=hc['find'](hf=>hf['system']===hd);return{'system':hd,'cacheKey':he?.['pssh']?hd+':'+he['pssh']:'track:'+dl(ha)};},dw=async ha=>{const jU=hQ;let hb=new Map();for(let hc of ha){let hd=await du(hc);for(let he of hd)!he['pssh']||hb['has'](he['pssh'])||hb['set'](he[jU(0x213)],{'pssh':he['pssh'],'system':he['system'],'track':hc});}return hb;},dx=({jobId:ha,title:hb,entryTitle:hc,psshList:hd,options:he,error:hf})=>{const jV=hQ;q['error']('Failed\x20to\x20extract\x20decryption\x20keys\x20for\x20job\x20'+ha),q[jV(0x2a4)]('DRM\x20extraction\x20context:\x20title='+(hb||hc||'(unknown)')+',\x20psshCount='+hd['length']+',\x20providedKeyCount='+(he['keys']?.['length']??0x0)),hf instanceof Error?(dk('DRM\x20extraction\x20failure',hf),hf['message']==='Unauthorized'&&w['emit']('error',{'code':'DRM_UNAUTHORIZED'}),hf['message']===jV(0x2a5)&&w['emit']('error',{'code':'DRM_FORBIDDEN'})):q['debug'](String(hf));},dy=async({psshList:ha,requestLicense:hb})=>{const jW=hQ;q['debug']('Extracting\x20decryption\x20keys');let hc=[],hd=[...new Set(ha??[])];for(let he of hd){q['debug']('Resolving\x20DRM\x20keys\x20for\x20PSSH\x20'+he),q['debug'](jW(0x322)+he);let hf=Buffer[jW(0x32a)](he,jW(0x1fc)),hg='cenc',hh=new RemoteCdm({'keySystem':'com.widevine.alpha','baseUrl':bL(bK(),'drm'),'headers':{'Authorization':'Bearer\x20'+c5['accessToken']}}),hi=null;try{hi=(await requestMediaKeySystemAccess(hh['keySystem'],[])['createMediaKeys']({'cdm':hh}))['createSession'](),q['debug']('Generating\x20license\x20request...');let hk=hi['waitForLicenseRequest']();await hi['generateRequest']('cenc',hf);let hl=await hk;q['debug']('License\x20request\x20of\x20'+hl['length']+'\x20bytes\x20generated\x20for\x20session\x20'+hi['sessionId']),q['debug']('Requesting\x20license...');let hm=await hb({'pssh':he,'data':new Uint8Array(hl)});if(hm[0x0]===0x7b||hm[0x0]===0x3c){q['debug']('License\x20response\x20is\x20not\x20binary');let ho=Buffer[jW(0x32a)](hm)['toString']('utf8');if(q['debug'](ho),ho['includes']('<html>'))throw Error('Invalid\x20license\x20response');}q['debug']('Updating\x20session...'),await hi['update'](new Uint8Array(hm)),q['debug']('Waiting\x20for\x20key\x20statuses\x20change...');let hn=await hi['waitForKeyStatusesChange']();q['debug']('Keys\x20count:\x20'+hn['length']),await hi['close'](),await hi['remove']();for(let hp of hn){let hq='Key:\x20'+hp['keyId']+':'+hp['key'];q['debug'](hq),hc['push']({'kid':hp['keyId'],'key':hp['key']});}}finally{if(hi){try{await hi['close']();}catch{}try{await hi['remove']();}catch{}}}}return hc['length']||(q['warn']('Can\x27t\x20get\x20decryption\x20keys'),q['debug']('PSSH:\x20'+hd['join'](',\x20'))),hc;},dz=async({jobId:ha,title:hb,entryTitle:hc,options:hd,psshList:he,selectedTracks:hf,extension:hg,resource:hh})=>{const jX=hQ;let hi=hd['keys']??[];if(hi['length'])return hi;if(!hg)return[];let hk=bv(hg);if(!hk['drm'])return[];let hl=[];if(typeof hk[jX(0x1de)]['resolveKeys']=='function'){let ho=new Map(),hp=new Map();for(let hq of hf){let hr=await dv(hq);if(!hr)continue;let hs=hp['get'](hr['cacheKey']);hs||(hs=await hk['drm']['resolveKeys']({'system':hr[jX(0x235)],'resource':hh,'track':hq,'options':hd}),hp['set'](hr['cacheKey'],hs));for(let ht of hs)ho['has'](ht['kid'])||ho['set'](ht['kid'],ht);}hl[jX(0x277)](...Array['from'](ho['values']()));}if(typeof hk['drm']['requestLicense']!='function')return hl;let hm=hk[jX(0x1de)]['requestLicense'],hn=await dw(hf);if(!hn['size'])return hl;try{let hu=await dy({'psshList':he,'requestLicense':async({pssh:hv,data:hw})=>{let hx=hn['get'](hv);if(!hx)throw Error('No\x20DRM\x20track\x20binding\x20found\x20for\x20PSSH\x20'+hv);return await hm({'system':hx['system'],'resource':hh,'track':hx['track'],'options':hd,'data':hw});}});hl['push'](...hu);}catch(hv){let hw=dr(hv);throw dx({'jobId':ha,'title':hb,'entryTitle':hc,'psshList':he,'options':hd,'error':hw}),hw;}return hl;},dA=ha=>{const jY=hQ;let hb=ha['replace'](/[<>:"/\\|?*\x00-\x1F]/g,'');hb=hb['replace'](/^[\s.]+|[\s.]+$/g,''),hb=hb['replace'](/\s+/g,'\x20');let hc=hb['lastIndexOf']('.'),hd=hc>0x0,he=hd?hb['slice'](hc):'',hf=hd?hb['slice'](0x0,hc):hb;if(he['length']>=0xff)hb=hb['slice'](0x0,0xff);else{let hh=0xff-he[jY(0x264)];hf['length']>hh&&(hf=hf['slice'](0x0,hh)),hb=hf+he;}let hg=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;if(he['length']<0xff){let hi=hb[jY(0x30d)]('.'),hk=hi>0x0;if(he=hk?hb['slice'](hi):'',hf=hk?hb['slice'](0x0,hi):hb,hg['test'](hf)){let hl=0xff-he['length'];hb=('_'+hf)['slice'](0x0,hl)+he;}}return hb['length']===0x0?'untitled':hb;},dB=(ha,hb)=>Object['keys'](hb)['reduce']((hc,hd)=>{const jZ=hQ;let he='{'+hd+'}',hf=hb[hd];if(!hf){let hg=RegExp('(?:\x5c.|^)\x5c{'+hd+'\x5c}(?=\x5c.|$)|\x5c{'+hd+'\x5c}(\x5c.|$)|\x5c{'+hd+'\x5c}','g');return hc['replace'](hg,(hh,hi)=>'')['replaceAll']('....',jZ(0x252));}return hc['replaceAll'](he,hf);},ha)['replaceAll']('\x20\x20','\x20'),dC=ha=>typeof ha=='string'&&ha['trim']()||'mp4',dD=async ha=>{const k0=hQ;if(!ha)return'';let hb=(await ha['getCodec']())?.[k0(0x26a)]();if(!hb)return'';switch(hb['split']('.')[0x0]??hb){case'ec-3':case'eac3':return k0(0x31a);case'ac-3':case'ac3':return'DD';case'aac':case k0(0x2e0):return'AAC';case'opus':return'OPUS';case k0(0x239):return'VORBIS';case'flac':return'FLAC';default:return hb['toUpperCase']();}},dE=ha=>{let hb=ha['seasonNumber']?''+ha['seasonNumber']:'',hc=ha['episodeNumber']?''+ha['episodeNumber']:'',hd=hb?'S'+hb:'',he=hc?'E'+hc:'',hf=hb&&hc?hd+':'+he:'',hg=ha['episodeTitle']?.['trim']()?'\x22'+ha['episodeTitle']+'\x22':'';return((ha['title']??'')+'\x20'+hf+'\x20'+hg)['trim']();},dF=async({settings:ha,options:hb,entry:hc,tag:hd,tracks:he})=>{const k1=hQ;let [hf,hg]=await Promise['all']([he['videos'][0x0]?.[k1(0x1b6)]()??Promise['resolve'](''),dD(he['audios'][0x0])]),hh=ha['get']('downloadDir'),hi=hb['movieTemplate']||ha['get']('movieFilenameTemplate'),hk=hb['episodeTemplate']||ha['get']('seriesFilenameTemplate'),hl=dA(dB(hc['episodeNumber']?hk:hi,{'title':hc['title']??'','s':hc['seasonNumber']?hc['seasonNumber']['toString']()['padStart'](0x2,'0'):'','e':hc['episodeNumber']?hc['episodeNumber']['toString']()['padStart'](0x2,'0'):'','quality':hb['videoQuality']??'','codec':hf??'','tag':hd??'','episodeTitle':hc['episodeTitle']??'','audioType':hg,'format':k1(0x2e6)}))+'.'+dC(hb['format']||ha['get'](k1(0x209))),hm=hb['outputPath']||join(hh,hl),hn=parse(hm);return{'outputPath':hm,'outputDirectory':hn['dir']||hh,'fileName':hn['base'],'baseName':hn['name']};},dG=ha=>{const k2=hQ;if(!ha)return;let hb=Object['fromEntries'](new Headers(ha)['entries']());return Object[k2(0x327)](hb)['length']?hb:void 0x0;},dH=ha=>{const k3=hQ;let hb=ha['source'],hc=hb['rootPath'];if(typeof hc!='string'||!hc)throw Error('Resolved\x20media\x20resource\x20is\x20missing\x20a\x20usable\x20input\x20source\x20URL');return{'url':hc,'headers':dG(hb['_options']?.['requestInit']?.[k3(0x31b)])};},dI=ha=>ha?.['trim']()['toLowerCase']()??'',dJ=ha=>dI(ha)['slice'](0x0,0x2),dK=ha=>dI(ha)||'und',dL=(ha,hb)=>{let hc=dI(ha),hd=dI(hb);return!hc||!hd?!0x1:hc===hd||hc['startsWith'](hd+'-')?!0x0:dJ(hc)===dJ(hd);},dM=ha=>Array['from'](new Map(ha['map'](hb=>dI(hb))['filter'](Boolean)['map'](hb=>[dJ(hb),hb]))['values']()),dN=({videos:ha,audios:hb,subtitles:hc})=>({'videos':ha,'audios':hb,'subtitles':hc,'all':[...ha,...hb,...hc]}),dO=ha=>(ha??0x0)/0x3e8,dP=async ha=>{try{return(await ha['getSegments']())['length']+'\x20Segments';}catch{return'?\x20Segments';}},dQ=(ha,hb)=>{const k4=hQ;let hc=new Map();for(let hd of ha){let he=dK(hd[k4(0x270)]),hf=hc['get'](he);if(!hf){hc[k4(0x255)](he,[hd]);continue;}hf['length']<hb&&hf[k4(0x277)](hd);}return Array['from'](hc['values']())['flat']();},dR=(ha,hb,hc=0x1)=>{const k5=hQ;let hd=[...ha]['sort']((hh,hi)=>hi['bitrate']-hh['bitrate']),he=dM(hb),hf=[];for(let hh of he){let hi=[];for(let hk of hd)dL(hk['language'],hh)&&hi[k5(0x277)](hk);hi['length']&&hf['push'](...dQ(hi,hc));}let hg=dM(hd['map'](hl=>hl['language']||'und'));if(!hf['length'])for(let hl of hg){let hm=[];for(let hn of hd)dL(hn['language']||'und',hl)&&hm['push'](hn);hm['length']&&hf['push'](...dQ(hm,hc));}return hf;},dS=async(ha,hb)=>{const k6=hQ;let hc=hb?parseInt(String(hb),0xa)*0x10/0x9:void 0x0;return await ha[k6(0x1cf)]({'filter':async hd=>!await hd['hasOnlyKeyPackets'](),'sortBy':async hd=>[prefer(!!hb&&Number(await hd[k6(0x2ce)]())===Number(hb)),prefer(!!hc&&Number(await hd['getDisplayWidth']())===Number(hc)),desc(await hd['getBitrate']())]});},dT=(ha,hb)=>{if(!hb?.['length'])return ha;let hc=[];for(let hd of ha)hd['codec']&&hb['includes'](hd['codec'])&&hc['push'](hd);return hc['length']?hc:ha;},dU=(ha,hb)=>{if(!hb)return ha;let hc=[];for(let hd of ha)hd['channels']===Number(hb)&&hc['push'](hd);return hc['length']?hc:ha;},dV=async({input:ha,video:hb})=>await ha['getAudioTracks']({'sortBy':async hc=>[prefer(!hb||hc['canBePairedWith'](hb)),desc(await hc['getBitrate']())]}),dW=async ha=>await ha['getSubtitleTracks']({'sortBy':async hb=>[desc(await hb['getBitrate']())]}),dX=async ha=>await ha['getName']?.()['catch'](()=>void 0x0)??'',dY=async(ha,hb={})=>{const k7=hQ;let [hc,hd,he]=await Promise['all']([ha[k7(0x2f4)]()['catch'](()=>'und'),ha['getCodec']()['catch'](()=>void 0x0),ha['getBitrate']()[k7(0x273)](()=>0x0)]),hf={'id':dl(ha),'track':ha,'type':ha['type'],'language':hc??'und','languageFamily':dJ(hc),'label':'','codec':hd??void 0x0,'bitrate':he??0x0};if(ha['type']==='video'||ha['isVideoTrack']?.()===!0x0){let hm=ha,[hn,ho,hp]=await Promise['all']([hm['getDisplayWidth']()[k7(0x273)](()=>void 0x0),hm['getDisplayHeight']()['catch'](()=>void 0x0),dP(hm)]);return{...hf,'width':hn??void 0x0,'height':ho??void 0x0,'label':(hn??'?')+'x'+(ho??'?')+'\x20|\x20'+(dO(he)||'?')+'\x20Kbps\x20|\x20'+(hd??'?')+'\x20|\x20'+hp};}if(!(ha['type']==='audio'||ha['isAudioTrack']?.()===!0x0)){let hq=await dP(ha);return{...hf,'label':(hd??'?')+k7(0x23f)+(hc||'und')+'\x20|\x20'+hq};}let hg=ha,[hh,hi,hk,hl]=await Promise['all']([hg['getNumberOfChannels']()['catch'](()=>void 0x0),hb['pairableWithVideo']?Promise['resolve'](hg[k7(0x29c)](hb['pairableWithVideo']))['catch'](()=>!0x1):Promise['resolve'](void 0x0),dX(hg),dP(hg)]);return{...hf,'channels':hh??void 0x0,'pairableWithPrimaryVideo':hi,'label':''+(hk?hk+'\x20|\x20':'')+(dO(he)||'?')+'\x20Kbps\x20|\x20'+(hd?hd+k7(0x23f):'')+(hc||'und')+'\x20|\x20'+(hh??'?')+'CH\x20|\x20'+hl};},dZ=async(ha,hb)=>await Promise['all'](ha[hQ(0x2d7)](async hc=>await dY(hc,hb))),e0=async({videos:ha,audios:hb,subtitles:hc})=>{let hd=ha[0x0],[he,hf,hg]=await Promise['all']([dZ(ha),dZ(hb,{'pairableWithVideo':hd}),dZ(hc)]);return{'videos':he,'audios':hf,'subtitles':hg};},e1=async(ha,hb)=>{const k8=hQ;let hc=hb[k8(0x2fb)],hd=dT(await dZ(await dS(ha,hc||NaN)),hb['videoCodecs'])['map'](he=>he['track']);return await e0({'videos':hd,'audios':await dV({'input':ha,'video':hd[0x0]}),'subtitles':await dW(ha)});},e2=({options:ha,catalog:hb})=>{const k9=hQ;let hc=ha['skipVideo']?void 0x0:hb[k9(0x2fc)][0x0],hd=[...ha['languages']||[]],he=hb['audios']['filter'](hh=>hc&&hh[k9(0x2f8)]);he['length']||(he=[...hb['audios']]),he=dU(he,ha['audioChannels']),he=dT(he,ha['audioCodecs']);let hf=dR(he,hd,0x1);hf[k9(0x264)]&&(he=hf);let hg=[];for(let hh of hb['subtitles'])ha[k9(0x240)]?.['length']&&ha['subtitleLanguages']['some'](hi=>dL(hh['language']||'und',hi))&&hg['push'](hh);return{'videos':hc?[hc]:[],'audios':ha['skipAudio']?[]:he,'subtitles':ha['skipSubtitles']?[]:hg};},e3=async({options:ha,catalog:hb})=>{const ka=hQ;let hc=e2({'options':ha,'catalog':hb}),hd=hc['audios']['map'](hf=>hf['track']),he=(ha['languages']||[])['at'](-0x1);if(he){for(let hf of hc['audios'])(!hf['language']||hf['language']==='und')&&hf['track'][ka(0x24b)](he);}return dN({'videos':hc['videos']['map'](hg=>hg['track']),'audios':ha[ka(0x286)]?[]:hd,'subtitles':ha['skipSubtitles']?[]:hc['subtitles']['map'](hg=>hg['track'])});},e4=ha=>{if(!ha)return null;try{return new URL(ha);}catch{return null;}},e5=(ha,hb)=>{if(!hb['languages']?.['length'])return(ha['context']?.['legacy']?.['source'])?.['audioLanguage']?.['trim']()||void 0x0;},e6=(ha,hb)=>{if(ha)switch(ha){case'aar':case'abk':return'rus';case'ave':return'eng';case'zu':return hb?.['includes']('start.film')?'ru':'zu';default:return ha;}},e7=async(ha,hb)=>{let hc=await ha['getLanguageCode']()['catch'](()=>void 0x0),hd=e6(hc,hb);hd&&hd!==hc&&ha['setLanguageCode'](hd);},e8=async(ha,hb)=>{await Promise['all'](ha['map'](hc=>e7(hc,hb)));},e9=(ha,hb)=>ha['filter'](hc=>hc['type']===hb)['length'],ea=ha=>{const kb=hQ;let hb='Extracted,\x20there\x20are\x20';if(ha['length']===0x0)hb+='no\x20tracks';else{hb+=ha['length']+'\x20tracks';let hc=e9(ha,'video');hc&&(hb+=',\x20'+hc+kb(0x1c3));let hd=e9(ha,'audio');hd&&(hb+=',\x20'+hd+'\x20audio\x20tracks');let he=e9(ha,'subtitle');he&&(hb+=',\x20'+he+'\x20subtitle\x20tracks');}q['info'](hb);},eb=async(ha,hb)=>{let hc=await ha['getSubtitleTracks']();return await e8(hc,hb),hc;},ec=(ha,hb)=>{q['debug']('URL:\x20'+dH(ha['input'])['url']);let hc=hb['seasonNumber'],hd=hb['episodeNumber'],he=hb['episodeTitle']??'',hf=[hb['title'],hc?'S'+hc:'',hd?'E'+hd:'',he]['filter'](Boolean)['join']('\x20∙\x20');hf&&q['info'](hf);},ed=(ha,hb)=>{if(ha['title'])return;let hc=e4(hb)?.['pathname']['split']('/')['pop']();hc&&(ha['title']=hc);},ee=(ha,hb)=>{if(ha['title'])return;let hc=e4(hb)?.['host'];hc&&(ha['title']=hc+'_'+m());},ef=(ha,hb)=>{ha['videoQuality']||=hb?hb+'p':void 0x0;},eg=({videos:ha,audios:hb,subtitles:hc})=>({'videos':ha,'audios':hb,'subtitles':hc,'all':[...hc,...ha,...hb]}),eh=async({options:ha,resource:hb,entry:hc})=>{const kc=hQ;let hd=dH(hb['input'])['url'],he={...ha},hf={...hc},hg=hb['input'];ed(hf,hd);let [hh,hi,hk]=await Promise['all']([hg['getPrimaryVideoTrack'](),hg[kc(0x330)](),eb(hg,hd)]);ef(he,await hh?.['getCodedHeight']());let hl=hh&&!he['skipVideo']?[hh]:[],hm=[];!hh&&hi&&!he['skipAudio']&&(await e7(hi,hd),hm=[hi]);let hn=eg({'videos':hl,'audios':hm,'subtitles':hk});return ea(hn['all']),{'options':he,'resource':hb,'entry':hf,'tracks':hn,'isSegmented':!0x1};},ei=async({options:ha,resource:hb,entry:hc,trackSelector:hd})=>{const kd=hQ;let he=dH(hb['input'])['url'],hf={...ha},hg={...hc};await e8(await hb['input']['getTracks'](),he),ee(hg,he);let hh={...hf},hi=e5(hg,hh);hi&&(hh['languages']=[hi]);let hk=await hd({'options':hh,'catalog':await e1(hb[kd(0x2ff)],hh)});if(ea(hk['all']),!hk['videos']['length']&&!hk['audios']['length']&&!hk['subtitles']['length'])throw new cE('No\x20tracks\x20selected');return hk[kd(0x2fc)][0x0]&&ef(hf,await hk['videos'][0x0]['getDisplayHeight']()),{'options':hf,'resource':hb,'entry':hg,'tracks':hk,'isSegmented':!0x0};},ej={'direct':eh,'manifest':ei},ek=ha=>ha===HLS||ha===DASH?'manifest':'direct',el=async({format:ha,options:hb,resource:hc,entry:hd,trackSelector:he})=>(q['info']('Content\x20Matched:\x20'+ha[hQ(0x30e)]),await ej[ek(ha)]({'options':hb,'resource':hc,'entry':hd,'trackSelector':he})),em=async({options:ha,resource:hb,entry:hc,trackSelector:hd=e3})=>await el({'format':await hb['input']['getFormat'](),'options':ha,'resource':hb,'entry':hc,'trackSelector':hd??e3}),en=async({settings:ha,options:hb,resource:hc,extensionTag:hd,trackSelector:he})=>{const ke=hQ;let hf={...hc['entry'],'id':hc['entry']['id']??crypto[ke(0x257)]()};ec(hc,hf),q['info']('Parsing\x20streams...');let hg=await em({'options':{...hb},'resource':hc,'entry':hf,'trackSelector':he}),hh=await dF({'settings':ha,'options':hg['options'],'entry':hg['entry'],'tag':hd,'tracks':hg['tracks']});return await aH(hh['outputDirectory']),{...hg,'output':hh,'downloadTitle':dE(hg['entry'])||hh['baseName']};},eo=async({extensionManager:ha,entry:hb,url:hc,options:hd,signal:he})=>{let hf=hc?await ha['getExtensionForUrl'](hc):null,hg=await de({'entry':hb,'url':hc??hb['source']?.['url']??'','options':hd,'extension':hf,'signal':he});return{'resource':hg,'extension':hf,'extensionTag':hf?b8(hf):void 0x0,'beforeDownload':async()=>{!hf||!hc||await bB(hf,{'url':hc,'options':hd,'resource':hg,'signal':he});},'afterDownload':async hh=>{!hf||!hc||await bC(hf,{'url':hc,'options':hd,'resource':hg,'signal':he,'skipMux':hh});},'dispose':async()=>{const kf=b;if(hg['dispose']){await hg['dispose']();return;}await hg['input'][kf(0x1c7)]?.();}};};var ep=class{[hQ(0x1bd)];constructor(ha){this['strategy']=ha;}async['prepare'](){await this['strategy']['prepare']?.();}async['process'](ha){let hb=await this['strategy']['decryptFile'](ha);return ha['cleanup']&&await rm(ha['input'],{'force':!0x0}),hb;}};const eq=ha=>ha['replaceAll']('-','')['toLowerCase']();var er=class{async['decryptFile'](ha){const kg=hQ;let hb=new Map();for(let hc of ha['keys']){if(!hc['kid'])throw Error('Shifro\x20requires\x20a\x20KID\x20for\x20every\x20decryption\x20key');hb['set'](eq(hc['kid']),eq(hc['key']));}return q['debug']('Decrypting\x20via\x20shifro:\x20'+ha[kg(0x2ff)]),await(await Decryption['init']({'input':new U({'source':new FilePathSource(ha['input']),'keys':hb}),'output':new Output({'target':new FilePathTarget(ha['output'])})}))['execute'](),ha['output'];}};const es=async(ha,hb,hc)=>hc??open(ha,hb),et=ha=>{let hb=null;return new StreamSource({'getSize':async()=>(hb=await es(ha,'r',hb),(await hb['stat']())['size']),'read':async(hc,hd)=>{const kh=b;hb=await es(ha,'r',hb);let he=new Uint8Array(hd-hc);return await hb[kh(0x267)](he,0x0,hd-hc,hc),he;},'dispose':async()=>{let hc=hb;hb=null,await hc?.['close']();},'prefetchProfile':'fileSystem'});},eu=ha=>{let hb=null;return new StreamTarget(new WritableStream({'start':async()=>{hb=await es(ha,'w',hb);},'write':async hc=>{const ki=b;if(!hb)throw Error('MediaBunny\x20output\x20handle\x20was\x20not\x20initialized\x20for\x20'+ha);await hb[ki(0x272)](hc['data'],0x0,hc['data']['byteLength'],hc['position']);},'close':async()=>{let hc=hb;hb=null,await hc?.['close']();},'abort':async()=>{let hc=hb;hb=null,await hc?.['close']();}}),{'chunked':!0x0});},ev=/(?:(.+?)\n)?((?:\d{2}:)?\d{2}:\d{2}\.\d{3})\s+-->\s+((?:\d{2}:)?\d{2}:\d{2}\.\d{3})([^\n]*)/g,ew=/^\uFEFF?WEBVTT(?:.|\n)*?\n{2}/,ex=/(?:(\d{2}):)?(\d{2}):(\d{2})\.(\d{3})/,ey={'ar':'ara','de':'deu','en':'eng','es':'spa','fr':'fra','hi':'hin','it':'ita','ja':'jpn','ko':hQ(0x2bd),'pl':'pol','pt':'por','ru':'rus','th':'tha','tr':'tur','uk':hQ(0x211),'und':'und','vi':'vie','zh':'zho'},ez=ha=>ha==='subtitle'||ha==='text',eA=ha=>{const kj=hQ;let hb=ha['trim']()['split'](':');if(hb['length']<0x2||hb[kj(0x264)]>0x3)throw Error('Invalid\x20trim\x20timestamp:\x20'+ha);let hc=Number(hb['at'](-0x1)),hd=Number(hb['at'](-0x2)),he=hb['length']===0x3?Number(hb[0x0]):0x0;if(![he,hd,hc]['every'](hf=>Number['isFinite'](hf)&&hf>=0x0))throw Error('Invalid\x20trim\x20timestamp:\x20'+ha);return he*0xe10+hd*0x3c+hc;},eB=ha=>{let hb=ex['exec'](ha);if(!hb)throw Error('Invalid\x20WebVTT\x20timestamp:\x20'+ha);return 0xe10*0x3e8*Number(hb[0x1]||'0')+0x3c*0x3e8*Number(hb[0x2])+0x3e8*Number(hb[0x3])+Number(hb[0x4]);},eC=ha=>{const kk=hQ;let hb=Math['floor'](ha/(0xe10*0x3e8)),hc=Math['floor'](ha%(0xe10*0x3e8)/(0x3c*0x3e8)),hd=Math['floor'](ha%(0x3c*0x3e8)/0x3e8),he=ha%0x3e8;return hb['toString']()['padStart'](0x2,'0')+':'+hc['toString']()['padStart'](0x2,'0')+':'+hd['toString']()['padStart'](0x2,'0')+'.'+he['toString']()[kk(0x2c3)](0x3,'0');},eD=ha=>{const kl=hQ;let hb=[ha['invalidEntries']?.['length']?ha['invalidEntries']['length']+'\x20invalid\x20entries':void 0x0,ha['invalidTimecodes']?.['length']?ha['invalidTimecodes'][kl(0x264)]+'\x20invalid\x20timecodes':void 0x0,ha['invalidIndices']?.[kl(0x264)]?ha['invalidIndices']['length']+'\x20invalid\x20indices':void 0x0,ha['timecodeIssues']?.['reversedTimecodes']?.['length']?ha['timecodeIssues']['reversedTimecodes']['length']+'\x20reversed\x20timecodes':void 0x0,ha['timecodeIssues']?.['overlappingTimecodes']?.['length']?ha['timecodeIssues']['overlappingTimecodes']['length']+'\x20overlapping\x20timecodes':void 0x0]['filter'](Boolean);return hb['length']?'\x20('+hb['join'](',\x20')+')':'';},eE=ha=>{let hb=ha['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')['trim']();if(ew['test'](hb))return hb;let {subtitle:hc,status:hd}=convert(ha,'.vtt');if(!hd['success'])throw Error('Failed\x20to\x20convert\x20subtitle\x20to\x20WebVTT'+eD(hd)+'.');return hc['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')['trim']();},eF=ha=>{const km=hQ;if(!ha)return;let hb=ha['trim']()[km(0x26a)]();if(!hb)return;let hc=hb['split']('-')[0x0]??hb;return/^[a-z]{3}$/['test'](hc)?hc:ey[hc];},eG=ha=>{switch(extname(ha)['toLowerCase']()){case'.mp4':return new Mp4OutputFormat();case'.mkv':return new MkvOutputFormat();default:throw Error('Unsupported\x20mux\x20output\x20format:\x20'+ha);}},eH=ha=>new W({'formats':V,'source':et(ha)}),eI=ha=>{let hb=ha['trimBegin']?eA(ha['trimBegin']):void 0x0,hc=ha['trimEnd']?eA(ha['trimEnd']):void 0x0;if(hb!==void 0x0&&hc!==void 0x0&&hc<=hb)throw Error('trimEnd\x20must\x20be\x20greater\x20than\x20trimBegin');return{'trimBegin':hb,'trimEnd':hc};},eJ=async(ha,hb,hc,hd,he)=>{const kn=hQ;let hf=eH(hb),hg=await hf['getPrimaryVideoTrack']();if(!hg)throw Error('Missing\x20video\x20track\x20in\x20'+hb);let hh=hg['codec'];if(!hh)throw Error('Unknown\x20video\x20codec\x20in\x20'+hb);if(he!==void 0x0&&he>=await hg['computeDuration']())throw Error('trimBegin\x20excludes\x20the\x20full\x20video\x20track\x20in\x20'+hb);let hi=new EncodedPacketSink(hg),hk=he===void 0x0?await hi['getFirstKeyPacket']({'verifyKeyPackets':!0x0}):await hi['getKeyPacket'](he,{'verifyKeyPackets':!0x0})??await hi['getFirstKeyPacket']({'verifyKeyPackets':!0x0});if(!hk)throw Error(kn(0x31c)+hb);let hl=new EncodedVideoPacketSource(hh);return ha['addVideoTrack'](hl,{'disposition':hg['disposition'],'name':hc??hg['name']??void 0x0,'rotation':hd['supportsVideoRotationMetadata']?hg['rotation']:void 0x0}),{'kind':'video','input':hf,'sink':hi,'source':hl,'startPacket':hk,'startTimestamp':hk['timestamp'],'emit':async hm=>{const ko=kn;let hn={'decoderConfig':await hg[ko(0x2eb)]()??void 0x0},ho=!0x0;for await(let hp of hi['packets'](hk,void 0x0,{'verifyKeyPackets':!0x0}))await hl['add'](hp['clone']({'timestamp':hp['timestamp']-hm}),ho?hn:void 0x0),ho=!0x1;hl['close']();}};},eK=async(ha,hb,hc,hd,he)=>{let hf=eH(hb),hg=await hf['getPrimaryAudioTrack']();if(!hg)throw Error('Missing\x20audio\x20track\x20in\x20'+hb);let hh=hg['codec'];if(!hh)throw Error('Unknown\x20audio\x20codec\x20in\x20'+hb);if(he!==void 0x0&&he>=await hg['computeDuration']())throw Error('trimBegin\x20excludes\x20the\x20full\x20audio\x20track\x20in\x20'+hb);let hi=new EncodedPacketSink(hg),hk=he===void 0x0?await hi['getFirstPacket']():await hi['getPacket'](he)??await hi['getFirstPacket']();if(!hk)throw Error('No\x20audio\x20packets\x20found\x20in\x20'+hb);let hl=new EncodedAudioPacketSource(hh);return ha['addAudioTrack'](hl,{'disposition':hg['disposition'],'languageCode':eF(hc)??eF(hg['languageCode']),'name':hd??hg['name']??void 0x0}),{'kind':'audio','input':hf,'sink':hi,'source':hl,'startPacket':hk,'startTimestamp':hk['timestamp'],'emit':async hm=>{let hn={'decoderConfig':await hg['getDecoderConfig']()??void 0x0},ho=!0x0;for await(let hp of hi['packets'](hk))await hl['add'](hp['clone']({'timestamp':hp['timestamp']-hm}),ho?hn:void 0x0),ho=!0x1;hl['close']();}};},eL=(ha,{trimBegin:hb,trimEnd:hc,commonStart:hd})=>{const kp=hQ;let he=ha['replaceAll']('\x0d\x0a','\x0a')['replaceAll']('\x0d','\x0a')['trim']();if(!ew['test'](he))throw Error(kp(0x28d));let hf=hb===void 0x0?void 0x0:Math['round'](hb*0x3e8),hg=hc===void 0x0?void 0x0:Math['round'](hc*0x3e8),hh=Math['round'](hd*0x3e8);ev['lastIndex']=0x0;let hi=ev['exec'](he),hk=he['slice'](0x0,hi?.['index']??he['length'])['trimEnd'](),hl=[],hm=hi?he['slice'](hi['index']):'';for(;;){ev['lastIndex']=0x0;let hn=ev['exec'](hm);if(!hn)break;let ho=hn['index']+hn[0x0][kp(0x264)],hp=hm['indexOf']('\x0a',ho)+0x1,hq=hm['indexOf']('\x0a\x0a',ho);hq===-0x1&&(hq=hm['length']);let hr=hn[0x1]?.['trim'](),hs=hn[0x4]?.['trim'](),ht=hm[kp(0x2c7)](hp,hq)['trim'](),hu=eB(hn[0x2]),hv=eB(hn[0x3]),hw=Math['max'](hu,hf??hu)-hh,hx=Math['min'](hv,hg??hv)-hh;if(hx>hw){let hy=eC(hw)+'\x20-->\x20'+eC(hx)+(hs?'\x20'+hs:'');hl['push']([hr,hy,ht]['filter'](Boolean)['join']('\x0a'));}hm=hm['slice'](hq)['trimStart']();}return[hk,...hl]['filter'](Boolean)['join']('\x0a\x0a');},eM=async(ha,hb,hc,hd,he)=>{const kq=hQ;if(hc[kq(0x263)]===kq(0x205))return eJ(ha,hc['path'],hc['label'],hb,hd);if(hc['type']==='audio')return eK(ha,hc['path'],hc['language'],hc['label'],hd);if(ez(hc['type'])){let hf=eE(await readFile(hc['path'],'utf8')),hg=new TextSubtitleSource('webvtt');return ha[kq(0x26b)](hg,{'disposition':hc['forced']?{'forced':!0x0}:void 0x0,'languageCode':eF(hc['language']),'name':hc['label']}),{'kind':'subtitle','source':hg,'emit':async hh=>{let hi=eL(hf,{'trimBegin':hd,'trimEnd':he,'commonStart':hh});await hg['add'](hi),hg['close']();}};}throw Error('Unsupported\x20mux\x20input\x20type:\x20'+hc[kq(0x263)]);};var eN=class{async['mux'](ha){const kr=hQ;let {trimBegin:hb,trimEnd:hc}=eI(ha),hd=eG(ha['output']),he=new X({'format':hd,'target':eu(ha['output'])}),hf=[];try{for(let hi of ha['inputs'])hf['push'](await eM(he,hd,hi,hb,hc));let hg=hf['filter'](hk=>hk['kind']!=='subtitle');if(!hf['length'])throw Error('No\x20tracks\x20provided\x20for\x20muxing.');let hh=hg['length']>0x0?Math[kr(0x1da)](...hg['map'](hk=>hk['startTimestamp'])):hb??0x0;await he['start']();for(let hk of hf){if(hk['kind']==='subtitle'){await hk['emit'](hh);continue;}await hk['emit'](hh);}return await he['finalize'](),ha['output'];}catch(hl){throw await he['cancel']()['catch'](()=>void 0x0),hl;}finally{for(let hm of hf)hm[kr(0x2b4)]!=='subtitle'&&hm['input']['dispose']();}}},eO=class{['strategy'];constructor(ha){this['strategy']=ha;}async[hQ(0x1ef)](){await this['strategy']['prepare']?.();}async['process'](ha){const ks=hQ;let hb=await this['strategy']['mux'](ha);if(ha['cleanup']){for(let hc of new Set(ha[ks(0x260)]['map'](hd=>hd['path'])))await rm(hc,{'force':!0x0});}return hb;}};const eP=()=>{const kt=hQ;if(!(process['platform']!=='win32'||process.env.ELECTRON_RUN_AS_NODE!=='1')&&!isatty(process['stderr']['fd'])&&aa()?.['getConsoleSize']?.()?.[kt(0x1fa)])try{let ha=a8('nanospinner/dist/consts.js');ha&&ha['isTTY']===!0x1&&(ha['isTTY']=!0x0,ha['symbols']?.[kt(0x2e3)]?.[kt(0x264)]===0x1&&(ha['symbols']['frames']=['-','\x5c','|','/']));}catch{}},eQ=ha=>{let hb=process['stderr'];if(!ha||process['platform']!=='win32'||process.env.ELECTRON_RUN_AS_NODE!=='1')return hb;if(!hb['columns']||hb['columns']!==ha){let hc=Object['getOwnPropertyDescriptor'](hb,'columns')??Object['getOwnPropertyDescriptor'](Object['getPrototypeOf'](hb),'columns');if(!hc||hc['writable']||hc['set'])try{hb['columns']=ha;}catch{}if(hb['columns']!==ha){let hd=Object['create'](hb);return Object['defineProperty'](hd,'columns',{'value':ha,'configurable':!0x0,'enumerable':!0x0,'writable':!0x0}),q['warn']('Unable\x20to\x20override\x20stderr.columns;\x20using\x20spinner-local\x20width\x20'+ha+'.'),hd;}}return hb;},eR={'debug':'gray','info':'green','warn':'yellow','error':'red'},eS=ha=>{let hb=ha['toUpperCase'](),hc=O[eR[ha]];return hc(hb);},eT=(ha,hb)=>typeof hb=='string'?ha+'\x20'+hb:hb&&{...hb,'text':(ha+'\x20'+(hb['text']??''))['trimEnd']()},eU=(ha,hb)=>{const ku=hQ;eP();let hc=A(eS('info')),hd=createSpinner(ha,{'stream':eQ(aa()?.['getConsoleSize']?.()?.['columns']??process[ku(0x2ca)]['columns']??process['stdout']['columns']??(process['platform']==='win32'?0x78:0x50))})['start']({'text':hc+'\x20'+ha,'color':hb}),he=hd['update']['bind'](hd),hf=hd['success']['bind'](hd),hg=hd['error']['bind'](hd);return hd['update']=hh=>he(eT(hc,hh)),hd['success']=hh=>hf(eT(hc,hh)),hd['error']=hh=>hg(eT(hc,hh)),hd;},eV={'update':()=>void 0x0,'success':()=>void 0x0,'error':()=>void 0x0},eW={'createTask':()=>eV,'progress':()=>void 0x0},eX=()=>({'createTask':(ha,hb)=>{let hc=eU(ha,hb?.['color']);return{'update':hd=>hc['update'](hd),'success':hd=>hc['success'](hd),'error':hd=>hc['error'](hd)};},'progress':()=>void 0x0}),eY=async ha=>{const kv=hQ;if(!ha['keys']['length'])return[...ha['inputs']];let hb=ha['inputs']['map'](hf=>({...hf})),hc=(ha[kv(0x29a)]??eW)['createTask'](kv(0x266)),hd=new ep(new er());await hd['prepare']();let he=new Map();for(let hf of hb){if(hf['type']!=='video'&&hf['type']!=='audio')continue;let hg=he['get'](hf['path']);if(hg){hf['path']=hg;continue;}let hh=hf['path'],hi=extname(hh),hk=hh['replace'](hi,'.dec'+hi);if(await hd['process']({'input':hh,'output':hk,'keys':ha['keys'],'type':hf['type'],'cleanup':!0x0}),!existsSync(hk))throw Error(kv(0x1d0)+hh+kv(0x278)+hk);he['set'](hh,hk),hf['path']=hk;}return hc['success']('Decrypted'),hb;},eZ=async ha=>{const kw=hQ;if(ha['skipMux'])return;let hb=(ha['reporter']??eW)['createTask']('Muxing'),hc=new eO(new eN());if(await hc['prepare'](),await hc['process']({'inputs':ha['inputs'],'output':ha['output'],'trimBegin':ha['trimBegin'],'trimEnd':ha['trimEnd'],'cleanup':!0x0}),existsSync(ha['output']))return hb['success']('Muxed'),q['debug']('Muxed:\x20'+ha['output']),ha['output'];hb['error']('Muxing\x20failed.\x20Output\x20file\x20not\x20found:\x20'+ha[kw(0x23d)]);},f0=async ha=>{let hb=await eY(ha);return{'outputPath':await eZ({...ha,'inputs':hb}),'artifacts':hb};};var f1=a5((ha,hb)=>{function hc(hd){var he=new hd(),hf=he;function hg(){var hi=he;return hi['next']?he=hi['next']:(he=new hd(),hf=he),hi['next']=null,hi;}function hh(hi){hf['next']=hi,hf=hi;}return{'get':hg,'release':hh};}hb['exports']=hc;}),f2=a5((ha,hb)=>{const kD=hQ;var hc=f1();function hd(hh,hi,hk){if(typeof hh=='function'&&(hk=hi,hi=hh,hh=null),!(hk>=0x1))throw Error('fastqueue\x20concurrency\x20must\x20be\x20equal\x20to\x20or\x20greater\x20than\x201');var hl=hc(hf),hm=null,hn=null,ho=0x0,hp=null,hq={'push':hx,'drain':he,'saturated':he,'pause':hs,'paused':!0x1,get 'concurrency'(){return hk;},set 'concurrency'(hE){const kx=b;if(!(hE>=0x1))throw Error(kx(0x2b9));if(hk=hE,!hq[kx(0x27d)]){for(;hm&&ho<hk;)ho++,hz();}},'running':hr,'resume':hv,'idle':hw,'length':ht,'getQueue':hu,'unshift':hy,'empty':he,'kill':hA,'killAndDrain':hB,'error':hD,'abort':hC};return hq;function hr(){return ho;}function hs(){hq['paused']=!0x0;}function ht(){for(var hE=hm,hF=0x0;hE;)hE=hE['next'],hF++;return hF;}function hu(){for(var hE=hm,hF=[];hE;)hF['push'](hE['value']),hE=hE['next'];return hF;}function hv(){if(hq['paused']){if(hq['paused']=!0x1,hm===null){ho++,hz();return;}for(;hm&&ho<hk;)ho++,hz();}}function hw(){return ho===0x0&&hq['length']()===0x0;}function hx(hE,hF){const kz=b;var hG=hl['get']();hG['context']=hh,hG['release']=hz,hG['value']=hE,hG['callback']=hF||he,hG['errorHandler']=hp,ho>=hk||hq[kz(0x27d)]?hn?(hn['next']=hG,hn=hG):(hm=hG,hn=hG,hq['saturated']()):(ho++,hi['call'](hh,hG['value'],hG['worked']));}function hy(hE,hF){const kA=b;var hG=hl['get']();hG['context']=hh,hG['release']=hz,hG[kA(0x311)]=hE,hG['callback']=hF||he,hG['errorHandler']=hp,ho>=hk||hq['paused']?hm?(hG['next']=hm,hm=hG):(hm=hG,hn=hG,hq['saturated']()):(ho++,hi['call'](hh,hG['value'],hG['worked']));}function hz(hE){hE&&hl['release'](hE);var hF=hm;hF&&ho<=hk?hq['paused']?ho--:(hn===hm&&(hn=null),hm=hF['next'],hF['next']=null,hi['call'](hh,hF['value'],hF['worked']),hn===null&&hq['empty']()):--ho===0x0&&hq['drain']();}function hA(){hm=null,hn=null,hq['drain']=he;}function hB(){hm=null,hn=null,hq['drain'](),hq['drain']=he;}function hC(){const kB=b;var hE=hm;for(hm=null,hn=null;hE;){var hF=hE['next'],hG=hE['callback'],hH=hE['errorHandler'],hI=hE['value'],hJ=hE['context'];hE[kB(0x311)]=null,hE['callback']=he,hE['errorHandler']=null,hH&&hH(Error('abort'),hI),hG['call'](hJ,Error('abort')),hE['release'](hE),hE=hF;}hq['drain']=he;}function hD(hE){hp=hE;}}function he(){}function hf(){this['value']=null,this['callback']=he,this['next']=null,this['release']=he,this['context']=null,this['errorHandler']=null;var hh=this;this['worked']=function(hi,hk){var hl=hh['callback'],hm=hh['errorHandler'],hn=hh['value'];hh['value']=null,hh['callback']=he,hh['errorHandler']&&hm(hi,hn),hl['call'](hh['context'],hi,hk),hh['release'](hh);};}function hg(hh,hi,hk){typeof hh=='function'&&(hk=hi,hi=hh,hh=null);function hl(hs,ht){const kC=b;hi['call'](this,hs)[kC(0x1f6)](function(hu){ht(null,hu);},ht);}var hm=hd(hh,hl,hk),hn=hm['push'],ho=hm['unshift'];return hm['push']=hp,hm['unshift']=hq,hm['drained']=hr,hm;function hp(hs){var ht=new Promise(function(hu,hv){hn(hs,function(hw,hx){if(hw){hv(hw);return;}hu(hx);});});return ht['catch'](he),ht;}function hq(hs){var ht=new Promise(function(hu,hv){ho(hs,function(hw,hx){if(hw){hv(hw);return;}hu(hx);});});return ht['catch'](he),ht;}function hr(){return new Promise(function(hs){process['nextTick'](function(){if(hm['idle']())hs();else{var ht=hm['drain'];hm['drain']=function(){typeof ht=='function'&&ht(),hs(),hm['drain']=ht;};}});});}}hb[kD(0x1ec)]=hd,hb['exports']['promise']=hg;}),f3=a7(f2(),0x1);const f4=T['default']??T,f5=0x493e0,f6=(ha={})=>{const kE=hQ;let hb=ha['maxRetries']??0x5,hc=!0x1,hd=!0x1,he=null,{proxy:hf}=ha,hg=hf?new ProxyAgent({'uri':hf,'allowH2':!0x0}):new Agent({'allowH2':!0x0}),hh=f4['create']({'fetch':ha['fetch'],'dispatcher':hg,'proxy':hf,'timeout':f5,'retry':{'limit':hb,'methods':['get','head'],'statusCodes':[0x198,0x19d,0x1ad,0x1f4,0x1f6,0x1f7,0x1f8],'backoffLimit':0x7530},'throwHttpErrors':!0x0,'redirect':kE(0x29e),'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'](hh,{'close':async()=>{if(he)return he;hc||hd||(hc=!0x0,he=hg['close'](),await he);},'destroy':async hi=>{if(he)return he;hc||hd||(hc=!0x0,hd=!0x0,he=hg['destroy'](hi??null),await he);}});},f7=ha=>new Promise(hb=>setTimeout(hb,ha)),f8=async(ha,hb)=>{let hc=await Q['stat'](hb)['catch'](()=>null);(!hc||!hc['isDirectory']())&&await Q['mkdir'](hb,{'recursive':!0x0});let hd=f9(ha,hb),he=await Q['stat'](hd)['catch'](()=>null);return(!he||!he['isDirectory']())&&await Q['mkdir'](hd,{'recursive':!0x0}),hd;},f9=(ha,hb)=>{const kF=hQ;let hc=M['resolve'](ha),hd=M['parse'](ha)['name'],he=createHash(kF(0x1bc))['update'](hc)['digest']('hex')['slice'](0x0,0xa);return M['join'](hb,hd+'-'+he);},fa=async ha=>{let hb=M['dirname'](ha),hc=M['resolve'](hb);M['parse'](hc)['root']!==hc&&(await Q['stat'](hb)['then'](()=>!0x0)['catch'](()=>!0x1)||await Q['mkdir'](hb,{'recursive':!0x0}));},fb=async(...ha)=>{const kG=hQ;let hb=[];for(let hc of ha)hc&&hb['push'](Q['rm'](hc,{'recursive':!0x0,'force':!0x0})[kG(0x273)](()=>void 0x0));await Promise['all'](hb);},fc=ha=>ha+'.part.json',fd=ha=>{if(ha['filePath'])return ha['filePath'];if(ha['output'])return fc(ha['output']);throw Error('Either\x20output\x20or\x20filePath\x20is\x20required\x20for\x20FileResumeStore');},fe=ha=>{const kH=hQ;if(!ha||typeof ha!='object')return!0x1;let hb='code'in ha?ha[kH(0x2ee)]:void 0x0;return hb==='EPERM'||hb==='EACCES'||hb===kH(0x296);},ff=async(ha,hb)=>{let hc=R['platform']==='win32'?[0x0,0x32,0x96,0x12c,0x1f4]:[0x0],hd;for(let he of hc){he>0x0&&await f7(he);try{await Q['rename'](ha,hb);return;}catch(hf){if(hd=hf,!fe(hf))break;await Q['rm'](hb,{'force':!0x0})['catch'](()=>void 0x0);try{await Q['rename'](ha,hb);return;}catch(hg){if(hd=hg,!fe(hg))break;}}}throw hd;};var fg=class{async['get'](ha){let hb=fd(ha);if(!await Q['stat'](hb)['then'](()=>!0x0)['catch'](()=>!0x1))return null;try{let hc=await Q['readFile'](hb,'utf8');return JSON['parse'](hc);}catch{return null;}}async['set'](ha,hb){let hc=fd(ha);await fa(hc);let hd=hc+'.'+R['pid']+'.'+Date['now']()['toString'](0x24)+'.tmp';await Q['writeFile'](hd,JSON['stringify'](hb));try{await ff(hd,hc);}finally{try{await Q['rm'](hd,{'force':!0x0});}catch{}}}async['delete'](ha){let hb=fd(ha);await Q['rm'](hb,{'force':!0x0})['catch'](()=>void 0x0);}};const fh=ha=>M['resolve'](ha),fi=ha=>createHash('sha1')['update'](fh(ha))['digest']('hex'),fj=ha=>ha['map']((hb,hc)=>({'index':hc,'start':hb['start'],'end':hb['end'],'output':hb['output'],'completed':!0x1,'bytesWritten':0x0})),fk=(ha,hb)=>ha['parts']['length']===hb['length']?ha['parts']['every']((hc,hd)=>{let he=hb[hd];return he?hc['start']===he['start']&&hc['end']===he['end']&&(hc['output']??null)===(he['output']??null):!0x1;}):!0x1,fl=(ha,hb)=>!hb||!ha['sourceSignature']?!0x0:ha['sourceSignature']===hb,fm=ha=>{const kI=hQ;let hb=ha['parts']['reduce']((hc,hd)=>hc+hd[kI(0x224)],0x0);return hb>0x0?hb:ha['bytesDownloaded'];},fn=ha=>{const kJ=hQ;if(!ha||typeof ha!='object')return!0x1;let hb=ha;return hb['version']===0x2&&typeof hb['key']=='string'&&Array['isArray'](hb['parts'])&&typeof hb[kJ(0x302)]=='number';};var fo=class{['key'];['output'];['filePath'];[hQ(0x2d5)];['store'];[hQ(0x20e)];['trustExplicitKey'];constructor(ha={}){const kK=hQ;if(this['output']=ha['output'],this['filePath']=ha['filePath'],this['key']=ha[kK(0x317)]??(this['output']?fi(this['output']):''),!this['key'])throw Error('Resume\x20key\x20is\x20required\x20when\x20output\x20is\x20not\x20provided');this[kK(0x1d3)]=ha['store']??new fg(),this['cleanupOnSuccess']=ha['cleanupOnSuccess']??!0x0,this['target']={'key':this['key'],'output':this['output'],'filePath':this['filePath']},this['trustExplicitKey']=typeof ha[kK(0x317)]=='string'&&ha['key'][kK(0x264)]>0x0;}async['read'](){let ha=await this['store']['get'](this['target']);return fn(ha)?ha:null;}async['write'](ha){const kL=hQ;let hb=new Date()['toISOString'](),hc={...ha,'version':0x2,'key':this[kL(0x317)],'output':ha['output']??this['output'],'bytesDownloaded':fm(ha),'createdAt':ha['createdAt']||hb,'updatedAt':hb};await this['store']['set'](this['target'],hc);}async['delete'](){await this['store']['delete'](this['target']);}['createState'](ha){const kM=hQ;let hb=new Date()['toISOString']();return{'version':0x2,'key':this[kM(0x317)],'output':this[kM(0x23d)],'input':ha['input'],'bytesTotal':ha['bytesTotal'],'bytesDownloaded':0x0,'parts':fj(ha['parts']),'sourceSignature':ha[kM(0x1ce)],'planner':ha['planner'],'createdAt':hb,'updatedAt':hb};}['reconcileState'](ha,hb){const kN=hQ;let hc=ha['version']!==0x2,hd=ha['key']!==this['key'],he=!this['trustExplicitKey']&&!fl(ha,hb['sourceSignature']),hf=!fk(ha,hb['parts']);if(hc||hd||he||hf)return{'state':this[kN(0x20f)](hb),'reset':!0x0};let hg={...ha,'key':this['key'],'output':this['output'],'input':hb['input'],'bytesTotal':hb['bytesTotal'],'sourceSignature':hb['sourceSignature'],'planner':hb['planner'],'parts':hb['parts']['map']((hh,hi)=>{let hk=ha['parts'][hi];return{'index':hi,'start':hh['start'],'end':hh['end'],'output':hh['output'],'completed':hk?.['completed']??!0x1,'bytesWritten':hk?.['bytesWritten']??0x0};}),'createdAt':ha['createdAt'],'updatedAt':ha['updatedAt']};return hg['bytesDownloaded']=fm(hg),{'state':hg,'reset':!0x1};}['markPartCompleted'](ha,hb,hc){const kO=hQ;let hd=ha['parts'][hb];if(!hd)return ha;let he=hd['bytesWritten'];return hd['completed']=!0x0,hd['bytesWritten']=hc,ha['bytesDownloaded']=Math['max'](0x0,ha['bytesDownloaded']-he+hc),ha['updatedAt']=new Date()[kO(0x283)](),ha;}async['getProgress'](){const kP=hQ;let ha=await this['read']();if(!ha)return null;let hb=ha['bytesDownloaded'];if(ha[kP(0x292)]){let he=ha['bytesTotal'];return{'bytesDownloaded':hb,'totalBytes':he,'percentComplete':he>0x0?Math['round'](hb/he*0x64):0x0};}let hc=ha['parts']['length'],hd=ha['parts']['filter'](hf=>hf[kP(0x1e6)])[kP(0x264)];return{'bytesDownloaded':hb,'totalBytes':null,'percentComplete':hc>0x0?Math[kP(0x2f9)](hd/hc*0x64):0x0,'segmentsCompleted':hd,'segmentsTotal':hc};}};const fp=0x8*0x2**0x14,fq=(ha,hb,hc)=>{let hd='part_'+hc+'.part';return M['join'](hb,hd);},fr=(ha,hb,hc)=>{let hd=Math['ceil'](ha/Math['max'](0x1,hb));return Math['max'](0x1,Math['min'](hd,Math['max'](0x1,hc)));},ft=(ha,hb,hc)=>{let hd=fr(ha,hb,hc),he=[],hf=0x0;for(;hf<ha;){let hg=Math['min'](ha-0x1,hf+hd-0x1);he['push']([hf,hg]),hf=hg+0x1;}return he;},fu=ha=>{const kQ=hQ;let [hb,hc]=ha;return kQ(0x2d4)+hb+'-'+(hc||'');},fv=ha=>ft(ha['contentLength'],ha['maxWorkerCount'],ha['maxChunkSize']??fp)['map'](hb=>{const kR=hQ;let [hc,hd]=hb,he=new Headers(ha['requestInit']?.['headers']);return he[kR(0x255)]('Range',fu([hc,hd])),{'url':ha['url'],'headers':he,'start':hc,'end':hd};}),fw=new WeakMap(),fx=ha=>{let hb=ha?Error('The\x20operation\x20was\x20aborted',{'cause':ha}):Error('The\x20operation\x20was\x20aborted');return hb['name']='AbortError',hb;},fy=ha=>{const kS=hQ;if(!(ha instanceof Error))return!0x1;if(ha['name']===kS(0x1d5)||ha[kS(0x2ee)]==='ABORT_ERR')return!0x0;let hb=ha['cause'];return hb instanceof Error&&hb['name']==='AbortError';},fz=async ha=>await ha['client']['get'](ha['url'],{'redirect':'follow',...ha['requestInit']}),fA=(ha,hb,hc)=>async hd=>{const kT=hQ;if(hc?.['aborted'])throw fx();let he=typeof hb=='number'?{'flags':'r+','start':hb}:{'flags':'w'},hf=K['createWriteStream'](ha,he),hg=Readable[kT(0x2fa)](hd['body']),hh=0x0,hi=new Transform({'transform'(hk,hl,hm){hh+=hk['byteLength'],hm(null,hk);}});try{await pipeline(hg,hi,hf,{'signal':hc});}catch(hk){throw fy(hk)?fx(hk):hk;}if(hc?.['aborted'])throw fx();return fw['set'](hd,hh),hd;},fB=(ha,hb,hc)=>hd=>{const kU=hQ;if(hc?.['aborted'])throw fx();let he=parseInt(hd['headers'][kU(0x236)](kU(0x218))||'0',0xa),hf=Number[kU(0x2c5)](he)&&he>0x0?he:fw['get'](hd)??0x0;if(ha['increase'](hf),hc?.['aborted'])throw fx();return hb&&!hc?.['aborted']?hb(ha['toProgressInfo']()):ha['log'](),hd;},fC=ha=>typeof ha=='boolean'?{'enabled':ha,'cleanupOnSuccess':!0x0}:ha?{'enabled':ha['enabled']??!0x0,'key':ha['key'],'store':ha['store'],'filePath':ha['filePath'],'cleanupOnSuccess':ha['cleanupOnSuccess']??!0x0}:{'enabled':!0x1,'cleanupOnSuccess':!0x0},fD=ha=>({'tempDir':ha['tempDir']??process['cwd'](),'maxRetries':ha['maxRetries']??0x5,'maxChunkSize':ha['maxChunkSize']??fp,'maxWorkerCount':ha['maxWorkerCount']??0x4,'resume':fC(ha['resume']),'proxy':ha['proxy'],'requestInit':ha['requestInit'],'fetchFn':ha['fetchFn']}),fE={'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},'completedParts':0x0},fF=ha=>{let hb=Math['floor'](ha/0xe10),hc=Math['floor'](ha%0xe10/0x3c),hd=ha%0x3c,he=hb>0x0?hb+'h':'',hf=hc>0x0?hc+'m':'',hg=hd>0x0?hd+'s':'';return hb>0x0?he+'\x20'+(hf||'0m')+'\x20'+(hg&&''+hg):!hb&&hc>0x0?hf+'\x20'+(hg&&''+hg):hg;},fG=(ha=0x0)=>{let hb=structuredClone(fE),hc=0x0,hd=setInterval(()=>{hc>0x1&&(hb['speed']['bps']=hb['current']['b']/hc),hc+=0.5;},0x1f4);return{'state':hb,'setTotal':he=>{hb['total']['b']=he,hb['total']['mb']=he/0x400/0x400;},'setCurrent'(he,hf=0x0){const kV=b;hb['current']['b']=he,hb['current']['mb']=he/0x400/0x400,hb['completedParts']=hf,hf>0x0&&(hb['averageSize']['b']=he/hf,hb['averageSize']['mb']=hb['averageSize']['b']/0x400/0x400,hb['averageTotal']['b']=ha*hb['averageSize']['b'],hb['averageTotal']['mb']=hb[kV(0x1e2)]['b']/0x400/0x400);},'increase'(he){const kW=b;hb[kW(0x200)]['b']+=he,hb['current']['mb']=hb['current']['b']/0x400/0x400,hb['speed']['mbps']=hb['speed']['bps']/0x400/0x400,hb['chunkSize']=he,hb['chunkSizes']['push'](he),hb['completedParts']+=0x1,hb['averageSize']['b']=hb['current']['b']/hb['completedParts'],hb['averageSize']['mb']=hb['averageSize']['b']/0x400/0x400,hb['averageTotal']['b']=ha*hb['averageSize']['b'],hb['averageTotal']['mb']=hb['averageTotal']['b']/0x400/0x400;},'stop'(){clearInterval(hd),Object['assign'](hb,fE);},'log'(){let he=hb['current']['b'],hf=hb['total']['b'],hg=he+(hf?'/'+hf:'');stdout['write']('\x0dDownloading\x20['+hg+']');},'stopLog'(){stdout['write']('\x0a');},'toString'(){let he='';hb['speed']['bps']&&(he+=hb['speed']['mbps']['toFixed'](0x1)+'\x20MB/s\x20–\x20'),he+=''+hb['current']['mb']['toFixed'](0x1),hb['total']['b']?he+='\x20of\x20'+hb['total']['mb']['toFixed'](0x1)+'\x20MB':he+='\x20MB';let hf=hb['total']['b']||hb['averageTotal']['b'];if(hf){let hg=hf-hb['speed']['bps']*hc,hh=Math['round'](hg/hb['speed']['bps']),hi=fF(hh);hh&&isFinite(hh)&&hi&&(he+=',\x20'+hi+'\x20left');}return he;},'toProgressInfo'(){let he=hb['total']['b']||null,hf=he?null:hb['averageTotal']['b']||null,hg=he??hf,hh=hg?Math['max'](hg-hb['current']['b'],0x0):null,hi=hg?Math['min'](Math['max'](hb['current']['b']/hg*0x64,0x0),0x64):null;return{'bytesDownloaded':hb['current']['b'],'totalBytes':he,'estimatedTotalBytes':hf,'percentComplete':hi,'bytesPerSecond':hb['speed']['bps'],'estimatedSecondsRemaining':hb['speed']['bps']>0x0&&hh!==null?hh/hb['speed']['bps']:null};}};},fH=new Set(['authorization','cookie','set-cookie','x-amz-date','x-amz-security-token','x-amz-content-sha256','x-goog-date','x-goog-security-token']),fI=(ha,hb={})=>{if(!ha)return[];let hc=hb['includeVolatile']??!0x1,hd=[];return new Headers(ha)['forEach']((he,hf)=>{const kX=b;!hc&&fH['has'](hf[kX(0x26a)]())||hd['push']([hf,he]);}),hd['sort'](([he],[hf])=>he['localeCompare'](hf)),hd;},fJ=ha=>{const kY=hQ;try{let hb=new URL(ha),hc=hb['pathname']['split']('/')['map'](hd=>hd&&(hd['includes']('=')||hd[kY(0x27a)](',')?':volatile':hd))['join']('/');return''+hb['origin']+hc;}catch{let hd=String(ha);return(hd['split']('#')[0x0]??hd)[kY(0x320)]('?')[0x0]||hd;}},fK=ha=>({'url':fJ(ha['url']),'start':ha[hQ(0x2de)],'end':ha['end'],'output':ha['output'],'headers':fI(ha['headers'])}),fL=ha=>{const kZ=hQ;let hb={'input':Array['isArray'](ha['input'])?ha['input']['map'](hc=>fK(hc)):fJ(String(ha['resolvedUrl'])),'requestHeaders':fI(ha['requestHeaders']),'parts':ha['parts']['map'](hc=>fK(hc)),'maxWorkerCount':ha['maxWorkerCount'],'maxChunkSize':ha['maxChunkSize']};return createHash(kZ(0x1bc))['update'](JSON['stringify'](hb))['digest']('hex');},fM=async ha=>{if(!ha['manager'])return null;let hb={'input':Array['isArray'](ha['input'])?ha['input']:ha['resolvedUrl'],'parts':ha['parts'],'bytesTotal':ha['bytesTotal'],'sourceSignature':ha['sourceSignature'],'planner':{'maxWorkerCount':ha['maxWorkerCount'],'maxChunkSize':ha['maxChunkSize']}},hc=await ha['manager']['read'](),hd=(hc?ha['manager']['reconcileState'](hc,hb):null)?.['state']??ha['manager']['createState'](hb);return await ha['manager']['write'](hd),hd;},fN=ha=>{if(ha&&!ha['parts']['every'](hb=>hb['completed']))throw Error('Not\x20all\x20segments\x20were\x20downloaded\x20successfully.\x20Try\x20resuming\x20later.');},fO=ha=>{const l0=hQ;if(Array['isArray'](ha['input']))return ha['input'][l0(0x2d7)]((hb,hc)=>({...hb,'output':fq(ha['url'],ha['tempFileDir'],hc)}));if(!ha['acceptsRanges'])throw Error('Unable\x20to\x20get\x20parts');if(!ha[l0(0x315)])throw Error('Size\x20is\x20not\x20known');return fv({'url':ha['url'],'requestInit':ha['requestInit'],'contentLength':ha['size'],'maxWorkerCount':ha['maxWorkerCount'],'maxChunkSize':ha['maxChunkSize']});},fP=async ha=>{const l1=hQ;if(!ha['parts']['some'](hc=>typeof hc['start']=='number'&&(hc['output']??ha[l1(0x23d)])===ha['output'])||await Q['stat'](ha[l1(0x23d)])['then'](()=>!0x0)['catch'](()=>!0x1))return;let hb=await Q['open'](ha['output'],'w');ha['size']&&ha['size']>0x0&&await hb['truncate'](ha['size']),await hb[l1(0x294)]();},fQ=()=>{let ha=Error('The\x20operation\x20was\x20aborted');return ha['name']='AbortError',ha;},fR=ha=>{let hb=ha['match'](/bytes\s+(\d+)-(\d+)\/(\d+|\*)/i);if(!hb||!hb[0x1]||!hb[0x2]||!hb[0x3])return null;let hc=parseInt(hb[0x1],0xa),hd=parseInt(hb[0x2],0xa),he=hb[0x3];if(!Number['isFinite'](hc)||!Number['isFinite'](hd)||hd<hc)return null;if(he==='*')return{'start':hc,'end':hd,'total':null};let hf=parseInt(he,0xa);return!Number['isFinite'](hf)||hf<=0x0?null:{'start':hc,'end':hd,'total':hf};},fS=(ha,hb)=>{const l2=hQ;if(typeof hb['start']!='number'||typeof hb['end']!='number')return;if(ha['status']!==0xce)throw Error('Range\x20request\x20failed\x20for\x20bytes='+hb['start']+'-'+hb['end']+':\x20expected\x20206,\x20got\x20'+ha['status']);let hc=ha['headers']['get']('content-range');if(!hc)throw Error('Range\x20request\x20failed\x20for\x20bytes='+hb['start']+'-'+hb['end']+':\x20missing\x20Content-Range\x20header');let hd=fR(hc);if(!hd)throw Error('Range\x20request\x20failed\x20for\x20bytes='+hb[l2(0x2de)]+'-'+hb['end']+':\x20invalid\x20Content-Range\x20\x22'+hc+'\x22');if(hd['start']!==hb['start']||hd['end']!==hb['end'])throw Error('Range\x20request\x20failed\x20for\x20bytes='+hb[l2(0x2de)]+'-'+hb['end']+':\x20got\x20bytes='+hd['start']+'-'+hd[l2(0x262)]);},fT=async(ha,hb,hc)=>{const l3=hQ;let hd=ha[l3(0x31b)]['get']('content-length');if(hd){let hf=parseInt(hd,0xa);if(Number['isFinite'](hf)&&hf>0x0)return hf;}let he=ha['headers']['get'](l3(0x2f0));if(he){let hg=he[l3(0x297)](/bytes\s+(\d+)-(\d+)\//i);if(hg&&hg[0x1]&&hg[0x2]){let hh=parseInt(hg[0x1],0xa),hi=parseInt(hg[0x2],0xa);if(Number['isFinite'](hh)&&Number['isFinite'](hi)&&hi>=hh)return hi-hh+0x1;}}return typeof hb['start']=='number'&&typeof hb['end']=='number'?Math['max'](0x0,hb['end']-hb['start']+0x1):hb['output']&&hb['output']!==hc?Q['stat'](hb['output'])['then'](hk=>hk['size'])['catch'](()=>0x0):0x0;},fU=(ha,hb)=>ha['map']((hc,hd)=>hd)['filter'](hc=>!(hb?.['parts'][hc]?.[hQ(0x1e6)]??!0x1)),fV=ha=>{let hb=Promise['resolve']();return{'enqueue':()=>(hb=hb['then'](ha),hb),'onIdle':()=>hb};},fW=async ha=>{const l4=hQ;let hb=ha['signal']??ha['requestInit']?.[l4(0x1ba)]??void 0x0,hc=()=>{if(hb?.['aborted'])throw fQ();};hc();let hd=fU(ha['parts'],ha['resumeState']),he=f3[l4(0x1eb)](async hn=>{const l5=l4;let {index:ho,part:hp}=hn;hc();let hq=await fz({'index':ho,'client':ha['client'],'url':hp['url'],'requestInit':{...ha['requestInit'],'signal':hb,'headers':hp['headers']??ha[l5(0x290)]?.[l5(0x31b)]}});if(hc(),fS(hq,hp),await fA(hp['output']??ha['output'],hp['start'],hb)(hq),fB(ha['progress'],ha['onProgress'],hb)(hq),hc(),ha['resumeState']&&ha['resumeManager']){let hr=await fT(hq,hp,ha['output']);ha['resumeManager']['markPartCompleted'](ha['resumeState'],ho,hr),await hi['enqueue']();}},ha['maxWorkerCount']),hf=()=>{he['pause'](),he['killAndDrain'](),he['kill']();};if(hb?.['aborted'])throw hf(),fQ();let hg=()=>{},hh=hb?new Promise((hn,ho)=>{const l6=l4;let hp=()=>{hf(),ho(fQ());};hb['addEventListener']('abort',hp,{'once':!0x0}),hg=()=>hb[l6(0x1b8)]('abort',hp);}):null,hi=fV(async()=>{!ha['resumeState']||!ha['resumeManager']||await ha['resumeManager']['write'](ha['resumeState']);}),hk=hd['map'](hn=>{let ho=ha['parts'][hn];return ho?(hc(),he['push']({'index':hn,'part':ho})):Promise['resolve']();}),hl=[];try{let hn=Promise[l4(0x281)](hk);hh&&(await Promise['race']([hn,hh]),hc()),hl=await hn;}finally{hg(),await hi['onIdle']();}let hm=hl['find'](ho=>ho['status']==='rejected');if(hm?.['status']==='rejected')throw hm['reason'];},fX=async(ha,hb)=>{await new Promise((hc,hd)=>{let he=K['createReadStream'](ha),hf=()=>{const l7=b;hb['off']('error',hg),he['off']('error',hh),he[l7(0x25a)]('end',hi);},hg=hk=>{const l8=b;hf(),hd(Error(l8(0x28b),{'cause':hk}));},hh=hk=>{hf(),hd(Error('Segment\x20read\x20stream\x20error',{'cause':hk}));},hi=()=>{hf(),hc();};hb['on']('error',hg),he['on']('error',hh),he['on']('end',hi),he['pipe'](hb,{'end':!0x1});});},fY=async ha=>{let hb=ha['parts']['map'](hd=>hd['output'])['filter'](hd=>!!hd&&hd!==ha['output']);if(!hb['length'])return;let hc=K['createWriteStream'](ha['output']);for(let hd of hb)await fX(hd,hc);hc['end'](),await finished(hc);},fZ=async ha=>{const l9=hQ;if(!ha[l9(0x32e)])return;let hb=await Q['stat'](ha['output'])['then'](hc=>hc['size'])['catch'](()=>null);if(hb&&hb!==ha['expectedSize'])throw Error('Actual\x20size\x20'+hb+'\x20doesn\x27t\x20match\x20expected\x20size\x20'+ha['expectedSize']);},g0=async ha=>{const la=hQ;ha['resumeManager']&&ha['resumeManager']['cleanupOnSuccess']&&await ha['resumeManager']['delete'](),await fb(ha[la(0x269)]);},g1=async ha=>{const lb=hQ;let hb=fL({'input':ha['input'],'resolvedUrl':ha['url'],'parts':ha['parts'],'requestHeaders':ha['requestInit']?.['headers'],'maxWorkerCount':ha['maxWorkerCount'],'maxChunkSize':ha['maxChunkSize']}),hc=await fM({'manager':ha['resumeManager'],'input':ha['input'],'resolvedUrl':ha['url'],'parts':ha['parts'],'bytesTotal':ha['size']??void 0x0,'sourceSignature':hb,'maxWorkerCount':ha['maxWorkerCount'],'maxChunkSize':ha['maxChunkSize']}),hd=fG(ha['parts']['length']);if(ha['size']&&hd['setTotal'](ha['size']),hc?.['bytesDownloaded']){let he=hc['parts']['filter'](hf=>hf['completed'])['length'];hd['setCurrent'](hc['bytesDownloaded'],he);}await fP({'output':ha['output'],'size':ha['size'],'parts':ha['parts']});try{await fW({'parts':ha['parts'],'output':ha['output'],'maxWorkerCount':ha['maxWorkerCount'],'client':ha['client'],'requestInit':ha['requestInit'],'progress':hd,'onProgress':ha['onProgress'],'resumeState':hc,'resumeManager':ha['resumeManager'],'signal':ha['signal']});}finally{hd[lb(0x2d8)](),ha['onProgress']||hd['stopLog']();}fN(hc),await fY({'output':ha['output'],'parts':ha['parts']}),await fZ({'output':ha['output'],'expectedSize':Array['isArray'](ha['input'])?null:ha[lb(0x315)]}),await g0({'tempFileDir':ha['tempFileDir'],'resumeManager':ha['resumeManager']});},g2=async ha=>{const lc=hQ;let hb=new Headers(ha['requestInit']?.['headers']);hb['set']('Range','bytes=0-0');let hc=Array['isArray'](ha['input'])?ha['input'][0x0]?.['url']:ha['input'];if(!hc)throw Error('Input\x20is\x20empty');let hd=await ha['client']['head'](hc,{...ha['requestInit'],'headers':hb}),he=hd['headers']['get']('content-type'),hf=hd['headers']['get']('content-length'),hg=hd[lc(0x31b)]['get']('content-range'),hh=hg?.['split']('/')?.[0x1]||hf,hi=hh&&!Array[lc(0x1db)](ha['input'])?parseInt(hh,0xa):null,hk=hd['headers']['get']('accept-ranges')==='bytes'||!!hg?.['includes']('bytes')||!!he?.['includes']('video')||!!he?.['includes']('audio')||!!he?.['includes']('octet-stream');return{'url':hd['url'],'size':hi,'acceptsRanges':hk};};var g3=class hO{['input'];['output'];['resume'];['onProgress'];['config'];['client'];['resumeManager'];['executed']=!0x1;['probe'];['tempFileDir'];constructor(ha){const ld=hQ;this['input']=ha['input'],this['output']=ha['output'],this['resume']=ha['resume'],this['onProgress']=ha['onProgress'],this['config']=fD(ha),this[ld(0x310)]=f6({'maxRetries':this['config']['maxRetries'],'proxy':this['config']['proxy'],'fetch':this['config']['fetchFn']}),this['config']['resume']['enabled']&&(this['resumeManager']=new fo({'output':this['output'],'key':this['config']['resume']['key'],'filePath':this['config']['resume']['filePath'],'store':this[ld(0x249)]['resume']['store'],'cleanupOnSuccess':this['config']['resume']['cleanupOnSuccess']}));}static async['init'](ha){let hb=new hO(ha);return await hb['_init'](),hb;}async['_init'](){const le=hQ;this['probe']=await g2({'client':this['client'],'input':this['input'],'requestInit':this['config']['requestInit']}),await fa(this['output']),this['tempFileDir']=await f8(this['output'],this['config']['tempDir']),this['config']['resume']['enabled']||(await fb(this['output'],fc(this['output']),this['tempFileDir']),this[le(0x269)]=await f8(this['output'],this['config']['tempDir']));}async['execute'](){const lf=hQ;if(!this['probe']||!this['tempFileDir'])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 ha=fO({'input':this['input'],'url':this['probe'][lf(0x230)],'size':this['probe']['size'],'acceptsRanges':this['probe']['acceptsRanges'],'requestInit':this['config']['requestInit'],'tempFileDir':this['tempFileDir'],'maxWorkerCount':this['config']['maxWorkerCount'],'maxChunkSize':this['config']['maxChunkSize']});await g1({'input':this['input'],'output':this['output'],'url':this['probe']['url'],'size':this['probe']['size'],'requestInit':this['config']['requestInit'],'maxWorkerCount':this['config']['maxWorkerCount'],'maxChunkSize':this[lf(0x249)]['maxChunkSize'],'onProgress':this['onProgress'],'client':this['client'],'parts':ha,'tempFileDir':this['tempFileDir'],'resumeManager':this['resumeManager'],'signal':this['config']['requestInit']?.['signal']??void 0x0});}finally{try{await this['close']();}catch{}}}async['getSize'](){const lg=hQ;if(this['probe']||=await g2({'client':this['client'],'input':this['input'],'requestInit':this['config']['requestInit']}),!this[lg(0x256)]['size'])throw Error('Size\x20is\x20not\x20known');return this['probe'][lg(0x315)];}async['close'](){await this['client']['close']();}};const g4=async({attempts:ha,fn:hb,shouldRetry:hc,onRetry:hd})=>{let he=Math['max'](0x1,Math['trunc'](ha)),hf;for(let hg=0x1;hg<=he;hg+=0x1)try{return await hb(hg);}catch(hh){if(hf=hh,hg>=he||!hc?.(hh,hg))throw hh;await hd?.(hh,hg);}throw hf instanceof Error?hf:Error(String(hf));},g5=0x10,g6=ha=>{let hb=Math['max'](0x1,Math['trunc'](ha)),hc=Math['min'](g5,hb);return{'normalizedRequestedConnections':hb,'maxWorkerCount':hc,'wasClamped':hb!==hc};},g7=ha=>Math['max'](0x1,Math['trunc'](ha)+0x1),g8=({title:ha,progress:hb,filepath:hc,target:hd,quality:he,codec:hf,expectedTotalBytes:hg})=>{const lh=hQ;let hh=hb['totalBytes']??void 0x0,hi=hb['estimatedTotalBytes']??void 0x0,hk=hg??hh??hi,hl=hb['bytesPerSecond']??void 0x0,hm=hg===void 0x0?hb['bytesDownloaded']:Math['min'](hb['bytesDownloaded'],hg),hn={'b':hk,'mb':hk===void 0x0?void 0x0:hk/0x400/0x400,'estimated':hg===void 0x0&&hh===void 0x0&&hi!==void 0x0},ho={'b':hm,'mb':hm/0x400/0x400},hp=hk?Math['min'](0x64,Math['round'](hm/hk*0x64)):void 0x0;return{'title':ha,'total':hn,'current':ho,'percentage':hp,'speed':{'bps':hl,'mbps':hl===void 0x0?void 0x0:hl/0x400/0x400},'trackName':basename(hc),'trackPath':hc,'finalName':hd[lh(0x30f)],'finalPath':hd['finalPath'],'state':hp===0x64?'downloaded':'downloading','quality':he,'codec':hf};},g9=ha=>{let hb=(ha['bytesDownloaded']/0x400/0x400)['toFixed'](0x2)+'\x20MB',hc=ha['totalBytes']??ha['estimatedTotalBytes'],hd=ha['totalBytes']?'':'~';return'Downloading\x20∙\x20'+hb+(hc?'\x20of\x20'+hd+(hc/0x400/0x400)['toFixed'](0x2)+'\x20MB':'');},ga=async({input:ha,resume:hb,filepath:hc,description:hd,target:he,resource:hf,options:hg,settings:hh,abortSignal:hi,title:hk,quality:hl,codec:hm,expectedTotalBytes:hn,emitProgress:ho,reporter:hp=eW})=>{const li=hQ;q['info'](hd),q['debug']('Path:\x20'+hc);let hq=dH(hf['input']),hr=hg[li(0x304)]??hh['get']('connections')??0x1,{maxWorkerCount:hs,wasClamped:ht}=g6(hr);ht&&q['warn']('Connections\x20value\x20'+hr+'\x20was\x20clamped\x20to\x20'+hs+'\x20for\x20stability'),q['debug'](li(0x20c)+hs);let hu=hp['createTask']('Downloading',{'color':'yellow'}),hv='',hw=g7(hg['retry']??hh[li(0x236)](li(0x241))??0x1);try{await g4({'attempts':hw,'fn':async()=>{const lj=li;let hx=await g3['init']({'input':ha,'output':hc,'tempDir':r,'requestInit':{'headers':hq[lj(0x31b)],'signal':hi},'proxy':hg['proxyMedia']||hg['proxy']||void 0x0,'resume':hb,'maxRetries':hg['retry'],'maxWorkerCount':hs,'onProgress':hy=>{const lk=lj;let hz=g8({'title':hk,'progress':hy,'filepath':hc,'target':he,'quality':hl,'codec':hm,'expectedTotalBytes':hn});ho(hz),hp[lk(0x265)](hz),hv=g9(hy),hu['update'](hv);}});if(hi?.['aborted']){q['debug']('Track\x20download\x20skipped,\x20already\x20aborted:\x20'+hc);let hy=Error('The\x20operation\x20was\x20aborted');throw hy['name']='AbortError',hy;}await hx['execute']();},'shouldRetry':hx=>!(hx instanceof Error&&hx['name']==='AbortError'),'onRetry':async(hx,hy)=>{let hz=hx instanceof Error?hx['message']:String(hx);q['warn']('Track\x20download\x20retry\x20'+hy+'/'+(hw-0x1)+'\x20scheduled\x20for\x20'+hc+':\x20'+hz);}}),hu['success'](hv);}catch(hx){if(hu['error'](hd),hx instanceof Error&&hx['name']==='AbortError')throw hx;let hy=hx instanceof Error?hx['message']:String(hx);throw q['error']('Download\x20track\x20failed:\x20'+hy),hx instanceof Error&&hx['stack']?q['debug'](hx['stack']):q['debug'](hy),hx instanceof Error?hx:Error(hy);}},gb=async(ha,hb)=>{const ll=hQ;let hc=hb+'\x20∙\x20';if(ha['type']==='subtitle'?hc+='SUBTITLES':hc+=ha['type']['toUpperCase'](),ha['isVideoTrack']()){let [hd,he,hf]=await Promise['all']([ha['getDisplayWidth'](),ha['getDisplayHeight'](),ha['getBitrate']()]);hd&&(hc+='\x20∙\x20'+hd+'x'+he),hf&&(hc+='\x20∙\x20'+Math['round'](hf/0x3e8)+ll(0x1ee));}if(ha['isAudioTrack']()){let [hg,hh,hi,hk]=await Promise['all']([ha['getLanguageCode'](),ha['getName'](),ha['getSampleRate'](),ha['getBitrate']()]);hg&&(hc+='\x20∙\x20'+hg['toUpperCase']()),hh&&(hc+='\x20('+hh+')'),hi&&(hc+='\x20∙\x20'+hi+ll(0x21a)),hk&&(hc+='\x20∙\x20'+Math['round'](hk/0x3e8)+'\x20KiB/s');}if(ha['type']==='subtitle'){let [hl,hm,hn]=await Promise['all']([ha['getLanguageCode'](),ha['getName'](),ha['getDisposition']()]);hl&&(hc+=ll(0x244)+hl['toUpperCase']()),hm&&(hc+='\x20('+hm+')'),hn[ll(0x32f)]&&(hc+='\x20FORCED');}return hc;},gc=ha=>{const lm=hQ;if(!(!ha||typeof ha!='object'||!('drm'in ha)))return ha['drm']?.[lm(0x1ea)]?.['pssh'];},gd=(ha,hb)=>{const ln=hQ;if(hb)return{'Range':ln(0x2d4)+ha+'-'+(ha+hb-0x1)};},ge=ha=>{const lo=hQ;let hb=[],hc=ha[0x0];hc?.['initSegment']&&hb['push']({'url':hc['initSegment']['location']['path'],'headers':gd(hc['initSegment']['location']['offset'],hc['initSegment']['location']['length'])});for(let hd of ha)hb[lo(0x277)]({'url':hd['location']['path'],'headers':gd(hd['location']['offset'],hd[lo(0x26e)]['length'])});return hb['length']===0x1&&!hb[0x0]?.['headers']?hb[0x0]['url']:hb;},gf=ha=>{let hb=0x0,hc=ha[0x0],hd=hc?.['initSegment']?.['location']['length'];if(hc?.['initSegment']){if(hd==null)return;hb+=hd;}for(let he of ha){let hf=he['location']['length'];if(hf==null)return;hb+=hf;}return hb;},gg=async ha=>{let hb=ha['getSegmentedInput']?.();return hb?.['segments']['length']?hb['segments']:await ha['getSegments']();},gh=ha=>{let hb=ha[0x0];return hb?.['location']['path']??hb?.['initSegment']?.['location']['path'];},gi=async(ha,hb)=>{if(hb)return gh(hb);let hc;try{hc=await ha['getSegments']();}catch(hd){if(hd instanceof Error&&hd['message']['toLowerCase']()['includes']('no\x20segments')){q['debug']('Track\x20segments\x20unavailable\x20for\x20URL\x20logging:\x20'+hd['message']);return;}throw hd;}return gh(hc);},gj=({outputDirectory:ha,baseName:hb,track:hc})=>join(ha,hb+'.'+createHash('sha256')['update'](dl(hc))['digest']('hex')['slice'](0x0,0x6)+'.'+(hc['type']==='subtitle'?'vtt':hc['type']==='audio'?'m4a':'mp4')),gk=(ha,hb)=>({'enabled':!0x0,'key':createHash(hQ(0x1bc))['update'](ha+':'+dl(hb))['digest']('hex')}),gl=ha=>{let hb=[];for(let hc of ha){let hd=hc[0x0],he=gc(hd?.['initSegment']?.['encryption'])??gc(hd?.['encryption']);he&&hb['push'](he);}return hb['map'](hf=>{let hg=hf;return typeof hg=='string'?hg:hg instanceof Uint8Array||hg instanceof ArrayBuffer?Buffer['from'](hg)['toString']('base64'):ArrayBuffer['isView'](hg)?Buffer['from'](hg['buffer'])['toString']('base64'):String(hg);});},gm=async(ha,hb)=>{const lp=hQ;let [hc,hd,he]=await Promise['all']([ha[lp(0x2f4)]()['catch'](()=>void 0x0),ha['getName']()['catch'](()=>void 0x0),ha['getDisposition']()['catch'](()=>void 0x0)]);return{'path':hb,'type':ha['type'],'language':hc,'label':hd??void 0x0,'forced':ha['type']==='subtitle'?he?.['forced']:void 0x0};},gn=async(ha,hb)=>{const lq=hQ;if(!ha['isVideoTrack']())return{'quality':void 0x0,'codec':void 0x0};let [hc,hd,he]=await Promise['all']([ha[lq(0x1b6)](),hb?ha['getDisplayWidth']():ha['getCodedWidth'](),hb?ha['getDisplayHeight']():ha['getCodedHeight']()]);return{'quality':hd?hd+'x'+he:void 0x0,'codec':hc??void 0x0};},go=async({plan:ha,track:hb,input:hc,resume:hd,isSegmented:he,segments:hf})=>{const lr=hQ;let hg=gj({'outputDirectory':ha['output']['outputDirectory'],'baseName':ha['output']['baseName'],'track':hb}),[hh,hi,hk,hl]=await Promise['all']([gb(hb,ha[lr(0x23d)]['baseName']),gn(hb,he),gm(hb,hg),hb['type']==='subtitle'?gi(hb,hf):Promise['resolve'](void 0x0)]),hm=hf?gf(hf):void 0x0;return{'kind':hb['type'],'input':hc,'artifactPath':hg,'description':hh,'target':{'finalName':ha['output']['fileName'],'finalPath':ha['output']['outputPath']},'resume':hd,'progressMetadata':{...hi,'expectedBytes':hm},'artifactMetadata':{'type':hk['type'],'language':hk[lr(0x270)],'label':hk['label'],'forced':hk[lr(0x32f)]},'logUrl':hl};},gp=async(ha,hb)=>{const lt=hQ;if(ha['isSegmented'])return await Promise['all'](ha[lt(0x202)]['all']['map'](async he=>{let hf=await gg(he);return{'task':await go({'plan':ha,'track':he,'input':ge(hf),'resume':gk(hb,he),'isSegmented':!0x0,'segments':hf}),'segments':hf};}));let hc=ha[lt(0x202)]['videos'][0x0]??ha['tracks']['audios'][0x0],hd=hc?[{'track':hc,'input':hb,'resume':!0x0,'isSegmented':!0x1}]:[];for(let he of ha['tracks']['subtitles']){let hf=await gg(he);hd['push']({'track':he,'input':ge(hf),'resume':!0x0,'isSegmented':!0x1,'segments':hf});}return(await Promise['all'](hd['map'](async hg=>await go({'plan':ha,...hg}))))['map'](hg=>({'task':hg,'segments':[]}));},gq=async ha=>{dn(ha['tracks']['all']);let hb=await gp(ha,dH(ha['resource']['input'])['url']);return{'tasks':hb['map'](({task:hc})=>hc),'psshList':ha['isSegmented']?gl(hb['map'](({segments:hc})=>hc)):[],'selectedTracks':ha['tracks']['all']};},gr=ha=>JSON['stringify'](ha['input']),gs=ha=>{const lu=hQ;let hb=new Map();for(let hc of ha){let hd=gr(hc),he=hb['get'](hd);if(he){he['tasks']['push'](hc);continue;}hb[lu(0x255)](hd,{'representative':hc,'tasks':[hc]});}return[...hb['values']()];},gt=(ha,hb)=>{let hc=hb['progressMetadata']['expectedBytes'];return{'title':ha['downloadTitle'],'total':{'b':hc,'mb':hc===void 0x0?void 0x0:hc/0x400/0x400,'estimated':!0x1},'current':{'b':0x0,'mb':0x0},'percentage':hc===void 0x0?void 0x0:0x0,'speed':{},'trackName':hb['artifactPath'],'trackPath':hb['artifactPath'],'finalName':hb['target']['finalName'],'finalPath':hb['target']['finalPath'],'quality':hb['progressMetadata']['quality'],'codec':hb['progressMetadata']['codec'],'state':'downloading'};},gu=async({settings:ha,plan:hb,task:hc,abortSignal:hd,callbacks:he,reporter:hf})=>(await ga({'input':hc['input'],'resume':hc['resume'],'filepath':hc['artifactPath'],'description':hc['description'],'target':hc['target'],'resource':hb['resource'],'options':hb['options'],'settings':ha,'abortSignal':hd,'title':hb['downloadTitle'],'quality':hc['progressMetadata']['quality'],'codec':hc['progressMetadata']['codec'],'expectedTotalBytes':hc['progressMetadata']['expectedBytes'],'reporter':hf,'emitProgress':hg=>{he?.['onProgress']?.(hg);}}),await aD(hc['artifactPath'])?{'path':hc['artifactPath'],...hc['artifactMetadata']}:null),gv=async({settings:ha,plan:hb,abortSignal:hc,callbacks:hd,reporter:he=eW})=>{const lv=hQ;q['debug']('Preparing\x20track\x20downloads');let hf=await gq(hb),hg=gs(hf['tasks']);q['debug']('Downloading\x20tracks'),await hd?.['onTransferReady']?.();for(let hi of hg)hd?.['onProgress']?.(gt(hb,hi['representative']));let hh=[];for(let hk of hg){let hl=hk['representative'];hl['kind']==='subtitle'&&q['debug']('URL:\x20'+(hl['logUrl']??'manifest\x20subtitle\x20track'));let hm=await gu({'settings':ha,'plan':hb,'task':hl,'abortSignal':hc,'callbacks':hd,'reporter':he});if(hm){for(let hn of hk[lv(0x1f4)])hh[lv(0x277)]({'path':hm['path'],...hn['artifactMetadata']});}}return{'downloaded':hh,'psshList':hf['psshList'],'selectedTracks':hf['selectedTracks']};},gw={'resolveDownloadJobOptions':cB,'prepareDownloadResource':eo,'prepareDownloadPlan':en,'executeTransfer':gv,'resolveContentKeys':dz,'processDownloadedMedia':f0},gx=()=>e3,gy=()=>{let ha=Error('The\x20operation\x20was\x20aborted');return ha['name']='AbortError',ha;},gz=async(ha,hb)=>{for(let hc of hb)await ha({'type':'artifact-created','path':hc['path']});},gA=ha=>ha[hQ(0x21d)]['b']&&ha['total']['b']>0x0?Math['min'](0x1,ha['current']['b']/ha['total']['b']):+(ha['state']===hQ(0x2e9)||ha['state']==='finished'),gB=(ha,hb=0x0)=>{const lw=hQ;let hc=[...ha],hd=0x0,he=0x0,hf=!0x1,hg=!0x1,hh=Math['max'](0x0,hb-hc[lw(0x264)]);for(let hn of hc){if(hd+=hn['current']['b'],hn['total']['b']===void 0x0){hf=!0x0;continue;}he+=hn['total']['b'],hg||=hn['total']['estimated']===!0x0;}let hi=hf||hh>0x0?void 0x0:he,hk=hc['reduce']((ho,hp)=>ho+gA(hp),0x0),hl=hb?hk/hb*0x64:hc['length']?hk/hc['length']*0x64:0x0,hm=hi&&hi>0x0?hd/hi*0x64:0x0;return{'totalDownloaded':hd,'totalSize':hi,'isTotalSizeEstimated':hi!==void 0x0&&hg,'percent':Math['min'](0x64,hb>0x0||hi===void 0x0?hl:hm)};};var gC=class{['settings'];['extensionManager'];#e;#t;#n;constructor(ha,hb,hc={}){this['settings']=ha,this['extensionManager']=hb,this.#e=hc['dependencies']??gw,this.#t=hc['trackSelectorFactory']??gx,this.#n=hc['reporter']??eW;}async['run']({jobId:ha,request:hb,filePath:hc,grantedBenefits:hd,signal:he,emit:hf}){const lx=hQ;let {options:hg,limit:hh}=this.#e['resolveDownloadJobOptions']({'settings':this['settings'],'requestedOptions':hb['options'],'filePath':hc,'grantedBenefits':hd});hh['wasClamped']&&q['warn']('Connections\x20value\x20'+hh['normalizedRequestedConnections']+'\x20exceeds\x20tier\x20limit\x20('+hh[lx(0x323)]+').\x20Using\x20'+hh['connections']+'.');let hi=await this.#e['prepareDownloadResource']({'extensionManager':this['extensionManager'],'entry':hb['entry'],'url':hb[lx(0x230)],'options':hg,'signal':he});try{await hf({'type':'entry-resolved','entry':hi['resource']['entry']}),await hi['beforeDownload']();let hk=await this.#e['prepareDownloadPlan']({'settings':this[lx(0x2be)],'options':hg,'resource':hi['resource'],'extensionTag':hi['extensionTag'],'trackSelector':this.#t(hg)});await hf({'type':'output-resolved','title':hk['downloadTitle'],'filePath':hk['output'][lx(0x2ac)]});let {transferResult:hl,processedMedia:hm}=await this.#r({'preparedPlan':hk,'preparedResource':hi,'jobId':ha,'options':hg,'signal':he,'emit':hf});return{'entry':hi['resource']['entry'],'transferResult':hl,'processedMedia':hm};}catch(hn){throw hn instanceof Error&&hn['name']==='AbortError'?(q['debug']('Download\x20was\x20aborted\x20(paused):\x20'+ha),hn):(q['error']('Download\x20workflow\x20failed:\x20'+(hn instanceof Error?hn['message']:hn)),dk('Download\x20workflow\x20failure',hn),hn);}finally{await hi['dispose']();}}async #r({preparedPlan:ha,preparedResource:hb,jobId:hc,options:hd,signal:he,emit:hf}){const ly=hQ;let hg={},hh=await this.#e['executeTransfer']({'settings':this[ly(0x2be)],'plan':ha,'abortSignal':he,'callbacks':{'onTransferReady':async()=>{await hf({'type':'phase-changed','phase':'transferring'});},'onProgress':async hl=>{await this.#i(hf,hg,hl);}},'reporter':this.#n});if(he[ly(0x303)])throw gy();if(!hh['downloaded']['length'])throw cF();await gz(hf,hh['downloaded']),await hf({'type':'phase-changed','phase':'processing'});let hi=await this.#e['resolveContentKeys']({'jobId':hc,'title':ha['downloadTitle'],'entryTitle':hb['resource']['entry']['title'],'options':hd,'psshList':hh['psshList']??[],'selectedTracks':hh['selectedTracks'],'extension':hb[ly(0x32c)],'resource':hb['resource']}),hk=await this.#e['processDownloadedMedia']({'inputs':hh[ly(0x2e9)],'output':ha['output']['outputPath'],'keys':hi,'trimBegin':hd['trimBegin'],'trimEnd':hd['trimEnd'],'binariesDir':this['settings'][ly(0x236)]('binariesDir'),'skipMux':hd['skipMux'],'reporter':this.#n});return await hb['afterDownload'](hd['skipMux']),{'transferResult':hh,'processedMedia':hk};}async #i(ha,hb,hc){const lz=hQ;hb[hc['trackPath']]=hc;let {totalDownloaded:hd,totalSize:he,isTotalSizeEstimated:hf,percent:hg}=gB(Object['values'](hb));await ha({'type':'progress','progress':{'percent':hg,'downloadedBytes':hd,'totalBytes':he,'totalBytesEstimated':hf,'filePath':hc['finalPath'],'quality':hc[lz(0x1fb)],'codec':hc['codec']},'artifactPaths':[hc['trackPath'],hc['finalPath']]['filter'](Boolean)});}};const gD=ha=>{const lA=hQ;if(!ha)return null;let [hb,hc]=ha['toLowerCase']()['split']('e');return[parseInt(hb[lA(0x245)]()['toLowerCase']()['replace']('s','')),parseFloat(hc?.['trim']())];},gE=ha=>{let hb=0x0,hc=0x270f,hd=[],he=ha['split'](',');for(let hg of he){let [hh,hi]=hg['split']('-'),hk=gD(hh),hl=gD(hi);if(hk&&!hi){let [hm,hn]=hk;if(isNaN(hn)){for(let ho=0x0;ho<=hc;ho++)hd['push']([hm,ho]);}else hd['push']([hm,hn]);}else{if(hk&&hl){let [hp,hq]=hk,[hr,hs]=hl;for(let ht=hp;ht<=hr;ht++){let hu=hq||0x0,hv=ht===hr?hs:hc;for(let hw=hu;hw<=hv;hw++)hd['push']([ht,hw]);}}}}let hf=new Map();for(let [hx,hy]of hd)hf['has'](hx)||hf['set'](hx,new Set()),hf['get'](hx)?.['add'](hy);return hf;},gF=ha=>{if(!ha)return{};let hb={},hc=typeof ha=='string'?ha['split']('|'):ha;for(let hd of hc){let [he,...hf]=hd['split'](':'),hg=hf['join'](':');if(!hg)throw Error('Can\x27t\x20parse\x20header:\x20'+hd);hb[he['trim']()]=hg['trim']();}return hb;},gG=async ha=>{let hb=!0x1,hc=ha;do try{hc?hb=!!new URL(hc):hc=(await t['ask']({'fields':{'url':{'label':'URL'}}}))['url'];}catch{hc=(await t['ask']({'fields':{'url':{'label':'URL'}}}))['url'];}while(!hb);return hc!==ha&&q['debug']('URL:\x20'+hc),hc;},gH=async({message:ha,choices:hb})=>hb['length']?await checkbox({'message':ha,'pageSize':0xc,'choices':hb,'loop':!0x1}):[],gI=async({catalog:ha})=>{const lB=hQ;let hb=await gH({'message':'Select\x20video\x20streams','choices':ha['videos']['map']((hg,hh)=>({'name':hg['label'],'value':hg['id'],'checked':hh===0x0}))}),hc=ha['videos'][lB(0x233)](hg=>hb['includes'](hg['id']))['map'](hg=>hg['track']),hd=await gH({'message':'Select\x20audio\x20streams','choices':ha['audios']['map']((hg,hh)=>({'name':hg['label'],'value':hg['id'],'checked':hh===0x0}))}),he=ha['audios']['filter'](hg=>hd['includes'](hg['id']))['map'](hg=>hg[lB(0x268)]),hf=await gH({'message':'Select\x20subtitles','choices':ha['subtitles']['map']((hg,hh)=>({'name':hg['label'],'value':hg['id'],'checked':hh===0x0}))});return dN({'videos':hc,'audios':he,'subtitles':ha[lB(0x212)]['filter'](hg=>hf['includes'](hg['id']))['map'](hg=>hg['track'])});};var gJ=class{['filePath'];['records']=[];#e=Promise['resolve']();constructor(ha){this['filePath']=ha;}async['load'](){const lC=hQ;await this.#e;try{let ha=await readFile(this['filePath'],{'encoding':'utf8'}),hb=JSON['parse'](ha);this['records']=hb['map'](hc=>this.#n(hc))['toSorted']((hc,hd)=>new Date(hd['createdAt']??0x0)[lC(0x2bb)]()-new Date(hc['createdAt']??0x0)['getTime']());}catch{this[lC(0x1bb)]=[];}return this;}get['size'](){const lD=hQ;return this[lD(0x1bb)]['length'];}async['addRecord'](ha){await this.#t(async()=>{this['records']['unshift'](ha),await this['save']();});}async['updateRecord'](ha){await this.#t(async()=>{const lE=b;let hb=this['records'][lE(0x2a9)](hc=>hc['id']===ha['id']);hb!==-0x1&&(this['records'][hb]=ha,await this['save']());});}['getRecord'](ha){return this['records']['find'](hb=>hb['id']===ha);}['listRecords'](){return this['records'];}['has'](ha){const lF=hQ;return this['records'][lF(0x274)](hb=>hb['id']===ha);}async['deleteRecord'](ha){await this.#t(async()=>{let hb=this['records']['findIndex'](hc=>hc['id']===ha);hb!==-0x1&&(this['records']['splice'](hb,0x1),await this['save']());});}['deleteRecordSync'](ha){let hb=this['records']['findIndex'](hc=>hc['id']===ha);hb!==-0x1&&(this['records']['splice'](hb,0x1),writeFileSync(this['filePath'],JSON['stringify'](this['records'],null,0x2)));}async[hQ(0x217)](){await this.#t(async()=>{this['records']=[],await this['save']();});}async['save'](){writeFileSync(this['filePath'],JSON['stringify'](this['records'],null,0x2));}#t(ha){let hb=this.#e['then'](ha,ha);return this.#e=hb['then'](()=>void 0x0,()=>void 0x0),hb;}#n(ha){const lG=hQ;if('request'in ha&&'state'in ha&&'progress'in ha&&'output'in ha)return ha;if(ha['entry'])return cI(ha);let hb=ha[lG(0x22d)];return cI({...ha,'entry':{'id':hb?.['metadata']?.['id'],'title':hb?.['metadata']?.['title'],'seasonNumber':hb?.['metadata']?.['seasonNumber'],'episodeNumber':hb?.['metadata']?.['episodeNumber'],'episodeTitle':hb?.['metadata']?.['episodeTitle'],'source':hb?.['source']}});}};const gK=ha=>{const lH=hQ;process[lH(0x1f2)](ha);},gL=ha=>ha['select']?gI:e3,gM=0x7d0,gN=async(ha,hb,hc)=>{const lI=hQ;let hd,he=new Promise((hf,hg)=>{hd=setTimeout(()=>hg(Error(hc)),hb);});try{return await Promise[lI(0x1f0)]([ha,he]);}finally{hd&&clearTimeout(hd);}},gO={'command':['download\x20[urls..]','$0\x20[urls..]'],'aliases':['dl'],'describe':'Download\x20media\x20content\x20by\x20URL','builder':ha=>ha['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'})[hQ(0x1d7)]('video-dimension',{'describe':hQ(0x1dd),'default':'2D','type':hQ(0x282)})['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':hQ(0x207)})['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']('lang',{'alias':'l','describe':'Video/audio\x20language(s)','type':'string'})['option']('skip-video',{'describe':'do\x20not\x20download\x20video','type':'boolean'})['option'](hQ(0x275),{'describe':'do\x20not\x20download\x20audio','type':'boolean'})['option']('skip-subtitles',{'describe':'do\x20not\x20download\x20subtitles','type':'boolean'})[hQ(0x1d7)]('skip-mux',{'describe':'Disable\x20merge\x20audio/video/subs\x20into\x20single\x20file','type':'boolean'})['option']('select',{'describe':'Select\x20audio/video/subtitle\x20streams\x20from\x20manifest\x20manually','type':'boolean'})['option'](hQ(0x24c),{'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':hb=>gE(hb)})['option']('retry',{'alias':'R','describe':hQ(0x312),'type':'number','default':aB[hQ(0x241)]})['option']('connections',{'alias':'C','describe':'Number\x20of\x20parallel\x20http\x20connections\x20per\x20download','type':hQ(0x207),'default':aB['connections']})['option']('proxy',{'describe':'Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20all\x20requests','type':'string'})[hQ(0x1d7)]('proxy-meta',{'describe':'Use\x20specified\x20HTTP/HTTPS\x20proxy\x20for\x20metadata\x20fetching','type':'string'})['option']('proxy-media',{'describe':hQ(0x2ab),'type':hQ(0x282)})['option']('movie-template',{'describe':'Movie\x20filename\x20template','type':'string','default':aB['movieFilenameTemplate']})['option']('episode-template',{'describe':'Episode\x20filename\x20template','type':'string','default':aB['seriesFilenameTemplate']})['option']('hardsub',{'describe':'Download\x20hardsubbed\x20video\x20if\x20available','type':'boolean'})['option']('trim-begin',{'describe':hQ(0x1ed),'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':hb=>hb[hQ(0x2d7)](hc=>{let [hd,he]=hc['split'](':');return{'kid':hd,'key':he};})})[hQ(0x1d7)]('header',{'alias':'H','describe':'Pass\x20custom\x20header(s)\x20for\x20manifest\x20request','type':hQ(0x32b),'string':!0x0,'coerce':hb=>gF(hb)})['option']('format',{'alias':'f','describe':'Video\x20container\x20format\x20-\x20mp4\x20|\x20mkv\x20(Pro\x20only)','type':'string','choices':['mp4','mkv']}),'handler':async ha=>{const lJ=hQ;let hb=ha;hb['videoQuality']=ha['quality'];let hc=new aC(j);if(hb['format']){let {error:ho}=await cw({'videoContainerFormat':hb[lJ(0x234)]});ho&&(q[lJ(0x1d1)]('Invalid\x20format:\x20'+ho['message']),q['info']('Learn\x20more:\x20https://azot.mov/pricing'),process['exit'](0x1));}let hd=new ck({'dirs':[I],'indexPath':n});await hd['init'](),await hd['loadCoreExtensions'](),await hd['discover']();let he=new gJ(join(B,'downloads.json'));q['debug']('Downloads\x20storage\x20path:\x20'+he['filePath']),await he['load']();let hf=new d9({'settings':hc,'store':he,'workflow':new gC(hc,hd,{'trackSelectorFactory':gL,'reporter':eX()}),'analyzer':df(hd)}),hg=new Set(),hh=co(),hi=!0x1,hk=()=>{const lK=lJ;if(!hi){hi=!0x0;for(let hp of hg){let hq=hf['getRecord'](hp);if(!(!hq||hq['state']===lK(0x1e6))){q['debug']('Synchronously\x20cleaning\x20up\x20interrupted\x20CLI\x20download:\x20'+hp),he['deleteRecordSync'](hp);for(let hr of cm(hq))rmSync(hr,{'recursive':!0x0,'force':!0x0});he['getRecord'](hp)?q['error']('Interrupted\x20CLI\x20download\x20is\x20still\x20persisted\x20after\x20sync\x20cleanup:\x20'+hp):q['debug']('Synchronously\x20removed\x20interrupted\x20CLI\x20download\x20state:\x20'+hp);}}}},hl=async()=>{const lL=lJ;if(!hi){hi=!0x0;for(let hp of hg){let hq=hf['getRecord'](hp);if(!(!hq||hq['state']==='completed')){q['debug']('Cleaning\x20up\x20interrupted\x20CLI\x20download:\x20'+hp);try{await gN(hf['removeWithFile'](hp),gM,'Timed\x20out\x20while\x20removing\x20interrupted\x20CLI\x20download:\x20'+hp),q['debug']('Removed\x20interrupted\x20CLI\x20download\x20via\x20engine:\x20'+hp);}catch(hr){let hs=hr instanceof Error?hr['message']:String(hr);q['debug']('Engine\x20cleanup\x20failed\x20for\x20interrupted\x20CLI\x20download\x20'+hp+':\x20'+hs),await he['deleteRecord'](hp),await hh[lL(0x21b)](hq),q['debug']('Removed\x20interrupted\x20CLI\x20download\x20directly\x20from\x20storage:\x20'+hp);}he['getRecord'](hp)&&q['error']('Interrupted\x20CLI\x20download\x20is\x20still\x20persisted\x20after\x20cleanup:\x20'+hp);}}}},hm=ae(hl),hn=hp=>{let hq=hp==='SIGINT'?0x82:0x8f;hk(),hm(),gK(hq);};process['once']('SIGINT',hn),process['once']('SIGTERM',hn),c7()['then'](hp=>Object[lJ(0x226)](c5,hp)),hf['subscribe'](hp=>{const lM=lJ;if(hp['type']==='job-added'){hg['add'](hp['record']['id']);return;}if(hp['type']==='job-completed'){q['debug'](lM(0x316)+hp['record']['id']);return;}if(hp['type']==='job-error'){q['debug']('Job\x20failed:\x20'+hp['record']['failure']?.['message']);return;}hp['type']==='error'&&q['error']('Download\x20engine\x20error:\x20'+hp['error']['message']);});try{let hp=Array['isArray'](ha['urls'])?ha['urls']:[],hq=process.env.ELECTRON_RUN_AS_NODE==='1'?hp[lJ(0x233)](ht=>ht!==process['argv'][0x1]):hp,hr=hq['length']>0x0?hq:[''],hs=[];for(let ht of hr){let hu=await gG(ht),hv=await hf['analyze'](hu,hb);for(let hw of hv)hs[lJ(0x277)](hf['add']({'url':hu,'options':hb,'entry':hw}));}await Promise[lJ(0x2c2)](hs),await hf['drain']();}catch(hx){throw await hl(),hx;}finally{hm(),process['off']('SIGINT',hn),process['off']('SIGTERM',hn);}}},gP='azot-desktop',gQ=async()=>{const lN=hQ;if(await c7()&&!await confirm({'message':'You\x27re\x20already\x20logged\x20in.\x20Do\x20you\x20want\x20to\x20log\x20in\x20again?','default':!0x1})){q['debug']('Login\x20cancelled');return;}let ha=createSpinner('Requesting\x20device\x20authorization...');ha['start']();try{let hb=bW(),{data:hc,error:hd}=await hb[lN(0x2dc)]['code']({'client_id':gP,'scope':'openid\x20profile\x20email'});if(ha['stop'](),hd||!hc)q['error']('Failed\x20to\x20request\x20device\x20authorization:\x20'+(hd?.['error_description']||hd?.['statusText']||'Unknown\x20error')),q[lN(0x2a4)](hd);else{let {device_code:he,user_code:hf,verification_uri:hg,verification_uri_complete:hh,interval:hi=0x5,expires_in:hk}=hc;console['log'](''),console['log'](O['cyan']('📱\x20Device\x20Authorization\x20Required')),console['log'](''),console['log']('Please\x20visit:\x20'+O['underline'](O['blue'](hg))),console['log']('Enter\x20code:\x20'+O['bold'](O['green'](hf))),console['log'](''),await confirm({'message':'Open\x20browser\x20automatically?','default':!0x0})&&await Y(hh||hg),console['log'](O['gray']('Waiting\x20for\x20authorization\x20(expires\x20in\x20'+Math['floor'](hk/0x3c)+'\x20minutes)...'));let hl=await gR(hb,he,gP,hi);if(hl){await c6(hl);let {data:hm}=await hb['getSession']({'fetchOptions':{'headers':{'Authorization':'Bearer\x20'+hl['access_token']}}});console['log'](O['green']('✅\x20Login\x20successful!\x20Logged\x20in\x20as\x20'+(hm?.['user']?.['name']||hm?.['user']?.['email']||'User')));}}}catch(hn){ha[lN(0x2d8)](),q['error']('Login\x20failed:\x20'+(hn instanceof Error?hn['message']:'Unknown\x20error'));}};async function gR(ha,hb,hc,hd){let he=hd,hf=createSpinner('',{'color':'cyan'}),hg=0x0;return new Promise(hh=>{let hi=async()=>{const lO=b;hg=(hg+0x1)%0x4,hf[lO(0x1b3)](O['gray']('Polling\x20for\x20authorization'+'.'['repeat'](hg)+'\x20'['repeat'](0x3-hg))),hf['isSpinning']()||hf['start']();try{let {data:hk,error:hl}=await ha['device']['token']({'grant_type':'urn:ietf:params:oauth:grant-type:device_code','device_code':hb,'client_id':hc,'fetchOptions':{'headers':{'user-agent':'Azot\x20Desktop'}}});if(hk?.['access_token']){hf['stop'](),hh(hk);return;}else{if(hl)switch(hl['error']){case'authorization_pending':break;case lO(0x329):he+=0x5,hf['update'](O[lO(0x2b0)]('Slowing\x20down\x20polling\x20to\x20'+he+'s'));break;case'access_denied':hf['stop'](),q['error']('Access\x20was\x20denied\x20by\x20the\x20user');break;case'expired_token':hf['stop'](),q[lO(0x1d1)](lO(0x2cc));break;default:hf['stop'](),q['error']('Error:\x20'+hl['error_description']);}}}catch(hm){hf['stop'](),q['error']('Network\x20error:\x20'+(hm instanceof Error?hm['message']:'Unknown\x20error'));return;}setTimeout(hi,he*0x3e8);};setTimeout(hi,he*0x3e8);});}const gS=async()=>{q['info']('Logging\x20out...');let ha=await bW()['signOut']();ha['error']?q['error']('Logout\x20failed:\x20'+ha['error']['message']):(q['info']('Logout\x20successful'),await c6({}));},gT={'command':hQ(0x26f),'describe':hQ(0x301),'builder':ha=>ha[hQ(0x1d7)]('username',{'alias':'u','describe':'Username','type':'string'})[hQ(0x1d7)]('password',{'alias':'p','describe':hQ(0x284),'type':'string'})['option'](hQ(0x232),{'alias':'o','describe':'One-time\x20password','type':'string'}),'handler':async ha=>{const lP=hQ;let hb=ha['extension'],hc={'username':ha['username'],'password':ha[lP(0x28e)],'otp':ha['otp']};if(hb){let hd=new ck({'dirs':[I],'indexPath':n});await hd['init'](),await hd[lP(0x1f1)](),await hd[lP(0x1c2)](hb,hc);}else gQ();}},gU={'command':'list','aliases':['ls'],'describe':'Lists\x20information\x20about\x20installed/active\x20extensions','handler':async()=>{const lQ=hQ;let ha=await new ck({'indexPath':n})['init']();if(!ha['infoList']['length'])return console[lQ(0x22b)]('No\x20added\x20extensions\x20found');for(let hb of ha['infoList']){let hc=''+O['bold'](O[lQ(0x2db)](hb['name']['padEnd'](0xf))),hd=O['green'](hb['package']?.['version']);console['log'](hc+hd);}console['log']('\x0a'+O['dim']('Location:\x20'+J));}},gV=new Intl['RelativeTimeFormat']('en',{'style':'long'}),gW=ha=>{const lR=hQ;let hb=Math['floor'](ha/0x18),hc=Math['abs'](hb);return hc>0x16d?gV[lR(0x234)](Math['floor'](hb/0x16d),'year'):hc>0x1e?gV['format'](Math['floor'](hb/0x1e),'month'):hc>0x7?gV['format'](Math['floor'](hb/0x7),'week'):hc>0x1?gV['format'](Math[lR(0x1b5)](hb),'day'):gV['format'](Math['floor'](ha),'hour');},gX=(ha,hb,hc)=>{let hd=''+O['bold'](O['blue'](ha['padEnd'](0xf))),he=O['green'](hb['padEnd'](0xa)),hf=O['dim'](hc);console['log'](hd+he+hf);},gY={'command':'list-remote','aliases':['ls-remote'],'describe':'List\x20all\x20available\x20extensions','handler':async()=>{const lS=hQ;c7()['then'](hc=>Object['assign'](c5,hc));let ha=await ck['getAvailableExtensions'](),hb=Date['now']();for(let hc of ha){let hd=hc['releases'][lS(0x2cf)]((hh,hi)=>new Date(hi['createdAt'])['getTime']()-new Date(hh[lS(0x2f6)])['getTime']())['at'](0x0);if(!hd)continue;let he=hd['createdAt'],hf=new Date(he)['getTime']()-hb,hg=gW(Math['floor'](hf/0x36ee80));gX(hc[lS(0x30e)],hd['version'],hg);}}},gZ={'command':'logout\x20[extensions..]','describe':'Logout\x20from\x20extension\x20(or\x20if\x20no\x20extension\x20is\x20specified,\x20logout\x20from\x20Azot\x20account)','handler':async ha=>{const lT=hQ;let hb=ha['extensions'];if(hb?.['length']){let hc=new ck({'dirs':[I],'indexPath':n});await hc['init'](),await hc['discover'](),await hc[lT(0x300)](hb);}else gS();}},h0={'command':'settings\x20[key]\x20[value]','describe':'CLI\x20access\x20to\x20get/set\x20configuration\x20settings','handler':async ha=>{const lU=hQ;let hb=new aC(j),hc=ha['key'],hd=ha['value'];if(hc&&hd){hb['set']({[hc]:hd}),console['log']('Setting\x20'+O[lU(0x201)](O['blue'](hc))+'\x20set\x20to\x20'+O['green'](hd));return;}else{if(hc){let hf=hb[lU(0x236)](hc);console[lU(0x22b)](hf?'Setting\x20'+O['bold'](O['blue'](hc))+'\x20is\x20'+O['green'](hf):'Setting\x20'+O['bold'](O['blue'](hc))+'\x20is\x20not\x20found');return;}}let he=hb['getAll']();for(let [hg,hh]of Object['entries'](he)){let hi=(''+hg)['padEnd'](0x19),hk=String(hh)['replaceAll']('{','{{')['replaceAll']('}','}}');console['log'](O['bold'](O[lU(0x2db)](hi))+'\x20'+hk);}console['log']('\x0a'+O['dim']('Location:\x20'+j));}},h1={'command':hQ(0x1b4),'aliases':['rm'],'describe':'Uninstall\x20an\x20extension','handler':async ha=>{let hb=ha['extensions'],hc=new ck({'dirs':[I],'indexPath':n});await hc['init'](),await hc['uninstall'](hb);}},h2={'command':'install\x20<extensions..>','aliases':['i'],'describe':'Install\x20extension','handler':async ha=>{let hb=ha['extensions'],hc=new ck({'dirs':[I],'indexPath':n});await hc['init'](),await hc['install'](hb);}},h3={'command':'logs','describe':'Show\x20logs\x20list','handler':async()=>{const lV=hQ;let ha=s,hb=await readdir(ha)['then'](hd=>hd['filter'](he=>he[lV(0x29f)]('.log'))),hc=hd=>join(ha,hd);hb['length']||q['info']('No\x20logs\x20found');for(let hd of hb)q['info'](hc(hd));}};q['debug'](i);const h4=ab(process['argv']);q['debug'](H+'\x20'+h4['join']('\x20'));const h5=new Set(['build','dev']);w['on']('error',ha=>{let hb=F(ha);q['error'](hb['message']);});const h6=O['magenta'](O['bold'](k))+'\x20is\x20'+h['description']['toLocaleLowerCase'](),h7=O['bold'](hQ(0x22a)+O['cyan']('[...options]')),h8=async(ha,hb)=>{let hc=hb instanceof Error?hb:Error(String(hb));q['fatal'](ha+':\x20'+hc['message']),hc['stack']&&q['debug'](hc['stack']),await af();try{rmSync(r,{'recursive':!0x0,'force':!0x0});}catch(hd){q['error']('Failed\x20to\x20remove\x20temp\x20directory\x20'+r+':',hd);}process['exit'](0x1);};process['on']('uncaughtException',ha=>{h8('Unexpected\x20error',ha);}),process['on']('unhandledRejection',ha=>{h8('Unhandled\x20promise\x20rejection',ha);}),!c&&h5['has'](h4[0x0]??'')&&h8('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 h9=N(h4)['scriptName'](H)[hQ(0x2e7)](h6+'\x0a\x0a'+h7)['command'](gO)['command'](gU)['command'](gY)['command'](h2)['command'](h1)['command'](gT)['command'](gZ)['command'](h0)[hQ(0x221)](h3)['option']('debug',{'describe':'Debug\x20mode','type':'boolean'})['wrap'](N()['terminalWidth']())['help']()['alias']('h','help')['showHelpOnFail'](!0x1)['version'](u)[hQ(0x2ba)]({'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[hQ(0x238)]('number')})['epilogue']('Learn\x20more\x20about\x20Azot:\x20'+O['magenta']('https://azot.mov')+'.');c&&h9[hQ(0x221)](av)['command'](aw),h9['parseAsync']()['then'](async ha=>{const lW=hQ;await p(s);let hb=String(ha['_'][0x0]??'');hb==='dev'||hb===lW(0x23a)&&ha['watch']===!0x0||process['exit'](0x0);})['catch'](ha=>{h8('CLI\x20error',ha);});export{};
|