53 lines
550 KiB
JavaScript
53 lines
550 KiB
JavaScript
/* 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 setLevel(...e){this.log_level_=e}};n(ge,"Log");Vi=ge;ge.YTJS_TAG="YOUTUBEJS";ge.Level={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4};ge.log_map_={[ge.Level.ERROR]:(...t)=>console.error(...t),[ge.Level.WARNING]:(...t)=>console.warn(...t),[ge.Level.INFO]:(...t)=>console.info(...t),[ge.Level.DEBUG]:(...t)=>console.debug(...t)};ge.log_level_=[ge.Level.WARNING];ge.one_time_warnings_issued_=new Set;ge.warnOnce=(t,...e)=>{Vi.one_time_warnings_issued_.has(t)||(Vi.doLog(ge.Level.WARNING,t,e),Vi.one_time_warnings_issued_.add(t))};ge.warn=(t,...e)=>Vi.doLog(ge.Level.WARNING,t,e);ge.error=(t,...e)=>Vi.doLog(ge.Level.ERROR,t,e);ge.info=(t,...e)=>Vi.doLog(ge.Level.INFO,t,e);ge.debug=(t,...e)=>Vi.doLog(ge.Level.DEBUG,t,e);var U=ge;var $y,Ow,Le,Ky,fe,Zt,gi,So,Dw=Symbol("ObservedArray.isObserved"),a=class{constructor(){$y.add(this),this.type=this.constructor.type}is(...e){return e.some(i=>d(this,$y,"m",Ow).call(this,i))}as(...e){if(!this.is(...e))throw new kt(`Cannot cast ${this.type} to one of ${e.map(i=>i.type).join(", ")}`);return this}hasKey(e){return Reflect.has(this,e)}key(e){if(!this.hasKey(e))throw new kt(`Missing key ${e}`);return new Co(this[e])}};n(a,"YTNode");$y=new WeakSet,Ow=n(function(e){return this.type===e.type},"_YTNode_is");a.type="YTNode";var Co=class{constructor(e){Le.add(this),Ky.set(this,"Maybe"),fe.set(this,void 0),I(this,fe,e,"f")}get typeof(){return typeof d(this,fe,"f")}string(){return d(this,Le,"m",gi).call(this,"string")}isString(){return d(this,Le,"m",Zt).call(this,"string")}number(){return d(this,Le,"m",gi).call(this,"number")}isNumber(){return d(this,Le,"m",Zt).call(this,"number")}bigint(){return d(this,Le,"m",gi).call(this,"bigint")}isBigint(){return d(this,Le,"m",Zt).call(this,"bigint")}boolean(){return d(this,Le,"m",gi).call(this,"boolean")}isBoolean(){return d(this,Le,"m",Zt).call(this,"boolean")}symbol(){return d(this,Le,"m",gi).call(this,"symbol")}isSymbol(){return d(this,Le,"m",Zt).call(this,"symbol")}undefined(){return d(this,Le,"m",gi).call(this,"undefined")}isUndefined(){return d(this,Le,"m",Zt).call(this,"undefined")}null(){if(d(this,fe,"f")!==null)throw new TypeError(`Expected null, got ${typeof d(this,fe,"f")}`);return d(this,fe,"f")}isNull(){return d(this,fe,"f")===null}object(){return d(this,Le,"m",gi).call(this,"object")}isObject(){return d(this,Le,"m",Zt).call(this,"object")}function(){return d(this,Le,"m",gi).call(this,"function")}isFunction(){return d(this,Le,"m",Zt).call(this,"function")}array(){if(!Array.isArray(d(this,fe,"f")))throw new TypeError(`Expected array, got ${typeof d(this,fe,"f")}`);return d(this,fe,"f")}arrayOfMaybe(){let e=[];return new Proxy(this.array(),{get(i,o){return Reflect.has(e,o)?Reflect.get(i,o):new Co(Reflect.get(i,o))}})}isArray(){return Array.isArray(d(this,fe,"f"))}node(){if(!(d(this,fe,"f")instanceof a))throw new TypeError(`Expected YTNode, got ${d(this,fe,"f").constructor.name}`);return d(this,fe,"f")}isNode(){return d(this,fe,"f")instanceof a}nodeOfType(...e){return this.node().as(...e)}isNodeOfType(...e){return this.isNode()&&this.node().is(...e)}observed(){if(!this.isObserved())throw new TypeError(`Expected ObservedArray, got ${typeof d(this,fe,"f")}`);return d(this,fe,"f")}isObserved(){var e;return(e=d(this,fe,"f"))===null||e===void 0?void 0:e[Dw]}parsed(){if(!(d(this,fe,"f")instanceof ei))throw new TypeError(`Expected SuperParsedResult, got ${typeof d(this,fe,"f")}`);return d(this,fe,"f")}isParsed(){return d(this,fe,"f")instanceof ei}any(){return U.warn(d(this,Ky,"f"),"This call is not meant to be used outside of debugging. Please use the specific type getter instead."),d(this,fe,"f")}instanceof(e){if(!this.isInstanceof(e))throw new TypeError(`Expected instance of ${e.name}, got ${d(this,fe,"f").constructor.name}`);return d(this,fe,"f")}isInstanceof(e){return d(this,fe,"f")instanceof e}};n(Co,"Maybe");Ky=new WeakMap,fe=new WeakMap,Le=new WeakSet,Zt=n(function(e){return typeof d(this,fe,"f")===e},"_Maybe_checkPrimative"),gi=n(function(e){if(!d(this,Le,"m",Zt).call(this,e))throw new TypeError(`Expected ${e}, got ${this.typeof}`);return d(this,fe,"f")},"_Maybe_assertPrimative");var ei=class{constructor(e){So.set(this,void 0),I(this,So,e,"f")}get is_null(){return d(this,So,"f")===null}get is_array(){return!this.is_null&&Array.isArray(d(this,So,"f"))}get is_node(){return!this.is_array}array(){if(!this.is_array)throw new TypeError("Expected an array, got a node");return d(this,So,"f")}item(){if(!this.is_node)throw new TypeError("Expected a node, got an array");return d(this,So,"f")}};n(ei,"SuperParsedResult");So=new WeakMap;function re(t){return new Proxy(t,{get(e,i){return i=="get"?(o,s)=>e.find((r,l)=>{let p=g_(o,r);return p&&s&&e.splice(l,1),p}):i==Dw?!0:i=="getAll"?(o,s)=>e.filter((r,l)=>{let p=g_(o,r);return p&&s&&e.splice(l,1),p}):i=="matchCondition"?o=>e.find(s=>o(s)):i=="filterType"?(...o)=>re(e.filter(s=>!!s.is(...o))):i=="firstOfType"?(...o)=>e.find(s=>!!s.is(...o)):i=="first"?()=>e[0]:i=="as"?(...o)=>re(e.map(s=>{if(s.is(...o))return s;throw new kt(`Expected node of any type ${o.map(r=>r.type).join(", ")}, got ${s.type}`)})):i=="remove"?o=>e.splice(o,1):Reflect.get(e,i)}})}n(re,"observe");var Oi=class extends Map{getType(...e){return e=e.flat(),re(e.flatMap(i=>this.get(i.type)||[]))}};n(Oi,"Memo");var $b={};B($b,{Author:()=>V,ChildElement:()=>n0,EmojiRun:()=>Di,Format:()=>Zg,Text:()=>u,TextRun:()=>Li,Thumbnail:()=>w,VideoDetails:()=>ao});var X={};B(X,{CLIENTS:()=>ae,INNERTUBE_HEADERS_BASE:()=>wC,OAUTH:()=>bC,STREAM_HEADERS:()=>xi,URLS:()=>lt});var lt=Object.freeze({YT_BASE:"https://www.youtube.com",YT_MUSIC_BASE:"https://music.youtube.com",YT_SUGGESTIONS:"https://suggestqueries.google.com/complete/",YT_UPLOAD:"https://upload.youtube.com/",API:Object.freeze({BASE:"https://youtubei.googleapis.com",PRODUCTION_1:"https://www.youtube.com/youtubei/",PRODUCTION_2:"https://youtubei.googleapis.com/youtubei/",STAGING:"https://green-youtubei.sandbox.googleapis.com/youtubei/",RELEASE:"https://release-youtubei.sandbox.googleapis.com/youtubei/",TEST:"https://test-youtubei.sandbox.googleapis.com/youtubei/",CAMI:"http://cami-youtubei.sandbox.googleapis.com/youtubei/",UYTFE:"https://uytfe.sandbox.google.com/youtubei/"})}),bC=Object.freeze({SCOPE:"http://gdata.youtube.com https://www.googleapis.com/auth/youtube-paid-content",GRANT_TYPE:"http://oauth.net/grant_type/device/1.0",MODEL_NAME:"ytlr::",HEADERS:Object.freeze({accept:"*/*",origin:"https://www.youtube.com","user-agent":"Mozilla/5.0 (ChromiumStylePlatform) Cobalt/Version","content-type":"application/json",referer:"https://www.youtube.com/tv","accept-language":"en-US"}),REGEX:Object.freeze({AUTH_SCRIPT:/<script id="base-js" src="(.*?)" nonce=".*?"><\/script>/,CLIENT_IDENTITY:new RegExp('var .+?={clientId:"(?<client_id>.+?)",.+?:"(?<client_secret>.+?)".+?}')})}),ae=Object.freeze({iOS:{NAME_ID:"5",NAME:"iOS",VERSION:"18.06.35",USER_AGENT:"com.google.ios.youtube/18.06.35 (iPhone; CPU iPhone OS 14_4 like Mac OS X; en_US)",DEVICE_MODEL:"iPhone10,6"},WEB:{NAME_ID:"1",NAME:"WEB",VERSION:"2.20240111.09.00",API_KEY:"AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",API_VERSION:"v1",STATIC_VISITOR_ID:"6zpwvWUNAco"},WEB_KIDS:{NAME_ID:"76",NAME:"WEB_KIDS",VERSION:"2.20230111.00.00"},YTMUSIC:{NAME_ID:"67",NAME:"WEB_REMIX",VERSION:"1.20211213.00.00"},ANDROID:{NAME_ID:"3",NAME:"ANDROID",VERSION:"18.48.37",SDK_VERSION:33,USER_AGENT:"com.google.android.youtube/18.48.37(Linux; U; Android 13; en_US; sdk_gphone64_x86_64 Build/UPB4.230623.005) gzip"},YTSTUDIO_ANDROID:{NAME_ID:"14",NAME:"ANDROID_CREATOR",VERSION:"22.43.101"},YTMUSIC_ANDROID:{NAME_ID:"21",NAME:"ANDROID_MUSIC",VERSION:"5.34.51"},TV_EMBEDDED:{NAME_ID:"85",NAME:"TVHTML5_SIMPLY_EMBEDDED_PLAYER",VERSION:"2.0"}}),xi=Object.freeze({accept:"*/*",origin:"https://www.youtube.com",referer:"https://www.youtube.com",DNT:"?1"}),wC=Object.freeze({accept:"*/*","accept-encoding":"gzip, deflate","content-type":"application/json"});var c={};B(c,{addRuntimeParser:()=>Mb,applyCommentsMutations:()=>u1,applyMutations:()=>a1,getDynamicParsers:()=>PE,getParserByName:()=>Vh,hasParser:()=>qg,parse:()=>qe,parseActions:()=>r1,parseArray:()=>Ke,parseC:()=>s1,parseFormats:()=>Ob,parseItem:()=>ue,parseLC:()=>Vb,parseRR:()=>ex,parseResponse:()=>NE,sanitizeClassName:()=>Dh,setParserErrorHandler:()=>CE,shouldIgnore:()=>n1});var Ho={};B(Ho,{AboutChannel:()=>N_,AboutChannelView:()=>P_,AccountChannel:()=>A_,AccountItemSection:()=>M_,AccountItemSectionHeader:()=>R_,AccountSectionList:()=>V_,AddBannerToLiveChatCommand:()=>WI,AddChatItemAction:()=>N0,AddLiveChatTickerItemAction:()=>HI,Alert:()=>os,AlertWithButton:()=>j_,AnalyticsMainAppKeyMetrics:()=>Xw,AnalyticsRoot:()=>Qw,AnalyticsShortsCarouselCard:()=>Zw,AnalyticsVideo:()=>W_,AnalyticsVodCarouselCard:()=>eT,AnchoredSection:()=>Jg,AppendContinuationItemsAction:()=>Mo,AttributionView:()=>H_,AudioOnlyPlayability:()=>J_,AuthorCommentBadge:()=>Ov,AutomixPreviewVideo:()=>Bi,AvatarView:()=>G_,BackstageImage:()=>z_,BackstagePost:()=>Fi,BackstagePostThread:()=>oT,BrowseFeedActions:()=>K_,BrowserMediaSession:()=>nT,Button:()=>S,ButtonView:()=>Vo,C4TabbedHeader:()=>Wi,CallToActionButton:()=>sT,Card:()=>rT,CardCollection:()=>wv,CarouselHeader:()=>Tv,CarouselItem:()=>aT,CarouselLockup:()=>vv,Channel:()=>Iv,ChannelAboutFullMetadata:()=>rl,ChannelAgeGate:()=>uT,ChannelExternalLinkView:()=>E_,ChannelFeaturedContent:()=>lT,ChannelHeaderLinks:()=>q_,ChannelHeaderLinksView:()=>X_,ChannelMetadata:()=>kv,ChannelMobileHeader:()=>cT,ChannelOptions:()=>Sv,ChannelOwnerEmptyState:()=>dT,ChannelSubMenu:()=>ml,ChannelTagline:()=>yv,ChannelThumbnailWithLink:()=>pT,ChannelVideoPlayer:()=>fT,Chapter:()=>Cv,ChildVideo:()=>mT,ChipBarView:()=>hT,ChipCloud:()=>vt,ChipCloudChip:()=>xe,ChipView:()=>Ev,ClipAdState:()=>ev,ClipCreation:()=>tv,ClipCreationScrubber:()=>Z_,ClipCreationTextInput:()=>Q_,ClipSection:()=>iv,CollaboratorInfoCardContent:()=>_T,CollageHeroImage:()=>vT,CollectionThumbnailView:()=>Mv,Command:()=>gT,Comment:()=>vs,CommentActionButtons:()=>ns,CommentDialog:()=>pI,CommentReplies:()=>Uv,CommentReplyDialog:()=>fs,CommentSimplebox:()=>Gv,CommentThread:()=>zv,CommentView:()=>$i,CommentsEntryPointHeader:()=>Jv,CommentsEntryPointTeaser:()=>Hv,CommentsHeader:()=>zi,CommentsSimplebox:()=>Wv,CompactChannel:()=>fI,CompactLink:()=>gs,CompactMix:()=>mI,CompactMovie:()=>hI,CompactPlaylist:()=>_I,CompactStation:()=>vI,CompactVideo:()=>cs,ConfirmDialog:()=>gI,ContentMetadataView:()=>bs,ContentPreviewImageView:()=>us,ContinuationItem:()=>he,ConversationBar:()=>xI,CopyLink:()=>$v,CreatePlaylistDialog:()=>I_,CreatorHeart:()=>$_,CtaGoToCreatorStudio:()=>tT,DataModelSection:()=>U_,DecoratedAvatarView:()=>Kv,DecoratedPlayerBar:()=>Zv,DefaultPromoPanel:()=>yI,DescriptionPreviewView:()=>e0,DidYouMean:()=>t0,DimChatItemAction:()=>JI,DislikeButtonView:()=>i0,DownloadButton:()=>bI,Dropdown:()=>ts,DropdownItem:()=>T_,DynamicTextView:()=>o0,Element:()=>Ts,EmergencyOnebox:()=>wI,EmojiPicker:()=>jv,EmojiPickerCategory:()=>TI,EmojiPickerCategoryButton:()=>II,EmojiPickerUpsellCategory:()=>kI,EndScreenPlaylist:()=>r0,EndScreenVideo:()=>a0,Endscreen:()=>s0,EndscreenElement:()=>SI,EngagementPanelSectionList:()=>Ui,EngagementPanelTitleHeader:()=>ov,ExpandableMetadata:()=>cv,ExpandableTab:()=>Is,ExpandableVideoDescriptionBody:()=>av,ExpandedShelfContents:()=>CI,Factoid:()=>ji,FancyDismissibleDialog:()=>EI,FeedFilterChipBar:()=>bi,FeedNudge:()=>PI,FeedTabbedHeader:()=>u0,FlexibleActionsView:()=>l0,GameCard:()=>uv,GameDetails:()=>NI,Grid:()=>Uo,GridChannel:()=>c0,GridHeader:()=>AI,GridMix:()=>RI,GridMovie:()=>MI,GridPlaylist:()=>d0,GridShow:()=>VI,GridVideo:()=>m0,GuideCollapsibleEntry:()=>OI,GuideCollapsibleSectionEntry:()=>DI,GuideDownloadsEntry:()=>LI,GuideEntry:()=>Wo,GuideSection:()=>ks,GuideSubscriptionsSection:()=>h0,HashtagHeader:()=>_0,HashtagTile:()=>BI,HeatMarker:()=>qv,Heatmap:()=>Xv,HeroPlaylistThumbnail:()=>FI,HighlightsCarousel:()=>td,HistorySuggestion:()=>YI,HorizontalCardList:()=>Yi,HorizontalList:()=>lv,HorizontalMovieList:()=>jI,IconLink:()=>g0,ImageBannerView:()=>x0,IncludingResultsFor:()=>UI,InfoPanelContainer:()=>b0,InfoPanelContent:()=>y0,InfoRow:()=>_v,InteractiveTabbedHeader:()=>w0,ItemSection:()=>ye,ItemSectionHeader:()=>Ss,ItemSectionTab:()=>T0,ItemSectionTabbedHeader:()=>Cs,KidsBlocklistPicker:()=>GS,KidsBlocklistPickerItem:()=>Us,KidsCategoriesHeader:()=>Gg,KidsCategoryTab:()=>Ws,KidsHomeScreen:()=>zg,LikeButton:()=>k0,LikeButtonView:()=>S0,LiveChat:()=>C0,LiveChatActionPanel:()=>R0,LiveChatAuthorBadge:()=>_k,LiveChatAutoModMessage:()=>GI,LiveChatBanner:()=>P0,LiveChatBannerHeader:()=>E0,LiveChatBannerPoll:()=>zI,LiveChatDialog:()=>vk,LiveChatHeader:()=>B0,LiveChatItemList:()=>F0,LiveChatMembershipItem:()=>$I,LiveChatMessageInput:()=>gk,LiveChatPaidMessage:()=>KI,LiveChatPaidSticker:()=>qI,LiveChatParticipant:()=>Y0,LiveChatParticipantsList:()=>j0,LiveChatPlaceholderItem:()=>XI,LiveChatProductItem:()=>QI,LiveChatRestrictedParticipation:()=>ZI,LiveChatTextMessage:()=>ek,LiveChatTickerPaidMessageItem:()=>A0,LiveChatTickerPaidStickerItem:()=>tk,LiveChatTickerSponsorItem:()=>ik,LiveChatViewerEngagementMessage:()=>ok,LockupMetadataView:()=>U0,LockupView:()=>W0,MacroMarkersInfoItem:()=>nv,MacroMarkersList:()=>sv,MacroMarkersListItem:()=>rs,MarkChatItemAsDeletedAction:()=>sk,MarkChatItemsByAuthorAsDeletedAction:()=>rk,Menu:()=>j,MenuNavigationItem:()=>H0,MenuPopup:()=>xk,MenuServiceItem:()=>Ki,MenuServiceItemDownload:()=>yk,MerchandiseItem:()=>Tk,MerchandiseShelf:()=>$0,Message:()=>Ge,MetadataBadge:()=>ct,MetadataRow:()=>Ik,MetadataRowContainer:()=>K0,MetadataRowHeader:()=>kk,MetadataScreen:()=>Sk,MicroformatData:()=>ii,Mix:()=>Ck,ModalWithTitleAndButton:()=>Ek,Movie:()=>Pk,MovingThumbnail:()=>Nk,MultiMarkersPlayerBar:()=>Qv,MultiPageMenu:()=>bk,MultiPageMenuNotificationSection:()=>wk,MusicCardShelf:()=>X0,MusicCardShelfHeaderBasic:()=>q0,MusicCarouselShelf:()=>Ue,MusicCarouselShelfBasicHeader:()=>Q0,MusicDescriptionShelf:()=>Xi,MusicDetailHeader:()=>Go,MusicDownloadStateBadge:()=>Yk,MusicEditablePlaylistDetailHeader:()=>ig,MusicElementHeader:()=>Xp,MusicHeader:()=>Qi,MusicImmersiveHeader:()=>og,MusicInlineBadge:()=>Es,MusicItemThumbnailOverlay:()=>oi,MusicLargeCardItemCarousel:()=>jk,MusicMenuItemDivider:()=>J0,MusicMultiRowListItem:()=>Z0,MusicMultiSelectMenu:()=>G0,MusicMultiSelectMenuItem:()=>Yt,MusicNavigationButton:()=>Ns,MusicPlayButton:()=>Ps,MusicPlaylistShelf:()=>zo,MusicQueue:()=>Ms,MusicResponsiveHeader:()=>Uk,MusicResponsiveListItem:()=>qi,MusicResponsiveListItemFixedColumn:()=>eg,MusicResponsiveListItemFlexColumn:()=>tg,MusicShelf:()=>Te,MusicSideAlignedItem:()=>sg,MusicSortFilterButton:()=>ff,MusicTastebuilderShelf:()=>ag,MusicTastebuilderShelfThumbnail:()=>rg,MusicThumbnail:()=>ot,MusicTwoRowItem:()=>Rs,MusicVisualHeader:()=>ug,NavigationEndpoint:()=>g,Notification:()=>lg,OpenPopupAction:()=>k_,PageHeader:()=>si,PageHeaderView:()=>cg,PageIntroduction:()=>dg,PdgCommentChip:()=>Dv,PivotButton:()=>pg,PlayerAnnotationsExpanded:()=>fg,PlayerCaptionsTracklist:()=>mg,PlayerControlsOverlay:()=>Wk,PlayerErrorMessage:()=>Hk,PlayerLegacyDesktopYpcOffer:()=>Jk,PlayerLegacyDesktopYpcTrailer:()=>Nf,PlayerLiveStoryboardSpec:()=>vg,PlayerMicroformat:()=>Ct,PlayerOverflow:()=>hg,PlayerOverlay:()=>Zi,PlayerOverlayAutoplay:()=>gg,PlayerStoryboardSpec:()=>Po,Playlist:()=>ti,PlaylistCustomThumbnail:()=>xs,PlaylistHeader:()=>yg,PlaylistInfoCardContent:()=>Gk,PlaylistMetadata:()=>bg,PlaylistPanel:()=>ni,PlaylistPanelVideo:()=>wi,PlaylistPanelVideoWrapper:()=>ng,PlaylistSidebar:()=>zk,PlaylistSidebarPrimaryInfo:()=>wg,PlaylistSidebarSecondaryInfo:()=>Tg,PlaylistVideo:()=>Vs,PlaylistVideoList:()=>$k,PlaylistVideoThumbnail:()=>ys,Poll:()=>Kk,PollHeader:()=>nk,Post:()=>Ig,PostMultiImage:()=>qk,ProductList:()=>rv,ProductListHeader:()=>Xk,ProductListItem:()=>Qk,ProfileColumn:()=>Zk,ProfileColumnStats:()=>eS,ProfileColumnStatsEntry:()=>tS,ProfileColumnUserInfo:()=>iS,Quiz:()=>oS,RecognitionShelf:()=>nS,ReelItem:()=>Os,ReelPlayerHeader:()=>kg,ReelPlayerOverlay:()=>sS,ReelShelf:()=>ps,RelatedChipCloud:()=>Sg,RemoveBannerForLiveChatCommand:()=>ak,RemoveChatItemAction:()=>uk,RemoveChatItemByAuthorAction:()=>lk,ReplaceChatItemAction:()=>ck,ReplayChatItemAction:()=>dk,RichGrid:()=>eo,RichItem:()=>rS,RichListHeader:()=>aS,RichMetadata:()=>lm,RichMetadataRow:()=>dm,RichSection:()=>uS,RichShelf:()=>Cg,SearchBox:()=>lS,SearchFilter:()=>Eg,SearchFilterGroup:()=>Ds,SearchFilterOptionsDialog:()=>cS,SearchHeader:()=>Pg,SearchRefinementCard:()=>Oo,SearchSubMenu:()=>Ng,SearchSuggestion:()=>v0,SearchSuggestionsSection:()=>Ag,SecondarySearchContainer:()=>dS,SectionList:()=>Q,SegmentedLikeDislikeButton:()=>$o,SegmentedLikeDislikeButtonView:()=>Ko,SettingBoolean:()=>pS,SettingsCheckbox:()=>Rg,SettingsOptions:()=>Bs,SettingsSidebar:()=>Mg,SettingsSwitch:()=>Ls,SharedPost:()=>Vg,Shelf:()=>Fs,ShowCustomThumbnail:()=>p0,ShowLiveChatActionPanelAction:()=>pk,ShowLiveChatDialogAction:()=>fk,ShowLiveChatTooltipCommand:()=>mk,ShowingResultsFor:()=>Og,SimpleCardContent:()=>fS,SimpleCardTeaser:()=>mS,SimpleMenuHeader:()=>z0,SimpleTextSection:()=>hS,SingleActionEmergencySupport:()=>_S,SingleColumnBrowseResults:()=>ri,SingleColumnMusicWatchNextResults:()=>vS,SingleHeroImage:()=>gS,SlimOwner:()=>xS,SlimVideoMetadata:()=>Dg,SortFilterHeader:()=>I0,SortFilterSubMenu:()=>Bt,SponsorCommentBadge:()=>Lv,StatRow:()=>iT,StructuredDescriptionContent:()=>Lo,StructuredDescriptionPlaylistLockup:()=>gv,SubFeedOption:()=>Lg,SubFeedSelector:()=>yS,SubscribeButton:()=>$e,SubscriptionNotificationToggleButton:()=>bv,Tab:()=>be,Tabbed:()=>bS,TabbedSearchResults:()=>Bg,TextHeader:()=>wS,ThumbnailBadgeView:()=>Nv,ThumbnailHoverOverlayView:()=>Pv,ThumbnailLandscapePortrait:()=>TS,ThumbnailOverlayBadgeView:()=>Av,ThumbnailOverlayBottomPanel:()=>f0,ThumbnailOverlayEndorsement:()=>IS,ThumbnailOverlayHoverText:()=>kS,ThumbnailOverlayInlineUnplayable:()=>SS,ThumbnailOverlayLoadingPreview:()=>CS,ThumbnailOverlayNowPlaying:()=>ES,ThumbnailOverlayPinking:()=>PS,ThumbnailOverlayPlaybackStatus:()=>NS,ThumbnailOverlayResumePlayback:()=>AS,ThumbnailOverlaySidePanel:()=>RS,ThumbnailOverlayTimeStatus:()=>Do,ThumbnailOverlayToggleButton:()=>MS,ThumbnailView:()=>Rv,TimedMarkerDecoration:()=>VS,TitleAndButtonListHeader:()=>OS,ToggleButton:()=>Re,ToggleButtonView:()=>ws,ToggleMenuServiceItem:()=>DS,Tooltip:()=>LS,TopicChannelDetails:()=>BS,Transcript:()=>is,TranscriptFooter:()=>O_,TranscriptSearchBox:()=>D_,TranscriptSearchPanel:()=>Y_,TranscriptSectionHeader:()=>L_,TranscriptSegment:()=>B_,TranscriptSegmentList:()=>F_,TwoColumnBrowseResults:()=>ai,TwoColumnSearchResults:()=>Fg,TwoColumnWatchNextResults:()=>Ys,UniversalWatchCard:()=>jg,UpdateDateTextAction:()=>M0,UpdateDescriptionAction:()=>V0,UpdateEngagementPanelAction:()=>qw,UpdateLiveChatPollAction:()=>hk,UpdateTitleAction:()=>O0,UpdateToggleButtonTextAction:()=>D0,UpdateViewershipAction:()=>L0,UploadTimeFactoid:()=>pv,UpsellDialog:()=>FS,VerticalList:()=>YS,VerticalWatchCardList:()=>jS,Video:()=>as,VideoAttributeView:()=>ls,VideoCard:()=>dv,VideoDescriptionCourseSection:()=>xv,VideoDescriptionHeader:()=>mv,VideoDescriptionInfocardsSection:()=>hv,VideoDescriptionMusicSection:()=>ds,VideoDescriptionTranscriptSection:()=>Ju,VideoInfoCardContent:()=>US,VideoOwner:()=>js,VideoPrimaryInfo:()=>Ug,VideoSecondaryInfo:()=>yh,ViewCountFactoid:()=>fv,WatchCardCompactVideo:()=>Wg,WatchCardHeroVideo:()=>WS,WatchCardRichHeader:()=>HS,WatchCardSectionSequence:()=>JS,WatchNextEndScreen:()=>xg,WatchNextTabbedResults:()=>Hg,YpcTrailer:()=>_g});var Eo,x_=class{constructor(e,i){Eo.set(this,void 0),I(this,Eo,new L.shim.Cache(e,i),"f")}get cache_dir(){return d(this,Eo,"f").cache_dir}get(e){return d(this,Eo,"f").get(e)}set(e,i){return d(this,Eo,"f").set(e,i)}remove(e){return d(this,Eo,"f").remove(e)}};n(x_,"UniversalCache");Eo=new WeakMap;var TC=x_;var Zn,y_=class extends EventTarget{constructor(){super(),Zn.set(this,new Map)}emit(e,...i){let o=new L.shim.CustomEvent(e,{detail:i});this.dispatchEvent(o)}on(e,i){let o=n(s=>{s instanceof L.shim.CustomEvent?i(...s.detail):i(s)},"wrapper");d(this,Zn,"f").set(i,o),this.addEventListener(e,o)}once(e,i){let o=n(s=>{s instanceof L.shim.CustomEvent?i(...s.detail):i(s),this.off(e,i)},"wrapper");d(this,Zn,"f").set(i,o),this.addEventListener(e,o)}off(e,i){let o=d(this,Zn,"f").get(i);o&&(this.removeEventListener(e,o),d(this,Zn,"f").delete(i))}};n(y_,"EventEmitterLike");Zn=new WeakMap;var pa=y_;var No={};B(No,{chooseFormat:()=>$w,download:()=>$C,toDash:()=>zw});var IC={"&":"&",'"':""","'":"'","<":"<",">":">"};function Lw(t){return t.replace(/([&"<>'])/g,(e,i)=>IC[i])}n(Lw,"escapeXMLString");function kC(t){return t==="mpd"?"MPD":t==="base-url"?"BaseURL":t.split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join("")}n(kC,"normalizeTag");function me(t,e,...i){let o=i.flat().map(s=>typeof s=="string"?SC(s):s);return typeof t=="function"?t(Object.assign(Object.assign({},e),{children:o})):{type:kC(t),props:Object.assign(Object.assign({},e),{children:o})}}n(me,"createElement");function SC(t){return{type:"TEXT_ELEMENT",props:{nodeValue:t}}}n(SC,"createTextElement");function Bw(t){return y(this,void 0,void 0,function*(){if(t.type==="TEXT_ELEMENT")return Lw(typeof t.props.nodeValue=="string"?t.props.nodeValue:"");let e=`<${t.type}`;if(t.props){let i=Object.keys(t.props).filter(o=>!["children","nodeValue"].includes(o)&&t.props[o]!==void 0).map(o=>`${o}="${Lw(`${t.props[o]}`)}"`);i.length>0&&(e+=` ${i.join(" ")}`)}if(t.props.children){let i=yield Promise.all((yield Promise.all(t.props.children.flat())).flat().filter(o=>!!o).map(o=>Bw(o)));if(i.length>0)return e+=`>${i.join("")}</${t.type}>`,e}return`${e}/>`})}n(Bw,"renderElementToString");function Fw(t){return y(this,void 0,void 0,function*(){return`<?xml version="1.0" encoding="utf-8"?>${yield Bw(yield t)}`})}n(Fw,"renderToString");function Yw(t){return t.children}n(Yw,"Fragment");var fa=class extends a{constructor(e){super();let i=e.spec.split("|"),o=new URL(i.shift());this.boards=i.map((s,r)=>{let[l,p,f,h,m,b,x,T]=s.split("#");o.searchParams.set("sigh",T);let k=Math.ceil(parseInt(f,10)/(parseInt(h,10)*parseInt(m,10)));return{type:"vod",template_url:o.toString().replace("$L",r).replace("$N",x),thumbnail_width:parseInt(l,10),thumbnail_height:parseInt(p,10),thumbnail_count:parseInt(f,10),interval:parseInt(b,10),columns:parseInt(h,10),rows:parseInt(m,10),storyboard_count:k}})}};n(fa,"PlayerStoryboardSpec");fa.type="PlayerStoryboardSpec";var Po=fa;var EC="StreamingInfo";function PC(t,e){var i,o,s;let r=new Map,l=t.some(p=>!!p.audio_track);for(let p of t){if((!p.index_range||!p.init_range)&&!p.is_type_otf&&!e)continue;let f=p.mime_type.split(";")[0],h=(i=Ye(p.mime_type,'codecs="','"'))===null||i===void 0?void 0:i.split(".")[0],m=p.color_info?Object.values(p.color_info).join("-"):"",b=((o=p.audio_track)===null||o===void 0?void 0:o.id)||"",x=`${f}-${h}-${m}-${b}`;r.has(x)||r.set(x,[]),(s=r.get(x))===null||s===void 0||s.push(p)}return{groups:Array.from(r.values()),has_multiple_audio_tracks:l}}n(PC,"getFormatGroupings");function Uw(t,e){if(t.length>1&&new Set(t.map(i=>Ye(i.mime_type,'codecs="','"'))).size===1)return e.push("codecs"),Ye(t[0].mime_type,'codecs="','"')}n(Uw,"hoistCodecsIfPossible");function Ww(t,e,i){if(t.length>1&&new Set(t.map(o=>o.fps)).size===1)return i.push(e),Number(t[0][e])}n(Ww,"hoistNumberAttributeIfPossible");function NC(t,e){if(t.length>1&&new Set(t.map(i=>i.audio_channels||2)).size===1)return e.push("AudioChannelConfiguration"),t[0].audio_channels}n(NC,"hoistAudioChannelsIfPossible");function AC(t,e){var i;return y(this,void 0,void 0,function*(){let o=yield e.session.http.fetch_function(`${t}&rn=0&sq=0`,{method:"GET",headers:xi,redirect:"follow"}),s=o.url.replace("&rn=0","").replace("&sq=0",""),r=yield o.text(),l=(i=Ye(r,"Segment-Durations-Ms:",`\r
|
|
`))===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_range.end}`},me("initialization",{range:`${t.init_range.start}-${t.init_range.end}`})))}n(Gw,"SegmentInfo");function zC({streamingData:t,isPostLiveDvr:e,transformURL:i,rejectFormat:o,cpn:s,player:r,actions:l,storyboards:p}){return y(this,void 0,void 0,function*(){let{getDuration:f,audio_sets:h,video_sets:m,image_sets:b}=b_(t,e,i,o,s,r,l,p);return me("mpd",{xmlns:"urn:mpeg:dash:schema:mpd:2011",minBufferTime:"PT1.500S",profiles:"urn:mpeg:dash:profile:isoff-main:2011",type:"static",mediaPresentationDuration:`PT${yield f()}S`,"xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xsi:schemaLocation":"urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"},me("period",null,h.map((x,T)=>me("adaptation-set",{id:T,mimeType:x.mime_type,startWithSAP:"1",subsegmentAlignment:"true",lang:x.language,codecs:x.codecs,audioSamplingRate:x.audio_sample_rate,contentType:"audio"},x.track_role&&me("role",{schemeIdUri:"urn:mpeg:dash:role:2011",value:x.track_role}),x.track_name&&me("label",{id:T},x.track_name),x.channels&&me("audio-channel-configuration",{schemeIdUri:"urn:mpeg:dash:23003:3:audio_channel_configuration:2011",value:x.channels}),x.representations.map(k=>me("representation",{id:k.uid,bandwidth:k.bitrate,codecs:k.codecs,audioSamplingRate:k.audio_sample_rate},k.channels&&me("audio-channel-configuration",{schemeIdUri:"urn:mpeg:dash:23003:3:audio_channel_configuration:2011",value:k.channels}),me(Gw,{info:k.segment_info}))))),m.map((x,T)=>me("adaptation-set",{id:T+h.length,mimeType:x.mime_type,startWithSAP:"1",subsegmentAlignment:"true",codecs:x.codecs,maxPlayoutRate:"1",frameRate:x.fps,contentType:"video"},x.color_info.primaries&&me("essential-property",{schemeIdUri:"urn:mpeg:mpegB:cicp:ColourPrimaries",value:x.color_info.primaries}),x.color_info.transfer_characteristics&&me("essential-property",{schemeIdUri:"urn:mpeg:mpegB:cicp:TransferCharacteristics",value:x.color_info.transfer_characteristics}),x.color_info.matrix_coefficients&&me("essential-property",{schemeIdUri:"urn:mpeg:mpegB:cicp:MatrixCoefficients",value:x.color_info.matrix_coefficients}),x.representations.map(k=>me("representation",{id:k.uid,bandwidth:k.bitrate,width:k.width,height:k.height,codecs:k.codecs,frameRate:k.fps},me(Gw,{info:k.segment_info}))))),b.map((x,T)=>y(this,void 0,void 0,function*(){return me("adaptation-set",{id:T+h.length+m.length,mimeType:yield x.getMimeType(),contentType:"image"},x.representations.map(k=>y(this,void 0,void 0,function*(){return me("representation",{id:`thumbnails_${k.thumbnail_width}x${k.thumbnail_height}`,bandwidth:yield k.getBitrate(),width:k.sheet_width,height:k.sheet_height},me("essential-property",{schemeIdUri:"http://dashif.org/thumbnail_tile",value:`${k.columns}x${k.rows}`}),me("segment-template",{media:k.template_url,duration:k.template_duration,startNumber:"0"}))})))}))))})}n(zC,"DashManifest");function zw(t,e=!1,i=f=>f,o,s,r,l,p){if(!t)throw new v("Streaming data not available");return Fw(me(zC,{streamingData:t,isPostLiveDvr:e,transformURL:i,rejectFormat:o,cpn:s,player:r,actions:l,storyboards:p}))}n(zw,"toDash");function $C(t,e,i,o,s,r){return y(this,void 0,void 0,function*(){if((i==null?void 0:i.status)==="UNPLAYABLE")throw new v("Video is unplayable",{error_type:"UNPLAYABLE"});if((i==null?void 0:i.status)==="LOGIN_REQUIRED")throw new v("Video is login required",{error_type:"LOGIN_REQUIRED"});if(!o)throw new v("Streaming data not available.",{error_type:"NO_STREAMING_DATA"});let l=Object.assign({quality:"360p",type:"video+audio",format:"mp4",range:void 0},t),p=$w(l,o),f=p.decipher(s);if(l.type==="video+audio"&&!t.range){let C=yield e.session.http.fetch_function(`${f}&cpn=${r}`,{method:"GET",headers:xi,redirect:"follow"});if(!C.ok)throw new v("The server responded with a non 2xx status code",{error_type:"FETCH_FAILED",response:C});let M=C.body;if(!M)throw new v("Could not get ReadableStream from fetch Response.",{error_type:"FETCH_FAILED",response:C});return M}let h=1048576*10,m=t.range?t.range.start:0,b=t.range?t.range.end:h,x=!1,T;return new L.shim.ReadableStream({start(){},pull:C=>y(this,void 0,void 0,function*(){if(x){C.close();return}return(b>=(p.content_length?p.content_length:0)||t.range)&&(x=!0),new Promise((M,A)=>y(this,void 0,void 0,function*(){var $,D,le,ve;try{T=new AbortController;let K=yield e.session.http.fetch_function(`${f}&cpn=${r}&range=${m}-${b||""}`,{method:"GET",headers:Object.assign({},xi),signal:T.signal}),z=K.body;if(!z)throw new v("Could not get ReadableStream from fetch Response.",{error_type:"FETCH_FAILED",response:K});try{for(var ke=!0,Pe=Vw(Xy(z)),De;De=yield Pe.next(),$=De.done,!$;ke=!0){ve=De.value,ke=!1;let Z=ve;C.enqueue(Z)}}catch(Z){D={error:Z}}finally{try{!ke&&!$&&(le=Pe.return)&&(yield le.call(Pe))}finally{if(D)throw D.error}}m=b+1,b+=h,M()}catch(K){A(K)}}))}),cancel(C){return y(this,void 0,void 0,function*(){T.abort(C)})}},{highWaterMark:1,size(C){return C.byteLength}})})}n($C,"download");function $w(t,e){if(!e)throw new v("Streaming data not available");let i=[...e.formats||[],...e.adaptive_formats||[]],o=t.type?t.type.includes("audio"):!0,s=t.type?t.type.includes("video"):!0,r=t.language||"original",l=t.quality||"best",p=-1,f=["best","bestefficiency"].includes(l),h=l!=="best",m=i.filter(b=>o&&!b.has_audio||s&&!b.has_video||t.format!=="any"&&!b.mime_type.includes(t.format||"mp4")||!f&&b.quality_label!==l?!1:(p<b.width&&(p=b.width),!0));if(!m.length)throw new v("No matching formats found",{options:t});if(f&&s&&(m=m.filter(b=>b.width===p)),o&&!s){let b=m.filter(x=>r!=="original"?!x.has_video&&!x.has_text&&x.language===r:!x.has_video&&!x.has_text&&x.is_original);b.length>0&&(m=b)}return h?m.sort((b,x)=>b.bitrate-x.bitrate):m.sort((b,x)=>x.bitrate-b.bitrate),m[0]}n($w,"chooseFormat");var Qy,Lt,es,ma,Kw,w_=class{constructor(e,i,o){Qy.add(this),Lt.set(this,void 0),es.set(this,void 0),ma.set(this,void 0),I(this,Lt,e,"f"),I(this,es,i,"f"),I(this,ma,o||L.shim.fetch,"f")}get fetch_function(){return d(this,ma,"f")}fetch(e,i){return y(this,void 0,void 0,function*(){let o=lt.API.PRODUCTION_1+d(this,Lt,"f").api_version,s=(i==null?void 0:i.baseURL)||o,r=typeof e=="string"?!s.endsWith("/")&&!e.startsWith("/")?new URL(`${s}/${e}`):new URL(s+e):e instanceof URL?e:new URL(e.url,s),l=(i==null?void 0:i.headers)||(e instanceof L.shim.Request?e.headers:new L.shim.Headers)||new L.shim.Headers,p=(i==null?void 0:i.body)||(e instanceof L.shim.Request?e.body:void 0),f=new L.shim.Headers(l);f.set("Accept","*/*"),f.set("Accept-Language","*"),f.set("X-Goog-Visitor-Id",d(this,Lt,"f").context.client.visitorData||""),f.set("X-Youtube-Client-Version",d(this,Lt,"f").context.client.clientVersion||"");let h=Object.values(ae).find(M=>M.NAME===d(this,Lt,"f").context.client.clientName);h&&f.set("X-Youtube-Client-Name",h.NAME_ID),L.shim.server&&(f.set("User-Agent",Ao("desktop")),f.set("origin",r.origin)),r.searchParams.set("prettyPrint","false"),r.searchParams.set("alt","json");let m=f.get("Content-Type"),b=p,x=!1,T=s===o||s===lt.YT_UPLOAD;if(m==="application/json"&&T&&typeof p=="string"){let M=JSON.parse(p),A=Object.assign(Object.assign({},M),{context:JSON.parse(JSON.stringify(d(this,Lt,"f").context))});d(this,Qy,"m",Kw).call(this,A.context,A.client),f.set("x-youtube-client-version",A.context.client.clientVersion);let $=Object.values(ae).find(D=>D.NAME===A.context.client.clientName);$&&f.set("X-Youtube-Client-Name",$.NAME_ID),delete A.client,L.shim.server&&(A.context.client.clientName==="ANDROID"||A.context.client.clientName==="ANDROID_MUSIC"?(f.set("User-Agent",ae.ANDROID.USER_AGENT),f.set("X-GOOG-API-FORMAT-VERSION","2")):A.context.client.clientName==="iOS"&&f.set("User-Agent",ae.iOS.USER_AGENT)),x=A.context.client.clientName==="WEB_KIDS",b=JSON.stringify(A)}else m==="application/x-protobuf"&&L.shim.server&&(f.set("User-Agent",ae.ANDROID.USER_AGENT),f.set("X-GOOG-API-FORMAT-VERSION","2"),f.delete("X-Youtube-Client-Version"));if(d(this,Lt,"f").logged_in&&T&&!x){let M=d(this,Lt,"f").oauth;if(M.validateCredentials()&&(yield M.refreshIfRequired(),f.set("authorization",`Bearer ${M.credentials.access_token}`)),d(this,es,"f")){let A=Ye(d(this,es,"f"),"PAPISID=",";");A&&(f.set("authorization",yield eb(A)),f.set("x-goog-authuser",d(this,Lt,"f").account_index.toString())),f.set("cookie",d(this,es,"f"))}}let k=new L.shim.Request(r,e instanceof L.shim.Request?e:i),C=yield d(this,ma,"f").call(this,k,Object.assign({body:b,headers:f,redirect:e instanceof L.shim.Request?e.redirect:(i==null?void 0:i.redirect)||"follow"},L.shim.runtime!=="cf-worker"?{credentials:"include"}:{}));if(C.ok)return C;throw new v(`Request to ${C.url} failed with status ${C.status}`,yield C.text())})}};n(w_,"HTTPClient");Lt=new WeakMap,es=new WeakMap,ma=new WeakMap,Qy=new WeakSet,Kw=n(function(e,i){switch((i==="ANDROID"||i==="YTMUSIC_ANDROID"||i==="YTMUSIC_ANDROID"||i==="YTSTUDIO_ANDROID")&&(e.client.androidSdkVersion=ae.ANDROID.SDK_VERSION,e.client.userAgent=ae.ANDROID.USER_AGENT,e.client.osName="Android",e.client.osVersion="13",e.client.platform="MOBILE"),i){case"iOS":e.client.deviceModel=ae.iOS.DEVICE_MODEL,e.client.clientVersion=ae.iOS.VERSION,e.client.clientName=ae.iOS.NAME,e.client.platform="MOBILE";break;case"YTMUSIC":e.client.clientVersion=ae.YTMUSIC.VERSION,e.client.clientName=ae.YTMUSIC.NAME;break;case"ANDROID":e.client.clientVersion=ae.ANDROID.VERSION,e.client.clientFormFactor="SMALL_FORM_FACTOR",e.client.clientName=ae.ANDROID.NAME;break;case"YTMUSIC_ANDROID":e.client.clientVersion=ae.YTMUSIC_ANDROID.VERSION,e.client.clientFormFactor="SMALL_FORM_FACTOR",e.client.clientName=ae.YTMUSIC_ANDROID.NAME;break;case"YTSTUDIO_ANDROID":e.client.clientVersion=ae.YTSTUDIO_ANDROID.VERSION,e.client.clientFormFactor="SMALL_FORM_FACTOR",e.client.clientName=ae.YTSTUDIO_ANDROID.NAME;break;case"TV_EMBEDDED":e.client.clientName=ae.TV_EMBEDDED.NAME,e.client.clientVersion=ae.TV_EMBEDDED.VERSION,e.client.clientScreen="EMBED",e.thirdParty={embedUrl:lt.YT_BASE};break;case"YTKIDS":e.client.clientVersion=ae.WEB_KIDS.VERSION,e.client.clientName=ae.WEB_KIDS.NAME,e.client.kidsAppInfo={categorySettings:{enabledCategories:["approved_for_you","black_joy","camp","collections","earth","explore","favorites","gaming","halloween","hero","learning","move","music","reading","shared_by_parents","shows","soccer","sports","spotlight","winter"]},contentSettings:{corpusPreference:"KIDS_CORPUS_PREFERENCE_YOUNGER",kidsNoSearchMode:"YT_KIDS_NO_SEARCH_MODE_OFF"}};break;default:break}},"_HTTPClient_adjustContext");var Zy=w_;var ha=class extends a{constructor(e){super(),Reflect.has(e,"text")&&(this.text=new u(e.text).toString()),Reflect.has(e,"accessibility")&&Reflect.has(e.accessibility,"label")&&(this.label=e.accessibility.label),Reflect.has(e,"tooltip")&&(this.tooltip=e.tooltip),Reflect.has(e,"icon")&&Reflect.has(e.icon,"iconType")&&(this.icon_type=e.icon.iconType),Reflect.has(e,"isDisabled")&&(this.is_disabled=e.isDisabled),this.endpoint=new g(e.navigationEndpoint||e.serviceEndpoint||e.command)}};n(ha,"Button");ha.type="Button";var S=ha;var _a=class extends a{constructor(e){var i;super(),this.label=new u(e.label).toString(),this.selected=!!e.isSelected,Reflect.has(e,"int32Value")?this.value=e.int32Value:e.stringValue&&(this.value=e.stringValue),Reflect.has(e,"onSelectCommand")&&(this.endpoint=new g(e.onSelectCommand)),Reflect.has(e,"icon")&&(this.icon_type=(i=e.icon)===null||i===void 0?void 0:i.iconType),Reflect.has(e,"descriptionText")&&(this.description=new u(e.descriptionText))}};n(_a,"DropdownItem");_a.type="DropdownItem";var T_=_a;var va=class extends a{constructor(e){super(),this.label=e.label||"",this.entries=c.parseArray(e.entries,T_)}};n(va,"Dropdown");va.type="Dropdown";var ts=va;var ga=class extends a{constructor(e){super(),this.title=new u(e.dialogTitle).toString(),this.title_placeholder=e.titlePlaceholder||"",this.privacy_option=c.parseItem(e.privacyOption,ts),this.create_button=c.parseItem(e.cancelButton,S),this.cancel_button=c.parseItem(e.cancelButton,S)}};n(ga,"CreatePlaylistDialog");ga.type="CreatePlaylistDialog";var I_=ga;var xa=class extends a{constructor(e){super(),this.popup=c.parseItem(e.popup),this.popup_type=e.popupType}};n(xa,"OpenPopupAction");xa.type="OpenPopupAction";var k_=xa;var Ro=class extends a{constructor(e){var i,o,s,r,l,p,f,h;super(),Reflect.has(e||{},"innertubeCommand")&&(e=e.innertubeCommand),Reflect.has(e||{},"openPopupAction")&&(this.open_popup=new k_(e.openPopupAction));let m=Object.keys(e||{}).find(b=>b.endsWith("Endpoint")||b.endsWith("Command"));this.payload=m?Reflect.get(e,m):{},(Reflect.has(this.payload,"dialog")||Reflect.has(this.payload,"content"))&&(this.dialog=c.parseItem(this.payload.dialog||this.payload.content)),Reflect.has(this.payload,"modal")&&(this.modal=c.parseItem(this.payload.modal)),Reflect.has(this.payload,"nextEndpoint")&&(this.next_endpoint=new Ro(this.payload.nextEndpoint)),e!=null&&e.serviceEndpoint&&(e=e.serviceEndpoint),this.metadata={},!((o=(i=e==null?void 0:e.commandMetadata)===null||i===void 0?void 0:i.webCommandMetadata)===null||o===void 0)&&o.url&&(this.metadata.url=e.commandMetadata.webCommandMetadata.url),!((r=(s=e==null?void 0:e.commandMetadata)===null||s===void 0?void 0:s.webCommandMetadata)===null||r===void 0)&&r.webPageType&&(this.metadata.page_type=e.commandMetadata.webCommandMetadata.webPageType),!((p=(l=e==null?void 0:e.commandMetadata)===null||l===void 0?void 0:l.webCommandMetadata)===null||p===void 0)&&p.apiUrl?this.metadata.api_url=e.commandMetadata.webCommandMetadata.apiUrl.replace("/youtubei/v1/",""):m&&(this.metadata.api_url=this.getEndpoint(m)),!((h=(f=e==null?void 0:e.commandMetadata)===null||f===void 0?void 0:f.webCommandMetadata)===null||h===void 0)&&h.sendPost&&(this.metadata.send_post=e.commandMetadata.webCommandMetadata.sendPost),e!=null&&e.createPlaylistEndpoint&&e!=null&&e.createPlaylistEndpoint.createPlaylistDialog&&(this.dialog=c.parseItem(e==null?void 0:e.createPlaylistEndpoint.createPlaylistDialog,I_))}getEndpoint(e){switch(e){case"browseEndpoint":return"/browse";case"watchEndpoint":return"/player";case"searchEndpoint":return"/search";case"watchPlaylistEndpoint":return"/next";case"liveChatItemContextMenuEndpoint":return"live_chat/get_item_context_menu"}}call(e,i){if(!e)throw new Error("An active caller must be provided");if(!this.metadata.api_url)throw new Error("Expected an api_url, but none was found, this is a bug.");return e.execute(this.metadata.api_url,Object.assign(Object.assign({},this.payload),i))}toURL(){if(!!this.metadata.url&&!!this.metadata.page_type)return this.metadata.page_type==="WEB_PAGE_TYPE_UNKNOWN"?this.metadata.url:`https://www.youtube.com${this.metadata.url}`}};n(Ro,"NavigationEndpoint");Ro.type="NavigationEndpoint";var g=Ro;var w=class{constructor(e){this.url=e.url,this.width=e.width,this.height=e.height}static fromResponse(e){if(!e)return[];let i;return e.thumbnails?i=e.thumbnails:e.sources&&(i=e.sources),i?i.map(o=>new w(o)).sort((o,s)=>s.width-o.width):[]}};n(w,"Thumbnail");var Di=class{constructor(e){var i,o,s,r,l,p;this.text=((i=e.emoji)===null||i===void 0?void 0:i.emojiId)||((s=(o=e.emoji)===null||o===void 0?void 0:o.shortcuts)===null||s===void 0?void 0:s[0])||e.text||"",this.emoji={emoji_id:e.emoji.emojiId,shortcuts:((r=e.emoji)===null||r===void 0?void 0:r.shortcuts)||[],search_terms:((l=e.emoji)===null||l===void 0?void 0:l.searchTerms)||[],image:w.fromResponse(e.emoji.image),is_custom:!!(!((p=e.emoji)===null||p===void 0)&&p.isCustomEmoji)}}toString(){return this.text}toHTML(){let e=S_(this.text);return`<img src="${this.emoji.image[0].url}" alt="${e}" title="${e}" style="display: inline-block; vertical-align: text-top; height: var(--yt-emoji-size, 1rem); width: var(--yt-emoji-size, 1rem);" loading="lazy" crossorigin="anonymous" />`}};n(Di,"EmojiRun");var Li=class{constructor(e){this.text=e.text,this.bold=Boolean(e.bold),this.italics=Boolean(e.italics),this.strikethrough=Boolean(e.strikethrough),Reflect.has(e,"navigationEndpoint")&&(this.endpoint=new g(e.navigationEndpoint)),this.attachment=e.attachment}toString(){return this.text}toHTML(){let e=[];this.bold&&e.push("b"),this.italics&&e.push("i"),this.strikethrough&&e.push("s");let i=S_(this.text),s=`<span style="white-space: pre-wrap;">${e.map(r=>`<${r}>`).join("")+i+e.map(r=>`</${r}>`).join("")}</span>`;if(this.attachment&&this.attachment.element.type.imageType.image.sources.length){let{url:r}=this.attachment.element.type.imageType.image.sources[0];if(this.endpoint){let l=this.endpoint.toURL();if(l)return`<a href="${l}" class="yt-ch-link" display: block; width: fit-content; font-size: small;><img src="${r}" style="vertical-align: middle; height: ${this.attachment.element.properties.layoutProperties.height.value}px; width: ${this.attachment.element.properties.layoutProperties.width.value}px;">${s}</a>`}}if(this.endpoint){let r=this.endpoint.toURL();if(r)return`<a href="${r}">${s}</a>`}return s}};n(Li,"TextRun");function S_(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}n(S_,"escape");var ya="Text",u=class{constructor(e){var i,o,s,r;typeof e=="object"&&e!==null&&Reflect.has(e,"runs")&&Array.isArray(e.runs)?(this.runs=e.runs.map(l=>l.emoji?new Di(l):new Li(l)),this.text=this.runs.map(l=>l.text).join("")):this.text=e==null?void 0:e.simpleText,typeof e=="object"&&e!==null&&Reflect.has(e,"navigationEndpoint")&&(this.endpoint=new g(e.navigationEndpoint)),typeof e=="object"&&e!==null&&Reflect.has(e,"titleNavigationEndpoint")&&(this.endpoint=new g(e.titleNavigationEndpoint)),this.endpoint||!((o=(i=this.runs)===null||i===void 0?void 0:i[0])===null||o===void 0)&&o.endpoint&&(this.endpoint=(r=(s=this.runs)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.endpoint)}static fromAttributed(e){var i,o,s;let{content:r,styleRuns:l,commandRuns:p,attachmentRuns:f}=e,h=[{text:r,startIndex:0}];if(l||p||f){if(l)for(let m of l)if(m.italic||m.strikethrough==="LINE_STYLE_SINGLE"||m.weightLabel==="FONT_WEIGHT_MEDIUM"||m.weightLabel==="FONT_WEIGHT_BOLD"){let b=ib(h,m);if(!b){U.warn(ya,"Unable to find matching run for style run. Skipping...",{style_run:m,input_data:e,parsed_runs:JSON.parse(JSON.stringify(h))});continue}C_(h,b,m,{bold:m.weightLabel==="FONT_WEIGHT_MEDIUM"||m.weightLabel==="FONT_WEIGHT_BOLD",italics:m.italic,strikethrough:m.strikethrough==="LINE_STYLE_SINGLE"})}else U.debug(ya,"Skipping style run as it is doesn't have any information that we parse.",{style_run:m,input_data:e});if(p)for(let m of p)if(m.onTap){let b=ib(h,m);if(!b){U.warn(ya,"Unable to find matching run for command run. Skipping...",{command_run:m,input_data:e,parsed_runs:JSON.parse(JSON.stringify(h))});continue}C_(h,b,m,{navigationEndpoint:m.onTap})}else U.debug(ya,'Skipping command run as it is missing the "doTap" property.',{command_run:m,input_data:e});if(f)for(let m of f){let b=ib(h,m);if(!b){U.warn(ya,"Unable to find matching run for attachment run. Skipping...",{attachment_run:m,input_data:e,parsed_runs:JSON.parse(JSON.stringify(h))});continue}if(m.length===0)b.attachment=m;else{let x=m.startIndex-b.startIndex,T=b.text.substring(x,x+m.length),k=/^:[^:]+:$/.test(T);if(((s=(o=(i=m.element)===null||i===void 0?void 0:i.type)===null||o===void 0?void 0:o.imageType)===null||s===void 0?void 0:s.image)&&(k||new RegExp("^(?:\\p{Emoji}|\\u200d)+$","u").test(T))){let C={image:m.element.type.imageType.image,isCustomEmoji:k,shortcuts:k?[T]:void 0};C_(h,b,m,{emoji:C})}else C_(h,b,m,{attachment:m})}}}return new u({runs:h})}toHTML(){return this.runs?this.runs.map(e=>e.toHTML()).join(""):this.text}isEmpty(){return this.text===void 0}toString(){return this.text||"N/A"}};n(u,"Text");function ib(t,e){return t.find(i=>i.startIndex<=e.startIndex&&e.startIndex+e.length<=i.startIndex+i.text.length)}n(ib,"findMatchingRun");function C_(t,e,i,o){let s=t.indexOf(e),r=[],l=i.startIndex-e.startIndex;i.startIndex>e.startIndex&&r.push(Object.assign(Object.assign({},e),{text:e.text.substring(0,l)})),r.push(Object.assign(Object.assign(Object.assign({},e),{text:e.text.substring(l,l+i.length),startIndex:i.startIndex}),o)),i.startIndex+i.length<e.startIndex+e.text.length&&r.push(Object.assign(Object.assign({},e),{text:e.text.substring(l+i.length),startIndex:i.startIndex+i.length})),t.splice(s,1,...r)}n(C_,"insertSubRun");var ba=class extends a{constructor(e){super(),this.title=u.fromAttributed(e.title),this.link=u.fromAttributed(e.link),this.favicon=w.fromResponse(e.favicon)}};n(ba,"ChannelExternalLinkView");ba.type="ChannelExternalLinkView";var E_=ba;var wa=class extends a{constructor(e){super(),Reflect.has(e,"description")&&(this.description=e.description),Reflect.has(e,"descriptionLabel")&&(this.description_label=u.fromAttributed(e.descriptionLabel)),Reflect.has(e,"country")&&(this.country=e.country),Reflect.has(e,"customLinksLabel")&&(this.custom_links_label=u.fromAttributed(e.customLinksLabel)),Reflect.has(e,"subscriberCountText")&&(this.subscriber_count=e.subscriberCountText),Reflect.has(e,"viewCountText")&&(this.view_count=e.viewCountText),Reflect.has(e,"joinedDateText")&&(this.joined_date=u.fromAttributed(e.joinedDateText)),Reflect.has(e,"canonicalChannelUrl")&&(this.canonical_channel_url=e.canonicalChannelUrl),Reflect.has(e,"channelId")&&(this.channel_id=e.channelId),Reflect.has(e,"additionalInfoLabel")&&(this.additional_info_label=u.fromAttributed(e.additionalInfoLabel)),Reflect.has(e,"customUrlOnTap")&&(this.custom_url_on_tap=new g(e.customUrlOnTap)),Reflect.has(e,"videoCountText")&&(this.video_count=e.videoCountText),Reflect.has(e,"signInForBusinessEmail")&&(this.sign_in_for_business_email=u.fromAttributed(e.signInForBusinessEmail)),Reflect.has(e,"links")?this.links=c.parseArray(e.links,E_):this.links=[]}};n(wa,"AboutChannelView");wa.type="AboutChannelView";var P_=wa;var Ta=class extends a{constructor(e){super(),this.metadata=c.parseItem(e.metadata,P_),this.share_channel=c.parseItem(e.shareChannel,S)}};n(Ta,"AboutChannel");Ta.type="AboutChannel";var N_=Ta;var Ia=class extends a{constructor(e){super(),this.title=new u(e.title),this.endpoint=new g(e.navigationEndpoint)}};n(Ia,"AccountChannel");Ia.type="AccountChannel";var A_=Ia;var ka=class extends a{constructor(e){super(),this.title=new u(e.title)}};n(ka,"AccountItemSectionHeader");ka.type="AccountItemSectionHeader";var R_=ka;var Sa=class extends a{constructor(e){super(),this.account_name=new u(e.accountName),this.account_photo=w.fromResponse(e.accountPhoto),this.is_selected=!!e.isSelected,this.is_disabled=!!e.isDisabled,this.has_channel=!!e.hasChannel,this.endpoint=new g(e.serviceEndpoint),this.account_byline=new u(e.accountByline)}};n(Sa,"AccountItem");Sa.type="AccountItem";var Ca=class extends a{constructor(e){super(),this.contents=re(e.contents.map(i=>new Sa(i.accountItem))),this.header=c.parseItem(e.header,R_)}};n(Ca,"AccountItemSection");Ca.type="AccountItemSection";var M_=Ca;var Ea=class extends a{constructor(e){super(),this.contents=c.parseItem(e.contents[0],M_),this.footers=c.parseItem(e.footers[0],A_)}};n(Ea,"AccountSectionList");Ea.type="AccountSectionList";var V_=Ea;var Pa=class extends a{constructor(e){super(),this.contents=c.parseArray(e.continuationItems),this.target=e.target}};n(Pa,"AppendContinuationItemsAction");Pa.type="AppendContinuationItemsAction";var Mo=Pa;var Na=class extends a{constructor(e){super(),Reflect.has(e,"title")&&(this.title=e.title),Reflect.has(e,"icon")&&(this.icon_type=e.icon.iconType),Reflect.has(e,"accessibility")&&(this.label=e.accessibility.accessibilityData.label),Reflect.has(e,"tooltip")&&(this.tooltip=e.tooltip),Reflect.has(e,"subMenuItems")&&(this.sub_menu_items=e.subMenuItems.map(i=>{var o,s;return{title:i.title,selected:i.selected,continuation:(s=(o=i.continuation)===null||o===void 0?void 0:o.reloadContinuationData)===null||s===void 0?void 0:s.continuation,endpoint:new g(i.serviceEndpoint||i.navigationEndpoint),subtitle:i.subtitle||null}}))}};n(Na,"SortFilterSubMenu");Na.type="SortFilterSubMenu";var Bt=Na;var Aa=class extends a{constructor(e){super(),this.language_menu=c.parseItem(e.languageMenu,Bt)}};n(Aa,"TranscriptFooter");Aa.type="TranscriptFooter";var O_=Aa;var Ra=class extends a{constructor(e){super(),this.formatted_placeholder=new u(e.formattedPlaceholder),this.clear_button=c.parseItem(e.clearButton,S),this.endpoint=new g(e.onTextChangeCommand),this.search_button=c.parseItem(e.searchButton,S)}};n(Ra,"TranscriptSearchBox");Ra.type="TranscriptSearchBox";var D_=Ra;var Ma=class extends a{constructor(e){super(),this.start_ms=e.startMs,this.end_ms=e.endMs,this.snippet=new u(e.snippet)}};n(Ma,"TranscriptSectionHeader");Ma.type="TranscriptSectionHeader";var L_=Ma;var Va=class extends a{constructor(e){super(),this.start_ms=e.startMs,this.end_ms=e.endMs,this.snippet=new u(e.snippet),this.start_time_text=new u(e.startTimeText),this.target_id=e.targetId}};n(Va,"TranscriptSegment");Va.type="TranscriptSegment";var B_=Va;var Oa=class extends a{constructor(e){super(),this.initial_segments=c.parseArray(e.initialSegments,[B_,L_]),this.no_result_label=new u(e.noResultLabel),this.retry_label=new u(e.retryLabel),this.touch_captions_enabled=e.touchCaptionsEnabled}};n(Oa,"TranscriptSegmentList");Oa.type="TranscriptSegmentList";var F_=Oa;var Da=class extends a{constructor(e){super(),this.header=c.parseItem(e.header,D_),this.body=c.parseItem(e.body,F_),this.footer=c.parseItem(e.footer,O_),this.target_id=e.targetId}};n(Da,"TranscriptSearchPanel");Da.type="TranscriptSearchPanel";var Y_=Da;var La=class extends a{constructor(e){super(),this.content=c.parseItem(e.content,Y_)}};n(La,"Transcript");La.type="Transcript";var is=La;var Ba=class extends a{constructor(e){super(),this.target_id=e.targetId,this.content=c.parseItem(e.content,is)}};n(Ba,"UpdateEngagementPanelAction");Ba.type="UpdateEngagementPanelAction";var qw=Ba;var Fa=class extends a{constructor(e){super(),this.text=new u(e.text),this.alert_type=e.type}};n(Fa,"Alert");Fa.type="Alert";var os=Fa;var Ya=class extends a{constructor(e){super(),this.text=new u(e.text),this.alert_type=e.type,this.dismiss_button=c.parseItem(e.dismissButton,S)}};n(Ya,"AlertWithButton");Ya.type="AlertWithButton";var j_=Ya;var ja=class extends a{constructor(e){super(),this.title=e.title,this.subtitle=e.subtitle,this.metric_value=e.metricValue,this.comparison_indicator=e.comparisonIndicator;let i=e.seriesConfiguration.lineSeries;this.series_configuration={line_series:{lines_data:{x:i.linesData[0].x,y:i.linesData[0].y,style:{line_width:i.linesData[0].style.lineWidth,line_color:i.linesData[0].style.lineColor}},domain_axis:{tick_values:i.domainAxis.tickValues,custom_formatter:i.domainAxis.customFormatter},measure_axis:{tick_values:i.measureAxis.tickValues,custom_formatter:i.measureAxis.customFormatter}}}}};n(ja,"DataModelSection");ja.type="DataModelSection";var U_=ja;var Ua=class extends a{constructor(e){super(),this.period=e.cardData.periodLabel;let i=e.cardData.sections[0].analyticsKeyMetricsData;this.sections=i.dataModel.sections.map(o=>new U_(o))}};n(Ua,"AnalyticsMainAppKeyMetrics");Ua.type="AnalyticsMainAppKeyMetrics";var Xw=Ua;var Wa=class extends a{constructor(e){super();let i=e.analyticsTableCarouselData.data.tableCards;this.title=e.analyticsTableCarouselData.carouselTitle,this.selected_card_index_key=e.analyticsTableCarouselData.selectedCardIndexKey,this.table_cards=i.map(o=>({title:o.cardData.title,rows:o.cardData.rows.map(s=>({label:s.label,display_value:s.displayValue,display_value_a11y:s.displayValueA11y,bar_ratio:s.barRatio,bar_color:s.barColor,bar_opacity:s.barOpacity}))})),this.use_main_app_specs=e.analyticsTableCarouselData.useMainAppSpecs}};n(Wa,"AnalyticsRoot");Wa.type="AnalyticsRoot";var Qw=Wa;var Ha=class extends a{constructor(e){super(),this.title=e.title,this.shorts=e.shortsCarouselData.shorts.map(i=>({description:i.shortsDescription,thumbnail_url:i.thumbnailUrl,endpoint:new g(i.videoEndpoint)}))}};n(Ha,"AnalyticsShortsCarouselCard");Ha.type="AnalyticsShortsCarouselCard";var Zw=Ha;var Ja=class extends a{constructor(e){super(),this.title=e.videoTitle,this.metadata={views:e.videoDescription.split("\xB7")[0].trim(),published:e.videoDescription.split("\xB7")[1].trim(),thumbnails:w.fromResponse(e.thumbnailDetails),duration:e.formattedLength,is_short:e.isShort}}};n(Ja,"AnalyticsVideo");Ja.type="AnalyticsVideo";var W_=Ja;var Ga=class extends a{constructor(e){super(),this.title=e.title,Reflect.has(e,"noDataMessage")&&(this.no_data_message=e.noDataMessage),Reflect.has(e,"videoCarouselData")&&Reflect.has(e.videoCarouselData,"videos")&&(this.videos=e.videoCarouselData.videos.map(i=>new W_(i)))}};n(Ga,"AnalyticsVodCarouselCard");Ga.type="AnalyticsVodCarouselCard";var eT=Ga;var za=class extends a{constructor(e){super(),this.title=e.buttonLabel,this.use_new_specs=e.useNewSpecs}};n(za,"CtaGoToCreatorStudio");za.type="CtaGoToCreatorStudio";var tT=za;var $a=class extends a{constructor(e){super(),this.title=new u(e.title),this.contents=new u(e.contents)}};n($a,"StatRow");$a.type="StatRow";var iT=$a;var Ka=class extends a{constructor(e){super(),this.text=u.fromAttributed(e.text),this.suffix=u.fromAttributed(e.suffix)}};n(Ka,"AttributionView");Ka.type="AttributionView";var H_=Ka;var qa=class extends a{constructor(e){super(),this.audio_only_availability=e.audioOnlyAvailability}};n(qa,"AudioOnlyPlayability");qa.type="AudioOnlyPlayability";var J_=qa;var Xa=class extends a{constructor(e){var i,o;super(),!((o=(i=e==null?void 0:e.content)===null||i===void 0?void 0:i.automixPlaylistVideoRenderer)===null||o===void 0)&&o.navigationEndpoint&&(this.playlist_video={endpoint:new g(e.content.automixPlaylistVideoRenderer.navigationEndpoint)})}};n(Xa,"AutomixPreviewVideo");Xa.type="AutomixPreviewVideo";var Bi=Xa;var Qa=class extends a{constructor(e){super(),this.image=w.fromResponse(e.image),this.image_processor={border_image_processor:{circular:e.image.processor.borderImageProcessor.circular}},this.avatar_image_size=e.avatarImageSize}};n(Qa,"AvatarView");Qa.type="AvatarView";var G_=Qa;var Za=class extends a{constructor(e){super(),this.image=w.fromResponse(e.image),this.endpoint=new g(e.command)}};n(Za,"BackstageImage");Za.type="BackstageImage";var z_=Za;var eu=class extends a{constructor(e){var i,o,s,r,l,p,f,h,m;super(),this.text=new u(e.defaultText),this.toggled_text=new u(e.toggledText),this.tooltip=e.defaultTooltip,this.toggled_tooltip=e.toggledTooltip,this.is_toggled=e.isToggled,this.is_disabled=e.isDisabled,this.icon_type=(i=e.defaultIcon)===null||i===void 0?void 0:i.iconType;let b=((r=(s=(o=e==null?void 0:e.defaultText)===null||o===void 0?void 0:o.accessibility)===null||s===void 0?void 0:s.accessibilityData)===null||r===void 0?void 0:r.label)||((p=(l=e==null?void 0:e.accessibilityData)===null||l===void 0?void 0:l.accessibilityData)===null||p===void 0?void 0:p.label)||((f=e==null?void 0:e.accessibility)===null||f===void 0?void 0:f.label);this.icon_type=="LIKE"&&(this.like_count=parseInt(b.replace(/\D/g,"")),this.short_like_count=new u(e.defaultText).toString()),this.endpoint=!((m=(h=e.defaultServiceEndpoint)===null||h===void 0?void 0:h.commandExecutorCommand)===null||m===void 0)&&m.commands?new g(e.defaultServiceEndpoint.commandExecutorCommand.commands.pop()):new g(e.defaultServiceEndpoint),this.toggled_endpoint=new g(e.toggledServiceEndpoint),Reflect.has(e,"toggleButtonSupportedData")&&Reflect.has(e.toggleButtonSupportedData,"toggleButtonIdData")&&(this.button_id=e.toggleButtonSupportedData.toggleButtonIdData.id),Reflect.has(e,"targetId")&&(this.target_id=e.targetId)}};n(eu,"ToggleButton");eu.type="ToggleButton";var Re=eu;var tu=class extends a{constructor(e){var i,o;super(),this.creator_thumbnail=w.fromResponse(e.creatorThumbnail),Reflect.has(e,"heartIcon")&&Reflect.has(e.heartIcon,"iconType")&&(this.heart_icon_type=e.heartIcon.iconType),this.heart_color={basic_color_palette_data:{foreground_title_color:(o=(i=e.heartColor)===null||i===void 0?void 0:i.basicColorPaletteData)===null||o===void 0?void 0:o.foregroundTitleColor}},this.hearted_tooltip=e.heartedTooltip,this.is_hearted=e.isHearted,this.is_enabled=e.isEnabled,this.kennedy_heart_color_string=e.kennedyHeartColorString}};n(tu,"CreatorHeart");tu.type="CreatorHeart";var $_=tu;var iu=class extends a{constructor(e){super(),this.like_button=c.parseItem(e.likeButton,Re),this.dislike_button=c.parseItem(e.dislikeButton,Re),this.reply_button=c.parseItem(e.replyButton,S),this.creator_heart=c.parseItem(e.creatorHeart,$_)}};n(iu,"CommentActionButtons");iu.type="CommentActionButtons";var ns=iu;var ou=class extends a{constructor(e){super(),this.items=c.parseArray(e.items),this.top_level_buttons=c.parseArray(e.topLevelButtons),Reflect.has(e,"accessibility")&&Reflect.has(e.accessibility,"accessibilityData")&&(this.label=e.accessibility.accessibilityData.label)}get contents(){return this.items}};n(ou,"Menu");ou.type="Menu";var j=ou;var nu=class extends a{constructor(e){super(),this.id=e.postId,this.author=new V(Object.assign(Object.assign({},e.authorText),{navigationEndpoint:e.authorEndpoint}),null,e.authorThumbnail),this.content=new u(e.contentText),this.published=new u(e.publishedTimeText),Reflect.has(e,"pollStatus")&&(this.poll_status=e.pollStatus),Reflect.has(e,"voteStatus")&&(this.vote_status=e.voteStatus),Reflect.has(e,"voteCount")&&(this.vote_count=new u(e.voteCount)),Reflect.has(e,"actionMenu")&&(this.menu=c.parseItem(e.actionMenu,j)),Reflect.has(e,"actionButtons")&&(this.action_buttons=c.parseItem(e.actionButtons,ns)),Reflect.has(e,"voteButton")&&(this.vote_button=c.parseItem(e.voteButton,S)),Reflect.has(e,"navigationEndpoint")&&(this.endpoint=new g(e.navigationEndpoint)),Reflect.has(e,"backstageAttachment")&&(this.attachment=c.parseItem(e.backstageAttachment)),this.surface=e.surface}};n(nu,"BackstagePost");nu.type="BackstagePost";var Fi=nu;var su=class extends a{constructor(e){super(),this.post=c.parseItem(e.post)}};n(su,"BackstagePostThread");su.type="BackstagePostThread";var oT=su;var ru=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents)}};n(ru,"BrowseFeedActions");ru.type="BrowseFeedActions";var K_=ru;var au=class extends a{constructor(e){super(),this.album=new u(e.album),this.thumbnails=w.fromResponse(e.thumbnailDetails)}};n(au,"BrowserMediaSession");au.type="BrowserMediaSession";var nT=au;var uu=class extends a{constructor(e){super(),this.icon_name=e.iconName,this.title=e.title,this.accessibility_text=e.accessibilityText,this.style=e.style,this.is_full_width=e.isFullWidth,this.type=e.type,this.button_size=e.buttonSize,this.on_tap=new g(e.onTap)}};n(uu,"ButtonView");uu.type="ButtonView";var Vo=uu;var ss=class extends a{constructor(e){super(),this.endpoint=new g(e.navigationEndpoint),this.icon=w.fromResponse(e.icon),this.title=new u(e.title)}};n(ss,"HeaderLink");ss.type="HeaderLink";var lu=class extends a{constructor(e){var i,o;super(),this.primary=re(((i=e.primaryLinks)===null||i===void 0?void 0:i.map(s=>new ss(s)))||[]),this.secondary=re(((o=e.secondaryLinks)===null||o===void 0?void 0:o.map(s=>new ss(s)))||[])}};n(lu,"ChannelHeaderLinks");lu.type="ChannelHeaderLinks";var q_=lu;var cu=class extends a{constructor(e){super(),Reflect.has(e,"firstLink")&&(this.first_link=u.fromAttributed(e.firstLink)),Reflect.has(e,"more")&&(this.more=u.fromAttributed(e.more))}};n(cu,"ChannelHeaderLinksView");cu.type="ChannelHeaderLinksView";var X_=cu;var du=class extends a{constructor(e){super(),this.placeholder_text=new u(e.placeholderText),this.max_character_limit=e.maxCharacterLimit}};n(du,"ClipCreationTextInput");du.type="ClipCreationTextInput";var Q_=du;var pu=class extends a{constructor(e){var i,o,s,r,l,p;super(),this.length_template=e.lengthTemplate,this.max_length_ms=e.maxLengthMs,this.min_length_ms=e.minLengthMs,this.default_length_ms=e.defaultLengthMs,this.window_size_ms=e.windowSizeMs,this.start_label=(o=(i=e.startAccessibility)===null||i===void 0?void 0:i.accessibilityData)===null||o===void 0?void 0:o.label,this.end_label=(r=(s=e.endAccessibility)===null||s===void 0?void 0:s.accessibilityData)===null||r===void 0?void 0:r.label,this.duration_label=(p=(l=e.durationAccessibility)===null||l===void 0?void 0:l.accessibilityData)===null||p===void 0?void 0:p.label}};n(pu,"ClipCreationScrubber");pu.type="ClipCreationScrubber";var Z_=pu;var fu=class extends a{constructor(e){super(),this.title=new u(e.title),this.body=new u(e.body)}};n(fu,"ClipAdState");fu.type="ClipAdState";var ev=fu;var mu=class extends a{constructor(e){super(),this.user_avatar=w.fromResponse(e.userAvatar),this.title_input=c.parseItem(e.titleInput,[Q_]),this.scrubber=c.parseItem(e.scrubber,[Z_]),this.save_button=c.parseItem(e.saveButton,[S]),this.display_name=new u(e.displayName),this.publicity_label=e.publicityLabel,this.cancel_button=c.parseItem(e.cancelButton,[S]),this.ad_state_overlay=c.parseItem(e.adStateOverlay,[ev]),this.external_video_id=e.externalVideoId,this.publicity_label_icon=e.publicityLabelIcon}};n(mu,"ClipCreation");mu.type="ClipCreation";var tv=mu;var hu=class extends a{constructor(e){super(),this.contents=c.parse(e.contents,!0,[tv])}};n(hu,"ClipSection");hu.type="ClipSection";var iv=hu;var _u=class extends a{constructor(e){super(),this.trigger=e.trigger,Reflect.has(e,"button")&&(this.button=c.parseItem(e.button,S)),this.endpoint=new g(e.continuationEndpoint)}};n(_u,"ContinuationItem");_u.type="ContinuationItem";var he=_u;var vu=class extends a{constructor(e){super(),this.title=new u(e.title),this.visibility_button=c.parseItem(e.visibilityButton,S)}};n(vu,"EngagementPanelTitleHeader");vu.type="EngagementPanelTitleHeader";var ov=vu;var gu=class extends a{constructor(e){super(),this.info_text=new u(e.infoText),this.menu=c.parseItem(e.menu,j)}};n(gu,"MacroMarkersInfoItem");gu.type="MacroMarkersInfoItem";var nv=gu;var xu=class extends a{constructor(e){super(),this.title=new u(e.title),this.time_description=new u(e.timeDescription),this.thumbnail=w.fromResponse(e.thumbnail),this.on_tap_endpoint=new g(e.onTap),this.layout=e.layout,this.is_highlighted=!!e.isHighlighted}};n(xu,"MacroMarkersListItem");xu.type="MacroMarkersListItem";var rs=xu;var yu=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents,[nv,rs]),this.sync_button_label=new u(e.syncButtonLabel)}};n(yu,"MacroMarkersList");yu.type="MacroMarkersList";var sv=yu;var bu=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents)}};n(bu,"ProductList");bu.type="ProductList";var rv=bu;var wu=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents),Reflect.has(e,"targetId")&&(this.target_id=e.targetId),Reflect.has(e,"continuations")&&(Reflect.has(e.continuations[0],"nextContinuationData")?this.continuation=e.continuations[0].nextContinuationData.continuation:Reflect.has(e.continuations[0],"reloadContinuationData")&&(this.continuation=e.continuations[0].reloadContinuationData.continuation)),Reflect.has(e,"header")&&(this.header=c.parseItem(e.header)),Reflect.has(e,"subMenu")&&(this.sub_menu=c.parseItem(e.subMenu))}};n(wu,"SectionList");wu.type="SectionList";var Q=wu;var Tu=class extends a{constructor(e){var i;super(),this.show_more_text=new u(e.showMoreText),this.show_less_text=new u(e.showLessText),Reflect.has(e,"attributedDescriptionBodyText")&&(this.attributed_description_body_text=(i=e.attributedDescriptionBodyText)===null||i===void 0?void 0:i.content)}};n(Tu,"ExpandableVideoDescriptionBody");Tu.type="ExpandableVideoDescriptionBody";var av=Tu;var Iu=class extends a{constructor(e){super(),this.thumbnails=w.fromResponse(e.thumbnail),this.endpoint=new g(e.searchEndpoint),this.query=new u(e.query).toString()}};n(Iu,"SearchRefinementCard");Iu.type="SearchRefinementCard";var Oo=Iu;var ku=class extends a{constructor(e){super(),this.game=c.parseItem(e.game)}};n(ku,"GameCard");ku.type="GameCard";var uv=ku;var Su=class extends a{constructor(e){super(),this.visible_item_count=e.visibleItemCount,this.items=c.parseArray(e.items)}get contents(){return this.items}};n(Su,"HorizontalList");Su.type="HorizontalList";var lv=Su;var Cu=class extends a{constructor(e){super(),Reflect.has(e,"header")&&(this.header={collapsed_title:new u(e.header.collapsedTitle),collapsed_thumbnail:w.fromResponse(e.header.collapsedThumbnail),collapsed_label:new u(e.header.collapsedLabel),expanded_title:new u(e.header.expandedTitle)}),this.expanded_content=c.parseItem(e.expandedContent,[Yi,lv]),this.expand_button=c.parseItem(e.expandButton,S),this.collapse_button=c.parseItem(e.collapseButton,S)}};n(Cu,"ExpandableMetadata");Cu.type="ExpandableMetadata";var cv=Cu;var Eu=class extends a{constructor(e){super(),Reflect.has(e,"icon")&&(this.icon_type=e.icon.iconType),Reflect.has(e,"style")&&(this.style=e.style),Reflect.has(e,"label")&&(this.label=e.label),(Reflect.has(e,"tooltip")||Reflect.has(e,"iconTooltip"))&&(this.tooltip=e.tooltip||e.iconTooltip)}};n(Eu,"MetadataBadge");Eu.type="MetadataBadge";var ct=Eu;var Pu=class extends a{constructor(e){super(),this.text=new u(e.text).toString(),this.style=e.style}};n(Pu,"ThumbnailOverlayTimeStatus");Pu.type="ThumbnailOverlayTimeStatus";var Do=Pu;var Nu=class extends a{constructor(e){var i,o,s;super();let r=((i=e.thumbnailOverlays.find(l=>l.thumbnailOverlayTimeStatusRenderer))===null||i===void 0?void 0:i.thumbnailOverlayTimeStatusRenderer.text)||"N/A";this.id=e.videoId,this.title=new u(e.title),Reflect.has(e,"descriptionSnippet")&&(this.description_snippet=new u(e.descriptionSnippet)),Reflect.has(e,"detailedMetadataSnippets")&&(this.snippets=e.detailedMetadataSnippets.map(l=>({text:new u(l.snippetText),hover_text:new u(l.snippetHoverText)}))),this.expandable_metadata=c.parseItem(e.expandableMetadata,cv),this.thumbnails=w.fromResponse(e.thumbnail),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),Reflect.has(e,"richThumbnail")&&(this.rich_thumbnail=c.parseItem(e.richThumbnail)),this.author=new V(e.ownerText,e.ownerBadges,(s=(o=e.channelThumbnailSupportedRenderers)===null||o===void 0?void 0:o.channelThumbnailWithLinkRenderer)===null||s===void 0?void 0:s.thumbnail),this.badges=c.parseArray(e.badges,ct),this.endpoint=new g(e.navigationEndpoint),this.published=new u(e.publishedTimeText),this.view_count=new u(e.viewCountText),this.short_view_count=new u(e.shortViewCountText),Reflect.has(e,"upcomingEventData")&&(this.upcoming=new Date(Number(`${e.upcomingEventData.startTime}000`))),this.duration={text:e.lengthText?new u(e.lengthText).toString():new u(r).toString(),seconds:je(e.lengthText?new u(e.lengthText).toString():new u(r).toString())},this.show_action_menu=!!e.showActionMenu,this.is_watched=!!e.isWatched,this.menu=c.parseItem(e.menu,j),Reflect.has(e,"searchVideoResultEntityKey")&&(this.search_video_result_entity_key=e.searchVideoResultEntityKey)}get description(){var e;return this.snippets?this.snippets.map(i=>i.text.toString()).join(""):((e=this.description_snippet)===null||e===void 0?void 0:e.toString())||""}get is_live(){var e;return this.badges.some(i=>{if(i.style==="BADGE_STYLE_TYPE_LIVE_NOW"||i.label==="LIVE")return!0})||((e=this.thumbnail_overlays.firstOfType(Do))===null||e===void 0?void 0:e.style)==="LIVE"}get is_upcoming(){return this.upcoming&&this.upcoming>new Date}get is_premiere(){return this.badges.some(e=>e.label==="PREMIERE")}get is_4k(){return this.badges.some(e=>e.label==="4K")}get has_captions(){return this.badges.some(e=>e.label==="CC")}get best_thumbnail(){return this.thumbnails[0]}};n(Nu,"Video");Nu.type="Video";var as=Nu;var Au=class extends as{constructor(e){super(e)}};n(Au,"VideoCard");Au.type="VideoCard";var dv=Au;var Ru=class extends a{constructor(e){super(),this.image=w.fromResponse(e.image),this.style=e.style}};n(Ru,"ContentPreviewImageView");Ru.type="ContentPreviewImageView";var us=Ru;var Mu=class extends a{constructor(e){var i;super(),!((i=e.image)===null||i===void 0)&&i.sources?this.image=w.fromResponse(e.image):this.image=c.parseItem(e.image,us),this.image_style=e.imageStyle,this.title=e.title,this.subtitle=e.subtitle,this.secondary_subtitle={content:e.secondarySubtitle.content},this.orientation=e.orientation,this.sizing_rule=e.sizingRule,this.overflow_menu_on_tap=new g(e.overflowMenuOnTap),this.overflow_menu_a11y_label=e.overflowMenuA11yLabel}};n(Mu,"VideoAttributeView");Mu.type="VideoAttributeView";var ls=Mu;var Vu=class extends a{constructor(e){super(),this.cards=c.parseArray(e.cards,[ls,Oo,rs,uv,dv]),this.header=c.parseItem(e.header),this.previous_button=c.parseItem(e.previousButton,S),this.next_button=c.parseItem(e.nextButton,S)}};n(Vu,"HorizontalCardList");Vu.type="HorizontalCardList";var Yi=Vu;var Ou=class extends a{constructor(e){super(),this.label=new u(e.label),this.value=new u(e.value),this.accessibility_text=e.accessibilityText}};n(Ou,"Factoid");Ou.type="Factoid";var ji=Ou;var Du=class extends a{constructor(e){super(),this.factoid=c.parseItem(e.factoid,ji)}};n(Du,"UploadTimeFactoid");Du.type="UploadTimeFactoid";var pv=Du;var Lu=class extends a{constructor(e){super(),this.view_count_entity_key=e.viewCountEntityKey,this.factoid=c.parseItem(e.factoid,[ji]),this.view_count_type=e.viewCountType}};n(Lu,"ViewCountFactoid");Lu.type="ViewCountFactoid";var fv=Lu;var Bu=class extends a{constructor(e){super(),this.title=new u(e.title),this.channel=new u(e.channel),this.channel_navigation_endpoint=new g(e.channelNavigationEndpoint),this.channel_thumbnail=w.fromResponse(e.channelThumbnail),this.publish_date=new u(e.publishDate),this.views=new u(e.views),this.factoids=c.parseArray(e.factoid,[ji,fv,pv])}};n(Bu,"VideoDescriptionHeader");Bu.type="VideoDescriptionHeader";var mv=Bu;var Fu=class extends a{constructor(e){super(),this.section_title=new u(e.sectionTitle),this.creator_videos_button=c.parseItem(e.creatorVideosButton,S),this.creator_about_button=c.parseItem(e.creatorAboutButton,S),this.section_subtitle=new u(e.sectionSubtitle),this.channel_avatar=w.fromResponse(e.channelAvatar),this.channel_endpoint=new g(e.channelEndpoint)}};n(Fu,"VideoDescriptionInfocardsSection");Fu.type="VideoDescriptionInfocardsSection";var hv=Fu;var Yu=class extends a{constructor(e){super(),this.title=new u(e.title),Reflect.has(e,"defaultMetadata")&&(this.default_metadata=new u(e.defaultMetadata)),Reflect.has(e,"expandedMetadata")&&(this.expanded_metadata=new u(e.expandedMetadata)),Reflect.has(e,"infoRowExpandStatusKey")&&(this.info_row_expand_status_key=e.infoRowExpandStatusKey)}};n(Yu,"InfoRow");Yu.type="InfoRow";var _v=Yu;var ju=class extends a{constructor(e){super(),this.id=e.videoId,this.thumbnails=w.fromResponse(e.thumbnail)||null,Reflect.has(e,"richThumbnail")&&(this.rich_thumbnail=c.parse(e.richThumbnail)),this.title=new u(e.title),this.author=new V(e.longBylineText,e.ownerBadges,e.channelThumbnail),this.view_count=new u(e.viewCountText),this.short_view_count=new u(e.shortViewCountText),this.published=new u(e.publishedTimeText),this.badges=c.parseArray(e.badges,ct),this.duration={text:new u(e.lengthText).toString(),seconds:je(new u(e.lengthText).toString())},this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),this.endpoint=new g(e.navigationEndpoint),this.menu=c.parseItem(e.menu,j)}get best_thumbnail(){return this.thumbnails[0]}get is_fundraiser(){return this.badges.some(e=>e.label==="Fundraiser")}get is_live(){return this.badges.some(e=>{if(e.style==="BADGE_STYLE_TYPE_LIVE_NOW"||e.label==="LIVE")return!0})}get is_new(){return this.badges.some(e=>e.label==="New")}get is_premiere(){return this.badges.some(e=>e.style==="PREMIERE")}};n(ju,"CompactVideo");ju.type="CompactVideo";var cs=ju;var Uu=class extends a{constructor(e){super(),this.info_rows=c.parseArray(e.infoRows,_v),this.video_lockup=c.parseItem(e.videoLockup,cs)}};n(Uu,"CarouselLockup");Uu.type="CarouselLockup";var vv=Uu;var Wu=class extends a{constructor(e){super(),this.carousel_lockups=c.parseArray(e.carouselLockups,vv),this.section_title=new u(e.sectionTitle)}};n(Wu,"VideoDescriptionMusicSection");Wu.type="VideoDescriptionMusicSection";var ds=Wu;var Hu=class extends a{constructor(e){super(),this.section_title=new u(e.sectionTitle),this.sub_header_text=new u(e.subHeaderText),this.primary_button=c.parseItem(e.primaryButton,S)}};n(Hu,"VideoDescriptionTranscriptSection");Hu.type="VideoDescriptionTranscriptSection";var Ju=Hu;var Gu=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail),this.title=new u(e.title),this.short_byline_text=new u(e.shortBylineText),this.video_count_short_text=new u(e.videoCountShortText),this.endpoint=new g(e.navigationEndpoint),this.thumbnail_width=e.thumbnailWidth,this.aspect_ratio=e.aspectRatio,this.max_lines_title=e.maxLinesTitle,this.max_lines_short_byline_text=e.maxLinesShortBylineText,this.overlay_position=e.overlayPosition}};n(Gu,"StructuredDescriptionPlaylistLockup");Gu.type="StructuredDescriptionPlaylistLockup";var gv=Gu;var zu=class extends a{constructor(e){super(),this.section_title=new u(e.sectionTitle),this.media_lockups=c.parseArray(e.mediaLockups,[gv])}};n(zu,"VideoDescriptionCourseSection");zu.type="VideoDescriptionCourseSection";var xv=zu;var $u=class extends a{constructor(e){super(),this.title=new u(e.title),this.items=c.parseArray(e.items),Reflect.has(e,"endpoint")&&(this.endpoint=new g(e.endpoint))}get contents(){return this.items}};n($u,"ReelShelf");$u.type="ReelShelf";var ps=$u;var Ku=class extends a{constructor(e){super(),this.items=c.parseArray(e.items,[mv,av,ds,hv,xv,Ju,Ju,Yi,ps])}};n(Ku,"StructuredDescriptionContent");Ku.type="StructuredDescriptionContent";var Lo=Ku;var qu=class extends a{constructor(e){super(),this.header=c.parseItem(e.header,ov),this.content=c.parseItem(e.content,[ls,Q,he,iv,Lo,sv,rv]),this.panel_identifier=e.panelIdentifier,this.identifier=e.identifier?{surface:e.identifier.surface,tag:e.identifier.tag}:void 0,this.target_id=e.targetId,this.visibility=e.visibility}};n(qu,"EngagementPanelSectionList");qu.type="EngagementPanelSectionList";var Ui=qu;var Xu=class extends a{constructor(e){super(),this.content=e.content,this.max_lines=e.maxLines,this.more_endpoint=e.moreEndpoint.showEngagementPanelEndpoint?{show_engagement_panel_endpoint:{engagement_panel:c.parseItem(e.moreEndpoint.showEngagementPanelEndpoint.engagementPanel,Ui),engagement_panel_popup_type:e.moreEndpoint.showEngagementPanelEndpoint.engagementPanelPresentationConfigs.engagementPanelPopupPresentationConfig.popupType,identifier:{surface:e.moreEndpoint.showEngagementPanelEndpoint.identifier.surface,tag:e.moreEndpoint.showEngagementPanelEndpoint.identifier.tag}}}:new g(e.moreEndpoint),this.more_icon_type=e.moreIcon.iconType,this.more_label=e.moreLabel,this.target_id=e.targetId}};n(Xu,"ChannelTagline");Xu.type="ChannelTagline";var yv=Xu;var Qu=class extends a{constructor(e){super(),this.states=e.states.map(i=>({id:i.stateId,next_id:i.nextStateId,state:c.parse(i.state)})),this.current_state_id=e.currentStateId,this.target_id=e.targetId}};n(Qu,"SubscriptionNotificationToggleButton");Qu.type="SubscriptionNotificationToggleButton";var bv=Qu;var Zu=class extends a{constructor(e){var i,o;super(),this.title=new u(e.buttonText),this.subscribed=e.subscribed,this.enabled=e.enabled,this.item_type=e.type,this.channel_id=e.channelId,this.show_preferences=e.showPreferences,this.subscribed_text=new u(e.subscribedButtonText),this.unsubscribed_text=new u(e.unsubscribedButtonText),this.notification_preference_button=c.parseItem(e.notificationPreferenceButton,bv),this.endpoint=new g(((i=e.serviceEndpoints)===null||i===void 0?void 0:i[0])||((o=e.onSubscribeEndpoints)===null||o===void 0?void 0:o[0]))}};n(Zu,"SubscribeButton");Zu.type="SubscribeButton";var $e=Zu;var el=class extends a{constructor(e){super(),this.author=new V({simpleText:e.title,navigationEndpoint:e.navigationEndpoint},e.badges,e.avatar),Reflect.has(e,"banner")&&(this.banner=w.fromResponse(e.banner)),Reflect.has(e,"tv_banner")&&(this.tv_banner=w.fromResponse(e.tvBanner)),Reflect.has(e,"mobile_banner")&&(this.mobile_banner=w.fromResponse(e.mobileBanner)),Reflect.has(e,"subscriberCountText")&&(this.subscribers=new u(e.subscriberCountText)),Reflect.has(e,"videosCountText")&&(this.videos_count=new u(e.videosCountText)),Reflect.has(e,"sponsorButton")&&(this.sponsor_button=c.parseItem(e.sponsorButton,S)),Reflect.has(e,"subscribeButton")&&(this.subscribe_button=c.parseItem(e.subscribeButton,[$e,S])),Reflect.has(e,"headerLinks")&&(this.header_links=c.parseItem(e.headerLinks,[q_,X_])),Reflect.has(e,"channelHandleText")&&(this.channel_handle=new u(e.channelHandleText)),Reflect.has(e,"channelId")&&(this.channel_id=e.channelId),Reflect.has(e,"tagline")&&(this.tagline=c.parseItem(e.tagline,yv))}};n(el,"C4TabbedHeader");el.type="C4TabbedHeader";var Wi=el;var tl=class extends a{constructor(e){super(),this.label=new u(e.label),this.icon_type=e.icon.iconType,this.style=e.style}};n(tl,"CallToActionButton");tl.type="CallToActionButton";var sT=tl;var il=class extends a{constructor(e){super(),this.teaser=c.parseItem(e.teaser),this.content=c.parseItem(e.content),Reflect.has(e,"cardId")&&(this.card_id=e.cardId),Reflect.has(e,"feature")&&(this.feature=e.feature),this.cue_ranges=e.cueRanges.map(i=>({start_card_active_ms:i.startCardActiveMs,end_card_active_ms:i.endCardActiveMs,teaser_duration_ms:i.teaserDurationMs,icon_after_teaser_ms:i.iconAfterTeaserMs}))}};n(il,"Card");il.type="Card";var rT=il;var ol=class extends a{constructor(e){super(),this.cards=c.parseArray(e.cards),this.header=new u(e.headerText),this.allow_teaser_dismiss=e.allowTeaserDismiss}};n(ol,"CardCollection");ol.type="CardCollection";var wv=ol;var nl=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents)}};n(nl,"CarouselHeader");nl.type="CarouselHeader";var Tv=nl;var sl=class extends a{constructor(e){super(),this.items=c.parseArray(e.carouselItems),this.background_color=e.backgroundColor,this.layout_style=e.layoutStyle,this.pagination_thumbnails=w.fromResponse(e.paginationThumbnails),this.paginator_alignment=e.paginatorAlignment}get contents(){return this.items}};n(sl,"CarouselItem");sl.type="CarouselItem";var aT=sl;var Hi=class extends a{constructor(e){super(),this.id=e.channelId,this.author=new V(Object.assign(Object.assign({},e.title),{navigationEndpoint:e.navigationEndpoint}),e.ownerBadges,e.thumbnail),this.subscriber_count=new u(e.subscriberCountText),this.video_count=new u(e.videoCountText),this.long_byline=new u(e.longBylineText),this.short_byline=new u(e.shortBylineText),this.endpoint=new g(e.navigationEndpoint),this.subscribe_button=c.parseItem(e.subscribeButton,[$e,S]),this.description_snippet=new u(e.descriptionSnippet)}get subscribers(){return U.warnOnce(Hi.type,"Channel#subscribers is deprecated. Please use Channel#subscriber_count instead."),this.subscriber_count}get videos(){return U.warnOnce(Hi.type,"Channel#videos is deprecated. Please use Channel#video_count instead."),this.video_count}};n(Hi,"Channel");Hi.type="Channel";var Iv=Hi;var Ji=class extends a{constructor(e){var i,o;super(),this.id=e.channelId,this.name=new u(e.title),this.avatar=w.fromResponse(e.avatar),this.canonical_channel_url=e.canonicalChannelUrl,this.primary_links=(o=(i=e.primaryLinks)===null||i===void 0?void 0:i.map(s=>({endpoint:new g(s.navigationEndpoint),icon:w.fromResponse(s.icon),title:new u(s.title)})))!==null&&o!==void 0?o:[],this.view_count=new u(e.viewCountText),this.joined_date=new u(e.joinedDateText),this.description=new u(e.description),this.email_reveal=new g(e.onBusinessEmailRevealClickCommand),this.can_reveal_email=!e.signInForBusinessEmail,this.country=new u(e.country),this.buttons=c.parseArray(e.actionButtons,S)}get views(){return U.warnOnce(Ji.type,"ChannelAboutFullMetadata#views is deprecated. Please use ChannelAboutFullMetadata#view_count instead."),this.view_count}get joined(){return U.warnOnce(Ji.type,"ChannelAboutFullMetadata#joined is deprecated. Please use ChannelAboutFullMetadata#joined_date instead."),this.joined_date}};n(Ji,"ChannelAboutFullMetadata");Ji.type="ChannelAboutFullMetadata";var rl=Ji;var al=class extends a{constructor(e){super(),this.channel_title=e.channelTitle,this.avatar=w.fromResponse(e.avatar),this.header=new u(e.header),this.main_text=new u(e.mainText),this.sign_in_button=c.parseItem(e.signInButton,S),this.secondary_text=new u(e.secondaryText)}};n(al,"ChannelAgeGate");al.type="ChannelAgeGate";var uT=al;var ul=class extends a{constructor(e){super(),this.title=new u(e.title),this.items=c.parseArray(e.items)}};n(ul,"ChannelFeaturedContent");ul.type="ChannelFeaturedContent";var lT=ul;var ll=class extends a{constructor(e){super(),this.title=e.title,this.description=e.description,this.url=e.channelUrl,this.rss_url=e.rssUrl,this.vanity_channel_url=e.vanityChannelUrl,this.external_id=e.externalId,this.is_family_safe=e.isFamilySafe,this.keywords=e.keywords,this.avatar=w.fromResponse(e.avatar),this.music_artist_name=typeof e.musicArtistName=="string"&&e.musicArtistName.length>0?e.musicArtistName:void 0,this.available_countries=e.availableCountryCodes,this.android_deep_link=e.androidDeepLink,this.android_appindexing_link=e.androidAppindexingLink,this.ios_appindexing_link=e.iosAppindexingLink}};n(ll,"ChannelMetadata");ll.type="ChannelMetadata";var kv=ll;var cl=class extends a{constructor(e){super(),this.title=new u(e.title)}};n(cl,"ChannelMobileHeader");cl.type="ChannelMobileHeader";var cT=cl;var dl=class extends a{constructor(e){super(),this.avatar=w.fromResponse(e.avatar),this.endpoint=new g(e.avatarEndpoint),this.name=e.name,this.links=e.links.map(i=>new u(i))}};n(dl,"ChannelOptions");dl.type="ChannelOptions";var Sv=dl;var pl=class extends a{constructor(e){super(),this.illustration=w.fromResponse(e.illustration),this.description=new u(e.description)}};n(pl,"ChannelOwnerEmptyState");pl.type="ChannelOwnerEmptyState";var dT=pl;var fl=class extends a{constructor(e){super(),this.content_type_sub_menu_items=e.contentTypeSubMenuItems.map(i=>({endpoint:new g(i.navigationEndpoint||i.endpoint),selected:i.selected,title:i.title})),this.sort_setting=c.parseItem(e.sortSetting)}};n(fl,"ChannelSubMenu");fl.type="ChannelSubMenu";var ml=fl;var hl=class extends a{constructor(e){var i,o;super(),this.thumbnails=w.fromResponse(e.thumbnail),this.endpoint=new g(e.navigationEndpoint),this.label=(o=(i=e.accessibility)===null||i===void 0?void 0:i.accessibilityData)===null||o===void 0?void 0:o.label}};n(hl,"ChannelThumbnailWithLink");hl.type="ChannelThumbnailWithLink";var pT=hl;var Gi=class extends a{constructor(e){super(),this.id=e.videoId,this.title=new u(e.title),this.description=new u(e.description),this.view_count=new u(e.viewCountText),this.published_time=new u(e.publishedTimeText)}get views(){return U.warnOnce(Gi.type,"ChannelVideoPlayer#views is deprecated. Please use ChannelVideoPlayer#view_count instead."),this.view_count}get published(){return U.warnOnce(Gi.type,"ChannelVideoPlayer#published is deprecated. Please use ChannelVideoPlayer#published_time instead."),this.published_time}};n(Gi,"ChannelVideoPlayer");Gi.type="ChannelVideoPlayer";var fT=Gi;var _l=class extends a{constructor(e){super(),this.title=new u(e.title),this.time_range_start_millis=e.timeRangeStartMillis,this.thumbnail=w.fromResponse(e.thumbnail)}};n(_l,"Chapter");_l.type="Chapter";var Cv=_l;var vl=class extends a{constructor(e){super(),this.id=e.videoId,this.title=new u(e.title),this.duration={text:e.lengthText.simpleText,seconds:je(e.lengthText.simpleText)},this.endpoint=new g(e.navigationEndpoint)}};n(vl,"ChildVideo");vl.type="ChildVideo";var mT=vl;var gl=class extends a{constructor(e){super(),this.text=e.text,this.display_type=e.displayType,this.endpoint=new g(e.tapCommand),this.chip_entity_key=e.chipEntityKey}};n(gl,"ChipView");gl.type="ChipView";var Ev=gl;var xl=class extends a{constructor(e){super(),this.chips=c.parseArray(e.chips,Ev)}};n(xl,"ChipBarView");xl.type="ChipBarView";var hT=xl;var yl=class extends a{constructor(e){super(),this.is_selected=e.isSelected,Reflect.has(e,"navigationEndpoint")&&(this.endpoint=new g(e.navigationEndpoint)),this.text=new u(e.text).toString()}};n(yl,"ChipCloudChip");yl.type="ChipCloudChip";var xe=yl;var bl=class extends a{constructor(e){super(),this.chips=c.parseArray(e.chips,xe),this.next_button=c.parseItem(e.nextButton,S),this.previous_button=c.parseItem(e.previousButton,S),this.horizontal_scrollable=e.horizontalScrollable}};n(bl,"ChipCloud");bl.type="ChipCloud";var vt=bl;var wl=class extends a{constructor(e){super(),this.channel_avatar=w.fromResponse(e.channelAvatar),this.custom_text=new u(e.customText),this.channel_name=new u(e.channelName),this.subscriber_count=new u(e.subscriberCountText),this.endpoint=new g(e.endpoint)}};n(wl,"CollaboratorInfoCardContent");wl.type="CollaboratorInfoCardContent";var _T=wl;var Tl=class extends a{constructor(e){super(),this.left=w.fromResponse(e.leftThumbnail),this.top_right=w.fromResponse(e.topRightThumbnail),this.bottom_right=w.fromResponse(e.bottomRightThumbnail),this.endpoint=new g(e.navigationEndpoint)}};n(Tl,"CollageHeroImage");Tl.type="CollageHeroImage";var vT=Tl;var Il=class extends a{constructor(e){super(),this.icon_name=e.icon.sources[0].clientResource.imageName,this.text=u.fromAttributed(e.text),this.style=e.style}};n(Il,"ThumbnailHoverOverlayView");Il.type="ThumbnailHoverOverlayView";var Pv=Il;var kl=class extends a{constructor(e){super(),this.icon_name=e.icon.sources[0].clientResource.imageName,this.text=e.text,this.badge_style=e.badgeStyle,this.background_color={light_theme:e.backgroundColor.lightTheme,dark_theme:e.backgroundColor.darkTheme}}};n(kl,"ThumbnailBadgeView");kl.type="ThumbnailBadgeView";var Nv=kl;var Sl=class extends a{constructor(e){super(),this.badges=c.parseArray(e.thumbnailBadges,Nv),this.position=e.position}};n(Sl,"ThumbnailOverlayBadgeView");Sl.type="ThumbnailOverlayBadgeView";var Av=Sl;var Cl=class extends a{constructor(e){super(),this.image=w.fromResponse(e.image),this.overlays=c.parseArray(e.overlays,[Av,Pv]),this.background_color={light_theme:e.backgroundColor.lightTheme,dark_theme:e.backgroundColor.darkTheme}}};n(Cl,"ThumbnailView");Cl.type="ThumbnailView";var Rv=Cl;var El=class extends a{constructor(e){super(),this.primary_thumbnail=c.parseItem(e.primaryThumbnail,Rv),this.stack_color={light_theme:e.stackColor.lightTheme,dark_theme:e.stackColor.darkTheme}}};n(El,"CollectionThumbnailView");El.type="CollectionThumbnailView";var Mv=El;var Pl=class extends a{constructor(e){super(),this.endpoint=new g(e)}};n(Pl,"Command");Pl.type="Command";var gT=Pl;var Vv,Nl=class extends a{constructor(e){super(),Vv.set(this,void 0),Reflect.has(e,"icon")&&Reflect.has(e.icon,"iconType")&&(this.icon_type=e.icon.iconType),this.tooltip=e.iconTooltip,this.tooltip==="Verified"&&(this.style="BADGE_STYLE_TYPE_VERIFIED")&&(e.style="BADGE_STYLE_TYPE_VERIFIED"),I(this,Vv,e,"f")}get orig_badge(){return d(this,Vv,"f")}};n(Nl,"AuthorCommentBadge");Vv=new WeakMap;Nl.type="AuthorCommentBadge";var Ov=Nl;var Al=class extends a{constructor(e){super(),this.reply_button=c.parseItem(e.replyButton,S),this.cancel_button=c.parseItem(e.cancelButton,S),this.author_thumbnail=w.fromResponse(e.authorThumbnail),this.placeholder=new u(e.placeholderText),this.error_message=new u(e.errorMessage)}};n(Al,"CommentReplyDialog");Al.type="CommentReplyDialog";var fs=Al;var Rl=class extends a{constructor(e){var i,o;super(),this.text=new u(e.chipText),this.color_pallette={background_color:(i=e.chipColorPalette)===null||i===void 0?void 0:i.backgroundColor,foreground_title_color:(o=e.chipColorPalette)===null||o===void 0?void 0:o.foregroundTitleColor},Reflect.has(e,"chipIcon")&&Reflect.has(e.chipIcon,"iconType")&&(this.icon_type=e.chipIcon.iconType)}};n(Rl,"PdgCommentChip");Rl.type="PdgCommentChip";var Dv=Rl;var Ml=class extends a{constructor(e){super(),this.custom_badge=w.fromResponse(e.customBadge),this.tooltip=e.tooltip}};n(Ml,"SponsorCommentBadge");Ml.type="SponsorCommentBadge";var Lv=Ml;var St={};B(St,{decodeVisitorData:()=>db,encodeChannelAnalyticsParams:()=>pb,encodeCommentActionParams:()=>Bo,encodeCommentParams:()=>vb,encodeCommentsSectionParams:()=>_b,encodeCustomThumbnailPayload:()=>yb,encodeHashtag:()=>bb,encodeMessageParams:()=>hb,encodeMusicSearchFilters:()=>mb,encodeNotificationPref:()=>gb,encodeReelSequence:()=>wb,encodeSearchFilters:()=>fb,encodeShortsParam:()=>bE,encodeVideoMetadataPayload:()=>xb,encodeVisitorData:()=>cb});var P;(function(t){t[t.Varint=0]="Varint",t[t.Fixed64=1]="Fixed64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Fixed32=5]="Fixed32"})(P||(P={}));var W=class extends Uint32Array{constructor(e=0,i=0){super([e,i])}toString(e=!0){let[i,o]=this;if(i===0&&o===0)return"0";if(e&&o>2147483647)return"-"+Fv(ob(this),Bv).toString(!1);let s=[],r=new W(i,o);for(;XC(r,KC);){let[l,p]=qC(r);s.push(p),r=l}return s.reverse().join("")}static parse(e){let i=parseInt(e,10),o=i<0;if(Number.isNaN(i))return new W(0);if(e.length<10)return i<0?Fv(ob(new W(-i)),Bv):new W(i);let s=new W,r=Bv;for(let l of e.split("").reverse())parseInt(l)&&(s=Fv(s,xT(new W(parseInt(l)),r))),r=xT(r,new W(10));return o?Fv(ob(s),Bv):s}};n(W,"Long");var KC=new W(0),Bv=new W(1);function Yv(t){let[e,i]=t;return[e&65535,e>>>16,i&65535,i>>>16]}n(Yv,"makeChunk");function Fv(t,e){let[i,o,s,r]=Yv(t),[l,p,f,h]=Yv(e),m=0,b=0,x=0,T=0;return T+=i+l,x+=T>>>16,T&=65535,x+=o+p,b+=x>>>16,x&=65535,b+=s+f,m+=b>>>16,b&=65535,m+=r+h,m&=65535,new W(x<<16|T,m<<16|b)}n(Fv,"add");function xT(t,e){let[i,o,s,r]=Yv(t),[l,p,f,h]=Yv(e),m=0,b=0,x=0,T=0;return T+=i*l,x+=T>>>16,T&=65535,x+=i*p+o*l,b+=x>>>16,x&=65535,b+=i*f+s*l+o*p,m+=b>>>16,b&=65535,m+=i*h+o*f+s*p+r*l,m&=65535,new W(x<<16|T,m<<16|b)}n(xT,"mul");function qC(t){let[e,i]=t;return[new W((i%10*(4294967295+1)+e)/10|0,i/10|0),(i%10*(4294967295+1)+e)%10]}n(qC,"divByTen");function XC(t,e){let[i,o]=t,[s,r]=e;return o!==r?o-r:i-s}n(XC,"compare");function ob(t){let[e,i]=t;return new W(~e,~i)}n(ob,"negate");function ms(t){let e=[],s=typeof t=="number"?new W(t):t;for(;s[0]||s[1];){let[r,l]=s,p=r&127,f=l>>>7,h=r>>>7|(l&127)<<32-7;s=new W(h,f);let m=s[0]||s[1]?p|128:p;e.push(m)}return e.length<1?new Uint8Array(1):Uint8Array.from(e)}n(ms,"encode");function hs(t){let e=new W(0),i=0;for(;;){let o=t.getUint8(i);if(e=QC(e,ZC(new W(o&127),i*7)),++i,!(o>>>7))return[i,e]}}n(hs,"decode");function QC(t,e){return new W(t[0]|e[0],t[1]|e[1])}n(QC,"or");function ZC(t,e){return e===0?t:e>=32?new W(0,t[0]<<e-32):new W(t[0]<<e,t[1]<<e|t[0]>>>32-e)}n(ZC,"leftshift");function N(t){let e=[];return t.forEach(([i,o])=>{switch(e.push(ms(i<<3|o.type)),o.type){case P.Varint:e.push(ms(o.value));break;case P.Fixed64:{let s=new Uint8Array(8),r=new DataView(s.buffer);r.setUint32(0,o.value[0],!0),r.setUint32(4,o.value[1],!0),e.push(s);break}case P.LengthDelimited:e.push(ms(o.value.byteLength)),e.push(o.value);break;case P.Fixed32:{let s=new Uint8Array(4);new DataView(s.buffer).setUint32(0,o.value,!0),e.push(s);break}}}),nb(e)}n(N,"serialize");function nb(t){let e=t.reduce((o,s)=>o+s.byteLength,0),i=new Uint8Array(e);return t.reduce((o,s)=>(i.set(s,o),o+s.byteLength),0),i}n(nb,"concat");function sb(t){if(t instanceof W){let e=new W(t[0]<<1,t[1]<<1|t[0]>>>31),i=t[1]>>>31?new W(4294967295,4294967295):new W;return new W(e[0]^i[0],e[1]^i[1])}return(t*2^t>>31)>>>0}n(sb,"encode");function rb(t){if(t instanceof W){let e=new W(t[0]>>>1|t[1]<<31,t[1]>>>1),i=t[0]&1?new W(4294967295,4294967295):new W;return new W(e[0]^i[0],e[1]^i[1])}return t>>>1^-(t&1)}n(rb,"decode");var ab={int32:t=>t[0]|0,int64:t=>t.toString(!0),uint32:t=>t[0]>>>0,uint64:t=>t.toString(!1),sint32:t=>rb(t[0]),sint64:t=>rb(t).toString(!0),bool:t=>t[0]!==0},ub={int32:t=>new W(t),int64:t=>W.parse(t),uint32:t=>new W(t),uint64:t=>W.parse(t),sint32:t=>sb(new W(t)),sint64:t=>sb(W.parse(t)),bool:t=>new W(+t)},eE=Object.fromEntries(Object.entries(ab).map(([t,e])=>[t,i=>{if(i.type===P.Varint)return e(i.value)}])),tE=Object.fromEntries(Object.entries(ub).map(([t,e])=>[t,i=>({type:P.Varint,value:e(i)})])),H=Object.assign(Object.assign({},eE),{double:t=>t.type!==P.Fixed64?void 0:new DataView(t.value.buffer).getFloat64(0,!0),float:t=>t.type!==P.Fixed32?void 0:new DataView(new Uint32Array([t.value]).buffer).getFloat32(0,!0),fixed32:t=>{if(t.type===P.Fixed32)return t.value>>>0},fixed64:t=>{if(t.type===P.Fixed64)return t.value.toString(!1)},sfixed32:t=>{if(t.type===P.Fixed32)return t.value|0},sfixed64:t=>{if(t.type===P.Fixed64)return t.value.toString(!0)},string:t=>t.type!==P.LengthDelimited?void 0:new TextDecoder().decode(t.value),bytes:t=>{if(t.type===P.LengthDelimited)return t.value}}),E=Object.assign(Object.assign({},tE),{double:t=>{let e=new W;return new DataView(e.buffer).setFloat64(0,t,!0),{type:P.Fixed64,value:e}},float:t=>{let e=new Uint32Array(1),i=new DataView(e.buffer);return i.setFloat32(0,t,!0),{type:P.Fixed32,value:i.getUint32(0,!0)}},fixed32:t=>({type:P.Fixed32,value:t>>>0}),fixed64:t=>({type:P.Fixed64,value:W.parse(t)}),sfixed32:t=>({type:P.Fixed32,value:t|0}),sfixed64:t=>({type:P.Fixed64,value:W.parse(t)}),string:t=>{let e=new TextEncoder;return{type:P.LengthDelimited,value:e.encode(t)}},bytes:t=>({type:P.LengthDelimited,value:t})}),iE=Object.fromEntries(Object.keys(ab).map(t=>[t,function*(e){for(let i of e){let o=H[t](i);if(o!=null)yield o;else for(let s of rE(i))yield ab[t](s)}}])),e6=Object.assign(Object.assign({},iE),{*double(t){for(let e of t){let i=H.double(e);i!=null?yield i:yield*nE(e)}},*float(t){for(let e of t){let i=H.float(e);i!=null?yield i:yield*sE(e)}},*fixed32(t){for(let e of t){let i=H.fixed32(e);if(i!=null)yield i;else for(let o of yT(e))yield o>>>0}},*fixed64(t){for(let e of t){let i=H.fixed64(e);if(i!=null)yield i;else for(let o of bT(e))yield o.toString(!1)}},*sfixed32(t){for(let e of t){let i=H.sfixed32(e);if(i!=null)yield i;else for(let o of yT(e))yield o|0}},*sfixed64(t){for(let e of t){let i=H.sfixed64(e);if(i!=null)yield i;else for(let o of bT(e))yield o.toString(!0)}}}),oE=Object.fromEntries(Object.keys(ub).map(t=>[t,function(e){return{type:P.LengthDelimited,value:nb(e.map(i=>{let o=ub[t](i);return ms(o)}))}}]));function _s(t,e){return n(function(o){let s=new Uint8Array(o.length*t),r=new DataView(s.buffer);for(let l=0;l<o.length;++l)e(r,l*t,o[l]);return{type:P.LengthDelimited,value:s}},"pack")}n(_s,"getFixedPackFn");var t6=Object.assign(Object.assign({},oE),{double:_s(8,(t,e,i)=>{t.setFloat64(e,i,!0)}),float:_s(4,(t,e,i)=>{t.setFloat32(e,i,!0)}),fixed32:_s(4,(t,e,i)=>{t.setUint32(e,i,!0)}),fixed64:_s(8,(t,e,i)=>{let o=W.parse(i);t.setUint32(e,o[0],!0),t.setUint32(e+4,o[1],!0)}),sfixed32:_s(4,(t,e,i)=>{t.setInt32(e,i,!0)}),sfixed64:_s(8,(t,e,i)=>{let o=W.parse(i);t.setUint32(e,o[0],!0),t.setUint32(e+4,o[1],!0)})});function*nE(t){if(t.type!==P.LengthDelimited)return;let{value:e}=t,i=0,o=new DataView(e.buffer,e.byteOffset);for(;i<e.length;){let s=o.getFloat64(i,!0);i+=4,yield s}}n(nE,"unpackDouble");function*sE(t){if(t.type!==P.LengthDelimited)return;let{value:e}=t,i=0,o=new DataView(e.buffer,e.byteOffset);for(;i<e.length;){let s=o.getFloat32(i,!0);i+=4,yield s}}n(sE,"unpackFloat");function*rE(t){if(t.type!==P.LengthDelimited)return;let{value:e}=t,i=0,o=e.byteOffset;for(;i<e.length;){let s=hs(new DataView(e.buffer,o+i));i+=s[0],yield s[1]}}n(rE,"unpackVarint");function*yT(t){if(t.type!==P.LengthDelimited)return;let{value:e}=t,i=0,o=new DataView(e.buffer,e.byteOffset);for(;i<e.length;){let s=o.getUint32(i,!0);i+=4,yield s}}n(yT,"unpackFixed32");function*bT(t){if(t.type!==P.LengthDelimited)return;let{value:e}=t,i=0,o=new DataView(e.buffer,e.byteOffset);for(;i<e.length;){let s=o.getUint32(i,!0);i+=4;let r=o.getUint32(i,!0);i+=4,yield new W(s,r)}}n(bT,"unpackFixed64");function J(t){let e=0,i=t.byteOffset,o=[],s=new DataView(t.buffer,i);for(;e<t.length;){let r=hs(new DataView(t.buffer,i+e)),l=r[1][0];e+=r[0];let p=l&7,f=l>>>3;switch(p){default:throw new Error(`Unknown wire type ${p}`);case P.Varint:{let[b,x]=hs(new DataView(t.buffer,i+e));o.push([f,{type:p,value:x}]),e+=b;break}case P.Fixed64:let h=s.getUint32(e,!0),m=s.getUint32(e+=4,!0);e+=4,o.push([f,{type:p,value:new W(h,m)}]);break;case P.LengthDelimited:{let[b,x]=hs(new DataView(t.buffer,i+e));o.push([f,{type:p,value:t.subarray(e+=b,e+=x[0])}]);break}case P.StartGroup:case P.EndGroup:o.push([f,{type:p}]);break;case P.Fixed32:o.push([f,{type:p,value:s.getUint32(e,!0)}]),e+=4;break}}return o}n(J,"deserialize");function aE(){return{id:"",timestamp:0}}n(aE,"getDefaultValue");function wT(t){let e=[];if(t.id!==void 0){let i=t.id;e.push([1,E.string(i)])}if(t.timestamp!==void 0){let i=t.timestamp;e.push([5,E.int32(i)])}return N(e)}n(wT,"encodeBinary");function TT(t){let e=aE(),i=J(t),o=new Map(i);e:{let s=o.get(1);if(s===void 0)break e;let r=H.string(s);if(r===void 0)break e;e.id=r}e:{let s=o.get(5);if(s===void 0)break e;let r=H.int32(s);if(r===void 0)break e;e.timestamp=r}return e}n(TT,"decodeBinary");function IT(t){let e=[];if(t.channelId!==void 0){let i=t.channelId;e.push([1001,E.string(i)])}return N(e)}n(IT,"encodeBinary");function kT(t){let e=[];if(t.params!==void 0){let i=t.params;e.push([32,{type:P.LengthDelimited,value:IT(i)}])}return N(e)}n(kT,"encodeBinary");function ST(t){let e=[];if(t.uploadDate!==void 0){let i=t.uploadDate;e.push([1,E.int32(i)])}if(t.type!==void 0){let i=t.type;e.push([2,E.int32(i)])}if(t.duration!==void 0){let i=t.duration;e.push([3,E.int32(i)])}if(t.featuresHd!==void 0){let i=t.featuresHd;e.push([4,E.int32(i)])}if(t.featuresSubtitles!==void 0){let i=t.featuresSubtitles;e.push([5,E.int32(i)])}if(t.featuresCreativeCommons!==void 0){let i=t.featuresCreativeCommons;e.push([6,E.int32(i)])}if(t.features3d!==void 0){let i=t.features3d;e.push([7,E.int32(i)])}if(t.featuresLive!==void 0){let i=t.featuresLive;e.push([8,E.int32(i)])}if(t.featuresPurchased!==void 0){let i=t.featuresPurchased;e.push([9,E.int32(i)])}if(t.features4k!==void 0){let i=t.features4k;e.push([14,E.int32(i)])}if(t.features360!==void 0){let i=t.features360;e.push([15,E.int32(i)])}if(t.featuresLocation!==void 0){let i=t.featuresLocation;e.push([23,E.int32(i)])}if(t.featuresHdr!==void 0){let i=t.featuresHdr;e.push([25,E.int32(i)])}if(t.featuresVr180!==void 0){let i=t.featuresVr180;e.push([26,E.int32(i)])}return N(e)}n(ST,"encodeBinary");function CT(t){let e=[];if(t.sortBy!==void 0){let i=t.sortBy;e.push([1,E.int32(i)])}if(t.filters!==void 0){let i=t.filters;e.push([2,{type:P.LengthDelimited,value:ST(i)}])}if(t.noFilter!==void 0){let i=t.noFilter;e.push([19,E.int32(i)])}return N(e)}n(CT,"encodeBinary");function ET(t){let e=[];if(t.song!==void 0){let i=t.song;e.push([1,E.int32(i)])}if(t.video!==void 0){let i=t.video;e.push([2,E.int32(i)])}if(t.album!==void 0){let i=t.album;e.push([3,E.int32(i)])}if(t.artist!==void 0){let i=t.artist;e.push([4,E.int32(i)])}if(t.playlist!==void 0){let i=t.playlist;e.push([5,E.int32(i)])}return N(e)}n(ET,"encodeBinary");function PT(t){let e=[];if(t.type!==void 0){let i=t.type;e.push([17,{type:P.LengthDelimited,value:ET(i)}])}return N(e)}n(PT,"encodeBinary");function NT(t){let e=[];if(t.filters!==void 0){let i=t.filters;e.push([2,{type:P.LengthDelimited,value:PT(i)}])}return N(e)}n(NT,"encodeBinary");function AT(t){let e=[];if(t.channelId!==void 0){let i=t.channelId;e.push([1,E.string(i)])}if(t.videoId!==void 0){let i=t.videoId;e.push([2,E.string(i)])}return N(e)}n(AT,"encodeBinary");function RT(t){let e=[];if(t.ids!==void 0){let i=t.ids;e.push([5,{type:P.LengthDelimited,value:AT(i)}])}return N(e)}n(RT,"encodeBinary");function MT(t){let e=[];if(t.params!==void 0){let i=t.params;e.push([1,{type:P.LengthDelimited,value:RT(i)}])}if(t.number0!==void 0){let i=t.number0;e.push([2,E.int32(i)])}if(t.number1!==void 0){let i=t.number1;e.push([3,E.int32(i)])}return N(e)}n(MT,"encodeBinary");function VT(t){let e=[];if(t.videoId!==void 0){let i=t.videoId;e.push([2,E.string(i)])}return N(e)}n(VT,"encodeBinary");function OT(t){let e=[];if(t.unkParam!==void 0){let i=t.unkParam;e.push([1,E.int32(i)])}return N(e)}n(OT,"encodeBinary");function DT(t){let e=[];if(t.commentId!==void 0){let i=t.commentId;e.push([2,E.string(i)])}if(t.unkopts!==void 0){let i=t.unkopts;e.push([4,{type:P.LengthDelimited,value:OT(i)}])}if(t.channelId!==void 0){let i=t.channelId;e.push([5,E.string(i)])}if(t.videoId!==void 0){let i=t.videoId;e.push([6,E.string(i)])}if(t.unkParam1!==void 0){let i=t.unkParam1;e.push([8,E.int32(i)])}if(t.unkParam2!==void 0){let i=t.unkParam2;e.push([9,E.int32(i)])}return N(e)}n(DT,"encodeBinary");function LT(t){let e=[];if(t.videoId!==void 0){let i=t.videoId;e.push([4,E.string(i)])}if(t.sortBy!==void 0){let i=t.sortBy;e.push([6,E.int32(i)])}if(t.type!==void 0){let i=t.type;e.push([15,E.int32(i)])}return N(e)}n(LT,"encodeBinary");function BT(t){let e=[];if(t.unkToken!==void 0){let i=t.unkToken;e.push([1,E.string(i)])}if(t.repliesOpts!==void 0){let i=t.repliesOpts;e.push([3,{type:P.LengthDelimited,value:DT(i)}])}if(t.opts!==void 0){let i=t.opts;e.push([4,{type:P.LengthDelimited,value:LT(i)}])}if(t.page!==void 0){let i=t.page;e.push([5,E.int32(i)])}if(t.target!==void 0){let i=t.target;e.push([8,E.string(i)])}return N(e)}n(BT,"encodeBinary");function FT(t){let e=[];if(t.ctx!==void 0){let i=t.ctx;e.push([2,{type:P.LengthDelimited,value:VT(i)}])}if(t.unkParam!==void 0){let i=t.unkParam;e.push([3,E.int32(i)])}if(t.params!==void 0){let i=t.params;e.push([6,{type:P.LengthDelimited,value:BT(i)}])}return N(e)}n(FT,"encodeBinary");function YT(t){let e=[];if(t.index!==void 0){let i=t.index;e.push([1,E.int32(i)])}return N(e)}n(YT,"encodeBinary");function jT(t){let e=[];if(t.videoId!==void 0){let i=t.videoId;e.push([2,E.string(i)])}if(t.params!==void 0){let i=t.params;e.push([5,{type:P.LengthDelimited,value:YT(i)}])}if(t.number!==void 0){let i=t.number;e.push([10,E.int32(i)])}return N(e)}n(jT,"encodeBinary");function UT(t){let e=[];if(t.text!==void 0){let i=t.text;e.push([1,E.string(i)])}return N(e)}n(UT,"encodeBinary");function WT(t){let e=[];if(t.comment!==void 0){let i=t.comment;e.push([1,{type:P.LengthDelimited,value:UT(i)}])}return N(e)}n(WT,"encodeBinary");function HT(t){let e=[];if(t.commentId!==void 0){let i=t.commentId;e.push([2,E.string(i)])}if(t.params!==void 0){let i=t.params;e.push([3,{type:P.LengthDelimited,value:WT(i)}])}if(t.targetLanguage!==void 0){let i=t.targetLanguage;e.push([4,E.string(i)])}return N(e)}n(HT,"encodeBinary");function JT(t){let e=[];if(t.type!==void 0){let i=t.type;e.push([1,E.int32(i)])}if(t.unkNum!==void 0){let i=t.unkNum;e.push([2,E.int32(i)])}if(t.commentId!==void 0){let i=t.commentId;e.push([3,E.string(i)])}if(t.videoId!==void 0){let i=t.videoId;e.push([5,E.string(i)])}if(t.channelId!==void 0){let i=t.channelId;e.push([23,E.string(i)])}if(t.translateCommentParams!==void 0){let i=t.translateCommentParams;e.push([31,{type:P.LengthDelimited,value:HT(i)}])}return N(e)}n(JT,"encodeBinary");function GT(t){let e=[];if(t.index!==void 0){let i=t.index;e.push([1,E.int32(i)])}return N(e)}n(GT,"encodeBinary");function zT(t){let e=[];if(t.channelId!==void 0){let i=t.channelId;e.push([1,E.string(i)])}if(t.prefId!==void 0){let i=t.prefId;e.push([2,{type:P.LengthDelimited,value:GT(i)}])}if(t.number0!==void 0){let i=t.number0;e.push([3,E.int32(i)])}if(t.number1!==void 0){let i=t.number1;e.push([4,E.int32(i)])}return N(e)}n(zT,"encodeBinary");function $T(t){let e=[];if(t.unkparam!==void 0){let i=t.unkparam;e.push([16,E.int32(i)])}if(t.clientVersion!==void 0){let i=t.clientVersion;e.push([17,E.string(i)])}if(t.clientName!==void 0){let i=t.clientName;e.push([18,E.string(i)])}return N(e)}n($T,"encodeBinary");function KT(t){let e=[];if(t.client!==void 0){let i=t.client;e.push([1,{type:P.LengthDelimited,value:$T(i)}])}return N(e)}n(KT,"encodeBinary");function qT(t){let e=[];if(t.text!==void 0){let i=t.text;e.push([1,E.string(i)])}return N(e)}n(qT,"encodeBinary");function XT(t){let e=[];if(t.text!==void 0){let i=t.text;e.push([1,E.string(i)])}return N(e)}n(XT,"encodeBinary");function QT(t){let e=[];for(let i of t.list)e.push([1,E.string(i)]);return N(e)}n(QT,"encodeBinary");function ZT(t){let e=[];if(t.id!==void 0){let i=t.id;e.push([1,E.int32(i)])}return N(e)}n(ZT,"encodeBinary");function eI(t){let e=[];if(t.type!==void 0){let i=t.type;e.push([1,E.string(i)])}return N(e)}n(eI,"encodeBinary");function tI(t){let e=[];if(t.imageData!==void 0){let i=t.imageData;e.push([1,E.bytes(i)])}return N(e)}n(tI,"encodeBinary");function iI(t){let e=[];if(t.type!==void 0){let i=t.type;e.push([1,E.int32(i)])}if(t.thumbnail!==void 0){let i=t.thumbnail;e.push([3,{type:P.LengthDelimited,value:tI(i)}])}return N(e)}n(iI,"encodeBinary");function oI(t){let e=[];if(t.type!==void 0){let i=t.type;e.push([1,E.int32(i)])}return N(e)}n(oI,"encodeBinary");function nI(t){let e=[];if(t.unkparam!==void 0){let i=t.unkparam;e.push([1,E.int32(i)])}if(t.choice!==void 0){let i=t.choice;e.push([2,E.int32(i)])}return N(e)}n(nI,"encodeBinary");function sI(t){let e=[];if(t.unkparam!==void 0){let i=t.unkparam;e.push([1,E.int32(i)])}if(t.choice!==void 0){let i=t.choice;e.push([2,E.int32(i)])}return N(e)}n(sI,"encodeBinary");function lb(t){let e=[];if(t.context!==void 0){let i=t.context;e.push([1,{type:P.LengthDelimited,value:KT(i)}])}if(t.target!==void 0){let i=t.target;e.push([2,E.string(i)])}if(t.title!==void 0){let i=t.title;e.push([3,{type:P.LengthDelimited,value:qT(i)}])}if(t.description!==void 0){let i=t.description;e.push([4,{type:P.LengthDelimited,value:XT(i)}])}if(t.tags!==void 0){let i=t.tags;e.push([6,{type:P.LengthDelimited,value:QT(i)}])}if(t.category!==void 0){let i=t.category;e.push([7,{type:P.LengthDelimited,value:ZT(i)}])}if(t.license!==void 0){let i=t.license;e.push([8,{type:P.LengthDelimited,value:eI(i)}])}if(t.videoThumbnail!==void 0){let i=t.videoThumbnail;e.push([20,{type:P.LengthDelimited,value:iI(i)}])}if(t.privacy!==void 0){let i=t.privacy;e.push([38,{type:P.LengthDelimited,value:oI(i)}])}if(t.madeForKids!==void 0){let i=t.madeForKids;e.push([68,{type:P.LengthDelimited,value:nI(i)}])}if(t.ageRestricted!==void 0){let i=t.ageRestricted;e.push([69,{type:P.LengthDelimited,value:sI(i)}])}return N(e)}n(lb,"encodeBinary");function rI(t){let e=[];if(t.hashtag!==void 0){let i=t.hashtag;e.push([1,E.string(i)])}if(t.type!==void 0){let i=t.type;e.push([3,E.int32(i)])}return N(e)}n(rI,"encodeBinary");function aI(t){let e=[];if(t.params!==void 0){let i=t.params;e.push([93,{type:P.LengthDelimited,value:rI(i)}])}return N(e)}n(aI,"encodeBinary");function uI(t){let e=[];if(t.number!==void 0){let i=t.number;e.push([3,E.int32(i)])}return N(e)}n(uI,"encodeBinary");function lI(t){let e=[];if(t.shortId!==void 0){let i=t.shortId;e.push([1,E.string(i)])}if(t.params!==void 0){let i=t.params;e.push([5,{type:P.LengthDelimited,value:uI(i)}])}if(t.feature2!==void 0){let i=t.feature2;e.push([10,E.int32(i)])}if(t.feature3!==void 0){let i=t.feature3;e.push([13,E.int32(i)])}return N(e)}n(lI,"encodeBinary");function cI(t){let e=[];if(t.p1!==void 0){let i=t.p1;e.push([1,E.int32(i)])}return N(e)}n(cI,"encodeBinary");function dI(t){let e=[];if(t.f1!==void 0){let i=t.f1;e.push([1,{type:P.LengthDelimited,value:cI(i)}])}if(t.p59!==void 0){let i=t.p59;e.push([59,E.int32(i)])}return N(e)}n(dI,"encodeBinary");function cb(t,e){let i=wT({id:t,timestamp:e});return encodeURIComponent(dt(i).replace(/\+/g,"-").replace(/\//g,"_"))}n(cb,"encodeVisitorData");function db(t){return TT(Tb(decodeURIComponent(t).replace(/-/g,"+").replace(/_/g,"/")))}n(db,"decodeVisitorData");function pb(t){let e=kT({params:{channelId:t}});return encodeURIComponent(dt(e))}n(pb,"encodeChannelAnalyticsParams");function fb(t){let e={all:void 0,hour:1,today:2,week:3,month:4,year:5},i={all:void 0,video:1,channel:2,playlist:3,movie:4},o={all:void 0,short:1,long:2,medium:3},s={relevance:void 0,rating:1,upload_date:2,view_count:3},r={hd:"featuresHd",subtitles:"featuresSubtitles",creative_commons:"featuresCreativeCommons","3d":"features3D",live:"featuresLive",purchased:"featuresPurchased","4k":"features4K",360:"features360",location:"featuresLocation",hdr:"featuresHdr",vr180:"featuresVr180"},l={};if(t?l.filters={}:l.noFilter=0,l.filters&&(t.upload_date&&(l.filters.uploadDate=e[t.upload_date]),t.type&&(l.filters.type=i[t.type]),t.duration&&(l.filters.duration=o[t.duration]),t.sort_by&&t.sort_by!=="relevance"&&(l.sortBy=s[t.sort_by]),t.features))for(let f of t.features)l.filters[r[f]]=1;let p=CT(l);return encodeURIComponent(dt(p))}n(fb,"encodeSearchFilters");function mb(t){var e;let i={filters:{type:{}}};t.type&&t.type!=="all"&&((e=i.filters)===null||e===void 0?void 0:e.type)&&(i.filters.type[t.type]=1);let o=NT(i);return encodeURIComponent(dt(o))}n(mb,"encodeMusicSearchFilters");function hb(t,e){let i=MT({params:{ids:{channelId:t,videoId:e}},number0:1,number1:4});return btoa(encodeURIComponent(dt(i)))}n(hb,"encodeMessageParams");function _b(t,e={}){let o=FT({ctx:{videoId:t},unkParam:6,params:{opts:{videoId:t,sortBy:{TOP_COMMENTS:0,NEWEST_FIRST:1}[e.sort_by||"TOP_COMMENTS"],type:e.type||2},target:"comments-section"}});return encodeURIComponent(dt(o))}n(_b,"encodeCommentsSectionParams");function vb(t){let e=jT({videoId:t,params:{index:0},number:7});return encodeURIComponent(dt(e))}n(vb,"encodeCommentParams");function Bo(t,e={}){let i={type:t,commentId:e.comment_id||" ",videoId:e.video_id||" ",channelId:" ",unkNum:2};if(e.hasOwnProperty("text")){if(typeof e.target_language!="string")throw new Error("target_language must be a string");e.comment_id&&delete i.unkNum,i.translateCommentParams={params:{comment:{text:e.text}},commentId:e.comment_id||" ",targetLanguage:e.target_language}}let o=JT(i);return encodeURIComponent(dt(o))}n(Bo,"encodeCommentActionParams");function gb(t,e){let i=zT({channelId:t,prefId:{index:e},number0:0,number1:4});return encodeURIComponent(dt(i))}n(gb,"encodeNotificationPref");function xb(t,e){let i={context:{client:{unkparam:14,clientName:ae.ANDROID.NAME,clientVersion:ae.YTSTUDIO_ANDROID.VERSION}},target:t};if(Reflect.has(e,"title")&&(i.title={text:e.title||""}),Reflect.has(e,"description")&&(i.description={text:e.description||""}),Reflect.has(e,"license")&&(i.license={type:e.license||""}),Reflect.has(e,"tags")&&(i.tags={list:e.tags||[]}),Reflect.has(e,"category")&&(i.category={id:e.category||0}),Reflect.has(e,"privacy"))switch(e.privacy){case"PUBLIC":i.privacy={type:1};break;case"UNLISTED":i.privacy={type:2};break;case"PRIVATE":i.privacy={type:3};break;default:throw new Error("Invalid visibility option")}return Reflect.has(e,"made_for_kids")&&(i.madeForKids={unkparam:1,choice:e.made_for_kids?1:2}),Reflect.has(e,"age_restricted")&&(i.ageRestricted={unkparam:1,choice:e.age_restricted?1:2}),lb(i)}n(xb,"encodeVideoMetadataPayload");function yb(t,e){let i={context:{client:{unkparam:14,clientName:ae.ANDROID.NAME,clientVersion:ae.YTSTUDIO_ANDROID.VERSION}},target:t,videoThumbnail:{type:3,thumbnail:{imageData:e}}};return lb(i)}n(yb,"encodeCustomThumbnailPayload");function bb(t){let e=aI({params:{hashtag:t,type:1}});return encodeURIComponent(dt(e))}n(bb,"encodeHashtag");function wb(t){let e=lI({shortId:t,params:{number:5},feature2:25,feature3:0});return encodeURIComponent(dt(e))}n(wb,"encodeReelSequence");function bE(){let t=dI({f1:{p1:1},p59:1});return encodeURIComponent(dt(t))}n(bE,"encodeShortsParam");var Ft,Vl=class extends a{constructor(e){var i,o,s,r,l,p,f;super(),Ft.set(this,void 0),this.content=new u(e.contentText),this.published=new u(e.publishedTimeText),this.author_is_channel_owner=e.authorIsChannelOwner,this.current_user_reply_thumbnail=w.fromResponse(e.currentUserReplyThumbnail),this.sponsor_comment_badge=c.parseItem(e.sponsorCommentBadge,Lv),this.paid_comment_chip=c.parseItem(e.paidCommentChipRenderer,Dv),this.author_badge=c.parseItem(e.authorCommentBadge,Ov),this.author=new V(Object.assign(Object.assign({},e.authorText),{navigationEndpoint:e.authorEndpoint}),this.author_badge?[{metadataBadgeRenderer:(i=this.author_badge)===null||i===void 0?void 0:i.orig_badge}]:null,e.authorThumbnail),this.action_menu=c.parseItem(e.actionMenu,j),this.action_buttons=c.parseItem(e.actionButtons,ns),this.comment_id=e.commentId,this.vote_status=e.voteStatus,this.vote_count=e.voteCount?new u(e.voteCount).toString():"0",this.reply_count=e.replyCount||0,this.is_liked=!!(!((s=(o=this.action_buttons)===null||o===void 0?void 0:o.like_button)===null||s===void 0)&&s.is_toggled),this.is_disliked=!!(!((l=(r=this.action_buttons)===null||r===void 0?void 0:r.dislike_button)===null||l===void 0)&&l.is_toggled),this.is_hearted=!!(!((f=(p=this.action_buttons)===null||p===void 0?void 0:p.creator_heart)===null||f===void 0)&&f.is_hearted),this.is_pinned=!!e.pinnedCommentBadge,this.is_member=!!e.sponsorCommentBadge}like(){var e;return y(this,void 0,void 0,function*(){if(!d(this,Ft,"f"))throw new v("An active caller must be provide to perform this operation.");let i=(e=this.action_buttons)===null||e===void 0?void 0:e.like_button;if(!i)throw new v("Like button was not found.",{comment_id:this.comment_id});if(i.is_toggled)throw new v("This comment is already liked",{comment_id:this.comment_id});return yield i.endpoint.call(d(this,Ft,"f"),{parse:!1})})}dislike(){var e;return y(this,void 0,void 0,function*(){if(!d(this,Ft,"f"))throw new v("An active caller must be provide to perform this operation.");let i=(e=this.action_buttons)===null||e===void 0?void 0:e.dislike_button;if(!i)throw new v("Dislike button was not found.",{comment_id:this.comment_id});if(i.is_toggled)throw new v("This comment is already disliked",{comment_id:this.comment_id});return yield i.endpoint.call(d(this,Ft,"f"),{parse:!1})})}reply(e){var i,o,s;return y(this,void 0,void 0,function*(){if(!d(this,Ft,"f"))throw new v("An active caller must be provide to perform this operation.");if(!(!((i=this.action_buttons)===null||i===void 0)&&i.reply_button))throw new v("Cannot reply to another reply. Try mentioning the user instead.",{comment_id:this.comment_id});let r=(o=this.action_buttons)===null||o===void 0?void 0:o.reply_button;if(!(!((s=r.endpoint)===null||s===void 0)&&s.dialog))throw new v("Reply button endpoint did not have a dialog.");let p=r.endpoint.dialog.as(fs).reply_button;if(!p)throw new v("Reply button was not found in the dialog.",{comment_id:this.comment_id});if(!p.endpoint)throw new v("Reply button endpoint was not found.",{comment_id:this.comment_id});return yield p.endpoint.call(d(this,Ft,"f"),{commentText:e})})}translate(e){var i,o,s,r,l,p;return y(this,void 0,void 0,function*(){if(!d(this,Ft,"f"))throw new v("An active caller must be provide to perform this operation.");let h={text:this.content.toString().replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""),target_language:e,comment_id:this.comment_id},m=Bo(22,h),b=yield d(this,Ft,"f").execute("comment/perform_comment_action",{action:m,client:"ANDROID"}),x=(o=(i=b.data.frameworkUpdates)===null||i===void 0?void 0:i.entityBatchUpdate)===null||o===void 0?void 0:o.mutations,T=(p=(l=(r=(s=x==null?void 0:x[0])===null||s===void 0?void 0:s.payload)===null||r===void 0?void 0:r.commentEntityPayload)===null||l===void 0?void 0:l.translatedContent)===null||p===void 0?void 0:p.content;return Object.assign(Object.assign({},b),{content:T})})}setActions(e){I(this,Ft,e,"f")}};n(Vl,"Comment");Ft=new WeakMap;Vl.type="Comment";var vs=Vl;var Ol=class extends a{constructor(e){super(),this.id=e.id,this.categories=c.parseArray(e.categories),this.category_buttons=c.parseArray(e.categoryButtons),this.search_placeholder=new u(e.searchPlaceholderText),this.search_no_results=new u(e.searchNoResultsText),this.pick_skin_tone=new u(e.pickSkinToneText),this.clear_search_label=e.clearSearchLabel,this.skin_tone_generic_label=e.skinToneGenericLabel,this.skin_tone_light_label=e.skinToneLightLabel,this.skin_tone_medium_light_label=e.skinToneMediumLightLabel,this.skin_tone_medium_label=e.skinToneMediumLabel,this.skin_tone_medium_dark_label=e.skinToneMediumDarkLabel,this.skin_tone_dark_label=e.skinToneDarkLabel}};n(Ol,"EmojiPicker");Ol.type="EmojiPicker";var jv=Ol;var Dl=class extends a{constructor(e){super(),this.editable_text=new u(e.editableText),this.author_thumbnail=w.fromResponse(e.authorThumbnail),this.submit_button=c.parseItem(e.submitButton,S),this.cancel_button=c.parseItem(e.cancelButton,S),this.placeholder=new u(e.placeholderText),this.emoji_button=c.parseItem(e.emojiButton,S),this.emoji_picker=c.parseItem(e.emojiPicker,jv)}};n(Dl,"CommentDialog");Dl.type="CommentDialog";var pI=Dl;var Ll=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents),this.view_replies=c.parseItem(e.viewReplies,S),this.hide_replies=c.parseItem(e.hideReplies,S),this.view_replies_creator_thumbnail=w.fromResponse(e.viewRepliesCreatorThumbnail),this.has_channel_owner_replied=!!e.viewRepliesCreatorThumbnail}};n(Ll,"CommentReplies");Ll.type="CommentReplies";var Uv=Ll;var Bl=class extends a{constructor(e){super(),this.simplebox_avatar=w.fromResponse(e.simpleboxAvatar),this.simplebox_placeholder=new u(e.simpleboxPlaceholder)}};n(Bl,"CommentsSimplebox");Bl.type="CommentsSimplebox";var Wv=Bl;var Fl=class extends a{constructor(e){super(),Reflect.has(e,"teaserAvatar")&&(this.teaser_avatar=w.fromResponse(e.teaserAvatar)),Reflect.has(e,"teaserContent")&&(this.teaser_content=new u(e.teaserContent))}};n(Fl,"CommentsEntryPointTeaser");Fl.type="CommentsEntryPointTeaser";var Hv=Fl;var Yl=class extends a{constructor(e){super(),Reflect.has(e,"headerText")&&(this.header=new u(e.headerText)),Reflect.has(e,"commentCount")&&(this.comment_count=new u(e.commentCount)),(Reflect.has(e,"teaserAvatar")||Reflect.has(e,"simpleboxAvatar"))&&(this.teaser_avatar=w.fromResponse(e.teaserAvatar||e.simpleboxAvatar)),Reflect.has(e,"teaserContent")&&(this.teaser_content=new u(e.teaserContent)),Reflect.has(e,"contentRenderer")&&(this.content_renderer=c.parseItem(e.contentRenderer,[Hv,Wv])),Reflect.has(e,"simpleboxPlaceholder")&&(this.simplebox_placeholder=new u(e.simpleboxPlaceholder))}};n(Yl,"CommentsEntryPointHeader");Yl.type="CommentsEntryPointHeader";var Jv=Yl;var jl=class extends a{constructor(e){super(),this.title=new u(e.titleText),this.count=new u(e.countText),this.comments_count=new u(e.commentsCount),this.create_renderer=c.parseItem(e.createRenderer),this.sort_menu=c.parseItem(e.sortMenu,Bt),Reflect.has(e,"customEmojis")&&(this.custom_emojis=e.customEmojis.map(i=>({emoji_id:i.emojiId,shortcuts:i.shortcuts,search_terms:i.searchTerms,image:w.fromResponse(i.image),is_custom_emoji:i.isCustomEmoji})))}};n(jl,"CommentsHeader");jl.type="CommentsHeader";var zi=jl;var Ul=class extends a{constructor(e){super(),this.submit_button=c.parseItem(e.submitButton,S),this.cancel_button=c.parseItem(e.cancelButton,S),this.author_thumbnail=w.fromResponse(e.authorThumbnail),this.placeholder=new u(e.placeholderText),this.avatar_size=e.avatarSize}};n(Ul,"CommentSimplebox");Ul.type="CommentSimplebox";var Gv=Ul;var it,Wl=class extends a{constructor(e){super(),it.set(this,void 0),this.comment_id=e.commentId,this.is_pinned=!!e.pinnedText,this.keys={comment:e.commentKey,comment_surface:e.commentSurfaceKey,toolbar_state:e.toolbarStateKey,toolbar_surface:e.toolbarSurfaceKey,shared:e.sharedKey}}applyMutations(e,i,o){e&&(this.content=u.fromAttributed(e.properties.content),this.published_time=e.properties.publishedTime,this.author_is_channel_owner=!!e.author.isCreator,this.like_count=e.toolbar.likeCountNotliked?e.toolbar.likeCountNotliked:"0",this.reply_count=e.toolbar.replyCount?e.toolbar.replyCount:"0",this.is_member=!!e.author.sponsorBadgeUrl,Reflect.has(e.author,"sponsorBadgeUrl")&&(this.member_badge={url:e.author.sponsorBadgeUrl,a11y:e.author.A11y}),this.author=new V({simpleText:e.author.displayName,navigationEndpoint:e.avatar.endpoint},e.author,e.avatar.image,e.author.channelId)),i&&(this.is_hearted=i.heartState==="TOOLBAR_HEART_STATE_HEARTED",this.is_liked=i.likeState==="TOOLBAR_LIKE_STATE_LIKED",this.is_disliked=i.likeState==="TOOLBAR_LIKE_STATE_DISLIKED"),o&&!Reflect.has(o,"prepareAccountCommand")&&(this.like_command=new g(o.likeCommand),this.dislike_command=new g(o.dislikeCommand),this.unlike_command=new g(o.unlikeCommand),this.undislike_command=new g(o.undislikeCommand),this.reply_command=new g(o.replyCommand))}like(){return y(this,void 0,void 0,function*(){if(!d(this,it,"f"))throw new v("Actions instance not set for this comment.");if(!this.like_command)throw new v("Like command not found.");if(this.is_liked)throw new v("This comment is already liked.",{comment_id:this.comment_id});return this.like_command.call(d(this,it,"f"))})}dislike(){return y(this,void 0,void 0,function*(){if(!d(this,it,"f"))throw new v("Actions instance not set for this comment.");if(!this.dislike_command)throw new v("Dislike command not found.");if(this.is_disliked)throw new v("This comment is already disliked.",{comment_id:this.comment_id});return this.dislike_command.call(d(this,it,"f"))})}unlike(){return y(this,void 0,void 0,function*(){if(!d(this,it,"f"))throw new v("Actions instance not set for this comment.");if(!this.unlike_command)throw new v("Unlike command not found.");if(!this.is_liked)throw new v("This comment is not liked.",{comment_id:this.comment_id});return this.unlike_command.call(d(this,it,"f"))})}undislike(){return y(this,void 0,void 0,function*(){if(!d(this,it,"f"))throw new v("Actions instance not set for this comment.");if(!this.undislike_command)throw new v("Undislike command not found.");if(!this.is_disliked)throw new v("This comment is not disliked.",{comment_id:this.comment_id});return this.undislike_command.call(d(this,it,"f"))})}reply(e){var i;return y(this,void 0,void 0,function*(){if(!d(this,it,"f"))throw new v("Actions instance not set for this comment.");if(!this.reply_command)throw new v("Reply command not found.");let o=(i=this.reply_command.dialog)===null||i===void 0?void 0:i.as(fs);if(!o)throw new v("Reply dialog not found.");let s=o.reply_button;if(!s)throw new v("Reply button not found in the dialog.");if(!s.endpoint)throw new v("Reply button endpoint not found.");return s.endpoint.call(d(this,it,"f"),{commentText:e})})}translate(e){var i,o,s,r,l,p;return y(this,void 0,void 0,function*(){if(!d(this,it,"f"))throw new v("Actions instance not set for this comment.");if(!this.content)throw new v("Comment content not found.",{comment_id:this.comment_id});let h={text:this.content.toString().replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""),target_language:e},m=Bo(22,h),b=yield d(this,it,"f").execute("comment/perform_comment_action",{action:m,client:"ANDROID"}),x=(o=(i=b.data.frameworkUpdates)===null||i===void 0?void 0:i.entityBatchUpdate)===null||o===void 0?void 0:o.mutations,T=(p=(l=(r=(s=x==null?void 0:x[0])===null||s===void 0?void 0:s.payload)===null||r===void 0?void 0:r.commentEntityPayload)===null||l===void 0?void 0:l.translatedContent)===null||p===void 0?void 0:p.content;return Object.assign(Object.assign({},b),{content:T})})}setActions(e){I(this,it,e,"f")}};n(Wl,"CommentView");it=new WeakMap;Wl.type="CommentView";var $i=Wl;var yi,Fo,Hl=class extends a{constructor(e){super(),yi.set(this,void 0),Fo.set(this,void 0),Reflect.has(e,"commentViewModel")?this.comment=c.parseItem(e.commentViewModel,$i):this.comment=c.parseItem(e.comment,vs),this.comment_replies_data=c.parseItem(e.replies,Uv),this.is_moderated_elq_comment=e.isModeratedElqComment,this.has_replies=!!this.comment_replies_data}getReplies(){var e;return y(this,void 0,void 0,function*(){if(!d(this,yi,"f"))throw new v("Actions instance not set for this thread.");if(!this.comment_replies_data)throw new v("This comment has no replies.",this);let i=(e=this.comment_replies_data.contents)===null||e===void 0?void 0:e.firstOfType(he);if(!i)throw new v("Replies continuation not found.");let o=yield i.endpoint.call(d(this,yi,"f"),{parse:!0});if(!o.on_response_received_endpoints_memo)throw new v("Unexpected response.",o);return this.replies=re(o.on_response_received_endpoints_memo.getType(vs,$i).map(s=>(s.setActions(d(this,yi,"f")),s))),I(this,Fo,o==null?void 0:o.on_response_received_endpoints_memo.getType(he).first(),"f"),this})}getContinuation(){var e;return y(this,void 0,void 0,function*(){if(!this.replies)throw new v("Cannot retrieve continuation because this thread's replies have not been loaded.");if(!d(this,Fo,"f"))throw new v("Continuation not found.");if(!d(this,yi,"f"))throw new v("Actions instance not set for this thread.");let i=(e=d(this,Fo,"f").button)===null||e===void 0?void 0:e.as(S);if(!i)throw new v('"Load more" button not found.');let o=yield i.endpoint.call(d(this,yi,"f"),{parse:!0});if(!o.on_response_received_endpoints_memo)throw new v("Unexpected response.",o);return this.replies=re(o.on_response_received_endpoints_memo.getType(vs,$i).map(s=>(s.setActions(d(this,yi,"f")),s))),I(this,Fo,o.on_response_received_endpoints_memo.getType(he).first(),"f"),this})}get has_continuation(){if(!this.replies)throw new v("Cannot determine if there is a continuation because this thread's replies have not been loaded.");return!!d(this,Fo,"f")}setActions(e){I(this,yi,e,"f")}};n(Hl,"CommentThread");yi=new WeakMap,Fo=new WeakMap;Hl.type="CommentThread";var zv=Hl;var Jl=class extends a{constructor(e){super(),this.title=new u(e.title),this.channel_id=e.channelId,this.thumbnail=w.fromResponse(e.thumbnail),this.display_name=new u(e.displayName),this.video_count=new u(e.videoCountText),this.subscriber_count=new u(e.subscriberCountText),this.endpoint=new g(e.navigationEndpoint),this.tv_banner=w.fromResponse(e.tvBanner),this.menu=c.parseItem(e.menu,j)}};n(Jl,"CompactChannel");Jl.type="CompactChannel";var fI=Jl;var Gl=class extends a{constructor(e){super(),this.title=new u(e.title).toString(),this.endpoint=new g(e.navigationEndpoint),this.style=e.style}};n(Gl,"CompactLink");Gl.type="CompactLink";var gs=Gl;var zl=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail)}};n(zl,"PlaylistCustomThumbnail");zl.type="PlaylistCustomThumbnail";var xs=zl;var $l=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail)}};n($l,"PlaylistVideoThumbnail");$l.type="PlaylistVideoThumbnail";var ys=$l;var Kl=class extends a{constructor(e){var i;super(),this.id=e.playlistId,this.title=new u(e.title),this.author=!((i=e.shortBylineText)===null||i===void 0)&&i.simpleText?new u(e.shortBylineText):new V(e.longBylineText,e.ownerBadges,null),this.thumbnails=w.fromResponse(e.thumbnail||{thumbnails:e.thumbnails.map(o=>o.thumbnails).flat(1)}),this.video_count=new u(e.thumbnailText),this.video_count_short=new u(e.videoCountShortText),this.first_videos=c.parseArray(e.videos),this.share_url=e.shareUrl||null,this.menu=c.parseItem(e.menu),this.badges=c.parseArray(e.ownerBadges),this.endpoint=new g(e.navigationEndpoint),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),Reflect.has(e,"thumbnailRenderer")&&(this.thumbnail_renderer=c.parseItem(e.thumbnailRenderer,[ys,xs])||void 0),Reflect.has(e,"viewPlaylistText")&&(this.view_playlist=new u(e.viewPlaylistText))}};n(Kl,"Playlist");Kl.type="Playlist";var ti=Kl;var ql=class extends ti{constructor(e){super(e)}};n(ql,"CompactMix");ql.type="CompactMix";var mI=ql;var Xl=class extends a{constructor(e){var i;super();let o=((i=e.thumbnailOverlays.find(r=>r.thumbnailOverlayTimeStatusRenderer))===null||i===void 0?void 0:i.thumbnailOverlayTimeStatusRenderer.text)||"N/A";this.id=e.videoId,this.title=new u(e.title),this.top_metadata_items=new u(e.topMetadataItems),this.thumbnails=w.fromResponse(e.thumbnail),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),this.author=new V(e.shortBylineText);let s=e.lengthText?new u(e.lengthText).toString():new u(o).toString();this.duration={text:s,seconds:je(s)},this.endpoint=new g(e.navigationEndpoint),this.badges=c.parseArray(e.badges),this.use_vertical_poster=e.useVerticalPoster,this.menu=c.parseItem(e.menu,j)}};n(Xl,"CompactMovie");Xl.type="CompactMovie";var hI=Xl;var Ql=class extends ti{constructor(e){super(e)}};n(Ql,"CompactPlaylist");Ql.type="CompactPlaylist";var _I=Ql;var Zl=class extends a{constructor(e){super(),this.title=new u(e.title),this.description=new u(e.description),this.video_count=new u(e.videoCountText),this.endpoint=new g(e.navigationEndpoint),this.thumbnail=w.fromResponse(e.thumbnail)}};n(Zl,"CompactStation");Zl.type="CompactStation";var vI=Zl;var ec=class extends a{constructor(e){super(),this.title=new u(e.title),this.confirm_button=c.parseItem(e.confirmButton,S),this.cancel_button=c.parseItem(e.cancelButton,S),this.dialog_messages=e.dialogMessages.map(i=>new u(i))}};n(ec,"ConfirmDialog");ec.type="ConfirmDialog";var gI=ec;var tc=class extends a{constructor(e){super(),this.metadata_rows=e.metadataRows.map(i=>{var o;return{metadata_parts:(o=i.metadataParts)===null||o===void 0?void 0:o.map(s=>({text:u.fromAttributed(s.text)}))}}),this.delimiter=e.delimiter}};n(tc,"ContentMetadataView");tc.type="ContentMetadataView";var bs=tc;var ic=class extends a{constructor(e){super(),this.text=new u(e.text)}};n(ic,"Message");ic.type="Message";var Ge=ic;var oc=class extends a{constructor(e){super(),this.availability_message=c.parseItem(e.availabilityMessage,Ge)}};n(oc,"ConversationBar");oc.type="ConversationBar";var xI=oc;var nc=class extends a{constructor(e){super(),this.copy_button=c.parseItem(e.copyButton,S),this.short_url=e.shortUrl,this.style=e.style}};n(nc,"CopyLink");nc.type="CopyLink";var $v=nc;var sc=class extends a{constructor(e){var i,o;super(),this.avatar=c.parseItem(e.avatar,G_),this.a11y_label=e.a11yLabel,!((o=(i=e.rendererContext)===null||i===void 0?void 0:i.commandContext)===null||o===void 0)&&o.onTap&&(this.on_tap_endpoint=new g(e.rendererContext.commandContext.onTap))}};n(sc,"DecoratedAvatarView");sc.type="DecoratedAvatarView";var Kv=sc;var rc=class extends a{constructor(e){super(),this.time_range_start_millis=e.timeRangeStartMillis,this.marker_duration_millis=e.markerDurationMillis,this.heat_marker_intensity_score_normalized=e.heatMarkerIntensityScoreNormalized}};n(rc,"HeatMarker");rc.type="HeatMarker";var qv=rc;var ac=class extends a{constructor(e){super(),this.max_height_dp=e.maxHeightDp,this.min_height_dp=e.minHeightDp,this.show_hide_animation_duration_millis=e.showHideAnimationDurationMillis,this.heat_markers=c.parseArray(e.heatMarkers,qv),this.heat_markers_decorations=c.parseArray(e.heatMarkersDecorations)}};n(ac,"Heatmap");ac.type="Heatmap";var Xv=ac;var uc=class extends a{constructor(e){super(),this.marker_key=e.key,this.value={},Reflect.has(e,"value")&&(Reflect.has(e.value,"heatmap")&&(this.value.heatmap=c.parseItem(e.value.heatmap,Xv)),Reflect.has(e.value,"chapters")&&(this.value.chapters=c.parseArray(e.value.chapters,Cv)))}};n(uc,"Marker");uc.type="Marker";var lc=class extends a{constructor(e){var i;super(),this.markers_map=re(((i=e.markersMap)===null||i===void 0?void 0:i.map(o=>new uc(o)))||[])}};n(lc,"MultiMarkersPlayerBar");lc.type="MultiMarkersPlayerBar";var Qv=lc;var cc=class extends a{constructor(e){super(),this.player_bar=c.parseItem(e.playerBar,Qv),this.player_bar_action_button=c.parseItem(e.playerBarActionButton,S)}};n(cc,"DecoratedPlayerBar");cc.type="DecoratedPlayerBar";var Zv=cc;var dc=class extends a{constructor(e){super(),this.title=new u(e.title),this.description=new u(e.description),this.endpoint=new g(e.navigationEndpoint),this.large_form_factor_background_thumbnail=c.parseItem(e.largeFormFactorBackgroundThumbnail),this.small_form_factor_background_thumbnail=c.parseItem(e.smallFormFactorBackgroundThumbnail),this.scrim_color_values=e.scrimColorValues,this.min_panel_display_duration_ms=e.minPanelDisplayDurationMs,this.min_video_play_duration_ms=e.minVideoPlayDurationMs,this.scrim_duration=e.scrimDuration,this.metadata_order=e.metadataOrder,this.panel_layout=e.panelLayout}};n(dc,"DefaultPromoPanel");dc.type="DefaultPromoPanel";var yI=dc;var pc=class extends a{constructor(e){var i,o,s,r,l,p;if(super(),this.description=u.fromAttributed(e.description),this.max_lines=parseInt(e.maxLines),this.truncation_text=u.fromAttributed(e.truncationText),this.always_show_truncation_text=!!e.alwaysShowTruncationText,!((s=(o=(i=e.rendererContext.commandContext)===null||i===void 0?void 0:i.onTap)===null||o===void 0?void 0:o.innertubeCommand)===null||s===void 0)&&s.showEngagementPanelEndpoint){let f=(p=(l=(r=e.rendererContext.commandContext)===null||r===void 0?void 0:r.onTap)===null||l===void 0?void 0:l.innertubeCommand)===null||p===void 0?void 0:p.showEngagementPanelEndpoint;this.more_endpoint={show_engagement_panel_endpoint:{engagement_panel:c.parseItem(f.engagementPanel,Ui),engagement_panel_popup_type:f.engagementPanelPresentationConfigs.engagementPanelPopupPresentationConfig.popupType,identifier:{surface:f.identifier.surface,tag:f.identifier.tag}}}}}};n(pc,"DescriptionPreviewView");pc.type="DescriptionPreviewView";var e0=pc;var fc=class extends a{constructor(e){super(),this.text=new u(e.didYouMean).toString(),this.corrected_query=new u(e.correctedQuery),this.endpoint=new g(e.navigationEndpoint||e.correctedQueryEndpoint)}};n(fc,"DidYouMean");fc.type="DidYouMean";var t0=fc;var mc=class extends a{constructor(e){super(),this.default_button=c.parseItem(e.defaultButtonViewModel,Vo),this.toggled_button=c.parseItem(e.toggledButtonViewModel,Vo),this.identifier=e.identifier,this.is_toggling_disabled=e.isTogglingDisabled}};n(mc,"ToggleButtonView");mc.type="ToggleButtonView";var ws=mc;var hc=class extends a{constructor(e){super(),this.toggle_button=c.parseItem(e.toggleButtonViewModel,ws),this.dislike_entity_key=e.dislikeEntityKey}};n(hc,"DislikeButtonView");hc.type="DislikeButtonView";var i0=hc;var _c=class extends a{constructor(e){super(),this.style=e.style,this.size=e.size,this.endpoint=new g(e.command),this.target_id=e.targetId}};n(_c,"DownloadButton");_c.type="DownloadButton";var bI=_c;var vc=class extends a{constructor(e){super(),this.text=u.fromAttributed(e.text),this.max_lines=parseInt(e.maxLines)}};n(vc,"DynamicTextView");vc.type="DynamicTextView";var o0=vc;var Yo=class extends a{constructor(e){var i;super(),Reflect.has(e,"type")&&Reflect.has(e.type,"textType")&&(this.text=(i=e.type.textType.text)===null||i===void 0?void 0:i.content),this.properties=e.properties,Reflect.has(e,"childElements")&&(this.child_elements=e.childElements.map(o=>new Yo(o)))}};n(Yo,"ChildElement");Yo.type="ChildElement";var n0=Yo;var jo=class extends a{constructor(e){var i;if(super(),Reflect.has(e,"elementRenderer"))return c.parseItem(e,jo);let o=e.newElement.type.componentType;this.model=c.parseItem(o==null?void 0:o.model),Reflect.has(e,"newElement")&&Reflect.has(e.newElement,"childElements")&&(this.child_elements=re(((i=e.newElement.childElements)===null||i===void 0?void 0:i.map(s=>new n0(s)))||[]))}};n(jo,"Element");jo.type="Element";var Ts=jo;var gc=class extends a{constructor(e){super(),this.title=new u(e.title),this.first_option=c.parseItem(e.firstOption),this.menu=c.parseItem(e.menu,j)}};n(gc,"EmergencyOnebox");gc.type="EmergencyOnebox";var wI=gc;var xc=class extends a{constructor(e){super(),this.category_id=e.categoryId,this.title=new u(e.title),this.emoji_ids=e.emojiIds,this.image_loading_lazy=!!e.imageLoadingLazy,this.category_type=e.categoryType}};n(xc,"EmojiPickerCategory");xc.type="EmojiPickerCategory";var TI=xc;var yc=class extends a{constructor(e){var i;super(),this.category_id=e.categoryId,Reflect.has(e,"icon")&&(this.icon_type=(i=e.icon)===null||i===void 0?void 0:i.iconType),this.tooltip=e.tooltip}};n(yc,"EmojiPickerCategoryButton");yc.type="EmojiPickerCategoryButton";var II=yc;var bc=class extends a{constructor(e){super(),this.category_id=e.categoryId,this.title=new u(e.title),this.upsell=new u(e.upsell),this.emoji_tooltip=e.emojiTooltip,this.endpoint=new g(e.command),this.emoji_ids=e.emojiIds}};n(bc,"EmojiPickerUpsellCategory");bc.type="EmojiPickerUpsellCategory";var kI=bc;var wc=class extends a{constructor(e){super(),this.elements=c.parseArray(e.elements),this.start_ms=e.startMs}};n(wc,"Endscreen");wc.type="Endscreen";var s0=wc;var Tc=class extends a{constructor(e){super(),this.style=e.style,this.title=new u(e.title),this.endpoint=new g(e.endpoint),Reflect.has(e,"image")&&(this.image=w.fromResponse(e.image)),Reflect.has(e,"icon")&&(this.icon=w.fromResponse(e.icon)),Reflect.has(e,"metadata")&&(this.metadata=new u(e.metadata)),Reflect.has(e,"callToAction")&&(this.call_to_action=new u(e.callToAction)),Reflect.has(e,"hovercardButton")&&(this.hovercard_button=c.parseItem(e.hovercardButton)),Reflect.has(e,"isSubscribe")&&(this.is_subscribe=!!e.isSubscribe),Reflect.has(e,"playlistLength")&&(this.playlist_length=new u(e.playlistLength)),Reflect.has(e,"thumbnailOverlays")&&(this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays)),this.left=parseFloat(e.left),this.width=parseFloat(e.width),this.top=parseFloat(e.top),this.aspect_ratio=parseFloat(e.aspectRatio),this.start_ms=parseFloat(e.startMs),this.end_ms=parseFloat(e.endMs),this.id=e.id}};n(Tc,"EndscreenElement");Tc.type="EndscreenElement";var SI=Tc;var Ic=class extends a{constructor(e){super(),this.id=e.playlistId,this.title=new u(e.title),this.author=new u(e.longBylineText),this.endpoint=new g(e.navigationEndpoint),this.thumbnails=w.fromResponse(e.thumbnail),this.video_count=new u(e.videoCountText)}};n(Ic,"EndScreenPlaylist");Ic.type="EndScreenPlaylist";var r0=Ic;var kc=class extends a{constructor(e){super(),this.id=e.videoId,this.title=new u(e.title),this.thumbnails=w.fromResponse(e.thumbnail),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),this.author=new V(e.shortBylineText,e.ownerBadges),this.endpoint=new g(e.navigationEndpoint),this.short_view_count=new u(e.shortViewCountText),this.badges=c.parseArray(e.badges),this.duration={text:new u(e.lengthText).toString(),seconds:e.lengthInSeconds}}};n(kc,"EndScreenVideo");kc.type="EndScreenVideo";var a0=kc;var Sc=class extends a{constructor(e){super(),this.title=e.title,this.endpoint=new g(e.endpoint),this.selected=e.selected,this.content=c.parseItem(e.content)}};n(Sc,"ExpandableTab");Sc.type="ExpandableTab";var Is=Sc;var Cc=class extends a{constructor(e){super(),this.items=c.parseArray(e.items)}get contents(){return this.items}};n(Cc,"ExpandedShelfContents");Cc.type="ExpandedShelfContents";var CI=Cc;var Ec=class extends a{constructor(e){super(),this.dialog_message=new u(e.dialogMessage),this.confirm_label=new u(e.confirmLabel)}};n(Ec,"FancyDismissibleDialog");Ec.type="FancyDismissibleDialog";var EI=Ec;var Pc=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents,xe)}};n(Pc,"FeedFilterChipBar");Pc.type="FeedFilterChipBar";var bi=Pc;var Nc=class extends a{constructor(e){super(),this.title=new u(e.title),this.subtitle=new u(e.subtitle),this.endpoint=new g(e.impressionEndpoint),this.apply_modernized_style=e.applyModernizedStyle,this.trim_style=e.trimStyle,this.background_style=e.backgroundStyle}};n(Nc,"FeedNudge");Nc.type="FeedNudge";var PI=Nc;var Ac=class extends a{constructor(e){super(),this.title=new u(e.title)}};n(Ac,"FeedTabbedHeader");Ac.type="FeedTabbedHeader";var u0=Ac;var Rc=class extends a{constructor(e){super(),this.actions_rows=e.actionsRows.map(i=>({actions:c.parseArray(i.actions,Vo)})),this.style=e.style}};n(Rc,"FlexibleActionsView");Rc.type="FlexibleActionsView";var l0=Rc;var Mc=class extends a{constructor(e){super(),this.title=new u(e.title),this.box_art=w.fromResponse(e.boxArt),this.box_art_overlay_text=new u(e.boxArtOverlayText),this.endpoint=new g(e.endpoint),this.is_official_box_art=!!e.isOfficialBoxArt}};n(Mc,"GameDetails");Mc.type="GameDetails";var NI=Mc;var Vc=class extends a{constructor(e){var i,o,s;super(),this.items=c.parseArray(e.items),Reflect.has(e,"header")&&(this.header=c.parseItem(e.header)),Reflect.has(e,"isCollapsible")&&(this.is_collapsible=e.isCollapsible),Reflect.has(e,"visibleRowCount")&&(this.visible_row_count=e.visibleRowCount),Reflect.has(e,"targetId")&&(this.target_id=e.targetId),this.continuation=((s=(o=(i=e.continuations)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.nextContinuationData)===null||s===void 0?void 0:s.continuation)||null}get contents(){return this.items}};n(Vc,"Grid");Vc.type="Grid";var Uo=Vc;var Oc=class extends a{constructor(e){super(),this.id=e.channelId,this.author=new V(Object.assign(Object.assign({},e.title),{navigationEndpoint:e.navigationEndpoint}),e.ownerBadges,e.thumbnail),this.subscribers=new u(e.subscriberCountText),this.video_count=new u(e.videoCountText),this.endpoint=new g(e.navigationEndpoint),this.subscribe_button=c.parseItem(e.subscribeButton)}};n(Oc,"GridChannel");Oc.type="GridChannel";var c0=Oc;var Dc=class extends a{constructor(e){super(),this.title=new u(e.title)}};n(Dc,"GridHeader");Dc.type="GridHeader";var AI=Dc;var Lc=class extends a{constructor(e){var i,o;super(),this.id=e.playlistId,this.title=new u(e.title),this.author=!((i=e.shortBylineText)===null||i===void 0)&&i.simpleText?new u(e.shortBylineText):!((o=e.longBylineText)===null||o===void 0)&&o.simpleText?new u(e.longBylineText):null,this.thumbnails=w.fromResponse(e.thumbnail),this.video_count=new u(e.videoCountText),this.video_count_short=new u(e.videoCountShortText),this.endpoint=new g(e.navigationEndpoint),this.secondary_endpoint=new g(e.secondaryNavigationEndpoint),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays)}};n(Lc,"GridMix");Lc.type="GridMix";var RI=Lc;var Bc=class extends a{constructor(e){var i;super();let o=(i=e.thumbnailOverlays.find(s=>s.hasOwnProperty("thumbnailOverlayTimeStatusRenderer")))===null||i===void 0?void 0:i.thumbnailOverlayTimeStatusRenderer;this.id=e.videoId,this.title=new u(e.title),this.thumbnails=w.fromResponse(e.thumbnail),this.duration=e.lengthText?new u(e.lengthText):o!=null&&o.text?new u(o.text):null,this.endpoint=new g(e.navigationEndpoint),this.badges=c.parseArray(e.badges,ct),this.metadata=new u(e.metadata),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays)}};n(Bc,"GridMovie");Bc.type="GridMovie";var MI=Bc;var Fc=class extends a{constructor(e){var i;super(),this.id=e.playlistId,this.title=new u(e.title),Reflect.has(e,"shortBylineText")&&(this.author=new V(e.shortBylineText,e.ownerBadges)),this.badges=c.parseArray(e.ownerBadges),this.endpoint=new g(e.navigationEndpoint),this.view_playlist=new u(e.viewPlaylistText),this.thumbnails=w.fromResponse(e.thumbnail),this.thumbnail_renderer=c.parseItem(e.thumbnailRenderer),this.sidebar_thumbnails=[].concat(...((i=e.sidebarThumbnails)===null||i===void 0?void 0:i.map(o=>w.fromResponse(o)))||[])||null,this.video_count=new u(e.thumbnailText),this.video_count_short=new u(e.videoCountShortText)}};n(Fc,"GridPlaylist");Fc.type="GridPlaylist";var d0=Fc;var Yc=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail)}};n(Yc,"ShowCustomThumbnail");Yc.type="ShowCustomThumbnail";var p0=Yc;var jc=class extends a{constructor(e){super(),Reflect.has(e,"text")&&(this.text=new u(e.text)),Reflect.has(e,"icon")&&Reflect.has(e.icon,"iconType")&&(this.icon_type=e.icon.iconType)}};n(jc,"ThumbnailOverlayBottomPanel");jc.type="ThumbnailOverlayBottomPanel";var f0=jc;var Uc=class extends a{constructor(e){super(),this.title=new u(e.title),this.thumbnail_renderer=ue(e.thumbnailRenderer,p0),this.endpoint=new g(e.navigationEndpoint),this.long_byline_text=new u(e.longBylineText),this.thumbnail_overlays=Ke(e.thumbnailOverlays,f0),this.author=new V(e.shortBylineText,void 0)}};n(Uc,"GridShow");Uc.type="GridShow";var VI=Uc;var Wc=class extends a{constructor(e){var i,o;super();let s=(i=e.thumbnailOverlays.find(r=>r.hasOwnProperty("thumbnailOverlayTimeStatusRenderer")))===null||i===void 0?void 0:i.thumbnailOverlayTimeStatusRenderer;this.id=e.videoId,this.title=new u(e.title),this.thumbnails=w.fromResponse(e.thumbnail),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),this.rich_thumbnail=c.parseItem(e.richThumbnail),this.published=new u(e.publishedTimeText),this.duration=e.lengthText?new u(e.lengthText):s!=null&&s.text?new u(s.text):null,this.author=e.shortBylineText&&new V(e.shortBylineText,e.ownerBadges),this.views=new u(e.viewCountText),this.short_view_count=new u(e.shortViewCountText),this.endpoint=new g(e.navigationEndpoint),this.menu=c.parseItem(e.menu,j),Reflect.has(e,"buttons")&&(this.buttons=c.parseArray(e.buttons)),Reflect.has(e,"upcomingEventData")&&(this.upcoming=new Date(Number(`${e.upcomingEventData.startTime}000`)),this.upcoming_text=new u(e.upcomingEventData.upcomingEventText),this.is_reminder_set=!!(!((o=e.upcomingEventData)===null||o===void 0)&&o.isReminderSet))}get is_upcoming(){return Boolean(this.upcoming&&this.upcoming>new Date)}};n(Wc,"GridVideo");Wc.type="GridVideo";var m0=Wc;var Hc=class extends a{constructor(e){super(),this.title=new u(e.formattedTitle),this.endpoint=new g(e.navigationEndpoint||e.serviceEndpoint),Reflect.has(e,"icon")&&Reflect.has(e.icon,"iconType")&&(this.icon_type=e.icon.iconType),Reflect.has(e,"thumbnail")&&(this.thumbnails=w.fromResponse(e.thumbnail)),Reflect.has(e,"badges")&&(this.badges=e.badges),this.is_primary=!!e.isPrimary}};n(Hc,"GuideEntry");Hc.type="GuideEntry";var Wo=Hc;var Jc=class extends a{constructor(e){super(),this.expander_item=ue(e.expanderItem,Wo),this.collapser_item=ue(e.collapserItem,Wo),this.expandable_items=Ke(e.expandableItems)}};n(Jc,"GuideCollapsibleEntry");Jc.type="GuideCollapsibleEntry";var OI=Jc;var Gc=class extends a{constructor(e){super(),this.header_entry=ue(e.headerEntry),this.expander_icon=e.expanderIcon.iconType,this.collapser_icon=e.collapserIcon.iconType,this.section_items=Ke(e.sectionItems)}};n(Gc,"GuideCollapsibleSectionEntry");Gc.type="GuideCollapsibleSectionEntry";var DI=Gc;var zc=class extends Wo{constructor(e){super(e.entryRenderer.guideEntryRenderer),this.always_show=!!e.alwaysShow}};n(zc,"GuideDownloadsEntry");zc.type="GuideDownloadsEntry";var LI=zc;var $c=class extends a{constructor(e){super(),Reflect.has(e,"formattedTitle")&&(this.title=new u(e.formattedTitle)),this.items=Ke(e.items)}};n($c,"GuideSection");$c.type="GuideSection";var ks=$c;var Kc=class extends ks{};n(Kc,"GuideSubscriptionsSection");Kc.type="GuideSubscriptionsSection";var h0=Kc;var qc=class extends a{constructor(e){super(),this.hashtag=new u(e.hashtag),this.hashtag_info=new u(e.hashtagInfoText)}};n(qc,"HashtagHeader");qc.type="HashtagHeader";var _0=qc;var Xc=class extends a{constructor(e){super(),this.hashtag=new u(e.hashtag),this.hashtag_info_text=new u(e.hashtagInfoText),this.hashtag_thumbnail=w.fromResponse(e.hashtagThumbnail),this.endpoint=new g(e.onTapCommand),this.hashtag_background_color=e.hashtagBackgroundColor,this.hashtag_video_count=new u(e.hashtagVideoCount),this.hashtag_channel_count=new u(e.hashtagChannelCount)}};n(Xc,"HashtagTile");Xc.type="HashtagTile";var BI=Xc;var Qc=class extends a{constructor(e){super(),this.thumbnails=w.fromResponse(e.thumbnail),this.on_tap_endpoint=new g(e.onTap)}};n(Qc,"HeroPlaylistThumbnail");Qc.type="HeroPlaylistThumbnail";var FI=Qc;var Zc=class extends a{constructor(e){super(),e.thumbnail&&(this.thumbnail={image:w.fromResponse(e.thumbnail.image),endpoint:new g(e.thumbnail.onTap),on_long_press_endpoint:new g(e.thumbnail.onLongPress),content_mode:e.thumbnail.contentMode,crop_options:e.thumbnail.cropOptions}),this.background_image={image:w.fromResponse(e.backgroundImage.image),gradient_image:w.fromResponse(e.backgroundImage.gradientImage)},this.strapline=e.strapline,this.title=e.title,this.description=e.description,this.cta={icon_name:e.cta.iconName,title:e.cta.title,endpoint:new g(e.cta.onTap),accessibility_text:e.cta.accessibilityText,state:e.cta.state},this.text_on_tap_endpoint=new g(e.textOnTap)}};n(Zc,"Panel");Zc.type="Panel";var ed=class extends a{constructor(e){super(),this.panels=re(e.highlightsCarousel.panels.map(i=>new Zc(i)))}};n(ed,"HighlightsCarousel");ed.type="HighlightsCarousel";var td=ed;var id=class extends a{constructor(e){super(),this.suggestion=new u(e.suggestion),this.endpoint=new g(e.navigationEndpoint),Reflect.has(e,"icon")&&(this.icon_type=e.icon.iconType),Reflect.has(e,"serviceEndpoint")&&(this.service_endpoint=new g(e.serviceEndpoint))}};n(id,"SearchSuggestion");id.type="SearchSuggestion";var v0=id;var od=class extends v0{constructor(e){super(e)}};n(od,"HistorySuggestion");od.type="HistorySuggestion";var YI=od;var nd=class extends a{constructor(e){super(),this.items=c.parseArray(e.items),this.previous_button=c.parseItem(e.previousButton,S),this.next_button=c.parseItem(e.nextButton,S)}get contents(){return this.items}};n(nd,"HorizontalMovieList");nd.type="HorizontalMovieList";var jI=nd;var sd=class extends a{constructor(e){var i;super(),this.icon_type=(i=e.icon)===null||i===void 0?void 0:i.iconType,Reflect.has(e,"tooltip")&&(this.tooltip=new u(e.tooltip).toString()),this.endpoint=new g(e.navigationEndpoint)}};n(sd,"IconLink");sd.type="IconLink";var g0=sd;var rd=class extends a{constructor(e){super(),this.image=w.fromResponse(e.image),this.style=e.style}};n(rd,"ImageBannerView");rd.type="ImageBannerView";var x0=rd;var ad=class extends a{constructor(e){super(),this.including_results_for=new u(e.includingResultsFor),this.corrected_query=new u(e.correctedQuery),this.corrected_query_endpoint=new g(e.correctedQueryEndpoint),this.search_only_for=Reflect.has(e,"searchOnlyFor")?new u(e.searchOnlyFor):void 0,this.original_query=Reflect.has(e,"originalQuery")?new u(e.originalQuery):void 0,this.original_query_endpoint=Reflect.has(e,"originalQueryEndpoint")?new g(e.originalQueryEndpoint):void 0}};n(ad,"IncludingResultsFor");ad.type="IncludingResultsFor";var UI=ad;var ud=class extends a{constructor(e){super(),this.title=new u(e.title),this.source=new u(e.source),this.paragraphs=e.paragraphs.map(i=>new u(i)),this.thumbnail=w.fromResponse(e.thumbnail),this.source_endpoint=new g(e.sourceEndpoint),this.truncate_paragraphs=!!e.truncateParagraphs,this.background=e.background,Reflect.has(e,"inlineLinkIcon")&&Reflect.has(e.inlineLinkIcon,"iconType")&&(this.inline_link_icon_type=e.inlineLinkIcon.iconType)}};n(ud,"InfoPanelContent");ud.type="InfoPanelContent";var y0=ud;var ld=class extends a{constructor(e){var i;super(),this.title=new u(e.title),this.menu=c.parseItem(e.menu,j),this.content=c.parseItem(e.content,y0),this.background=e.background,Reflect.has(e,"icon")&&(this.icon_type=(i=e.icon)===null||i===void 0?void 0:i.iconType)}};n(ld,"InfoPanelContainer");ld.type="InfoPanelContainer";var b0=ld;var cd=class extends a{constructor(e){super(),this.header_type=e.type,this.title=new u(e.title),this.description=new u(e.description),this.metadata=new u(e.metadata),this.badges=c.parseArray(e.badges,ct),this.box_art=w.fromResponse(e.boxArt),this.banner=w.fromResponse(e.banner),this.buttons=c.parseArray(e.buttons,[$e,S]),this.auto_generated=new u(e.autoGenerated)}};n(cd,"InteractiveTabbedHeader");cd.type="InteractiveTabbedHeader";var w0=cd;var dd=class extends a{constructor(e){super(),this.title=new u(e.title)}};n(dd,"ItemSectionHeader");dd.type="ItemSectionHeader";var Ss=dd;var pd=class extends a{constructor(e){super(),this.title=new u(e.title),this.selected=!!e.selected,this.endpoint=new g(e.endpoint)}};n(pd,"ItemSectionTab");pd.type="Tab";var T0=pd;var fd=class extends a{constructor(e){super(),this.title=new u(e.title),this.tabs=c.parseArray(e.tabs,T0),Reflect.has(e,"endItems")&&(this.end_items=c.parseArray(e.endItems))}};n(fd,"ItemSectionTabbedHeader");fd.type="ItemSectionTabbedHeader";var Cs=fd;var md=class extends a{constructor(e){super(),this.filter_menu=c.parseItem(e.filterMenu,Ho.SortFilterSubMenu)}};n(md,"SortFilterHeader");md.type="SortFilterHeader";var I0=md;var hd=class extends a{constructor(e){var i,o,s;super(),this.header=c.parseItem(e.header,[zi,Ss,Cs,I0]),this.contents=c.parseArray(e.contents),(e.targetId||e.sectionIdentifier)&&(this.target_id=e.target_id||e.sectionIdentifier),e.continuations&&(this.continuation=(s=(o=(i=e.continuations)===null||i===void 0?void 0:i.at(0))===null||o===void 0?void 0:o.nextContinuationData)===null||s===void 0?void 0:s.continuation)}};n(hd,"ItemSection");hd.type="ItemSection";var ye=hd;var _d=class extends a{constructor(e){super(),this.target={video_id:e.target.videoId},this.like_status=e.likeStatus,this.likes_allowed=e.likesAllowed,Reflect.has(e,"serviceEndpoints")&&(this.endpoints=e.serviceEndpoints.map(i=>new g(i)))}};n(_d,"LikeButton");_d.type="LikeButton";var k0=_d;var vd=class extends a{constructor(e){super(),this.toggle_button=c.parseItem(e.toggleButtonViewModel,ws),this.like_status_entity_key=e.likeStatusEntityKey,this.like_status_entity={key:e.likeStatusEntity.key,like_status:e.likeStatusEntity.likeStatus}}};n(vd,"LikeButtonView");vd.type="LikeButtonView";var S0=vd;var gd=class extends a{constructor(e){var i,o;super(),this.header=c.parseItem(e.header),this.initial_display_state=e.initialDisplayState,this.continuation=(o=(i=e.continuations[0])===null||i===void 0?void 0:i.reloadContinuationData)===null||o===void 0?void 0:o.continuation,this.client_messages={reconnect_message:new u(e.clientMessages.reconnectMessage),unable_to_reconnect_message:new u(e.clientMessages.unableToReconnectMessage),fatal_error:new u(e.clientMessages.fatalError),reconnected_message:new u(e.clientMessages.reconnectedMessage),generic_error:new u(e.clientMessages.genericError)},this.is_replay=!!e.isReplay}};n(gd,"LiveChat");gd.type="LiveChat";var C0=gd;var xd=class extends a{constructor(e){super(),this.text=new u(e.text),Reflect.has(e,"icon")&&Reflect.has(e.icon,"iconType")&&(this.icon_type=e.icon.iconType),this.context_menu_button=c.parseItem(e.contextMenuButton,S)}};n(xd,"LiveChatBannerHeader");xd.type="LiveChatBannerHeader";var E0=xd;var yd=class extends a{constructor(e){super(),this.header=c.parseItem(e.header,E0),this.contents=c.parseItem(e.contents),this.action_id=e.actionId,this.viewer_is_creator=e.viewerIsCreator,this.target_id=e.targetId,this.is_stackable=e.isStackable,this.background_type=e.backgroundType}};n(yd,"LiveChatBanner");yd.type="LiveChatBanner";var P0=yd;var bd=class extends a{constructor(e){super(),this.banner=c.parseItem(e.bannerRenderer,P0)}};n(bd,"AddBannerToLiveChatCommand");bd.type="AddBannerToLiveChatCommand";var WI=bd;var wd=class extends a{constructor(e){super(),this.item=c.parseItem(e.item),Reflect.has(e,"clientId")&&(this.client_id=e.clientId)}};n(wd,"AddChatItemAction");wd.type="AddChatItemAction";var N0=wd;var Td=class extends a{constructor(e){super(),this.item=c.parseItem(e.item),this.duration_sec=e.durationSec}};n(Td,"AddLiveChatTickerItemAction");Td.type="AddLiveChatTickerItemAction";var HI=Td;var Id=class extends a{constructor(e){super(),this.client_assigned_id=e.clientAssignedId}};n(Id,"DimChatItemAction");Id.type="DimChatItemAction";var JI=Id;var kd=class extends a{constructor(e){super(),this.menu_endpoint=new g(e.contextMenuEndpoint),this.moderation_buttons=c.parseArray(e.moderationButtons,S),this.auto_moderated_item=c.parseItem(e.autoModeratedItem),this.header_text=new u(e.headerText),this.timestamp=Math.floor(parseInt(e.timestampUsec)/1e3),this.id=e.id}};n(kd,"LiveChatAutoModMessage");kd.type="LiveChatAutoModMessage";var GI=kd;var Sd=class extends a{constructor(e){super(),this.poll_question=new u(e.pollQuestion),this.author_photo=w.fromResponse(e.authorPhoto),this.choices=e.pollChoices.map(i=>({option_id:i.pollOptionId,text:new u(i.text).toString()})),this.collapsed_state_entity_key=e.collapsedStateEntityKey,this.live_chat_poll_state_entity_key=e.liveChatPollStateEntityKey,this.context_menu_button=c.parseItem(e.contextMenuButton,S)}};n(Sd,"LiveChatBannerPoll");Sd.type="LiveChatBannerPoll";var zI=Sd;var Cd=class extends a{constructor(e){super(),this.id=e.id,this.timestamp=Math.floor(parseInt(e.timestampUsec)/1e3),this.header_subtext=new u(e.headerSubtext),this.author=new V(e.authorName,e.authorBadges,e.authorPhoto,e.authorExternalChannelId),this.menu_endpoint=new g(e.contextMenuEndpoint)}};n(Cd,"LiveChatMembershipItem");Cd.type="LiveChatMembershipItem";var $I=Cd;var Ed=class extends a{constructor(e){super(),this.message=new u(e.message),this.author=new V(e.authorName,e.authorBadges,e.authorPhoto,e.authorExternalChannelId),this.header_background_color=e.headerBackgroundColor,this.header_text_color=e.headerTextColor,this.body_background_color=e.bodyBackgroundColor,this.body_text_color=e.bodyTextColor,this.purchase_amount=new u(e.purchaseAmountText).toString(),this.menu_endpoint=new g(e.contextMenuEndpoint),this.timestamp=Math.floor(parseInt(e.timestampUsec)/1e3),this.timestamp_text=new u(e.timestampText).toString(),this.id=e.id}};n(Ed,"LiveChatPaidMessage");Ed.type="LiveChatPaidMessage";var KI=Ed;var Pd=class extends a{constructor(e){super(),this.id=e.id,this.author=new V(e.authorName,e.authorBadges,e.authorPhoto,e.authorExternalChannelId),this.money_chip_background_color=e.moneyChipBackgroundColor,this.money_chip_text_color=e.moneyChipTextColor,this.background_color=e.backgroundColor,this.author_name_text_color=e.authorNameTextColor,this.sticker=w.fromResponse(e.sticker),this.purchase_amount=new u(e.purchaseAmountText).toString(),this.menu_endpoint=new g(e.contextMenuEndpoint),this.context_menu=this.menu_endpoint,this.timestamp=Math.floor(parseInt(e.timestampUsec)/1e3)}};n(Pd,"LiveChatPaidSticker");Pd.type="LiveChatPaidSticker";var qI=Pd;var Nd=class extends a{constructor(e){super(),this.id=e.id,this.timestamp=Math.floor(parseInt(e.timestampUsec)/1e3)}};n(Nd,"LiveChatPlaceholderItem");Nd.type="LiveChatPlaceholderItem";var XI=Nd;var Ad=class extends a{constructor(e){super(),this.title=e.title,this.accessibility_title=e.accessibilityTitle,this.thumbnail=w.fromResponse(e.thumbnail),this.price=e.price,this.vendor_name=e.vendorName,this.from_vendor_text=e.fromVendorText,this.information_button=c.parseItem(e.informationButton),this.endpoint=new g(e.onClickCommand),this.creator_message=e.creatorMessage,this.creator_name=e.creatorName,this.author_photo=w.fromResponse(e.authorPhoto),this.information_dialog=c.parseItem(e.informationDialog),this.is_verified=e.isVerified,this.creator_custom_message=new u(e.creatorCustomMessage)}};n(Ad,"LiveChatProductItem");Ad.type="LiveChatProductItem";var QI=Ad;var Rd=class extends a{constructor(e){super(),this.message=new u(e.message),Reflect.has(e,"icon")&&Reflect.has(e.icon,"iconType")&&(this.icon_type=e.icon.iconType)}};n(Rd,"LiveChatRestrictedParticipation");Rd.type="LiveChatRestrictedParticipation";var ZI=Rd;var Jo=class extends a{constructor(e){super(),this.message=new u(e.message),this.inline_action_buttons=c.parseArray(e.inlineActionButtons,S),this.timestamp=Math.floor(parseInt(e.timestampUsec)/1e3),this.id=e.id}};n(Jo,"LiveChatMessageBase");Jo.type="LiveChatMessageBase";var Md=class extends Jo{constructor(e){super(e),this.author=new V(e.authorName,e.authorBadges,e.authorPhoto,e.authorExternalChannelId),this.menu_endpoint=new g(e.contextMenuEndpoint)}};n(Md,"LiveChatTextMessage");Md.type="LiveChatTextMessage";var ek=Md;var Vd=class extends a{constructor(e){var i,o;super(),this.author=new V(e.authorName,e.authorBadges,e.authorPhoto,e.authorExternalChannelId),this.amount=new u(e.amount),this.duration_sec=e.durationSec,this.full_duration_sec=e.fullDurationSec,this.show_item=c.parseItem((o=(i=e.showItemEndpoint)===null||i===void 0?void 0:i.showLiveChatItemEndpoint)===null||o===void 0?void 0:o.renderer),this.show_item_endpoint=new g(e.showItemEndpoint),this.id=e.id}};n(Vd,"LiveChatTickerPaidMessageItem");Vd.type="LiveChatTickerPaidMessageItem";var A0=Vd;var Od=class extends A0{};n(Od,"LiveChatTickerPaidStickerItem");Od.type="LiveChatTickerPaidStickerItem";var tk=Od;var Dd=class extends a{constructor(e){super(),this.id=e.id,this.detail=new u(e.detailText),this.author=new V(e.authorName,e.authorBadges,e.sponsorPhoto,e.authorExternalChannelId),this.duration_sec=e.durationSec}};n(Dd,"LiveChatTickerSponsorItem");Dd.type="LiveChatTickerSponsorItem";var ik=Dd;var Ld=class extends Jo{constructor(e){super(e),Reflect.has(e,"icon")&&Reflect.has(e.icon,"iconType")&&(this.icon_type=e.icon.iconType),this.action_button=c.parseItem(e.actionButton)}};n(Ld,"LiveChatViewerEngagementMessage");Ld.type="LiveChatViewerEngagementMessage";var ok=Ld;var Bd=class extends a{constructor(e){super(),this.poll_question=new u(e.pollQuestion),this.thumbnails=w.fromResponse(e.thumbnail),this.metadata=new u(e.metadataText),this.live_chat_poll_type=e.liveChatPollType,this.context_menu_button=c.parseItem(e.contextMenuButton,S)}};n(Bd,"PollHeader");Bd.type="PollHeader";var nk=Bd;var Fd=class extends a{constructor(e){super(),this.id=e.id,this.contents=c.parse(e.contents),this.target_id=e.targetId}};n(Fd,"LiveChatActionPanel");Fd.type="LiveChatActionPanel";var R0=Fd;var Yd=class extends a{constructor(e){super(),this.deleted_state_message=new u(e.deletedStateMessage),this.target_item_id=e.targetItemId}};n(Yd,"MarkChatItemAsDeletedAction");Yd.type="MarkChatItemAsDeletedAction";var sk=Yd;var jd=class extends a{constructor(e){super(),this.deleted_state_message=new u(e.deletedStateMessage),this.external_channel_id=e.externalChannelId}};n(jd,"MarkChatItemsByAuthorAsDeletedAction");jd.type="MarkChatItemsByAuthorAsDeletedAction";var rk=jd;var Ud=class extends a{constructor(e){super(),this.target_action_id=e.targetActionId}};n(Ud,"RemoveBannerForLiveChatCommand");Ud.type="RemoveBannerForLiveChatCommand";var ak=Ud;var Wd=class extends a{constructor(e){super(),this.target_item_id=e.targetItemId}};n(Wd,"RemoveChatItemAction");Wd.type="RemoveChatItemAction";var uk=Wd;var Hd=class extends a{constructor(e){super(),this.external_channel_id=e.externalChannelId}};n(Hd,"RemoveChatItemByAuthorAction");Hd.type="RemoveChatItemByAuthorAction";var lk=Hd;var Jd=class extends a{constructor(e){super(),this.target_item_id=e.targetItemId,this.replacement_item=c.parseItem(e.replacementItem)}};n(Jd,"ReplaceChatItemAction");Jd.type="ReplaceChatItemAction";var ck=Jd;var Gd=class extends a{constructor(e){var i;super(),this.actions=c.parseArray((i=e.actions)===null||i===void 0?void 0:i.map(o=>(delete o.clickTrackingParams,o))),this.video_offset_time_msec=e.videoOffsetTimeMsec}};n(Gd,"ReplayChatItemAction");Gd.type="ReplayChatItemAction";var dk=Gd;var zd=class extends a{constructor(e){super(),this.panel_to_show=c.parseItem(e.panelToShow,R0)}};n(zd,"ShowLiveChatActionPanelAction");zd.type="ShowLiveChatActionPanelAction";var pk=zd;var $d=class extends a{constructor(e){super(),this.dialog=c.parseItem(e.dialog)}};n($d,"ShowLiveChatDialogAction");$d.type="ShowLiveChatDialogAction";var fk=$d;var Kd=class extends a{constructor(e){super(),this.tooltip=c.parseItem(e.tooltip)}};n(Kd,"ShowLiveChatTooltipCommand");Kd.type="ShowLiveChatTooltipCommand";var mk=Kd;var qd=class extends a{constructor(e){super(),this.date_text=new u(e.dateText).toString()}};n(qd,"UpdateDateTextAction");qd.type="UpdateDateTextAction";var M0=qd;var Xd=class extends a{constructor(e){super(),this.description=new u(e.description)}};n(Xd,"UpdateDescriptionAction");Xd.type="UpdateDescriptionAction";var V0=Xd;var Qd=class extends a{constructor(e){super(),this.poll_to_update=c.parseItem(e.pollToUpdate)}};n(Qd,"UpdateLiveChatPollAction");Qd.type="UpdateLiveChatPollAction";var hk=Qd;var Zd=class extends a{constructor(e){super(),this.title=new u(e.title)}};n(Zd,"UpdateTitleAction");Zd.type="UpdateTitleAction";var O0=Zd;var ep=class extends a{constructor(e){super(),this.default_text=new u(e.defaultText).toString(),this.toggled_text=new u(e.toggledText).toString(),this.button_id=e.buttonId}};n(ep,"UpdateToggleButtonTextAction");ep.type="UpdateToggleButtonTextAction";var D0=ep;var tp=class extends a{constructor(e){super();let i=e.viewCount.videoViewCountRenderer;this.view_count=new u(i.viewCount),this.extra_short_view_count=new u(i.extraShortViewCount),this.original_view_count=parseInt(i.originalViewCount),this.unlabeled_view_count_value=new u(i.unlabeledViewCountValue),this.is_live=i.isLive}};n(tp,"UpdateViewershipAction");tp.type="UpdateViewershipAction";var L0=tp;var ip=class extends ct{constructor(e){super(e),this.custom_thumbnail=w.fromResponse(e.customThumbnail)}};n(ip,"LiveChatAuthorBadge");ip.type="LiveChatAuthorBadge";var _k=ip;var op=class extends a{constructor(e){super(),this.confirm_button=c.parseItem(e.confirmButton,S),this.dialog_messages=e.dialogMessages.map(i=>new u(i))}};n(op,"LiveChatDialog");op.type="LiveChatDialog";var vk=op;var np=class extends a{constructor(e){super(),this.overflow_menu=c.parseItem(e.overflowMenu,j),this.collapse_button=c.parseItem(e.collapseButton,S),this.view_selector=c.parseItem(e.viewSelector,Bt)}};n(np,"LiveChatHeader");np.type="LiveChatHeader";var B0=np;var sp=class extends a{constructor(e){super(),this.max_items_to_display=e.maxItemsToDisplay,this.more_comments_below_button=c.parseItem(e.moreCommentsBelowButton,S)}};n(sp,"LiveChatItemList");sp.type="LiveChatItemList";var F0=sp;var rp=class extends a{constructor(e){super(),this.author_name=new u(e.authorName),this.author_photo=w.fromResponse(e.authorPhoto),this.send_button=c.parseItem(e.sendButton,S),this.target_id=e.targetId}};n(rp,"LiveChatMessageInput");rp.type="LiveChatMessageInput";var gk=rp;var ap=class extends a{constructor(e){super(),this.name=new u(e.authorName),this.photo=w.fromResponse(e.authorPhoto),this.badges=c.parseArray(e.authorBadges)}};n(ap,"LiveChatParticipant");ap.type="LiveChatParticipant";var Y0=ap;var up=class extends a{constructor(e){super(),this.title=new u(e.title),this.participants=c.parseArray(e.participants,Y0)}};n(up,"LiveChatParticipantsList");up.type="LiveChatParticipantsList";var j0=up;var lp=class extends a{constructor(e){super(),this.title=u.fromAttributed(e.title),this.metadata=c.parseItem(e.metadata,bs)}};n(lp,"LockupMetadataView");lp.type="LockupMetadataView";var U0=lp;var cp=class extends a{constructor(e){super(),this.content_image=c.parseItem(e.contentImage,Mv),this.metadata=c.parseItem(e.metadata,U0),this.content_id=e.contentId,this.content_type=e.contentType.replace("LOCKUP_CONTENT_TYPE_",""),this.on_tap_endpoint=new g(e.rendererContext.commandContext.onTap)}};n(cp,"LockupView");cp.type="LockupView";var W0=cp;var dp=class extends S{constructor(e){super(e)}};n(dp,"MenuNavigationItem");dp.type="MenuNavigationItem";var H0=dp;var pp=class extends S{constructor(e){super(e)}};n(pp,"MenuServiceItem");pp.type="MenuServiceItem";var Ki=pp;var fp=class extends a{constructor(e){super(),this.items=c.parseArray(e.items,[H0,Ki])}};n(fp,"MenuPopup");fp.type="MenuPopup";var xk=fp;var mp=class extends a{constructor(e){super(),this.has_separator=!!e.hasSeparator,this.endpoint=new g(e.navigationEndpoint||e.serviceEndpoint)}};n(mp,"MenuServiceItemDownload");mp.type="MenuServiceItemDownload";var yk=mp;var hp=class extends a{constructor(e){super(),this.header=c.parse(e.header),this.sections=c.parse(e.sections),this.style=e.style}};n(hp,"MultiPageMenu");hp.type="MultiPageMenu";var bk=hp;var _p=class extends a{constructor(e){super(),this.items=c.parse(e.items)}get contents(){return this.items}};n(_p,"MultiPageMenuNotificationSection");_p.type="MultiPageMenuNotificationSection";var wk=_p;var vp=class extends a{constructor(e){super()}};n(vp,"MusicMenuItemDivider");vp.type="MusicMenuItemDivider";var J0=vp;var gp=class extends a{constructor(e){super(),this.title=new u(e.title).toString(),this.form_item_entity_key=e.formItemEntityKey,Reflect.has(e,"selectedIcon")&&(this.selected_icon_type=e.selectedIcon.iconType),Reflect.has(e,"selectedCommand")&&(this.endpoint=new g(e.selectedCommand)),this.selected=!!this.endpoint}};n(gp,"MusicMultiSelectMenuItem");gp.type="MusicMultiSelectMenuItem";var Yt=gp;var xp=class extends a{constructor(e){var i;super(),Reflect.has(e,"title")&&Reflect.has(e.title,"musicMenuTitleRenderer")&&(this.title=new u((i=e.title.musicMenuTitleRenderer)===null||i===void 0?void 0:i.primaryText)),this.options=c.parseArray(e.options,[Yt,J0])}};n(xp,"MusicMultiSelectMenu");xp.type="MusicMultiSelectMenu";var G0=xp;var yp=class extends a{constructor(e){super(),this.title=new u(e.title),this.buttons=c.parse(e.buttons)}};n(yp,"SimpleMenuHeader");yp.type="SimpleMenuHeader";var z0=yp;var bp=class extends a{constructor(e){super(),this.title=e.title,this.description=e.description,this.thumbnails=w.fromResponse(e.thumbnail),this.price=e.price,this.vendor_name=e.vendorName,this.button_text=e.buttonText,this.button_accessibility_text=e.buttonAccessibilityText,this.from_vendor_text=e.fromVendorText,this.additional_fees_text=e.additionalFeesText,this.region_format=e.regionFormat,this.endpoint=new g(e.buttonCommand)}};n(bp,"MerchandiseItem");bp.type="MerchandiseItem";var Tk=bp;var wp=class extends a{constructor(e){super(),this.title=e.title,this.menu=c.parseItem(e.actionButton),this.items=c.parseArray(e.items)}get contents(){return this.items}};n(wp,"MerchandiseShelf");wp.type="MerchandiseShelf";var $0=wp;var Tp=class extends a{constructor(e){super(),this.title=new u(e.title),this.contents=e.contents.map(i=>new u(i))}};n(Tp,"MetadataRow");Tp.type="MetadataRow";var Ik=Tp;var Ip=class extends a{constructor(e){super(),this.rows=c.parseArray(e.rows),this.collapsed_item_count=e.collapsedItemCount}};n(Ip,"MetadataRowContainer");Ip.type="MetadataRowContainer";var K0=Ip;var kp=class extends a{constructor(e){super(),this.content=new u(e.content),this.has_divider_line=e.hasDividerLine}};n(kp,"MetadataRowHeader");kp.type="MetadataRowHeader";var kk=kp;var Sp=class extends a{constructor(e){super(),this.section_list=c.parseItem(e)}};n(Sp,"MetadataScreen");Sp.type="MetadataScreen";var Sk=Sp;var Cp=class extends a{constructor(e){super(),this.url_canonical=e.urlCanonical,this.title=e.title,this.description=e.description,this.thumbnail=w.fromResponse(e.thumbnail),this.site_name=e.siteName,this.app_name=e.appName,this.android_package=e.androidPackage,this.ios_app_store_id=e.iosAppStoreId,this.ios_app_arguments=e.iosAppArguments,this.og_type=e.ogType,this.url_applinks_web=e.urlApplinksWeb,this.url_applinks_ios=e.urlApplinksIos,this.url_applinks_android=e.urlApplinksAndroid,this.url_twitter_ios=e.urlTwitterIos,this.url_twitter_android=e.urlTwitterAndroid,this.twitter_card_type=e.twitterCardType,this.twitter_site_handle=e.twitterSiteHandle,this.schema_dot_org_type=e.schemaDotOrgType,this.noindex=e.noindex,this.is_unlisted=e.unlisted,this.is_family_safe=e.familySafe,this.tags=e.tags,this.available_countries=e.availableCountries}};n(Cp,"MicroformatData");Cp.type="MicroformatData";var ii=Cp;var Ep=class extends ti{constructor(e){super(e)}};n(Ep,"Mix");Ep.type="Mix";var Ck=Ep;var Pp=class extends a{constructor(e){super(),this.title=new u(e.title),this.content=new u(e.content),this.button=c.parseItem(e.button,S)}};n(Pp,"ModalWithTitleAndButton");Pp.type="ModalWithTitleAndButton";var Ek=Pp;var Np=class extends a{constructor(e){var i,o,s;super();let r=((i=e.thumbnailOverlays.find(l=>l.thumbnailOverlayTimeStatusRenderer))===null||i===void 0?void 0:i.thumbnailOverlayTimeStatusRenderer.text)||"N/A";this.id=e.videoId,this.title=new u(e.title),Reflect.has(e,"descriptionSnippet")&&(this.description_snippet=new u(e.descriptionSnippet)),this.top_metadata_items=new u(e.topMetadataItems),this.thumbnails=w.fromResponse(e.thumbnail),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),this.author=new V(e.longBylineText,e.ownerBadges,(s=(o=e.channelThumbnailSupportedRenderers)===null||o===void 0?void 0:o.channelThumbnailWithLinkRenderer)===null||s===void 0?void 0:s.thumbnail),this.duration={text:e.lengthText?new u(e.lengthText).toString():new u(r).toString(),seconds:je(e.lengthText?new u(e.lengthText).toString():new u(r).toString())},this.endpoint=new g(e.navigationEndpoint),this.badges=c.parseArray(e.badges),this.use_vertical_poster=e.useVerticalPoster,this.show_action_menu=e.showActionMenu,this.menu=c.parseItem(e.menu,j)}};n(Np,"Movie");Np.type="Movie";var Pk=Np;var Ap=class extends a{constructor(e){var i;return super(),(i=e.movingThumbnailDetails)===null||i===void 0?void 0:i.thumbnails.map(o=>new w(o)).sort((o,s)=>s.width-o.width)}};n(Ap,"MovingThumbnail");Ap.type="MovingThumbnail";var Nk=Ap;var Rp=class extends a{constructor(e){super(),this.title=new u(e.title)}};n(Rp,"MusicCardShelfHeaderBasic");Rp.type="MusicCardShelfHeaderBasic";var q0=Rp;var Mp=class extends a{constructor(e){super(),this.icon_type=e.icon.iconType,this.label=e.accessibilityData.accessibilityData.label}};n(Mp,"MusicInlineBadge");Mp.type="MusicInlineBadge";var Es=Mp;var Vp=class extends a{constructor(e){var i,o;super(),this.endpoint=new g(e.playNavigationEndpoint),this.play_icon_type=e.playIcon.iconType,this.pause_icon_type=e.pauseIcon.iconType,Reflect.has(e,"accessibilityPlayData")&&(this.play_label=(i=e.accessibilityPlayData.accessibilityData)===null||i===void 0?void 0:i.label),Reflect.has(e,"accessibilityPauseData")&&(this.pause_label=(o=e.accessibilityPauseData.accessibilityData)===null||o===void 0?void 0:o.label),this.icon_color=e.iconColor}};n(Vp,"MusicPlayButton");Vp.type="MusicPlayButton";var Ps=Vp;var Op=class extends a{constructor(e){super(),this.content=c.parseItem(e.content,Ps),this.content_position=e.contentPosition,this.display_style=e.displayStyle}};n(Op,"MusicItemThumbnailOverlay");Op.type="MusicItemThumbnailOverlay";var oi=Op;var Dp=class extends a{constructor(e){super(),this.contents=w.fromResponse(e.thumbnail)}};n(Dp,"MusicThumbnail");Dp.type="MusicThumbnail";var ot=Dp;var Lp=class extends a{constructor(e){super(),this.thumbnail=c.parseItem(e.thumbnail,ot),this.title=new u(e.title),this.subtitle=new u(e.subtitle),this.buttons=c.parseArray(e.buttons,S),this.menu=c.parseItem(e.menu,j),this.on_tap=new g(e.onTap),this.header=c.parseItem(e.header,q0),Reflect.has(e,"endIcon")&&Reflect.has(e.endIcon,"iconType")&&(this.end_icon_type=e.endIcon.iconType),this.subtitle_badges=c.parseArray(e.subtitleBadges,Es),this.thumbnail_overlay=c.parseItem(e.thumbnailOverlay,oi),Reflect.has(e,"contents")&&(this.contents=c.parseArray(e.contents))}};n(Lp,"MusicCardShelf");Lp.type="MusicCardShelf";var X0=Lp;var Bp=class extends a{constructor(e){super(),this.title=new u(e.title),Reflect.has(e,"strapline")&&(this.strapline=new u(e.strapline)),Reflect.has(e,"thumbnail")&&(this.thumbnail=c.parseItem(e.thumbnail,ot)),Reflect.has(e,"moreContentButton")&&(this.more_content=c.parseItem(e.moreContentButton,S)),Reflect.has(e,"endIcons")&&(this.end_icons=c.parseArray(e.endIcons,g0))}};n(Bp,"MusicCarouselShelfBasicHeader");Bp.type="MusicCarouselShelfBasicHeader";var Q0=Bp;var Fp=class extends a{constructor(e){super(),this.thumbnail=c.parseItem(e.thumbnail,ot),this.overlay=c.parseItem(e.overlay,oi),this.on_tap=new g(e.onTap),this.menu=c.parseItem(e.menu,j),this.subtitle=new u(e.subtitle),this.title=new u(e.title),Reflect.has(e,"secondTitle")&&(this.second_title=new u(e.secondTitle)),Reflect.has(e,"description")&&(this.description=new u(e.description)),Reflect.has(e,"displayStyle")&&(this.display_style=e.displayStyle)}};n(Fp,"MusicMultiRowListItem");Fp.type="MusicMultiRowListItem";var Z0=Fp;var Yp=class extends a{constructor(e){super(),this.button_text=new u(e.buttonText).toString(),this.endpoint=new g(e.clickCommand)}};n(Yp,"MusicNavigationButton");Yp.type="MusicNavigationButton";var Ns=Yp;var jp=class extends a{constructor(e){super(),this.title=new u(e.text),this.display_priority=e.displayPriority}};n(jp,"MusicResponsiveListItemFixedColumn");jp.type="musicResponsiveListItemFlexColumnRenderer";var eg=jp;var Up=class extends a{constructor(e){super(),this.title=new u(e.text),this.display_priority=e.displayPriority}};n(Up,"MusicResponsiveListItemFlexColumn");Up.type="MusicResponsiveListItemFlexColumn";var tg=Up;var gt,As,Ib,Mk,Ak,Rk,Vk,Ok,Dk,Lk,Bk,Fk,Wp=class extends a{constructor(e){var i,o,s,r,l,p;super(),gt.add(this),As.set(this,void 0),this.flex_columns=c.parseArray(e.flexColumns,tg),this.fixed_columns=c.parseArray(e.fixedColumns,eg),I(this,As,{video_id:((i=e==null?void 0:e.playlistItemData)===null||i===void 0?void 0:i.videoId)||null,playlist_set_video_id:((o=e==null?void 0:e.playlistItemData)===null||o===void 0?void 0:o.playlistSetVideoId)||null},"f"),Reflect.has(e,"navigationEndpoint")&&(this.endpoint=new g(e.navigationEndpoint));let f=(p=(l=(r=(s=this.endpoint)===null||s===void 0?void 0:s.payload)===null||r===void 0?void 0:r.browseEndpointContextSupportedConfigs)===null||l===void 0?void 0:l.browseEndpointContextMusicConfig)===null||p===void 0?void 0:p.pageType;switch(f||this.flex_columns.find(m=>{var b,x,T,k;return((k=(T=(x=(b=m.title.endpoint)===null||b===void 0?void 0:b.payload)===null||x===void 0?void 0:x.browseEndpointContextSupportedConfigs)===null||T===void 0?void 0:T.browseEndpointContextMusicConfig)===null||k===void 0?void 0:k.pageType)==="MUSIC_PAGE_TYPE_NON_MUSIC_AUDIO_TRACK_PAGE"})&&(f="MUSIC_PAGE_TYPE_NON_MUSIC_AUDIO_TRACK_PAGE"),f){case"MUSIC_PAGE_TYPE_ALBUM":this.item_type="album",d(this,gt,"m",Bk).call(this);break;case"MUSIC_PAGE_TYPE_PLAYLIST":this.item_type="playlist",d(this,gt,"m",Fk).call(this);break;case"MUSIC_PAGE_TYPE_ARTIST":case"MUSIC_PAGE_TYPE_USER_CHANNEL":this.item_type="artist",d(this,gt,"m",Vk).call(this);break;case"MUSIC_PAGE_TYPE_LIBRARY_ARTIST":this.item_type="library_artist",d(this,gt,"m",Ok).call(this);break;case"MUSIC_PAGE_TYPE_NON_MUSIC_AUDIO_TRACK_PAGE":this.item_type="non_music_track",d(this,gt,"m",Dk).call(this);break;case"MUSIC_PAGE_TYPE_PODCAST_SHOW_DETAIL_PAGE":this.item_type="podcast_show",d(this,gt,"m",Lk).call(this);break;default:this.flex_columns[1]?d(this,gt,"m",Mk).call(this):d(this,gt,"m",Ib).call(this)}Reflect.has(e,"index")&&(this.index=new u(e.index)),Reflect.has(e,"thumbnail")&&(this.thumbnail=c.parseItem(e.thumbnail,ot)),Reflect.has(e,"badges")&&(this.badges=c.parseArray(e.badges)),Reflect.has(e,"menu")&&(this.menu=c.parseItem(e.menu,j)),Reflect.has(e,"overlay")&&(this.overlay=c.parseItem(e.overlay,oi))}get thumbnails(){var e;return((e=this.thumbnail)===null||e===void 0?void 0:e.contents)||[]}};n(Wp,"MusicResponsiveListItem");As=new WeakMap,gt=new WeakSet,Ib=n(function(){this.title=this.flex_columns.first().title.toString(),this.endpoint?this.item_type="endpoint":this.item_type="unknown"},"_MusicResponsiveListItem_parseOther"),Mk=n(function(){var e,i,o,s,r,l,p;switch((p=(l=(r=(s=(o=(i=(e=this.flex_columns.at(0))===null||e===void 0?void 0:e.title.runs)===null||i===void 0?void 0:i.at(0))===null||o===void 0?void 0:o.endpoint)===null||s===void 0?void 0:s.payload)===null||r===void 0?void 0:r.watchEndpointMusicSupportedConfigs)===null||l===void 0?void 0:l.watchEndpointMusicConfig)===null||p===void 0?void 0:p.musicVideoType){case"MUSIC_VIDEO_TYPE_UGC":case"MUSIC_VIDEO_TYPE_OMV":this.item_type="video",d(this,gt,"m",Rk).call(this);break;case"MUSIC_VIDEO_TYPE_ATV":this.item_type="song",d(this,gt,"m",Ak).call(this);break;default:d(this,gt,"m",Ib).call(this)}},"_MusicResponsiveListItem_parseVideoOrSong"),Ak=n(function(){var e,i,o,s,r,l,p,f,h,m,b,x,T,k,C;this.id=d(this,As,"f").video_id||((i=(e=this.endpoint)===null||e===void 0?void 0:e.payload)===null||i===void 0?void 0:i.videoId),this.title=this.flex_columns.first().title.toString();let M=((r=(s=(o=this.flex_columns.at(1))===null||o===void 0?void 0:o.title.runs)===null||s===void 0?void 0:s.find(D=>/^\d+$/.test(D.text.replace(/:/g,""))))===null||r===void 0?void 0:r.text)||((p=(l=this.fixed_columns.first())===null||l===void 0?void 0:l.title)===null||p===void 0?void 0:p.toString());M&&(this.duration={text:M,seconds:je(M)});let A=((h=(f=this.flex_columns.at(1))===null||f===void 0?void 0:f.title.runs)===null||h===void 0?void 0:h.find(D=>nt(D)&&D.endpoint&&D.endpoint.payload.browseId.startsWith("MPR")))||((b=(m=this.flex_columns.at(2))===null||m===void 0?void 0:m.title.runs)===null||b===void 0?void 0:b.find(D=>nt(D)&&D.endpoint&&D.endpoint.payload.browseId.startsWith("MPR")));A&&nt(A)&&(this.album={id:(T=(x=A.endpoint)===null||x===void 0?void 0:x.payload)===null||T===void 0?void 0:T.browseId,name:A.text,endpoint:A.endpoint});let $=(C=(k=this.flex_columns.at(1))===null||k===void 0?void 0:k.title.runs)===null||C===void 0?void 0:C.filter(D=>nt(D)&&D.endpoint&&D.endpoint.payload.browseId.startsWith("UC"));$&&(this.artists=$.map(D=>{var le,ve;return{name:D.text,channel_id:nt(D)?(ve=(le=D.endpoint)===null||le===void 0?void 0:le.payload)===null||ve===void 0?void 0:ve.browseId:void 0,endpoint:nt(D)?D.endpoint:void 0}}))},"_MusicResponsiveListItem_parseSong"),Rk=n(function(){var e,i,o,s,r,l,p,f,h,m;this.id=d(this,As,"f").video_id,this.title=this.flex_columns.first().title.toString(),this.views=(o=(i=(e=this.flex_columns.at(1))===null||e===void 0?void 0:e.title.runs)===null||i===void 0?void 0:i.find(T=>T.text.match(/(.*?) views/)))===null||o===void 0?void 0:o.toString();let b=(r=(s=this.flex_columns.at(1))===null||s===void 0?void 0:s.title.runs)===null||r===void 0?void 0:r.filter(T=>nt(T)&&T.endpoint&&T.endpoint.payload.browseId.startsWith("UC"));b&&(this.authors=b.map(T=>{var k,C;return{name:T.text,channel_id:nt(T)?(C=(k=T.endpoint)===null||k===void 0?void 0:k.payload)===null||C===void 0?void 0:C.browseId:void 0,endpoint:nt(T)?T.endpoint:void 0}}));let x=((p=(l=this.flex_columns[1].title.runs)===null||l===void 0?void 0:l.find(T=>/^\d+$/.test(T.text.replace(/:/g,""))))===null||p===void 0?void 0:p.text)||((m=(h=(f=this.fixed_columns.first())===null||f===void 0?void 0:f.title.runs)===null||h===void 0?void 0:h.find(T=>/^\d+$/.test(T.text.replace(/:/g,""))))===null||m===void 0?void 0:m.text);x&&(this.duration={text:x,seconds:je(x)})},"_MusicResponsiveListItem_parseVideo"),Vk=n(function(){var e,i,o,s,r,l;this.id=(i=(e=this.endpoint)===null||e===void 0?void 0:e.payload)===null||i===void 0?void 0:i.browseId,this.name=this.flex_columns.first().title.toString(),this.subtitle=(o=this.flex_columns.at(1))===null||o===void 0?void 0:o.title,this.subscribers=((l=(r=(s=this.subtitle)===null||s===void 0?void 0:s.runs)===null||r===void 0?void 0:r.find(p=>/^(\d*\.)?\d+[M|K]? subscribers?$/i.test(p.text)))===null||l===void 0?void 0:l.text)||""},"_MusicResponsiveListItem_parseArtist"),Ok=n(function(){var e,i,o,s;this.name=this.flex_columns.first().title.toString(),this.subtitle=(e=this.flex_columns.at(1))===null||e===void 0?void 0:e.title,this.song_count=((s=(o=(i=this.subtitle)===null||i===void 0?void 0:i.runs)===null||o===void 0?void 0:o.find(r=>/^\d+(,\d+)? songs?$/i.test(r.text)))===null||s===void 0?void 0:s.text)||""},"_MusicResponsiveListItem_parseLibraryArtist"),Dk=n(function(){var e,i;this.id=d(this,As,"f").video_id||((i=(e=this.endpoint)===null||e===void 0?void 0:e.payload)===null||i===void 0?void 0:i.videoId),this.title=this.flex_columns.first().title.toString()},"_MusicResponsiveListItem_parseNonMusicTrack"),Lk=n(function(){var e,i;this.id=(i=(e=this.endpoint)===null||e===void 0?void 0:e.payload)===null||i===void 0?void 0:i.browseId,this.title=this.flex_columns.first().title.toString()},"_MusicResponsiveListItem_parsePodcastShow"),Bk=n(function(){var e,i,o,s,r,l,p,f,h;this.id=(i=(e=this.endpoint)===null||e===void 0?void 0:e.payload)===null||i===void 0?void 0:i.browseId,this.title=this.flex_columns.first().title.toString();let m=(s=(o=this.flex_columns.at(1))===null||o===void 0?void 0:o.title.runs)===null||s===void 0?void 0:s.find(b=>nt(b)&&b.endpoint&&b.endpoint.payload.browseId.startsWith("UC"));m&&nt(m)&&(this.author={name:m.text,channel_id:(l=(r=m.endpoint)===null||r===void 0?void 0:r.payload)===null||l===void 0?void 0:l.browseId,endpoint:m.endpoint}),this.year=(h=(f=(p=this.flex_columns.at(1))===null||p===void 0?void 0:p.title.runs)===null||f===void 0?void 0:f.find(b=>/^[12][0-9]{3}$/.test(b.text)))===null||h===void 0?void 0:h.text},"_MusicResponsiveListItem_parseAlbum"),Fk=n(function(){var e,i,o,s,r,l,p,f;this.id=(i=(e=this.endpoint)===null||e===void 0?void 0:e.payload)===null||i===void 0?void 0:i.browseId,this.title=this.flex_columns.first().title.toString();let h=(s=(o=this.flex_columns.at(1))===null||o===void 0?void 0:o.title.runs)===null||s===void 0?void 0:s.find(b=>b.text.match(/\d+ (song|songs)/));this.item_count=h?h.text:void 0;let m=(l=(r=this.flex_columns.at(1))===null||r===void 0?void 0:r.title.runs)===null||l===void 0?void 0:l.find(b=>nt(b)&&b.endpoint&&b.endpoint.payload.browseId.startsWith("UC"));m&&nt(m)&&(this.author={name:m.text,channel_id:(f=(p=m.endpoint)===null||p===void 0?void 0:p.payload)===null||f===void 0?void 0:f.browseId,endpoint:m.endpoint})},"_MusicResponsiveListItem_parsePlaylist");Wp.type="MusicResponsiveListItem";var qi=Wp;var Hp=class extends a{constructor(e){var i,o,s,r,l,p,f,h,m,b,x,T,k,C,M,A,$,D,le,ve,ke,Pe;switch(super(),this.title=new u(e.title),this.endpoint=new g(e.navigationEndpoint),this.id=((o=(i=this.endpoint)===null||i===void 0?void 0:i.payload)===null||o===void 0?void 0:o.browseId)||((r=(s=this.endpoint)===null||s===void 0?void 0:s.payload)===null||r===void 0?void 0:r.videoId),this.subtitle=new u(e.subtitle),this.badges=c.parse(e.subtitleBadges),(h=(f=(p=(l=this.endpoint)===null||l===void 0?void 0:l.payload)===null||p===void 0?void 0:p.browseEndpointContextSupportedConfigs)===null||f===void 0?void 0:f.browseEndpointContextMusicConfig)===null||h===void 0?void 0:h.pageType){case"MUSIC_PAGE_TYPE_ARTIST":this.item_type="artist";break;case"MUSIC_PAGE_TYPE_PLAYLIST":this.item_type="playlist";break;case"MUSIC_PAGE_TYPE_ALBUM":this.item_type="album";break;default:((b=(m=this.endpoint)===null||m===void 0?void 0:m.metadata)===null||b===void 0?void 0:b.api_url)==="/next"?this.item_type="endpoint":!((x=this.subtitle.runs)===null||x===void 0)&&x[0]?this.subtitle.runs[0].text!=="Song"?this.item_type="video":this.item_type="song":this.endpoint?this.item_type="endpoint":this.item_type="unknown";break}if(this.item_type=="artist")this.subscribers=((k=(T=this.subtitle.runs)===null||T===void 0?void 0:T.find(K=>/^(\d*\.)?\d+[M|K]? subscribers?$/i.test(K.text)))===null||k===void 0?void 0:k.text)||"";else if(this.item_type=="playlist"){let K=(C=this.subtitle.runs)===null||C===void 0?void 0:C.find(z=>z.text.match(/\d+ songs|song/));this.item_count=K?K.text:null}else if(this.item_type=="album"){let K=(M=this.subtitle.runs)===null||M===void 0?void 0:M.filter(z=>{var Z,se;return(se=(Z=z.endpoint)===null||Z===void 0?void 0:Z.payload)===null||se===void 0?void 0:se.browseId.startsWith("UC")});K&&(this.artists=K.map(z=>{var Z,se;return{name:z.text,channel_id:(se=(Z=z.endpoint)===null||Z===void 0?void 0:Z.payload)===null||se===void 0?void 0:se.browseId,endpoint:z.endpoint}})),this.year=(A=this.subtitle.runs)===null||A===void 0?void 0:A.slice(-1)[0].text,isNaN(Number(this.year))&&delete this.year}else if(this.item_type=="video"){this.views=((D=($=this===null||this===void 0?void 0:this.subtitle.runs)===null||$===void 0?void 0:$.find(z=>z==null?void 0:z.text.match(/(.*?) views/)))===null||D===void 0?void 0:D.text)||"N/A";let K=(le=this.subtitle.runs)===null||le===void 0?void 0:le.find(z=>{var Z,se,Fe;return(Fe=(se=(Z=z.endpoint)===null||Z===void 0?void 0:Z.payload)===null||se===void 0?void 0:se.browseId)===null||Fe===void 0?void 0:Fe.startsWith("UC")});K&&(this.author={name:K==null?void 0:K.text,channel_id:(ke=(ve=K==null?void 0:K.endpoint)===null||ve===void 0?void 0:ve.payload)===null||ke===void 0?void 0:ke.browseId,endpoint:K==null?void 0:K.endpoint})}else if(this.item_type=="song"){let K=(Pe=this.subtitle.runs)===null||Pe===void 0?void 0:Pe.filter(z=>{var Z,se;return(se=(Z=z.endpoint)===null||Z===void 0?void 0:Z.payload)===null||se===void 0?void 0:se.browseId.startsWith("UC")});K&&(this.artists=K.map(z=>{var Z,se;return{name:z==null?void 0:z.text,channel_id:(se=(Z=z==null?void 0:z.endpoint)===null||Z===void 0?void 0:Z.payload)===null||se===void 0?void 0:se.browseId,endpoint:z==null?void 0:z.endpoint}}))}this.thumbnail=w.fromResponse(e.thumbnailRenderer.musicThumbnailRenderer.thumbnail),this.thumbnail_overlay=c.parseItem(e.thumbnailOverlay,oi),this.menu=c.parseItem(e.menu,j)}};n(Hp,"MusicTwoRowItem");Hp.type="MusicTwoRowItem";var Rs=Hp;var Jp=class extends a{constructor(e){super(),this.header=c.parseItem(e.header,Q0),this.contents=c.parseArray(e.contents,[Rs,qi,Z0,Ns]),Reflect.has(e,"numItemsPerColumn")&&(this.num_items_per_column=parseInt(e.numItemsPerColumn))}};n(Jp,"MusicCarouselShelf");Jp.type="MusicCarouselShelf";var Ue=Jp;var Gp=class extends a{constructor(e){super(),this.description=new u(e.description),Reflect.has(e,"maxCollapsedLines")&&(this.max_collapsed_lines=e.maxCollapsedLines),Reflect.has(e,"maxExpandedLines")&&(this.max_expanded_lines=e.maxExpandedLines),this.footer=new u(e.footer)}};n(Gp,"MusicDescriptionShelf");Gp.type="MusicDescriptionShelf";var Xi=Gp;var zp=class extends a{constructor(e){var i,o,s,r,l,p,f,h,m;super(),this.title=new u(e.title),this.description=new u(e.description),this.subtitle=new u(e.subtitle),this.second_subtitle=new u(e.secondSubtitle),this.year=((o=(i=this.subtitle.runs)===null||i===void 0?void 0:i.find(x=>/^[12][0-9]{3}$/.test(x.text)))===null||o===void 0?void 0:o.text)||"",this.song_count=((r=(s=this.second_subtitle.runs)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.text)||"",this.total_duration=((p=(l=this.second_subtitle.runs)===null||l===void 0?void 0:l[2])===null||p===void 0?void 0:p.text)||"",this.thumbnails=w.fromResponse(e.thumbnail.croppedSquareThumbnailRenderer.thumbnail),this.badges=c.parseArray(e.subtitleBadges);let b=(f=this.subtitle.runs)===null||f===void 0?void 0:f.find(x=>{var T,k;return(k=(T=x==null?void 0:x.endpoint)===null||T===void 0?void 0:T.payload)===null||k===void 0?void 0:k.browseId.startsWith("UC")});b&&(this.author={name:b.text,channel_id:(m=(h=b.endpoint)===null||h===void 0?void 0:h.payload)===null||m===void 0?void 0:m.browseId,endpoint:b.endpoint}),this.menu=c.parseItem(e.menu)}};n(zp,"MusicDetailHeader");zp.type="MusicDetailHeader";var Go=zp;var $p=class extends a{constructor(e){super(),this.playlist_id=e.playlistId,this.supported_download_states=e.supportedDownloadStates}};n($p,"MusicDownloadStateBadge");$p.type="MusicDownloadStateBadge";var Yk=$p;var Kp=class extends a{constructor(e){super(),this.header=c.parseItem(e.header)}};n(Kp,"MusicEditablePlaylistDetailHeader");Kp.type="MusicEditablePlaylistDetailHeader";var ig=Kp;var qp=class extends a{constructor(e){super(),this.element=Reflect.has(e,"elementRenderer")?c.parseItem(e,Ts):null}};n(qp,"MusicElementHeader");qp.type="MusicElementHeader";var Xp=qp;var Qp=class extends a{constructor(e){super(),Reflect.has(e,"header")&&(this.header=c.parseItem(e.header)),Reflect.has(e,"title")&&(this.title=new u(e.title))}};n(Qp,"MusicHeader");Qp.type="MusicHeader";var Qi=Qp;var Zp=class extends a{constructor(e){super(),this.title=new u(e.title),this.description=new u(e.description),this.thumbnail=c.parseItem(e.thumbnail,ot)}};n(Zp,"MusicImmersiveHeader");Zp.type="MusicImmersiveHeader";var og=Zp;var ef=class{constructor(e){this.icon_name=e.iconName,this.endpoint=new g(e.onTap),this.a11y_text=e.a11yText,this.style=e.style}};n(ef,"ActionButton");ef.type="ActionButton";var tf=class{constructor(e){this.image=w.fromResponse(e.image.image),this.content_mode=e.image.contentMode,this.crop_options=e.image.cropOptions,this.image_aspect_ratio=e.imageAspectRatio,this.caption=e.caption,this.action_buttons=e.actionButtons.map(i=>new ef(i))}};n(tf,"Panel");tf.type="Panel";var of=class extends a{constructor(e){super(),this.header=e.shelf.header,this.panels=e.shelf.panels.map(i=>new tf(i))}};n(of,"MusicLargeCardItemCarousel");of.type="MusicLargeCardItemCarousel";var jk=of;var nf=class extends a{constructor(e){var i,o,s;super(),this.playlist_id=e.playlistId,this.contents=c.parseArray(e.contents,qi),this.collapsed_item_count=e.collapsedItemCount,this.continuation=((s=(o=(i=e.continuations)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.nextContinuationData)===null||s===void 0?void 0:s.continuation)||null}};n(nf,"MusicPlaylistShelf");nf.type="MusicPlaylistShelf";var zo=nf;var sf=class extends a{constructor(e){var i,o,s,r,l;super(),this.title=new u(e.title),this.thumbnail=w.fromResponse(e.thumbnail),this.endpoint=new g(e.navigationEndpoint),this.selected=e.selected,this.video_id=e.videoId,this.duration={text:new u(e.lengthText).toString(),seconds:je(new u(e.lengthText).toString())};let p=(i=new u(e.longBylineText).runs)===null||i===void 0?void 0:i.find(h=>{var m,b,x;return(x=(b=(m=h.endpoint)===null||m===void 0?void 0:m.payload)===null||b===void 0?void 0:b.browseId)===null||x===void 0?void 0:x.startsWith("MPR")}),f=(o=new u(e.longBylineText).runs)===null||o===void 0?void 0:o.filter(h=>{var m,b,x;return(x=(b=(m=h.endpoint)===null||m===void 0?void 0:m.payload)===null||b===void 0?void 0:b.browseId)===null||x===void 0?void 0:x.startsWith("UC")});this.author=new u(e.shortBylineText).toString(),p&&(this.album={id:(r=(s=p.endpoint)===null||s===void 0?void 0:s.payload)===null||r===void 0?void 0:r.browseId,name:p.text,year:(l=new u(e.longBylineText).runs)===null||l===void 0?void 0:l.slice(-1)[0].text,endpoint:p.endpoint}),f&&(this.artists=f.map(h=>{var m,b;return{name:h.text,channel_id:(b=(m=h.endpoint)===null||m===void 0?void 0:m.payload)===null||b===void 0?void 0:b.browseId,endpoint:h.endpoint}})),this.badges=c.parseArray(e.badges),this.menu=c.parseItem(e.menu),this.set_video_id=e.playlistSetVideoId}};n(sf,"PlaylistPanelVideo");sf.type="PlaylistPanelVideo";var wi=sf;var rf=class extends a{constructor(e){super(),this.primary=c.parseItem(e.primaryRenderer,wi),Reflect.has(e,"counterpart")&&(this.counterpart=re(e.counterpart.map(i=>c.parseItem(i.counterpartRenderer,wi))||[]))}};n(rf,"PlaylistPanelVideoWrapper");rf.type="PlaylistPanelVideoWrapper";var ng=rf;var af=class extends a{constructor(e){var i,o,s,r,l,p;super(),this.title=e.title,this.title_text=new u(e.titleText),this.contents=c.parseArray(e.contents,[ng,wi,Bi]),this.playlist_id=e.playlistId,this.is_infinite=e.isInfinite,this.continuation=((s=(o=(i=e.continuations)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.nextRadioContinuationData)===null||s===void 0?void 0:s.continuation)||((p=(l=(r=e.continuations)===null||r===void 0?void 0:r[0])===null||l===void 0?void 0:l.nextContinuationData)===null||p===void 0?void 0:p.continuation),this.is_editable=e.isEditable,this.preview_description=e.previewDescription,this.num_items_to_show=e.numItemsToShow}};n(af,"PlaylistPanel");af.type="PlaylistPanel";var ni=af;var uf=class extends a{constructor(e){super(),this.content=c.parseItem(e.content,ni)}};n(uf,"MusicQueue");uf.type="MusicQueue";var Ms=uf;var lf=class extends a{constructor(e){super(),this.thumbnail=c.parseItem(e.thumbnail,ot),this.buttons=c.parseArray(e.buttons,[Re,Ps,j]),this.title=new Text(e.title),this.subtitle=new Text(e.subtitle),this.strapline_text_one=new Text(e.straplineTextOne),this.strapline_thumbnail=c.parseItem(e.straplineThumbnail,ot),this.second_subtitle=new Text(e.secondSubtitle),Reflect.has(e,"subtitleBadge")&&(this.subtitle_badge=c.parseArray(e.subtitleBadge,Es)),Reflect.has(e,"description")&&(this.description=c.parseItem(e.description,Xi))}};n(lf,"MusicResponsiveHeader");lf.type="MusicResponsiveHeader";var Uk=lf;var cf=class extends a{constructor(e){var i,o,s,r;super(),this.title=new u(e.title),this.contents=c.parseArray(e.contents,qi),Reflect.has(e,"bottomEndpoint")&&(this.endpoint=new g(e.bottomEndpoint)),Reflect.has(e,"continuations")&&(this.continuation=((o=(i=e.continuations)===null||i===void 0?void 0:i[0].nextContinuationData)===null||o===void 0?void 0:o.continuation)||((r=(s=e.continuations)===null||s===void 0?void 0:s[0].reloadContinuationData)===null||r===void 0?void 0:r.continuation)),Reflect.has(e,"bottomText")&&(this.bottom_text=new u(e.bottomText)),Reflect.has(e,"bottomButton")&&(this.bottom_button=c.parseItem(e.bottomButton,S)),Reflect.has(e,"subheaders")&&(this.subheaders=c.parseArray(e.subheaders))}};n(cf,"MusicShelf");cf.type="MusicShelf";var Te=cf;var df=class extends a{constructor(e){super(),Reflect.has(e,"startItems")&&(this.start_items=c.parseArray(e.startItems)),Reflect.has(e,"endItems")&&(this.end_items=c.parseArray(e.endItems))}};n(df,"MusicSideAlignedItem");df.type="MusicSideAlignedItem";var sg=df;var pf=class extends a{constructor(e){super(),this.title=new u(e.title).toString(),Reflect.has(e,"icon")&&(this.icon_type=e.icon.iconType),this.menu=c.parseItem(e.menu,G0)}};n(pf,"MusicSortFilterButton");pf.type="MusicSortFilterButton";var ff=pf;var mf=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail)}};n(mf,"MusicTastebuilderShelfThumbnail");mf.type="MusicTastebuilderShelfThumbnail";var rg=mf;var hf=class extends a{constructor(e){super(),this.thumbnail=c.parseItem(e.thumbnail,rg),this.primary_text=new u(e.primaryText),this.secondary_text=new u(e.secondaryText),this.action_button=c.parseItem(e.actionButton,S),this.is_visible=e.isVisible}};n(hf,"MusicTasteBuilderShelf");hf.type="MusicTasteBuilderShelf";var ag=hf;var _f=class extends a{constructor(e){var i,o;super(),this.title=new u(e.title),this.thumbnail=e.thumbnail?w.fromResponse((i=e.thumbnail.musicThumbnailRenderer)===null||i===void 0?void 0:i.thumbnail):[],this.menu=c.parseItem(e.menu,j),this.foreground_thumbnail=e.foregroundThumbnail?w.fromResponse((o=e.foregroundThumbnail.musicThumbnailRenderer)===null||o===void 0?void 0:o.thumbnail):[]}};n(_f,"MusicVisualHeader");_f.type="MusicVisualHeader";var ug=_f;var vf=class extends a{constructor(e){super(),this.thumbnails=w.fromResponse(e.thumbnail),this.video_thumbnails=w.fromResponse(e.videoThumbnail),this.short_message=new u(e.shortMessage),this.sent_time=new u(e.sentTimeText),this.notification_id=e.notificationId,this.endpoint=new g(e.navigationEndpoint),this.record_click_endpoint=new g(e.recordClickEndpoint),this.menu=c.parseItem(e.contextualMenu),this.read=e.read}};n(vf,"Notification");vf.type="Notification";var lg=vf;var gf=class extends a{constructor(e){super(),this.title=c.parseItem(e.title,o0),this.image=c.parseItem(e.image,[us,Kv]),this.metadata=c.parseItem(e.metadata,bs),this.actions=c.parseItem(e.actions,l0),this.description=c.parseItem(e.description,e0),this.attributation=c.parseItem(e.attributation,H_),this.banner=c.parseItem(e.banner,x0)}};n(gf,"PageHeaderView");gf.type="PageHeaderView";var cg=gf;var xf=class extends a{constructor(e){super(),this.page_title=e.pageTitle,this.content=c.parseItem(e.content,cg)}};n(xf,"PageHeader");xf.type="PageHeader";var si=xf;var yf=class extends a{constructor(e){super(),this.header_text=new u(e.headerText).toString(),this.body_text=new u(e.bodyText).toString(),this.page_title=new u(e.pageTitle).toString(),this.header_icon_type=e.headerIcon.iconType}};n(yf,"PageIntroduction");yf.type="PageIntroduction";var dg=yf;var bf=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail),this.endpoint=new g(e.onClickCommand),this.content_description=new u(e.contentDescription),this.target_id=e.targetId,this.sound_attribution_title=new u(e.soundAttributionTitle),this.waveform_animation_style=e.waveformAnimationStyle,this.background_animation_style=e.backgroundAnimationStyle}};n(bf,"PivotButton");bf.type="PivotButton";var pg=bf;var wf=class extends a{constructor(e){super(),Reflect.has(e,"featuredChannel")&&(this.featured_channel={start_time_ms:e.featuredChannel.startTimeMs,end_time_ms:e.featuredChannel.endTimeMs,watermark:w.fromResponse(e.featuredChannel.watermark),channel_name:e.featuredChannel.channelName,endpoint:new g(e.featuredChannel.navigationEndpoint),subscribe_button:c.parseItem(e.featuredChannel.subscribeButton)}),this.allow_swipe_dismiss=e.allowSwipeDismiss,this.annotation_id=e.annotationId}};n(wf,"PlayerAnnotationsExpanded");wf.type="PlayerAnnotationsExpanded";var fg=wf;var Tf=class extends a{constructor(e){super(),Reflect.has(e,"captionTracks")&&(this.caption_tracks=e.captionTracks.map(i=>({base_url:i.baseUrl,name:new u(i.name),vss_id:i.vssId,language_code:i.languageCode,kind:i.kind,is_translatable:i.isTranslatable}))),Reflect.has(e,"audioTracks")&&(this.audio_tracks=e.audioTracks.map(i=>({audio_track_id:i.audioTrackId,captions_initial_state:i.captionsInitialState,default_caption_track_index:i.defaultCaptionTrackIndex,has_default_track:i.hasDefaultTrack,visibility:i.visibility,caption_track_indices:i.captionTrackIndices}))),Reflect.has(e,"defaultAudioTrackIndex")&&(this.default_audio_track_index=e.defaultAudioTrackIndex),Reflect.has(e,"translationLanguages")&&(this.translation_languages=e.translationLanguages.map(i=>({language_code:i.languageCode,language_name:new u(i.languageName)})))}};n(Tf,"PlayerCaptionsTracklist");Tf.type="PlayerCaptionsTracklist";var mg=Tf;var If=class extends a{constructor(e){super(),this.endpoint=new g(e.endpoint),this.enable_listen_first=e.enableListenFirst}};n(If,"PlayerOverflow");If.type="PlayerOverflow";var hg=If;var kf=class extends a{constructor(e){super(),this.overflow=c.parseItem(e.overflow,hg)}};n(kf,"PlayerControlsOverlay");kf.type="PlayerControlsOverlay";var Wk=kf;var Sf=class extends a{constructor(e){super(),this.subreason=new u(e.subreason),this.reason=new u(e.reason),this.proceed_button=c.parseItem(e.proceedButton,S),this.thumbnails=w.fromResponse(e.thumbnail),Reflect.has(e,"icon")&&(this.icon_type=e.icon.iconType)}};n(Sf,"PlayerErrorMessage");Sf.type="PlayerErrorMessage";var Hk=Sf;var Cf=class extends a{constructor(e){super(),this.title=e.itemTitle,this.thumbnail=e.itemThumbnail,this.offer_description=e.offerDescription,this.offer_id=e.offerId}};n(Cf,"PlayerLegacyDesktopYpcOffer");Cf.type="PlayerLegacyDesktopYpcOffer";var Jk=Cf;var Ef=class extends a{constructor(e){super(),this.video_message=e.fullVideoMessage,this.player_response=e.unserializedPlayerResponse}};n(Ef,"YpcTrailer");Ef.type="YpcTrailer";var _g=Ef;var Pf=class extends a{constructor(e){super(),this.video_id=e.trailerVideoId,this.title=e.itemTitle,this.thumbnail=e.itemThumbnail,this.offer_headline=e.offerHeadline,this.offer_description=e.offerDescription,this.offer_id=e.offerId,this.offer_button_text=e.offerButtonText,this.video_message=e.fullVideoMessage,this.trailer=c.parseItem(e.ypcTrailer,_g)}};n(Pf,"PlayerLegacyDesktopYpcTrailer");Pf.type="PlayerLegacyDesktopYpcTrailer";var Nf=Pf;var Af=class extends a{constructor(e){super();let[i,o,s,r,l]=e.spec.split("#");this.board={type:"live",template_url:i,thumbnail_width:parseInt(o,10),thumbnail_height:parseInt(s,10),columns:parseInt(r,10),rows:parseInt(l,10)}}};n(Af,"PlayerLiveStoryboardSpec");Af.type="PlayerLiveStoryboardSpec";var vg=Af;var Rf=class extends a{constructor(e){var i,o;super(),this.title=new u(e.title),this.description=new u(e.description),this.thumbnails=w.fromResponse(e.thumbnail),Reflect.has(e,"embed")&&(this.embed={iframe_url:e.embed.iframeUrl,flash_url:e.embed.flashUrl,flash_secure_url:e.embed.flashSecureUrl,width:e.embed.width,height:e.embed.height}),this.length_seconds=parseInt(e.lengthSeconds),this.channel={id:e.externalChannelId,name:e.ownerChannelName,url:e.ownerProfileUrl},this.is_family_safe=!!e.isFamilySafe,this.is_unlisted=!!e.isUnlisted,this.has_ypc_metadata=!!e.hasYpcMetadata,this.view_count=parseInt(e.viewCount),this.category=e.category,this.publish_date=e.publishDate,this.upload_date=e.uploadDate,this.available_countries=e.availableCountries,this.start_timestamp=!((i=e.liveBroadcastDetails)===null||i===void 0)&&i.startTimestamp?new Date(e.liveBroadcastDetails.startTimestamp):null,this.end_timestamp=!((o=e.liveBroadcastDetails)===null||o===void 0)&&o.endTimestamp?new Date(e.liveBroadcastDetails.endTimestamp):null}};n(Rf,"PlayerMicroformat");Rf.type="PlayerMicroformat";var Ct=Rf;var Mf=class extends a{constructor(e){super(),this.title=new u(e.title),this.video_id=e.videoId,this.video_title=new u(e.videoTitle),this.short_view_count=new u(e.shortViewCountText),this.prefer_immediate_redirect=e.preferImmediateRedirect,this.count_down_secs_for_fullscreen=e.countDownSecsForFullscreen,this.published=new u(e.publishedTimeText),this.background=w.fromResponse(e.background),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),this.author=new V(e.byline),this.cancel_button=c.parseItem(e.cancelButton,S),this.next_button=c.parseItem(e.nextButton,S),this.close_button=c.parseItem(e.closeButton,S)}};n(Mf,"PlayerOverlayAutoplay");Mf.type="PlayerOverlayAutoplay";var gg=Mf;var Vf=class extends a{constructor(e){super(),this.results=c.parseArray(e.results,[a0,r0]),this.title=new u(e.title).toString()}};n(Vf,"WatchNextEndScreen");Vf.type="WatchNextEndScreen";var xg=Vf;var Of=class extends a{constructor(e){super(),this.end_screen=c.parseItem(e.endScreen,xg),this.autoplay=c.parseItem(e.autoplay,gg),this.share_button=c.parseItem(e.shareButton,S),this.add_to_menu=c.parseItem(e.addToMenu,j),this.fullscreen_engagement=c.parseItem(e.fullscreenEngagement),this.actions=c.parseArray(e.actions),this.browser_media_session=c.parseItem(e.browserMediaSession),this.decorated_player_bar=c.parseItem(e.decoratedPlayerBarRenderer,Zv)}};n(Of,"PlayerOverlay");Of.type="PlayerOverlay";var Zi=Of;var Df=class extends a{constructor(e){super(),this.id=e.playlistId,this.title=new u(e.title),this.subtitle=e.subtitle?new u(e.subtitle):null,this.stats=e.stats.map(i=>new u(i)),this.brief_stats=e.briefStats.map(i=>new u(i)),this.author=e.ownerText||e.ownerEndpoint?new V(Object.assign(Object.assign({},e.ownerText),{navigationEndpoint:e.ownerEndpoint}),e.ownerBadges,null):null,this.description=new u(e.descriptionText),this.num_videos=new u(e.numVideosText),this.view_count=new u(e.viewCountText),this.can_share=e.shareData.canShare,this.can_delete=e.editableDetails.canDelete,this.is_editable=e.isEditable,this.privacy=e.privacy,this.save_button=c.parseItem(e.saveButton),this.shuffle_play_button=c.parseItem(e.shufflePlayButton),this.menu=c.parseItem(e.moreActionsMenu),this.banner=c.parseItem(e.playlistHeaderBanner)}};n(Df,"PlaylistHeader");Df.type="PlaylistHeader";var yg=Df;var Lf=class extends a{constructor(e){super(),this.title=new u(e.playlistTitle),this.thumbnails=w.fromResponse(e.thumbnail),this.video_count=new u(e.playlistVideoCount),this.channel_name=new u(e.channelName),this.endpoint=new g(e.action)}};n(Lf,"PlaylistInfoCardContent");Lf.type="PlaylistInfoCardContent";var Gk=Lf;var Bf=class extends a{constructor(e){super(),this.title=e.title,this.description=e.description||null}};n(Bf,"PlaylistMetadata");Bf.type="PlaylistMetadata";var bg=Bf;var Ff=class extends a{constructor(e){super(),this.items=c.parseArray(e.items)}get contents(){return this.items}};n(Ff,"PlaylistSidebar");Ff.type="PlaylistSidebar";var zk=Ff;var Yf=class extends a{constructor(e){super(),this.stats=e.stats.map(i=>new u(i)),this.thumbnail_renderer=c.parseItem(e.thumbnailRenderer),this.title=new u(e.title),this.menu=c.parseItem(e.menu),this.endpoint=new g(e.navigationEndpoint),this.description=new u(e.description)}};n(Yf,"PlaylistSidebarPrimaryInfo");Yf.type="PlaylistSidebarPrimaryInfo";var wg=Yf;var jf=class extends a{constructor(e){super(),this.owner=c.parseItem(e.videoOwner),this.button=c.parseItem(e.button)}};n(jf,"PlaylistSidebarSecondaryInfo");jf.type="PlaylistSidebarSecondaryInfo";var Tg=jf;var Uf=class extends a{constructor(e){super(),this.id=e.videoId,this.index=new u(e.index),this.title=new u(e.title),this.author=new V(e.shortBylineText),this.thumbnails=w.fromResponse(e.thumbnail),this.thumbnail_overlays=c.parseArray(e.thumbnailOverlays),this.set_video_id=e==null?void 0:e.setVideoId,this.endpoint=new g(e.navigationEndpoint),this.is_playable=e.isPlayable,this.menu=c.parseItem(e.menu,j),this.video_info=new u(e.videoInfo),this.accessibility_label=e.title.accessibility.accessibilityData.label,Reflect.has(e,"style")&&(this.style=e.style);let i=e.upcomingEventData&&Number(`${e.upcomingEventData.startTime}000`);i&&(this.upcoming=new Date(i)),this.duration={text:new u(e.lengthText).toString(),seconds:parseInt(e.lengthSeconds)}}get is_live(){var e;return((e=this.thumbnail_overlays.firstOfType(Do))===null||e===void 0?void 0:e.style)==="LIVE"}get is_upcoming(){var e;return((e=this.thumbnail_overlays.firstOfType(Do))===null||e===void 0?void 0:e.style)==="UPCOMING"}};n(Uf,"PlaylistVideo");Uf.type="PlaylistVideo";var Vs=Uf;var Wf=class extends a{constructor(e){super(),this.id=e.playlistId,this.is_editable=e.isEditable,this.can_reorder=e.canReorder,this.videos=c.parseArray(e.contents)}};n(Wf,"PlaylistVideoList");Wf.type="PlaylistVideoList";var $k=Wf;var Hf=class extends a{constructor(e){super(),this.choices=e.choices.map(i=>({text:new u(i.text),select_endpoint:i.selectServiceEndpoint?new g(i.selectServiceEndpoint):null,deselect_endpoint:i.deselectServiceEndpoint?new g(i.deselectServiceEndpoint):null,vote_ratio_if_selected:(i==null?void 0:i.voteRatioIfSelected)||null,vote_percentage_if_selected:new u(i.votePercentageIfSelected),vote_ratio_if_not_selected:(i==null?void 0:i.voteRatioIfSelected)||null,vote_percentage_if_not_selected:new u(i.votePercentageIfSelected),image:i.image?w.fromResponse(i.image):null})),Reflect.has(e,"type")&&(this.poll_type=e.type),Reflect.has(e,"totalVotes")&&(this.total_votes=new u(e.totalVotes)),Reflect.has(e,"liveChatPollId")&&(this.live_chat_poll_id=e.liveChatPollId)}};n(Hf,"Poll");Hf.type="Poll";var Kk=Hf;var Jf=class extends Fi{constructor(e){super(e)}};n(Jf,"Post");Jf.type="Post";var Ig=Jf;var Gf=class extends a{constructor(e){super(),this.images=c.parseArray(e.images,z_)}};n(Gf,"PostMultiImage");Gf.type="PostMultiImage";var qk=Gf;var zf=class extends a{constructor(e){super(),this.title=new u(e.title),this.suppress_padding_disclaimer=!!e.suppressPaddingDisclaimer}};n(zf,"ProductListHeader");zf.type="ProductListHeader";var Xk=zf;var $f=class extends a{constructor(e){super(),this.title=new u(e.title),this.accessibility_title=e.accessibilityTitle,this.thumbnail=w.fromResponse(e.thumbnail),this.price=e.price,this.endpoint=new g(e.onClickCommand),this.merchant_name=e.merchantName,this.stay_in_app=!!e.stayInApp,this.view_button=c.parseItem(e.viewButton,S)}};n($f,"ProductListItem");$f.type="ProductListItem";var Qk=$f;var Kf=class extends a{constructor(e){super(),this.items=c.parseArray(e.items)}get contents(){return this.items}};n(Kf,"ProfileColumn");Kf.type="ProfileColumn";var Zk=Kf;var qf=class extends a{constructor(e){super(),this.items=c.parseArray(e.items)}get contents(){return this.items}};n(qf,"ProfileColumnStats");qf.type="ProfileColumnStats";var eS=qf;var Xf=class extends a{constructor(e){super(),this.label=new u(e.label),this.value=new u(e.value)}};n(Xf,"ProfileColumnStatsEntry");Xf.type="ProfileColumnStatsEntry";var tS=Xf;var Qf=class extends a{constructor(e){super(),this.title=new u(e.title),this.thumbnails=w.fromResponse(e.thumbnail)}};n(Qf,"ProfileColumnUserInfo");Qf.type="ProfileColumnUserInfo";var iS=Qf;var Zf=class extends a{constructor(e){super(),this.choices=e.choices.map(i=>({text:new u(i.text),is_correct:i.isCorrect})),this.total_votes=new u(e.totalVotes)}};n(Zf,"Quiz");Zf.type="Quiz";var oS=Zf;var em=class extends a{constructor(e){super(),this.title=new u(e.title),this.subtitle=new u(e.subtitle),this.avatars=e.avatars.map(i=>new w(i)),this.button=c.parseItem(e.button,S),this.surface=e.surface}};n(em,"RecognitionShelf");em.type="RecognitionShelf";var nS=em;var tm=class extends a{constructor(e){super(),this.id=e.videoId,this.title=new u(e.headline),this.thumbnails=w.fromResponse(e.thumbnail),this.views=new u(e.viewCountText),this.endpoint=new g(e.navigationEndpoint),this.accessibility_label=e.accessibility.accessibilityData.label}};n(tm,"ReelItem");tm.type="ReelItem";var Os=tm;var im=class extends a{constructor(e){super(),this.reel_title_text=new u(e.reelTitleText),this.timestamp_text=new u(e.timestampText),this.channel_title_text=new u(e.channelTitleText),this.channel_thumbnail=w.fromResponse(e.channelThumbnail),this.author=new V(e.channelNavigationEndpoint,void 0)}};n(im,"ReelPlayerHeader");im.type="ReelPlayerHeader";var kg=im;var om=class extends a{constructor(e){super(),this.like_button=c.parseItem(e.likeButton,k0),this.reel_player_header_supported_renderers=c.parseItem(e.reelPlayerHeaderSupportedRenderers,kg),this.menu=c.parseItem(e.menu,j),this.next_item_button=c.parseItem(e.nextItemButton,S),this.prev_item_button=c.parseItem(e.prevItemButton,S),this.subscribe_button_renderer=c.parseItem(e.subscribeButtonRenderer,S),this.style=e.style,this.view_comments_button=c.parseItem(e.viewCommentsButton,S),this.share_button=c.parseItem(e.shareButton,S),this.pivot_button=c.parseItem(e.pivotButton,pg),this.info_panel=c.parseItem(e.infoPanel,b0)}};n(om,"ReelPlayerOverlay");om.type="ReelPlayerOverlay";var sS=om;var nm=class extends a{constructor(e){super(),this.content=c.parseItem(e.content)}};n(nm,"RelatedChipCloud");nm.type="RelatedChipCloud";var Sg=nm;var sm=class extends a{constructor(e){super(),this.header=c.parseItem(e.header),this.contents=c.parseArray(e.contents)}};n(sm,"RichGrid");sm.type="RichGrid";var eo=sm;var rm=class extends a{constructor(e){super(),this.content=c.parseItem(e.content)}};n(rm,"RichItem");rm.type="RichItem";var rS=rm;var am=class extends a{constructor(e){super(),this.title=new u(e.title),this.subtitle=new u(e.subtitle),Reflect.has(e,"titleStyle")&&(this.title_style=e.titleStyle.style),Reflect.has(e,"icon")&&(this.icon_type=e.icon.iconType)}};n(am,"RichListHeader");am.type="RichListHeader";var aS=am;var um=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail),this.title=new u(e.title),this.subtitle=new u(e.subtitle),this.call_to_action=new u(e.callToAction),Reflect.has(e,"callToActionIcon")&&(this.icon_type=e.callToActionIcon.iconType),this.endpoint=new g(e.endpoint)}};n(um,"RichMetadata");um.type="RichMetadata";var lm=um;var cm=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents)}};n(cm,"RichMetadataRow");cm.type="RichMetadataRow";var dm=cm;var pm=class extends a{constructor(e){super(),this.content=c.parseItem(e.content)}};n(pm,"RichSection");pm.type="RichSection";var uS=pm;var fm=class extends a{constructor(e){super(),this.title=new u(e.title),this.contents=c.parseArray(e.contents),Reflect.has(e,"endpoint")&&(this.endpoint=new g(e.endpoint))}};n(fm,"RichShelf");fm.type="RichShelf";var Cg=fm;var mm=class extends a{constructor(e){super(),this.endpoint=new g(e.endpoint),this.search_button=c.parseItem(e.searchButton,S),this.clear_button=c.parseItem(e.clearButton,S),this.placeholder_text=new u(e.placeholderText)}};n(mm,"SearchBox");mm.type="SearchBox";var lS=mm;var hm=class extends a{constructor(e){super(),this.label=new u(e.label),this.endpoint=new g(e.endpoint||e.navigationEndpoint),this.tooltip=e.tooltip,Reflect.has(e,"status")&&(this.status=e.status)}get disabled(){return this.status==="FILTER_STATUS_DISABLED"}get selected(){return this.status==="FILTER_STATUS_SELECTED"}};n(hm,"SearchFilter");hm.type="SearchFilter";var Eg=hm;var _m=class extends a{constructor(e){super(),this.title=new u(e.title),this.filters=c.parseArray(e.filters,Eg)}};n(_m,"SearchFilterGroup");_m.type="SearchFilterGroup";var Ds=_m;var vm=class extends a{constructor(e){super(),this.title=new u(e.title),this.groups=c.parseArray(e.groups,Ds)}};n(vm,"SearchFilterOptionsDialog");vm.type="SearchFilterOptionsDialog";var cS=vm;var gm=class extends a{constructor(e){super(),this.chip_bar=c.parseItem(e.chipBar,vt),this.search_filter_button=c.parseItem(e.searchFilterButton,S)}};n(gm,"SearchHeader");gm.type="SearchHeader";var Pg=gm;var xm=class extends a{constructor(e){super(),Reflect.has(e,"title")&&(this.title=new u(e.title)),Reflect.has(e,"groups")&&(this.groups=c.parseArray(e.groups,Ds)),Reflect.has(e,"button")&&(this.button=c.parseItem(e.button,Re))}};n(xm,"SearchSubMenu");xm.type="SearchSubMenu";var Ng=xm;var ym=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents)}};n(ym,"SearchSuggestionsSection");ym.type="SearchSuggestionsSection";var Ag=ym;var bm=class extends a{constructor(e){super(),this.contents=c.parseArray(e.contents)}};n(bm,"SecondarySearchContainer");bm.type="SecondarySearchContainer";var dS=bm;var wm=class extends a{constructor(e){super(),this.like_button=c.parseItem(e.likeButton,[Re,S]),this.dislike_button=c.parseItem(e.dislikeButton,[Re,S])}};n(wm,"SegmentedLikeDislikeButton");wm.type="SegmentedLikeDislikeButton";var $o=wm;var Tm=class extends a{constructor(e){if(super(),this.like_button=c.parseItem(e.likeButtonViewModel,S0),this.dislike_button=c.parseItem(e.dislikeButtonViewModel,i0),this.icon_type=e.iconType,this.like_button&&this.like_button.toggle_button){let i=this.like_button.toggle_button;i.default_button?(this.short_like_count=i.default_button.title,this.like_count=parseInt(i.default_button.accessibility_text.replace(/\D/g,""))):i.toggled_button&&(this.short_like_count=i.toggled_button.title,this.like_count=parseInt(i.toggled_button.accessibility_text.replace(/\D/g,"")))}this.like_count_entity={key:e.likeCountEntity.key},this.dynamic_like_count_update_data={update_status_key:e.dynamicLikeCountUpdateData.updateStatusKey,placeholder_like_count_values_key:e.dynamicLikeCountUpdateData.placeholderLikeCountValuesKey,update_delay_loop_id:e.dynamicLikeCountUpdateData.updateDelayLoopId,update_delay_sec:e.dynamicLikeCountUpdateData.updateDelaySec}}};n(Tm,"SegmentedLikeDislikeButtonView");Tm.type="SegmentedLikeDislikeButtonView";var Ko=Tm;var Im=class extends a{constructor(e){super(),Reflect.has(e,"title")&&(this.title=new u(e.title)),Reflect.has(e,"summary")&&(this.summary=new u(e.summary)),Reflect.has(e,"enableServiceEndpoint")&&(this.enable_endpoint=new g(e.enableServiceEndpoint)),Reflect.has(e,"disableServiceEndpoint")&&(this.disable_endpoint=new g(e.disableServiceEndpoint)),this.item_id=e.itemId}};n(Im,"SettingBoolean");Im.type="SettingBoolean";var pS=Im;var km=class extends a{constructor(e){super(),this.title=new u(e.title),this.help_text=new u(e.helpText),this.enabled=e.enabled,this.disabled=e.disabled,this.id=e.id}};n(km,"SettingsCheckbox");km.type="SettingsCheckbox";var Rg=km;var Sm=class extends a{constructor(e){super(),this.title=new u(e.title),this.subtitle=new u(e.subtitle),this.enabled=e.enabled,this.enable_endpoint=new g(e.enableServiceEndpoint),this.disable_endpoint=new g(e.disableServiceEndpoint)}};n(Sm,"SettingsSwitch");Sm.type="SettingsSwitch";var Ls=Sm;var Cm=class extends a{constructor(e){super(),this.title=new u(e.title),Reflect.has(e,"text")&&(this.text=new u(e.text).toString()),Reflect.has(e,"options")&&(this.options=c.parseArray(e.options,[Ls,ts,$v,Rg,Sv]))}};n(Cm,"SettingsOptions");Cm.type="SettingsOptions";var Bs=Cm;var Em=class extends a{constructor(e){super(),this.title=new u(e.title),this.items=c.parseArray(e.items,gs)}get contents(){return this.items}};n(Em,"SettingsSidebar");Em.type="SettingsSidebar";var Mg=Em;var Pm=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail),this.content=new u(e.content),this.published=new u(e.publishedTimeText),this.menu=ue(e.actionMenu,j),this.original_post=ue(e.originalPost,Fi),this.id=e.postId,this.endpoint=new g(e.navigationEndpoint),this.expand_button=ue(e.expandButton,S),this.author=new V(e.displayName,void 0)}};n(Pm,"SharedPost");Pm.type="SharedPost";var Vg=Pm;var Nm=class extends a{constructor(e){super(),this.title=new u(e.title),Reflect.has(e,"endpoint")&&(this.endpoint=new g(e.endpoint)),this.content=c.parseItem(e.content),Reflect.has(e,"icon")&&(this.icon_type=e.icon.iconType),Reflect.has(e,"menu")&&(this.menu=c.parseItem(e.menu)),Reflect.has(e,"playAllButton")&&(this.play_all_button=c.parseItem(e.playAllButton,S))}};n(Nm,"Shelf");Nm.type="Shelf";var Fs=Nm;var Am=class extends a{constructor(e){super(),this.corrected_query=new u(e.correctedQuery),this.original_query=new u(e.originalQuery),this.corrected_query_endpoint=new g(e.correctedQueryEndpoint),this.original_query_endpoint=new g(e.originalQueryEndpoint),this.search_instead_for=new u(e.searchInsteadFor),this.showing_results_for=new u(e.showingResultsFor)}};n(Am,"ShowingResultsFor");Am.type="ShowingResultsFor";var Og=Am;var Rm=class extends a{constructor(e){super(),this.image=w.fromResponse(e.image),this.title=new u(e.title),this.display_domain=new u(e.displayDomain),this.show_link_icon=e.showLinkIcon,this.call_to_action=new u(e.callToAction),this.endpoint=new g(e.command)}};n(Rm,"SimpleCardContent");Rm.type="SimpleCardContent";var fS=Rm;var Mm=class extends a{constructor(e){super(),this.message=new u(e.message),this.prominent=e.prominent}};n(Mm,"SimpleCardTeaser");Mm.type="SimpleCardTeaser";var mS=Mm;var Vm=class extends a{constructor(e){super(),this.lines=e.lines.map(i=>new u(i)),this.style=e.layoutStyle}};n(Vm,"SimpleTextSection");Vm.type="SimpleTextSection";var hS=Vm;var Om=class extends a{constructor(e){super(),this.action_text=new u(e.actionText),this.nav_text=new u(e.navigationText),this.details=new u(e.detailsText),this.icon_type=e.icon.iconType,this.endpoint=new g(e.navigationEndpoint)}};n(Om,"SingleActionEmergencySupport");Om.type="SingleActionEmergencySupport";var _S=Om;var Dm=class extends a{constructor(e){super(),this.title=e.title||"N/A",this.selected=!!e.selected,this.endpoint=new g(e.endpoint),this.content=c.parseItem(e.content,[Q,Ms,eo])}};n(Dm,"Tab");Dm.type="Tab";var be=Dm;var Lm=class extends a{constructor(e){super(),this.tabs=c.parseArray(e.tabs,be)}};n(Lm,"SingleColumnBrowseResults");Lm.type="SingleColumnBrowseResults";var ri=Lm;var Bm=class extends a{constructor(e){super(),this.contents=c.parse(e)}};n(Bm,"SingleColumnMusicWatchNextResults");Bm.type="SingleColumnMusicWatchNextResults";var vS=Bm;var Fm=class extends a{constructor(e){super(),this.thumbnails=w.fromResponse(e.thumbnail),this.style=e.style}};n(Fm,"SingleHeroImage");Fm.type="SingleHeroImage";var gS=Fm;var Ym=class extends a{constructor(e){super(),this.thumbnail=w.fromResponse(e.thumbnail),this.title=new u(e.title),this.endpoint=new g(e.navigationEndpoint),this.subscribe_button=c.parseItem(e.subscribeButton,$e)}};n(Ym,"SlimOwner");Ym.type="SlimOwner";var xS=Ym;var jm=class extends a{constructor(e){super(),this.title=new u(e.title),this.collapsed_subtitle=new u(e.collapsedSubtitle),this.expanded_subtitle=new u(e.expandedSubtitle),this.owner=c.parseItem(e.owner),this.description=new u(e.description),this.video_id=e.videoId,this.date=new u(e.dateText)}};n(jm,"SlimVideoMetadata");jm.type="SlimVideoMetadata";var Dg=jm;var Um=class extends a{constructor(e){super(),this.name=new u(e.name),this.is_selected=e.isSelected,this.endpoint=new g(e.navigationEndpoint)}};n(Um,"SubFeedOption");Um.type="SubFeedOption";var Lg=Um;var Wm=class extends a{constructor(e){super(),this.title=new u(e.title),this.options=c.parseArray(e.options,Lg)}};n(Wm,"SubFeedSelector");Wm.type="SubFeedSelector";var yS=Wm;var Hm=class extends a{constructor(e){super(),this.contents=c.parse(e)}};n(Hm,"Tabbed");Hm.type="Tabbed";var bS=Hm;var Jm=class extends a{constructor(e){super(),this.tabs=c.parseArray(e.tabs,be)}};n(Jm,"TabbedSearchResults");Jm.type="TabbedSearchResults";var Bg=Jm;var Gm=class extends a{constructor(e){super(),this.title=new u(e.title),this.style=e.style}};n(Gm,"TextHeader");Gm.type="TextHeader";var wS=Gm;var zm=class extends a{constructor(e){super(),this.landscape=w.fromResponse(e.landscape),this.portrait=w.fromResponse(e.portrait)}};n(zm,"ThumbnailLandscapePortrait");zm.type="ThumbnailLandscapePortrait";var TS=zm;var $m=class extends a{constructor(e){super(),this.text=new u(e.text).toString()}};n($m,"ThumbnailOverlayEndorsement");$m.type="ThumbnailOverlayEndorsement";var IS=$m;var Km=class extends a{constructor(e){super(),this.text=new u(e.text),this.icon_type=e.icon.iconType}};n(Km,"ThumbnailOverlayHoverText");Km.type="ThumbnailOverlayHoverText";var kS=Km;var qm=class extends a{constructor(e){super(),this.text=new u(e.text).toString(),this.icon_type=e.icon.iconType}};n(qm,"ThumbnailOverlayInlineUnplayable");qm.type="ThumbnailOverlayInlineUnplayable";var SS=qm;var Xm=class extends a{constructor(e){super(),this.text=new u(e.text)}};n(Xm,"ThumbnailOverlayLoadingPreview");Xm.type="ThumbnailOverlayLoadingPreview";var CS=Xm;var Qm=class extends a{constructor(e){super(),this.text=new u(e.text).toString()}};n(Qm,"ThumbnailOverlayNowPlaying");Qm.type="ThumbnailOverlayNowPlaying";var ES=Qm;var Zm=class extends a{constructor(e){super(),this.hack=e.hack}};n(Zm,"ThumbnailOverlayPinking");Zm.type="ThumbnailOverlayPinking";var PS=Zm;var eh=class extends a{constructor(e){super(),this.texts=e.texts.map(i=>new u(i))}};n(eh,"ThumbnailOverlayPlaybackStatus");eh.type="ThumbnailOverlayPlaybackStatus";var NS=eh;var th=class extends a{constructor(e){super(),this.percent_duration_watched=e.percentDurationWatched}};n(th,"ThumbnailOverlayResumePlayback");th.type="ThumbnailOverlayResumePlayback";var AS=th;var ih=class extends a{constructor(e){super(),this.text=new u(e.text),this.icon_type=e.icon.iconType}};n(ih,"ThumbnailOverlaySidePanel");ih.type="ThumbnailOverlaySidePanel";var RS=ih;var oh=class extends a{constructor(e){super(),Reflect.has(e,"isToggled")&&(this.is_toggled=e.isToggled),this.icon_type={toggled:e.toggledIcon.iconType,untoggled:e.untoggledIcon.iconType},this.tooltip={toggled:e.toggledTooltip,untoggled:e.untoggledTooltip},this.toggled_endpoint=new g(e.toggledServiceEndpoint),this.untoggled_endpoint=new g(e.untoggledServiceEndpoint)}};n(oh,"ThumbnailOverlayToggleButton");oh.type="ThumbnailOverlayToggleButton";var MS=oh;var nh=class extends a{constructor(e){super(),this.visible_time_range_start_millis=e.visibleTimeRangeStartMillis,this.visible_time_range_end_millis=e.visibleTimeRangeEndMillis,this.decoration_time_millis=e.decorationTimeMillis,this.label=new u(e.label),this.icon=e.icon}};n(nh,"TimedMarkerDecoration");nh.type="TimedMarkerDecoration";var VS=nh;var sh=class extends a{constructor(e){super(),this.title=new u(e.title)}};n(sh,"TitleAndButtonListHeader");sh.type="TitleAndButtonListHeader";var OS=sh;var rh=class extends a{constructor(e){super(),this.text=new u(e.defaultText),this.toggled_text=new u(e.toggledText),this.icon_type=e.defaultIcon.iconType,this.toggled_icon_type=e.toggledIcon.iconType,this.default_endpoint=new g(e.defaultServiceEndpoint),this.toggled_endpoint=new g(e.toggledServiceEndpoint)}};n(rh,"ToggleMenuServiceItem");rh.type="ToggleMenuServiceItem";var DS=rh;var ah=class extends a{constructor(e){super(),this.promo_config={promo_id:e.promoConfig.promoId,impression_endpoints:e.promoConfig.impressionEndpoints.map(i=>new g(i)),accept:new g(e.promoConfig.acceptCommand),dismiss:new g(e.promoConfig.dismissCommand)},this.target_id=e.targetId,this.details=new u(e.detailsText),this.suggested_position=e.suggestedPosition.type,this.dismiss_stratedy=e.dismissStrategy.type,this.dwell_time_ms=parseInt(e.dwellTimeMs)}};n(ah,"Tooltip");ah.type="Tooltip";var LS=ah;var uh=class extends a{constructor(e){var i;super(),this.title=new u(e.title),this.avatar=w.fromResponse((i=e.thumbnail)!==null&&i!==void 0?i:e.avatar),this.subtitle=new u(e.subtitle),this.subscribe_button=c.parseItem(e.subscribeButton,$e),this.endpoint=new g(e.navigationEndpoint)}};n(uh,"TopicChannelDetails");uh.type="TopicChannelDetails";var BS=uh;var lh=class extends a{constructor(e){super(),this.tabs=c.parse(e.tabs),this.secondary_contents=c.parse(e.secondaryContents)}};n(lh,"TwoColumnBrowseResults");lh.type="TwoColumnBrowseResults";var ai=lh;var ch=class extends a{constructor(e){super(),this.primary_contents=c.parse(e.primaryContents),this.secondary_contents=c.parse(e.secondaryContents)}};n(ch,"TwoColumnSearchResults");ch.type="TwoColumnSearchResults";var Fg=ch;var Yg,kb,dh=class extends a{constructor(e){var i,o,s,r,l;super(),Yg.add(this),this.results=c.parseArray((i=e.results)===null||i===void 0?void 0:i.results.contents),this.secondary_results=c.parseArray((o=e.secondaryResults)===null||o===void 0?void 0:o.secondaryResults.results),this.conversation_bar=c.parseItem(e==null?void 0:e.conversationBar);let p=(s=e.playlist)===null||s===void 0?void 0:s.playlist;p&&(this.playlist={id:p.playlistId,title:p.title,author:!((r=p.shortBylineText)===null||r===void 0)&&r.simpleText?new u(p.shortBylineText):new V(p.longBylineText),contents:c.parseArray(p.contents),current_index:p.currentIndex,is_infinite:!!p.isInfinite,menu:c.parseItem(p.menu,j)});let f=(l=e.autoplay)===null||l===void 0?void 0:l.autoplay;f&&(this.autoplay={sets:f.sets.map(h=>d(this,Yg,"m",kb).call(this,h))},f.modifiedSets&&(this.autoplay.modified_sets=f.modifiedSets.map(h=>d(this,Yg,"m",kb).call(this,h))),f.countDownSecs&&(this.autoplay.count_down_secs=f.countDownSecs))}};n(dh,"TwoColumnWatchNextResults");Yg=new WeakSet,kb=n(function(e){let i={autoplay_video:new g(e.autoplayVideo)};return e.nextButtonVideo&&(i.next_button_video=new g(e.nextButtonVideo)),i},"_TwoColumnWatchNextResults_parseAutoplaySet");dh.type="TwoColumnWatchNextResults";var Ys=dh;var ph=class extends a{constructor(e){super(),this.header=c.parseItem(e.header),this.call_to_action=c.parseItem(e.callToAction),this.sections=c.parseArray(e.sections),Reflect.has(e,"collapsedLabel")&&(this.collapsed_label=new u(e.collapsedLabel))}};n(ph,"UniversalWatchCard");ph.type="UniversalWatchCard";var jg=ph;var fh=class extends a{constructor(e){super(),this.message_title=new u(e.dialogMessageTitle),this.message_text=new u(e.dialogMessageText),this.action_button=c.parseItem(e.actionButton,S),this.dismiss_button=c.parseItem(e.dismissButton,S),this.is_visible=e.isVisible}};n(fh,"UpsellDialog");fh.type="UpsellDialog";var FS=fh;var mh=class extends a{constructor(e){super(),this.items=c.parseArray(e.items),this.collapsed_item_count=e.collapsedItemCount,this.collapsed_state_button_text=new u(e.collapsedStateButtonText)}get contents(){return this.items}};n(mh,"VerticalList");mh.type="VerticalList";var YS=mh;var hh=class extends a{constructor(e){super(),this.items=c.parseArray(e.items),this.view_all_text=new u(e.viewAllText),this.view_all_endpoint=new g(e.viewAllEndpoint)}get contents(){return this.items}};n(hh,"VerticalWatchCardList");hh.type="VerticalWatchCardList";var jS=hh;var _h=class extends a{constructor(e){super(),this.title=new u(e.videoTitle),this.channel_name=new u(e.channelName),this.view_count=new u(e.viewCountText),this.video_thumbnails=w.fromResponse(e.videoThumbnail),this.duration=new u(e.lengthString),this.endpoint=new g(e.action)}};n(_h,"VideoInfoCardContent");_h.type="VideoInfoCardContent";var US=_h;var vh=class extends a{constructor(e){super(),this.subscription_button=e.subscriptionButton,this.subscriber_count=new u(e.subscriberCountText),this.author=new V(Object.assign(Object.assign({},e.title),{navigationEndpoint:e.navigationEndpoint}),e.badges,e.thumbnail)}};n(vh,"VideoOwner");vh.type="VideoOwner";var js=vh;var gh=class extends a{constructor(e){var i,o,s,r;super(),this.title=new u(e.title),Reflect.has(e,"superTitleLink")&&(this.super_title_link=new u(e.superTitleLink)),this.view_count=new u((o=(i=e.viewCount)===null||i===void 0?void 0:i.videoViewCountRenderer)===null||o===void 0?void 0:o.viewCount),this.short_view_count=new u((r=(s=e.viewCount)===null||s===void 0?void 0:s.videoViewCountRenderer)===null||r===void 0?void 0:r.shortViewCount),this.badges=c.parseArray(e.badges,ct),this.published=new u(e.dateText),this.relative_date=new u(e.relativeDateText),this.menu=c.parseItem(e.videoActions,j)}};n(gh,"VideoPrimaryInfo");gh.type="VideoPrimaryInfo";var Ug=gh;var xh=class extends a{constructor(e){super(),this.owner=c.parseItem(e.owner,js),this.description=new u(e.description),Reflect.has(e,"attributedDescription")&&(this.description=u.fromAttributed(e.attributedDescription)),this.subscribe_button=c.parseItem(e.subscribeButton,[$e,S]),this.metadata=c.parseItem(e.metadataRowContainer,K0),this.show_more_text=e.showMoreText,this.show_less_text=e.showLessText,this.default_expanded=e.defaultExpanded,this.description_collapsed_lines=e.descriptionCollapsedLines}};n(xh,"VideoSecondaryInfo");xh.type="VideoSecondaryInfo";var yh=xh;var bh=class extends a{constructor(e){super(),this.title=new u(e.title),this.subtitle=new u(e.subtitle),this.duration={text:new u(e.lengthText).toString(),seconds:je(e.lengthText.simpleText)},this.style=e.style}};n(bh,"WatchCardCompactVideo");bh.type="WatchCardCompactVideo";var Wg=bh;var wh=class extends a{constructor(e){var i;super(),this.endpoint=new g(e.navigationEndpoint),this.call_to_action_button=c.parseItem(e.callToActionButton),this.hero_image=c.parseItem(e.heroImage),this.label=((i=e.lengthText)===null||i===void 0?void 0:i.accessibility.accessibilityData.label)||""}};n(wh,"WatchCardHeroVideo");wh.type="WatchCardHeroVideo";var WS=wh;var Th=class extends a{constructor(e){super(),this.title=new u(e.title),this.title_endpoint=new g(e.titleNavigationEndpoint),this.subtitle=new u(e.subtitle),this.author=new V(e,e.titleBadge?[e.titleBadge]:null,e.avatar),this.author.name=this.title.toString(),this.style=e.style}};n(Th,"WatchCardRichHeader");Th.type="WatchCardRichHeader";var HS=Th;var Ih=class extends a{constructor(e){super(),this.lists=c.parseArray(e.lists)}};n(Ih,"WatchCardSectionSequence");Ih.type="WatchCardSectionSequence";var JS=Ih;var kh=class extends ai{constructor(e){super(e)}};n(kh,"WatchNextTabbedResults");kh.type="WatchNextTabbedResults";var Hg=kh;var Sh=class extends a{constructor(e){var i,o;super(),this.title=e.title,this.content=c.parseItem(e.content,Q),this.endpoint=new g(e.navigationEndpoint),this.category_assets={asset_key:(i=e.categoryAssets)===null||i===void 0?void 0:i.assetKey,background_color:(o=e.categoryAssets)===null||o===void 0?void 0:o.backgroundColor},this.category_type=e.categoryType}};n(Sh,"AnchoredSection");Sh.type="AnchoredSection";var Jg=Sh;var Ch,Eh=class extends a{constructor(e){super(),Ch.set(this,void 0),this.child_display_name=new u(e.childDisplayName),this.child_account_description=new u(e.childAccountDescription),this.avatar=w.fromResponse(e.avatar),this.block_button=c.parseItem(e.blockButton,[Re]),this.blocked_entity_key=e.blockedEntityKey}blockChannel(){return y(this,void 0,void 0,function*(){if(!d(this,Ch,"f"))throw new v("An active caller must be provide to perform this operation.");let e=this.block_button;if(!e)throw new v("Block button was not found.",{child_display_name:this.child_display_name});if(e.is_toggled)throw new v("This channel is already blocked.",{child_display_name:this.child_display_name});return yield e.endpoint.call(d(this,Ch,"f"),{parse:!1})})}setActions(e){I(this,Ch,e,"f")}};n(Eh,"KidsBlocklistPickerItem");Ch=new WeakMap;Eh.type="KidsBlocklistPickerItem";var Us=Eh;var Ph=class extends a{constructor(e){super(),this.title=new u(e.title),this.child_rows=c.parse(e.childRows,!0,[Us]),this.done_button=c.parseItem(e.doneButton,[S]),this.successful_toast_action_message=new u(e.successfulToastActionMessage)}};n(Ph,"KidsBlocklistPicker");Ph.type="KidsBlocklistPicker";var GS=Ph;var Nh=class extends a{constructor(e){var i,o;super(),this.title=new u(e.title),this.category_assets={asset_key:(i=e.categoryAssets)===null||i===void 0?void 0:i.assetKey,background_color:(o=e.categoryAssets)===null||o===void 0?void 0:o.backgroundColor},this.category_type=e.categoryType,this.endpoint=new g(e.endpoint)}};n(Nh,"KidsCategoryTab");Nh.type="KidsCategoryTab";var Ws=Nh;var Ah=class extends a{constructor(e){super(),this.category_tabs=c.parseArray(e.categoryTabs,Ws),this.privacy_button=c.parseItem(e.privacyButtonRenderer,S)}};n(Ah,"KidsCategoriesHeader");Ah.type="kidsCategoriesHeader";var Gg=Ah;var Rh=class extends a{constructor(e){super(),this.anchors=c.parseArray(e.anchors,Jg)}};n(Rh,"KidsHomeScreen");Rh.type="kidsHomeScreen";var zg=Rh;var Rb={};B(Rb,{camelToSnake:()=>qo,createRuntimeClass:()=>i1,generateRuntimeClass:()=>Oh,generateTypescriptClass:()=>Kg,inferType:()=>$g,introspect:()=>Eb,isArrayType:()=>e1,isIgnoredKey:()=>t1,isMiscType:()=>ZS,isRenderer:()=>Cb,isRendererList:()=>QS,mergeKeyInfo:()=>Mh,parse:()=>Ab,toParser:()=>Nb,toTypeDeclaration:()=>Pb});var wE=new Set(["trackingParams","accessibility","accessibilityData"]),Sb={};function qo(t){return t.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}n(qo,"camelToSnake");function $g(t,e){let i=!1;if(typeof e=="object"&&e!=null){if(i=Cb(e))return Sb[i]=Reflect.get(e,Reflect.ownKeys(e)[0]),{type:"renderer",renderers:[i],optional:!1};if(i=QS(e)){for(let[s,r]of Object.entries(i))Sb[s]=r;return{type:"array",array_type:"renderer",renderers:Object.keys(i),optional:!1}}if((i=ZS(t,e))||(i=e1(e)))return i}let o=typeof e;return o==="object"?{type:"object",keys:Object.entries(e).map(([s,r])=>[s,$g(s,r)]),optional:!1}:{type:"primative",typeof:[o],optional:!1}}n($g,"inferType");function QS(t){let e=Array.isArray(t);return e&&t.length===0?!1:e&&t.every(o=>Cb(o))?Object.fromEntries(t.map(o=>{let s=Reflect.ownKeys(o)[0].toString();return[Dh(s),o[s]]})):!1}n(QS,"isRendererList");function ZS(t,e){if(typeof e=="object"&&e!==null){if(t.endsWith("Endpoint")||t.endsWith("Command")||t==="endpoint")return{type:"misc",endpoint:new g(e),optional:!1,misc_type:"NavigationEndpoint"};if(Reflect.has(e,"simpleText")||Reflect.has(e,"runs")){let i=new u(e);return{type:"misc",misc_type:"Text",optional:!1,endpoint:i.endpoint,text:i.toString()}}if(Reflect.has(e,"thumbnails")&&Array.isArray(Reflect.get(e,"thumbnails")))return{type:"misc",misc_type:"Thumbnail",optional:!1}}return!1}n(ZS,"isMiscType");function Cb(t){if(!(typeof t=="object"))return!1;let i=Reflect.ownKeys(t);if(i.length===1){let o=i[0].toString();if(o.endsWith("Renderer")||o.endsWith("Model"))return Dh(o)}return!1}n(Cb,"isRenderer");function e1(t){if(!Array.isArray(t))return!1;if(t.length===0)return{type:"array",array_type:"primitive",items:{type:"primative",typeof:["never"],optional:!1},optional:!1};let e=t.map(r=>typeof r);if(!e.every(r=>r===e[0]))return{type:"array",array_type:"primitive",items:{type:"primative",typeof:["unknown"],optional:!1},optional:!1};let o=e[0];if(o!=="object")return{type:"array",array_type:"primitive",items:{type:"primative",typeof:[o],optional:!1},optional:!1};let s=[];for(let r=0;r<t.length;r++){let l=Object.entries(t[r]).map(([p,f])=>[p,$g(p,f)]);if(r===0){s=l;continue}s=Mh(s,l).resolved_key_info}return{type:"array",array_type:"object",items:{type:"object",keys:s,optional:!1},optional:!1}}n(e1,"isArrayType");function TE(t){if(typeof t!="object"||t===null)throw new v("Generator: Cannot introspect non-object",{classdata:t});return Reflect.ownKeys(t).filter(i=>!t1(i)).filter(i=>typeof i=="string").map(i=>{let o=Reflect.get(t,i),s=$g(i,o);return[i,s]})}n(TE,"introspectKeysFirstPass");function IE(t){var e;let o=t.filter(([,p])=>{var f;return p.type!=="misc"||!(p.misc_type==="NavigationEndpoint"||p.misc_type==="Text")?!1:((f=p.endpoint)===null||f===void 0?void 0:f.metadata.page_type)==="WEB_PAGE_TYPE_CHANNEL"}).sort(([,p],[,f])=>p.type!=="misc"||f.type!=="misc"||p.misc_type!=="Text"||f.misc_type!=="Text"?0:f.text.length-p.text.length),s=new Set,r=o[0],l;if(r){s.add(r[0]);let f=t.map(([T])=>T).filter(T=>T.endsWith("Badges")||T==="badges"),m=(e=f.filter(T=>T.startsWith("owner")||T.startsWith("author"))[0])!==null&&e!==void 0?e:f[0],b=t.find(([T])=>T===m),x=b?b[1].type==="array"&&b[1].array_type==="renderer"&&Reflect.has(b[1].renderers,"MetadataBadge"):!1;x&&m&&s.add(m),l={type:"misc",misc_type:"Author",optional:!1,params:[r[0],x?m:void 0]}}return l&&t.push(["author",l]),t.filter(([p])=>!s.has(p))}n(IE,"introspectKeysSecondPass");function kE(t){let e=TE(t);return IE(e)}n(kE,"introspect2");function Eb(t){let e=kE(t),i=new Map;for(let[,s]of e)if(s.type==="renderer"||s.type==="array"&&s.array_type==="renderer")for(let r of s.renderers){let l=Sb[r];l&&i.set(r,l)}let o=Array.from(i).filter(([s])=>!qg(s));return{key_info:e,unimplemented_dependencies:o}}n(Eb,"introspect");function t1(t){return typeof t=="string"&&wE.has(t)}n(t1,"isIgnoredKey");function i1(t,e,i){var o,s;i({error_type:"class_not_found",classname:t,key_info:e});let r=(o=n(class extends a{static set key_info(l){I(this,o,new Map(l),"f",s)}static get key_info(){return[...d(this,o,"f",s).entries()]}constructor(l){super();let{key_info:p,unimplemented_dependencies:f}=Eb(l),{resolved_key_info:h,changed_keys:m}=Mh(r.key_info,p);m.length>0&&(r.key_info=h,i({error_type:"class_changed",classname:t,key_info:r.key_info,changed_keys:m}));for(let[x,T]of f)Oh(x,T,i);for(let[x,T]of p){let k=qo(x);T.type==="misc"&&T.misc_type==="NavigationEndpoint"&&(k="endpoint"),Reflect.set(this,k,Ab(x,T,l))}}},"_a"),Rw(o,"node"),o.type=t,s={value:new Map},o);return r.key_info=e,Object.defineProperty(r,"name",{value:t,writable:!1}),r}n(i1,"createRuntimeClass");function Oh(t,e,i){let{key_info:o,unimplemented_dependencies:s}=Eb(e),r=i1(t,o,i);Mb(t,r);for(let[l,p]of s)Oh(l,p,i);return r}n(Oh,"generateRuntimeClass");function Kg(t,e){let i=[],o=["super();"];for(let[s,r]of e){let l=qo(s);r.type==="misc"&&r.misc_type==="NavigationEndpoint"&&(l="endpoint"),i.push(`${l}${r.optional?"?":""}: ${Pb(r)};`),o.push(`this.${l} = ${Nb(s,r)};`)}return`class ${t} extends YTNode {
|
|
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.assign({},T),{renderers:Object.keys(T.renderers)}))&&i.set(x,A)}break;case"object":{if(k.array_type==="primitive"&&k.items.typeof.length==1&&k.items.typeof[0]==="never")continue;if(k.array_type!=="object"){i.set(x,{type:"array",array_type:"primitive",items:{type:"primative",typeof:["unknown"],optional:!0},optional:!0});continue}let{resolved_key_info:C}=Mh(T.items.keys,k.items.keys),M={type:"array",array_type:"object",items:{type:"object",keys:C,optional:T.items.optional||k.items.optional},optional:T.optional||k.optional};JSON.stringify(M)!==JSON.stringify(T)&&i.set(x,M)}break;case"primitive":{if(T.items.typeof.includes("never")&&k.array_type==="object"){i.set(x,k);continue}if(k.array_type!=="primitive"){i.set(x,{type:"array",array_type:"primitive",items:{type:"primative",typeof:["unknown"],optional:!0},optional:!0});continue}let C=new Set([...k.items.typeof,...T.items.typeof]);C.size>1&&C.has("never")&&C.delete("never");let M={type:"array",array_type:"primitive",items:{type:"primative",typeof:Array.from(C),optional:T.items.optional||k.items.optional},optional:T.optional||k.optional};JSON.stringify(M)!==JSON.stringify(T)&&i.set(x,M)}break;default:throw new Error("Unreachable code reached! Switch missing case!")}}break;case"misc":{if(k.type!=="misc")continue;switch(T.misc_type!==k.misc_type&&i.set(x,{type:"primative",typeof:["unknown"],optional:!0}),T.misc_type){case"Author":{if(k.misc_type!=="Author")break;let C=T.params[1]||k.params[1],M=T.optional||k.optional,A={type:"misc",misc_type:"Author",optional:M,params:[k.params[0],C]};JSON.stringify(A)!==JSON.stringify(T)&&i.set(x,A)}break}}break;case"primative":{if(k.type!=="primative")continue;let C={type:"primative",typeof:Array.from(new Set([...k.typeof,...T.typeof])),optional:T.optional||k.optional};JSON.stringify(C)!==JSON.stringify(T)&&i.set(x,C)}break}}}for(let[x,T]of r)i.set(x,Object.assign(Object.assign({},T),{optional:!0}));for(let[x,T]of l)i.set(x,Object.assign(Object.assign({},T),{optional:!0}));let h=t.filter(([x])=>!i.has(x));return{resolved_key_info:[...new Map([...h,...i]).entries()],changed_keys:[...i.entries()]}}n(Mh,"mergeKeyInfo");var to=class extends a{constructor(e){var i,o,s;super(),this.contents=Ke(e.contents),Array.isArray(e.continuations)&&(this.continuation=(s=(o=(i=e.continuations)===null||i===void 0?void 0:i.at(0))===null||o===void 0?void 0:o.nextContinuationData)===null||s===void 0?void 0:s.continuation)}};n(to,"ItemSectionContinuation");to.type="itemSectionContinuation";var io=class extends a{constructor(e){super(),this.endpoint=new g(e.endpoint)}};n(io,"NavigateAction");io.type="navigateAction";var Hs=class extends a{constructor(e){super(),this.miniplayer_command=new g(e.miniplayerCommand),this.show_premium_branding=e.showPremiumBranding}};n(Hs,"ShowMiniplayerCommand");Hs.type="showMiniplayerCommand";var oo=class extends a{constructor(e){super(),this.target_id=e.targetId,this.contents=qe(e.continuationItems,!0),this.slot=e==null?void 0:e.slot}};n(oo,"ReloadContinuationItemsCommand");oo.type="reloadContinuationItemsCommand";var pt=class extends a{constructor(e){var i,o,s,r,l,p;super(),this.contents=qe(e.contents,!0),this.continuation=((s=(o=(i=e.continuations)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.nextContinuationData)===null||s===void 0?void 0:s.continuation)||((p=(l=(r=e.continuations)===null||r===void 0?void 0:r[0])===null||l===void 0?void 0:l.reloadContinuationData)===null||p===void 0?void 0:p.continuation)||null}};n(pt,"SectionListContinuation");pt.type="sectionListContinuation";var no=class extends a{constructor(e){var i;super(),this.contents=qe(e.contents,!0),this.continuation=((i=e.continuations)===null||i===void 0?void 0:i[0].nextContinuationData.continuation)||null}};n(no,"MusicPlaylistShelfContinuation");no.type="musicPlaylistShelfContinuation";var li=class extends a{constructor(e){var i,o,s,r;super(),this.contents=Ke(e.contents),this.continuation=((o=(i=e.continuations)===null||i===void 0?void 0:i[0].nextContinuationData)===null||o===void 0?void 0:o.continuation)||((r=(s=e.continuations)===null||s===void 0?void 0:s[0].reloadContinuationData)===null||r===void 0?void 0:r.continuation)||null}};n(li,"MusicShelfContinuation");li.type="musicShelfContinuation";var so=class extends a{constructor(e){var i;super(),this.items=qe(e.items,!0),this.continuation=((i=e.continuations)===null||i===void 0?void 0:i[0].nextContinuationData.continuation)||null}get contents(){return this.items}};n(so,"GridContinuation");so.type="gridContinuation";var Js=class extends a{constructor(e){var i,o,s,r,l,p;super(),this.contents=Ke(e.contents),this.continuation=((s=(o=(i=e.continuations)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.nextContinuationData)===null||s===void 0?void 0:s.continuation)||((p=(l=(r=e.continuations)===null||r===void 0?void 0:r[0])===null||l===void 0?void 0:l.nextRadioContinuationData)===null||p===void 0?void 0:p.continuation)||null}};n(Js,"PlaylistPanelContinuation");Js.type="playlistPanelContinuation";var Xo=class extends a{constructor(e){var i,o,s;super(),this.continuation_type=e.type,this.timeout_ms=(i=e.continuation)===null||i===void 0?void 0:i.timeoutMs,this.time_until_last_message_ms=(o=e.continuation)===null||o===void 0?void 0:o.timeUntilLastMessageMsec,this.token=(s=e.continuation)===null||s===void 0?void 0:s.continuation}};n(Xo,"Continuation");Xo.type="continuation";var ro=class extends a{constructor(e){var i,o,s,r,l,p,f,h;super(),this.actions=qe((i=e.actions)===null||i===void 0?void 0:i.map(x=>(delete x.clickTrackingParams,x)),!0)||re([]),this.action_panel=ue(e.actionPanel),this.item_list=ue(e.itemList,F0),this.header=ue(e.header,B0),this.participants_list=ue(e.participantsList,j0),this.popout_message=ue(e.popoutMessage,Ge),this.emojis=((o=e.emojis)===null||o===void 0?void 0:o.map(x=>({emoji_id:x.emojiId,shortcuts:x.shortcuts,search_terms:x.searchTerms,image:w.fromResponse(x.image),is_custom_emoji:x.isCustomEmoji})))||[];let m,b;!((s=e.continuations)===null||s===void 0)&&s[0].timedContinuationData?(b="timed",m=(r=e.continuations)===null||r===void 0?void 0:r[0].timedContinuationData):!((l=e.continuations)===null||l===void 0)&&l[0].invalidationContinuationData?(b="invalidation",m=(p=e.continuations)===null||p===void 0?void 0:p[0].invalidationContinuationData):!((f=e.continuations)===null||f===void 0)&&f[0].liveChatReplayContinuationData&&(b="replay",m=(h=e.continuations)===null||h===void 0?void 0:h[0].liveChatReplayContinuationData),this.continuation=new Xo({continuation:m,type:b}),this.viewer_name=e.viewerName}};n(ro,"LiveChatContinuation");ro.type="liveChatContinuation";var Ti=class extends a{constructor(e){super(),this.request=e.request,this.token=e.token}};n(Ti,"ContinuationCommand");Ti.type="ContinuationCommand";var Xg,Qg=class{constructor(e,i){var o,s,r,l,p,f,h,m;if(Xg.set(this,void 0),i&&I(this,Xg,i,"f"),this.itag=e.itag,this.mime_type=e.mimeType,this.is_type_otf=e.type==="FORMAT_STREAM_TYPE_OTF",this.bitrate=e.bitrate,this.average_bitrate=e.averageBitrate,this.width=e.width,this.height=e.height,this.projection_type=e.projectionType,this.stereo_layout=(o=e.stereoLayout)===null||o===void 0?void 0:o.replace("STEREO_LAYOUT_",""),this.init_range=e.initRange?{start:parseInt(e.initRange.start),end:parseInt(e.initRange.end)}:void 0,this.index_range=e.indexRange?{start:parseInt(e.indexRange.start),end:parseInt(e.indexRange.end)}:void 0,this.last_modified=new Date(Math.floor(parseInt(e.lastModified)/1e3)),this.content_length=parseInt(e.contentLength),this.quality=e.quality,this.quality_label=e.qualityLabel,this.fps=e.fps,this.url=e.url,this.cipher=e.cipher,this.signature_cipher=e.signatureCipher,this.audio_quality=e.audioQuality,this.approx_duration_ms=parseInt(e.approxDurationMs),this.audio_sample_rate=parseInt(e.audioSampleRate),this.audio_channels=e.audioChannels,this.loudness_db=e.loudnessDb,this.spatial_audio_type=(s=e.spatialAudioType)===null||s===void 0?void 0:s.replace("SPATIAL_AUDIO_TYPE_",""),this.max_dvr_duration_sec=e.maxDvrDurationSec,this.target_duration_dec=e.targetDurationSec,this.has_audio=!!e.audioBitrate||!!e.audioQuality,this.has_video=!!e.qualityLabel,this.has_text=!!e.captionTrack,this.color_info=e.colorInfo?{primaries:(r=e.colorInfo.primaries)===null||r===void 0?void 0:r.replace("COLOR_PRIMARIES_",""),transfer_characteristics:(l=e.colorInfo.transferCharacteristics)===null||l===void 0?void 0:l.replace("COLOR_TRANSFER_CHARACTERISTICS_",""),matrix_coefficients:(p=e.colorInfo.matrixCoefficients)===null||p===void 0?void 0:p.replace("COLOR_MATRIX_COEFFICIENTS_","")}:void 0,Reflect.has(e,"audioTrack")&&(this.audio_track={audio_is_default:e.audioTrack.audioIsDefault,display_name:e.audioTrack.displayName,id:e.audioTrack.id}),Reflect.has(e,"captionTrack")&&(this.caption_track={display_name:e.captionTrack.displayName,vss_id:e.captionTrack.vssId,language_code:e.captionTrack.languageCode,kind:e.captionTrack.kind,id:e.captionTrack.id}),this.has_audio||this.has_text){let b=new URLSearchParams(this.cipher||this.signature_cipher),T=(f=new URLSearchParams(b.get("url")||this.url).get("xtags"))===null||f===void 0?void 0:f.split(":");if(this.language=((h=T==null?void 0:T.find(k=>k.startsWith("lang=")))===null||h===void 0?void 0:h.split("=")[1])||null,this.has_audio){let k=(m=T==null?void 0:T.find(C=>C.startsWith("acont=")))===null||m===void 0?void 0:m.split("=")[1];this.is_dubbed=k==="dubbed",this.is_descriptive=k==="descriptive",this.is_original=k==="original"||!this.is_dubbed&&!this.is_descriptive}this.has_text&&!this.language&&this.caption_track&&(this.language=this.caption_track.language_code)}}decipher(e){if(!e)throw new v("Cannot decipher format, this session appears to have no valid player.");return e.decipher(this.url,this.signature_cipher,this.cipher,d(this,Xg,"f"))}};n(Qg,"Format");Xg=new WeakMap;var Zg=Qg;var ao=class{constructor(e){this.id=e.videoId,this.channel_id=e.channelId,this.title=e.title,this.duration=parseInt(e.lengthSeconds),this.keywords=e.keywords,this.is_owner_viewing=!!e.isOwnerViewing,this.short_description=e.shortDescription,this.thumbnail=w.fromResponse(e.thumbnail),this.allow_ratings=!!e.allowRatings,this.view_count=parseInt(e.viewCount),this.author=e.author,this.is_private=!!e.isPrivate,this.is_live=!!e.isLive,this.is_live_content=!!e.isLiveContent,this.is_live_dvr_enabled=!!e.isLiveDvrEnabled,this.is_low_latency_live_stream=!!e.isLowLatencyLiveStream,this.is_upcoming=!!e.isUpcoming,this.is_post_live_dvr=!!e.isPostLiveDvr,this.is_crawlable=!!e.isCrawlable,this.live_chunk_readahead=e.liveChunkReadahead}};n(ao,"VideoDetails");var Qo="Parser",SE=new Set(["AdSlot","DisplayAd","SearchPyv","MealbarPromo","PrimetimePromo","BackgroundPromo","PromotedSparklesWeb","RunAttestationCommand","CompactPromotedVideo","BrandVideoShelf","BrandVideoSingleton","StatementBanner","GuideSigninPromo","AdsEngagementPanelContent"]),Db=new Map(Object.entries(Ho)),o1=new Map,Zo=null,uo=n(t=>{var{classname:e}=t,i=Aw(t,["classname"]);switch(i.error_type){case"parse":i.error instanceof Error&&U.warn(Qo,new v(`Something went wrong at ${e}!
|
|
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={audio_config:{loudness_db:(r=t.playerConfig.audioConfig)===null||r===void 0?void 0:r.loudnessDb,perceptual_loudness_db:(l=t.playerConfig.audioConfig)===null||l===void 0?void 0:l.perceptualLoudnessDb,enable_per_format_loudness:(p=t.playerConfig.audioConfig)===null||p===void 0?void 0:p.enablePerFormatLoudness},stream_selection_config:{max_bitrate:((f=t.playerConfig.streamSelectionConfig)===null||f===void 0?void 0:f.maxBitrate)||"0"},media_common_config:{dynamic_readahead_config:{max_read_ahead_media_time_ms:((m=(h=t.playerConfig.mediaCommonConfig)===null||h===void 0?void 0:h.dynamicReadaheadConfig)===null||m===void 0?void 0:m.maxReadAheadMediaTimeMs)||0,min_read_ahead_media_time_ms:((x=(b=t.playerConfig.mediaCommonConfig)===null||b===void 0?void 0:b.dynamicReadaheadConfig)===null||x===void 0?void 0:x.minReadAheadMediaTimeMs)||0,read_ahead_growth_rate_ms:((k=(T=t.playerConfig.mediaCommonConfig)===null||T===void 0?void 0:T.dynamicReadaheadConfig)===null||k===void 0?void 0:k.readAheadGrowthRateMs)||0}}};C.player_config=tt}let Xn=t.currentVideoEndpoint?new g(t.currentVideoEndpoint):null;Xn&&(C.current_video_endpoint=Xn);let Qn=t.endpoint?new g(t.endpoint):null;Qn&&(C.endpoint=Qn);let de=ue(t.captions,mg);de&&(C.captions=de);let It=t.videoDetails?new ao(t.videoDetails):null;It&&(C.video_details=It);let Je=Ke(t.annotations,fg);Je.length&&(C.annotations=Je);let vi=ue(t.storyboards,[Po,vg]);vi&&(C.storyboards=vi);let Io=ue(t.endscreen,s0);Io&&(C.endscreen=Io);let Ne=ue(t.cards,wv);Ne&&(C.cards=Ne);let et=Ke(t.engagementPanels,Ui);return et.length&&(C.engagement_panels=et),C}n(NE,"parseResponse");function ue(t,e){if(!t)return null;let i=Object.keys(t);if(!i.length)return null;let o=Dh(i[0]);if(!n1(o))try{let r=qg(o)?Vh(o):Oh(o,t[i[0]],uo);if(e){if(Array.isArray(e)){if(!e.some(p=>p.type===r.type))return uo({classdata:t[i[0]],classname:o,error_type:"typecheck",expected:e.map(p=>p.type)}),null}else if(r.type!==e.type)return uo({classdata:t[i[0]],classname:o,error_type:"typecheck",expected:e.type}),null}let l=new r(t[i[0]]);return EE(o,l),l}catch(s){return uo({classname:o,classdata:t[i[0]],error:s,error_type:"parse"}),null}return null}n(ue,"parseItem");function Ke(t,e){if(Array.isArray(t)){let i=[];for(let o of t){let s=ue(o,e);s&&i.push(s)}return re(i)}else if(!t)return re([]);throw new kt("Expected array but got a single item")}n(Ke,"parseArray");function qe(t,e,i){if(!t)return null;if(Array.isArray(t)){let o=[];for(let r of t){let l=ue(r,i);l&&o.push(l)}let s=re(o);return e?s:new ei(s)}else if(e)throw new kt("Expected array but got a single item");return new ei(ue(t,i))}n(qe,"parse");function s1(t){return t.timedContinuationData?new Xo({continuation:t.timedContinuationData,type:"timed"}):null}n(s1,"parseC");function Vb(t){return t.itemSectionContinuation?new to(t.itemSectionContinuation):t.sectionListContinuation?new pt(t.sectionListContinuation):t.liveChatContinuation?new ro(t.liveChatContinuation):t.musicPlaylistShelfContinuation?new no(t.musicPlaylistShelfContinuation):t.musicShelfContinuation?new li(t.musicShelfContinuation):t.gridContinuation?new so(t.gridContinuation):t.playlistPanelContinuation?new Js(t.playlistPanelContinuation):t.continuationCommand?new Ti(t.continuationCommand):null}n(Vb,"parseLC");function ex(t){return re(t.map(e=>{if(e.navigateAction)return new io(e.navigateAction);if(e.showMiniplayerCommand)return new Hs(e.showMiniplayerCommand);if(e.reloadContinuationItemsCommand)return new oo(e.reloadContinuationItemsCommand);if(e.appendContinuationItemsAction)return new Mo(e.appendContinuationItemsAction)}).filter(e=>e))}n(ex,"parseRR");function r1(t){return Array.isArray(t)?qe(t.map(e=>(delete e.clickTrackingParams,e))):new ei(ue(t))}n(r1,"parseActions");function Ob(t,e){return(t==null?void 0:t.map(i=>new Zg(i,e)))||[]}n(Ob,"parseFormats");function a1(t,e){let i=t.getType(Yt);if(i.length>0&&!e)uo({error_type:"mutation_data_missing",classname:"MusicMultiSelectMenuItem"});else{let o=[];for(let s of i){let r=e.find(p=>{var f,h;return((h=(f=p.payload)===null||f===void 0?void 0:f.musicFormBooleanChoice)===null||h===void 0?void 0:h.id)===s.form_item_entity_key}),l=r==null?void 0:r.payload.musicFormBooleanChoice;(l==null?void 0:l.selected)!==void 0&&(l==null?void 0:l.opaqueToken)?s.selected=l.selected:o.push(`'${s.title}'`)}o.length>0&&uo({error_type:"mutation_data_invalid",classname:"MusicMultiSelectMenuItem",total:i.length,failed:o.length,titles:o})}}n(a1,"applyMutations");function u1(t,e){var i,o,s,r,l,p;let f=t.getType($i);if(f.length>0){e||uo({error_type:"mutation_data_missing",classname:"CommentView"});for(let h of f){let m=(o=(i=e.find(T=>{var k,C;return((C=(k=T.payload)===null||k===void 0?void 0:k.commentEntityPayload)===null||C===void 0?void 0:C.key)===h.keys.comment}))===null||i===void 0?void 0:i.payload)===null||o===void 0?void 0:o.commentEntityPayload,b=(r=(s=e.find(T=>{var k,C;return((C=(k=T.payload)===null||k===void 0?void 0:k.engagementToolbarStateEntityPayload)===null||C===void 0?void 0:C.key)===h.keys.toolbar_state}))===null||s===void 0?void 0:s.payload)===null||r===void 0?void 0:r.engagementToolbarStateEntityPayload,x=(p=(l=e.find(T=>T.entityKey===h.keys.toolbar_surface))===null||l===void 0?void 0:l.payload)===null||p===void 0?void 0:p.engagementToolbarSurfaceEntityPayload;h.applyMutations(m,b,x)}}}n(u1,"applyCommentsMutations");var Ub={};B(Ub,{AccountInfo:()=>ix,Analytics:()=>nx,Channel:()=>Ve,ChannelListContinuation:()=>rn,Comments:()=>ux,FilteredChannelList:()=>mo,Guide:()=>cx,HashtagFeed:()=>di,History:()=>Zs,HomeFeed:()=>Jt,ItemMenu:()=>mx,Library:()=>vx,LiveChat:()=>Ix,NotificationsMenu:()=>kx,Playlist:()=>Ii,Search:()=>Sx,Settings:()=>Cx,SmoothedQueue:()=>yx,TimeWatched:()=>Px,TranscriptInfo:()=>ax,VideoInfo:()=>Kh});var Gs,tx=class{constructor(e){if(Gs.set(this,void 0),I(this,Gs,c.parseResponse(e.data),"f"),!d(this,Gs,"f").contents)throw new v("Page contents not found");let i=d(this,Gs,"f").contents.array().as(V_).first();if(!i)throw new v("Account section list not found");this.contents=i.contents,this.footers=i.footers}get page(){return d(this,Gs,"f")}};n(tx,"AccountInfo");Gs=new WeakMap;var ix=tx;var Lh,ox=class{constructor(e){var i;Lh.set(this,void 0),I(this,Lh,c.parseResponse(e.data),"f"),this.sections=(i=d(this,Lh,"f").contents_memo)===null||i===void 0?void 0:i.getType(Ts).map(o=>o.model).flatMap(o=>o||[])}get page(){return d(this,Lh,"f")}};n(ox,"Analytics");Lh=new WeakMap;var nx=ox;var Bh,Xe,en,Fh,ft,l1,Lb,lo=class{constructor(e,i,o=!1){Bh.add(this),Xe.set(this,void 0),en.set(this,void 0),Fh.set(this,void 0),ft.set(this,void 0),d(this,Bh,"m",l1).call(this,i)||o?I(this,Xe,i,"f"):I(this,Xe,c.parseResponse(i.data),"f");let s=Bb(d(this,Xe,"f").contents_memo,d(this,Xe,"f").continuation_contents_memo,d(this,Xe,"f").on_response_received_commands_memo,d(this,Xe,"f").on_response_received_endpoints_memo,d(this,Xe,"f").on_response_received_actions_memo,d(this,Xe,"f").sidebar_memo,d(this,Xe,"f").header_memo);if(!s)throw new v("No memo found in feed");I(this,ft,s,"f"),I(this,Fh,e,"f")}static getVideosFromMemo(e){return e.getType(as,m0,Os,cs,Vs,wi,Wg)}static getPlaylistsFromMemo(e){let i=e.getType(ti,d0),o=e.getType(W0).filter(s=>["PLAYLIST","ALBUM","PODCAST"].includes(s.content_type));return o.length>0&&i.push(...o),i}get videos(){return lo.getVideosFromMemo(d(this,ft,"f"))}get posts(){return d(this,ft,"f").getType(Fi,Ig,Vg)}get channels(){return d(this,ft,"f").getType(Iv,c0)}get playlists(){return lo.getPlaylistsFromMemo(d(this,ft,"f"))}get memo(){return d(this,ft,"f")}get page_contents(){var e;let i=(e=d(this,ft,"f").getType(be))===null||e===void 0?void 0:e.first().content,o=d(this,ft,"f").getType(oo).first(),s=d(this,ft,"f").getType(Mo).first();return i||o||s}get shelves(){return d(this,ft,"f").getType(Fs,Cg,ps)}getShelf(e){return this.shelves.get({title:e})}get secondary_contents(){var e,i;if(!(!((e=d(this,Xe,"f").contents)===null||e===void 0)&&e.is_node))return;let o=(i=d(this,Xe,"f").contents)===null||i===void 0?void 0:i.item();if(!!o.is(ai,Fg))return o.secondary_contents}get actions(){return d(this,Fh,"f")}get page(){return d(this,Xe,"f")}get has_continuation(){return d(this,Bh,"m",Lb).call(this).length>0}getContinuationData(){return y(this,void 0,void 0,function*(){if(d(this,en,"f")){if(d(this,en,"f").length===0)throw new v("There are no continuations.");return yield d(this,en,"f")[0].endpoint.call(d(this,Fh,"f"),{parse:!0})}if(I(this,en,d(this,Bh,"m",Lb).call(this),"f"),d(this,en,"f"))return this.getContinuationData()})}getContinuation(){return y(this,void 0,void 0,function*(){let e=yield this.getContinuationData();if(!e)throw new v("Could not get continuation data");return new lo(this.actions,e,!0)})}};n(lo,"Feed");Xe=new WeakMap,en=new WeakMap,Fh=new WeakMap,ft=new WeakMap,Bh=new WeakSet,l1=n(function(e){return!("data"in e)},"_Feed_isParsed"),Lb=n(function(){if(d(this,Xe,"f").header_memo){let e=d(this,Xe,"f").header_memo.getType(he);return d(this,ft,"f").getType(he).filter(i=>!e.includes(i))}return d(this,ft,"f").getType(he)},"_Feed_getBodyContinuations");var _e=lo;var zs,sx=class extends _e{constructor(e,i,o=!1){super(e,i,o),zs.set(this,void 0)}get filter_chips(){var e,i;if(d(this,zs,"f"))return d(this,zs,"f")||[];if(((e=this.memo.getType(bi))===null||e===void 0?void 0:e.length)>1)throw new v("There are too many feed filter chipbars, you'll need to find the correct one yourself in this.page");if(((i=this.memo.getType(bi))===null||i===void 0?void 0:i.length)===0)throw new v("There are no feed filter chipbars");return I(this,zs,this.memo.getType(xe),"f"),d(this,zs,"f")||[]}get filters(){return this.filter_chips.map(e=>e.text.toString())||[]}getFilteredFeed(e){var i;return y(this,void 0,void 0,function*(){let o;if(typeof e=="string"){if(!this.filters.includes(e))throw new v("Filter not found",{available_filters:this.filters});o=this.filter_chips.find(r=>r.text.toString()===e)}else if(e.type==="ChipCloudChip")o=e;else throw new v("Invalid filter");if(!o)throw new v("Filter not found");if(o.is_selected)return this;let s=yield(i=o.endpoint)===null||i===void 0?void 0:i.call(this.actions,{parse:!0});if(!s)throw new v("Failed to get filtered feed");return new _e(this.actions,s,!0)})}};n(sx,"FilterableFeed");zs=new WeakMap;var co=sx;var Fb={};B(Fb,{Feed:()=>_e,FilterableFeed:()=>co,MediaInfo:()=>fo,TabbedFeed:()=>tn});var po,Ht,$s,Yh,rx=class{constructor(e,i,o){var s,r;po.set(this,void 0),Ht.set(this,void 0),$s.set(this,void 0),Yh.set(this,void 0),I(this,Ht,i,"f");let l=c.parseResponse(e[0].data),p=!((s=e==null?void 0:e[1])===null||s===void 0)&&s.data?c.parseResponse(e[1].data):void 0;if(I(this,po,[l,p],"f"),I(this,$s,o,"f"),((r=l.playability_status)===null||r===void 0?void 0:r.status)==="ERROR")throw new v("This video is unavailable",l.playability_status);this.streaming_data=l.streaming_data,this.playability_status=l.playability_status,this.player_config=l.player_config,I(this,Yh,l.playback_tracking,"f")}toDash(e,i,o={include_thumbnails:!1}){var s;return y(this,void 0,void 0,function*(){let r=d(this,po,"f")[0];if(r.video_details&&r.video_details.is_live)throw new v("Generating DASH manifests for live videos is not supported. Please use the DASH and HLS manifests provided by YouTube in `streaming_data.dash_manifest_url` and `streaming_data.hls_manifest_url` instead.");let l;return o.include_thumbnails&&r.storyboards&&(l=r.storyboards),No.toDash(this.streaming_data,(s=this.page[0].video_details)===null||s===void 0?void 0:s.is_post_live_dvr,e,i,d(this,$s,"f"),d(this,Ht,"f").session.player,d(this,Ht,"f"),l)})}getStreamingInfo(e,i){var o;return b_(this.streaming_data,(o=this.page[0].video_details)===null||o===void 0?void 0:o.is_post_live_dvr,e,i,this.cpn,d(this,Ht,"f").session.player,d(this,Ht,"f"),d(this,po,"f")[0].storyboards?d(this,po,"f")[0].storyboards:void 0)}chooseFormat(e){return No.chooseFormat(e,this.streaming_data)}download(e={}){return y(this,void 0,void 0,function*(){let i=d(this,po,"f")[0];if(i.video_details&&(i.video_details.is_live||i.video_details.is_post_live_dvr))throw new v("Downloading is not supported for live and Post-Live-DVR videos, as they are split up into 5 second segments that are individual files, which require using a tool such as ffmpeg to stitch them together, so they cannot be returned in a single stream.");return No.download(e,d(this,Ht,"f"),this.playability_status,this.streaming_data,d(this,Ht,"f").session.player,this.cpn)})}getTranscript(){var e;return y(this,void 0,void 0,function*(){let i=this.page[1];if(!i)throw new v("Cannot get transcript from basic video info.");if(!i.engagement_panels)throw new v("Engagement panels not found. Video likely has no transcript.");let o=i.engagement_panels.get({panel_identifier:"engagement-panel-searchable-transcript"});if(!o)throw new v("Transcript panel not found. Video likely has no transcript.");let s=(e=o.content)===null||e===void 0?void 0:e.as(he);if(!s)throw new v("Transcript continuation not found.");let r=yield s.endpoint.call(this.actions);return new ax(this.actions,r)})}addToWatchHistory(e=X.CLIENTS.WEB.NAME,i=X.CLIENTS.WEB.VERSION,o="https://www."){return y(this,void 0,void 0,function*(){if(!d(this,Yh,"f"))throw new v("Playback tracking not available");let s={cpn:d(this,$s,"f"),fmt:251,rtn:0,rt:0},r=d(this,Yh,"f").videostats_playback_url.replace("https://s.",o);return yield d(this,Ht,"f").stats(r,{client_name:e,client_version:i},s)})}get actions(){return d(this,Ht,"f")}get cpn(){return d(this,$s,"f")}get page(){return d(this,po,"f")}};n(rx,"MediaInfo");po=new WeakMap,Ht=new WeakMap,$s=new WeakMap,Yh=new WeakMap;var fo=rx;var on,nn,sn=class extends _e{constructor(e,i,o=!1){var s;super(e,i,o),on.set(this,void 0),nn.set(this,void 0),I(this,nn,e,"f"),I(this,on,(s=this.page.contents_memo)===null||s===void 0?void 0:s.getType(be),"f")}get tabs(){var e,i;return(i=(e=d(this,on,"f"))===null||e===void 0?void 0:e.map(o=>o.title.toString()))!==null&&i!==void 0?i:[]}getTabByName(e){var i;return y(this,void 0,void 0,function*(){let o=(i=d(this,on,"f"))===null||i===void 0?void 0:i.find(r=>r.title.toLowerCase()===e.toLowerCase());if(!o)throw new v(`Tab "${e}" not found`);if(o.selected)return this;let s=yield o.endpoint.call(d(this,nn,"f"));return new sn(d(this,nn,"f"),s,!1)})}getTabByURL(e){var i;return y(this,void 0,void 0,function*(){let o=(i=d(this,on,"f"))===null||i===void 0?void 0:i.find(r=>{var l;return((l=r.endpoint.metadata.url)===null||l===void 0?void 0:l.split("/").pop())===e});if(!o)throw new v(`Tab "${e}" not found`);if(o.selected)return this;let s=yield o.endpoint.call(d(this,nn,"f"));return new sn(d(this,nn,"f"),s,!1)})}hasTabWithURL(e){var i,o;return(o=(i=d(this,on,"f"))===null||i===void 0?void 0:i.some(s=>{var r;return((r=s.endpoint.metadata.url)===null||r===void 0?void 0:r.split("/").pop())===e}))!==null&&o!==void 0?o:!1}get title(){var e,i,o;return(o=(i=(e=this.page.contents_memo)===null||e===void 0?void 0:e.getType(be))===null||i===void 0?void 0:i.find(s=>s.selected))===null||o===void 0?void 0:o.title.toString()}};n(sn,"TabbedFeed");on=new WeakMap,nn=new WeakMap;var tn=sn;var Ve=class extends tn{constructor(e,i,o=!1){var s,r,l,p,f,h;super(e,i,o),this.header=(r=(s=this.page.header)===null||s===void 0?void 0:s.item())===null||r===void 0?void 0:r.as(Wi,Tv,w0,si);let m=(l=this.page.metadata)===null||l===void 0?void 0:l.item().as(kv),b=(p=this.page.microformat)===null||p===void 0?void 0:p.as(ii);if(this.page.alerts){let x=this.page.alerts.first();if((x==null?void 0:x.alert_type)==="ERROR")throw new Ks(x.text.toString())}if(!m&&!this.page.contents)throw new v("Invalid channel",this);this.metadata=Object.assign(Object.assign({},m),b||{}),this.subscribe_button=(f=this.page.header_memo)===null||f===void 0?void 0:f.getType($e).first(),this.current_tab=(h=this.page.contents)===null||h===void 0?void 0:h.item().as(ai).tabs.array().filterType(be,Is).get({selected:!0})}applyFilter(e){var i;return y(this,void 0,void 0,function*(){let o,s=this.memo.getType(bi).first();if(typeof e=="string"){if(o=s==null?void 0:s.contents.get({text:e}),!o)throw new v(`Filter ${e} not found`,{available_filters:this.filters})}else e instanceof xe&&(o=e);if(!o)throw new v("Invalid filter",e);let r=yield(i=o.endpoint)===null||i===void 0?void 0:i.call(this.actions,{parse:!0});if(!r)throw new v("No page returned",{filter:o});return new mo(this.actions,r,!0)})}applySort(e){var i,o;return y(this,void 0,void 0,function*(){let s=this.memo.getType(Bt).first();if(!s)throw new v("No sort filter sub menu found");let r=(i=s==null?void 0:s.sub_menu_items)===null||i===void 0?void 0:i.find(p=>p.title===e);if(!r)throw new v(`Sort filter ${e} not found`,{available_sort_filters:this.sort_filters});if(r.selected)return this;let l=yield(o=r.endpoint)===null||o===void 0?void 0:o.call(this.actions,{parse:!0});return new Ve(this.actions,l,!0)})}applyContentTypeFilter(e){var i,o,s,r;return y(this,void 0,void 0,function*(){let l=(s=(o=(i=this.current_tab)===null||i===void 0?void 0:i.content)===null||o===void 0?void 0:o.as(Q).sub_menu)===null||s===void 0?void 0:s.as(ml);if(!l)throw new v("Sub menu not found");let p=l.content_type_sub_menu_items.find(h=>h.title===e);if(!p)throw new v(`Sub menu item ${e} not found`,{available_filters:this.content_type_filters});if(p.selected)return this;let f=yield(r=p.endpoint)===null||r===void 0?void 0:r.call(this.actions,{parse:!0});return new Ve(this.actions,f,!0)})}get filters(){var e,i;return((i=(e=this.memo.getType(bi))===null||e===void 0?void 0:e[0])===null||i===void 0?void 0:i.contents.filterType(xe).map(o=>o.text))||[]}get sort_filters(){var e;let i=this.memo.getType(Bt).first();return((e=i==null?void 0:i.sub_menu_items)===null||e===void 0?void 0:e.map(o=>o.title))||[]}get content_type_filters(){var e,i,o;let s=(o=(i=(e=this.current_tab)===null||e===void 0?void 0:e.content)===null||i===void 0?void 0:i.as(Q).sub_menu)===null||o===void 0?void 0:o.as(ml);return(s==null?void 0:s.content_type_sub_menu_items.map(r=>r.title))||[]}getHome(){return y(this,void 0,void 0,function*(){let e=yield this.getTabByURL("featured");return new Ve(this.actions,e.page,!0)})}getVideos(){return y(this,void 0,void 0,function*(){let e=yield this.getTabByURL("videos");return new Ve(this.actions,e.page,!0)})}getShorts(){return y(this,void 0,void 0,function*(){let e=yield this.getTabByURL("shorts");return new Ve(this.actions,e.page,!0)})}getLiveStreams(){return y(this,void 0,void 0,function*(){let e=yield this.getTabByURL("streams");return new Ve(this.actions,e.page,!0)})}getReleases(){return y(this,void 0,void 0,function*(){let e=yield this.getTabByURL("releases");return new Ve(this.actions,e.page,!0)})}getPodcasts(){return y(this,void 0,void 0,function*(){let e=yield this.getTabByURL("podcasts");return new Ve(this.actions,e.page,!0)})}getPlaylists(){return y(this,void 0,void 0,function*(){let e=yield this.getTabByURL("playlists");return new Ve(this.actions,e.page,!0)})}getCommunity(){return y(this,void 0,void 0,function*(){let e=yield this.getTabByURL("community");return new Ve(this.actions,e.page,!0)})}getAbout(){var e,i,o,s,r;return y(this,void 0,void 0,function*(){if(this.hasTabWithURL("about"))return(yield this.getTabByURL("about")).memo.getType(rl)[0];let l=((e=this.header)===null||e===void 0?void 0:e.is(Wi))&&this.header.tagline;if(l||((i=this.header)===null||i===void 0?void 0:i.is(si))&&((o=this.header.content)===null||o===void 0?void 0:o.description)){if(l&&l.more_endpoint instanceof g){let h=yield l.more_endpoint.call(this.actions);return new tn(this.actions,h,!1).memo.getType(rl)[0]}let p=(r=(s=this.page.header_memo)===null||s===void 0?void 0:s.getType(he)[0])===null||r===void 0?void 0:r.endpoint;if(!p)throw new v("Failed to extract continuation to get channel about");let f=yield p.call(this.actions,{parse:!0});if(!f.on_response_received_endpoints_memo)throw new v("Unexpected response while fetching channel about",{response:f});return f.on_response_received_endpoints_memo.getType(N_)[0]}throw new v("About not found")})}search(e){var i,o;return y(this,void 0,void 0,function*(){let s=(i=this.memo.getType(Is))===null||i===void 0?void 0:i[0];if(!s)throw new v("Search tab not found",this);let r=yield(o=s.endpoint)===null||o===void 0?void 0:o.call(this.actions,{query:e,parse:!0});return new Ve(this.actions,r,!0)})}get has_home(){return this.hasTabWithURL("featured")}get has_videos(){return this.hasTabWithURL("videos")}get has_shorts(){return this.hasTabWithURL("shorts")}get has_live_streams(){return this.hasTabWithURL("streams")}get has_releases(){return this.hasTabWithURL("releases")}get has_podcasts(){return this.hasTabWithURL("podcasts")}get has_playlists(){return this.hasTabWithURL("playlists")}get has_community(){return this.hasTabWithURL("community")}get has_about(){var e,i,o,s,r;return this.hasTabWithURL("about")||!!(((e=this.header)===null||e===void 0?void 0:e.is(Wi))&&((i=this.header.tagline)===null||i===void 0?void 0:i.more_endpoint))||!!(((o=this.header)===null||o===void 0?void 0:o.is(si))&&((r=(s=this.header.content)===null||s===void 0?void 0:s.description)===null||r===void 0?void 0:r.more_endpoint))}get has_search(){var e;return((e=this.memo.getType(Is))===null||e===void 0?void 0:e.length)>0}getContinuation(){let e=Object.create(null,{getContinuationData:{get:()=>super.getContinuationData}});return y(this,void 0,void 0,function*(){let i=yield e.getContinuationData.call(this);if(!i)throw new v("Could not get continuation data");return new rn(this.actions,i,!0)})}};n(Ve,"Channel");var rn=class extends _e{constructor(e,i,o=!1){var s,r;super(e,i,o),this.contents=((s=this.page.on_response_received_actions)===null||s===void 0?void 0:s.first())||((r=this.page.on_response_received_endpoints)===null||r===void 0?void 0:r.first())}getContinuation(){let e=Object.create(null,{getContinuationData:{get:()=>super.getContinuationData}});return y(this,void 0,void 0,function*(){let i=yield e.getContinuationData.call(this);if(!i)throw new v("Could not get continuation data");return new rn(this.actions,i,!0)})}};n(rn,"ChannelListContinuation");var mo=class extends co{constructor(e,i,o=!1){super(e,i,o),this.applied_filter=this.memo.getType(xe).get({is_selected:!0}),this.page.on_response_received_actions&&this.page.on_response_received_actions.length>1&&this.page.on_response_received_actions.shift(),this.contents=this.page.on_response_received_actions.first()}applyFilter(e){let i=Object.create(null,{getFilteredFeed:{get:()=>super.getFilteredFeed}});return y(this,void 0,void 0,function*(){let o=yield i.getFilteredFeed.call(this,e);return new mo(this.actions,o.page,!0)})}getContinuation(){let e=Object.create(null,{getContinuationData:{get:()=>super.getContinuationData}});return y(this,void 0,void 0,function*(){let i=yield e.getContinuationData.call(this);if(!(i!=null&&i.on_response_received_actions_memo))throw new v("Unexpected continuation data",i);return i.on_response_received_actions_memo.set("FeedFilterChipBar",this.memo.getType(bi)),i.on_response_received_actions_memo.set("ChipCloudChip",this.memo.getType(xe)),new mo(this.actions,i,!0)})}};n(mo,"FilteredChannelList");var qs,ci,Xs,an=class{constructor(e,i,o=!1){var s,r,l;qs.set(this,void 0),ci.set(this,void 0),Xs.set(this,void 0),I(this,qs,o?i:c.parseResponse(i),"f"),I(this,ci,e,"f");let p=d(this,qs,"f").on_response_received_endpoints;if(!p)throw new v("Comments page did not have any content.");let f=p.at(0),h=p.at(1);this.header=(s=f==null?void 0:f.contents)===null||s===void 0?void 0:s.firstOfType(zi);let m=((r=h==null?void 0:h.contents)===null||r===void 0?void 0:r.filterType(zv))||[];this.contents=re(m.map(b=>{var x;return(x=b.comment)===null||x===void 0||x.setActions(d(this,ci,"f")),b.setActions(d(this,ci,"f")),b})),I(this,Xs,(l=h==null?void 0:h.contents)===null||l===void 0?void 0:l.firstOfType(he),"f")}applySort(e){var i,o,s,r;return y(this,void 0,void 0,function*(){if(!this.header)throw new v("Page header is missing. Cannot apply sort option.");let l;if(e==="TOP_COMMENTS"?l=(o=(i=this.header.sort_menu)===null||i===void 0?void 0:i.sub_menu_items)===null||o===void 0?void 0:o.at(0):e==="NEWEST_FIRST"&&(l=(r=(s=this.header.sort_menu)===null||s===void 0?void 0:s.sub_menu_items)===null||r===void 0?void 0:r.at(1)),!l)throw new v("Could not find target button.");if(l.selected)return this;let p=yield l.endpoint.call(d(this,ci,"f"),{parse:!0});return new an(d(this,ci,"f"),p,!0)})}createComment(e){var i;return y(this,void 0,void 0,function*(){if(!this.header)throw new v("Page header is missing. Cannot create comment.");let o=(i=this.header.create_renderer)===null||i===void 0?void 0:i.as(Gv).submit_button;if(!o)throw new v("Could not find target button. You are probably not logged in.");if(!o.endpoint)throw new v("Button does not have an endpoint.");return yield o.endpoint.call(d(this,ci,"f"),{commentText:e})})}getContinuation(){return y(this,void 0,void 0,function*(){if(!d(this,Xs,"f"))throw new v("Continuation not found");let e=yield d(this,Xs,"f").endpoint.call(d(this,ci,"f"),{parse:!0}),i=Object.assign({},d(this,qs,"f"));if(!i.on_response_received_endpoints||!e.on_response_received_endpoints)throw new v("Invalid reponse format, missing on_response_received_endpoints.");return i.on_response_received_endpoints.pop(),i.on_response_received_endpoints.push(e.on_response_received_endpoints[0]),new an(d(this,ci,"f"),i,!0)})}get has_continuation(){return!!d(this,Xs,"f")}get page(){return d(this,qs,"f")}};n(an,"Comments");qs=new WeakMap,ci=new WeakMap,Xs=new WeakMap;var ux=an;var jh,lx=class{constructor(e){jh.set(this,void 0),I(this,jh,c.parseResponse(e),"f"),this.contents=d(this,jh,"f").items.array().as(ks,h0)}get page(){return d(this,jh,"f")}};n(lx,"Guide");jh=new WeakMap;var cx=lx;var Qs=class extends _e{constructor(e,i,o=!1){super(e,i,o),this.sections=this.memo.getType(ye),this.feed_actions=this.memo.getType(K_).first()}getContinuation(){return y(this,void 0,void 0,function*(){let e=yield this.getContinuationData();if(!e)throw new Error("No continuation data found");return new Qs(this.actions,e,!0)})}};n(Qs,"History");var Zs=Qs;var Jt=class extends co{constructor(e,i,o=!1){super(e,i,o),this.header=this.memo.getType(u0).first(),this.contents=this.memo.getType(eo).first()||this.page.on_response_received_actions.first()}applyFilter(e){let i=Object.create(null,{getFilteredFeed:{get:()=>super.getFilteredFeed}});return y(this,void 0,void 0,function*(){let o=yield i.getFilteredFeed.call(this,e);return new Jt(this.actions,o.page,!0)})}getContinuation(){let e=Object.create(null,{getContinuation:{get:()=>super.getContinuation}});var i;return y(this,void 0,void 0,function*(){let o=yield e.getContinuation.call(this);return o.page.header=this.page.header,(i=o.page.header_memo)===null||i===void 0||i.set(this.header.type,[this.header]),new Jt(this.actions,o.page,!0)})}};n(Jt,"HomeFeed");var di=class extends co{constructor(e,i){if(super(e,i),!this.page.contents_memo)throw new v("Unexpected response",this.page);let o=this.page.contents_memo.getType(be).first();if(!o.content)throw new v("Content tab has no content",o);this.page.header&&(this.header=this.page.header.item().as(_0,si)),this.contents=o.content.as(eo)}applyFilter(e){let i=Object.create(null,{getFilteredFeed:{get:()=>super.getFilteredFeed}});return y(this,void 0,void 0,function*(){let o=yield i.getFilteredFeed.call(this,e);return new di(this.actions,o.page)})}};n(di,"HashtagFeed");var dx,px,Uh,fx=class{constructor(e,i){dx.set(this,void 0),px.set(this,void 0),Uh.set(this,void 0),I(this,dx,e,"f"),I(this,px,i,"f");let o=e==null?void 0:e.live_chat_item_context_menu_supported_renderers;if(!o||!o.is(j))throw new v('Response did not have a "live_chat_item_context_menu_supported_renderers" property. The call may have failed.');I(this,Uh,o.as(j).items,"f")}selectItem(e){return y(this,void 0,void 0,function*(){let i;if(e instanceof S){if(!e.endpoint)throw new v("Item does not have an endpoint.");i=e.endpoint}else{let s=d(this,Uh,"f").find(r=>r.is(Ki)?r.as(Ki).icon_type===e:!1);if(!s||!s.is(Ki))throw new v(`Button "${e}" not found.`);i=s.endpoint}if(!i)throw new v("Target button does not have an endpoint.");return yield i.call(d(this,px,"f"),{parse:!0})})}items(){return d(this,Uh,"f")}page(){return d(this,dx,"f")}};n(fx,"ItemMenu");dx=new WeakMap,px=new WeakMap,Uh=new WeakMap;var mx=fx;var Wh,hx,er=class extends _e{constructor(e,i,o=!1){var s,r,l,p,f;super(e,i,o),Wh.add(this);let h=this.memo.getType(yg).first(),m=this.memo.getType(wg).first(),b=this.memo.getType(Tg).first(),x=(s=this.page.alerts)===null||s===void 0?void 0:s.firstOfType(os);if(x&&x.alert_type==="ERROR")throw new v(x.text.toString(),x);if(!m&&!b&&Object.keys(this.page).length===0)throw new v("Got empty continuation response. This is likely the end of the playlist.");this.info=Object.assign(Object.assign({},(r=this.page.metadata)===null||r===void 0?void 0:r.item().as(bg)),{subtitle:h?h.subtitle:null,author:(p=(l=b==null?void 0:b.owner)===null||l===void 0?void 0:l.as(js).author)!==null&&p!==void 0?p:h==null?void 0:h.author,thumbnails:(f=m==null?void 0:m.thumbnail_renderer)===null||f===void 0?void 0:f.as(ys,xs).thumbnail,total_items:d(this,Wh,"m",hx).call(this,0,m),views:d(this,Wh,"m",hx).call(this,1,m),last_updated:d(this,Wh,"m",hx).call(this,2,m),can_share:h==null?void 0:h.can_share,can_delete:h==null?void 0:h.can_delete,is_editable:h==null?void 0:h.is_editable,privacy:h==null?void 0:h.privacy}),this.menu=m==null?void 0:m.menu,this.endpoint=m==null?void 0:m.endpoint,this.messages=this.memo.getType(Ge)}get items(){return re(this.videos.as(Vs,Os).filter(e=>e.style!=="PLAYLIST_VIDEO_RENDERER_STYLE_RECOMMENDED_VIDEO"))}get has_continuation(){let e=this.memo.getType(Q).first();return e?!!this.memo.getType(he).find(i=>!e.contents.includes(i)):super.has_continuation}getContinuationData(){let e=Object.create(null,{getContinuationData:{get:()=>super.getContinuationData}});return y(this,void 0,void 0,function*(){let i=this.memo.getType(Q).first();if(!i)return yield e.getContinuationData.call(this);let o=this.memo.getType(he).find(r=>!i.contents.includes(r));if(!o)throw new v("There are no continuations.");return yield o.endpoint.call(this.actions,{parse:!0})})}getContinuation(){return y(this,void 0,void 0,function*(){let e=yield this.getContinuationData();if(!e)throw new v("Could not get continuation data");return new er(this.actions,e,!0)})}};n(er,"Playlist");Wh=new WeakSet,hx=n(function(e,i){var o;return!i||!i.stats?"N/A":((o=i.stats[e])===null||o===void 0?void 0:o.toString())||"N/A"},"_Playlist_getStat");var Ii=er;var Yb,c1,_x=class extends _e{constructor(e,i){if(super(e,i),Yb.add(this),!this.page.contents_memo)throw new v("Page contents not found");this.header=this.memo.getType(si).first();let o=this.page.contents_memo.getType(Fs);this.sections=o.map(s=>{var r;return{type:s.icon_type,title:s.title,contents:((r=s.content)===null||r===void 0?void 0:r.key("items").array())||[],getAll:()=>d(this,Yb,"m",c1).call(this,s)}})}get history(){return this.sections.find(e=>e.type==="WATCH_HISTORY")}get watch_later(){return this.sections.find(e=>e.type==="WATCH_LATER")}get liked_videos(){return this.sections.find(e=>e.type==="LIKE")}get playlists_section(){return this.sections.find(e=>e.type==="PLAYLISTS")}get clips(){return this.sections.find(e=>e.type==="CONTENT_CUT")}};n(_x,"Library");Yb=new WeakSet,c1=n(function(e){var i;return y(this,void 0,void 0,function*(){if(!(!((i=e.menu)===null||i===void 0)&&i.as(j).hasKey("top_level_buttons")))throw new v(`The ${e.title.text} shelf doesn't have more items`);let o=e.menu.as(j).top_level_buttons.firstOfType(S);if(!o)throw new v("Did not find target button.");let s=yield o.as(S).endpoint.call(this.actions,{parse:!0});switch(e.icon_type){case"LIKE":case"WATCH_LATER":return new Ii(this.actions,s,!0);case"WATCH_HISTORY":return new Zs(this.actions,s,!0);case"CONTENT_CUT":return new _e(this.actions,s,!0);default:throw new v("Target shelf not implemented.")}})},"_Library_getAll");var vx=_x;var ki,ho,un,Et,Gt,mt;function AE(t){let e=[];for(let i of t)if(Array.isArray(i))for(let o of i)e.push(o);else e.push(i);return e}n(AE,"flattenQueue");var gx=class{constructor(){this.front=[],this.back=[]}isEmpty(){return!this.front.length&&!this.back.length}clear(){this.front=[],this.back=[]}getValues(){return this.front.concat(this.back.reverse())}};n(gx,"DelayQueue");var xx=class{constructor(){ki.set(this,void 0),ho.set(this,void 0),un.set(this,void 0),Et.set(this,void 0),Gt.set(this,void 0),mt.set(this,void 0),I(this,ki,null,"f"),I(this,ho,null,"f"),I(this,un,null,"f"),I(this,Et,[],"f"),I(this,Gt,null,"f"),I(this,mt,new gx,"f")}enqueueActionGroup(e){if(d(this,ki,"f")!==null){let i=Date.now()-d(this,ki,"f");d(this,mt,"f").back.push(i),5<d(this,mt,"f").front.length+d(this,mt,"f").back.length&&(d(this,mt,"f").front.length||(d(this,mt,"f").front=d(this,mt,"f").back,d(this,mt,"f").front.reverse(),d(this,mt,"f").back=[]),d(this,mt,"f").front.pop()),I(this,ho,Math.max(...d(this,mt,"f").getValues()),"f")}I(this,ki,Date.now(),"f"),d(this,Et,"f").push(e),d(this,Gt,"f")===null&&I(this,Gt,setTimeout(this.emitSmoothedActions.bind(this)),"f")}emitSmoothedActions(){if(I(this,Gt,null,"f"),d(this,Et,"f").length){let e=1e4;d(this,ho,"f")!==null&&d(this,ki,"f")!==null&&(e=d(this,ho,"f")-Date.now()+d(this,ki,"f")),e=d(this,Et,"f").length<e/80?1:Math.ceil(d(this,Et,"f").length/(e/80));let i=AE(d(this,Et,"f").splice(0,e));d(this,un,"f")&&d(this,un,"f").call(this,i),d(this,Et,"f")!==null&&(e==1?(e=d(this,ho,"f")/d(this,Et,"f").length,e*=Math.random()+.5,e=Math.min(1e3,e),e=Math.max(80,e)):e=80,I(this,Gt,setTimeout(this.emitSmoothedActions.bind(this),e),"f"))}}clear(){d(this,Gt,"f")!==null&&(clearTimeout(d(this,Gt,"f")),I(this,Gt,null,"f")),I(this,Et,[],"f")}set callback(e){I(this,un,e,"f")}get callback(){return d(this,un,"f")}get action_queue(){return d(this,Et,"f")}get estimated_update_interval(){return d(this,ho,"f")}get last_update_time(){return d(this,ki,"f")}get next_update_id(){return d(this,Gt,"f")}get poll_response_delay_queue(){return d(this,mt,"f")}};n(xx,"SmoothedQueue");ki=new WeakMap,ho=new WeakMap,un=new WeakMap,Et=new WeakMap,Gt=new WeakMap,mt=new WeakMap;var yx=xx;var We,Si,Gh,bx,cn,Hh,Jh,jb,wx,d1,ln,Tx=class extends pa{constructor(e){var i,o;super(),We.add(this),Si.set(this,void 0),Gh.set(this,void 0),bx.set(this,void 0),cn.set(this,void 0),Hh.set(this,void 0),Jh.set(this,0),this.running=!1,this.is_replay=!1,I(this,Gh,e.basic_info.id,"f"),I(this,bx,e.basic_info.channel_id,"f"),I(this,Si,e.actions,"f"),I(this,cn,(i=e.livechat)===null||i===void 0?void 0:i.continuation,"f"),this.is_replay=((o=e.livechat)===null||o===void 0?void 0:o.is_replay)||!1,this.smoothed_queue=new yx,this.smoothed_queue.callback=s=>y(this,void 0,void 0,function*(){s.length?s.length<10?yield d(this,We,"m",wx).call(this,s):this.is_replay?(d(this,We,"m",wx).call(this,s),yield d(this,We,"m",ln).call(this,2e3)):d(this,We,"m",wx).call(this,s):yield d(this,We,"m",ln).call(this,2e3),this.running&&d(this,We,"m",jb).call(this)})}on(e,i){super.on(e,i)}once(e,i){super.once(e,i)}start(){this.running||(this.running=!0,d(this,We,"m",jb).call(this),d(this,We,"m",d1).call(this))}stop(){this.smoothed_queue.clear(),this.running=!1}sendMessage(e){return y(this,void 0,void 0,function*(){let i=yield d(this,Si,"f").execute("/live_chat/send_message",{params:hb(d(this,bx,"f"),d(this,Gh,"f")),richMessage:{textSegments:[{text:e}]},clientMessageId:L.shim.uuidv4(),client:"ANDROID",parse:!0});if(!i.actions)throw new v("Unexpected response from send_message",i);return i.actions.array().as(N0)})}applyFilter(e){var i,o,s,r,l,p,f;if(!this.initial_info)throw new v("Cannot apply filter before initial info is retrieved.");let h=(s=(o=(i=this.initial_info)===null||i===void 0?void 0:i.header)===null||o===void 0?void 0:o.view_selector)===null||s===void 0?void 0:s.sub_menu_items;if(e==="TOP_CHAT"){if(!((r=h==null?void 0:h.at(0))===null||r===void 0)&&r.selected)return;I(this,cn,(l=h==null?void 0:h.at(0))===null||l===void 0?void 0:l.continuation,"f")}else{if(!((p=h==null?void 0:h.at(1))===null||p===void 0)&&p.selected)return;I(this,cn,(f=h==null?void 0:h.at(1))===null||f===void 0?void 0:f.continuation,"f")}}getItemMenu(e){return y(this,void 0,void 0,function*(){if(!e.hasKey("menu_endpoint")||!e.key("menu_endpoint").isInstanceof(g))throw new v("This item does not have a menu.",e);let i=yield e.key("menu_endpoint").instanceof(g).call(d(this,Si,"f"),{parse:!0});if(!i)throw new v("Could not retrieve item menu.",e);return new mx(i,d(this,Si,"f"))})}selectButton(e){return y(this,void 0,void 0,function*(){return yield e.endpoint.call(d(this,Si,"f"),{parse:!0})})}};n(Tx,"LiveChat");Si=new WeakMap,Gh=new WeakMap,bx=new WeakMap,cn=new WeakMap,Hh=new WeakMap,Jh=new WeakMap,We=new WeakSet,jb=n(function t(){y(this,void 0,void 0,function*(){var e,i;try{let o=yield d(this,Si,"f").execute(this.is_replay?"live_chat/get_live_chat_replay":"live_chat/get_live_chat",{continuation:d(this,cn,"f"),parse:!0}),s=o.continuation_contents;if(s||(this.emit("error",new v("Unexpected live chat incremental continuation response",o)),this.emit("end"),this.stop()),!(s instanceof ro)){this.stop(),this.emit("end");return}I(this,cn,s.continuation.token,"f"),s.header?(this.initial_info=s,this.emit("start",s),this.running&&d(this,We,"m",t).call(this)):this.smoothed_queue.enqueueActionGroup(s.actions),I(this,Jh,0,"f")}catch(o){this.emit("error",o),I(this,Jh,(i=d(this,Jh,"f"),e=i++,i),"f"),e<10?(yield d(this,We,"m",ln).call(this,2e3),d(this,We,"m",t).call(this)):(this.emit("error",new v("Reached retry limit for incremental continuation requests",o)),this.emit("end"),this.stop())}})},"_LiveChat_pollLivechat"),wx=n(function(e){return y(this,void 0,void 0,function*(){let o=e.length<125?1:Math.ceil(e.length/125),s=o==1?(o=1e4/e.length,o*=Math.random()+.5,o=Math.min(1e3,o),o=Math.max(80,o)):o=80;for(let r of e)yield d(this,We,"m",ln).call(this,s),this.emit("chat-update",r)})},"_LiveChat_emitSmoothedActions"),d1=n(function t(){y(this,void 0,void 0,function*(){var e,i,o,s,r,l,p,f,h,m,b;try{let x={videoId:d(this,Gh,"f")};d(this,Hh,"f")&&(x.continuation=d(this,Hh,"f"));let T=yield d(this,Si,"f").execute("/updated_metadata",x),k=c.parseResponse(T.data);I(this,Hh,(e=k.continuation)===null||e===void 0?void 0:e.token,"f"),this.metadata={title:((i=k.actions)===null||i===void 0?void 0:i.array().firstOfType(O0))||((o=this.metadata)===null||o===void 0?void 0:o.title),description:((s=k.actions)===null||s===void 0?void 0:s.array().firstOfType(V0))||((r=this.metadata)===null||r===void 0?void 0:r.description),views:((l=k.actions)===null||l===void 0?void 0:l.array().firstOfType(L0))||((p=this.metadata)===null||p===void 0?void 0:p.views),likes:((f=k.actions)===null||f===void 0?void 0:f.array().firstOfType(D0))||((h=this.metadata)===null||h===void 0?void 0:h.likes),date:((m=k.actions)===null||m===void 0?void 0:m.array().firstOfType(M0))||((b=this.metadata)===null||b===void 0?void 0:b.date)},this.emit("metadata-update",this.metadata),yield d(this,We,"m",ln).call(this,5e3),this.running&&d(this,We,"m",t).call(this)}catch(x){yield d(this,We,"m",ln).call(this,2e3),this.running&&d(this,We,"m",t).call(this)}})},"_LiveChat_pollMetadata"),ln=n(function(e){return y(this,void 0,void 0,function*(){return new Promise(i=>setTimeout(()=>i(),e))})},"_LiveChat_wait");var Ix=Tx;var dn,zh,tr=class{constructor(e,i){dn.set(this,void 0),zh.set(this,void 0),I(this,zh,e,"f"),I(this,dn,c.parseResponse(i.data),"f"),this.header=d(this,dn,"f").actions_memo.getType(z0).first(),this.contents=d(this,dn,"f").actions_memo.getType(lg)}getContinuation(){return y(this,void 0,void 0,function*(){let e=d(this,dn,"f").actions_memo.getType(he).first();if(!e)throw new v("Continuation not found");let i=yield e.endpoint.call(d(this,zh,"f"),{parse:!1});return new tr(d(this,zh,"f"),i)})}get page(){return d(this,dn,"f")}};n(tr,"NotificationsMenu");dn=new WeakMap,zh=new WeakMap;var kx=tr;var pn=class extends _e{constructor(e,i,o=!1){var s,r,l,p,f,h;super(e,i,o);let m=((s=this.page.contents_memo)===null||s===void 0?void 0:s.getType(Q).first().contents)||((r=this.page.on_response_received_commands)===null||r===void 0?void 0:r.first().contents);if(!m)throw new v("No contents found in search response");this.page.header&&(this.header=this.page.header.item().as(Pg)),this.results=(l=m.find(b=>b.is(ye)&&b.contents&&b.contents.length>0))===null||l===void 0?void 0:l.as(ye).contents,this.refinements=this.page.refinements||[],this.estimated_results=this.page.estimated_results,this.sub_menu=(p=this.page.contents_memo)===null||p===void 0?void 0:p.getType(Ng).first(),this.watch_card=(f=this.page.contents_memo)===null||f===void 0?void 0:f.getType(jg).first(),this.refinement_cards=(h=this.results)===null||h===void 0?void 0:h.firstOfType(Yi)}selectRefinementCard(e){var i,o;return y(this,void 0,void 0,function*(){let s;if(typeof e=="string"){if(!this.refinement_cards)throw new v("No refinement cards found.");if(s=(o=(i=this.refinement_cards)===null||i===void 0?void 0:i.cards.get({query:e}))===null||o===void 0?void 0:o.as(Oo),!s)throw new v(`Refinement card "${e}" not found`,{available_cards:this.refinement_card_queries})}else if(e.type==="SearchRefinementCard")s=e;else throw new v("Invalid refinement card!");let r=yield s.endpoint.call(this.actions,{parse:!0});return new pn(this.actions,r,!0)})}get refinement_card_queries(){var e;return((e=this.refinement_cards)===null||e===void 0?void 0:e.cards.as(Oo).map(i=>i.query))||[]}getContinuation(){return y(this,void 0,void 0,function*(){let e=yield this.getContinuationData();if(!e)throw new v("Could not get continuation data");return new pn(this.actions,e,!0)})}};n(pn,"Search");var Sx=pn;var fn,$h,ir=class{constructor(e,i){var o,s,r,l;if(fn.set(this,void 0),$h.set(this,void 0),I(this,$h,e,"f"),I(this,fn,c.parseResponse(i.data),"f"),this.sidebar=(o=d(this,fn,"f").sidebar)===null||o===void 0?void 0:o.as(Mg),!d(this,fn,"f").contents)throw new v("Page contents not found");let p=d(this,fn,"f").contents.item().as(ai).tabs.array().as(be).get({selected:!0});if(!p)throw new v("Target tab not found");let f=(s=p.content)===null||s===void 0?void 0:s.as(Q).contents.as(ye);this.introduction=(l=(r=f==null?void 0:f.shift())===null||r===void 0?void 0:r.contents)===null||l===void 0?void 0:l.firstOfType(dg),this.sections=f==null?void 0:f.map(h=>{var m;return{title:!((m=h.header)===null||m===void 0)&&m.is(zi,Ss,Cs)?h.header.title.toString():null,contents:h.contents}})}selectSidebarItem(e){return y(this,void 0,void 0,function*(){if(!this.sidebar)throw new v("Sidebar not available");let i;if(typeof e=="string"){if(i=this.sidebar.items.get({title:e}),!i)throw new v(`Item "${e}" not found`,{available_items:this.sidebar_items})}else if(e!=null&&e.is(gs))i=e;else throw new v("Invalid item",{target_item:e});let o=yield i.endpoint.call(d(this,$h,"f"),{parse:!1});return new ir(d(this,$h,"f"),o)})}getSettingOption(e){var i;if(!this.sections)throw new v("Sections not available");for(let o of this.sections)if(!!o.contents)for(let s of o.contents){let r=s.as(Bs).options;if(r){for(let l of r)if(l.is(Ls)&&((i=l.title)===null||i===void 0?void 0:i.toString())===e)return l}}throw new v(`Option "${e}" not found`,{available_options:this.setting_options})}get setting_options(){if(!this.sections)throw new v("Sections not available");let e=[];for(let i of this.sections)if(!!i.contents)for(let o of i.contents)o.as(Bs).options&&(e=e.concat(o.as(Bs).options));return e.map(i=>{var o;return(o=i.title)===null||o===void 0?void 0:o.toString()}).filter(i=>i)}get sidebar_items(){if(!this.sidebar)throw new v("Sidebar not available");return this.sidebar.items.map(e=>e.title.toString())}get page(){return d(this,fn,"f")}};n(ir,"Settings");fn=new WeakMap,$h=new WeakMap;var Cx=ir;var or,Ex=class{constructor(e){var i;if(or.set(this,void 0),I(this,or,c.parseResponse(e.data),"f"),!d(this,or,"f").contents)throw new v("Page contents not found");let o=d(this,or,"f").contents.item().as(ri).tabs.get({selected:!0});if(!o)throw new v("Could not find target tab.");this.contents=(i=o.content)===null||i===void 0?void 0:i.as(Q).contents.as(ye)}get page(){return d(this,or,"f")}};n(Ex,"TimeWatched");or=new WeakMap;var Px=Ex;var _o,nr=class extends fo{constructor(e,i,o){var s,r,l,p,f,h,m,b,x,T,k,C,M,A,$,D,le,ve,ke,Pe,De,K,z,Z,se,Fe,_t,Tt,q,ze,Xt,Qt,Se,ut,Un,Wn,Hn,Jn,Gn,zn,$n,Kn,qn,Xn,Qn;super(e,i,o),_o.set(this,void 0);let[de,It]=this.page;if(de.microformat&&!(!((s=de.microformat)===null||s===void 0)&&s.is(Ct,ii)))throw new v("Invalid microformat",de.microformat);if(this.basic_info=Object.assign(Object.assign(Object.assign({},de.video_details),{embed:!((r=de.microformat)===null||r===void 0)&&r.is(Ct)?(l=de.microformat)===null||l===void 0?void 0:l.embed:null,channel:!((p=de.microformat)===null||p===void 0)&&p.is(Ct)?(f=de.microformat)===null||f===void 0?void 0:f.channel:null,is_unlisted:(h=de.microformat)===null||h===void 0?void 0:h.is_unlisted,is_family_safe:(m=de.microformat)===null||m===void 0?void 0:m.is_family_safe,category:!((b=de.microformat)===null||b===void 0)&&b.is(Ct)?(x=de.microformat)===null||x===void 0?void 0:x.category:null,has_ypc_metadata:!((T=de.microformat)===null||T===void 0)&&T.is(Ct)?(k=de.microformat)===null||k===void 0?void 0:k.has_ypc_metadata:null,start_timestamp:!((C=de.microformat)===null||C===void 0)&&C.is(Ct)?de.microformat.start_timestamp:null,end_timestamp:!((M=de.microformat)===null||M===void 0)&&M.is(Ct)?de.microformat.end_timestamp:null,view_count:((A=de.microformat)===null||A===void 0?void 0:A.is(Ct))&&isNaN(($=de.video_details)===null||$===void 0?void 0:$.view_count)?de.microformat.view_count:(D=de.video_details)===null||D===void 0?void 0:D.view_count}),{like_count:void 0,is_liked:void 0,is_disliked:void 0}),this.annotations=de.annotations,this.storyboards=de.storyboards,this.endscreen=de.endscreen,this.captions=de.captions,this.cards=de.cards,this.streaming_data){let Ne=this.streaming_data.adaptive_formats.find(et=>{var tt;return(tt=et.audio_track)===null||tt===void 0?void 0:tt.audio_is_default});if(Ne)this.streaming_data.formats.forEach(et=>et.language=Ne.language);else if(((le=this.captions)===null||le===void 0?void 0:le.caption_tracks)&&((ve=this.captions)===null||ve===void 0?void 0:ve.caption_tracks.length)>0){let et=this.captions.caption_tracks.find(Ae=>Ae.kind==="asr"),tt=et==null?void 0:et.language_code;this.streaming_data.adaptive_formats.forEach(Ae=>{Ae.has_audio&&(Ae.language=tt)}),this.streaming_data.formats.forEach(Ae=>Ae.language=tt)}}let Je=(ke=It==null?void 0:It.contents)===null||ke===void 0?void 0:ke.item().as(Ys),vi=Je==null?void 0:Je.results,Io=Je==null?void 0:Je.secondary_results;if(vi&&Io){if(((Pe=de.microformat)===null||Pe===void 0?void 0:Pe.is(Ct))&&((De=de.microformat)===null||De===void 0?void 0:De.category)==="Gaming"){let Ae=(Z=(z=(K=vi.firstOfType(yh))===null||K===void 0?void 0:K.metadata)===null||z===void 0?void 0:z.rows)===null||Z===void 0?void 0:Z.firstOfType(dm);Ae!=null&&Ae.is(dm)&&(this.game_info={title:(Fe=(se=Ae==null?void 0:Ae.contents)===null||se===void 0?void 0:se.firstOfType(lm))===null||Fe===void 0?void 0:Fe.title,release_year:(Tt=(_t=Ae==null?void 0:Ae.contents)===null||_t===void 0?void 0:_t.firstOfType(lm))===null||Tt===void 0?void 0:Tt.subtitle})}this.primary_info=vi.firstOfType(Ug),this.secondary_info=vi.firstOfType(yh),this.merchandise=vi.firstOfType($0),this.related_chip_cloud=(q=Io.firstOfType(Sg))===null||q===void 0?void 0:q.content.as(vt),Je!=null&&Je.playlist&&(this.playlist=Je.playlist),this.watch_next_feed=((ze=Io.firstOfType(ye))===null||ze===void 0?void 0:ze.contents)||Io,this.watch_next_feed&&Array.isArray(this.watch_next_feed)&&((Xt=this.watch_next_feed.at(-1))===null||Xt===void 0?void 0:Xt.is(he))&&I(this,_o,(Qt=this.watch_next_feed.pop())===null||Qt===void 0?void 0:Qt.as(he),"f"),this.player_overlays=(Se=It==null?void 0:It.player_overlays)===null||Se===void 0?void 0:Se.item().as(Zi),Je!=null&&Je.autoplay&&(this.autoplay=Je.autoplay);let Ne=(Un=(ut=this.primary_info)===null||ut===void 0?void 0:ut.menu)===null||Un===void 0?void 0:Un.top_level_buttons.firstOfType($o);((Wn=Ne==null?void 0:Ne.like_button)===null||Wn===void 0?void 0:Wn.is(Re))&&((Hn=Ne==null?void 0:Ne.dislike_button)===null||Hn===void 0?void 0:Hn.is(Re))&&(this.basic_info.like_count=(Jn=Ne==null?void 0:Ne.like_button)===null||Jn===void 0?void 0:Jn.like_count,this.basic_info.is_liked=(Gn=Ne==null?void 0:Ne.like_button)===null||Gn===void 0?void 0:Gn.is_toggled,this.basic_info.is_disliked=(zn=Ne==null?void 0:Ne.dislike_button)===null||zn===void 0?void 0:zn.is_toggled);let et=(Kn=($n=this.primary_info)===null||$n===void 0?void 0:$n.menu)===null||Kn===void 0?void 0:Kn.top_level_buttons.firstOfType(Ko);if(et&&(this.basic_info.like_count=et.like_count,et.like_button)){let Ae=et.like_button.like_status_entity.like_status;this.basic_info.is_liked=Ae==="LIKE",this.basic_info.is_disliked=Ae==="DISLIKE"}let tt=(qn=vi.get({target_id:"comments-entry-point"}))===null||qn===void 0?void 0:qn.as(ye);this.comments_entry_point_header=(Xn=tt==null?void 0:tt.contents)===null||Xn===void 0?void 0:Xn.firstOfType(Jv),this.livechat=(Qn=It==null?void 0:It.contents_memo)===null||Qn===void 0?void 0:Qn.getType(C0).first()}}selectFilter(e){var i,o,s,r;return y(this,void 0,void 0,function*(){if(!this.related_chip_cloud)throw new v("Chip cloud not found, cannot apply filter");let l;if(typeof e=="string"){let h=(o=(i=this.related_chip_cloud)===null||i===void 0?void 0:i.chips)===null||o===void 0?void 0:o.get({text:e});if(!h)throw new v("Invalid filter",{available_filters:this.filters});l=h}else if(e!=null&&e.is(xe))l=e;else throw new v("Invalid cloud chip",e);if(l.is_selected)return this;let p=yield(s=l.endpoint)===null||s===void 0?void 0:s.call(this.actions,{parse:!0}),f=(r=p==null?void 0:p.on_response_received_endpoints)===null||r===void 0?void 0:r.get({target_id:"watch-next-feed"});return this.watch_next_feed=f==null?void 0:f.contents,this})}addToWatchHistory(){let e=Object.create(null,{addToWatchHistory:{get:()=>super.addToWatchHistory}});return y(this,void 0,void 0,function*(){return e.addToWatchHistory.call(this)})}getWatchNextContinuation(){var e,i,o,s,r;return y(this,void 0,void 0,function*(){if(!d(this,_o,"f"))throw new v("Watch next feed continuation not found");let l=yield(e=d(this,_o,"f"))===null||e===void 0?void 0:e.endpoint.call(this.actions,{parse:!0}),p=(i=l==null?void 0:l.on_response_received_endpoints)===null||i===void 0?void 0:i.get({type:"AppendContinuationItemsAction"});if(!p)throw new v("AppendContinuationItemsAction not found");return this.watch_next_feed=p==null?void 0:p.contents,!((s=(o=this.watch_next_feed)===null||o===void 0?void 0:o.at(-1))===null||s===void 0)&&s.is(he)?I(this,_o,(r=this.watch_next_feed.pop())===null||r===void 0?void 0:r.as(he),"f"):I(this,_o,void 0,"f"),this})}like(){var e,i,o,s,r;return y(this,void 0,void 0,function*(){let l=(i=(e=this.primary_info)===null||e===void 0?void 0:e.menu)===null||i===void 0?void 0:i.top_level_buttons.firstOfType(Ko);if(l){let m=(o=l==null?void 0:l.like_button)===null||o===void 0?void 0:o.toggle_button;if(!m||!m.default_button||!l.like_button)throw new v("Like button not found",{video_id:this.basic_info.id});if(l.like_button.like_status_entity.like_status==="LIKE")throw new v("This video is already liked",{video_id:this.basic_info.id});return yield new g(m.default_button.on_tap.payload.commands.find(k=>k.innertubeCommand)).call(this.actions)}let p=(r=(s=this.primary_info)===null||s===void 0?void 0:s.menu)===null||r===void 0?void 0:r.top_level_buttons.firstOfType($o),f=p==null?void 0:p.like_button;if(!f)throw new v("Like button not found",{video_id:this.basic_info.id});if(!f.is(Re))throw new v("Like button is not a toggle button. This action is likely disabled for this video.",{video_id:this.basic_info.id});if(f.is_toggled)throw new v("This video is already liked",{video_id:this.basic_info.id});return yield f.endpoint.call(this.actions)})}dislike(){var e,i,o,s,r;return y(this,void 0,void 0,function*(){let l=(i=(e=this.primary_info)===null||e===void 0?void 0:e.menu)===null||i===void 0?void 0:i.top_level_buttons.firstOfType(Ko);if(l){let m=(o=l==null?void 0:l.dislike_button)===null||o===void 0?void 0:o.toggle_button;if(!m||!m.default_button||!l.dislike_button||!l.like_button)throw new v("Dislike button not found",{video_id:this.basic_info.id});if(l.like_button.like_status_entity.like_status==="DISLIKE")throw new v("This video is already disliked",{video_id:this.basic_info.id});return yield new g(m.default_button.on_tap.payload.commands.find(k=>k.innertubeCommand)).call(this.actions)}let p=(r=(s=this.primary_info)===null||s===void 0?void 0:s.menu)===null||r===void 0?void 0:r.top_level_buttons.firstOfType($o),f=p==null?void 0:p.dislike_button;if(!f)throw new v("Dislike button not found",{video_id:this.basic_info.id});if(!f.is(Re))throw new v("Dislike button is not a toggle button. This action is likely disabled for this video.",{video_id:this.basic_info.id});if(f.is_toggled)throw new v("This video is already disliked",{video_id:this.basic_info.id});return yield f.endpoint.call(this.actions)})}removeRating(){var e,i,o,s,r,l,p;return y(this,void 0,void 0,function*(){let f,h=(i=(e=this.primary_info)===null||e===void 0?void 0:e.menu)===null||i===void 0?void 0:i.top_level_buttons.firstOfType(Ko);if(h){let k=(o=h==null?void 0:h.like_button)===null||o===void 0?void 0:o.toggle_button;if(!k||!k.default_button||!h.like_button)throw new v("Like button not found",{video_id:this.basic_info.id});let C=h.like_button.like_status_entity.like_status;if(C==="LIKE")f=(s=h==null?void 0:h.like_button)===null||s===void 0?void 0:s.toggle_button;else if(C==="DISLIKE")f=(r=h==null?void 0:h.dislike_button)===null||r===void 0?void 0:r.toggle_button;else throw new v("This video is not liked/disliked",{video_id:this.basic_info.id});if(!f||!f.toggled_button)throw new v("Like/Dislike button not found",{video_id:this.basic_info.id});return yield new g(f.toggled_button.on_tap.payload.commands.find($=>$.innertubeCommand)).call(this.actions)}let m=(p=(l=this.primary_info)===null||l===void 0?void 0:l.menu)===null||p===void 0?void 0:p.top_level_buttons.firstOfType($o),b=m==null?void 0:m.like_button,x=m==null?void 0:m.dislike_button;if(!(b!=null&&b.is(Re))||!(x!=null&&x.is(Re)))throw new v("Like/Dislike button is not a toggle button. This action is likely disabled for this video.",{video_id:this.basic_info.id});if(b!=null&&b.is_toggled?f=b:x!=null&&x.is_toggled&&(f=x),!f)throw new v("This video is not liked/disliked",{video_id:this.basic_info.id});return yield f.toggled_endpoint.call(this.actions)})}getLiveChat(){if(!this.livechat)throw new v("Live Chat is not available",{video_id:this.basic_info.id});return new Ix(this)}getTrailerInfo(){var e,i;if(this.has_trailer){let o=(i=(e=this.playability_status.error_screen)===null||e===void 0?void 0:e.as(Nf).trailer)===null||i===void 0?void 0:i.player_response;if(o)return new nr([{data:o}],this.actions,this.cpn)}return null}get filters(){var e,i;return((i=(e=this.related_chip_cloud)===null||e===void 0?void 0:e.chips)===null||i===void 0?void 0:i.map(o=>{var s;return(s=o.text)===null||s===void 0?void 0:s.toString()}))||[]}get wn_has_continuation(){return!!d(this,_o,"f")}get autoplay_video_endpoint(){var e,i,o;return((o=(i=(e=this.autoplay)===null||e===void 0?void 0:e.sets)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.autoplay_video)||null}get has_trailer(){var e;return!!(!((e=this.playability_status.error_screen)===null||e===void 0)&&e.is(Nf))}get music_tracks(){var e,i,o,s,r,l;let p=(i=(e=this.page[1])===null||e===void 0?void 0:e.engagement_panels)===null||i===void 0?void 0:i.filter(f=>{var h;return(h=f.content)===null||h===void 0?void 0:h.is(Lo)});if(p!==void 0&&p.length>0){let f=(r=(s=(o=p[0].content)===null||o===void 0?void 0:o.as(Lo))===null||s===void 0?void 0:s.items)===null||r===void 0?void 0:r.filterType(ds);if(f!==void 0&&f.length>0)return(l=f[0].carousel_lockups)===null||l===void 0?void 0:l.map(h=>{var m,b,x,T,k,C,M,A,$,D,le,ve,ke,Pe,De,K,z,Z,se;let Fe,_t,Tt,q,ze,Xt;Fe=(b=(m=h.video_lockup)===null||m===void 0?void 0:m.title)===null||b===void 0?void 0:b.toString(),ze=(x=h.video_lockup)===null||x===void 0?void 0:x.endpoint.payload.videoId;for(let Qt=0;Qt<h.info_rows.length;Qt++){let Se=h.info_rows[Qt];if(Se.info_row_expand_status_key===void 0)if(Fe===void 0){if(Fe=((T=Se.default_metadata)===null||T===void 0?void 0:T.toString())||((k=Se.expanded_metadata)===null||k===void 0?void 0:k.toString()),ze===void 0){let ut=((C=Se.default_metadata)===null||C===void 0?void 0:C.endpoint)||((M=Se.expanded_metadata)===null||M===void 0?void 0:M.endpoint);ze=(A=ut==null?void 0:ut.payload)===null||A===void 0?void 0:A.videoId}}else Tt=(($=Se.default_metadata)===null||$===void 0?void 0:$.toString())||((D=Se.expanded_metadata)===null||D===void 0?void 0:D.toString());else{if(((le=Se.info_row_expand_status_key)===null||le===void 0?void 0:le.indexOf("structured-description-music-section-artists-row-state-id"))!==-1&&(_t=((ve=Se.default_metadata)===null||ve===void 0?void 0:ve.toString())||((ke=Se.expanded_metadata)===null||ke===void 0?void 0:ke.toString()),Xt===void 0)){let ut=((Pe=Se.default_metadata)===null||Pe===void 0?void 0:Pe.endpoint)||((De=Se.expanded_metadata)===null||De===void 0?void 0:De.endpoint);Xt=(K=ut==null?void 0:ut.payload)===null||K===void 0?void 0:K.browseId}((z=Se.info_row_expand_status_key)===null||z===void 0?void 0:z.indexOf("structured-description-music-section-licenses-row-state-id"))!==-1&&(q=((Z=Se.default_metadata)===null||Z===void 0?void 0:Z.toString())||((se=Se.expanded_metadata)===null||se===void 0?void 0:se.toString()))}}return{song:Fe,artist:_t,album:Tt,license:q,videoId:ze,channelId:Xt}})}return[]}};n(nr,"VideoInfo");_o=new WeakMap;var Kh=nr;var qh,Xh,sr=class{constructor(e,i){qh.set(this,void 0),Xh.set(this,void 0),I(this,qh,c.parseResponse(i.data),"f"),I(this,Xh,e,"f"),this.transcript=d(this,qh,"f").actions_memo.getType(is).first()}selectLanguage(e){var i,o,s,r;return y(this,void 0,void 0,function*(){let l=(r=(s=(o=(i=this.transcript.content)===null||i===void 0?void 0:i.footer)===null||o===void 0?void 0:o.language_menu)===null||s===void 0?void 0:s.sub_menu_items)===null||r===void 0?void 0:r.find(f=>f.title.toString()===e);if(!l)throw new Error(`Language not found: ${e}`);if(l.selected)return this;let p=yield d(this,Xh,"f").execute("/get_transcript",{params:l.continuation});return new sr(d(this,Xh,"f"),p)})}get languages(){var e,i,o,s;return((s=(o=(i=(e=this.transcript.content)===null||e===void 0?void 0:e.footer)===null||i===void 0?void 0:i.language_menu)===null||o===void 0?void 0:o.sub_menu_items)===null||s===void 0?void 0:s.map(r=>r.title.toString()))||[]}get selectedLanguage(){var e,i,o,s,r;return((r=(s=(o=(i=(e=this.transcript.content)===null||e===void 0?void 0:e.footer)===null||i===void 0?void 0:i.language_menu)===null||o===void 0?void 0:o.sub_menu_items)===null||s===void 0?void 0:s.find(l=>l.selected))===null||r===void 0?void 0:r.title.toString())||""}get page(){return d(this,qh,"f")}};n(sr,"TranscriptInfo");qh=new WeakMap,Xh=new WeakMap;var ax=sr;var Hb={};B(Hb,{Album:()=>Ax,Artist:()=>Vx,Explore:()=>Dx,HomeFeed:()=>Lx,Library:()=>Bx,LibraryContinuation:()=>vn,Playlist:()=>fr,Recap:()=>Yx,Search:()=>jx,TrackInfo:()=>o_});var Ci,Nx=class{constructor(e){var i,o,s;if(Ci.set(this,void 0),I(this,Ci,c.parseResponse(e.data),"f"),this.header=(i=d(this,Ci,"f").header)===null||i===void 0?void 0:i.item().as(Go),this.url=((o=d(this,Ci,"f").microformat)===null||o===void 0?void 0:o.as(ii).url_canonical)||null,!d(this,Ci,"f").contents_memo)throw new Error("No contents found in the response");this.contents=(s=d(this,Ci,"f").contents_memo.getType(Te))===null||s===void 0?void 0:s.first().contents,this.sections=d(this,Ci,"f").contents_memo.getType(Ue)||[]}get page(){return d(this,Ci,"f")}};n(Nx,"Album");Ci=new WeakMap;var Ax=Nx;var rr,Rx,Mx=class{constructor(e,i){var o,s,r;rr.set(this,void 0),Rx.set(this,void 0),I(this,rr,c.parseResponse(e.data),"f"),I(this,Rx,i,"f"),this.header=(o=this.page.header)===null||o===void 0?void 0:o.item().as(og,ug,Qi);let l=((s=d(this,rr,"f").contents_memo)===null||s===void 0?void 0:s.getType(Te))||[],p=((r=d(this,rr,"f").contents_memo)===null||r===void 0?void 0:r.getType(Ue))||[];this.sections=[...l,...p]}getAllSongs(){var e,i;return y(this,void 0,void 0,function*(){let o=this.sections.filter(p=>p.type==="MusicShelf");if(!o.length)throw new v("Could not find any node of type MusicShelf.");let s=o.find(p=>p.title.toString()==="Songs");if(!s)throw new v("Could not find target shelf (Songs).");if(!s.endpoint)throw new v("Target shelf (Songs) did not have an endpoint.");return(i=(e=(yield s.endpoint.call(d(this,Rx,"f"),{client:"YTMUSIC",parse:!0})).contents_memo)===null||e===void 0?void 0:e.getType(zo))===null||i===void 0?void 0:i.first()})}get page(){return d(this,rr,"f")}};n(Mx,"Artist");rr=new WeakMap,Rx=new WeakMap;var Vx=Mx;var Qh,Ox=class{constructor(e){var i,o,s;Qh.set(this,void 0),I(this,Qh,c.parseResponse(e.data),"f");let r=(i=d(this,Qh,"f").contents)===null||i===void 0?void 0:i.item().as(ri).tabs.get({selected:!0});if(!r)throw new v("Could not find target tab.");let l=(o=r.content)===null||o===void 0?void 0:o.as(Q);if(!l)throw new v("Target tab did not have any content.");this.top_buttons=((s=l.contents.firstOfType(Uo))===null||s===void 0?void 0:s.items.as(Ns))||[],this.sections=l.contents.filterType(Ue)}get page(){return d(this,Qh,"f")}};n(Ox,"Explore");Qh=new WeakMap;var Dx=Ox;var vo,mn,hn,_n=class{constructor(e,i){var o,s,r,l,p,f;vo.set(this,void 0),mn.set(this,void 0),hn.set(this,void 0),I(this,mn,i,"f"),I(this,vo,c.parseResponse(e.data),"f");let h=(o=d(this,vo,"f").contents)===null||o===void 0?void 0:o.item().as(ri).tabs.get({selected:!0});if(!h)throw new v("Could not find Home tab.");if(h.content===null){if(!d(this,vo,"f").continuation_contents)throw new v("Continuation did not have any content.");I(this,hn,d(this,vo,"f").continuation_contents.as(pt).continuation,"f"),this.sections=(s=d(this,vo,"f").continuation_contents.as(pt).contents)===null||s===void 0?void 0:s.as(Ue);return}this.header=(l=(r=h.content)===null||r===void 0?void 0:r.as(Q).header)===null||l===void 0?void 0:l.as(vt),I(this,hn,(p=h.content)===null||p===void 0?void 0:p.as(Q).continuation,"f"),this.sections=(f=h.content)===null||f===void 0?void 0:f.as(Q).contents.as(Ue,ag)}getContinuation(){return y(this,void 0,void 0,function*(){if(!d(this,hn,"f"))throw new v("Continuation not found.");let e=yield d(this,mn,"f").execute("/browse",{client:"YTMUSIC",continuation:d(this,hn,"f")});return new _n(e,d(this,mn,"f"))})}applyFilter(e){var i,o;return y(this,void 0,void 0,function*(){let s;if(typeof e=="string"){if(s=(o=(i=this.header)===null||i===void 0?void 0:i.chips)===null||o===void 0?void 0:o.as(xe).get({text:e}),!s)throw new v("Could not find filter with given name.",{available_filters:this.filters})}else e!=null&&e.is(xe)&&(s=e);if(!s)throw new v("Invalid filter",{available_filters:this.filters});if(s!=null&&s.is_selected)return this;if(!s.endpoint)throw new v("Selected filter does not have an endpoint.");let r=yield s.endpoint.call(d(this,mn,"f"),{client:"YTMUSIC"});return new _n(r,d(this,mn,"f"))})}get filters(){var e,i;return((i=(e=this.header)===null||e===void 0?void 0:e.chips)===null||i===void 0?void 0:i.as(xe).map(o=>o.text))||[]}get has_continuation(){return!!d(this,hn,"f")}get page(){return d(this,vo,"f")}};n(_n,"HomeFeed");vo=new WeakMap,mn=new WeakMap,hn=new WeakMap;var Lx=_n;var pi,go,ar,ur,Zh,lr,cr=class{constructor(e,i){var o,s,r,l,p;pi.set(this,void 0),go.set(this,void 0),ar.set(this,void 0),I(this,pi,c.parseResponse(e.data),"f"),I(this,go,i,"f");let f=(o=d(this,pi,"f").contents_memo)===null||o===void 0?void 0:o.getType(Q).first();this.header=(s=f==null?void 0:f.header)===null||s===void 0?void 0:s.as(sg),this.contents=(r=f==null?void 0:f.contents)===null||r===void 0?void 0:r.as(Uo,Te),I(this,ar,(p=(l=this.contents)===null||l===void 0?void 0:l.find(h=>h.continuation))===null||p===void 0?void 0:p.continuation,"f")}applySort(e){var i,o,s,r,l,p,f,h,m,b;return y(this,void 0,void 0,function*(){let x;if(typeof e=="string"){let M=(i=d(this,pi,"f").contents_memo)===null||i===void 0?void 0:i.getType(ff).first(),A=(o=M==null?void 0:M.menu)===null||o===void 0?void 0:o.options.filter($=>$ instanceof Yt);if(x=A==null?void 0:A.find($=>$.title===e),!x)throw new v(`Sort option "${e}" not found`,{available_filters:A.map($=>$.title)})}else e instanceof Yt&&(x=e);if(!x)throw new v("Invalid sort option");if(x.selected)return this;let T=(p=(l=(r=(s=x.endpoint)===null||s===void 0?void 0:s.payload)===null||r===void 0?void 0:r.commands)===null||l===void 0?void 0:l.find(M=>M.browseSectionListReloadEndpoint))===null||p===void 0?void 0:p.browseSectionListReloadEndpoint;if(!T)throw new v("Failed to find sort option command");let k=yield d(this,go,"f").execute("/browse",{client:"YTMUSIC",continuation:T.continuation.reloadContinuationData.continuation,parse:!0}),C=(h=(f=d(this,pi,"f").contents_memo)===null||f===void 0?void 0:f.getType(Yt))===null||h===void 0?void 0:h.find(M=>M.selected);return C&&(C.selected=!1),x.selected=!0,this.contents=(b=(m=k.continuation_contents)===null||m===void 0?void 0:m.as(pt).contents)===null||b===void 0?void 0:b.as(Uo,Te),this})}applyFilter(e){var i,o,s,r;return y(this,void 0,void 0,function*(){let l,p=(i=d(this,pi,"f").contents_memo)===null||i===void 0?void 0:i.getType(vt).first();if(typeof e=="string"){if(l=p==null?void 0:p.chips.get({text:e}),!l)throw new v(`Filter "${e}" not found`,{available_filters:this.filters})}else e instanceof xe&&(l=e);if(!l)throw new v("Invalid filter",e);let h=yield new g((r=(s=(o=l.endpoint)===null||o===void 0?void 0:o.payload)===null||s===void 0?void 0:s.commands)===null||r===void 0?void 0:r[0]).call(d(this,go,"f"),{client:"YTMUSIC"});return new cr(h,d(this,go,"f"))})}getContinuation(){return y(this,void 0,void 0,function*(){if(!d(this,ar,"f"))throw new v("No continuation available");let e=yield d(this,go,"f").execute("/browse",{client:"YTMUSIC",continuation:d(this,ar,"f")});return new vn(e,d(this,go,"f"))})}get has_continuation(){return!!d(this,ar,"f")}get sort_options(){var e,i;let o=(e=d(this,pi,"f").contents_memo)===null||e===void 0?void 0:e.getType(ff).first();return((i=o==null?void 0:o.menu)===null||i===void 0?void 0:i.options.filter(r=>r instanceof Yt)).map(r=>r.title)}get filters(){var e,i;return((i=(e=d(this,pi,"f").contents_memo)===null||e===void 0?void 0:e.getType(vt))===null||i===void 0?void 0:i.first().chips.map(o=>o.text))||[]}get page(){return d(this,pi,"f")}};n(cr,"Library");pi=new WeakMap,go=new WeakMap,ar=new WeakMap;var vn=class{constructor(e,i){if(ur.set(this,void 0),Zh.set(this,void 0),lr.set(this,void 0),I(this,ur,c.parseResponse(e.data),"f"),I(this,Zh,i,"f"),!d(this,ur,"f").continuation_contents)throw new v("No continuation contents found");this.contents=d(this,ur,"f").continuation_contents.as(li,so),I(this,lr,this.contents.continuation||null,"f")}getContinuation(){return y(this,void 0,void 0,function*(){if(!d(this,lr,"f"))throw new v("No continuation available");let e=yield d(this,Zh,"f").execute("/browse",{client:"YTMUSIC",continuation:d(this,lr,"f")});return new vn(e,d(this,Zh,"f"))})}get has_continuation(){return!!d(this,lr,"f")}get page(){return d(this,ur,"f")}};n(vn,"LibraryContinuation");ur=new WeakMap,Zh=new WeakMap,lr=new WeakMap;var Bx=cr;var Wb,xt,xn,gn,dr,e_,p1,pr=class{constructor(e,i){var o,s,r,l,p,f,h;if(Wb.add(this),xt.set(this,void 0),xn.set(this,void 0),gn.set(this,void 0),dr.set(this,void 0),e_.set(this,void 0),I(this,xn,i,"f"),I(this,xt,c.parseResponse(e.data),"f"),I(this,dr,null,"f"),I(this,e_,null,"f"),d(this,xt,"f").continuation_contents){let m=(o=d(this,xt,"f").continuation_contents)===null||o===void 0?void 0:o.as(no);this.items=m.contents,I(this,gn,m.continuation,"f")}else((s=d(this,xt,"f").header)===null||s===void 0?void 0:s.item().type)==="MusicEditablePlaylistDetailHeader"?this.header=(l=(r=d(this,xt,"f").header)===null||r===void 0?void 0:r.item().as(ig).header)===null||l===void 0?void 0:l.as(Go):this.header=(p=d(this,xt,"f").header)===null||p===void 0?void 0:p.item().as(Go),this.items=((f=d(this,xt,"f").contents_memo)===null||f===void 0?void 0:f.getType(zo).first().contents)||null,I(this,gn,((h=d(this,xt,"f").contents_memo)===null||h===void 0?void 0:h.getType(zo).first().continuation)||null,"f")}getContinuation(){return y(this,void 0,void 0,function*(){if(!d(this,gn,"f"))throw new v("Continuation not found.");let e=yield d(this,xn,"f").execute("/browse",{client:"YTMUSIC",continuation:d(this,gn,"f")});return new pr(e,d(this,xn,"f"))})}getRelated(){var e,i,o,s,r;return y(this,void 0,void 0,function*(){let l=(i=(e=d(this,xt,"f").contents_memo)===null||e===void 0?void 0:e.getType(Q))===null||i===void 0?void 0:i[0].continuation;for(;l;){let f=(o=(yield d(this,xn,"f").execute("/browse",{client:"YTMUSIC",continuation:l,parse:!0})).continuation_contents)===null||o===void 0?void 0:o.as(pt),h=(s=f==null?void 0:f.contents)===null||s===void 0?void 0:s.as(Ue,Te),m=(r=h==null?void 0:h.matchCondition(b=>b.is(Ue)))===null||r===void 0?void 0:r.as(Ue);if(m)return m;l=f==null?void 0:f.continuation}throw new v("Target section not found.")})}getSuggestions(e=!0){return y(this,void 0,void 0,function*(){let s=yield e||!d(this,dr,"f")?d(this,Wb,"m",p1).call(this):Promise.resolve(null);return s&&(I(this,dr,s.items,"f"),I(this,e_,s.continuation,"f")),(s==null?void 0:s.items)||d(this,dr,"f")})}get page(){return d(this,xt,"f")}get has_continuation(){return!!d(this,gn,"f")}};n(pr,"Playlist");xt=new WeakMap,xn=new WeakMap,gn=new WeakMap,dr=new WeakMap,e_=new WeakMap,Wb=new WeakSet,p1=n(function(){var e,i,o,s,r;return y(this,void 0,void 0,function*(){let l=d(this,e_,"f")||((i=(e=d(this,xt,"f").contents_memo)===null||e===void 0?void 0:e.get("SectionList"))===null||i===void 0?void 0:i[0].as(Q).continuation);if(l){let f=(o=(yield d(this,xn,"f").execute("/browse",{client:"YTMUSIC",continuation:l,parse:!0})).continuation_contents)===null||o===void 0?void 0:o.as(pt),h=(s=f==null?void 0:f.contents)===null||s===void 0?void 0:s.as(Ue,Te),m=(r=h==null?void 0:h.matchCondition(b=>b.is(Te)))===null||r===void 0?void 0:r.as(Te);return{items:(m==null?void 0:m.contents)||[],continuation:(m==null?void 0:m.continuation)||null}}return{items:[],continuation:null}})},"_Playlist_fetchSuggestions");var fr=pr;var xo,t_,Fx=class{constructor(e,i){var o,s,r,l,p,f,h;xo.set(this,void 0),t_.set(this,void 0),I(this,xo,c.parseResponse(e.data),"f"),I(this,t_,i,"f");let m=(o=d(this,xo,"f").header)===null||o===void 0?void 0:o.item();this.header=m!=null&&m.is(Xp)?(l=(r=(s=d(this,xo,"f").header)===null||s===void 0?void 0:s.item().as(Xp).element)===null||r===void 0?void 0:r.model)===null||l===void 0?void 0:l.as(td):(p=d(this,xo,"f").header)===null||p===void 0?void 0:p.item().as(Qi);let b=(f=d(this,xo,"f").contents)===null||f===void 0?void 0:f.item().as(ri).tabs.firstOfType(be);if(!b)throw new v("Target tab not found");this.sections=(h=b.content)===null||h===void 0?void 0:h.as(Q).contents.as(ye,Ue,Ge)}getPlaylist(){return y(this,void 0,void 0,function*(){if(!this.header)throw new v("Header not found");if(!this.header.is(td))throw new v("Recap playlist not available, check back later.");let i=yield this.header.panels[0].text_on_tap_endpoint.call(d(this,t_,"f"),{client:"YTMUSIC"});return new fr(i,d(this,t_,"f"))})}get page(){return d(this,xo,"f")}};n(Fx,"Recap");xo=new WeakMap,t_=new WeakMap;var Yx=Fx;var fi,Ei,mr,i_,hr,yn=class{constructor(e,i,o){var s,r,l;if(fi.set(this,void 0),Ei.set(this,void 0),mr.set(this,void 0),I(this,Ei,i,"f"),I(this,fi,c.parseResponse(e.data),"f"),!d(this,fi,"f").contents||!d(this,fi,"f").contents_memo)throw new v("Response did not contain any contents.");let p=d(this,fi,"f").contents.item().as(Bg).tabs.get({selected:!0});if(!p)throw new v("Could not find target tab.");let f=(s=p.content)===null||s===void 0?void 0:s.as(Q);if(!f)throw new v("Target tab did not have any content.");this.header=(r=f.header)===null||r===void 0?void 0:r.as(vt),this.contents=f.contents.as(Te,X0,ye),o&&I(this,mr,(l=this.contents.firstOfType(Te))===null||l===void 0?void 0:l.continuation,"f")}getMore(e){return y(this,void 0,void 0,function*(){if(!e||!e.endpoint)throw new v("Cannot retrieve more items for this shelf because it does not have an endpoint.");let i=yield e.endpoint.call(d(this,Ei,"f"),{client:"YTMUSIC"});if(!i)throw new v("Endpoint did not return any data");return new yn(i,d(this,Ei,"f"),!0)})}getContinuation(){return y(this,void 0,void 0,function*(){if(!d(this,mr,"f"))throw new v("Continuation not found.");let e=yield d(this,Ei,"f").execute("/search",{continuation:d(this,mr,"f"),client:"YTMUSIC"});return new _r(d(this,Ei,"f"),e)})}applyFilter(e){var i,o;return y(this,void 0,void 0,function*(){let s;if(typeof e=="string"){if(s=(o=(i=this.header)===null||i===void 0?void 0:i.chips)===null||o===void 0?void 0:o.as(xe).get({text:e}),!s)throw new v("Could not find filter with given name.",{available_filters:this.filters})}else e!=null&&e.is(xe)&&(s=e);if(!s)throw new v("Invalid filter",{available_filters:this.filters});if(s!=null&&s.is_selected)return this;if(!s.endpoint)throw new v("Selected filter does not have an endpoint.");let r=yield s.endpoint.call(d(this,Ei,"f"),{client:"YTMUSIC"});return new yn(r,d(this,Ei,"f"),!0)})}get filters(){var e,i;return((i=(e=this.header)===null||e===void 0?void 0:e.chips)===null||i===void 0?void 0:i.as(xe).map(o=>o.text))||[]}get has_continuation(){return!!d(this,mr,"f")}get did_you_mean(){var e;return(e=d(this,fi,"f").contents_memo)===null||e===void 0?void 0:e.getType(t0).first()}get showing_results_for(){var e;return(e=d(this,fi,"f").contents_memo)===null||e===void 0?void 0:e.getType(Og).first()}get message(){var e;return(e=d(this,fi,"f").contents_memo)===null||e===void 0?void 0:e.getType(Ge).first()}get songs(){var e;return(e=this.contents)===null||e===void 0?void 0:e.filterType(Te).find(i=>i.title.toString()==="Songs")}get videos(){var e;return(e=this.contents)===null||e===void 0?void 0:e.filterType(Te).find(i=>i.title.toString()==="Videos")}get albums(){var e;return(e=this.contents)===null||e===void 0?void 0:e.filterType(Te).find(i=>i.title.toString()==="Albums")}get artists(){var e;return(e=this.contents)===null||e===void 0?void 0:e.filterType(Te).find(i=>i.title.toString()==="Artists")}get playlists(){var e;return(e=this.contents)===null||e===void 0?void 0:e.filterType(Te).find(i=>i.title.toString()==="Community playlists")}get results(){var e,i;return(i=(e=this.contents)===null||e===void 0?void 0:e.firstOfType(Te))===null||i===void 0?void 0:i.contents}get sections(){var e;return(e=this.contents)===null||e===void 0?void 0:e.filterType(Te)}get page(){return d(this,fi,"f")}};n(yn,"Search");fi=new WeakMap,Ei=new WeakMap,mr=new WeakMap;var jx=yn,_r=class{constructor(e,i){var o,s;i_.set(this,void 0),hr.set(this,void 0),I(this,i_,e,"f"),I(this,hr,c.parseResponse(i.data),"f"),this.header=(o=d(this,hr,"f").header)===null||o===void 0?void 0:o.item().as(Qi),this.contents=(s=d(this,hr,"f").continuation_contents)===null||s===void 0?void 0:s.as(li)}getContinuation(){var e;return y(this,void 0,void 0,function*(){if(!(!((e=this.contents)===null||e===void 0)&&e.continuation))throw new v("Continuation not found.");let i=yield d(this,i_,"f").execute("/search",{continuation:this.contents.continuation,client:"YTMUSIC"});return new _r(d(this,i_,"f"),i)})}get has_continuation(){var e;return!!(!((e=this.contents)===null||e===void 0)&&e.continuation)}get page(){return d(this,hr,"f")}};n(_r,"SearchContinuation");i_=new WeakMap,hr=new WeakMap;var Ux=class extends fo{constructor(e,i,o){var s,r,l,p,f,h,m,b,x;super(e,i,o);let[T,k]=this.page;if(!(!((s=T.microformat)===null||s===void 0)&&s.is(ii)))throw new v("Invalid microformat",T.microformat);if(this.basic_info=Object.assign(Object.assign({},T.video_details),{description:(r=T.microformat)===null||r===void 0?void 0:r.description,is_unlisted:(l=T.microformat)===null||l===void 0?void 0:l.is_unlisted,is_family_safe:(p=T.microformat)===null||p===void 0?void 0:p.is_family_safe,url_canonical:(f=T.microformat)===null||f===void 0?void 0:f.url_canonical,tags:(h=T.microformat)===null||h===void 0?void 0:h.tags}),this.storyboards=T.storyboards,this.endscreen=T.endscreen,k){let C=(b=(m=k.contents_memo)===null||m===void 0?void 0:m.getType(Hg))===null||b===void 0?void 0:b[0];this.tabs=C==null?void 0:C.tabs.array().as(be),this.current_video_endpoint=k.current_video_endpoint,this.player_overlays=(x=k.player_overlays)===null||x===void 0?void 0:x.item().as(Zi)}}getTab(e){var i,o;return y(this,void 0,void 0,function*(){if(!this.tabs)throw new v("Could not find any tab");let s=this.tabs.get({title:e})||this.tabs.matchCondition(l=>{var p,f;return((f=(p=l.endpoint.payload.browseEndpointContextSupportedConfigs)===null||p===void 0?void 0:p.browseEndpointContextMusicConfig)===null||f===void 0?void 0:f.pageType)===e})||((i=this.tabs)===null||i===void 0?void 0:i[0]);if(!s)throw new v(`Tab "${e}" not found`,{available_tabs:this.available_tabs});if(s.content)return s.content;let r=yield s.endpoint.call(this.actions,{client:"YTMUSIC",parse:!0});if(((o=r.contents)===null||o===void 0?void 0:o.item().type)==="Message")return r.contents.item().as(Ge);if(!r.contents)throw new v("Page contents was empty",r);return r.contents.item().as(Q).contents})}getUpNext(e=!0){var i,o;return y(this,void 0,void 0,function*(){let s=yield this.getTab("Up next");if(!s||!s.content)throw new v("Music queue was empty, the video id is probably invalid.",s);let r=s.content.as(ni);if(!r.playlist_id&&e){let l=r.contents.firstOfType(Bi);if(!l)throw new v("Automix item not found");let p=yield(i=l.playlist_video)===null||i===void 0?void 0:i.endpoint.call(this.actions,{videoId:this.basic_info.id,client:"YTMUSIC",parse:!0});if(!p||!p.contents_memo)throw new v("Could not fetch automix");return(o=p.contents_memo.getType(ni))===null||o===void 0?void 0:o[0]}return r})}getRelated(){return y(this,void 0,void 0,function*(){return yield this.getTab("MUSIC_PAGE_TYPE_TRACK_RELATED")})}getLyrics(){return y(this,void 0,void 0,function*(){return(yield this.getTab("MUSIC_PAGE_TYPE_TRACK_LYRICS")).firstOfType(Xi)})}addToWatchHistory(){let e=Object.create(null,{addToWatchHistory:{get:()=>super.addToWatchHistory}});return y(this,void 0,void 0,function*(){return e.addToWatchHistory.call(this,X.CLIENTS.YTMUSIC.NAME,X.CLIENTS.YTMUSIC.VERSION,"https://music.")})}get available_tabs(){return this.tabs?this.tabs.map(e=>e.title):[]}};n(Ux,"TrackInfo");var o_=Ux;var Jb={};B(Jb,{Channel:()=>Wx,HomeFeed:()=>Hx,Search:()=>Gx,VideoInfo:()=>$x});var vr=class extends _e{constructor(e,i,o=!1){var s,r;super(e,i,o),this.header=(s=this.page.header)===null||s===void 0?void 0:s.item().as(Wi),this.contents=this.memo.getType(ye).first()||((r=this.page.continuation_contents)===null||r===void 0?void 0:r.as(to))}getContinuation(){var e;return y(this,void 0,void 0,function*(){let i=yield this.actions.execute("/browse",{continuation:(e=this.contents)===null||e===void 0?void 0:e.continuation,client:"YTKIDS"});return new vr(this.actions,i)})}get has_continuation(){var e;return!!(!((e=this.contents)===null||e===void 0)&&e.continuation)}};n(vr,"Channel");var Wx=vr;var gr=class extends _e{constructor(e,i,o=!1){var s,r;super(e,i,o),this.header=(s=this.page.header)===null||s===void 0?void 0:s.item().as(Gg),this.contents=(r=this.page.contents)===null||r===void 0?void 0:r.item().as(zg)}selectCategoryTab(e){var i;return y(this,void 0,void 0,function*(){let o;if(typeof e=="string"?o=(i=this.header)===null||i===void 0?void 0:i.category_tabs.find(r=>r.title.toString()===e):e!=null&&e.is(Ws)&&(o=e),!o)throw new v(`Tab "${e}" not found`);let s=yield o.endpoint.call(this.actions,{client:"YTKIDS",parse:!0});return s.header=this.page.header,s.header_memo=this.page.header_memo,new gr(this.actions,s,!0)})}get categories(){var e;return((e=this.header)===null||e===void 0?void 0:e.category_tabs.map(i=>i.title.toString()))||[]}};n(gr,"HomeFeed");var Hx=gr;var Jx=class extends _e{constructor(e,i){super(e,i),this.estimated_results=this.page.estimated_results;let o=this.memo.getType(ye).first();if(!o)throw new v("No item section found in search response.");this.contents=o.contents}};n(Jx,"Search");var Gx=Jx;var zx=class extends fo{constructor(e,i,o){var s,r,l,p,f;super(e,i,o);let[h,m]=this.page;this.basic_info=h.video_details,this.captions=h.captions;let b=(s=m==null?void 0:m.contents)===null||s===void 0?void 0:s.item().as(Ys),x=b==null?void 0:b.results,T=b==null?void 0:b.secondary_results;x&&T&&(this.slim_video_metadata=(l=(r=x.firstOfType(ye))===null||r===void 0?void 0:r.contents)===null||l===void 0?void 0:l.firstOfType(Dg),this.watch_next_feed=((p=T.firstOfType(ye))===null||p===void 0?void 0:p.contents)||T,this.current_video_endpoint=m==null?void 0:m.current_video_endpoint,this.player_overlays=(f=m==null?void 0:m.player_overlays)===null||f===void 0?void 0:f.item().as(Zi))}addToWatchHistory(){let e=Object.create(null,{addToWatchHistory:{get:()=>super.addToWatchHistory}});return y(this,void 0,void 0,function*(){return e.addToWatchHistory.call(this)})}};n(zx,"VideoInfo");var $x=zx;var zb={};B(zb,{VideoInfo:()=>dy});var Gb={};B(Gb,{Account:()=>Tn,Browse:()=>qx,BrowseEndpoint:()=>F,Channel:()=>Pi,Comment:()=>Zx,GetNotificationMenuEndpoint:()=>bn,GuideEndpoint:()=>xr,Kids:()=>uy,Like:()=>ey,Music:()=>ty,NextEndpoint:()=>Ce,Notification:()=>yr,PlayerEndpoint:()=>st,Playlist:()=>oy,Reel:()=>Pt,ResolveURLEndpoint:()=>wn,SearchEndpoint:()=>yt,Subscription:()=>ny,Upload:()=>ay});var F={};B(F,{PATH:()=>RE,build:()=>ME});var RE="/browse";function ME(t){return Object.assign({browseId:t.browse_id,params:t.params,continuation:t.continuation,client:t.client})}n(ME,"build");var bn={};B(bn,{PATH:()=>VE,build:()=>OE});var VE="/notification/get_notification_menu";function OE(t){return Object.assign({notificationsMenuRequestType:t.notifications_menu_request_type})}n(OE,"build");var xr={};B(xr,{PATH:()=>DE});var DE="/guide";var Ce={};B(Ce,{PATH:()=>LE,build:()=>BE});var LE="/next";function BE(t){return Object.assign({videoId:t.video_id,playlistId:t.playlist_id,params:t.params,playlistIndex:t.playlist_index,client:t.client,continuation:t.continuation})}n(BE,"build");var st={};B(st,{PATH:()=>FE,build:()=>YE});var FE="/player";function YE(t){return Object.assign({playbackContext:{contentPlaybackContext:Object.assign({vis:0,splay:!1,referer:t.playlist_id?`https://www.youtube.com/watch?v=${t.video_id}&list=${t.playlist_id}`:`https://www.youtube.com/watch?v=${t.video_id}`,currentUrl:t.playlist_id?`/watch?v=${t.video_id}&list=${t.playlist_id}`:`/watch?v=${t.video_id}`,autonavState:"STATE_ON",autoCaptionsDefaultOn:!1,html5Preference:"HTML5_PREF_WANTS",lactMilliseconds:"-1"},{signatureTimestamp:t.sts})},attestationRequest:{omitBotguardData:!0},racyCheckOk:!0,contentCheckOk:!0,videoId:t.video_id},{client:t.client,playlistId:t.playlist_id,params:t.params})}n(YE,"build");var wn={};B(wn,{PATH:()=>jE,build:()=>UE});var jE="/navigation/resolve_url";function UE(t){return Object.assign({url:t.url})}n(UE,"build");var yt={};B(yt,{PATH:()=>WE,build:()=>HE});var WE="/search";function HE(t){return Object.assign({query:t.query,params:t.params,continuation:t.continuation,client:t.client})}n(HE,"build");var Tn={};B(Tn,{AccountListEndpoint:()=>Kx});var Kx={};B(Kx,{PATH:()=>JE,build:()=>GE});var JE="/account/accounts_list";function GE(){return{client:"ANDROID"}}n(GE,"build");var qx={};B(qx,{EditPlaylistEndpoint:()=>rt});var rt={};B(rt,{PATH:()=>zE,build:()=>$E});var zE="/browse/edit_playlist";function $E(t){return{playlistId:t.playlist_id,actions:t.actions.map(e=>Object.assign({action:e.action},{addedVideoId:e.added_video_id,setVideoId:e.set_video_id,movedSetVideoIdPredecessor:e.moved_set_video_id_predecessor,playlistDescription:e.playlist_description,playlistName:e.playlist_name}))}}n($E,"build");var Pi={};B(Pi,{EditDescriptionEndpoint:()=>Qx,EditNameEndpoint:()=>Xx});var Xx={};B(Xx,{PATH:()=>KE,build:()=>qE});var KE="/channel/edit_name";function qE(t){return{givenName:t.given_name,client:"ANDROID"}}n(qE,"build");var Qx={};B(Qx,{PATH:()=>XE,build:()=>QE});var XE="/channel/edit_description";function QE(t){return{givenDescription:t.given_description,client:"ANDROID"}}n(QE,"build");var Zx={};B(Zx,{CreateCommentEndpoint:()=>kn,PerformCommentActionEndpoint:()=>In});var In={};B(In,{PATH:()=>ZE,build:()=>eP});var ZE="/comment/perform_comment_action";function eP(t){return Object.assign({actions:t.actions},{client:t.client})}n(eP,"build");var kn={};B(kn,{PATH:()=>tP,build:()=>iP});var tP="/comment/create_comment";function iP(t){return Object.assign({commentText:t.comment_text,createCommentParams:t.create_comment_params},{client:t.client})}n(iP,"build");var ey={};B(ey,{DislikeEndpoint:()=>Cn,LikeEndpoint:()=>Sn,RemoveLikeEndpoint:()=>En});var Sn={};B(Sn,{PATH:()=>oP,build:()=>nP});var oP="/like/like";function nP(t){return Object.assign({target:{videoId:t.target.video_id}},{client:t.client})}n(nP,"build");var Cn={};B(Cn,{PATH:()=>sP,build:()=>rP});var sP="/like/dislike";function rP(t){return Object.assign({target:{videoId:t.target.video_id}},{client:t.client})}n(rP,"build");var En={};B(En,{PATH:()=>aP,build:()=>uP});var aP="/like/removelike";function uP(t){return Object.assign({target:{videoId:t.target.video_id}},{client:t.client})}n(uP,"build");var ty={};B(ty,{GetSearchSuggestionsEndpoint:()=>Pn});var Pn={};B(Pn,{PATH:()=>lP,build:()=>cP});var lP="/music/get_search_suggestions";function cP(t){return{input:t.input,client:"YTMUSIC"}}n(cP,"build");var yr={};B(yr,{GetUnseenCountEndpoint:()=>iy,ModifyChannelPreferenceEndpoint:()=>Nn});var iy={};B(iy,{PATH:()=>dP});var dP="/notification/get_unseen_count";var Nn={};B(Nn,{PATH:()=>pP,build:()=>fP});var pP="/notification/modify_channel_preference";function fP(t){return Object.assign({params:t.params},{client:t.client})}n(fP,"build");var oy={};B(oy,{CreateEndpoint:()=>An,DeleteEndpoint:()=>Rn});var An={};B(An,{PATH:()=>mP,build:()=>hP});var mP="/playlist/create";function hP(t){return{title:t.title,ids:t.ids}}n(hP,"build");var Rn={};B(Rn,{PATH:()=>_P,build:()=>vP});var _P="/playlist/delete";function vP(t){return{playlistId:t.playlist_id}}n(vP,"build");var ny={};B(ny,{SubscribeEndpoint:()=>Mn,UnsubscribeEndpoint:()=>Vn});var Mn={};B(Mn,{PATH:()=>gP,build:()=>xP});var gP="/subscription/subscribe";function xP(t){return Object.assign({channelIds:t.channel_ids},{client:t.client,params:t.params})}n(xP,"build");var Vn={};B(Vn,{PATH:()=>yP,build:()=>bP});var yP="/subscription/unsubscribe";function bP(t){return Object.assign({channelIds:t.channel_ids},{client:t.client,params:t.params})}n(bP,"build");var Pt={};B(Pt,{WatchEndpoint:()=>sy,WatchSequenceEndpoint:()=>ry});var sy={};B(sy,{PATH:()=>wP,build:()=>TP});var wP="/reel/reel_item_watch";function TP(t){var e,i;return{playerRequest:{videoId:t.short_id,params:(e=t.params)!==null&&e!==void 0?e:"CAUwAg%3D%3D"},params:(i=t.params)!==null&&i!==void 0?i:"CAUwAg%3D%3D"}}n(TP,"build");var ry={};B(ry,{PATH:()=>IP,build:()=>kP});var IP="/reel/reel_watch_sequence";function kP(t){return{sequenceParams:t.sequenceParams}}n(kP,"build");var ay={};B(ay,{CreateVideoEndpoint:()=>On});var On={};B(On,{PATH:()=>SP,build:()=>CP});var SP="/upload/createvideo";function CP(t){return Object.assign({resourceId:{scottyResourceId:{id:t.resource_id.scotty_resource_id.id}},frontendUploadId:t.frontend_upload_id,initialMetadata:{title:{newTitle:t.initial_metadata.title.new_title},description:{newDescription:t.initial_metadata.description.new_description,shouldSegment:t.initial_metadata.description.should_segment},privacy:{newPrivacy:t.initial_metadata.privacy.new_privacy},draftState:{isDraft:!!t.initial_metadata.draft_state.is_draft}}},{client:t.client})}n(CP,"build");var uy={};B(uy,{BlocklistPickerEndpoint:()=>Dn});var Dn={};B(Dn,{PATH:()=>EP,build:()=>PP});var EP="/kids/get_kids_blocklist_picker";function PP(t){return{blockedForKidsContent:{external_channel_id:t.channel_id}}}n(PP,"build");var br,ly,cy=class{constructor(e,i){var o,s;br.set(this,void 0),ly.set(this,void 0),I(this,ly,i,"f");let r=c.parseResponse(e[0].data),l=c.parseResponse(e[1].data);this.basic_info=r.video_details,this.watch_next_feed=(o=l.entries)===null||o===void 0?void 0:o.array(),I(this,br,(s=l.continuation_endpoint)===null||s===void 0?void 0:s.as(Ti),"f")}getWatchNextContinuation(){var e,i;return y(this,void 0,void 0,function*(){if(!d(this,br,"f"))throw new v("Watch next feed continuation not found");let o=yield d(this,ly,"f").execute(Pt.WatchSequenceEndpoint.PATH,Pt.WatchSequenceEndpoint.build({sequenceParams:d(this,br,"f").token}));if(!o.success)throw new v("Continue failed ",o.status_code);let s=c.parseResponse(o.data);return this.watch_next_feed=(e=s.entries)===null||e===void 0?void 0:e.array(),I(this,br,(i=s.continuation_endpoint)===null||i===void 0?void 0:i.as(Ti),"f"),this})}};n(cy,"VideoInfo");br=new WeakMap,ly=new WeakMap;var dy=cy;var V=class{constructor(e,i,o,s){var r,l,p,f,h,m,b,x,T,k,C,M,A,$,D,le,ve,ke,Pe,De,K,z,Z,se,Fe,_t,Tt;let q=new u(e);this.id=s||((f=(p=(l=(r=q==null?void 0:q.runs)===null||r===void 0?void 0:r[0])===null||l===void 0?void 0:l.endpoint)===null||p===void 0?void 0:p.payload)===null||f===void 0?void 0:f.browseId)||((m=(h=q==null?void 0:q.endpoint)===null||h===void 0?void 0:h.payload)===null||m===void 0?void 0:m.browseId)||"N/A",this.name=(q==null?void 0:q.text)||"N/A",this.thumbnails=o?w.fromResponse(o):[],this.endpoint=((x=(b=q==null?void 0:q.runs)===null||b===void 0?void 0:b[0])===null||x===void 0?void 0:x.endpoint)||(q==null?void 0:q.endpoint),i?Array.isArray(i)?(this.badges=c.parseArray(i),this.is_moderator=(T=this.badges)===null||T===void 0?void 0:T.some(ze=>ze.icon_type=="MODERATOR"),this.is_verified=(k=this.badges)===null||k===void 0?void 0:k.some(ze=>ze.style=="BADGE_STYLE_TYPE_VERIFIED"),this.is_verified_artist=(C=this.badges)===null||C===void 0?void 0:C.some(ze=>ze.style=="BADGE_STYLE_TYPE_VERIFIED_ARTIST")):(this.badges=re([]),this.is_verified=!!i.isVerified,this.is_verified_artist=!!i.isArtist):this.badges=re([]),this.url=((D=($=(A=(M=q==null?void 0:q.runs)===null||M===void 0?void 0:M[0])===null||A===void 0?void 0:A.endpoint)===null||$===void 0?void 0:$.metadata)===null||D===void 0?void 0:D.api_url)==="/browse"&&`${lt.YT_BASE}${((Pe=(ke=(ve=(le=q==null?void 0:q.runs)===null||le===void 0?void 0:le[0])===null||ve===void 0?void 0:ve.endpoint)===null||ke===void 0?void 0:ke.payload)===null||Pe===void 0?void 0:Pe.canonicalBaseUrl)||`/u/${(Z=(z=(K=(De=q==null?void 0:q.runs)===null||De===void 0?void 0:De[0])===null||K===void 0?void 0:K.endpoint)===null||z===void 0?void 0:z.payload)===null||Z===void 0?void 0:Z.browseId}`}`||`${lt.YT_BASE}${((Fe=(se=q==null?void 0:q.endpoint)===null||se===void 0?void 0:se.payload)===null||Fe===void 0?void 0:Fe.canonicalBaseUrl)||`/u/${(Tt=(_t=q==null?void 0:q.endpoint)===null||_t===void 0?void 0:_t.payload)===null||Tt===void 0?void 0:Tt.browseId}`}`}get best_thumbnail(){return this.thumbnails[0]}};n(V,"Author");var f1={desktop:["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.61","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"],mobile:["Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1","Mozilla/5.0 (Linux; Android 12; SM-G990U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 13; SM-G998B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36","Mozilla/5.0 (iPhone; CPU iPhone OS 16_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/108.1 Mobile/15E148 Safari/605.1.15","Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 ChannelId(73) NebulaSDK/1.8.100112 Nebula PSDType(1) AlipayDefined(nt:4G,ws:320|504|2.0) AliApp(AP/10.1.30.300) AlipayClient/10.1.30.300 Alipay Language/zh-Hans","Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1","Mozilla/5.0 (Linux; Android 13; SM-N981U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 13; SM-A515F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36","Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1","Mozilla/5.0 (Linux; Android 12; M2010J19SG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36","Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1","Mozilla/5.0 (Linux; Android 11; M2102J20SG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36","Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Mobile/15E148 Safari/604.1"]};var py,fy,NP="Utils",L=class{static load(e){I(L,py,e,"f",fy)}static get shim(){if(!d(L,py,"f",fy))throw new Error("Platform is not loaded");return d(L,py,"f",fy)}};n(L,"Platform");py=L;fy={value:void 0};var v=class extends Error{constructor(e,i){super(e),i&&(this.info=i),this.date=new Date,this.version=L.shim.info.version}};n(v,"InnertubeError");var kt=class extends v{};n(kt,"ParsingError");var Ln=class extends v{};n(Ln,"MissingParamError");var mi=class extends v{};n(mi,"OAuthError");var zt=class extends Error{};n(zt,"PlayerError");var wr=class extends Error{};n(wr,"SessionError");var Ks=class extends Error{};n(Ks,"ChannelError");function g_(t,e){return Reflect.ownKeys(t).some(o=>{let s=e[o]instanceof u;return!s&&typeof e[o]=="object"?JSON.stringify(t[o])===JSON.stringify(e[o]):t[o]===(s?e[o].toString():e[o])})}n(g_,"deepCompare");function Ye(t,e,i){let o=new RegExp(`${Kb(e)}(.*?)${Kb(i)}`,"s"),s=t.match(o);return s?s[1]:void 0}n(Ye,"getStringBetweenStrings");function Kb(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}n(Kb,"escapeStringRegexp");function Ao(t){let e=f1[t],i=Math.floor(Math.random()*e.length);return e[i]}n(Ao,"getRandomUserAgent");function eb(t){return y(this,void 0,void 0,function*(){let e="https://www.youtube.com",i=Math.floor(new Date().getTime()/1e3),o=[i,t,e].join(" "),s=yield L.shim.sha1Hash(o);return["SAPISIDHASH",[i,s].join("_")].join(" ")})}n(eb,"generateSidAuth");function Nt(t){let e=[],i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";for(let o=0;o<t;o++)e.push(i.charAt(Math.floor(Math.random()*i.length)));return e.join("")}n(Nt,"generateRandomString");function je(t){let e=t.split(":").map(i=>parseInt(i.replace(/\D/g,"")));switch(e.length){case 1:return e[0];case 2:return e[0]*60+e[1];case 3:return e[0]*3600+e[1]*60+e[2];default:throw new Error("Invalid time string")}}n(je,"timeToSeconds");function Bb(...t){let e=new Oi;for(let i of t)if(!!i)for(let o of i){let s=e.get(o[0]);if(s){e.set(o[0],[...s,...o[1]]);continue}e.set(...o)}return e}n(Bb,"concatMemos");function ie(t){for(let[e,i]of Object.entries(t))if(!i)throw new Ln(`${e} is missing`)}n(ie,"throwIfMissing");function AP(t,...e){for(let i of e)if(!Reflect.has(t,i)||t[i]===void 0)return!1;return!0}n(AP,"hasKeys");function Xy(t){return Mw(this,arguments,n(function*(){let i=t.getReader();try{for(;;){let{done:o,value:s}=yield ko(i.read());if(o)return yield ko(void 0);yield yield ko(s)}}finally{i.releaseLock()}},"streamToIterable_1"))}n(Xy,"streamToIterable");var RP=n((t,e)=>{let i=typeof t=="string"?new URL(t):t instanceof URL?t:new URL(t.url),o=e!=null&&e.headers?new Headers(e.headers):t instanceof Request?t.headers:new Headers,s=[...o],r=e!=null&&e.body?typeof e.body=="string"?o.get("content-type")==="application/json"?JSON.stringify(JSON.parse(e.body),null,2):e.body:" <binary>":" (none)",l=s.length>0?`${s.map(([p,f])=>` ${p}: ${f}`).join(`
|
|
`)}`:" (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';" ".ts';" ./deno -r && npx replace '.js";' '.ts";' ./deno -r && npx replace "'./DashManifest.ts';" "'./DashManifest.js';" ./deno -r && npx replace "'jintr';" "'https://esm.sh/jintr';" ./deno -r`,"bundle:node":'npx esbuild ./dist/src/platform/node.js --bundle --target=node10 --keep-names --format=cjs --platform=node --outfile=./bundle/node.cjs --external:jintr --external:undici --external:linkedom --external:tslib --sourcemap --banner:js="/* eslint-disable */"',"bundle:browser":'npx esbuild ./dist/src/platform/web.js --banner:js="/* eslint-disable */" --bundle --target=chrome58 --keep-names --format=esm --sourcemap --define:global=globalThis --conditions=module --outfile=./bundle/browser.js --platform=browser',"bundle:browser:prod":"npm run bundle:browser -- --outfile=./bundle/browser.min.js --minify","bundle:cf-worker":'npx esbuild ./dist/src/platform/cf-worker.js --banner:js="/* eslint-disable */" --bundle --target=es2020 --keep-names --format=esm --sourcemap --define:global=globalThis --conditions=module --outfile=./bundle/cf-worker.js --platform=node',prepare:"npm run build",watch:"npx tsc --watch"},repository:{type:"git",url:"git+https://github.com/LuanRT/YouTube.js.git"},license:"MIT",dependencies:{jintr:"^1.1.0",tslib:"^2.5.0",undici:"^5.19.1"},overrides:{typescript:"^5.0.0"},devDependencies:{"@types/glob":"^8.1.0","@types/jest":"^28.1.7","@types/node":"^17.0.45","@typescript-eslint/eslint-plugin":"^5.30.6","@typescript-eslint/parser":"^5.30.6","cpy-cli":"^4.2.0",esbuild:"^0.14.49",eslint:"^8.19.0","eslint-plugin-tsdoc":"^0.2.16",glob:"^8.0.3",jest:"^28.1.3",pbkit:"^0.0.59",replace:"^1.2.2","ts-jest":"^28.0.8","ts-patch":"^3.0.2","ts-transformer-inline-file":"^0.2.0",typescript:"^5.0.0"},bugs:{url:"https://github.com/LuanRT/YouTube.js/issues"},homepage:"https://github.com/LuanRT/YouTube.js#readme",keywords:["yt","dl","ytdl","youtube","youtubedl","youtube-dl","youtube-downloader","youtube-music","youtube-studio","innertube","unofficial","downloader","livechat","studio","upload","ytmusic","search","music","api"]};var s_={};B(s_,{ArrayExpression:()=>Tr,ArrowFunctionExpression:()=>Ir,AssignmentExpression:()=>kr,BinaryExpression:()=>Sr,BlockStatement:()=>Cr,BreakStatement:()=>Er,CallExpression:()=>Pr,ConditionalExpression:()=>Ar,ContinueStatement:()=>Rr,ExpressionStatement:()=>Mr,ForOfStatement:()=>Vr,ForStatement:()=>Or,FunctionDeclaration:()=>Dr,FunctionExpression:()=>Lr,Identifier:()=>Br,IfStatement:()=>Fr,Literal:()=>Yr,LogicalExpression:()=>jr,MemberExpression:()=>Ur,NewExpression:()=>Wr,ObjectExpression:()=>Hr,Property:()=>Jr,ReturnStatement:()=>Gr,SequenceExpression:()=>zr,SwitchCase:()=>$r,SwitchStatement:()=>Kr,ThisExpression:()=>qr,ThrowStatement:()=>Xr,TryStatement:()=>Qr,UnaryExpression:()=>Zr,UpdateExpression:()=>ea,VariableDeclaration:()=>ta,WhileStatement:()=>ia});var R=class{constructor(e,i){this.node=e,this.visitor=i}run(){}};n(R,"BaseJSNode");var Tr=class extends R{run(){return this.node.elements.map(e=>this.visitor.visitNode(e))}};n(Tr,"ArrayExpression");var Xb={};B(Xb,{namedFunction:()=>Bn});var Bn=n((t,e)=>Object.defineProperty(e,"name",{value:t}),"namedFunction");var Ir=class extends R{run(){let{params:e,body:i}=this.node;return Bn("anonymous function",s=>{let r=0;for(let l of e)this.visitor.visitNode(l),l.type==="Identifier"?this.visitor.scope.set(l.name,s[r]):console.warn("Unhandled param type",l.type),r++;return this.visitor.visitNode(i)})}};n(Ir,"ArrowFunctionExpression");var kr=class extends R{run(){let e=this.node.operator,i=this.visitor.visitNode(this.node.right);switch(e){case"=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]=i}else if(this.node.left.type==="Identifier")return this.visitor.scope.set(this.node.left.name,i),this.visitor.scope.get(this.node.left.name);console.warn("Unhandled left node",this.node.left);break;case"+=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]+=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)+i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case"-=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]-=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)-i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case"*=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]*=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)*i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case"/=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]/=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)/i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case"%=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]%=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)%i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case"**=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]**=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)**i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case"<<=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]<<=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)<<i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case">>=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]>>=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)>>i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case">>>=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]>>>=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)>>>i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break;case"&=":if(this.node.left.type==="MemberExpression"){let o=this.visitor.visitNode(this.node.left.object),s=this.visitor.visitNode(this.node.left.property);return o[s]&=i}else if(this.node.left.type==="Identifier"){let o=this.visitor.visitNode(this.node.left)&i;return this.visitor.scope.set(this.node.left.name,o),this.visitor.scope.get(this.node.left.name)}console.warn("Unhandled left node",this.node.left);break}}};n(kr,"AssignmentExpression");var Sr=class extends R{run(){let e=this.node.operator,i=this.visitor.visitNode(this.node.left),o=this.visitor.visitNode(this.node.right);switch(e){case"!=":return i!=o;case"!==":return i!==o;case"%":return i%o;case"&":return i&o;case"*":return i*o;case"**":return i**o;case"+":return i+o;case"-":return i-o;case"/":return i/o;case"<":return i<o;case"<<":return i<<o;case"<=":return i<=o;case"==":return i==o;case"===":return i===o;case">":return i>o;case">=":return i>=o;case">>":return i>>o;case">>>":return i>>>o;case"^":return i^o;case"|":return i|o;case"in":return i in o;case"instanceof":return i instanceof o}}};n(Sr,"BinaryExpression");var Cr=class extends R{run(){for(let e of this.node.body){let i=this.visitor.visitNode(e);if(e.type==="ReturnStatement"||i==="break"||i==="continue"||(e.type==="WhileStatement"||e.type==="IfStatement"||e.type==="ForStatement"||e.type==="TryStatement")&&!!i)return i}}};n(Cr,"BlockStatement");var Er=class extends R{run(){return"break"}};n(Er,"BreakStatement");var m1=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)},hy,Qb,Pr=class extends R{constructor(){super(...arguments),hy.add(this)}run(){let e,i;if(this.node.callee.type==="MemberExpression"?(e=this.visitor.getName(this.node.callee.object),i=this.visitor.getName(this.node.callee.property)):this.node.callee.type==="Identifier"&&(i=this.node.callee.name),e&&this.visitor.listeners[e]){let r=this.visitor.listeners[e](this.node,this.visitor);if(r!=="proceed")return r}if(i&&i!=="toString"&&this.visitor.listeners[i]){let r=this.visitor.listeners[i](this.node,this.visitor);if(r!=="proceed")return r}if(this.node.callee.type==="MemberExpression"){if(Nr.has(this.node,this.visitor))return Nr.execute(this.node,this.visitor);let r=this.visitor.visitNode(this.node.callee.object),l=this.node.callee.computed?this.visitor.visitNode(this.node.callee.property):this.visitor.getName(this.node.callee.property),p=this.node.arguments.map(f=>this.visitor.visitNode(f));return typeof r[l]!="function"&&m1(this,hy,"m",Qb).call(this),r[l].toString().includes("[native code]")?r[l](...p):r[l](p)}let o=this.visitor.visitNode(this.node.callee),s=this.node.arguments.map(r=>this.visitor.visitNode(r));return typeof o!="function"&&m1(this,hy,"m",Qb).call(this),o(s)}};n(Pr,"CallExpression");hy=new WeakSet,Qb=n(function(){if(this.node.callee.type==="MemberExpression")throw new Error(`${this.node.callee.object.type==="Identifier"?this.node.callee.object.name:"<object>"}.${this.node.callee.property.type==="Identifier"?this.node.callee.property.name:"?"} is not a function`);if(this.node.callee.type==="Identifier")throw new Error(`${this.node.callee.name} is not a function`);if(this.node.callee.type==="SequenceExpression"){let e=[],i=[];throw e.push("("),this.node.callee.expressions.forEach(o=>{o.type==="Literal"?i.push(o.raw||""):o.type==="Identifier"?i.push(o.name):o.type==="MemberExpression"&&(o.computed?i.push(`${this.visitor.getName(o.object)}[${this.visitor.getName(o.property)||"..."}]`):i.push(`${this.visitor.getName(o.object)}.${this.visitor.getName(o.property)}`))}),e.push(i.join(", ")),e.push(")"),new Error(`${e.join("")} is not a function`)}},"_CallExpression_throwError");var Nr=class{static has(e,i){var o;return e.callee.type==="MemberExpression"?!!(!((o=this.builtins)===null||o===void 0)&&o[i.getName(e.callee.property)||""]):!1}static execute(e,i){if(e.callee.type==="MemberExpression")return this.builtins[i.getName(e.callee.property)||""](e,i)}};n(Nr,"Builtins");Nr.builtins={forEach:(t,e)=>{let i=t.arguments.map(o=>e.visitNode(o));if(t.callee.type==="MemberExpression"){let o=e.visitNode(t.callee.object);i.length>1&&e.scope.set("_this",i.slice(-1)[0]);let s=0;for(let r of o)i[0]([r,s++,o])}else console.warn("Unhandled callee type:",t.callee.type)},toString:(t,e)=>{if(t.callee.type==="MemberExpression")return e.visitNode(t.callee.object).toString()}};var Ar=class extends R{run(){let{test:e,consequent:i,alternate:o}=this.node;return this.visitor.visitNode(e)?this.visitor.visitNode(i):this.visitor.visitNode(o)}};n(Ar,"ConditionalExpression");var Rr=class extends R{run(){return"continue"}};n(Rr,"ContinueStatement");var Mr=class extends R{run(){return this.visitor.visitNode(this.node.expression)}};n(Mr,"ExpressionStatement");var Vr=class extends R{run(){this.visitor.visitNode(this.node.left);let e=this.visitor.visitNode(this.node.right);for(let i of e){if(this.node.left.type==="VariableDeclaration"&&this.node.left.declarations[0].id.type==="Identifier")this.visitor.scope.set(this.node.left.declarations[0].id.name,i);else if(this.node.left.type==="VariableDeclaration"&&this.node.left.declarations[0].id.type==="ObjectPattern")for(let s of this.node.left.declarations[0].id.properties)s.type==="Property"&&s.value.type==="Identifier"&&s.key.type==="Identifier"&&this.visitor.scope.set(s.value.name,i[s.key.name]);let o=this.visitor.visitNode(this.node.body);if(o==="break")break;if(o!=="continue"&&o&&this.node.body.type!=="ExpressionStatement")return o}}};n(Vr,"ForOfStatement");var Or=class extends R{run(){this.node.init&&this.visitor.visitNode(this.node.init);let e=n(()=>this.node.test?this.visitor.visitNode(this.node.test):!0,"test");for(;e();){let o=this.visitor.visitNode(this.node.body);if(o!=="continue"){if(o==="break")break;if(this.node.update&&this.visitor.visitNode(this.node.update),o&&this.node.body.type!=="ExpressionStatement")return o}}}};n(Or,"ForStatement");var Dr=class extends R{run(){let{params:e,body:i}=this.node,o=this.visitor.visitNode(this.node.id),s=Bn(o,r=>{let l=0;for(let p of e)this.visitor.visitNode(p),p.type==="Identifier"?this.visitor.scope.set(p.name,r[l]):console.warn("Unhandled param type",p.type),l++;return this.visitor.visitNode(i)});this.visitor.scope.set(o,s)}};n(Dr,"FunctionDeclaration");var Lr=class extends R{run(){let{params:e,body:i}=this.node;return Bn("anonymous function",s=>{let r=0;for(let l of e)this.visitor.visitNode(l),l.type==="Identifier"?this.visitor.scope.set(l.name,s[r]):console.warn("Unhandled param type",l.type),r++;return this.visitor.visitNode(i)})}};n(Lr,"FunctionExpression");var Br=class extends R{run(){if(this.visitor.listeners[this.node.name]){let e=this.visitor.listeners[this.node.name](this.node,this.visitor);if(e!=="proceed")return e}return this.visitor.scope.has(this.node.name)?this.visitor.scope.get(this.node.name):this.node.name}};n(Br,"Identifier");var Fr=class extends R{run(){if(this.visitor.visitNode(this.node.test))return this.visitor.visitNode(this.node.consequent);if(this.node.alternate)return this.visitor.visitNode(this.node.alternate)}};n(Fr,"IfStatement");var Yr=class extends R{run(){return this.node.value}};n(Yr,"Literal");var jr=class extends R{run(){switch(this.node.operator){case"&&":{let i=this.visitor.visitNode(this.node.left);return i===!0?this.visitor.visitNode(this.node.right):i}case"||":return this.visitor.visitNode(this.node.left)||this.visitor.visitNode(this.node.right);case"??":{let i=this.visitor.visitNode(this.node.left);return i!=null?i:this.visitor.visitNode(this.node.right)}}}};n(jr,"LogicalExpression");var Ur=class extends R{run(){let{object:e,property:i,computed:o}=this.node,s=this.visitor.visitNode(e),r=o?this.visitor.visitNode(i):this.visitor.getName(i);if(r!==void 0||r!==null){if(this.visitor.listeners[r]){let l=this.visitor.listeners[r](this.node,this.visitor);if(l!=="proceed")return l}return s==null?void 0:s[r]}}};n(Ur,"MemberExpression");var Wr=class extends R{run(){let e=this.visitor.visitNode(this.node.callee),i=this.node.arguments.map(o=>this.visitor.visitNode(o));return new e(i)}};n(Wr,"NewExpression");var Hr=class extends R{run(){let e={};for(let i of this.node.properties)if(i.type==="Property")e=Object.assign(Object.assign({},e),this.visitor.visitNode(i));else throw new Error(`Unhandled property type: ${i.type}`);return e}};n(Hr,"ObjectExpression");var Zb=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)},n_,h1,_1,v1,Jr=class extends R{constructor(){super(...arguments),n_.add(this)}run(){switch(this.node.kind){case"init":return Zb(this,n_,"m",h1).call(this);case"get":return Zb(this,n_,"m",_1).call(this);case"set":return Zb(this,n_,"m",v1).call(this);default:throw new Error(`Unhandled property kind: ${this.node.kind}`)}}};n(Jr,"Property");n_=new WeakSet,h1=n(function(){let e=this.node.computed?this.visitor.visitNode(this.node.key):this.visitor.getName(this.node.key),i=this.visitor.visitNode(this.node.value);if(e)return{[e]:i}},"_Property_init"),_1=n(function(){throw new TypeError("Not implemented: Property.get")},"_Property_get"),v1=n(function(){throw new TypeError("Not implemented: Property.set")},"_Property_set");var Gr=class extends R{run(){if(this.node.argument)return this.visitor.visitNode(this.node.argument)}};n(Gr,"ReturnStatement");var zr=class extends R{run(){let e;for(let i of this.node.expressions)e=this.visitor.visitNode(i);return e}};n(zr,"SequenceExpression");var $r=class extends R{run(){for(let e of this.node.consequent){let i=this.visitor.visitNode(e);if(e.type==="ContinueStatement"||e.type==="BreakStatement")return i}}};n($r,"SwitchCase");var Kr=class extends R{run(){let e=this.visitor.visitNode(this.node.discriminant),i=!1,o=-1,s=0;for(;;){let r=this.node.cases[s];if(i){let l=this.visitor.visitNode(r);if(l==="break")break;if(l==="continue")return l;if(++s,s>=this.node.cases.length){s=0;break}else continue}if(i=r&&e===this.visitor.visitNode(r.test),i===void 0&&s>this.node.cases.length)break;if(r&&!i&&!r.test){o=s,s+=1;continue}if(!r&&!i&&o!==-1){i=!0,s=o;continue}i||++s}}};n(Kr,"SwitchStatement");var qr=class extends R{run(){return this.visitor.scope.get("_this")}};n(qr,"ThisExpression");var Xr=class extends R{run(){throw this.visitor.visitNode(this.node.argument)}};n(Xr,"ThrowStatement");var Qr=class extends R{run(){try{return this.visitor.visitNode(this.node.block)}catch(e){if(this.node.handler)return this.node.handler.param&&this.node.handler.param.type==="Identifier"&&this.visitor.scope.set(this.node.handler.param.name,e),this.visitor.visitNode(this.node.handler.body)}finally{this.visitor.visitNode(this.node.finalizer)}}};n(Qr,"TryStatement");var Zr=class extends R{run(){let e=this.node.operator;switch(e){case"-":return-this.visitor.visitNode(this.node.argument);case"+":return+this.visitor.visitNode(this.node.argument);case"!":return!this.visitor.visitNode(this.node.argument);case"~":return~this.visitor.visitNode(this.node.argument);case"void":{this.visitor.visitNode(this.node.argument);return}case"typeof":return typeof this.visitor.visitNode(this.node.argument);case"delete":{if(this.node.argument.type==="MemberExpression"){let i=this.visitor.visitNode(this.node.argument.object),o=this.node.argument.computed?this.visitor.visitNode(this.node.argument.property):this.visitor.getName(this.node.argument.property);return delete i[o]}else if(this.node.argument.type==="Identifier")return this.visitor.scope.delete(this.node.argument.name);return!0}default:console.warn("Unhandled UnaryExpression operator",e)}}};n(Zr,"UnaryExpression");var ea=class extends R{run(){switch(this.node.operator){case"++":if(this.node.argument.type==="MemberExpression"){let i=this.visitor.visitNode(this.node.argument.object);return i[this.visitor.visitNode(this.node.argument.property)]++}else if(this.node.argument.type==="Identifier"){let i=this.visitor.visitNode(this.node.argument);return this.visitor.scope.set(this.node.argument.name,i+1),this.node.prefix?++i:i}break;case"--":if(this.node.argument.type==="MemberExpression"){let i=this.visitor.visitNode(this.node.argument.object);return i[this.visitor.visitNode(this.node.argument.property)]--}else if(this.node.argument.type==="Identifier"){let i=this.visitor.visitNode(this.node.argument);return this.visitor.scope.set(this.node.argument.name,i-1),this.node.prefix?--i:i}break}}};n(ea,"UpdateExpression");var ta=class extends R{run(){this.node.declarations.forEach(e=>{let{id:i,init:o}=e,s=this.visitor.getName(i),r=o?this.visitor.visitNode(o):void 0;s&&this.visitor.scope.set(s,r),typeof r=="object"&&r!==null&&this.visitor.scope.set("_this",r)})}};n(ta,"VariableDeclaration");var ia=class extends R{run(){for(;this.visitor.visitNode(this.node.test);){let e=this.visitor.visitNode(this.node.body);if(e==="break")break;if(e!=="continue"&&e)return e}}};n(ia,"WhileStatement");var VP=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)},ew,g1,oa=class{constructor(e){ew.add(this),this.scope=new Map,this.listeners={},this.ast=e}run(){let e;for(let i of this.ast)e=this.visitNode(i);return e}visitNode(e){if(!e)return null;let i=VP(this,ew,"m",g1).call(this,e.type);if(i)return new i(e,this).run()}getName(e){if(e.type==="Identifier")return e.name;if(e.type==="Literal")return e.value}on(e,i){this.listeners[e]=i}};n(oa,"Visitor");ew=new WeakSet,g1=n(function(e){let i=s_[e];return i||console.warn("[JINTER]:",`JavaScript node "${e}" not implemented!
|
|
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-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F",I1="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",tw={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},iw="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",LP={5:iw,"5module":iw+" export import",6:iw+" const class extends export import super"},BP=/^in(stanceof)?$/,FP=new RegExp("["+I1+"]"),YP=new RegExp("["+I1+DP+"]");function nw(t,e){for(var i=65536,o=0;o<e.length;o+=2){if(i+=e[o],i>t)return!1;if(i+=e[o+1],i>=t)return!0}return!1}n(nw,"isInAstralSet");function Ni(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&FP.test(String.fromCharCode(t)):e===!1?!1:nw(t,T1)}n(Ni,"isIdentifierStart");function na(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&YP.test(String.fromCharCode(t)):e===!1?!1:nw(t,T1)||nw(t,OP)}n(na,"isIdentifierChar");var ce=n(function(e,i){i===void 0&&(i={}),this.label=e,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null},"TokenType");function At(t,e){return new ce(t,{beforeExpr:!0,binop:e})}n(At,"binop");var Rt={beforeExpr:!0},ht={startsExpr:!0},aw={};function ne(t,e){return e===void 0&&(e={}),e.keyword=t,aw[t]=new ce(t,e)}n(ne,"kw");var _={num:new ce("num",ht),regexp:new ce("regexp",ht),string:new ce("string",ht),name:new ce("name",ht),privateId:new ce("privateId",ht),eof:new ce("eof"),bracketL:new ce("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new ce("]"),braceL:new ce("{",{beforeExpr:!0,startsExpr:!0}),braceR:new ce("}"),parenL:new ce("(",{beforeExpr:!0,startsExpr:!0}),parenR:new ce(")"),comma:new ce(",",Rt),semi:new ce(";",Rt),colon:new ce(":",Rt),dot:new ce("."),question:new ce("?",Rt),questionDot:new ce("?."),arrow:new ce("=>",Rt),template:new ce("template"),invalidTemplate:new ce("invalidTemplate"),ellipsis:new ce("...",Rt),backQuote:new ce("`",ht),dollarBraceL:new ce("${",{beforeExpr:!0,startsExpr:!0}),eq:new ce("=",{beforeExpr:!0,isAssign:!0}),assign:new ce("_=",{beforeExpr:!0,isAssign:!0}),incDec:new ce("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new ce("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:At("||",1),logicalAND:At("&&",2),bitwiseOR:At("|",3),bitwiseXOR:At("^",4),bitwiseAND:At("&",5),equality:At("==/!=/===/!==",6),relational:At("</>/<=/>=",7),bitShift:At("<</>>/>>>",8),plusMin:new ce("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:At("%",10),star:At("*",10),slash:At("/",10),starstar:new ce("**",{beforeExpr:!0}),coalesce:At("??",1),_break:ne("break"),_case:ne("case",Rt),_catch:ne("catch"),_continue:ne("continue"),_debugger:ne("debugger"),_default:ne("default",Rt),_do:ne("do",{isLoop:!0,beforeExpr:!0}),_else:ne("else",Rt),_finally:ne("finally"),_for:ne("for",{isLoop:!0}),_function:ne("function",ht),_if:ne("if"),_return:ne("return",Rt),_switch:ne("switch"),_throw:ne("throw",Rt),_try:ne("try"),_var:ne("var"),_const:ne("const"),_while:ne("while",{isLoop:!0}),_with:ne("with"),_new:ne("new",{beforeExpr:!0,startsExpr:!0}),_this:ne("this",ht),_super:ne("super",ht),_class:ne("class",ht),_extends:ne("extends",Rt),_export:ne("export"),_import:ne("import",ht),_null:ne("null",ht),_true:ne("true",ht),_false:ne("false",ht),_in:ne("in",{beforeExpr:!0,binop:7}),_instanceof:ne("instanceof",{beforeExpr:!0,binop:7}),_typeof:ne("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:ne("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:ne("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Ot=/\r\n?|\n|\u2028|\u2029/,jP=new RegExp(Ot.source,"g");function sa(t){return t===10||t===13||t===8232||t===8233}n(sa,"isNewLine");function k1(t,e,i){i===void 0&&(i=t.length);for(var o=e;o<i;o++){var s=t.charCodeAt(o);if(sa(s))return o<i-1&&s===13&&t.charCodeAt(o+1)===10?o+2:o+1}return-1}n(k1,"nextLineBreak");var S1=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Mt=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,C1=Object.prototype,UP=C1.hasOwnProperty,WP=C1.toString,l_=Object.hasOwn||function(t,e){return UP.call(t,e)},x1=Array.isArray||function(t){return WP.call(t)==="[object Array]"};function yo(t){return new RegExp("^(?:"+t.replace(/ /g,"|")+")$")}n(yo,"wordsRegexp");function bo(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}n(bo,"codePointToString");var HP=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,a_=n(function(e,i){this.line=e,this.column=i},"Position");a_.prototype.offset=n(function(e){return new a_(this.line,this.column+e)},"offset");var yy=n(function(e,i,o){this.start=i,this.end=o,e.sourceFile!==null&&(this.source=e.sourceFile)},"SourceLocation");function E1(t,e){for(var i=1,o=0;;){var s=k1(t,o,e);if(s<0)return new a_(i,e-o);++i,o=s}}n(E1,"getLineInfo");var sw={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},y1=!1;function JP(t){var e={};for(var i in sw)e[i]=t&&l_(t,i)?t[i]:sw[i];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!y1&&typeof console=="object"&&console.warn&&(y1=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
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)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};at.expect=function(t){this.eat(t)||this.unexpected()};at.unexpected=function(t){this.raise(t!=null?t:this.start,"Unexpected token")};var by=n(function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1},"DestructuringErrors");at.checkPatternErrors=function(t,e){if(!!t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var i=e?t.parenthesizedAssign:t.parenthesizedBind;i>-1&&this.raiseRecoverable(i,e?"Assigning to rvalue":"Parenthesized pattern")}};at.checkExpressionErrors=function(t,e){if(!t)return!1;var i=t.shorthandAssign,o=t.doubleProto;if(!e)return i>=0||o>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),o>=0&&this.raiseRecoverable(o,"Redefinition of __proto__ property")};at.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};at.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var Y=Be.prototype;Y.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==_.eof;){var i=this.parseStatement(null,!0,e);t.body.push(i)}if(this.inModule)for(var o=0,s=Object.keys(this.undefinedExports);o<s.length;o+=1){var r=s[o];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var fw={kind:"loop"},$P={kind:"switch"};Y.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Mt.lastIndex=this.pos;var e=Mt.exec(this.input),i=this.pos+e[0].length,o=this.input.charCodeAt(i);if(o===91||o===92)return!0;if(t)return!1;if(o===123||o>55295&&o<56320)return!0;if(Ni(o,!0)){for(var s=i+1;na(o=this.input.charCodeAt(s),!0);)++s;if(o===92||o>55295&&o<56320)return!0;var r=this.input.slice(i,s);if(!BP.test(r))return!0}return!1};Y.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Mt.lastIndex=this.pos;var t=Mt.exec(this.input),e=this.pos+t[0].length,i;return!Ot.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(na(i=this.input.charCodeAt(e+8))||i>55295&&i<56320))};Y.parseStatement=function(t,e,i){var o=this.type,s=this.startNode(),r;switch(this.isLet(t)&&(o=_._var,r="let"),o){case _._break:case _._continue:return this.parseBreakContinueStatement(s,o.keyword);case _._debugger:return this.parseDebuggerStatement(s);case _._do:return this.parseDoStatement(s);case _._for:return this.parseForStatement(s);case _._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!t);case _._class:return t&&this.unexpected(),this.parseClass(s,!0);case _._if:return this.parseIfStatement(s);case _._return:return this.parseReturnStatement(s);case _._switch:return this.parseSwitchStatement(s);case _._throw:return this.parseThrowStatement(s);case _._try:return this.parseTryStatement(s);case _._const:case _._var:return r=r||this.value,t&&r!=="var"&&this.unexpected(),this.parseVarStatement(s,r);case _._while:return this.parseWhileStatement(s);case _._with:return this.parseWithStatement(s);case _.braceL:return this.parseBlock(!0,s);case _.semi:return this.parseEmptyStatement(s);case _._export:case _._import:if(this.options.ecmaVersion>10&&o===_._import){Mt.lastIndex=this.pos;var l=Mt.exec(this.input),p=this.pos+l[0].length,f=this.input.charCodeAt(p);if(f===40||f===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),o===_._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!t);var h=this.value,m=this.parseExpression();return o===_.name&&m.type==="Identifier"&&this.eat(_.colon)?this.parseLabeledStatement(s,h,m,t):this.parseExpressionStatement(s,m)}};Y.parseBreakContinueStatement=function(t,e){var i=e==="break";this.next(),this.eat(_.semi)||this.insertSemicolon()?t.label=null:this.type!==_.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var o=0;o<this.labels.length;++o){var s=this.labels[o];if((t.label==null||s.name===t.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||t.label&&i))break}return o===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,i?"BreakStatement":"ContinueStatement")};Y.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};Y.parseDoStatement=function(t){return this.next(),this.labels.push(fw),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(_._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(_.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};Y.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(fw),this.enterScope(0),this.expect(_.parenL),this.type===_.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var i=this.isLet();if(this.type===_._var||this.type===_._const||i){var o=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(o,!0,s),this.finishNode(o,"VariableDeclaration"),(this.type===_._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&o.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===_._in?e>-1&&this.unexpected(e):t.await=e>-1),this.parseForIn(t,o)):(e>-1&&this.unexpected(e),this.parseFor(t,o))}var r=this.isContextual("let"),l=!1,p=new by,f=this.parseExpression(e>-1?"await":!0,p);return this.type===_._in||(l=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===_._in?e>-1&&this.unexpected(e):t.await=e>-1),r&&l&&this.raise(f.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(f,!1,p),this.checkLValPattern(f),this.parseForIn(t,f)):(this.checkExpressionErrors(p,!0),e>-1&&this.unexpected(e),this.parseFor(t,f))};Y.parseFunctionStatement=function(t,e,i){return this.next(),this.parseFunction(t,r_|(i?0:rw),!1,e)};Y.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(_._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};Y.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(_.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};Y.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(_.braceL),this.labels.push($P),this.enterScope(0);for(var e,i=!1;this.type!==_.braceR;)if(this.type===_._case||this.type===_._default){var o=this.type===_._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),o?e.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,e.test=null),this.expect(_.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};Y.parseThrowStatement=function(t){return this.next(),Ot.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var KP=[];Y.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?A1:0),this.checkLValPattern(t,e?V1:Ri),this.expect(_.parenR),t};Y.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===_._catch){var e=this.startNode();this.next(),this.eat(_.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(_._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};Y.parseVarStatement=function(t,e,i){return this.next(),this.parseVar(t,!1,e,i),this.semicolon(),this.finishNode(t,"VariableDeclaration")};Y.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(fw),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};Y.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};Y.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};Y.parseLabeledStatement=function(t,e,i,o){for(var s=0,r=this.labels;s<r.length;s+=1){var l=r[s];l.name===e&&this.raise(i.start,"Label '"+e+"' is already declared")}for(var p=this.type.isLoop?"loop":this.type===_._switch?"switch":null,f=this.labels.length-1;f>=0;f--){var h=this.labels[f];if(h.statementStart===t.start)h.statementStart=this.start,h.kind=p;else break}return this.labels.push({name:e,kind:p,statementStart:this.start}),t.body=this.parseStatement(o?o.indexOf("label")===-1?o+"label":o:"label"),this.labels.pop(),t.label=i,this.finishNode(t,"LabeledStatement")};Y.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};Y.parseBlock=function(t,e,i){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(_.braceL),t&&this.enterScope(0);this.type!==_.braceR;){var o=this.parseStatement(null);e.body.push(o)}return i&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};Y.parseFor=function(t,e){return t.init=e,this.expect(_.semi),t.test=this.type===_.semi?null:this.parseExpression(),this.expect(_.semi),t.update=this.type===_.parenR?null:this.parseExpression(),this.expect(_.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};Y.parseForIn=function(t,e){var i=this.type===_._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(_.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,i?"ForInStatement":"ForOfStatement")};Y.parseVar=function(t,e,i,o){for(t.declarations=[],t.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(_.eq)?s.init=this.parseMaybeAssign(e):!o&&i==="const"&&!(this.type===_._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!o&&s.id.type!=="Identifier"&&!(e&&(this.type===_._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,t.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(_.comma))break}return t};Y.parseVarId=function(t,e){t.id=this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?pw:Ri,!1)};var r_=1,rw=2,D1=4;Y.parseFunction=function(t,e,i,o,s){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!o)&&(this.type===_.star&&e&rw&&this.unexpected(),t.generator=this.eat(_.star)),this.options.ecmaVersion>=8&&(t.async=!!o),e&r_&&(t.id=e&D1&&this.type!==_.name?null:this.parseIdent(),t.id&&!(e&rw)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?pw:Ri:M1));var r=this.yieldPos,l=this.awaitPos,p=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(dw(t.async,t.generator)),e&r_||(t.id=this.type===_.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,i,!1,s),this.yieldPos=r,this.awaitPos=l,this.awaitIdentPos=p,this.finishNode(t,e&r_?"FunctionDeclaration":"FunctionExpression")};Y.parseFunctionParams=function(t){this.expect(_.parenL),t.params=this.parseBindingList(_.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Y.parseClass=function(t,e){this.next();var i=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var o=this.enterClassBody(),s=this.startNode(),r=!1;for(s.body=[],this.expect(_.braceL);this.type!==_.braceR;){var l=this.parseClassElement(t.superClass!==null);l&&(s.body.push(l),l.type==="MethodDefinition"&&l.kind==="constructor"?(r&&this.raiseRecoverable(l.start,"Duplicate constructor in the same class"),r=!0):l.key&&l.key.type==="PrivateIdentifier"&&qP(o,l)&&this.raiseRecoverable(l.key.start,"Identifier '#"+l.key.name+"' has already been declared"))}return this.strict=i,this.next(),t.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};Y.parseClassElement=function(t){if(this.eat(_.semi))return null;var e=this.options.ecmaVersion,i=this.startNode(),o="",s=!1,r=!1,l="method",p=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(_.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===_.star?p=!0:o="static"}if(i.static=p,!o&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===_.star)&&!this.canInsertSemicolon()?r=!0:o="async"),!o&&(e>=9||!r)&&this.eat(_.star)&&(s=!0),!o&&!r&&!s){var f=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?l=f:o=f)}if(o?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=o,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),e<13||this.type===_.parenL||l!=="method"||s||r){var h=!i.static&&gy(i,"constructor"),m=h&&t;h&&l!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=h?"constructor":l,this.parseClassMethod(i,s,r,m)}else this.parseClassField(i);return i};Y.isClassElementNameStart=function(){return this.type===_.name||this.type===_.privateId||this.type===_.num||this.type===_.string||this.type===_.bracketL||this.type.keyword};Y.parseClassElementName=function(t){this.type===_.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};Y.parseClassMethod=function(t,e,i,o){var s=t.key;t.kind==="constructor"?(e&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):t.static&&gy(t,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var r=t.value=this.parseMethod(e,i,o);return t.kind==="get"&&r.params.length!==0&&this.raiseRecoverable(r.start,"getter should have no params"),t.kind==="set"&&r.params.length!==1&&this.raiseRecoverable(r.start,"setter should have exactly one param"),t.kind==="set"&&r.params[0].type==="RestElement"&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};Y.parseClassField=function(t){if(gy(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&gy(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(_.eq)){var e=this.currentThisScope(),i=e.inClassFieldInit;e.inClassFieldInit=!0,t.value=this.parseMaybeAssign(),e.inClassFieldInit=i}else t.value=null;return this.semicolon(),this.finishNode(t,"PropertyDefinition")};Y.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(c_|lw);this.type!==_.braceR;){var i=this.parseStatement(null);t.body.push(i)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};Y.parseClassId=function(t,e){this.type===_.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Ri,!1)):(e===!0&&this.unexpected(),t.id=null)};Y.parseClassSuper=function(t){t.superClass=this.eat(_._extends)?this.parseExprSubscripts(null,!1):null};Y.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};Y.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,i=t.used;if(!!this.options.checkPrivateFields)for(var o=this.privateNameStack.length,s=o===0?null:this.privateNameStack[o-1],r=0;r<i.length;++r){var l=i[r];l_(e,l.name)||(s?s.used.push(l):this.raiseRecoverable(l.start,"Private field '#"+l.name+"' must be declared in an enclosing class"))}};function qP(t,e){var i=e.key.name,o=t[i],s="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(s=(e.static?"s":"i")+e.kind),o==="iget"&&s==="iset"||o==="iset"&&s==="iget"||o==="sget"&&s==="sset"||o==="sset"&&s==="sget"?(t[i]="true",!1):o?!0:(t[i]=s,!1)}n(qP,"isPrivateNameConflicted");function gy(t,e){var i=t.computed,o=t.key;return!i&&(o.type==="Identifier"&&o.name===e||o.type==="Literal"&&o.value===e)}n(gy,"checkKeyName");Y.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==_.string&&this.unexpected(),t.source=this.parseExprAtom(),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};Y.parseExport=function(t,e){if(this.next(),this.eat(_.star))return this.parseExportAllDeclaration(t,e);if(this.eat(_._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null;else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==_.string&&this.unexpected(),t.source=this.parseExprAtom();else{for(var i=0,o=t.specifiers;i<o.length;i+=1){var s=o[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};Y.parseExportDeclaration=function(t){return this.parseStatement(null)};Y.parseExportDefaultDeclaration=function(){var t;if(this.type===_._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,r_|D1,!1,t)}else if(this.type===_._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var o=this.parseMaybeAssign();return this.semicolon(),o}};Y.checkExport=function(t,e,i){!t||(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),l_(t,e)&&this.raiseRecoverable(i,"Duplicate export '"+e+"'"),t[e]=!0)};Y.checkPatternExport=function(t,e){var i=e.type;if(i==="Identifier")this.checkExport(t,e,e.start);else if(i==="ObjectPattern")for(var o=0,s=e.properties;o<s.length;o+=1){var r=s[o];this.checkPatternExport(t,r)}else if(i==="ArrayPattern")for(var l=0,p=e.elements;l<p.length;l+=1){var f=p[l];f&&this.checkPatternExport(t,f)}else i==="Property"?this.checkPatternExport(t,e.value):i==="AssignmentPattern"?this.checkPatternExport(t,e.left):i==="RestElement"?this.checkPatternExport(t,e.argument):i==="ParenthesizedExpression"&&this.checkPatternExport(t,e.expression)};Y.checkVariableExport=function(t,e){if(!!t)for(var i=0,o=e;i<o.length;i+=1){var s=o[i];this.checkPatternExport(t,s.id)}};Y.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Y.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};Y.parseExportSpecifiers=function(t){var e=[],i=!0;for(this.expect(_.braceL);!this.eat(_.braceR);){if(i)i=!1;else if(this.expect(_.comma),this.afterTrailingComma(_.braceR))break;e.push(this.parseExportSpecifier(t))}return e};Y.parseImport=function(t){return this.next(),this.type===_.string?(t.specifiers=KP,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===_.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};Y.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,Ri),this.finishNode(t,"ImportSpecifier")};Y.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Ri),this.finishNode(t,"ImportDefaultSpecifier")};Y.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Ri),this.finishNode(t,"ImportNamespaceSpecifier")};Y.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===_.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(_.comma)))return t;if(this.type===_.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(_.braceL);!this.eat(_.braceR);){if(e)e=!1;else if(this.expect(_.comma),this.afterTrailingComma(_.braceR))break;t.push(this.parseImportSpecifier())}return t};Y.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===_.string){var t=this.parseLiteral(this.value);return HP.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};Y.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};Y.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var Dt=Be.prototype;Dt.toAssignable=function(t,e,i){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var o=0,s=t.properties;o<s.length;o+=1){var r=s[o];this.toAssignable(r,e),r.type==="RestElement"&&(r.argument.type==="ArrayPattern"||r.argument.type==="ObjectPattern")&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,i);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return t};Dt.toAssignableList=function(t,e){for(var i=t.length,o=0;o<i;o++){var s=t[o];s&&this.toAssignable(s,e)}if(i){var r=t[i-1];this.options.ecmaVersion===6&&e&&r&&r.type==="RestElement"&&r.argument.type!=="Identifier"&&this.unexpected(r.argument.start)}return t};Dt.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};Dt.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==_.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};Dt.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case _.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(_.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case _.braceL:return this.parseObj(!0)}return this.parseIdent()};Dt.parseBindingList=function(t,e,i,o){for(var s=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(_.comma),e&&this.type===_.comma)s.push(null);else{if(i&&this.afterTrailingComma(t))break;if(this.type===_.ellipsis){var l=this.parseRestBinding();this.parseBindingListItem(l),s.push(l),this.type===_.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else s.push(this.parseAssignableListItem(o))}return s};Dt.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};Dt.parseBindingListItem=function(t){return t};Dt.parseMaybeDefault=function(t,e,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(_.eq))return i;var o=this.startNodeAt(t,e);return o.left=i,o.right=this.parseMaybeAssign(),this.finishNode(o,"AssignmentPattern")};Dt.checkLValSimple=function(t,e,i){e===void 0&&(e=vy);var o=e!==vy;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(o?"Binding ":"Assigning to ")+t.name+" in strict mode"),o&&(e===Ri&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),i&&(l_(i,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),i[t.name]=!0),e!==O1&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":o&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return o&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,i);default:this.raise(t.start,(o?"Binding":"Assigning to")+" rvalue")}};Dt.checkLValPattern=function(t,e,i){switch(e===void 0&&(e=vy),t.type){case"ObjectPattern":for(var o=0,s=t.properties;o<s.length;o+=1){var r=s[o];this.checkLValInnerPattern(r,e,i)}break;case"ArrayPattern":for(var l=0,p=t.elements;l<p.length;l+=1){var f=p[l];f&&this.checkLValInnerPattern(f,e,i)}break;default:this.checkLValSimple(t,e,i)}};Dt.checkLValInnerPattern=function(t,e,i){switch(e===void 0&&(e=vy),t.type){case"Property":this.checkLValInnerPattern(t.value,e,i);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,i);break;case"RestElement":this.checkLValPattern(t.argument,e,i);break;default:this.checkLValPattern(t,e,i)}};var $t=n(function(e,i,o,s,r){this.token=e,this.isExpr=!!i,this.preserveSpace=!!o,this.override=s,this.generator=!!r},"TokContext"),Ie={b_stat:new $t("{",!1),b_expr:new $t("{",!0),b_tmpl:new $t("${",!1),p_stat:new $t("(",!1),p_expr:new $t("(",!0),q_tmpl:new $t("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new $t("function",!1),f_expr:new $t("function",!0),f_expr_gen:new $t("function",!0,!1,null,!0),f_gen:new $t("function",!1,!1,null,!0)},aa=Be.prototype;aa.initialContext=function(){return[Ie.b_stat]};aa.curContext=function(){return this.context[this.context.length-1]};aa.braceIsBlock=function(t){var e=this.curContext();return e===Ie.f_expr||e===Ie.f_stat?!0:t===_.colon&&(e===Ie.b_stat||e===Ie.b_expr)?!e.isExpr:t===_._return||t===_.name&&this.exprAllowed?Ot.test(this.input.slice(this.lastTokEnd,this.start)):t===_._else||t===_.semi||t===_.eof||t===_.parenR||t===_.arrow?!0:t===_.braceL?e===Ie.b_stat:t===_._var||t===_._const||t===_.name?!1:!this.exprAllowed};aa.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return!1};aa.updateContext=function(t){var e,i=this.type;i.keyword&&t===_.dot?this.exprAllowed=!1:(e=i.updateContext)?e.call(this,t):this.exprAllowed=i.beforeExpr};aa.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};_.parenR.updateContext=_.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===Ie.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};_.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?Ie.b_stat:Ie.b_expr),this.exprAllowed=!0};_.dollarBraceL.updateContext=function(){this.context.push(Ie.b_tmpl),this.exprAllowed=!0};_.parenL.updateContext=function(t){var e=t===_._if||t===_._for||t===_._with||t===_._while;this.context.push(e?Ie.p_stat:Ie.p_expr),this.exprAllowed=!0};_.incDec.updateContext=function(){};_._function.updateContext=_._class.updateContext=function(t){t.beforeExpr&&t!==_._else&&!(t===_.semi&&this.curContext()!==Ie.p_stat)&&!(t===_._return&&Ot.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===_.colon||t===_.braceL)&&this.curContext()===Ie.b_stat)?this.context.push(Ie.f_expr):this.context.push(Ie.f_stat),this.exprAllowed=!1};_.backQuote.updateContext=function(){this.curContext()===Ie.q_tmpl?this.context.pop():this.context.push(Ie.q_tmpl),this.exprAllowed=!1};_.star.updateContext=function(t){if(t===_._function){var e=this.context.length-1;this.context[e]===Ie.f_expr?this.context[e]=Ie.f_expr_gen:this.context[e]=Ie.f_gen}this.exprAllowed=!0};_.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==_.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var G=Be.prototype;G.checkPropClash=function(t,e,i){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var o=t.key,s;switch(o.type){case"Identifier":s=o.name;break;case"Literal":s=String(o.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&r==="init"&&(e.proto&&(i?i.doubleProto<0&&(i.doubleProto=o.start):this.raiseRecoverable(o.start,"Redefinition of __proto__ property")),e.proto=!0);return}s="$"+s;var l=e[s];if(l){var p;r==="init"?p=this.strict&&l.init||l.get||l.set:p=l.init||l[r],p&&this.raiseRecoverable(o.start,"Redefinition of property")}else l=e[s]={init:!1,get:!1,set:!1};l[r]=!0}};G.parseExpression=function(t,e){var i=this.start,o=this.startLoc,s=this.parseMaybeAssign(t,e);if(this.type===_.comma){var r=this.startNodeAt(i,o);for(r.expressions=[s];this.eat(_.comma);)r.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(r,"SequenceExpression")}return s};G.parseMaybeAssign=function(t,e,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var o=!1,s=-1,r=-1,l=-1;e?(s=e.parenthesizedAssign,r=e.trailingComma,l=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new by,o=!0);var p=this.start,f=this.startLoc;(this.type===_.parenL||this.type===_.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var h=this.parseMaybeConditional(t,e);if(i&&(h=i.call(this,h,p,f)),this.type.isAssign){var m=this.startNodeAt(p,f);return m.operator=this.value,this.type===_.eq&&(h=this.toAssignable(h,!1,e)),o||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),this.type===_.eq?this.checkLValPattern(h):this.checkLValSimple(h),m.left=h,this.next(),m.right=this.parseMaybeAssign(t),l>-1&&(e.doubleProto=l),this.finishNode(m,"AssignmentExpression")}else o&&this.checkExpressionErrors(e,!0);return s>-1&&(e.parenthesizedAssign=s),r>-1&&(e.trailingComma=r),h};G.parseMaybeConditional=function(t,e){var i=this.start,o=this.startLoc,s=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return s;if(this.eat(_.question)){var r=this.startNodeAt(i,o);return r.test=s,r.consequent=this.parseMaybeAssign(),this.expect(_.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return s};G.parseExprOps=function(t,e){var i=this.start,o=this.startLoc,s=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,o,-1,t)};G.parseExprOp=function(t,e,i,o,s){var r=this.type.binop;if(r!=null&&(!s||this.type!==_._in)&&r>o){var l=this.type===_.logicalOR||this.type===_.logicalAND,p=this.type===_.coalesce;p&&(r=_.logicalAND.binop);var f=this.value;this.next();var h=this.start,m=this.startLoc,b=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),h,m,r,s),x=this.buildBinary(e,i,t,b,f,l||p);return(l&&this.type===_.coalesce||p&&(this.type===_.logicalOR||this.type===_.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(x,e,i,o,s)}return t};G.buildBinary=function(t,e,i,o,s,r){o.type==="PrivateIdentifier"&&this.raise(o.start,"Private identifier can only be left side of binary expression");var l=this.startNodeAt(t,e);return l.left=i,l.operator=s,l.right=o,this.finishNode(l,r?"LogicalExpression":"BinaryExpression")};G.parseMaybeUnary=function(t,e,i,o){var s=this.start,r=this.startLoc,l;if(this.isContextual("await")&&this.canAwait)l=this.parseAwait(o),e=!0;else if(this.type.prefix){var p=this.startNode(),f=this.type===_.incDec;p.operator=this.value,p.prefix=!0,this.next(),p.argument=this.parseMaybeUnary(null,!0,f,o),this.checkExpressionErrors(t,!0),f?this.checkLValSimple(p.argument):this.strict&&p.operator==="delete"&&p.argument.type==="Identifier"?this.raiseRecoverable(p.start,"Deleting local variable in strict mode"):p.operator==="delete"&&L1(p.argument)?this.raiseRecoverable(p.start,"Private fields can not be deleted"):e=!0,l=this.finishNode(p,f?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===_.privateId)(o||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),l=this.parsePrivateIdent(),this.type!==_._in&&this.unexpected();else{if(l=this.parseExprSubscripts(t,o),this.checkExpressionErrors(t))return l;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(s,r);h.operator=this.value,h.prefix=!1,h.argument=l,this.checkLValSimple(l),this.next(),l=this.finishNode(h,"UpdateExpression")}}if(!i&&this.eat(_.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(s,r,l,this.parseMaybeUnary(null,!1,!1,o),"**",!1);else return l};function L1(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&L1(t.expression)}n(L1,"isPrivateFieldAccess");G.parseExprSubscripts=function(t,e){var i=this.start,o=this.startLoc,s=this.parseExprAtom(t,e);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var r=this.parseSubscripts(s,i,o,!1,e);return t&&r.type==="MemberExpression"&&(t.parenthesizedAssign>=r.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=r.start&&(t.parenthesizedBind=-1),t.trailingComma>=r.start&&(t.trailingComma=-1)),r};G.parseSubscripts=function(t,e,i,o,s){for(var r=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,l=!1;;){var p=this.parseSubscript(t,e,i,o,r,l,s);if(p.optional&&(l=!0),p===t||p.type==="ArrowFunctionExpression"){if(l){var f=this.startNodeAt(e,i);f.expression=p,p=this.finishNode(f,"ChainExpression")}return p}t=p}};G.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(_.arrow)};G.parseSubscriptAsyncArrow=function(t,e,i,o){return this.parseArrowExpression(this.startNodeAt(t,e),i,!0,o)};G.parseSubscript=function(t,e,i,o,s,r,l){var p=this.options.ecmaVersion>=11,f=p&&this.eat(_.questionDot);o&&f&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(_.bracketL);if(h||f&&this.type!==_.parenL&&this.type!==_.backQuote||this.eat(_.dot)){var m=this.startNodeAt(e,i);m.object=t,h?(m.property=this.parseExpression(),this.expect(_.bracketR)):this.type===_.privateId&&t.type!=="Super"?m.property=this.parsePrivateIdent():m.property=this.parseIdent(this.options.allowReserved!=="never"),m.computed=!!h,p&&(m.optional=f),t=this.finishNode(m,"MemberExpression")}else if(!o&&this.eat(_.parenL)){var b=new by,x=this.yieldPos,T=this.awaitPos,k=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var C=this.parseExprList(_.parenR,this.options.ecmaVersion>=8,!1,b);if(s&&!f&&this.shouldParseAsyncArrow())return this.checkPatternErrors(b,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=x,this.awaitPos=T,this.awaitIdentPos=k,this.parseSubscriptAsyncArrow(e,i,C,l);this.checkExpressionErrors(b,!0),this.yieldPos=x||this.yieldPos,this.awaitPos=T||this.awaitPos,this.awaitIdentPos=k||this.awaitIdentPos;var M=this.startNodeAt(e,i);M.callee=t,M.arguments=C,p&&(M.optional=f),t=this.finishNode(M,"CallExpression")}else if(this.type===_.backQuote){(f||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var A=this.startNodeAt(e,i);A.tag=t,A.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(A,"TaggedTemplateExpression")}return t};G.parseExprAtom=function(t,e,i){this.type===_.slash&&this.readRegexp();var o,s=this.potentialArrowAt===this.start;switch(this.type){case _._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),o=this.startNode(),this.next(),this.type===_.parenL&&!this.allowDirectSuper&&this.raise(o.start,"super() call outside constructor of a subclass"),this.type!==_.dot&&this.type!==_.bracketL&&this.type!==_.parenL&&this.unexpected(),this.finishNode(o,"Super");case _._this:return o=this.startNode(),this.next(),this.finishNode(o,"ThisExpression");case _.name:var r=this.start,l=this.startLoc,p=this.containsEsc,f=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!p&&f.name==="async"&&!this.canInsertSemicolon()&&this.eat(_._function))return this.overrideContext(Ie.f_expr),this.parseFunction(this.startNodeAt(r,l),0,!1,!0,e);if(s&&!this.canInsertSemicolon()){if(this.eat(_.arrow))return this.parseArrowExpression(this.startNodeAt(r,l),[f],!1,e);if(this.options.ecmaVersion>=8&&f.name==="async"&&this.type===_.name&&!p&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return f=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(_.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,l),[f],!0,e)}return f;case _.regexp:var h=this.value;return o=this.parseLiteral(h.value),o.regex={pattern:h.pattern,flags:h.flags},o;case _.num:case _.string:return this.parseLiteral(this.value);case _._null:case _._true:case _._false:return o=this.startNode(),o.value=this.type===_._null?null:this.type===_._true,o.raw=this.type.keyword,this.next(),this.finishNode(o,"Literal");case _.parenL:var m=this.start,b=this.parseParenAndDistinguishExpression(s,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(b)&&(t.parenthesizedAssign=m),t.parenthesizedBind<0&&(t.parenthesizedBind=m)),b;case _.bracketL:return o=this.startNode(),this.next(),o.elements=this.parseExprList(_.bracketR,!0,!0,t),this.finishNode(o,"ArrayExpression");case _.braceL:return this.overrideContext(Ie.b_expr),this.parseObj(!1,t);case _._function:return o=this.startNode(),this.next(),this.parseFunction(o,0);case _._class:return this.parseClass(this.startNode(),!1);case _._new:return this.parseNew();case _.backQuote:return this.parseTemplate();case _._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};G.parseExprAtomDefault=function(){this.unexpected()};G.parseExprImport=function(t){var e=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var i=this.parseIdent(!0);if(this.type===_.parenL&&!t)return this.parseDynamicImport(e);if(this.type===_.dot)return e.meta=i,this.parseImportMeta(e);this.unexpected()};G.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),!this.eat(_.parenR)){var e=this.start;this.eat(_.comma)&&this.eat(_.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};G.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};G.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};G.parseParenExpression=function(){this.expect(_.parenL);var t=this.parseExpression();return this.expect(_.parenR),t};G.shouldParseArrow=function(t){return!this.canInsertSemicolon()};G.parseParenAndDistinguishExpression=function(t,e){var i=this.start,o=this.startLoc,s,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var l=this.start,p=this.startLoc,f=[],h=!0,m=!1,b=new by,x=this.yieldPos,T=this.awaitPos,k;for(this.yieldPos=0,this.awaitPos=0;this.type!==_.parenR;)if(h?h=!1:this.expect(_.comma),r&&this.afterTrailingComma(_.parenR,!0)){m=!0;break}else if(this.type===_.ellipsis){k=this.start,f.push(this.parseParenItem(this.parseRestBinding())),this.type===_.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else f.push(this.parseMaybeAssign(!1,b,this.parseParenItem));var C=this.lastTokEnd,M=this.lastTokEndLoc;if(this.expect(_.parenR),t&&this.shouldParseArrow(f)&&this.eat(_.arrow))return this.checkPatternErrors(b,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=x,this.awaitPos=T,this.parseParenArrowList(i,o,f,e);(!f.length||m)&&this.unexpected(this.lastTokStart),k&&this.unexpected(k),this.checkExpressionErrors(b,!0),this.yieldPos=x||this.yieldPos,this.awaitPos=T||this.awaitPos,f.length>1?(s=this.startNodeAt(l,p),s.expressions=f,this.finishNodeAt(s,"SequenceExpression",C,M)):s=f[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var A=this.startNodeAt(i,o);return A.expression=s,this.finishNode(A,"ParenthesizedExpression")}else return s};G.parseParenItem=function(t){return t};G.parseParenArrowList=function(t,e,i,o){return this.parseArrowExpression(this.startNodeAt(t,e),i,!1,o)};var XP=[];G.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode(),e=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(_.dot)){t.meta=e;var i=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var o=this.start,s=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),o,s,!0,!1),this.eat(_.parenL)?t.arguments=this.parseExprList(_.parenR,this.options.ecmaVersion>=8,!1):t.arguments=XP,this.finishNode(t,"NewExpression")};G.parseTemplateElement=function(t){var e=t.isTagged,i=this.startNode();return this.type===_.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value,cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
`),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.yieldPos,r=this.awaitPos,l=this.awaitIdentPos;return this.initFunction(o),this.options.ecmaVersion>=6&&(o.generator=t),this.options.ecmaVersion>=8&&(o.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(dw(e,o.generator)|lw|(i?R1:0)),this.expect(_.parenL),o.params=this.parseBindingList(_.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(o,!1,!0,!1),this.yieldPos=s,this.awaitPos=r,this.awaitIdentPos=l,this.finishNode(o,"FunctionExpression")};G.parseArrowExpression=function(t,e,i,o){var s=this.yieldPos,r=this.awaitPos,l=this.awaitIdentPos;return this.enterScope(dw(i,!1)|N1),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,o),this.yieldPos=s,this.awaitPos=r,this.awaitIdentPos=l,this.finishNode(t,"ArrowFunctionExpression")};G.parseFunctionBody=function(t,e,i,o){var s=e&&this.type!==_.braceL,r=this.strict,l=!1;if(s)t.body=this.parseMaybeAssign(o),t.expression=!0,this.checkParams(t,!1);else{var p=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!r||p)&&(l=this.strictDirective(this.end),l&&p&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var f=this.labels;this.labels=[],l&&(this.strict=!0),this.checkParams(t,!r&&!l&&!e&&!i&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,O1),t.body=this.parseBlock(!1,void 0,l&&!r),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=f}this.exitScope()};G.isSimpleParamList=function(t){for(var e=0,i=t;e<i.length;e+=1){var o=i[e];if(o.type!=="Identifier")return!1}return!0};G.checkParams=function(t,e){for(var i=Object.create(null),o=0,s=t.params;o<s.length;o+=1){var r=s[o];this.checkLValInnerPattern(r,pw,e?null:i)}};G.parseExprList=function(t,e,i,o){for(var s=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect(_.comma),e&&this.afterTrailingComma(t))break;var l=void 0;i&&this.type===_.comma?l=null:this.type===_.ellipsis?(l=this.parseSpread(o),o&&this.type===_.comma&&o.trailingComma<0&&(o.trailingComma=this.start)):l=this.parseMaybeAssign(!1,o),s.push(l)}return s};G.checkUnreserved=function(t){var e=t.start,i=t.end,o=t.name;if(this.inGenerator&&o==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&o==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&o==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(o==="arguments"||o==="await")&&this.raise(e,"Cannot use "+o+" in class static initialization block"),this.keywords.test(o)&&this.raise(e,"Unexpected keyword '"+o+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(o)&&(!this.inAsync&&o==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+o+"' is reserved"))}};G.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};G.parseIdentNode=function(){var t=this.startNode();return this.type===_.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop()):this.unexpected(),t};G.parsePrivateIdent=function(){var t=this.startNode();return this.type===_.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};G.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===_.semi||this.canInsertSemicolon()||this.type!==_.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(_.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};G.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var xy=Be.prototype;xy.raise=function(t,e){var i=E1(this.input,t);e+=" ("+i.line+":"+i.column+")";var o=new SyntaxError(e);throw o.pos=t,o.loc=i,o.raisedAt=this.pos,o};xy.raiseRecoverable=xy.raise;xy.curPosition=function(){if(this.options.locations)return new a_(this.curLine,this.pos-this.lineStart)};var wo=Be.prototype,QP=n(function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1},"Scope");wo.enterScope=function(t){this.scopeStack.push(new QP(t))};wo.exitScope=function(){this.scopeStack.pop()};wo.treatFunctionsAsVarInScope=function(t){return t.flags&ra||!this.inModule&&t.flags&u_};wo.declareName=function(t,e,i){var o=!1;if(e===Ri){var s=this.currentScope();o=s.lexical.indexOf(t)>-1||s.functions.indexOf(t)>-1||s.var.indexOf(t)>-1,s.lexical.push(t),this.inModule&&s.flags&u_&&delete this.undefinedExports[t]}else if(e===V1){var r=this.currentScope();r.lexical.push(t)}else if(e===M1){var l=this.currentScope();this.treatFunctionsAsVar?o=l.lexical.indexOf(t)>-1:o=l.lexical.indexOf(t)>-1||l.var.indexOf(t)>-1,l.functions.push(t)}else for(var p=this.scopeStack.length-1;p>=0;--p){var f=this.scopeStack[p];if(f.lexical.indexOf(t)>-1&&!(f.flags&A1&&f.lexical[0]===t)||!this.treatFunctionsAsVarInScope(f)&&f.functions.indexOf(t)>-1){o=!0;break}if(f.var.push(t),this.inModule&&f.flags&u_&&delete this.undefinedExports[t],f.flags&cw)break}o&&this.raiseRecoverable(i,"Identifier '"+t+"' has already been declared")};wo.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};wo.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};wo.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&cw)return e}};wo.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&cw&&!(e.flags&N1))return e}};var wy=n(function(e,i,o){this.type="",this.start=i,this.end=0,e.options.locations&&(this.loc=new yy(e,o)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[i,0])},"Node"),d_=Be.prototype;d_.startNode=function(){return new wy(this,this.start,this.startLoc)};d_.startNodeAt=function(t,e){return new wy(this,t,e)};function B1(t,e,i,o){return t.type=e,t.end=i,this.options.locations&&(t.loc.end=o),this.options.ranges&&(t.range[1]=i),t}n(B1,"finishNodeAt");d_.finishNode=function(t,e){return B1.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};d_.finishNodeAt=function(t,e,i,o){return B1.call(this,t,e,i,o)};d_.copyNode=function(t){var e=new wy(this,t.start,this.startLoc);for(var i in t)e[i]=t[i];return e};var F1="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Y1=F1+" Extended_Pictographic",j1=Y1,U1=j1+" EBase EComp EMod EPres ExtPict",W1=U1,ZP=W1,eN={9:F1,10:Y1,11:j1,12:U1,13:W1,14:ZP},tN="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",iN={9:"",10:"",11:"",12:"",13:"",14:tN},b1="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",H1="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",J1=H1+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",G1=J1+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",z1=G1+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",$1=z1+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",oN=$1+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",nN={9:H1,10:J1,11:G1,12:z1,13:$1,14:oN},K1={};function sN(t){var e=K1[t]={binary:yo(eN[t]+" "+b1),binaryOfStrings:yo(iN[t]),nonBinary:{General_Category:yo(b1),Script:yo(nN[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}n(sN,"buildUnicodeData");for(_y=0,ow=[9,10,11,12,13,14];_y<ow.length;_y+=1)w1=ow[_y],sN(w1);var w1,_y,ow,O=Be.prototype,_i=n(function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=K1[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]},"RegExpValidationState");_i.prototype.reset=n(function(e,i,o){var s=o.indexOf("v")!==-1,r=o.indexOf("u")!==-1;this.start=e|0,this.source=i+"",this.flags=o,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=r&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=r&&this.parser.options.ecmaVersion>=9)},"reset");_i.prototype.raise=n(function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},"raise");_i.prototype.at=n(function(e,i){i===void 0&&(i=!1);var o=this.source,s=o.length;if(e>=s)return-1;var r=o.charCodeAt(e);if(!(i||this.switchU)||r<=55295||r>=57344||e+1>=s)return r;var l=o.charCodeAt(e+1);return l>=56320&&l<=57343?(r<<10)+l-56613888:r},"at");_i.prototype.nextIndex=n(function(e,i){i===void 0&&(i=!1);var o=this.source,s=o.length;if(e>=s)return s;var r=o.charCodeAt(e),l;return!(i||this.switchU)||r<=55295||r>=57344||e+1>=s||(l=o.charCodeAt(e+1))<56320||l>57343?e+1:e+2},"nextIndex");_i.prototype.current=n(function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},"current");_i.prototype.lookahead=n(function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},"lookahead");_i.prototype.advance=n(function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},"advance");_i.prototype.eat=n(function(e,i){return i===void 0&&(i=!1),this.current(i)===e?(this.advance(i),!0):!1},"eat");_i.prototype.eatChars=n(function(e,i){i===void 0&&(i=!1);for(var o=this.pos,s=0,r=e;s<r.length;s+=1){var l=r[s],p=this.at(o,i);if(p===-1||p!==l)return!1;o=this.nextIndex(o,i)}return this.pos=o,!0},"eatChars");O.validateRegExpFlags=function(t){for(var e=t.validFlags,i=t.flags,o=!1,s=!1,r=0;r<i.length;r++){var l=i.charAt(r);e.indexOf(l)===-1&&this.raise(t.start,"Invalid regular expression flag"),i.indexOf(l,r+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),l==="u"&&(o=!0),l==="v"&&(s=!0)}this.options.ecmaVersion>=15&&o&&s&&this.raise(t.start,"Invalid regular expression flag")};O.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&t.groupNames.length>0&&(t.switchN=!0,this.regexp_pattern(t))};O.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames.length=0,t.backReferenceNames.length=0,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,i=t.backReferenceNames;e<i.length;e+=1){var o=i[e];t.groupNames.indexOf(o)===-1&&t.raise("Invalid named capture referenced")}};O.regexp_disjunction=function(t){for(this.regexp_alternative(t);t.eat(124);)this.regexp_alternative(t);this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};O.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};O.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),!0):!1};O.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!i,!0}return t.pos=e,!1};O.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};O.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};O.regexp_eatBracedQuantifier=function(t,e){var i=t.pos;if(t.eat(123)){var o=0,s=-1;if(this.regexp_eatDecimalDigits(t)&&(o=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(s=t.lastIntValue),t.eat(125)))return s!==-1&&s<o&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=i}return!1};O.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};O.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};O.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)&&t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}t.pos=e}return!1};O.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1};O.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};O.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};O.regexp_eatSyntaxCharacter=function(t){var e=t.current();return q1(e)?(t.lastIntValue=e,t.advance(),!0):!1};function q1(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}n(q1,"isSyntaxCharacter");O.regexp_eatPatternCharacters=function(t){for(var e=t.pos,i=0;(i=t.current())!==-1&&!q1(i);)t.advance();return t.pos!==e};O.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),!0):!1};O.regexp_groupSpecifier=function(t){if(t.eat(63)){if(this.regexp_eatGroupName(t)){t.groupNames.indexOf(t.lastStringValue)!==-1&&t.raise("Duplicate capture group name"),t.groupNames.push(t.lastStringValue);return}t.raise("Invalid group")}};O.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1};O.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=bo(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=bo(t.lastIntValue);return!0}return!1};O.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,i=this.options.ecmaVersion>=11,o=t.current(i);return t.advance(i),o===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,i)&&(o=t.lastIntValue),rN(o)?(t.lastIntValue=o,!0):(t.pos=e,!1)};function rN(t){return Ni(t,!0)||t===36||t===95}n(rN,"isRegExpIdentifierStart");O.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,i=this.options.ecmaVersion>=11,o=t.current(i);return t.advance(i),o===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,i)&&(o=t.lastIntValue),aN(o)?(t.lastIntValue=o,!0):(t.pos=e,!1)};function aN(t){return na(t,!0)||t===36||t===95||t===8204||t===8205}n(aN,"isRegExpIdentifierPart");O.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?!0:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)};O.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var i=t.lastIntValue;if(t.switchU)return i>t.maxBackReference&&(t.maxBackReference=i),!0;if(i<=t.numCapturingParens)return!0;t.pos=e}return!1};O.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1};O.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};O.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};O.regexp_eatZero=function(t){return t.current()===48&&!Ty(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};O.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),!0):e===110?(t.lastIntValue=10,t.advance(),!0):e===118?(t.lastIntValue=11,t.advance(),!0):e===102?(t.lastIntValue=12,t.advance(),!0):e===114?(t.lastIntValue=13,t.advance(),!0):!1};O.regexp_eatControlLetter=function(t){var e=t.current();return X1(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function X1(t){return t>=65&&t<=90||t>=97&&t<=122}n(X1,"isControlLetter");O.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=!1);var i=t.pos,o=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var s=t.lastIntValue;if(o&&s>=55296&&s<=56319){var r=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var l=t.lastIntValue;if(l>=56320&&l<=57343)return t.lastIntValue=(s-55296)*1024+(l-56320)+65536,!0}t.pos=r,t.lastIntValue=s}return!0}if(o&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&uN(t.lastIntValue))return!0;o&&t.raise("Invalid unicode escape"),t.pos=i}return!1};function uN(t){return t>=0&&t<=1114111}n(uN,"isValidUnicode");O.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?!0:t.eat(47)?(t.lastIntValue=47,!0):!1;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),!0):!1};O.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1};var Q1=0,Ai=1,Vt=2;O.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(lN(e))return t.lastIntValue=-1,t.advance(),Ai;var i=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((i=e===80)||e===112)){t.lastIntValue=-1,t.advance();var o;if(t.eat(123)&&(o=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return i&&o===Vt&&t.raise("Invalid property name"),o;t.raise("Invalid property name")}return Q1};function lN(t){return t===100||t===68||t===115||t===83||t===119||t===87}n(lN,"isCharacterClassEscape");O.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var i=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var o=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,i,o),Ai}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var s=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,s)}return Q1};O.regexp_validateUnicodePropertyNameAndValue=function(t,e,i){l_(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(i)||t.raise("Invalid property value")};O.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return Ai;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return Vt;t.raise("Invalid property name")};O.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Z1(e=t.current());)t.lastStringValue+=bo(e),t.advance();return t.lastStringValue!==""};function Z1(t){return X1(t)||t===95}n(Z1,"isUnicodePropertyNameCharacter");O.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";cN(e=t.current());)t.lastStringValue+=bo(e),t.advance();return t.lastStringValue!==""};function cN(t){return Z1(t)||Ty(t)}n(cN,"isUnicodePropertyValueCharacter");O.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};O.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),i=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&i===Vt&&t.raise("Negated character class may contain strings"),!0}return!1};O.regexp_classContents=function(t){return t.current()===93?Ai:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),Ai)};O.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var i=t.lastIntValue;t.switchU&&(e===-1||i===-1)&&t.raise("Invalid character class"),e!==-1&&i!==-1&&e>i&&t.raise("Range out of order in character class")}}};O.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var i=t.current();(i===99||iC(i))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var o=t.current();return o!==93?(t.lastIntValue=o,t.advance(),!0):!1};O.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};O.regexp_classSetExpression=function(t){var e=Ai,i;if(!this.regexp_eatClassSetRange(t))if(i=this.regexp_eatClassSetOperand(t)){i===Vt&&(e=Vt);for(var o=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(i=this.regexp_eatClassSetOperand(t))){i!==Vt&&(e=Ai);continue}t.raise("Invalid character in character class")}if(o!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(o!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(i=this.regexp_eatClassSetOperand(t),!i)return e;i===Vt&&(e=Vt)}};O.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var o=t.lastIntValue;return i!==-1&&o!==-1&&i>o&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1};O.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?Ai:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};O.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var i=t.eat(94),o=this.regexp_classContents(t);if(t.eat(93))return i&&o===Vt&&t.raise("Negated character class may contain strings"),o;t.pos=e}if(t.eat(92)){var s=this.regexp_eatCharacterClassEscape(t);if(s)return s;t.pos=e}return null};O.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var i=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return i}else t.raise("Invalid escape");t.pos=e}return null};O.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===Vt&&(e=Vt);return e};O.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?Ai:Vt};O.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?!0:t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1);var i=t.current();return i<0||i===t.lookahead()&&dN(i)||pN(i)?!1:(t.advance(),t.lastIntValue=i,!0)};function dN(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}n(dN,"isClassSetReservedDoublePunctuatorCharacter");function pN(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}n(pN,"isClassSetSyntaxCharacter");O.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return fN(e)?(t.lastIntValue=e,t.advance(),!0):!1};function fN(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}n(fN,"isClassSetReservedPunctuator");O.regexp_eatClassControlLetter=function(t){var e=t.current();return Ty(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};O.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1};O.regexp_eatDecimalDigits=function(t){var e=t.pos,i=0;for(t.lastIntValue=0;Ty(i=t.current());)t.lastIntValue=10*t.lastIntValue+(i-48),t.advance();return t.pos!==e};function Ty(t){return t>=48&&t<=57}n(Ty,"isDecimalDigit");O.regexp_eatHexDigits=function(t){var e=t.pos,i=0;for(t.lastIntValue=0;eC(i=t.current());)t.lastIntValue=16*t.lastIntValue+tC(i),t.advance();return t.pos!==e};function eC(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}n(eC,"isHexDigit");function tC(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}n(tC,"hexToInt");O.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var i=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+i*8+t.lastIntValue:t.lastIntValue=e*8+i}else t.lastIntValue=e;return!0}return!1};O.regexp_eatOctalDigit=function(t){var e=t.current();return iC(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function iC(t){return t>=48&&t<=55}n(iC,"isOctalDigit");O.regexp_eatFixedHexDigits=function(t,e){var i=t.pos;t.lastIntValue=0;for(var o=0;o<e;++o){var s=t.current();if(!eC(s))return t.pos=i,!1;t.lastIntValue=16*t.lastIntValue+tC(s),t.advance()}return!0};var mw=n(function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new yy(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},"Token"),oe=Be.prototype;oe.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new mw(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};oe.getToken=function(){return this.next(),new mw(this)};typeof Symbol<"u"&&(oe[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===_.eof,value:e}}}});oe.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(_.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};oe.readToken=function(t){return Ni(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};oe.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888};oe.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var o=void 0,s=e;(o=k1(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=o;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,i),e,this.pos,t,this.curPosition())};oe.skipLineComment=function(t){for(var e=this.pos,i=this.options.onComment&&this.curPosition(),o=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!sa(o);)o=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,i,this.curPosition())};oe.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(t>8&&t<14||t>=5760&&S1.test(String.fromCharCode(t)))++this.pos;else break e}}};oe.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=t,this.value=e,this.updateContext(i)};oe.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(_.ellipsis)):(++this.pos,this.finishToken(_.dot))};oe.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(_.assign,2):this.finishOp(_.slash,1)};oe.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),i=1,o=t===42?_.star:_.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++i,o=_.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(_.assign,i+1):this.finishOp(o,i)};oe.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(_.assign,3)}return this.finishOp(t===124?_.logicalOR:_.logicalAND,2)}return e===61?this.finishOp(_.assign,2):this.finishOp(t===124?_.bitwiseOR:_.bitwiseAND,1)};oe.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(_.assign,2):this.finishOp(_.bitwiseXOR,1)};oe.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||Ot.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(_.incDec,2):e===61?this.finishOp(_.assign,2):this.finishOp(_.plusMin,1)};oe.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),i=1;return e===t?(i=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(_.assign,i+1):this.finishOp(_.bitShift,i)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(i=2),this.finishOp(_.relational,i))};oe.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(_.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(_.arrow)):this.finishOp(t===61?_.eq:_.prefix,1)};oe.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(_.questionDot,2)}if(e===63){if(t>=12){var o=this.input.charCodeAt(this.pos+2);if(o===61)return this.finishOp(_.assign,3)}return this.finishOp(_.coalesce,2)}}return this.finishOp(_.question,1)};oe.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Ni(e,!0)||e===92))return this.finishToken(_.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+bo(e)+"'")};oe.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(_.parenL);case 41:return++this.pos,this.finishToken(_.parenR);case 59:return++this.pos,this.finishToken(_.semi);case 44:return++this.pos,this.finishToken(_.comma);case 91:return++this.pos,this.finishToken(_.bracketL);case 93:return++this.pos,this.finishToken(_.bracketR);case 123:return++this.pos,this.finishToken(_.braceL);case 125:return++this.pos,this.finishToken(_.braceR);case 58:return++this.pos,this.finishToken(_.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(_.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(_.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+bo(t)+"'")};oe.finishOp=function(t,e){var i=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,i)};oe.readRegexp=function(){for(var t,e,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var o=this.input.charAt(this.pos);if(Ot.test(o)&&this.raise(i,"Unterminated regular expression"),t)t=!1;else{if(o==="[")e=!0;else if(o==="]"&&e)e=!1;else if(o==="/"&&!e)break;t=o==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var r=this.pos,l=this.readWord1();this.containsEsc&&this.unexpected(r);var p=this.regexpState||(this.regexpState=new _i(this));p.reset(i,s,l),this.validateRegExpFlags(p),this.validateRegExpPattern(p);var f=null;try{f=new RegExp(s,l)}catch(h){}return this.finishToken(_.regexp,{pattern:s,flags:l,value:f})};oe.readInt=function(t,e,i){for(var o=this.options.ecmaVersion>=12&&e===void 0,s=i&&this.input.charCodeAt(this.pos)===48,r=this.pos,l=0,p=0,f=0,h=e==null?1/0:e;f<h;++f,++this.pos){var m=this.input.charCodeAt(this.pos),b=void 0;if(o&&m===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),p===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),f===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),p=m;continue}if(m>=97?b=m-97+10:m>=65?b=m-65+10:m>=48&&m<=57?b=m-48:b=1/0,b>=t)break;p=m,l=l*t+b}return o&&p===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||e!=null&&this.pos-r!==e?null:l};function mN(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}n(mN,"stringToNumber");function oC(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}n(oC,"stringToBigInt");oe.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var i=this.readInt(t);return i==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=oC(this.input.slice(e,this.pos)),++this.pos):Ni(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(_.num,i)};oe.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,!0)===null&&this.raise(e,"Invalid number");var i=this.pos-e>=2&&this.input.charCodeAt(e)===48;i&&this.strict&&this.raise(e,"Invalid number");var o=this.input.charCodeAt(this.pos);if(!i&&!t&&this.options.ecmaVersion>=11&&o===110){var s=oC(this.input.slice(e,this.pos));return++this.pos,Ni(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(_.num,s)}i&&/[89]/.test(this.input.slice(e,this.pos))&&(i=!1),o===46&&!i&&(++this.pos,this.readInt(10),o=this.input.charCodeAt(this.pos)),(o===69||o===101)&&!i&&(o=this.input.charCodeAt(++this.pos),(o===43||o===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),Ni(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=mN(this.input.slice(e,this.pos),i);return this.finishToken(_.num,r)};oe.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else e=this.readHexChar(4);return e};oe.readString=function(t){for(var e="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var o=this.input.charCodeAt(this.pos);if(o===t)break;o===92?(e+=this.input.slice(i,this.pos),e+=this.readEscapedChar(!1),i=this.pos):o===8232||o===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(sa(o)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(i,this.pos++),this.finishToken(_.string,e)};var nC={};oe.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===nC)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};oe.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw nC;this.raise(t,e)};oe.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===_.template||this.type===_.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(_.dollarBraceL)):(++this.pos,this.finishToken(_.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(_.template,t));if(i===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(sa(i)){switch(t+=this.input.slice(e,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
|
|
`;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(this,5),I(this,Oe,e,"f")}init(e){return y(this,void 0,void 0,function*(){I(this,we,e,"f"),this.validateCredentials()?this.has_access_token_expired||d(this,Oe,"f").emit("auth",{credentials:d(this,we,"f"),status:"SUCCESS"}):(yield d(this,Mi,"m",aC).call(this))||(yield d(this,Mi,"m",_w).call(this))})}cacheCredentials(){var e;return y(this,void 0,void 0,function*(){let o=new TextEncoder().encode(JSON.stringify(d(this,we,"f")));yield(e=d(this,Oe,"f").cache)===null||e===void 0?void 0:e.set("youtubei_oauth_credentials",o.buffer)})}removeCache(){var e;return y(this,void 0,void 0,function*(){yield(e=d(this,Oe,"f").cache)===null||e===void 0?void 0:e.remove("youtubei_oauth_credentials")})}refreshIfRequired(){return y(this,void 0,void 0,function*(){this.has_access_token_expired&&(yield d(this,Mi,"m",uC).call(this))})}revokeCredentials(){return y(this,void 0,void 0,function*(){if(!!d(this,we,"f"))return yield this.removeCache(),d(this,Oe,"f").http.fetch_function(new URL(`/o/oauth2/revoke?token=${encodeURIComponent(d(this,we,"f").access_token)}`,X.URLS.YT_BASE),{method:"post"})})}get credentials(){return d(this,we,"f")}get has_access_token_expired(){let e=d(this,we,"f")?new Date(d(this,we,"f").expires).getTime():-1/0;return new Date().getTime()>e}validateCredentials(){return d(this,we,"f")&&Reflect.has(d(this,we,"f"),"access_token")&&Reflect.has(d(this,we,"f"),"refresh_token")&&Reflect.has(d(this,we,"f"),"expires")||!1}};n(To,"OAuth");Kt=new WeakMap,Oe=new WeakMap,we=new WeakMap,ky=new WeakMap,Mi=new WeakSet,aC=n(function(){var e;return y(this,void 0,void 0,function*(){let i=yield(e=d(this,Oe,"f").cache)===null||e===void 0?void 0:e.get("youtubei_oauth_credentials");if(!i)return!1;let o=new TextDecoder,s=JSON.parse(o.decode(i));return I(this,we,{access_token:s.access_token,refresh_token:s.refresh_token,client_id:s.client_id,client_secret:s.client_secret,expires:new Date(s.expires)},"f"),d(this,Oe,"f").emit("auth",{credentials:d(this,we,"f"),status:"SUCCESS"}),!0})},"_OAuth_loadCachedCredentials"),_w=n(function(){return y(this,void 0,void 0,function*(){I(this,Kt,yield d(this,Mi,"m",hw).call(this),"f");let e={client_id:d(this,Kt,"f").client_id,scope:X.OAUTH.SCOPE,device_id:L.shim.uuidv4(),device_model:X.OAUTH.MODEL_NAME},o=yield(yield d(this,Oe,"f").http.fetch_function(new URL("/o/oauth2/device/code",X.URLS.YT_BASE),{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"}})).json();d(this,Oe,"f").emit("auth-pending",o),I(this,ky,o.interval,"f"),d(this,Mi,"m",rC).call(this,o.device_code)})},"_OAuth_getUserCode"),rC=n(function(e){let i=setInterval(()=>y(this,void 0,void 0,function*(){var o,s;let r=Object.assign(Object.assign({},d(this,Kt,"f")),{code:e,grant_type:X.OAUTH.GRANT_TYPE});try{let p=yield(yield d(this,Oe,"f").http.fetch_function(new URL("/o/oauth2/token",X.URLS.YT_BASE),{body:JSON.stringify(r),method:"POST",headers:{"Content-Type":"application/json"}})).json();if(p.error){switch(p.error){case"access_denied":d(this,Oe,"f").emit("auth-error",new mi("Access was denied.",{status:"ACCESS_DENIED"}));break;case"expired_token":d(this,Oe,"f").emit("auth-error",new mi("The device code has expired, restarting auth flow.",{status:"DEVICE_CODE_EXPIRED"})),clearInterval(i),d(this,Mi,"m",_w).call(this);break;default:break}return}let f=new Date(new Date().getTime()+p.expires_in*1e3);I(this,we,{access_token:p.access_token,refresh_token:p.refresh_token,client_id:(o=d(this,Kt,"f"))===null||o===void 0?void 0:o.client_id,client_secret:(s=d(this,Kt,"f"))===null||s===void 0?void 0:s.client_secret,expires:f},"f"),d(this,Oe,"f").emit("auth",{credentials:d(this,we,"f"),status:"SUCCESS"}),clearInterval(i)}catch(l){return clearInterval(i),d(this,Oe,"f").emit("auth-error",new mi("Could not obtain user code.",{status:"FAILED",error:l}))}}),d(this,ky,"f")*1e3)},"_OAuth_startPolling"),uC=n(function(){return y(this,void 0,void 0,function*(){if(!d(this,we,"f"))return;I(this,Kt,yield d(this,Mi,"m",hw).call(this),"f");let e=Object.assign(Object.assign({},d(this,Kt,"f")),{refresh_token:d(this,we,"f").refresh_token,grant_type:"refresh_token"}),o=yield(yield d(this,Oe,"f").http.fetch_function(new URL("/o/oauth2/token",X.URLS.YT_BASE),{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"}})).json(),s=new Date(new Date().getTime()+o.expires_in*1e3);I(this,we,{access_token:o.access_token,refresh_token:o.refresh_token||d(this,we,"f").refresh_token,client_id:d(this,Kt,"f").client_id,client_secret:d(this,Kt,"f").client_secret,expires:s},"f"),d(this,Oe,"f").emit("update-credentials",{credentials:d(this,we,"f"),status:"SUCCESS"})})},"_OAuth_refreshAccessToken"),hw=n(function(){var e,i,o;return y(this,void 0,void 0,function*(){if(((e=d(this,we,"f"))===null||e===void 0?void 0:e.client_id)&&((i=this.credentials)===null||i===void 0?void 0:i.client_secret))return U.info(To.TAG,`Using custom OAuth2 credentials.
|
|
`),{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");b?l.searchParams.set(b,m):l.searchParams.set("signature",m)}let p=l.searchParams.get("n");if(p){let m;if(s&&s.has(p))m=s.get(p);else{if(m=L.shim.eval(d(this,ua,"f"),{nsig:p}),U.info(Ee.TAG,`Transformed nsig ${p} to ${m}.`),typeof m!="string")throw new zt("Failed to decipher nsig");m.startsWith("enhanced_except_")?U.warn(Ee.TAG,`Could not transform nsig, download may be throttled.
|
|
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_behalf_of_user:b};if(U.info(bt.TAG,"Retrieving InnerTube session."),l)x=d(this,ca,"m",bw).call(this,T);else try{x=yield d(this,ca,"m",pC).call(this,T,m)}catch(k){U.error(bt.TAG,"Failed to retrieve session data from server. Will try to generate it locally."),x=d(this,ca,"m",bw).call(this,T)}return U.info(bt.TAG,`Got session data.
|
|
`,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{constructor(e){My.add(this),h_.set(this,void 0),pe.set(this,void 0),I(this,h_,e,"f"),I(this,pe,e.actions,"f")}getInfo(e){if(e instanceof Rs)return d(this,My,"m",mC).call(this,e);if(typeof e=="string")return d(this,My,"m",fC).call(this,e);throw new v("Invalid target, expected either a video id or a valid MusicTwoRowItem",e)}search(e,i={}){return y(this,void 0,void 0,function*(){ie({query:e});let o=yield d(this,pe,"f").execute(yt.PATH,yt.build({query:e,client:"YTMUSIC",params:i.type&&i.type!=="all"?mb(i):void 0}));return new jx(o,d(this,pe,"f"),Reflect.has(i,"type")&&i.type!=="all")})}getHomeFeed(){return y(this,void 0,void 0,function*(){let e=yield d(this,pe,"f").execute(F.PATH,F.build({browse_id:"FEmusic_home",client:"YTMUSIC"}));return new Lx(e,d(this,pe,"f"))})}getExplore(){return y(this,void 0,void 0,function*(){let e=yield d(this,pe,"f").execute(F.PATH,F.build({client:"YTMUSIC",browse_id:"FEmusic_explore"}));return new Dx(e)})}getLibrary(){return y(this,void 0,void 0,function*(){let e=yield d(this,pe,"f").execute(F.PATH,F.build({client:"YTMUSIC",browse_id:"FEmusic_library_landing"}));return new Bx(e,d(this,pe,"f"))})}getArtist(e){return y(this,void 0,void 0,function*(){if(ie({artist_id:e}),!e.startsWith("UC")&&!e.startsWith("FEmusic_library_privately_owned_artist"))throw new v("Invalid artist id",e);let i=yield d(this,pe,"f").execute(F.PATH,F.build({client:"YTMUSIC",browse_id:e}));return new Vx(i,d(this,pe,"f"))})}getAlbum(e){return y(this,void 0,void 0,function*(){if(ie({album_id:e}),!e.startsWith("MPR")&&!e.startsWith("FEmusic_library_privately_owned_release"))throw new v("Invalid album id",e);let i=yield d(this,pe,"f").execute(F.PATH,F.build({client:"YTMUSIC",browse_id:e}));return new Ax(i)})}getPlaylist(e){return y(this,void 0,void 0,function*(){ie({playlist_id:e}),e.startsWith("VL")||(e=`VL${e}`);let i=yield d(this,pe,"f").execute(F.PATH,F.build({client:"YTMUSIC",browse_id:e}));return new fr(i,d(this,pe,"f"))})}getUpNext(e,i=!0){var o,s,r;return y(this,void 0,void 0,function*(){ie({video_id:e});let p=(o=(yield d(this,pe,"f").execute(Ce.PATH,Object.assign(Object.assign({},Ce.build({video_id:e,client:"YTMUSIC"})),{parse:!0}))).contents_memo)===null||o===void 0?void 0:o.getType(be),f=p==null?void 0:p.first();if(!f)throw new v("Could not find target tab.");let h=(s=f.content)===null||s===void 0?void 0:s.as(Ms);if(!h||!h.content)throw new v("Music queue was empty, the given id is probably invalid.",h);let m=h.content.as(ni);if(!m.playlist_id&&i){let b=m.contents.firstOfType(Bi);if(!b)throw new v("Automix item not found");let x=yield(r=b.playlist_video)===null||r===void 0?void 0:r.endpoint.call(d(this,pe,"f"),{videoId:e,client:"YTMUSIC",parse:!0});if(!x||!x.contents_memo)throw new v("Could not fetch automix");return x.contents_memo.getType(ni).first()}return m})}getRelated(e){var i;return y(this,void 0,void 0,function*(){ie({video_id:e});let s=(i=(yield d(this,pe,"f").execute(Ce.PATH,Object.assign(Object.assign({},Ce.build({video_id:e,client:"YTMUSIC"})),{parse:!0}))).contents_memo)===null||i===void 0?void 0:i.getType(be),r=s==null?void 0:s.matchCondition(f=>{var h,m;return((m=(h=f.endpoint.payload.browseEndpointContextSupportedConfigs)===null||h===void 0?void 0:h.browseEndpointContextMusicConfig)===null||m===void 0?void 0:m.pageType)==="MUSIC_PAGE_TYPE_TRACK_RELATED"});if(!r)throw new v("Could not find target tab.");let l=yield r.endpoint.call(d(this,pe,"f"),{client:"YTMUSIC",parse:!0});if(!l.contents)throw new v("Unexpected response",l);return l.contents.item().as(Q,Ge)})}getLyrics(e){var i;return y(this,void 0,void 0,function*(){ie({video_id:e});let s=(i=(yield d(this,pe,"f").execute(Ce.PATH,Object.assign(Object.assign({},Ce.build({video_id:e,client:"YTMUSIC"})),{parse:!0}))).contents_memo)===null||i===void 0?void 0:i.getType(be),r=s==null?void 0:s.matchCondition(f=>{var h,m;return((m=(h=f.endpoint.payload.browseEndpointContextSupportedConfigs)===null||h===void 0?void 0:h.browseEndpointContextMusicConfig)===null||m===void 0?void 0:m.pageType)==="MUSIC_PAGE_TYPE_TRACK_LYRICS"});if(!r)throw new v("Could not find target tab.");let l=yield r.endpoint.call(d(this,pe,"f"),{client:"YTMUSIC",parse:!0});if(!l.contents)throw new v("Unexpected response",l);if(l.contents.item().type==="Message")throw new v(l.contents.item().as(Ge).text.toString(),e);return l.contents.item().as(Q).contents.firstOfType(Xi)})}getRecap(){return y(this,void 0,void 0,function*(){let e=yield d(this,pe,"f").execute(F.PATH,F.build({client:"YTMUSIC_ANDROID",browse_id:"FEmusic_listening_review"}));return new Yx(e,d(this,pe,"f"))})}getSearchSuggestions(e){return y(this,void 0,void 0,function*(){let i=yield d(this,pe,"f").execute(Pn.PATH,Object.assign(Object.assign({},Pn.build({input:e})),{parse:!0}));return i.contents_memo?i.contents_memo.getType(Ag):[]})}};n(Vy,"Music");h_=new WeakMap,pe=new WeakMap,My=new WeakSet,fC=n(function(e){var i;return y(this,void 0,void 0,function*(){let o=st.build({video_id:e,sts:(i=d(this,h_,"f").player)===null||i===void 0?void 0:i.sts,client:"YTMUSIC"}),s=Ce.build({video_id:e,client:"YTMUSIC"}),r=d(this,pe,"f").execute(st.PATH,o),l=d(this,pe,"f").execute(Ce.PATH,s),p=yield Promise.all([r,l]),f=Nt(16);return new o_(p,d(this,pe,"f"),f)})},"_Music_fetchInfoFromVideoId"),mC=n(function(e){var i;return y(this,void 0,void 0,function*(){if(!e)throw new v("List item cannot be undefined");if(!e.endpoint)throw new Error("This item does not have an endpoint.");let o=e.endpoint.call(d(this,pe,"f"),{client:"YTMUSIC",playbackContext:{contentPlaybackContext:Object.assign({signatureTimestamp:(i=d(this,h_,"f").player)===null||i===void 0?void 0:i.sts})}}),s=e.endpoint.call(d(this,pe,"f"),{client:"YTMUSIC",enablePersistentPlaylistPanel:!0,override_endpoint:"/next"}),r=Nt(16),l=yield Promise.all([o,s]);return new o_(l,d(this,pe,"f"),r)})},"_Music_fetchInfoFromListItem");var Oy=Vy;var __,qt,hC,_C,vC,Dy=class{constructor(e){__.add(this),qt.set(this,void 0),I(this,qt,e,"f")}setThumbnail(e,i){return y(this,void 0,void 0,function*(){if(!d(this,qt,"f").logged_in)throw new v("You must be signed in to perform this operation.");if(!e||!i)throw new Ln("One or more parameters are missing.");let o=yb(e,i);return yield d(this,qt,"f").actions.execute("/video_manager/metadata_update",{protobuf:!0,serialized_data:o})})}updateVideoMetadata(e,i){return y(this,void 0,void 0,function*(){if(!d(this,qt,"f").logged_in)throw new v("You must be signed in to perform this operation.");let o=xb(e,i);return yield d(this,qt,"f").actions.execute("/video_manager/metadata_update",{protobuf:!0,serialized_data:o})})}upload(e,i={}){return y(this,void 0,void 0,function*(){if(!d(this,qt,"f").logged_in)throw new v("You must be signed in to perform this operation.");let o=yield d(this,__,"m",hC).call(this),s=yield d(this,__,"m",_C).call(this,o.upload_url,e);if(s.status!=="STATUS_SUCCESS")throw new v("Could not process video.");return yield d(this,__,"m",vC).call(this,o,s,i)})}};n(Dy,"Studio");qt=new WeakMap,__=new WeakSet,hC=n(function(){return y(this,void 0,void 0,function*(){let e=`innertube_android:${L.shim.uuidv4()}:0:v=3,api=1,cf=3`,i={frontendUploadId:e,deviceDisplayName:"Pixel 6 Pro",fileId:`goog-edited-video://generated?videoFileUri=content://media/external/video/media/${L.shim.uuidv4()}`,mp4MoovAtomRelocationStatus:"UNSUPPORTED",transcodeResult:"DISABLED",connectionType:"WIFI"},o=yield d(this,qt,"f").http.fetch("/upload/youtubei",{baseURL:X.URLS.YT_UPLOAD,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","x-goog-upload-command":"start","x-goog-upload-protocol":"resumable"},body:JSON.stringify(i)});if(!o.ok)throw new v("Could not get initial upload data");return{frontend_upload_id:e,upload_id:o.headers.get("x-guploader-uploadid"),upload_url:o.headers.get("x-goog-upload-url"),scotty_resource_id:o.headers.get("x-goog-upload-header-scotty-resource-id"),chunk_granularity:o.headers.get("x-goog-upload-chunk-granularity")}})},"_Studio_getInitialUploadData"),_C=n(function(e,i){return y(this,void 0,void 0,function*(){let o=yield d(this,qt,"f").http.fetch_function(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","x-goog-upload-command":"upload, finalize","x-goog-upload-file-name":`file-${Date.now()}`,"x-goog-upload-offset":"0"},body:i});if(!o.ok)throw new v("Could not upload video");return yield o.json()})},"_Studio_uploadVideo"),vC=n(function(e,i,o){return y(this,void 0,void 0,function*(){return yield d(this,qt,"f").actions.execute(On.PATH,On.build({resource_id:{scotty_resource_id:{id:i.scottyResourceId}},frontend_upload_id:e.frontend_upload_id,initial_metadata:{title:{new_title:o.title||new Date().toDateString()},description:{new_description:o.description||"",should_segment:!0},privacy:{new_privacy:o.privacy||"PRIVATE"},draft_state:{is_draft:o.is_draft}},client:"ANDROID"}))})},"_Studio_setVideoMetadata");var Ly=Dy;var kw={};B(kw,{AccountManager:()=>Fy,InteractionManager:()=>Wy,PlaylistManager:()=>jy});var wt,By=class{constructor(e){wt.set(this,void 0),I(this,wt,e,"f"),this.channel={editName:i=>{if(!d(this,wt,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");return d(this,wt,"f").execute(Pi.EditNameEndpoint.PATH,Pi.EditNameEndpoint.build({given_name:i}))},editDescription:i=>{if(!d(this,wt,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");return d(this,wt,"f").execute(Pi.EditDescriptionEndpoint.PATH,Pi.EditDescriptionEndpoint.build({given_description:i}))},getBasicAnalytics:()=>this.getAnalytics()}}getInfo(){return y(this,void 0,void 0,function*(){if(!d(this,wt,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");let e=yield d(this,wt,"f").execute(Tn.AccountListEndpoint.PATH,Tn.AccountListEndpoint.build());return new ix(e)})}getTimeWatched(){return y(this,void 0,void 0,function*(){let e=yield d(this,wt,"f").execute(F.PATH,F.build({browse_id:"SPtime_watched",client:"ANDROID"}));return new Px(e)})}getSettings(){return y(this,void 0,void 0,function*(){let e=yield d(this,wt,"f").execute(F.PATH,F.build({browse_id:"SPaccount_overview"}));return new Cx(d(this,wt,"f"),e)})}getAnalytics(){var e;return y(this,void 0,void 0,function*(){let i=yield this.getInfo(),o=yield d(this,wt,"f").execute(F.PATH,F.build({browse_id:"FEanalytics_screen",params:pb((e=i.footers)===null||e===void 0?void 0:e.endpoint.payload.browseId),client:"ANDROID"}));return new nx(o)})}};n(By,"AccountManager");wt=new WeakMap;var Fy=By;var Me,Yy=class{constructor(e){Me.set(this,void 0),I(this,Me,e,"f")}create(e,i){return y(this,void 0,void 0,function*(){if(ie({title:e,video_ids:i}),!d(this,Me,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");let o=yield d(this,Me,"f").execute(An.PATH,An.build({ids:i,title:e}));return{success:o.success,status_code:o.status_code,playlist_id:o.data.playlistId,data:o.data}})}delete(e){return y(this,void 0,void 0,function*(){if(ie({playlist_id:e}),!d(this,Me,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");let i=yield d(this,Me,"f").execute(Rn.PATH,Rn.build({playlist_id:e}));return{playlist_id:e,success:i.success,status_code:i.status_code,data:i.data}})}addVideos(e,i){return y(this,void 0,void 0,function*(){if(ie({playlist_id:e,video_ids:i}),!d(this,Me,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");let o=yield d(this,Me,"f").execute(rt.PATH,rt.build({actions:i.map(s=>({action:"ACTION_ADD_VIDEO",added_video_id:s})),playlist_id:e}));return{playlist_id:e,action_result:o.data.actions}})}removeVideos(e,i){return y(this,void 0,void 0,function*(){if(ie({playlist_id:e,video_ids:i}),!d(this,Me,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");let o=yield d(this,Me,"f").execute(F.PATH,Object.assign(Object.assign({},F.build({browse_id:`VL${e}`})),{parse:!0})),s=new Ii(d(this,Me,"f"),o,!0);if(!s.info.is_editable)throw new v("This playlist cannot be edited.",e);let r={playlist_id:e,actions:[]},l=n(f=>y(this,void 0,void 0,function*(){if(f.videos.filter(m=>i.includes(m.key("id").string())).forEach(m=>r.actions.push({action:"ACTION_REMOVE_VIDEO",set_video_id:m.key("set_video_id").string()})),r.actions.length<i.length){let m=yield f.getContinuation();return l(m)}}),"getSetVideoIds");if(yield l(s),!r.actions.length)throw new v("Given video ids were not found in this playlist.",i);let p=yield d(this,Me,"f").execute(rt.PATH,rt.build(r));return{playlist_id:e,action_result:p.data.actions}})}moveVideo(e,i,o){return y(this,void 0,void 0,function*(){if(ie({playlist_id:e,moved_video_id:i,predecessor_video_id:o}),!d(this,Me,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");let s=yield d(this,Me,"f").execute(F.PATH,Object.assign(Object.assign({},F.build({browse_id:`VL${e}`})),{parse:!0})),r=new Ii(d(this,Me,"f"),s,!0);if(!r.info.is_editable)throw new v("This playlist cannot be edited.",e);let l={playlist_id:e,actions:[]},p,f,h=n(b=>y(this,void 0,void 0,function*(){let x=b.videos.find(k=>i===k.key("id").string()),T=b.videos.find(k=>o===k.key("id").string());if(p=p||(x==null?void 0:x.key("set_video_id").string()),f=f||(T==null?void 0:T.key("set_video_id").string()),!p||!f){let k=yield b.getContinuation();return h(k)}}),"getSetVideoIds");yield h(r),l.actions.push({action:"ACTION_MOVE_VIDEO_AFTER",set_video_id:p,moved_set_video_id_predecessor:f});let m=yield d(this,Me,"f").execute(rt.PATH,rt.build(l));return{playlist_id:e,action_result:m.data.actions}})}setName(e,i){return y(this,void 0,void 0,function*(){if(ie({playlist_id:e,name:i}),!d(this,Me,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");let o={playlist_id:e,actions:[]};o.actions.push({action:"ACTION_SET_PLAYLIST_NAME",playlist_name:i});let s=yield d(this,Me,"f").execute(rt.PATH,rt.build(o));return{playlist_id:e,action_result:s.data.actions}})}setDescription(e,i){return y(this,void 0,void 0,function*(){if(ie({playlist_id:e,description:i}),!d(this,Me,"f").session.logged_in)throw new v("You must be signed in to perform this operation.");let o={playlist_id:e,actions:[]};o.actions.push({action:"ACTION_SET_PLAYLIST_DESCRIPTION",playlist_description:i});let s=yield d(this,Me,"f").execute(rt.PATH,rt.build(o));return{playlist_id:e,action_result:s.data.actions}})}};n(Yy,"PlaylistManager");Me=new WeakMap;var jy=Yy;var He,Uy=class{constructor(e){He.set(this,void 0),I(this,He,e,"f")}like(e){return y(this,void 0,void 0,function*(){if(ie({video_id:e}),!d(this,He,"f").session.logged_in)throw new Error("You must be signed in to perform this operation.");return yield d(this,He,"f").execute(Sn.PATH,Sn.build({client:"ANDROID",target:{video_id:e}}))})}dislike(e){return y(this,void 0,void 0,function*(){if(ie({video_id:e}),!d(this,He,"f").session.logged_in)throw new Error("You must be signed in to perform this operation.");return yield d(this,He,"f").execute(Cn.PATH,Cn.build({client:"ANDROID",target:{video_id:e}}))})}removeRating(e){return y(this,void 0,void 0,function*(){if(ie({video_id:e}),!d(this,He,"f").session.logged_in)throw new Error("You must be signed in to perform this operation.");return yield d(this,He,"f").execute(En.PATH,En.build({client:"ANDROID",target:{video_id:e}}))})}subscribe(e){return y(this,void 0,void 0,function*(){if(ie({channel_id:e}),!d(this,He,"f").session.logged_in)throw new Error("You must be signed in to perform this operation.");return yield d(this,He,"f").execute(Mn.PATH,Mn.build({client:"ANDROID",channel_ids:[e],params:"EgIIAhgA"}))})}unsubscribe(e){return y(this,void 0,void 0,function*(){if(ie({channel_id:e}),!d(this,He,"f").session.logged_in)throw new Error("You must be signed in to perform this operation.");return yield d(this,He,"f").execute(Vn.PATH,Vn.build({client:"ANDROID",channel_ids:[e],params:"CgIIAhgA"}))})}comment(e,i){return y(this,void 0,void 0,function*(){if(ie({video_id:e,text:i}),!d(this,He,"f").session.logged_in)throw new Error("You must be signed in to perform this operation.");return yield d(this,He,"f").execute(kn.PATH,kn.build({comment_text:i,create_comment_params:vb(e),client:"ANDROID"}))})}translate(e,i,o={}){return y(this,void 0,void 0,function*(){ie({text:e,target_language:i});let s=Bo(22,Object.assign({text:e,target_language:i},o)),r=yield d(this,He,"f").execute(In.PATH,In.build({client:"ANDROID",actions:[s]})),l=r.data.frameworkUpdates.entityBatchUpdate.mutations[0].payload.commentEntityPayload;return{success:r.success,status_code:r.status_code,translated_content:l.translatedContent.content,data:r.data}})}setNotificationPreferences(e,i){return y(this,void 0,void 0,function*(){if(ie({channel_id:e,type:i}),!d(this,He,"f").session.logged_in)throw new Error("You must be signed in to perform this operation.");let o={PERSONALIZED:1,ALL:2,NONE:3};if(!Object.keys(o).includes(i.toUpperCase()))throw new Error(`Invalid notification preference type: ${i}`);return yield d(this,He,"f").execute(Nn.PATH,Nn.build({client:"WEB",params:gb(e,o[i.toUpperCase()])}))})}};n(Uy,"InteractionManager");He=new WeakMap;var Wy=Uy;var Ze,da=class{constructor(e){Ze.set(this,void 0),I(this,Ze,e,"f")}static create(e={}){return y(this,void 0,void 0,function*(){return new da(yield Tw.create(e))})}getInfo(e,i){var o,s,r,l,p;return y(this,void 0,void 0,function*(){ie({target:e});let f;if(e instanceof g)f=Ce.build({video_id:(o=e.payload)===null||o===void 0?void 0:o.videoId,playlist_id:(s=e.payload)===null||s===void 0?void 0:s.playlistId,params:(r=e.payload)===null||r===void 0?void 0:r.params,playlist_index:(l=e.payload)===null||l===void 0?void 0:l.index});else if(typeof e=="string")f=Ce.build({video_id:e});else throw new v("Invalid target, expected either a video id or a valid NavigationEndpoint",e);if(!f.videoId)throw new v("Video id cannot be empty",f);let h=st.build({video_id:f.videoId,playlist_id:f==null?void 0:f.playlistId,client:i,sts:(p=d(this,Ze,"f").player)===null||p===void 0?void 0:p.sts}),m=this.actions.execute(st.PATH,h),b=this.actions.execute(Ce.PATH,f),x=yield Promise.all([m,b]),T=Nt(16);return new Kh(x,this.actions,T)})}getBasicInfo(e,i){var o;return y(this,void 0,void 0,function*(){ie({video_id:e});let s=yield this.actions.execute(st.PATH,st.build({video_id:e,client:i,sts:(o=d(this,Ze,"f").player)===null||o===void 0?void 0:o.sts})),r=Nt(16);return new Kh([s],this.actions,r)})}getShortsWatchItem(e,i){return y(this,void 0,void 0,function*(){ie({short_id:e});let o=this.actions.execute(Pt.WatchEndpoint.PATH,Pt.WatchEndpoint.build({short_id:e,client:i})),s=this.actions.execute(Pt.WatchSequenceEndpoint.PATH,Pt.WatchSequenceEndpoint.build({sequenceParams:wb(e)})),r=yield Promise.all([o,s]);return new dy(r,this.actions)})}search(e,i={}){return y(this,void 0,void 0,function*(){ie({query:e});let o=yield this.actions.execute(yt.PATH,yt.build({query:e,params:i?fb(i):void 0}));return new Sx(this.actions,o)})}getSearchSuggestions(e){return y(this,void 0,void 0,function*(){ie({query:e});let i=new URL(`${lt.YT_SUGGESTIONS}search`);i.searchParams.set("q",e),i.searchParams.set("hl",d(this,Ze,"f").context.client.hl),i.searchParams.set("gl",d(this,Ze,"f").context.client.gl),i.searchParams.set("ds","yt"),i.searchParams.set("client","youtube"),i.searchParams.set("xssi","t"),i.searchParams.set("oe","UTF");let s=yield(yield d(this,Ze,"f").http.fetch(i)).text();return JSON.parse(s.replace(")]}'",""))[1].map(p=>p[0])})}getComments(e,i){return y(this,void 0,void 0,function*(){ie({video_id:e});let o=yield this.actions.execute(Ce.PATH,Ce.build({continuation:_b(e,{sort_by:i||"TOP_COMMENTS"})}));return new ux(this.actions,o.data)})}getHomeFeed(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(F.PATH,F.build({browse_id:"FEwhat_to_watch"}));return new Jt(this.actions,e)})}getGuide(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(xr.PATH);return new cx(e.data)})}getLibrary(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(F.PATH,F.build({browse_id:"FElibrary"}));return new vx(this.actions,e)})}getHistory(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(F.PATH,F.build({browse_id:"FEhistory"}));return new Zs(this.actions,e)})}getTrending(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(F.PATH,Object.assign(Object.assign({},F.build({browse_id:"FEtrending"})),{parse:!0}));return new tn(this.actions,e)})}getSubscriptionsFeed(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(F.PATH,Object.assign(Object.assign({},F.build({browse_id:"FEsubscriptions"})),{parse:!0}));return new _e(this.actions,e)})}getChannelsFeed(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(F.PATH,Object.assign(Object.assign({},F.build({browse_id:"FEchannels"})),{parse:!0}));return new _e(this.actions,e)})}getChannel(e){return y(this,void 0,void 0,function*(){ie({id:e});let i=yield this.actions.execute(F.PATH,F.build({browse_id:e}));return new Ve(this.actions,i)})}getNotifications(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(bn.PATH,bn.build({notifications_menu_request_type:"NOTIFICATIONS_MENU_REQUEST_TYPE_INBOX"}));return new kx(this.actions,e)})}getUnseenNotificationsCount(){var e,i,o,s;return y(this,void 0,void 0,function*(){let r=yield this.actions.execute(yr.GetUnseenCountEndpoint.PATH);return((e=r.data)===null||e===void 0?void 0:e.unseenCount)||((s=(o=(i=r.data)===null||i===void 0?void 0:i.actions)===null||o===void 0?void 0:o[0].updateNotificationsUnseenCountAction)===null||s===void 0?void 0:s.unseenCount)||0})}getPlaylists(){return y(this,void 0,void 0,function*(){let e=yield this.actions.execute(F.PATH,Object.assign(Object.assign({},F.build({browse_id:"FEplaylist_aggregation"})),{parse:!0}));return new _e(this.actions,e).playlists})}getPlaylist(e){return y(this,void 0,void 0,function*(){ie({id:e}),e.startsWith("VL")||(e=`VL${e}`);let i=yield this.actions.execute(F.PATH,F.build({browse_id:e}));return new Ii(this.actions,i)})}getHashtag(e){return y(this,void 0,void 0,function*(){ie({hashtag:e});let i=yield this.actions.execute(F.PATH,F.build({browse_id:"FEhashtag",params:bb(e)}));return new di(this.actions,i)})}getStreamingData(e,i={}){return y(this,void 0,void 0,function*(){return(yield this.getBasicInfo(e)).chooseFormat(i)})}download(e,i){return y(this,void 0,void 0,function*(){return(yield this.getBasicInfo(e,i==null?void 0:i.client)).download(i)})}resolveURL(e){return y(this,void 0,void 0,function*(){return(yield this.actions.execute(wn.PATH,Object.assign(Object.assign({},wn.build({url:e})),{parse:!0}))).endpoint})}call(e,i){return e.call(this.actions,i)}get music(){return new Oy(d(this,Ze,"f"))}get studio(){return new Ly(d(this,Ze,"f"))}get kids(){return new Ry(d(this,Ze,"f"))}get account(){return new Fy(d(this,Ze,"f").actions)}get playlist(){return new jy(d(this,Ze,"f").actions)}get interact(){return new Wy(d(this,Ze,"f").actions)}get actions(){return d(this,Ze,"f").actions}get session(){return d(this,Ze,"f")}};n(da,"Innertube");Ze=new WeakMap;var Sw=da;var gC={};var xC=Sw;var yC="JsRuntime";function Cw(t,e){U.info(yC,`Evaluating JavaScript.
|
|
`,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
|