agsamantha/node_modules/youtubei.js/bundle/browser.min.js

54 lines
550 KiB
JavaScript
Raw Normal View History

2024-10-02 15:15:21 -05:00
/* eslint-disable */
var Pw=Object.defineProperty;var n=(t,e)=>Pw(t,"name",{value:e,configurable:!0});var B=(t,e)=>{for(var i in e)Pw(t,i,{get:e[i],enumerable:!0})};function Aw(t,e){var i={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(i[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(t);s<o.length;s++)e.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(i[o[s]]=t[o[s]]);return i}n(Aw,"__rest");function Rw(t,e,i){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:i?"".concat(i," ",e):e})}n(Rw,"__setFunctionName");function y(t,e,i,o){function s(r){return r instanceof i?r:new i(function(l){l(r)})}return n(s,"adopt"),new(i||(i=Promise))(function(r,l){function p(m){try{h(o.next(m))}catch(b){l(b)}}n(p,"fulfilled");function f(m){try{h(o.throw(m))}catch(b){l(b)}}n(f,"rejected");function h(m){m.done?r(m.value):s(m.value).then(p,f)}n(h,"step"),h((o=o.apply(t,e||[])).next())})}n(y,"__awaiter");function Nw(t){var e=typeof Symbol=="function"&&Symbol.iterator,i=e&&t[e],o=0;if(i)return i.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}n(Nw,"__values");function ko(t){return this instanceof ko?(this.v=t,this):new ko(t)}n(ko,"__await");function Mw(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=i.apply(t,e||[]),s,r=[];return s={},l("next"),l("throw"),l("return"),s[Symbol.asyncIterator]=function(){return this},s;function l(x){o[x]&&(s[x]=function(T){return new Promise(function(k,C){r.push([x,T,k,C])>1||p(x,T)})})}function p(x,T){try{f(o[x](T))}catch(k){b(r[0][3],k)}}function f(x){x.value instanceof ko?Promise.resolve(x.value.v).then(h,m):b(r[0][2],x)}function h(x){p("next",x)}function m(x){p("throw",x)}function b(x,T){x(T),r.shift(),r.length&&p(r[0][0],r[0][1])}}n(Mw,"__asyncGenerator");function Vw(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof Nw=="function"?Nw(t):t[Symbol.iterator](),i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i);function o(r){i[r]=t[r]&&function(l){return new Promise(function(p,f){l=t[r](l),s(p,f,l.done,l.value)})}}function s(r,l,p,f){Promise.resolve(f).then(function(h){r({value:h,done:p})},l)}}n(Vw,"__asyncValues");function d(t,e,i,o){if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?o:i==="a"?o.call(t):o?o.value:e.get(t)}n(d,"__classPrivateFieldGet");function I(t,e,i,o,s){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?s.call(t,i):s?s.value=i:e.set(t,i),i}n(I,"__classPrivateFieldSet");var tb={};B(tb,{ChannelError:()=>Ks,InnertubeError:()=>v,MissingParamError:()=>Ln,OAuthError:()=>mi,ParsingError:()=>kt,Platform:()=>L,PlayerError:()=>zt,SessionError:()=>wr,base64ToU8:()=>Tb,concatMemos:()=>Bb,debugFetch:()=>RP,deepCompare:()=>g_,escapeStringRegexp:()=>Kb,generateRandomString:()=>Nt,generateSidAuth:()=>eb,getRandomUserAgent:()=>Ao,getStringBetweenStrings:()=>Ye,hasKeys:()=>AP,isTextRun:()=>nt,streamToIterable:()=>Xy,throwIfMissing:()=>ie,timeToSeconds:()=>je,u8ToBase64:()=>dt});var qy={};B(qy,{Maybe:()=>Co,Memo:()=>Oi,SuperParsedResult:()=>ei,YTNode:()=>a,observe:()=>re});var Vi,ge=class{static doLog(e,i,o){if(!this.log_map_[e]||!this.log_level_.includes(e))return;let s=[`[${this.YTJS_TAG}]`];i&&s.push(`[${i}]`),this.log_map_[e](`${s.join("")}:`,...o||[])}static set
`))===null||i===void 0?void 0:i.split(",");if(!l)throw new v("Failed to extract the segment durations from this OTF stream",{url:t});let p=[];for(let f of l){let h=f.trim();if(h.length===0)continue;let m,b=Ye(h,"(r=",")");b&&(m=parseInt(b)),p.push({duration:parseInt(h),repeat_count:m})}return{init_url:`${s}&sq=0`,media_url:`${s}&sq=$Number$`,timeline:p}})}n(AC,"getOTFSegmentTemplate");function Hw(t,e){return y(this,void 0,void 0,function*(){let i=yield e.session.http.fetch_function(`${t}&rn=0&sq=0`,{method:"HEAD",headers:xi,redirect:"follow"}),o=parseInt(i.headers.get("X-Head-Time-Millis")||""),s=parseInt(i.headers.get("X-Head-Seqnum")||"");if(isNaN(o)||isNaN(s))throw new v("Failed to extract the duration or segment count for this Post Live DVR video");return{duration:o/1e3,segment_count:s}})}n(Hw,"getPostLiveDvrInfo");function RC(t,e,i,o,s,r){return y(this,void 0,void 0,function*(){if(!t.item){let l=new URL(e.decipher(s));l.searchParams.set("cpn",r||"");let p=i(l).toString();t.item=yield Hw(p,o)}return t.item.duration})}n(RC,"getPostLiveDvrDuration");function Jw(t,e,i,o,s,r){let l=new URL(t.decipher(o));l.searchParams.set("cpn",s||"");let p=e(l).toString();if(t.is_type_otf){if(!i)throw new v("Unable to get segment durations for this OTF stream without an Actions instance",{format:t});return{is_oft:!0,is_post_live_dvr:!1,getSegmentTemplate(){return AC(p,i)}}}if(r){if(!i)throw new v("Unable to get segment count for this Post Live DVR video without an Actions instance",{format:t});let h=t.target_duration_dec;if(typeof h!="number")throw new v("Format is missing target_duration_dec",{format:t});return{is_oft:!1,is_post_live_dvr:!0,getSegmentTemplate(){return y(this,void 0,void 0,function*(){return r.item||(r.item=yield Hw(p,i)),{media_url:`${p}&sq=$Number$`,timeline:[{duration:h*1e3,repeat_count:r.item.segment_count}]}})}}}if(!t.index_range||!t.init_range)throw new v("Index and init ranges not available",{format:t});return{is_oft:!1,is_post_live_dvr:!1,base_url:p,index_range:t.index_range,init_range:t.init_range}}n(Jw,"getSegmentInfo");function MC(t,e,i,o,s,r,l){return new URL(t.decipher(s)).searchParams.set("cpn",r||""),{uid:t.audio_track?`${t.itag}-${t.audio_track.id}`:t.itag.toString(),bitrate:t.bitrate,codecs:e.includes("codecs")?void 0:Ye(t.mime_type,'codecs="','"'),audio_sample_rate:e.includes("audio_sample_rate")?void 0:t.audio_sample_rate,channels:e.includes("AudioChannelConfiguration")?void 0:t.audio_channels||2,segment_info:Jw(t,i,o,s,r,l)}}n(MC,"getAudioRepresentation");function VC(t){let{audio_track:e}=t;if(!!e)return e.audio_is_default?"main":t.is_dubbed?"dub":t.is_descriptive?"description":"alternate"}n(VC,"getTrackRole");function OC(t,e,i,o,s,r){var l;let p=t[0],{audio_track:f}=p,h=[];return{mime_type:p.mime_type.split(";")[0],language:(l=p.language)!==null&&l!==void 0?l:void 0,codecs:Uw(t,h),audio_sample_rate:Ww(t,"audio_sample_rate",h),track_name:f==null?void 0:f.display_name,track_role:VC(p),channels:NC(t,h),representations:t.map(b=>MC(b,h,e,i,o,s,r))}}n(OC,"getAudioSet");var DC={BT709:"1",BT2020:"9"},jw={BT709:"1",BT2020_10:"14",SMPTEST2084:"16",ARIB_STD_B67:"18"},LC={BT709:"1",BT2020_NCL:"14"};function BC(t){var e;let i=t.color_info,o,s,r;if(i){if(i.primaries&&(o=DC[i.primaries]),i.transfer_characteristics&&(s=jw[i.transfer_characteristics]),i.matrix_coefficients&&(r=LC[i.matrix_coefficients],!r)){let p=new URL(t.url),f=JSON.parse(JSON.stringify(t));f.url="REDACTED",f.signature_cipher="REDACTED",f.cipher="REDACTED",U.warn(EC,`Unknown matrix coefficients "${i.matrix_coefficients}", the DASH manifest is still usuable without this.
Please report it at ${L.shim.info.bugs_url} so we can add support for it.
InnerTube client: ${p.searchParams.get("c")}
format:`,f)}}else!((e=Ye(t.mime_type,'codecs="','"'))===null||e===void 0)&&e.startsWith("avc1")&&(s=jw.BT709);return{primaries:o,transfer_characteristics:s,matrix_coefficients:r}}n(BC,"getColorInfo");function FC(t,e,i,o,s,r,l){return{uid:t.itag.toString(),bitrate:t.bitrate,width:t.width,height:t.height,codecs:i.includes("codecs")?void 0:Ye(t.mime_type,'codecs="','"'),fps:i.includes("fps")?void 0:t.fps,segment_info:Jw(t,e,s,o,r,l)}}n(FC,"getVideoRepresentation");function YC(t,e,i,o,s,r){let l=t[0],p=BC(l),f=[];return{mime_type:l.mime_type.split(";")[0],color_info:p,codecs:Uw(t,f),fps:Ww(t,"fps",f),representations:t.map(m=>FC(m,e,f,i,o,s,r))}}n(YC,"getVideoSet");function jC(t){var e;let i=new Map,o=t.is(Po)?t.boards:[t.board];for(let s of o){let r=new URL(s.template_url).pathname.split(".").pop(),l=`image/${r==="jpg"?"jpeg":r}`;i.has(l)||i.set(l,[]),(e=i.get(l))===null||e===void 0||e.push(s)}return i}n(jC,"getStoryboardInfo");function UC(t,e,i,o,s){return y(this,void 0,void 0,function*(){let r=e.template_url,l=i(new URL(r.replace("$M","0"))),p=s.response?s.response:t.session.http.fetch_function(l,{method:"HEAD",headers:xi});return s.response=p,(yield p).headers.get("Content-Type")||o})}n(UC,"getStoryboardMimeType");function WC(t,e,i){return y(this,void 0,void 0,function*(){let o=e.template_url,s=[],r=Math.min(e.type==="vod"?e.storyboard_count:5,10);for(let h=0;h<r;h++){let m=new URL(o.replace("$M",h.toString())),b=h===0&&i.response?i.response:t.session.http.fetch_function(m,{method:"HEAD",headers:xi});h===0&&(i.response=b),s.push(b)}let l=yield Promise.all(s),p=[];for(let h of l)p.push(parseInt(h.headers.get("Content-Length")||"0"));return Math.ceil(Math.max(...p)/(e.rows*e.columns)*8)})}n(WC,"getStoryboardBitrate");function HC(t,e,i,o,s){let r=i.template_url,l=new URL(r.replace("$M","$Number$")),p;return i.type==="vod"?p=t/i.storyboard_count:p=t*i.columns*i.rows,{uid:`thumbnails_${i.thumbnail_width}x${i.thumbnail_height}`,getBitrate(){return WC(e,i,s)},sheet_width:i.thumbnail_width*i.columns,sheet_height:i.thumbnail_height*i.rows,thumbnail_height:i.thumbnail_height,thumbnail_width:i.thumbnail_width,rows:i.rows,columns:i.columns,template_duration:p,template_url:o(l).toString(),getURL(h){return l.toString().replace("$Number$",h.toString())}}}n(HC,"getImageRepresentation");function JC(t,e,i,o){let s=jC(i),r={};return Array.from(s.entries()).map(([l,p])=>({probable_mime_type:l,getMimeType(){return UC(e,p[0],o,l,r)},representations:p.map(f=>HC(t,e,f,o,r))}))}n(JC,"getImageSets");function b_(t,e=!1,i=f=>f,o,s,r,l,p){if(!t)throw new v("Streaming data not available");let f=o?t.adaptive_formats.filter(D=>!o(D)):t.adaptive_formats,h,m;if(e){if(m={},!l)throw new v("Unable to get duration or segment count for this Post Live DVR video without an Actions instance");h=n(()=>m?RC(m,f[0],i,l,r,s):Promise.resolve(0),"getDuration")}else{let D=f[0].approx_duration_ms/1e3;h=n(()=>Promise.resolve(D),"getDuration")}let{groups:b,has_multiple_audio_tracks:x}=PC(f,e),{video_groups:T,audio_groups:k}=b.reduce((D,le)=>le[0].has_audio?(x&&!le[0].audio_track||D.audio_groups.push(le),D):(D.video_groups.push(le),D),{video_groups:[],audio_groups:[]}),C=k.map(D=>OC(D,i,l,r,s,m)),M=T.map(D=>YC(D,i,r,l,s,m)),A=[];if(p&&l){let D;if(p.is(Po))D=f[0].approx_duration_ms/1e3;else{let le=f[0].target_duration_dec;if(typeof le!="number")throw new v("Format is missing target_duration_dec",{format:f[0]});D=le}A=JC(D,l,p,i)}return{getDuration:h,audio_sets:C,video_sets:M,image_sets:A}}n(b_,"getStreamingInfo");function GC({info:t}){return y(this,void 0,void 0,function*(){if(!t.is_oft&&!t.is_post_live_dvr)return null;let e=yield t.getSegmentTemplate();return me("segment-template",{startNumber:e.init_url?"1":"0",timescale:"1000",initialization:e.init_url,media:e.media_url},me("segment-timeline",null,e.timeline.map(i=>me("s",{d:i.duration,r:i.repeat_count}))))})}n(GC,"OTFPostLiveDvrSegmentInfo");function Gw({info:t}){return t.is_oft||t.is_post_live_dvr?me(GC,{info:t}):me(Yw,null,me("base-url",null,t.base_url),me("segment-base",{indexRange:`${t.index_range.start}-${t.index_r
static type = '${t}';
${i.join(`
`)}
constructor(data: RawNode) {
${o.join(`
`)}
}
}
`}n(Kg,"generateTypescriptClass");function zS(t,e){return`{
${e.map(([i,o])=>`${" ".repeat((t+2)*2)}${qo(i)}${o.optional?"?":""}: ${Pb(o,t+1)}`).join(`,
`)}
${" ".repeat((t+1)*2)}}`}n(zS,"toTypeDeclarationObject");function Pb(t,e=0){switch(t.type){case"renderer":return`${t.renderers.map(i=>`YTNodes.${i}`).join(" | ")} | null`;case"array":switch(t.array_type){case"renderer":return`ObservedArray<${t.renderers.map(i=>`YTNodes.${i}`).join(" | ")}> | null`;case"primitive":{let i=t.items.typeof;return t.items.optional&&!i.includes("undefined")&&i.push("undefined"),`${i.length===1?`${i[0]}`:`(${i.join(" | ")})`}[]`}case"object":return`${zS(e,t.items.keys)}[]`;default:throw new Error("Unreachable code reached! Switch missing case!")}case"object":return zS(e,t.keys);case"misc":switch(t.misc_type){case"Thumbnail":return"Thumbnail[]";default:return t.misc_type}case"primative":return t.typeof.join(" | ")}}n(Pb,"toTypeDeclaration");function $S(t,e,i,o){let s=[...i,o];return`{
${e.map(([r,l])=>`${" ".repeat((t+2)*2)}${qo(r)}: ${Nb(r,l,s,t+1)}`).join(`,
`)}
${" ".repeat((t+1)*2)}}`}n($S,"toParserObject");function Nb(t,e,i=["data"],o=1){let s="undefined";switch(e.type){case"renderer":s=`Parser.parseItem(${i.join(".")}.${t}, ${KS(e.renderers)})`;break;case"array":switch(e.array_type){case"renderer":s=`Parser.parse(${i.join(".")}.${t}, true, ${KS(e.renderers)})`;break;case"object":s=`${i.join(".")}.${t}.map((item: any) => (${$S(o,e.items.keys,[],"item")}))`;break;case"primitive":s=`${i.join(".")}.${t}`;break;default:throw new Error("Unreachable code reached! Switch missing case!")}break;case"object":s=$S(o,e.keys,i,t);break;case"misc":switch(e.misc_type){case"Thumbnail":s=`Thumbnail.fromResponse(${i.join(".")}.${t})`;break;case"Author":{let r=`new Author(${i.join(".")}.${e.params[0]}, ${e.params[1]?`${i.join(".")}.${e.params[1]}`:"undefined"})`;return e.optional?`Reflect.has(${i.join(".")}, '${e.params[0]}') ? ${r} : undefined`:r}default:s=`new ${e.misc_type}(${i.join(".")}.${t})`;break}if(s==="undefined")throw new Error("Unreachable code reached! Switch missing case!");break;case"primative":s=`${i.join(".")}.${t}`;break}return e.optional?`Reflect.has(${i.join(".")}, '${t}') ? ${s} : undefined`:s}n(Nb,"toParser");function KS(t){return t.length===1?`YTNodes.${t[0]}`:`[ ${t.map(e=>`YTNodes.${e}`).join(", ")} ]`}n(KS,"toParserValidTypes");function ui(t,e){let i=t;for(let o of e)i=i[o];return i}n(ui,"accessDataFromKeyPath");function qS(t,e){let i=t;for(let o of e)if(Reflect.has(i,o))i=i[o];else return!1;return!0}n(qS,"hasDataFromKeyPath");function XS(t,e,i,o,s){let r={},l=[...i,t];for(let[p,f]of o)r[p]=s?Ab(p,f,e,l):void 0;return r}n(XS,"parseObject");function Ab(t,e,i,o=["data"]){let s=!e.optional||qS({data:i},[...o,t]);switch(e.type){case"renderer":return s?ue(ui({data:i},[...o,t]),e.renderers.map(r=>Vh(r))):void 0;case"array":{switch(e.array_type){case"renderer":return s?qe(ui({data:i},[...o,t]),!0,e.renderers.map(r=>Vh(r))):void 0;case"object":return s?ui({data:i},[...o,t]).map((r,l)=>XS(`${l}`,i,[...o,t],e.items.keys,s)):void 0;case"primitive":return s?ui({data:i},[...o,t]):void 0}throw new Error("Unreachable code reached! Switch missing case!")}case"object":return XS(t,i,o,e.keys,s);case"misc":switch(e.misc_type){case"NavigationEndpoint":return s?new g(ui({data:i},[...o,t])):void 0;case"Text":return s?new u(ui({data:i},[...o,t])):void 0;case"Thumbnail":return s?w.fromResponse(ui({data:i},[...o,t])):void 0;case"Author":return!e.optional||qS({data:i},[...o,e.params[0]])?new V(ui({data:i},[...o,e.params[0]]),e.params[1]?ui({data:i},[...o,e.params[1]]):void 0):void 0}throw new Error("Unreachable code reached! Switch missing case!");case"primative":return ui({data:i},[...o,t])}}n(Ab,"parse");function Mh(t,e){let i=new Map,o=new Set(t.map(([x])=>x)),s=new Set(e.map(([x])=>x)),r=e.filter(([x])=>!o.has(x)),l=t.filter(([x])=>!s.has(x)),p=t.filter(([x])=>s.has(x)),f=new Map(e);for(let[x,T]of p){let k=f.get(x);if(!!k){if(T.type!==k.type){i.set(x,{type:"primative",typeof:["unknown"],optional:!0});continue}switch(T.type){case"object":{if(k.type!=="object")continue;let{resolved_key_info:C}=Mh(T.keys,k.keys),M={type:"object",keys:C,optional:T.optional||k.optional};JSON.stringify(M)!==JSON.stringify(T)&&i.set(x,M)}break;case"renderer":{if(k.type!=="renderer")continue;let C=Object.assign(Object.assign({},T.renderers),k.renderers),M=T.optional||k.optional,A={type:"renderer",renderers:C,optional:M};JSON.stringify(Object.assign(Object.assign({},A),{renderers:Object.keys(A.renderers)}))!==JSON.stringify(Object.assign(Object.assign({},T),{renderers:Object.keys(T.renderers)}))&&i.set(x,A)}break;case"array":{if(k.type!=="array")continue;switch(T.array_type){case"renderer":{if(k.array_type!=="renderer"){i.set(x,{type:"array",array_type:"primitive",items:{type:"primative",typeof:["unknown"],optional:!0},optional:!0});continue}let C=Object.assign(Object.assign({},T.renderers),k.renderers),M=T.optional||k.optional,A={type:"array",array_type:"renderer",renderers:C,optional:M};JSON.stringify(Object.assign(Object.assign({},A),{renderers:Object.keys(A.renderers)}))!==JSON.stringify(Object.assign(Object.as
This is a bug, please report it at ${L.shim.info.bugs_url}`,{stack:i.error.stack}));break;case"typecheck":U.warn(Qo,new kt(`Type mismatch, got ${e} expected ${Array.isArray(i.expected)?i.expected.join(" | "):i.expected}.`,i.classdata));break;case"mutation_data_missing":U.warn(Qo,new v(`Mutation data required for processing ${e}, but none found.
This is a bug, please report it at ${L.shim.info.bugs_url}`));break;case"mutation_data_invalid":U.warn(Qo,new v(`Mutation data missing or invalid for ${i.failed} out of ${i.total} MusicMultiSelectMenuItems. The titles of the failed items are: ${i.titles.join(", ")}.
This is a bug, please report it at ${L.shim.info.bugs_url}`));break;case"class_not_found":U.warn(Qo,new v(`${e} not found!
This is a bug, want to help us fix it? Follow the instructions at ${L.shim.info.repo_url}/blob/main/docs/updating-the-parser.md or report it at ${L.shim.info.bugs_url}!
Introspected and JIT generated this class in the meantime:
${Kg(e,i.key_info)}`));break;case"class_changed":U.warn(Qo,`${e} changed!
The following keys where altered: ${i.changed_keys.map(([o])=>qo(o)).join(", ")}
The class has changed to:
${Kg(e,i.key_info)}`);break;default:U.warn(Qo,"Unreachable code reached at ParserErrorHandler");break}},"ERROR_HANDLER");function CE(t){uo=t}n(CE,"setParserErrorHandler");function jt(){Zo=null}n(jt,"_clearMemo");function Ut(){Zo=new Oi}n(Ut,"_createMemo");function EE(t,e){if(!Zo)return;let i=Zo.get(t);if(!i)return Zo.set(t,[e]);i.push(e)}n(EE,"_addToMemo");function Wt(){if(!Zo)throw new Error("Parser#getMemo() called before Parser#createMemo()");return Zo}n(Wt,"_getMemo");function n1(t){return SE.has(t)}n(n1,"shouldIgnore");function Dh(t){return(t.charAt(0).toUpperCase()+t.slice(1)).replace(/Renderer|Model/g,"").replace(/Radio/g,"Mix").trim()}n(Dh,"sanitizeClassName");function Vh(t){let e=Db.get(t);if(!e){let i=new Error(`Module not found: ${t}`);throw i.code="MODULE_NOT_FOUND",i}return e}n(Vh,"getParserByName");function qg(t){return Db.has(t)}n(qg,"hasParser");function Mb(t,e){Db.set(t,e),o1.set(t,e)}n(Mb,"addRuntimeParser");function PE(){return Object.fromEntries(o1)}n(PE,"getDynamicParsers");function NE(t){var e,i,o,s,r,l,p,f,h,m,b,x,T,k;let C={};Ut();let M=qe(t.contents),A=Wt();M&&(C.contents=M,C.contents_memo=A),jt(),Ut();let $=t.onResponseReceivedActions?ex(t.onResponseReceivedActions):null,D=Wt();$&&(C.on_response_received_actions=$,C.on_response_received_actions_memo=D),jt(),Ut();let le=t.onResponseReceivedEndpoints?ex(t.onResponseReceivedEndpoints):null,ve=Wt();le&&(C.on_response_received_endpoints=le,C.on_response_received_endpoints_memo=ve),jt(),Ut();let ke=t.onResponseReceivedCommands?ex(t.onResponseReceivedCommands):null,Pe=Wt();ke&&(C.on_response_received_commands=ke,C.on_response_received_commands_memo=Pe),jt(),Ut();let De=t.continuationContents?Vb(t.continuationContents):null,K=Wt();De&&(C.continuation_contents=De,C.continuation_contents_memo=K),jt(),Ut();let z=t.actions?r1(t.actions):null,Z=Wt();z&&(C.actions=z,C.actions_memo=Z),jt(),Ut();let se=t.liveChatItemContextMenuSupportedRenderers?ue(t.liveChatItemContextMenuSupportedRenderers):null,Fe=Wt();se&&(C.live_chat_item_context_menu_supported_renderers=se,C.live_chat_item_context_menu_supported_renderers_memo=Fe),jt(),Ut();let _t=t.header?qe(t.header):null,Tt=Wt();_t&&(C.header=_t,C.header_memo=Tt),jt(),Ut();let q=t.sidebar?ue(t.sidebar):null,ze=Wt();q&&(C.sidebar=q,C.sidebar_memo=ze),jt(),Ut();let Xt=qe(t.items);Xt&&(C.items=Xt,C.items_memo=Wt()),jt(),Ut();let Qt=qe(t.entries);Qt&&(C.entries=Qt,C.entries_memo=Wt()),jt(),a1(A,(i=(e=t.frameworkUpdates)===null||e===void 0?void 0:e.entityBatchUpdate)===null||i===void 0?void 0:i.mutations),ve&&u1(ve,(s=(o=t.frameworkUpdates)===null||o===void 0?void 0:o.entityBatchUpdate)===null||s===void 0?void 0:s.mutations);let Se=t.continuation?s1(t.continuation):null;Se&&(C.continuation=Se);let ut=t.continuationEndpoint?Vb(t.continuationEndpoint):null;ut&&(C.continuation_endpoint=ut);let Un=qe(t.metadata);Un&&(C.metadata=Un);let Wn=ue(t.microformat);Wn&&(C.microformat=Wn);let Hn=ue(t.overlay);Hn&&(C.overlay=Hn);let Jn=Ke(t.alerts,[os,j_]);Jn.length&&(C.alerts=Jn);let Gn=t.refinements;Gn&&(C.refinements=Gn);let zn=t.estimatedResults?parseInt(t.estimatedResults):null;zn&&(C.estimated_results=zn);let $n=qe(t.playerOverlays);$n&&(C.player_overlays=$n);let Kn=t.playbackTracking?{videostats_watchtime_url:t.playbackTracking.videostatsWatchtimeUrl.baseUrl,videostats_playback_url:t.playbackTracking.videostatsPlaybackUrl.baseUrl}:null;Kn&&(C.playback_tracking=Kn);let qn=t.playabilityStatus?{status:t.playabilityStatus.status,reason:t.playabilityStatus.reason||"",embeddable:!!t.playabilityStatus.playableInEmbed||!1,audio_only_playablility:ue(t.playabilityStatus.audioOnlyPlayability,J_),error_screen:ue(t.playabilityStatus.errorScreen)}:null;if(qn&&(C.playability_status=qn),t.streamingData){let tt=new Map,Ae={expires:new Date(Date.now()+parseInt(t.streamingData.expiresInSeconds)*1e3),formats:Ob(t.streamingData.formats,tt),adaptive_formats:Ob(t.streamingData.adaptiveFormats,tt),dash_manifest_url:t.streamingData.dashManifestUrl||null,hls_manifest_url:t.streamingData.hlsManifestUrl||null};C.streaming_data=Ae}if(t.playerConfig){let tt={a
`)}`:" (none)";return U.warn(NP,`Fetch:
url: ${i.toString()}
method: ${(e==null?void 0:e.method)||"GET"}
headers:
${l}
' +
' body:
${r}`),L.shim.fetch(t,e)},"debugFetch");function dt(t){return btoa(String.fromCharCode.apply(null,Array.from(t)))}n(dt,"u8ToBase64");function Tb(t){return new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0)))}n(Tb,"base64ToU8");function nt(t){return!("emoji"in t)}n(nt,"isTextRun");function qb(t){return y(this,void 0,void 0,function*(){let e=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function i(o){let s=new Uint8Array(o),r=[];for(let l=0;l<s.length;++l)r.push(e[s[l]]);return r.join("")}return n(i,"hex"),i(yield crypto.subtle.digest("SHA-1",new TextEncoder().encode(t)))})}n(qb,"sha1Hash");var my={name:"youtubei.js",version:"9.4.0",description:"A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).",type:"module",types:"./dist/src/platform/lib.d.ts",typesVersions:{"*":{agnostic:["./dist/src/platform/lib.d.ts"],web:["./dist/src/platform/lib.d.ts"],"web.bundle":["./dist/src/platform/lib.d.ts"],"web.bundle.min":["./dist/src/platform/lib.d.ts"],"cf-worker":["./dist/src/platform/lib.d.ts"]}},exports:{".":{node:{import:"./dist/src/platform/node.js",require:"./bundle/node.cjs"},deno:"./dist/src/platform/deno.js",types:"./dist/src/platform/lib.d.ts",browser:"./dist/src/platform/web.js",default:"./dist/src/platform/web.js"},"./agnostic":{types:"./dist/src/platform/lib.d.ts",default:"./dist/src/platform/lib.js"},"./web":{types:"./dist/src/platform/lib.d.ts",default:"./dist/src/platform/web.js"},"./web.bundle":{types:"./dist/src/platform/lib.d.ts",default:"./bundle/browser.js"},"./web.bundle.min":{types:"./dist/src/platform/lib.d.ts",default:"./bundle/browser.min.js"},"./cf-worker":{types:"./dist/src/platform/lib.d.ts",default:"./dist/src/platform/cf-worker.js"}},author:"LuanRT <luan.lrt4@gmail.com> (https://github.com/LuanRT)",funding:["https://github.com/sponsors/LuanRT"],contributors:["Wykerd (https://github.com/wykerd/)","MasterOfBob777 (https://github.com/MasterOfBob777)","patrickkfkan (https://github.com/patrickkfkan)","akkadaska (https://github.com/akkadaska)","Absidue (https://github.com/absidue)"],directories:{test:"./test",examples:"./examples",dist:"./dist"},scripts:{test:"npx jest --verbose",lint:"npx eslint ./src","lint:fix":"npx eslint --fix ./src",build:"npm run build:parser-map && npm run build:proto && npm run build:esm && npm run bundle:node && npm run bundle:browser && npm run bundle:browser:prod && npm run bundle:cf-worker","build:parser-map":"node ./scripts/gen-parser-map.mjs","build:proto":'npx pb-gen-ts --entry-path="src/proto" --out-dir="src/proto/generated" --ext-in-import=".js"',"build:esm":"npx tspc","build:deno":`npx cpy ./src ./deno && npx esbuild ./src/utils/DashManifest.tsx --keep-names --format=esm --platform=neutral --target=es2020 --outfile=./deno/src/utils/DashManifest.js && npx cpy ./package.json ./deno && npx replace ".js'
If this is causing unexpected behavior, please report it at https://github.com/LuanRT/Jinter/issues/new`),i},"_Visitor_getNode");var OP=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],T1=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,3104,541,1507,4938,6,4191],DP="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-
Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),x1(e.onToken)){var o=e.onToken;e.onToken=function(s){return o.push(s)}}return x1(e.onComment)&&(e.onComment=GP(e,e.onComment)),e}n(JP,"getOptions");function GP(t,e){return function(i,o,s,r,l,p){var f={type:i?"Block":"Line",value:o,start:s,end:r};t.locations&&(f.loc=new yy(this,l,p)),t.ranges&&(f.range=[s,r]),e.push(f)}}n(GP,"pushComment");var u_=1,ra=2,uw=4,P1=8,N1=16,A1=32,lw=64,R1=128,c_=256,cw=u_|ra|c_;function dw(t,e){return ra|(t?uw:0)|(e?P1:0)}n(dw,"functionFlags");var vy=0,pw=1,Ri=2,M1=3,V1=4,O1=5,Be=n(function(e,i,o){this.options=e=JP(e),this.sourceFile=e.sourceFile,this.keywords=yo(LP[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var s="";e.allowReserved!==!0&&(s=tw[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(s+=" await")),this.reservedWords=yo(s);var r=(s?s+" ":"")+tw.strict;this.reservedWordsStrict=yo(r),this.reservedWordsStrictBind=yo(r+" "+tw.strictBind),this.input=String(i),this.containsEsc=!1,o?(this.pos=o,this.lineStart=this.input.lastIndexOf(`
`,o-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(Ot).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=_.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(u_),this.regexpState=null,this.privateNameStack=[]},"Parser"),hi={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Be.prototype.parse=n(function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},"parse");hi.inFunction.get=function(){return(this.currentVarScope().flags&ra)>0};hi.inGenerator.get=function(){return(this.currentVarScope().flags&P1)>0&&!this.currentVarScope().inClassFieldInit};hi.inAsync.get=function(){return(this.currentVarScope().flags&uw)>0&&!this.currentVarScope().inClassFieldInit};hi.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t];if(e.inClassFieldInit||e.flags&c_)return!1;if(e.flags&ra)return(e.flags&uw)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};hi.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags,i=t.inClassFieldInit;return(e&lw)>0||i||this.options.allowSuperOutsideMethod};hi.allowDirectSuper.get=function(){return(this.currentThisScope().flags&R1)>0};hi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};hi.allowNewDotTarget.get=function(){var t=this.currentThisScope(),e=t.flags,i=t.inClassFieldInit;return(e&(ra|c_))>0||i};hi.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&c_)>0};Be.extend=n(function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];for(var o=this,s=0;s<e.length;s++)o=e[s](o);return o},"extend");Be.parse=n(function(e,i){return new this(i,e).parse()},"parse");Be.parseExpressionAt=n(function(e,i,o){var s=new this(o,e,i);return s.nextToken(),s.parseExpression()},"parseExpressionAt");Be.tokenizer=n(function(e,i){return new this(i,e)},"tokenizer");Object.defineProperties(Be.prototype,hi);var at=Be.prototype,zP=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;at.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){Mt.lastIndex=t,t+=Mt.exec(this.input)[0].length;var e=zP.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){Mt.lastIndex=t+e[0].length;var i=Mt.exec(this.input),o=i.index+i[0].length,s=this.input.charAt(o);return s===";"||s==="}"||Ot.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(o+1)==="=")}t+=e[0].length,Mt.lastIndex=t,t+=Mt.exec(this.input)[0].length,this.input[t]===";"&&t++}};at.eat=function(t){return this.type===t?(this.next(),!0):!1};at.isContextual=function(t){return this.type===_.name&&this.value===t&&!this.containsEsc};at.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};at.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};at.canInsertSemicolon=function(){return this.type===_.eof||this.type===_.braceR||Ot.test(this.input.slice(this.lastTokEnd,this.start))};at.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};at.semicolon=function(){!this.eat(_.semi)&&!this.insertSemicolon()&&this.unexpected()};at.afterTrailingComma=function(t,e){if(this.type===t)ret
`),cooked:this.value},this.next(),i.tail=this.type===_.backQuote,this.finishNode(i,"TemplateElement")};G.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=!1);var i=this.startNode();this.next(),i.expressions=[];var o=this.parseTemplateElement({isTagged:e});for(i.quasis=[o];!o.tail;)this.type===_.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(_.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(_.braceR),i.quasis.push(o=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(i,"TemplateLiteral")};G.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===_.name||this.type===_.num||this.type===_.string||this.type===_.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===_.star)&&!Ot.test(this.input.slice(this.lastTokEnd,this.start))};G.parseObj=function(t,e){var i=this.startNode(),o=!0,s={};for(i.properties=[],this.next();!this.eat(_.braceR);){if(o)o=!1;else if(this.expect(_.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(_.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,s,e),i.properties.push(r)}return this.finishNode(i,t?"ObjectPattern":"ObjectExpression")};G.parseProperty=function(t,e){var i=this.startNode(),o,s,r,l;if(this.options.ecmaVersion>=9&&this.eat(_.ellipsis))return t?(i.argument=this.parseIdent(!1),this.type===_.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,e),this.type===_.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(t||e)&&(r=this.start,l=this.startLoc),t||(o=this.eat(_.star)));var p=this.containsEsc;return this.parsePropertyName(i),!t&&!p&&this.options.ecmaVersion>=8&&!o&&this.isAsyncProp(i)?(s=!0,o=this.options.ecmaVersion>=9&&this.eat(_.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,t,o,s,r,l,e,p),this.finishNode(i,"Property")};G.parseGetterSetter=function(t){t.kind=t.key.name,this.parsePropertyName(t),t.value=this.parseMethod(!1);var e=t.kind==="get"?0:1;if(t.value.params.length!==e){var i=t.value.start;t.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};G.parsePropertyValue=function(t,e,i,o,s,r,l,p){(i||o)&&this.type===_.colon&&this.unexpected(),this.eat(_.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,l),t.kind="init"):this.options.ecmaVersion>=6&&this.type===_.parenL?(e&&this.unexpected(),t.kind="init",t.method=!0,t.value=this.parseMethod(i,o)):!e&&!p&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==_.comma&&this.type!==_.braceR&&this.type!==_.eq?((i||o)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((i||o)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),t.kind="init",e?t.value=this.parseMaybeDefault(s,r,this.copyNode(t.key)):this.type===_.eq&&l?(l.shorthandAssign<0&&(l.shorthandAssign=this.start),t.value=this.parseMaybeDefault(s,r,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.shorthand=!0):this.unexpected()};G.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(_.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(_.bracketR),t.key;t.computed=!1}return t.key=this.type===_.num||this.type===_.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};G.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};G.parseMethod=function(t,e,i){var o=this.startNode(),s=this
`;break;default:t+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};oe.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(_.invalidTemplate,this.input.slice(this.start,this.pos))}this.raise(this.start,"Unterminated template")};oe.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return bo(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(o,8);return s>255&&(o=o.slice(0,-1),s=parseInt(o,8)),this.pos+=o.length-1,e=this.input.charCodeAt(this.pos),(o!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-o.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return sa(e)?"":String.fromCharCode(e)}};oe.readHexChar=function(t){var e=this.pos,i=this.readInt(16,t);return i===null&&this.invalidStringToken(e,"Bad character escape sequence"),i};oe.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,i=this.pos,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(na(s,o))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,t+=this.input.slice(i,this.pos);var r=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var l=this.readCodePoint();(e?Ni:na)(l,o)||this.invalidStringToken(r,"Invalid Unicode escape"),t+=bo(l),i=this.pos}else break;e=!1}return t+this.input.slice(i,this.pos)};oe.readWord=function(){var t=this.readWord1(),e=_.name;return this.keywords.test(t)&&(e=aw[t]),this.finishToken(e,t)};var hN="8.10.0";Be.acorn={Parser:Be,version:hN,defaultOptions:sw,Position:a_,SourceLocation:yy,getLineInfo:E1,Node:wy,TokenType:ce,tokTypes:_,keywordTypes:aw,TokContext:$t,tokContexts:Ie,isIdentifierChar:na,isIdentifierStart:Ni,Token:mw,isNewLine:sa,lineBreak:Ot,lineBreakG:jP,nonASCIIwhitespace:S1};function sC(t,e){return Be.parse(t,e)}n(sC,"parse");var _N=function(t,e,i,o,s){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?s.call(t,i):s?s.value=i:e.set(t,i),i},vN=function(t,e,i,o){if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?o:i==="a"?o.call(t):o?o.value:e.get(t)},Iy,Fn=class{constructor(e){Iy.set(this,void 0);let i=sC(e,{ecmaVersion:2020});_N(this,Iy,i.body,"f"),this.visitor=new oa(vN(this,Iy,"f")),this.scope=this.visitor.scope,this.scope.set("print",o=>console.log(...o)),this.visitor.on("console",(o,s)=>{if(o.type==="Identifier")return console;if(o.type==="CallExpression"&&o.callee.type==="MemberExpression"){let r=s.visitNode(o.callee.property),l=o.arguments.map(f=>s.visitNode(f)),p=console[r];return p?p(...l):"proceed"}return"proceed"}),this.visitor.on("Math",(o,s)=>{if(o.type==="Identifier")return Math;if(o.type==="CallExpression"&&o.callee.type==="MemberExpression"){let r=s.visitNode(o.callee.property),l=o.arguments.map(f=>s.visitNode(f)),p=Math[r];return p?p(...l):"proceed"}return"proceed"}),this.visitor.on("String",(o,s)=>{if(o.type==="Identifier")return String;if(o.type==="CallExpression"&&o.callee.type==="MemberExpression"){let r=s.visitNode(o.callee.property),l=o.arguments.map(f=>s.visitNode(f)),p=String[r];return p?p(l):"proceed"}return"proceed"}),this.visitor.on("Date",o=>{if(o.type==="Identifier")return Date})}interpret(){return this.visitor.run()}};n(Fn,"Jinter");Iy=new WeakMap;var Mi,Kt,Oe,we,ky,aC,_w,rC,uC,hw,To=class{constructor(e){Mi.add(this),Kt.set(this,void 0),Oe.set(this,void 0),we.set(this,void 0),ky.set
`),{client_id:d(this,we,"f").client_id,client_secret:this.credentials.client_secret};let r=yield(yield d(this,Oe,"f").http.fetch_function(new URL("/tv",X.URLS.YT_BASE),{headers:X.OAUTH.HEADERS})).text(),l=(o=X.OAUTH.REGEX.AUTH_SCRIPT.exec(r))===null||o===void 0?void 0:o[1];if(!l)throw new mi("Could not obtain script url.",{status:"FAILED"});U.info(To.TAG,`Got YouTubeTV script URL (${l})`);let f=(yield(yield d(this,Oe,"f").http.fetch(l,{baseURL:X.URLS.YT_BASE})).text()).replace(/\n/g,"").match(X.OAUTH.REGEX.CLIENT_IDENTITY),h=f==null?void 0:f.groups;if(!h)throw new mi("Could not obtain client identity.",{status:"FAILED"});return U.info(To.TAG,`OAuth2 credentials retrieved.
`,h),h})},"_OAuth_getClientIdentity");To.TAG="OAuth";var vw=To;var p_,Yn,lC,cC,dC,Sy=class{constructor(e){p_.add(this),Yn.set(this,void 0),I(this,Yn,e,"f")}get session(){return d(this,Yn,"f")}stats(e,i,o){return y(this,void 0,void 0,function*(){let s=new URL(e);s.searchParams.set("ver","2"),s.searchParams.set("c",i.client_name.toLowerCase()),s.searchParams.set("cbrver",i.client_version),s.searchParams.set("cver",i.client_version);for(let l of Object.keys(o))s.searchParams.set(l,o[l]);return yield d(this,Yn,"f").http.fetch(s)})}execute(e,i){var o,s;return y(this,void 0,void 0,function*(){let r;if(i&&!i.protobuf){if(r=Object.assign({},i),Reflect.has(r,"browseId")&&d(this,p_,"m",dC).call(this,r.browseId)&&!d(this,Yn,"f").logged_in)throw new v("You must be signed in to perform this operation.");Reflect.has(r,"override_endpoint")&&delete r.override_endpoint,Reflect.has(r,"parse")&&delete r.parse,Reflect.has(r,"request")&&delete r.request,Reflect.has(r,"clientActions")&&delete r.clientActions,Reflect.has(r,"settingItemIdForClient")&&delete r.settingItemIdForClient,Reflect.has(r,"action")&&(r.actions=[r.action],delete r.action),Reflect.has(r,"boolValue")&&(r.newValue={boolValue:r.boolValue},delete r.boolValue),Reflect.has(r,"token")&&(r.continuation=r.token,delete r.token),(r==null?void 0:r.client)==="YTMUSIC"&&(r.isAudioOnly=!0)}else i&&(r=i.serialized_data);let l=Reflect.has(i||{},"override_endpoint")?i==null?void 0:i.override_endpoint:e,p=yield d(this,Yn,"f").http.fetch(l,{method:"POST",body:i!=null&&i.protobuf?r:JSON.stringify(r||{}),headers:{"Content-Type":i!=null&&i.protobuf?"application/x-protobuf":"application/json"}});if(i!=null&&i.parse){let f=c.parseResponse(yield p.json());if(d(this,p_,"m",cC).call(this,f)&&((s=(o=f.on_response_received_actions)===null||o===void 0?void 0:o.first())===null||s===void 0?void 0:s.type)==="navigateAction"){let h=f.on_response_received_actions.firstOfType(io);h&&(f=yield h.endpoint.call(this,{parse:!0}))}return f}return d(this,p_,"m",lC).call(this,p)})}};n(Sy,"Actions");Yn=new WeakMap,p_=new WeakSet,lC=n(function(e){return y(this,void 0,void 0,function*(){return{success:e.ok,status_code:e.status,data:JSON.parse(yield e.text())}})},"_Actions_wrap"),cC=n(function(e){return"on_response_received_actions"in e},"_Actions_isBrowse"),dC=n(function(e){return["FElibrary","FEhistory","FEsubscriptions","FEchannels","FEplaylist_aggregation","FEmusic_listening_review","FEmusic_library_landing","SPaccount_overview","SPaccount_notifications","SPaccount_privacy","SPtime_watched"].includes(e)},"_Actions_needsLogin");var gw=Sy;var ua,la,f_,m_,Ee=class{constructor(e,i,o,s){ua.set(this,void 0),la.set(this,void 0),f_.set(this,void 0),m_.set(this,void 0),I(this,ua,o,"f"),I(this,la,i,"f"),I(this,f_,e,"f"),I(this,m_,s,"f")}static create(e,i=L.shim.fetch){return y(this,void 0,void 0,function*(){let o=new URL("/iframe_api",X.URLS.YT_BASE),s=yield i(o);if(s.status!==200)throw new zt("Failed to request player id");let r=yield s.text(),l=Ye(r,"player\\/","\\/");if(U.info(Ee.TAG,`Got player id (${l}). Checking for cached players..`),!l)throw new zt("Failed to get player id");if(e){U.info(Ee.TAG,"Found a cached player.");let T=yield Ee.fromCache(e,l);if(T)return T}let p=new URL(`/s/player/${l}/player_ias.vflset/en_US/base.js`,X.URLS.YT_BASE);U.info(Ee.TAG,`Could not find any cached player. Will download a new player from ${p}.`);let f=yield i(p,{headers:{"user-agent":Ao("desktop")}});if(!f.ok)throw new zt(`Failed to get player data: ${f.status}`);let h=yield f.text(),m=this.extractSigTimestamp(h),b=this.extractSigSourceCode(h),x=this.extractNSigSourceCode(h);return U.info(Ee.TAG,`Got signature timestamp (${m}) and algorithms needed to decipher signatures.`),yield Ee.fromSource(e,m,b,x,l)})}decipher(e,i,o,s){if(e=e||i||o,!e)throw new zt("No valid URL to decipher");let r=new URLSearchParams(e),l=new URL(r.get("url")||e);if(i||o){let m=L.shim.eval(d(this,la,"f"),{sig:r.get("s")});if(U.info(Ee.TAG,`Transformed signature ${r.get("s")} to ${m}.`),typeof m!="string")throw new zt("Failed to decipher signature");let b=r.get("sp
Changing the InnerTube client to "ANDROID" might help!`):s&&s.set(p,m)}l.searchParams.set("n",m)}switch(l.searchParams.get("c")){case"WEB":l.searchParams.set("cver",X.CLIENTS.WEB.VERSION);break;case"WEB_REMIX":l.searchParams.set("cver",X.CLIENTS.YTMUSIC.VERSION);break;case"WEB_KIDS":l.searchParams.set("cver",X.CLIENTS.WEB_KIDS.VERSION);break;case"ANDROID":l.searchParams.set("cver",X.CLIENTS.ANDROID.VERSION);break;case"ANDROID_MUSIC":l.searchParams.set("cver",X.CLIENTS.YTMUSIC_ANDROID.VERSION);break;case"TVHTML5_SIMPLY_EMBEDDED_PLAYER":l.searchParams.set("cver",X.CLIENTS.TV_EMBEDDED.VERSION);break}let h=l.toString();return U.info(Ee.TAG,`Full deciphered URL: ${h}`),l.toString()}static fromCache(e,i){return y(this,void 0,void 0,function*(){let o=yield e.get(i);if(!o)return null;let s=new DataView(o);if(s.getUint32(0,!0)!==Ee.LIBRARY_VERSION)return null;let l=s.getUint32(4,!0),p=s.getUint32(8,!0),f=o.slice(12,12+p),h=o.slice(12+p),m=new TextDecoder,b=m.decode(f),x=m.decode(h);return new Ee(l,b,x,i)})}static fromSource(e,i,o,s,r){return y(this,void 0,void 0,function*(){let l=new Ee(i,o,s,r);return yield l.cache(e),l})}cache(e){return y(this,void 0,void 0,function*(){if(!e)return;let i=new TextEncoder,o=i.encode(d(this,la,"f")),s=i.encode(d(this,ua,"f")),r=new ArrayBuffer(12+o.byteLength+s.byteLength),l=new DataView(r);l.setUint32(0,Ee.LIBRARY_VERSION,!0),l.setUint32(4,d(this,f_,"f"),!0),l.setUint32(8,o.byteLength,!0),new Uint8Array(r).set(o,12),new Uint8Array(r).set(s,12+o.byteLength),yield e.set(d(this,m_,"f"),new Uint8Array(r))})}static extractSigTimestamp(e){return parseInt(Ye(e,"signatureTimestamp:",",")||"0")}static extractSigSourceCode(e){var i,o,s;let r=Ye(e,'function(a){a=a.split("")','return a.join("")}'),l=(s=(o=(i=r==null?void 0:r.split(/\.|\[/))===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.replace(";",""))===null||s===void 0?void 0:s.trim(),p=Ye(e,`var ${l}={`,"};");return(!p||!r)&&U.warn(Ee.TAG,"Failed to extract signature decipher algorithm."),`function descramble_sig(a) { a = a.split(""); let ${l}={${p}}${r} return a.join("") } descramble_sig(sig);`}static extractNSigSourceCode(e){let i=`function descramble_nsig(a) { let b=a.split("")${Ye(e,'b=a.split("")','}return b.join("")}')}} return b.join(""); } descramble_nsig(nsig)`;return i||U.warn(Ee.TAG,"Failed to extract n-token decipher algorithm"),i}get url(){return new URL(`/s/player/${d(this,m_,"f")}/player_ias.vflset/en_US/base.js`,X.URLS.YT_BASE).toString()}get sts(){return d(this,f_,"f")}get nsig_sc(){return d(this,ua,"f")}get sig_sc(){return d(this,la,"f")}static get LIBRARY_VERSION(){return 2}};n(Ee,"Player");ua=new WeakMap,la=new WeakMap,f_=new WeakMap,m_=new WeakMap;Ee.TAG="Player";var xw=Ee;var ca,Cy,Ey,jn,Py,Ny,yw,pC,bw,ww;(function(t){t.WEB="WEB",t.KIDS="WEB_KIDS",t.MUSIC="WEB_REMIX",t.IOS="iOS",t.ANDROID="ANDROID",t.ANDROID_MUSIC="ANDROID_MUSIC",t.ANDROID_CREATOR="ANDROID_CREATOR",t.TV_EMBEDDED="TVHTML5_SIMPLY_EMBEDDED_PLAYER"})(ww||(ww={}));var bt=class extends pa{constructor(e,i,o,s,r,l,p,f){super(),Cy.set(this,void 0),Ey.set(this,void 0),jn.set(this,void 0),Py.set(this,void 0),Ny.set(this,void 0),I(this,jn,e,"f"),I(this,Py,s,"f"),I(this,Ey,i,"f"),I(this,Cy,o,"f"),I(this,Ny,r,"f"),this.http=new Zy(this,l,p),this.actions=new gw(this),this.oauth=new vw(this),this.logged_in=!!l,this.cache=f}on(e,i){super.on(e,i)}once(e,i){super.once(e,i)}static create(e={}){return y(this,void 0,void 0,function*(){let{context:i,api_key:o,api_version:s,account_index:r}=yield bt.getSessionData(e.lang,e.location,e.account_index,e.visitor_data,e.enable_safety_mode,e.generate_session_locally,e.device_category,e.client_type,e.timezone,e.fetch,e.on_behalf_of_user);return new bt(i,o,s,r,e.retrieve_player===!1?void 0:yield xw.create(e.cache,e.fetch),e.cookie,e.fetch,e.cache)})}static getSessionData(e="",i="",o=0,s="",r=!1,l=!1,p="desktop",f=ww.WEB,h=Intl.DateTimeFormat().resolvedOptions().timeZone,m=L.shim.fetch,b){return y(this,void 0,void 0,function*(){let x,T={lang:e,location:i,time_zone:h,device_category:p,client_name:f,enable_safety_mode:r,visitor_data:s,on
`,x),Object.assign(Object.assign({},x),{account_index:o})})}signIn(e){return y(this,void 0,void 0,function*(){return new Promise((i,o)=>y(this,void 0,void 0,function*(){let s=n(r=>o(r),"error_handler");this.once("auth",r=>{this.off("auth-error",s),r.status==="SUCCESS"&&(this.logged_in=!0,i()),o(r)}),this.once("auth-error",s);try{yield this.oauth.init(e),this.oauth.validateCredentials()&&(yield this.oauth.refreshIfRequired(),this.logged_in=!0,i())}catch(r){o(r)}}))})}signOut(){return y(this,void 0,void 0,function*(){if(!this.logged_in)throw new v("You must be signed in to perform this operation.");let e=yield this.oauth.revokeCredentials();return this.logged_in=!1,e})}get key(){return d(this,Ey,"f")}get api_version(){return d(this,Cy,"f")}get client_version(){return d(this,jn,"f").client.clientVersion}get client_name(){return d(this,jn,"f").client.clientName}get account_index(){return d(this,Py,"f")}get context(){return d(this,jn,"f")}get player(){return d(this,Ny,"f")}get lang(){return d(this,jn,"f").client.hl}};n(bt,"Session");ca=bt,Cy=new WeakMap,Ey=new WeakMap,jn=new WeakMap,Py=new WeakMap,Ny=new WeakMap,yw=n(function(e){let i=db(e);return U.info(bt.TAG,`Custom visitor data decoded successfully.
`,i),i.id},"_Session_getVisitorID"),pC=n(function(e,i=L.shim.fetch){return y(this,void 0,void 0,function*(){let o=new URL("/sw.js_data",lt.YT_BASE),s=Nt(11);e.visitor_data&&(s=d(this,ca,"m",yw).call(this,e.visitor_data));let r=yield i(o,{headers:{"accept-language":e.lang||"en-US","user-agent":Ao("desktop"),accept:"*/*",referer:"https://www.youtube.com/sw.js",cookie:`PREF=tz=${e.time_zone.replace("/",".")};VISITOR_INFO1_LIVE=${s};`}});if(!r.ok)throw new wr(`Failed to retrieve session data: ${r.status}`);let l=yield r.text(),f=JSON.parse(l.replace(/^\)\]\}'/,""))[0][2],h=ae.WEB.API_VERSION,[[m],b]=f,x={client:{hl:m[0],gl:e.location||m[2],remoteHost:m[3],screenDensityFloat:1,screenHeightPoints:1080,screenPixelDensity:1,screenWidthPoints:1920,visitorData:m[13],clientName:e.client_name,clientVersion:m[16],osName:m[17],osVersion:m[18],platform:e.device_category.toUpperCase(),clientFormFactor:"UNKNOWN_FORM_FACTOR",userInterfaceTheme:"USER_INTERFACE_THEME_LIGHT",timeZone:m[79]||e.time_zone,browserName:m[86],browserVersion:m[87],originalUrl:lt.YT_BASE,deviceMake:m[11],deviceModel:m[12],utcOffsetMinutes:-new Date().getTimezoneOffset()},user:{enableSafetyMode:e.enable_safety_mode,lockedSafetyMode:!1},request:{useSsl:!0,internalExperimentFlags:[]}};return e.on_behalf_of_user&&(x.user.onBehalfOfUser=e.on_behalf_of_user),{context:x,api_key:b,api_version:h}})},"_Session_retrieveSessionData"),bw=n(function(e){let i=Nt(11);e.visitor_data&&(i=d(this,ca,"m",yw).call(this,e.visitor_data));let o={client:{hl:e.lang||"en",gl:e.location||"US",screenDensityFloat:1,screenHeightPoints:1080,screenPixelDensity:1,screenWidthPoints:1920,visitorData:cb(i,Math.floor(Date.now()/1e3)),clientName:e.client_name,clientVersion:ae.WEB.VERSION,osName:"Windows",osVersion:"10.0",platform:e.device_category.toUpperCase(),clientFormFactor:"UNKNOWN_FORM_FACTOR",userInterfaceTheme:"USER_INTERFACE_THEME_LIGHT",timeZone:e.time_zone,originalUrl:lt.YT_BASE,deviceMake:"",deviceModel:"",utcOffsetMinutes:-new Date().getTimezoneOffset()},user:{enableSafetyMode:e.enable_safety_mode,lockedSafetyMode:!1},request:{useSsl:!0,internalExperimentFlags:[]}};return e.on_behalf_of_user&&(o.user.onBehalfOfUser=e.on_behalf_of_user),{context:o,api_key:ae.WEB.API_KEY,api_version:ae.WEB.API_VERSION}},"_Session_generateSessionData");bt.TAG="Session";var Tw=bt;var Iw={};B(Iw,{Kids:()=>Ry,Music:()=>Oy,Studio:()=>Ly});var Qe,Ay=class{constructor(e){Qe.set(this,void 0),I(this,Qe,e,"f")}search(e){return y(this,void 0,void 0,function*(){let i=yield d(this,Qe,"f").actions.execute(yt.PATH,yt.build({client:"YTKIDS",query:e}));return new Gx(d(this,Qe,"f").actions,i)})}getInfo(e){var i;return y(this,void 0,void 0,function*(){let o=st.build({sts:(i=d(this,Qe,"f").player)===null||i===void 0?void 0:i.sts,client:"YTKIDS",video_id:e}),s=Ce.build({video_id:e,client:"YTKIDS"}),r=d(this,Qe,"f").actions.execute(st.PATH,o),l=d(this,Qe,"f").actions.execute(Ce.PATH,s),p=yield Promise.all([r,l]),f=Nt(16);return new $x(p,d(this,Qe,"f").actions,f)})}getChannel(e){return y(this,void 0,void 0,function*(){let i=yield d(this,Qe,"f").actions.execute(F.PATH,F.build({browse_id:e,client:"YTKIDS"}));return new Wx(d(this,Qe,"f").actions,i)})}getHomeFeed(){return y(this,void 0,void 0,function*(){let e=yield d(this,Qe,"f").actions.execute(F.PATH,F.build({browse_id:"FEkids_home",client:"YTKIDS"}));return new Hx(d(this,Qe,"f").actions,e)})}blockChannel(e){var i,o;return y(this,void 0,void 0,function*(){if(!d(this,Qe,"f").logged_in)throw new v("You must be signed in to perform this operation.");let s=Dn.build({channel_id:e}),p={contents:(yield d(this,Qe,"f").actions.execute(Dn.PATH,s)).data.command.confirmDialogEndpoint.content,engagementPanels:[]},h=(i=c.parseResponse(p).contents_memo)===null||i===void 0?void 0:i.getType(Us);if(!h)throw new v("Could not find any kids profiles or supervised accounts.");let m=[];for(let b of h)!((o=b.block_button)===null||o===void 0)&&o.is_toggled||(b.setActions(d(this,Qe,"f").actions),m.push(yield b.blockChannel()));return m})}};n(Ay,"Kids");Qe=new WeakMap;var Ry=Ay;var My,h_,pe,fC,mC,Vy=class{cons
`,t);let i=new Fn(t);for(let[s,r]of Object.entries(e))i.scope.set(s,r);let o=i.interpret();return U.info(yC,"Done. Result:",o),o}n(Cw,"evaluate");var v_,Ew,Hy,Jy,Gy,zy=class{constructor(e=!1,i){v_.add(this),Ew.set(this,"Cache"),Hy.set(this,void 0),Jy.set(this,void 0),I(this,Hy,i||"","f"),I(this,Jy,e,"f")}get cache_dir(){return d(this,Jy,"f")?d(this,Hy,"f"):""}get(e){return y(this,void 0,void 0,function*(){let i=yield d(this,v_,"m",Gy).call(this);if(!!i)return new Promise((o,s)=>{let r=i.transaction("kv-store","readonly").objectStore("kv-store").get(e);r.onerror=s,r.onsuccess=function(){var l;let p=(l=this.result)===null||l===void 0?void 0:l.v;p instanceof ArrayBuffer?o(p):ArrayBuffer.isView(p)?o(p.buffer):o(void 0)}})})}set(e,i){return y(this,void 0,void 0,function*(){let o=yield d(this,v_,"m",Gy).call(this);if(!!o)return new Promise((s,r)=>{let l=o.transaction("kv-store","readwrite").objectStore("kv-store").put({k:e,v:i});l.onerror=r,l.onsuccess=()=>s()})})}remove(e){return y(this,void 0,void 0,function*(){let i=yield d(this,v_,"m",Gy).call(this);if(!!i)return new Promise((o,s)=>{let r=i.transaction("kv-store","readwrite").objectStore("kv-store").delete(e);r.onerror=s,r.onsuccess=()=>o()})})}};n(zy,"Cache");Ew=new WeakMap,Hy=new WeakMap,Jy=new WeakMap,v_=new WeakSet,Gy=n(function(){let e=Reflect.get(globalThis,"indexedDB")||Reflect.get(globalThis,"webkitIndexedDB")||Reflect.get(globalThis,"mozIndexedDB")||Reflect.get(globalThis,"msIndexedDB");return e?new Promise((i,o)=>{let s=e.open("youtubei.js",1);s.onsuccess=function(){i(this.result)},s.onerror=function(r){o("indexedDB request error"),console.error(r)},s.onupgradeneeded=function(){let r=this.result.createObjectStore("kv-store",{keyPath:"k"});r.transaction.oncomplete=function(){i(this.db)}}}):U.warn(d(this,Ew,"f"),"IndexedDB is not supported. No cache will be used.")},"_Cache_getBrowserDB");L.load({runtime:"browser",server:!1,info:{version:my.version,bugs_url:my.bugs.url,repo_url:my.homepage.split("#")[0]},Cache:zy,sha1Hash:qb,uuidv4(){var t;return!((t=globalThis.crypto)===null||t===void 0)&&t.randomUUID()?globalThis.crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>{let i=parseInt(e);return(i^window.crypto.getRandomValues(new Uint8Array(1))[0]&15>>i/4).toString(16)})},eval:Cw,fetch:globalThis.fetch,Request:globalThis.Request,Response:globalThis.Response,Headers:globalThis.Headers,FormData:globalThis.FormData,File:globalThis.File,ReadableStream:globalThis.ReadableStream,CustomEvent:globalThis.CustomEvent});var jNe=xC;export{gw as Actions,Mo as AppendContinuationItemsAction,ww as ClientType,Iw as Clients,X as Constants,Xo as Continuation,Ti as ContinuationCommand,Gb as Endpoints,pa as EventEmitter,No as FormatUtils,Rb as Generator,so as GridContinuation,Zy as HTTPClient,qy as Helpers,Sw as Innertube,to as ItemSectionContinuation,ro as LiveChatContinuation,U as Log,kw as Managers,$b as Misc,Fb as Mixins,no as MusicPlaylistShelfContinuation,li as MusicShelfContinuation,io as NavigateAction,vw as OAuth,c as Parser,L as Platform,xw as Player,Js as PlaylistPanelContinuation,St as Proto,oo as ReloadContinuationItemsCommand,pt as SectionListContinuation,Tw as Session,Hs as ShowMiniplayerCommand,gC as Types,TC as UniversalCache,tb as Utils,Ub as YT,Jb as YTKids,Hb as YTMusic,Ho as YTNodes,zb as YTShorts,jNe as default};
//# sourceMappingURL=browser.min.js.map