azot 5.0.0-alpha.30 → 5.0.0-alpha.31

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