@vkontakte/videoplayer-statistics 1.0.52-dev.f8fa60d9.0 → 1.0.53-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.52-dev.f8fa60d9.0
3
- * Thu, 15 Aug 2024 18:55:46 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-52/doc/
2
+ * @vkontakte/videoplayer-statistics v1.0.53-beta.0
3
+ * Wed, 21 Aug 2024 12:58:20 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-53/doc/
5
5
  */
6
- "use strict";var L=Object.defineProperty,Ie=Object.defineProperties,Se=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertyNames,Z=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable;var ee=(r,e,i)=>e in r?L(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i,A=(r,e)=>{for(var i in e||(e={}))te.call(e,i)&&ee(r,i,e[i]);if(Z)for(var i of Z(e))_e.call(e,i)&&ee(r,i,e[i]);return r},$=(r,e)=>Ie(r,ye(e));var Ae=(r,e)=>{for(var i in e)L(r,i,{get:e[i],enumerable:!0})},Ee=(r,e,i,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Pe(e))!te.call(r,o)&&o!==i&&L(r,o,{get:()=>e[o],enumerable:!(t=Se(e,o))||t.enumerable});return r};var xe=r=>Ee(L({},"__esModule",{value:!0}),r);var S=(r,e,i)=>new Promise((t,o)=>{var a=l=>{try{h(i.next(l))}catch(p){o(p)}},n=l=>{try{h(i.throw(l))}catch(p){o(p)}},h=l=>l.done?t(l.value):Promise.resolve(l.value).then(a,n);h((i=i.apply(r,e)).next())});var ke={};Ae(ke,{ApiEnv:()=>C,ConnectionType:()=>N,ContentType:()=>O,InteractiveInterfaceClick:()=>K,OneStat:()=>U,Quality:()=>R,SeekAction:()=>D,VERSION:()=>T});module.exports=xe(ke);var C=(n=>(n.PROD="prod",n.VK_ALIAS="vk_alias",n.VIDEOTEST="videotest",n.TEST="test",n.OKCDN="okcdn",n.AUTO="auto",n))(C||{}),R=(p=>(p.Q144P="mobile",p.Q240P="lowest",p.Q360P="low",p.Q480P="medium",p.Q720P="high",p.Q1080P="fullhd",p.Q1440P="quadhd",p.Q2160P="ultrahd",p.UNKNOWN="unknown",p))(R||{}),O=(c=>(c.MP4="mp4",c.DASH="dash",c.DASH_SEP="dash_sep",c.ONDEMAND_DASH="ondemand_dash",c.HLS="hls",c.ONDEMAND_HLS="ondemand_hls",c.WEBM="webm",c.AV1="av1",c.ONDEMAND_DASH_LIVE="ondemand_dash_live",c.ONDEMAND_HLS_LIVE="ondemand_hls_live",c.WEBRTC="webrtc",c.UNKNOWN="unknown",c.RTMP="rtmp",c))(O||{});var N=(t=>(t.HTTP1="http1",t.HTTP2="http2",t.HTTP3="http3",t))(N||{});var D=(h=>(h.SLIDER="slider",h.DOUBLE_TAP="double_tap",h.TIME_CODE="time_code",h.EPISODE="episode",h.REWIND="rewind",h.LIVE="live",h.UNKNOWN="unknown",h))(D||{}),K=(a=>(a.GRAPH_SHOW="iGraphShow",a.GRAPH_HIDE="iGraphHide",a.NEXT_AREA="iNextChapterArea",a.NEXT_BUTTON="iNextChapterBtn",a.WATCH_AGAIN="iWatchAgainBtn",a))(K||{}),ie={action_play:"ap",action_play_interactive:"api",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts",failover:"fo"},oe={vsid:"si",isid:"is",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},se={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},re={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"};var ne=require("@vkontakte/videoplayer-shared"),Ce={apiEnv:"vk_alias",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},ae=r=>(0,ne.fillWithDefault)(r,Ce);function q(){let r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),i=0,t,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(i<=2&&(i=33554432+Math.random()*16777216|0),t=i&15,i=i>>4,e[o]=r[o===19?t&3|8:t]);return e.join("")}var d=require("@vkontakte/videoplayer-shared"),W=require("@vkontakte/videoplayer-shared");var de=r=>{var o;let{operation:e,custom:i}=r,t=Object.fromEntries(Object.entries(i).map(([a,n])=>{var p,m,g;let h=(p=oe[a])!=null?p:a,l=n;return n&&(a==="mode"?l=(m=re[n])!=null?m:n:a==="quality"&&(l=(g=se[n])!=null?g:n)),[h,l]}));return $(A({},r),{operation:(o=ie[e])!=null?o:e,custom:t})};var T="1.0.52-dev.f8fa60d9.0",ue="CIOPGQJGDIHBABABA",z={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var I=require("@vkontakte/videoplayer-shared");var w=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new I.ValueSubject(!1);this.params=e}authorize(e){return S(this,null,function*(){return this.authToken=e!=null?e:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(e){let i="log.externalLog",t=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(i,t,o)||this.logRequest(e)}logRequest(e){return S(this,null,function*(){var n;let i="log.externalLog",t=this.createLogParams(e),o=(n=this.sessionKey)!=null?n:yield this._authorizeWithBackoff();if(!o)return;let a=(p,...m)=>S(this,[p,...m],function*(h,l=this.params.config.requestRetryCount){try{return yield this.params.apiTransport.sendRequest(i,t,o)}catch(g){if(!g||!("error_code"in g)){this.params.error$.next({id:"logRequestUnknown",category:I.ErrorCategory.NETWORK,message:`Unknown ${i} error`,thrown:g});return}let s=g==null?void 0:g.error_code;switch(s){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),l>0?a(h,l-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),l>0?a(h,l-1):void 0;default:{this.params.error$.next({id:`LogRequest#${s}`,category:I.ErrorCategory.EXTERNAL_API,message:`${i} error`,data:g});return}}}});return a(e)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return S(this,null,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=this.params.refreshAuthToken().finally(()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(e){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${T}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?e.map(de):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=(0,I.getExponentialDelay)(this.consequentAuthErrors,this.params.config.backoff);return new Promise(i=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{this._authorize().then(i).catch(t=>this.params.error$.next({id:"AuthorizeBackoff",category:I.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:t})).finally(()=>this.backoffTimeoutId=0)},e))})}_authorize(){return S(this,null,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",i={session_data:{version:2,device_id:this.params.uuid,client_version:T.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(i.session_data.auth_token=this.authToken,i.session_data.version=3),this.authorizePromise=this.params.apiTransport.sendRequest(e,i).then(t=>{var o;return(!t||!t.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:I.ErrorCategory.EXTERNAL_API,message:"No session key",data:t}),this.sessionKey=(o=t==null?void 0:t.session_key)!=null?o:void 0,this.sessionKey}).catch(t=>S(this,null,function*(){this.sessionKey=void 0;let o=t==null?void 0:t.error_code;switch(o){case 401:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:I.ErrorCategory.EXTERNAL_API,message:"authorize error",data:t}):this.params.error$.next({id:"AuthorizeUnknown",category:I.ErrorCategory.NETWORK,message:"authorize error",thrown:t})})).finally(()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}};var y=require("@vkontakte/videoplayer-shared");var k=class{constructor(e){this.params=e,this.apiKey=e.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=z[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){return S(this,null,function*(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let i=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield fetch(i,{method:"GET",mode:"cors",cache:"no-cache"})).json(),a=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!a)throw new Error("Wrong DNS response");return a}catch(i){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:y.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:i}),z.vk_alias}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(e,i,t){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this._prepareQueryParams({method:e,queryParams:i,sessionKey:t}),a=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,a)}catch(n){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:y.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:n,data:{method:e,params:i}})}return!1}sendRequest(e,i,t){return S(this,null,function*(){let o=(0,y.now)(),a=n=>{if(n instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(n.message)){this.params.error$.next({id:"Network",category:y.ErrorCategory.NETWORK,message:"Request failed",thrown:n});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:y.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:n,data:{method:e,params:i,sessionKey:t,time:(0,y.now)()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),fetch(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:e,queryParams:i,sessionKey:t})}).then(n=>{var m,g;let h=Number(n.headers.get("content-length"))===0,l=new Date((m=n.headers.get("date"))!=null?m:"").getTime(),p=(0,y.now)()-o;if(isFinite(l)&&((g=this.timeSynchronisation)==null||g.addServerTime(l,p)),!h)return n.json().then(s=>Object.prototype.hasOwnProperty.call(s,"error_msg")?Promise.reject(s):s,a)},a)})}_prepareQueryParams(e){let i=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&i.append("session_key",e.sessionKey),Object.entries(e.queryParams).forEach(([t,o])=>i.append(t,typeof o=="string"?o:JSON.stringify(o))),i}};var v=require("@vkontakte/videoplayer-shared");var M="onestat_events",Q=r=>e=>e.timestamp+r>=(0,v.now)(),B=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:i}=e;return["action_play","watch_coverage_record","watch_coverage_live"].includes(i)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,v.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let i=v.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,v.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:i}),this.subscription=this.api.authorized$.subscribe(t=>{t&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var e;try{this.flush()}catch(i){this.error$.next({id:"LoggerError",category:v.ErrorCategory.WTF,message:(e=String(i))!=null?e:"Unknown logger error",thrown:i})}}readFromStorage(){let e=v.safeStorage.get(M);try{return e?JSON.parse(e):{}}catch(i){}return{}}addToStorage(e){var a;if(!this.userSalt){this.unsaltedStorage.push(e);return}let i=this.readFromStorage(),o=((a=i[this.userSalt])!=null?a:[]).filter(Q(this.params.config.storageExpiration));v.safeStorage.set(M,JSON.stringify($(A({},i),{[this.userSalt]:[...o,e]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!=null?t:[]).filter(Q(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],v.safeStorage.set(M,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[i,t]of Object.entries(e)){let o=t.filter(Q(this.params.config.storageExpiration));o.length?e[i]=o:delete e[i],this.loggerDebugLog({message:`${t.length} retrieved from storage, ${o.length} of them actual`})}v.safeStorage.set(M,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.custom.vsid)}flush(e=!1){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};var u=require("@vkontakte/videoplayer-core"),j=require("@vkontakte/videoplayer-shared");var ce=r=>r&&{[u.VideoQuality.INVARIANT]:"unknown",[u.VideoQuality.Q_144P]:"mobile",[u.VideoQuality.Q_240P]:"lowest",[u.VideoQuality.Q_360P]:"low",[u.VideoQuality.Q_480P]:"medium",[u.VideoQuality.Q_720P]:"high",[u.VideoQuality.Q_1080P]:"fullhd",[u.VideoQuality.Q_1440P]:"quadhd",[u.VideoQuality.Q_2160P]:"ultrahd",[u.VideoQuality.Q_4320P]:"unknown"}[r],G=r=>r&&{[u.HttpConnectionType.HTTP1]:"http1",[u.HttpConnectionType.HTTP2]:"http2",[u.HttpConnectionType.QUIC]:"http3"}[r],le=r=>{if(r!==void 0)switch(r){case u.VideoFormat.MPEG:return"mp4";case u.VideoFormat.DASH:case u.VideoFormat.DASH_LIVE:case u.VideoFormat.DASH_STREAMS:return"dash";case u.VideoFormat.DASH_SEP:return"dash_sep";case u.VideoFormat.DASH_ONDEMAND:return"ondemand_dash";case u.VideoFormat.DASH_WEBM:case u.VideoFormat.DASH_LIVE_WEBM:return"webm";case u.VideoFormat.DASH_WEBM_AV1:return"av1";case u.VideoFormat.DASH_LIVE_CMAF:return"ondemand_dash_live";case u.VideoFormat.HLS:case u.VideoFormat.HLS_LIVE:return"hls";case u.VideoFormat.HLS_ONDEMAND:return"ondemand_hls";case u.VideoFormat.HLS_LIVE_CMAF:return"ondemand_hls_live";case u.VideoFormat.WEB_RTC_LIVE:return"webrtc";default:return(0,j.assertNever)(r)}},F=r=>{if(r!==void 0)switch(r){case u.Surface.NONE:case u.Surface.INLINE:return;case u.Surface.FULLSCREEN:return"fullscreen";case u.Surface.SECOND_SCREEN:return"chromecast";case u.Surface.PIP:return"pip";case u.Surface.INVISIBLE:return"invisible";default:return(0,j.assertNever)(r)}},pe=r=>{switch(r){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var V=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){var e;return(e=this.offset)!=null?e:0}setOffset(e){this.offset=e}now(){var e;return Date.now()+((e=this.offset)!=null?e:0)}date(e=new Date){var i;return e.setTime(e.getTime()+((i=this.offset)!=null?i:0)),e}addServerTime(e,i){let t=Date.now(),o=e-t-i/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var he=()=>Math.floor(Math.random()*4294967296).toString(36).padStart(7,"0"),fe=()=>Math.floor(Math.random()*18446744073709552e3).toString(36).padStart(13,"0");var Y=require("@vkontakte/videoplayer-core"),f=require("@vkontakte/videoplayer-shared"),ge=(r,e)=>new f.Observable(i=>{let t=new f.Subscription,o=(0,f.merge)((0,f.fromEvent)(window,"beforeunload"),r.events.willDestruct$),a=new f.ValueSubject(void 0),n;t.add(r.info.isLive$.pipe((0,f.filterChanged)()).subscribe(_=>{n&&(n.unsubscribe(),a.next(void 0)),_?n=r.info.liveTime$.pipe((0,f.map)(H=>H&&H/1e3)).subscribe(a):n=r.info.position$.subscribe(a),t.add(n)}));let{playing$:h,paused$:l}=r.events,p=r.events.willSeek$.pipe((0,f.filter)(()=>r.info.playbackState$.getValue()===Y.PlaybackState.PLAYING)),m=r.events.seeked$.pipe((0,f.filter)(()=>r.info.playbackState$.getValue()===Y.PlaybackState.PLAYING)),g=!1,s=new f.Subject;t.add(p.subscribe(()=>{g||s.next(),g=!0})),t.add(m.subscribe(()=>g=!1));let c=new f.Subject,b=new f.Subject,P=(0,f.merge)(h,m,c),E=(0,f.merge)(l,s,o,r.events.looped$,b),x,me=()=>x=a.getValue(),be=()=>{let _=a.getValue();(0,f.isNullable)(x)||x===_||(0,f.isNullable)(_)||(i.next({from:x,to:_}),x=void 0)},ve=()=>{b.next(),c.next()};if(t.add(P.subscribe(me)),t.add(E.subscribe(be)),e.forceInterval&&isFinite(e.forceInterval)){let _=0;t.add(P.subscribe(()=>_=window.setTimeout(ve,e.forceInterval))),t.add(E.subscribe(()=>window.clearTimeout(_)))}return t});var we="_one-stat_",X=`${we}uuid`,J=()=>{let r=new d.Subscription;return{subscription:r,subscribe:(e,i)=>{e&&r.add(e.subscribe(i))}}},U=class{constructor(e,i){this.subscription=new d.Subscription;this.debugLogger=new W.Logger;this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat");this.loopCounter=0;this.disabled=!1;this.vsid$=new d.ValueSubject(void 0);this.isid$=new d.ValueSubject(void 0);this.seekAction$=new d.ValueSubject("unknown");var l,p,m;this.statContext=e,this.config=ae((l=i.config)!=null?l:{}),(0,d.isNonNullable)(i.apiEnv)&&(this.config.apiEnv=i.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new V);let t=new d.Subject;this.experimental={error$:t};let o=d.safeStorage.get(X);o?o.startsWith('"')&&o.endsWith('"')?(this.uuid=o.replaceAll('"',""),d.safeStorage.set(X,this.uuid)):this.uuid=o:(this.uuid=q(),d.safeStorage.set(X,this.uuid)),this.resetViewSession(),i.useIsid&&this.isid$.next((p=i.isid)!=null?p:fe());let a=new k({apiKey:ue,config:this.config,error$:t,timeSynchronisation:this.timeSynchronisation});this.api=new w({config:this.config,apiTransport:a,refreshAuthToken:i.refreshAuthToken,mobile:(m=this.statContext.mobile)!=null?m:!1,uuid:this.uuid,error$:t}),this.logger=new B({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:t,userSalt:i.userSalt});let{isEmbed:n,host:h}=(0,W.detectEmbed)();this.isEmbed=n,this.embedParent=h,this.subscribe()}updateContext(e){this.statContext=A(A({},this.statContext),e)}attachTo(e){let i=new d.Subscription,t=(s,c)=>i.add(s.subscribe(c));t(e.events.willStart$,()=>{let s=e.info.position$.getValue();this.logActionPlay({position:s}),this.statContext.projectId&&this.logActionPlayInteractive()}),t(e.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),this.logActionPlay({position:e.info.position$.getValue()})}),t(e.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:e.info.position$.getValue()}),this.seekAction$.next("unknown")}),t(e.events.paused$,()=>{this.logPause({position:e.info.position$.getValue()})}),t(e.events.willResume$,()=>{this.logPlay()}),t(e.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),t(e.events.playing$,()=>{this.logPlaying()}),t(ge(e,{forceInterval:this.config.watchCoverageInterval}),s=>{let c=e.info.isLive$.getValue(),b={start:parseFloat(s.from.toFixed(3)),end:parseFloat(s.to.toFixed(3))};c?this.logWatchCoverageLive(b):this.logWatchCoverageRecord(b)});let o;t(e.info.isStalled$,s=>{s?o=(0,d.now)():((0,d.isNonNullable)(o)&&this.logEmptyBuffer({duration:(0,d.now)()-o}),o=void 0)});let a=!1;i.add(e.events.fatalError$.pipe((0,d.once)()).subscribe(()=>a=!0)),t(e.events.willStop$,()=>{if(e.info.isStalled$.getValue()){let c=(0,d.isNonNullable)(o)?(0,d.now)()-o:void 0;this.logCloseAtEmptyBuffer({duration:c!=null?c:0}),o=void 0}else a||this.logActionStop()}),t(e.events.managedError$,({id:s})=>{this.logError({fatal:!1,errorType:s})}),t(e.events.fatalError$,({id:s})=>{this.logError({fatal:!0,errorType:s})});let n,h,l=!1;t(e.events.firstBytes$,s=>{n=(0,d.now)(),this.logFirstBytes({time:s})}),t(e.events.willStart$,()=>h=(0,d.now)()),t(e.info.currentBuffer$,s=>{!l&&s&&s.end-s.start>0&&(0,d.isNonNullable)(n)&&(this.logPlayerReady({duration:(0,d.now)()-n}),l=!0)}),t(e.events.firstFrame$,()=>{(0,d.isNonNullable)(n)&&!l&&(this.logPlayerReady({duration:(0,d.now)()-n}),l=!0),(0,d.isNonNullable)(h)&&this.logFirstFrame({time:(0,d.now)()-h})});let p;t(e.info.currentVideoStream$,s=>{s&&(p&&s.id!==p&&this.logTrackSwitch(s),p=s.id)});let m;t(e.info.currentAudioStream$,s=>{s&&(m&&s.id!==m&&this.logTrackSwitch(s),m=s.id)}),t(e.info.atLiveEdge$,s=>this.updateContext({liveEdge:s})),t((0,d.combine)({muted:e.info.muted$,volume:e.info.volume$}),({muted:s,volume:c})=>this.updateContext({audible:!s&&c>0})),t(e.info.currentQuality$,s=>this.updateContext({quality:ce(s)})),t(e.info.isAutoQualityEnabled$,s=>this.updateContext({autoQuality:s})),t(e.info.currentFormat$,s=>this.updateContext({contentType:le(s)})),t(e.info.currentPlaybackRate$,s=>this.updateContext({rate:s})),t(e.info.is3DVideo$,s=>this.updateContext({is3d:s}));let g;return t(e.info.hostname$,s=>{let c=g!==void 0&&g!==s;this.updateContext({cdnHostname:s,failover:c}),c&&this.logFailover(s),g=s}),t(e.info.throughputEstimation$,s=>this.updateContext({downloadSpeed:s})),t(e.info.httpConnectionType$,s=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:G(s)}),this.updateContext({connectionType:G(s)})}),t(e.info.httpConnectionReused$,s=>{(0,d.isNullable)(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:s}),this.updateContext({connectionReused:s})}),t(e.info.surface$,s=>this.updateContext({mode:F(s)})),t((0,d.combine)({current:e.info.currentTextTrack$,available:e.info.availableTextTracks$}),({current:s,available:c})=>{let b=c.find(({id:E})=>E===s),P=b&&(b.isAuto?`${b.language}_auto`:b.language);this.updateContext({subtitles:P})}),this.player=e,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(i),i}attachToUi(e){this.uiEvents=e;let{subscription:i,subscribe:t}=J();return this.player&&(t(e.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),t(e.actionSeek$,this.seekAction$),t(e.inPiP$,o=>{var n;let a=o?"pip":F((n=this.player)==null?void 0:n.info.surface$.getValue());this.updateContext({mode:a})}),t(e.inFullscreen$,o=>{var n;let a=o?"fullscreen":F((n=this.player)==null?void 0:n.info.surface$.getValue());this.updateContext({mode:a})}),t(e.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),t(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(i)),i}attachToAds(e){let{subscription:i,subscribe:t}=J();return t(e.slotRequested$,()=>this.logAdSlotRequest()),t(e.started$,o=>this.logAdStarted(o)),t(e.paused$,()=>this.logAdPaused()),t(e.resumed$,()=>this.logAdResumed()),t(e.ended$,()=>this.logAdEnded()),t(e.skipped$,()=>this.logAdSkipped()),t(e.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(i),i}attachToInteractive(e){let{subscription:i,subscribe:t}=J();return t(e.click$,o=>this.logInterfaceClick(o)),t(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(i),i}authorize(e){return this.api.authorize(e)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(he())}getDeviceId(){return this.uuid}setFieldBlacklist(){}logInited(){}logReady(e){this.log({operation:"player_ready",param:String(e.time)})}logStarted(...e){this.logActionPlay(...e)}logPlay(){this.log({operation:"play_toggle"})}logPlaying(){this.log({operation:"playing"})}logPause(e){this.log({operation:"pause",param:String(Math.round(e.position))})}logSeek(e){this.log({operation:"seek",param:e.action,time:e.time})}logFirstBytes(e){this.log({operation:"first_bytes",param:String(e.time)})}logFirstFrame(e){this.log({operation:"first_frame",param:String(e.time)})}logError(e){this.log({operation:"content_error",param:`${e.fatal?"fatal":"recoverable"}_${e.errorType}`})}logWatchCoverageRecord(e){this.log({operation:"watch_coverage_record",param:`${e.start}-${e.end}`})}logWatchCoverageLive(e){var a,n;let i=(n=(a=this.timeSynchronisation)==null?void 0:a.getOffset())!=null?n:0,t=e.start+i,o=e.end+i;this.log({operation:"watch_coverage_live",param:`${t}-${o}`})}logEmptyBuffer(e){this.log({operation:"empty_buffer",param:String(e.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(e){this.log({operation:"adv",param:e})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(e){this.log({operation:"player_interface_click",param:e})}logNextMovie(e){this.log({operation:"next_movie",param:String(e)})}subscribe(){this.resubscribeBeforeunload();let e=window.navigator.connection;e&&"onchange"in e&&"effectiveType"in e&&this.subscription.add((0,d.merge)((0,d.fromEvent)(e,"change"),(0,d.observableFrom)(["init"])).subscribe(()=>this.updateContext({network:pe(e.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(i=>{console.debug("%c stat ","background:#fa6470;",`component: ${i.component}.`,i.message)})}resubscribeBeforeunload(){var e;(e=this.beforeunloadSubscription)==null||e.unsubscribe(),this.beforeunloadSubscription=(0,d.fromEvent)(window,"beforeunload").subscribe(()=>this.logger.flush(!0)),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(e){this.log({operation:"player_ready",param:String(Math.round(e.duration))})}logActionPlay(e){this.log({operation:"action_play",param:String(Math.round(e.position))})}logActionPlayInteractive(){this.statContext.projectId&&this.log({operation:"action_play_interactive",param:String(this.statContext.movieId)},{vid:this.statContext.projectId})}logFailover(e){this.log({operation:"failover",param:e})}logCloseAtEmptyBuffer(e){this.log({operation:"close_at_empty_buffer",param:String(Math.round(e.duration))})}logActionStop(){this.log({operation:"action_stop"})}logTrackSwitch(e){this.log({operation:"track_switch",param:e.id})}log(e,i={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${e.operation} but statistics is disabled`});return}if(this.config.disabledOperations.includes(e.operation)){this.oneStatDebugLog({message:`operation ${e.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${e.operation} ${e.param}`});let t=this.createLogItem(e,i);this.logger.log(t)}createLogItem({operation:e,param:i,time:t},o={}){var c,b;let a=(b=(c=this.timeSynchronisation)==null?void 0:c.now())!=null?b:(0,d.now)(),n=this.vsid$.getValue();(0,d.assertNonNullable)(n);let h=this.isid$.getValue(),l=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,p=this.statContext.firstConnectionReused,m,g;if(this.isEmbed){m=this.embedParent;let P=[...new URLSearchParams(location.search).entries()].filter(([E,x])=>this.config.embedUrlParams.includes(E));g=new URLSearchParams(P).toString()}else this.statContext.place==="direct"&&((this.statContext.refDomain||document.referrer)&&(m=new URL(this.statContext.refDomain||document.referrer).hostname),g=location.href.substring(0,1024));let s=A({vsid:n,isid:h,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?"auto":this.statContext.autoplay===!1?"":void 0,param:i,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:l,connection_reused:p===!0?1:p===!1?0:void 0,cached_data:this.statContext.cached===!0?1:this.statContext.cached===!1?0:void 0,live:this.statContext.liveEdge?1:void 0,muted:this.statContext.audible===!1?1:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:1,ref_domain:m,direct_url:g,rate:this.statContext.rate===1||(0,d.isNullable)(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId},o);for(let P of this.config.disabledCustomFields)delete s[P];return{operation:e,type:1,time:t,network:this.statContext.network,timestamp:a,custom:s}}};
6
+ "use strict";var Bc=Object.create;var me=Object.defineProperty,Uc=Object.defineProperties,Vc=Object.getOwnPropertyDescriptor,Gc=Object.getOwnPropertyDescriptors,Kc=Object.getOwnPropertyNames,ki=Object.getOwnPropertySymbols,Wc=Object.getPrototypeOf,$i=Object.prototype.hasOwnProperty,Hc=Object.prototype.propertyIsEnumerable;var Di=(r,e,t)=>e in r?me(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,W=(r,e)=>{for(var t in e||(e={}))$i.call(e,t)&&Di(r,t,e[t]);if(ki)for(var t of ki(e))Hc.call(e,t)&&Di(r,t,e[t]);return r},Ge=(r,e)=>Uc(r,Gc(e));var n=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),zc=(r,e)=>{for(var t in e)me(r,t,{get:e[t],enumerable:!0})},Mi=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Kc(e))!$i.call(r,o)&&o!==t&&me(r,o,{get:()=>e[o],enumerable:!(i=Vc(e,o))||i.enumerable});return r};var ji=(r,e,t)=>(t=r!=null?Bc(Wc(r)):{},Mi(e||!r||!r.__esModule?me(t,"default",{value:r,enumerable:!0}):t,r)),Qc=r=>Mi(me({},"__esModule",{value:!0}),r);var D=(r,e,t)=>new Promise((i,o)=>{var a=d=>{try{f(t.next(d))}catch(l){o(l)}},u=d=>{try{f(t.throw(d))}catch(l){o(l)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(a,u);f((t=t.apply(r,e)).next())});var Wi=n(()=>{"use strict"});var E=n((Ur,Hi)=>{"use strict";var be=function(r){return r&&r.Math===Math&&r};Hi.exports=be(typeof globalThis=="object"&&globalThis)||be(typeof window=="object"&&window)||be(typeof self=="object"&&self)||be(typeof global=="object"&&global)||be(typeof Ur=="object"&&Ur)||function(){return this}()||Function("return this")()});var q=n((mm,zi)=>{"use strict";zi.exports=function(r){try{return!!r()}catch(e){return!0}}});var ye=n((bm,Qi)=>{"use strict";var Jc=q();Qi.exports=!Jc(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Vr=n((ym,Zi)=>{"use strict";var Xc=ye(),Xi=Function.prototype,Yi=Xi.apply,Ji=Xi.call;Zi.exports=typeof Reflect=="object"&&Reflect.apply||(Xc?Ji.bind(Yi):function(){return Ji.apply(Yi,arguments)})});var R=n((Im,to)=>{"use strict";var eo=ye(),ro=Function.prototype,Gr=ro.call,Zc=eo&&ro.bind.bind(Gr,Gr);to.exports=eo?Zc:function(r){return function(){return Gr.apply(r,arguments)}}});var Ie=n((Sm,oo)=>{"use strict";var io=R(),el=io({}.toString),rl=io("".slice);oo.exports=function(r){return rl(el(r),8,-1)}});var Kr=n((Em,no)=>{"use strict";var tl=Ie(),il=R();no.exports=function(r){if(tl(r)==="Function")return il(r)}});var P=n((Pm,ao)=>{"use strict";var Wr=typeof document=="object"&&document.all;ao.exports=typeof Wr=="undefined"&&Wr!==void 0?function(r){return typeof r=="function"||r===Wr}:function(r){return typeof r=="function"}});var x=n((Tm,so)=>{"use strict";var ol=q();so.exports=!ol(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var C=n((qm,uo)=>{"use strict";var nl=ye(),Qe=Function.prototype.call;uo.exports=nl?Qe.bind(Qe):function(){return Qe.apply(Qe,arguments)}});var po=n(fo=>{"use strict";var co={}.propertyIsEnumerable,lo=Object.getOwnPropertyDescriptor,al=lo&&!co.call({1:2},1);fo.f=al?function(e){var t=lo(this,e);return!!t&&t.enumerable}:co});var Se=n((_m,vo)=>{"use strict";vo.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var go=n((wm,ho)=>{"use strict";var sl=R(),ul=q(),cl=Ie(),Hr=Object,ll=sl("".split);ho.exports=ul(function(){return!Hr("z").propertyIsEnumerable(0)})?function(r){return cl(r)==="String"?ll(r,""):Hr(r)}:Hr});var Ee=n((Rm,mo)=>{"use strict";mo.exports=function(r){return r==null}});var Ye=n((xm,bo)=>{"use strict";var fl=Ee(),dl=TypeError;bo.exports=function(r){if(fl(r))throw new dl("Can't call method on "+r);return r}});var re=n((Cm,yo)=>{"use strict";var pl=go(),vl=Ye();yo.exports=function(r){return pl(vl(r))}});var A=n((Am,Io)=>{"use strict";var hl=P();Io.exports=function(r){return typeof r=="object"?r!==null:hl(r)}});var Je=n((Nm,So)=>{"use strict";So.exports={}});var F=n((Lm,Po)=>{"use strict";var zr=Je(),Qr=E(),gl=P(),Eo=function(r){return gl(r)?r:void 0};Po.exports=function(r,e){return arguments.length<2?Eo(zr[r])||Eo(Qr[r]):zr[r]&&zr[r][e]||Qr[r]&&Qr[r][e]}});var Xe=n((km,To)=>{"use strict";var ml=R();To.exports=ml({}.isPrototypeOf)});var te=n((Dm,_o)=>{"use strict";var bl=E(),qo=bl.navigator,Oo=qo&&qo.userAgent;_o.exports=Oo?String(Oo):""});var Jr=n(($m,No)=>{"use strict";var Ao=E(),Yr=te(),wo=Ao.process,Ro=Ao.Deno,xo=wo&&wo.versions||Ro&&Ro.version,Co=xo&&xo.v8,N,Ze;Co&&(N=Co.split("."),Ze=N[0]>0&&N[0]<4?1:+(N[0]+N[1]));!Ze&&Yr&&(N=Yr.match(/Edge\/(\d+)/),(!N||N[1]>=74)&&(N=Yr.match(/Chrome\/(\d+)/),N&&(Ze=+N[1])));No.exports=Ze});var Xr=n((Mm,ko)=>{"use strict";var Lo=Jr(),yl=q(),Il=E(),Sl=Il.String;ko.exports=!!Object.getOwnPropertySymbols&&!yl(function(){var r=Symbol("symbol detection");return!Sl(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Lo&&Lo<41})});var Zr=n((jm,Do)=>{"use strict";var El=Xr();Do.exports=El&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var et=n((Fm,$o)=>{"use strict";var Pl=F(),Tl=P(),ql=Xe(),Ol=Zr(),_l=Object;$o.exports=Ol?function(r){return typeof r=="symbol"}:function(r){var e=Pl("Symbol");return Tl(e)&&ql(e.prototype,_l(r))}});var Pe=n((Bm,Mo)=>{"use strict";var wl=String;Mo.exports=function(r){try{return wl(r)}catch(e){return"Object"}}});var B=n((Um,jo)=>{"use strict";var Rl=P(),xl=Pe(),Cl=TypeError;jo.exports=function(r){if(Rl(r))return r;throw new Cl(xl(r)+" is not a function")}});var er=n((Vm,Fo)=>{"use strict";var Al=B(),Nl=Ee();Fo.exports=function(r,e){var t=r[e];return Nl(t)?void 0:Al(t)}});var Uo=n((Gm,Bo)=>{"use strict";var rt=C(),tt=P(),it=A(),Ll=TypeError;Bo.exports=function(r,e){var t,i;if(e==="string"&&tt(t=r.toString)&&!it(i=rt(t,r))||tt(t=r.valueOf)&&!it(i=rt(t,r))||e!=="string"&&tt(t=r.toString)&&!it(i=rt(t,r)))return i;throw new Ll("Can't convert object to primitive value")}});var $=n((Km,Vo)=>{"use strict";Vo.exports=!0});var Wo=n((Wm,Ko)=>{"use strict";var Go=E(),kl=Object.defineProperty;Ko.exports=function(r,e){try{kl(Go,r,{value:e,configurable:!0,writable:!0})}catch(t){Go[r]=e}return e}});var Te=n((Hm,Qo)=>{"use strict";var Dl=$(),$l=E(),Ml=Wo(),Ho="__core-js_shared__",zo=Qo.exports=$l[Ho]||Ml(Ho,{});(zo.versions||(zo.versions=[])).push({version:"3.38.0",mode:Dl?"pure":"global",copyright:"\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var ot=n((zm,Jo)=>{"use strict";var Yo=Te();Jo.exports=function(r,e){return Yo[r]||(Yo[r]=e||{})}});var nt=n((Qm,Xo)=>{"use strict";var jl=Ye(),Fl=Object;Xo.exports=function(r){return Fl(jl(r))}});var M=n((Ym,Zo)=>{"use strict";var Bl=R(),Ul=nt(),Vl=Bl({}.hasOwnProperty);Zo.exports=Object.hasOwn||function(e,t){return Vl(Ul(e),t)}});var at=n((Jm,en)=>{"use strict";var Gl=R(),Kl=0,Wl=Math.random(),Hl=Gl(1 .toString);en.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Hl(++Kl+Wl,36)}});var O=n((Xm,tn)=>{"use strict";var zl=E(),Ql=ot(),rn=M(),Yl=at(),Jl=Xr(),Xl=Zr(),ie=zl.Symbol,st=Ql("wks"),Zl=Xl?ie.for||ie:ie&&ie.withoutSetter||Yl;tn.exports=function(r){return rn(st,r)||(st[r]=Jl&&rn(ie,r)?ie[r]:Zl("Symbol."+r)),st[r]}});var sn=n((Zm,an)=>{"use strict";var ef=C(),on=A(),nn=et(),rf=er(),tf=Uo(),of=O(),nf=TypeError,af=of("toPrimitive");an.exports=function(r,e){if(!on(r)||nn(r))return r;var t=rf(r,af),i;if(t){if(e===void 0&&(e="default"),i=ef(t,r,e),!on(i)||nn(i))return i;throw new nf("Can't convert object to primitive value")}return e===void 0&&(e="number"),tf(r,e)}});var ut=n((eb,un)=>{"use strict";var sf=sn(),uf=et();un.exports=function(r){var e=sf(r,"string");return uf(e)?e:e+""}});var rr=n((rb,ln)=>{"use strict";var cf=E(),cn=A(),ct=cf.document,lf=cn(ct)&&cn(ct.createElement);ln.exports=function(r){return lf?ct.createElement(r):{}}});var lt=n((tb,fn)=>{"use strict";var ff=x(),df=q(),pf=rr();fn.exports=!ff&&!df(function(){return Object.defineProperty(pf("div"),"a",{get:function(){return 7}}).a!==7})});var vn=n(pn=>{"use strict";var vf=x(),hf=C(),gf=po(),mf=Se(),bf=re(),yf=ut(),If=M(),Sf=lt(),dn=Object.getOwnPropertyDescriptor;pn.f=vf?dn:function(e,t){if(e=bf(e),t=yf(t),Sf)try{return dn(e,t)}catch(i){}if(If(e,t))return mf(!hf(gf.f,e,t),e[t])}});var ft=n((ob,hn)=>{"use strict";var Ef=q(),Pf=P(),Tf=/#|\.prototype\./,qe=function(r,e){var t=Of[qf(r)];return t===wf?!0:t===_f?!1:Pf(e)?Ef(e):!!e},qf=qe.normalize=function(r){return String(r).replace(Tf,".").toLowerCase()},Of=qe.data={},_f=qe.NATIVE="N",wf=qe.POLYFILL="P";hn.exports=qe});var Oe=n((nb,mn)=>{"use strict";var gn=Kr(),Rf=B(),xf=ye(),Cf=gn(gn.bind);mn.exports=function(r,e){return Rf(r),e===void 0?r:xf?Cf(r,e):function(){return r.apply(e,arguments)}}});var dt=n((ab,bn)=>{"use strict";var Af=x(),Nf=q();bn.exports=Af&&Nf(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var U=n((sb,yn)=>{"use strict";var Lf=A(),kf=String,Df=TypeError;yn.exports=function(r){if(Lf(r))return r;throw new Df(kf(r)+" is not an object")}});var z=n(Sn=>{"use strict";var $f=x(),Mf=lt(),jf=dt(),tr=U(),In=ut(),Ff=TypeError,pt=Object.defineProperty,Bf=Object.getOwnPropertyDescriptor,vt="enumerable",ht="configurable",gt="writable";Sn.f=$f?jf?function(e,t,i){if(tr(e),t=In(t),tr(i),typeof e=="function"&&t==="prototype"&&"value"in i&&gt in i&&!i[gt]){var o=Bf(e,t);o&&o[gt]&&(e[t]=i.value,i={configurable:ht in i?i[ht]:o[ht],enumerable:vt in i?i[vt]:o[vt],writable:!1})}return pt(e,t,i)}:pt:function(e,t,i){if(tr(e),t=In(t),tr(i),Mf)try{return pt(e,t,i)}catch(o){}if("get"in i||"set"in i)throw new Ff("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var oe=n((cb,En)=>{"use strict";var Uf=x(),Vf=z(),Gf=Se();En.exports=Uf?function(r,e,t){return Vf.f(r,e,Gf(1,t))}:function(r,e,t){return r[e]=t,r}});var j=n((lb,Tn)=>{"use strict";var _e=E(),Kf=Vr(),Wf=Kr(),Hf=P(),zf=vn().f,Qf=ft(),ne=Je(),Yf=Oe(),ae=oe(),Pn=M();Te();var Jf=function(r){var e=function(t,i,o){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,i)}return new r(t,i,o)}return Kf(r,this,arguments)};return e.prototype=r.prototype,e};Tn.exports=function(r,e){var t=r.target,i=r.global,o=r.stat,a=r.proto,u=i?_e:o?_e[t]:_e[t]&&_e[t].prototype,f=i?ne:ne[t]||ae(ne,t,{})[t],d=f.prototype,l,p,v,s,c,m,I,S,y;for(s in e)l=Qf(i?s:t+(o?".":"#")+s,r.forced),p=!l&&u&&Pn(u,s),m=f[s],p&&(r.dontCallGetSet?(y=zf(u,s),I=y&&y.value):I=u[s]),c=p&&I?I:e[s],!(!l&&!a&&typeof m==typeof c)&&(r.bind&&p?S=Yf(c,_e):r.wrap&&p?S=Jf(c):a&&Hf(c)?S=Wf(c):S=c,(r.sham||c&&c.sham||m&&m.sham)&&ae(S,"sham",!0),ae(f,s,S),a&&(v=t+"Prototype",Pn(ne,v)||ae(ne,v,{}),ae(ne[v],s,c),r.real&&d&&(l||!d[s])&&ae(d,s,c)))}});var mt=n((fb,qn)=>{"use strict";var we=E(),Xf=te(),Zf=Ie(),ir=function(r){return Xf.slice(0,r.length)===r};qn.exports=function(){return ir("Bun/")?"BUN":ir("Cloudflare-Workers")?"CLOUDFLARE":ir("Deno/")?"DENO":ir("Node.js/")?"NODE":we.Bun&&typeof Bun.version=="string"?"BUN":we.Deno&&typeof Deno.version=="object"?"DENO":Zf(we.process)==="process"?"NODE":we.window&&we.document?"BROWSER":"REST"}()});var or=n((db,On)=>{"use strict";var ed=mt();On.exports=ed==="NODE"});var se=n((pb,_n)=>{"use strict";var rd=oe();_n.exports=function(r,e,t,i){return i&&i.enumerable?r[e]=t:rd(r,e,t),r}});var Rn=n((vb,wn)=>{"use strict";var td=R(),id=B();wn.exports=function(r,e,t){try{return td(id(Object.getOwnPropertyDescriptor(r,e)[t]))}catch(i){}}});var Cn=n((hb,xn)=>{"use strict";var od=A();xn.exports=function(r){return od(r)||r===null}});var Nn=n((gb,An)=>{"use strict";var nd=Cn(),ad=String,sd=TypeError;An.exports=function(r){if(nd(r))return r;throw new sd("Can't set "+ad(r)+" as a prototype")}});var bt=n((mb,Ln)=>{"use strict";var ud=Rn(),cd=A(),ld=Ye(),fd=Nn();Ln.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=ud(Object.prototype,"__proto__","set"),t(e,[]),r=e instanceof Array}catch(i){}return function(o,a){return ld(o),fd(a),cd(o)&&(r?t(o,a):o.__proto__=a),o}}():void 0)});var nr=n((bb,Dn)=>{"use strict";var dd=O(),pd=dd("toStringTag"),kn={};kn[pd]="z";Dn.exports=String(kn)==="[object z]"});var sr=n((yb,$n)=>{"use strict";var vd=nr(),hd=P(),ar=Ie(),gd=O(),md=gd("toStringTag"),bd=Object,yd=ar(function(){return arguments}())==="Arguments",Id=function(r,e){try{return r[e]}catch(t){}};$n.exports=vd?ar:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=Id(e=bd(r),md))=="string"?t:yd?ar(e):(i=ar(e))==="Object"&&hd(e.callee)?"Arguments":i}});var jn=n((Ib,Mn)=>{"use strict";var Sd=nr(),Ed=sr();Mn.exports=Sd?{}.toString:function(){return"[object "+Ed(this)+"]"}});var Re=n((Sb,Bn)=>{"use strict";var Pd=nr(),Td=z().f,qd=oe(),Od=M(),_d=jn(),wd=O(),Fn=wd("toStringTag");Bn.exports=function(r,e,t,i){var o=t?r:r&&r.prototype;o&&(Od(o,Fn)||Td(o,Fn,{configurable:!0,value:e}),i&&!Pd&&qd(o,"toString",_d))}});var Vn=n((Eb,Un)=>{"use strict";var Rd=z();Un.exports=function(r,e,t){return Rd.f(r,e,t)}});var Wn=n((Pb,Kn)=>{"use strict";var xd=F(),Cd=Vn(),Ad=O(),Nd=x(),Gn=Ad("species");Kn.exports=function(r){var e=xd(r);Nd&&e&&!e[Gn]&&Cd(e,Gn,{configurable:!0,get:function(){return this}})}});var zn=n((Tb,Hn)=>{"use strict";var Ld=Xe(),kd=TypeError;Hn.exports=function(r,e){if(Ld(e,r))return r;throw new kd("Incorrect invocation")}});var It=n((qb,Qn)=>{"use strict";var Dd=R(),$d=P(),yt=Te(),Md=Dd(Function.toString);$d(yt.inspectSource)||(yt.inspectSource=function(r){return Md(r)});Qn.exports=yt.inspectSource});var ra=n((Ob,ea)=>{"use strict";var jd=R(),Fd=q(),Yn=P(),Bd=sr(),Ud=F(),Vd=It(),Jn=function(){},Xn=Ud("Reflect","construct"),St=/^\s*(?:class|function)\b/,Gd=jd(St.exec),Kd=!St.test(Jn),xe=function(e){if(!Yn(e))return!1;try{return Xn(Jn,[],e),!0}catch(t){return!1}},Zn=function(e){if(!Yn(e))return!1;switch(Bd(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Kd||!!Gd(St,Vd(e))}catch(t){return!0}};Zn.sham=!0;ea.exports=!Xn||Fd(function(){var r;return xe(xe.call)||!xe(Object)||!xe(function(){r=!0})||r})?Zn:xe});var ia=n((_b,ta)=>{"use strict";var Wd=ra(),Hd=Pe(),zd=TypeError;ta.exports=function(r){if(Wd(r))return r;throw new zd(Hd(r)+" is not a constructor")}});var Et=n((wb,na)=>{"use strict";var oa=U(),Qd=ia(),Yd=Ee(),Jd=O(),Xd=Jd("species");na.exports=function(r,e){var t=oa(r).constructor,i;return t===void 0||Yd(i=oa(t)[Xd])?e:Qd(i)}});var Pt=n((Rb,aa)=>{"use strict";var Zd=F();aa.exports=Zd("document","documentElement")});var ua=n((xb,sa)=>{"use strict";var ep=R();sa.exports=ep([].slice)});var la=n((Cb,ca)=>{"use strict";var rp=TypeError;ca.exports=function(r,e){if(r<e)throw new rp("Not enough arguments");return r}});var Tt=n((Ab,fa)=>{"use strict";var tp=te();fa.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(tp)});var Nt=n((Nb,Ia)=>{"use strict";var _=E(),ip=Vr(),op=Oe(),da=P(),np=M(),ya=q(),pa=Pt(),ap=ua(),va=rr(),sp=la(),up=Tt(),cp=or(),xt=_.setImmediate,Ct=_.clearImmediate,lp=_.process,qt=_.Dispatch,fp=_.Function,ha=_.MessageChannel,dp=_.String,Ot=0,Ce={},ga="onreadystatechange",Ae,Q,_t,wt;ya(function(){Ae=_.location});var At=function(r){if(np(Ce,r)){var e=Ce[r];delete Ce[r],e()}},Rt=function(r){return function(){At(r)}},ma=function(r){At(r.data)},ba=function(r){_.postMessage(dp(r),Ae.protocol+"//"+Ae.host)};(!xt||!Ct)&&(xt=function(e){sp(arguments.length,1);var t=da(e)?e:fp(e),i=ap(arguments,1);return Ce[++Ot]=function(){ip(t,void 0,i)},Q(Ot),Ot},Ct=function(e){delete Ce[e]},cp?Q=function(r){lp.nextTick(Rt(r))}:qt&&qt.now?Q=function(r){qt.now(Rt(r))}:ha&&!up?(_t=new ha,wt=_t.port2,_t.port1.onmessage=ma,Q=op(wt.postMessage,wt)):_.addEventListener&&da(_.postMessage)&&!_.importScripts&&Ae&&Ae.protocol!=="file:"&&!ya(ba)?(Q=ba,_.addEventListener("message",ma,!1)):ga in va("script")?Q=function(r){pa.appendChild(va("script"))[ga]=function(){pa.removeChild(this),At(r)}}:Q=function(r){setTimeout(Rt(r),0)});Ia.exports={set:xt,clear:Ct}});var Pa=n((Lb,Ea)=>{"use strict";var Sa=E(),pp=x(),vp=Object.getOwnPropertyDescriptor;Ea.exports=function(r){if(!pp)return Sa[r];var e=vp(Sa,r);return e&&e.value}});var Lt=n((kb,qa)=>{"use strict";var Ta=function(){this.head=null,this.tail=null};Ta.prototype={add:function(r){var e={item:r,next:null},t=this.tail;t?t.next=e:this.head=e,this.tail=e},get:function(){var r=this.head;if(r){var e=this.head=r.next;return e===null&&(this.tail=null),r.item}}};qa.exports=Ta});var _a=n((Db,Oa)=>{"use strict";var hp=te();Oa.exports=/ipad|iphone|ipod/i.test(hp)&&typeof Pebble!="undefined"});var Ra=n(($b,wa)=>{"use strict";var gp=te();wa.exports=/web0s(?!.*chrome)/i.test(gp)});var Da=n((Mb,ka)=>{"use strict";var ce=E(),mp=Pa(),xa=Oe(),kt=Nt().set,bp=Lt(),yp=Tt(),Ip=_a(),Sp=Ra(),Dt=or(),Ca=ce.MutationObserver||ce.WebKitMutationObserver,Aa=ce.document,Na=ce.process,ur=ce.Promise,jt=mp("queueMicrotask"),ue,$t,Mt,cr,La;jt||(Ne=new bp,Le=function(){var r,e;for(Dt&&(r=Na.domain)&&r.exit();e=Ne.get();)try{e()}catch(t){throw Ne.head&&ue(),t}r&&r.enter()},!yp&&!Dt&&!Sp&&Ca&&Aa?($t=!0,Mt=Aa.createTextNode(""),new Ca(Le).observe(Mt,{characterData:!0}),ue=function(){Mt.data=$t=!$t}):!Ip&&ur&&ur.resolve?(cr=ur.resolve(void 0),cr.constructor=ur,La=xa(cr.then,cr),ue=function(){La(Le)}):Dt?ue=function(){Na.nextTick(Le)}:(kt=xa(kt,ce),ue=function(){kt(Le)}),jt=function(r){Ne.head||ue(),Ne.add(r)});var Ne,Le;ka.exports=jt});var Ma=n((jb,$a)=>{"use strict";$a.exports=function(r,e){try{arguments.length===1?console.error(r):console.error(r,e)}catch(t){}}});var lr=n((Fb,ja)=>{"use strict";ja.exports=function(r){try{return{error:!1,value:r()}}catch(e){return{error:!0,value:e}}}});var Ua=n((Bb,Ba)=>{"use strict";var Ep=E(),Pp=P(),Fa=Ep.WeakMap;Ba.exports=Pp(Fa)&&/native code/.test(String(Fa))});var fr=n((Ub,Ga)=>{"use strict";var Tp=ot(),qp=at(),Va=Tp("keys");Ga.exports=function(r){return Va[r]||(Va[r]=qp(r))}});var dr=n((Vb,Ka)=>{"use strict";Ka.exports={}});var Vt=n((Gb,za)=>{"use strict";var Op=Ua(),Ha=E(),_p=A(),wp=oe(),Ft=M(),Bt=Te(),Rp=fr(),xp=dr(),Wa="Object already initialized",Ut=Ha.TypeError,Cp=Ha.WeakMap,pr,ke,vr,Ap=function(r){return vr(r)?ke(r):pr(r,{})},Np=function(r){return function(e){var t;if(!_p(e)||(t=ke(e)).type!==r)throw new Ut("Incompatible receiver, "+r+" required");return t}};Op||Bt.state?(L=Bt.state||(Bt.state=new Cp),L.get=L.get,L.has=L.has,L.set=L.set,pr=function(r,e){if(L.has(r))throw new Ut(Wa);return e.facade=r,L.set(r,e),e},ke=function(r){return L.get(r)||{}},vr=function(r){return L.has(r)}):(Y=Rp("state"),xp[Y]=!0,pr=function(r,e){if(Ft(r,Y))throw new Ut(Wa);return e.facade=r,wp(r,Y,e),e},ke=function(r){return Ft(r,Y)?r[Y]:{}},vr=function(r){return Ft(r,Y)});var L,Y;za.exports={set:pr,get:ke,has:vr,enforce:Ap,getterFor:Np}});var J=n((Kb,Qa)=>{"use strict";var Lp=E();Qa.exports=Lp.Promise});var le=n((Wb,Za)=>{"use strict";var kp=E(),De=J(),Dp=P(),$p=ft(),Mp=It(),jp=O(),Ya=mt(),Fp=$(),Gt=Jr(),Ja=De&&De.prototype,Bp=jp("species"),Kt=!1,Xa=Dp(kp.PromiseRejectionEvent),Up=$p("Promise",function(){var r=Mp(De),e=r!==String(De);if(!e&&Gt===66||Fp&&!(Ja.catch&&Ja.finally))return!0;if(!Gt||Gt<51||!/native code/.test(r)){var t=new De(function(a){a(1)}),i=function(a){a(function(){},function(){})},o=t.constructor={};if(o[Bp]=i,Kt=t.then(function(){})instanceof i,!Kt)return!0}return!e&&(Ya==="BROWSER"||Ya==="DENO")&&!Xa});Za.exports={CONSTRUCTOR:Up,REJECTION_EVENT:Xa,SUBCLASSING:Kt}});var fe=n((Hb,rs)=>{"use strict";var es=B(),Vp=TypeError,Gp=function(r){var e,t;this.promise=new r(function(i,o){if(e!==void 0||t!==void 0)throw new Vp("Bad Promise constructor");e=i,t=o}),this.resolve=es(e),this.reject=es(t)};rs.exports.f=function(r){return new Gp(r)}});var Is=n(()=>{"use strict";var Kp=j(),Wp=$(),br=or(),H=E(),he=C(),ts=se(),is=bt(),Hp=Re(),zp=Wn(),Qp=B(),mr=P(),Yp=A(),Jp=zn(),Xp=Et(),us=Nt().set,Yt=Da(),Zp=Ma(),ev=lr(),rv=Lt(),cs=Vt(),yr=J(),Jt=le(),ls=fe(),Ir="Promise",fs=Jt.CONSTRUCTOR,tv=Jt.REJECTION_EVENT,iv=Jt.SUBCLASSING,Wt=cs.getterFor(Ir),ov=cs.set,de=yr&&yr.prototype,X=yr,hr=de,ds=H.TypeError,Ht=H.document,Xt=H.process,zt=ls.f,nv=zt,av=!!(Ht&&Ht.createEvent&&H.dispatchEvent),ps="unhandledrejection",sv="rejectionhandled",os=0,vs=1,uv=2,Zt=1,hs=2,gr,ns,cv,as,gs=function(r){var e;return Yp(r)&&mr(e=r.then)?e:!1},ms=function(r,e){var t=e.value,i=e.state===vs,o=i?r.ok:r.fail,a=r.resolve,u=r.reject,f=r.domain,d,l,p;try{o?(i||(e.rejection===hs&&fv(e),e.rejection=Zt),o===!0?d=t:(f&&f.enter(),d=o(t),f&&(f.exit(),p=!0)),d===r.promise?u(new ds("Promise-chain cycle")):(l=gs(d))?he(l,d,a,u):a(d)):u(t)}catch(v){f&&!p&&f.exit(),u(v)}},bs=function(r,e){r.notified||(r.notified=!0,Yt(function(){for(var t=r.reactions,i;i=t.get();)ms(i,r);r.notified=!1,e&&!r.rejection&&lv(r)}))},ys=function(r,e,t){var i,o;av?(i=Ht.createEvent("Event"),i.promise=e,i.reason=t,i.initEvent(r,!1,!0),H.dispatchEvent(i)):i={promise:e,reason:t},!tv&&(o=H["on"+r])?o(i):r===ps&&Zp("Unhandled promise rejection",t)},lv=function(r){he(us,H,function(){var e=r.facade,t=r.value,i=ss(r),o;if(i&&(o=ev(function(){br?Xt.emit("unhandledRejection",t,e):ys(ps,e,t)}),r.rejection=br||ss(r)?hs:Zt,o.error))throw o.value})},ss=function(r){return r.rejection!==Zt&&!r.parent},fv=function(r){he(us,H,function(){var e=r.facade;br?Xt.emit("rejectionHandled",e):ys(sv,e,r.value)})},pe=function(r,e,t){return function(i){r(e,i,t)}},ve=function(r,e,t){r.done||(r.done=!0,t&&(r=t),r.value=e,r.state=uv,bs(r,!0))},Qt=function(r,e,t){if(!r.done){r.done=!0,t&&(r=t);try{if(r.facade===e)throw new ds("Promise can't be resolved itself");var i=gs(e);i?Yt(function(){var o={done:!1};try{he(i,e,pe(Qt,o,r),pe(ve,o,r))}catch(a){ve(o,a,r)}}):(r.value=e,r.state=vs,bs(r,!1))}catch(o){ve({done:!1},o,r)}}};if(fs&&(X=function(e){Jp(this,hr),Qp(e),he(gr,this);var t=Wt(this);try{e(pe(Qt,t),pe(ve,t))}catch(i){ve(t,i)}},hr=X.prototype,gr=function(e){ov(this,{type:Ir,done:!1,notified:!1,parent:!1,reactions:new rv,rejection:!1,state:os,value:void 0})},gr.prototype=ts(hr,"then",function(e,t){var i=Wt(this),o=zt(Xp(this,X));return i.parent=!0,o.ok=mr(e)?e:!0,o.fail=mr(t)&&t,o.domain=br?Xt.domain:void 0,i.state===os?i.reactions.add(o):Yt(function(){ms(o,i)}),o.promise}),ns=function(){var r=new gr,e=Wt(r);this.promise=r,this.resolve=pe(Qt,e),this.reject=pe(ve,e)},ls.f=zt=function(r){return r===X||r===cv?new ns(r):nv(r)},!Wp&&mr(yr)&&de!==Object.prototype)){as=de.then,iv||ts(de,"then",function(e,t){var i=this;return new X(function(o,a){he(as,i,o,a)}).then(e,t)},{unsafe:!0});try{delete de.constructor}catch(r){}is&&is(de,hr)}Kp({global:!0,constructor:!0,wrap:!0,forced:fs},{Promise:X});Hp(X,Ir,!1,!0);zp(Ir)});var Z=n((Yb,Ss)=>{"use strict";Ss.exports={}});var Ps=n((Jb,Es)=>{"use strict";var dv=O(),pv=Z(),vv=dv("iterator"),hv=Array.prototype;Es.exports=function(r){return r!==void 0&&(pv.Array===r||hv[vv]===r)}});var qs=n((Xb,Ts)=>{"use strict";var gv=Math.ceil,mv=Math.floor;Ts.exports=Math.trunc||function(e){var t=+e;return(t>0?mv:gv)(t)}});var ei=n((Zb,Os)=>{"use strict";var bv=qs();Os.exports=function(r){var e=+r;return e!==e||e===0?0:bv(e)}});var ws=n((ey,_s)=>{"use strict";var yv=ei(),Iv=Math.min;_s.exports=function(r){var e=yv(r);return e>0?Iv(e,9007199254740991):0}});var ri=n((ry,Rs)=>{"use strict";var Sv=ws();Rs.exports=function(r){return Sv(r.length)}});var ti=n((ty,Cs)=>{"use strict";var Ev=sr(),xs=er(),Pv=Ee(),Tv=Z(),qv=O(),Ov=qv("iterator");Cs.exports=function(r){if(!Pv(r))return xs(r,Ov)||xs(r,"@@iterator")||Tv[Ev(r)]}});var Ns=n((iy,As)=>{"use strict";var _v=C(),wv=B(),Rv=U(),xv=Pe(),Cv=ti(),Av=TypeError;As.exports=function(r,e){var t=arguments.length<2?Cv(r):e;if(wv(t))return Rv(_v(t,r));throw new Av(xv(r)+" is not iterable")}});var Ds=n((oy,ks)=>{"use strict";var Nv=C(),Ls=U(),Lv=er();ks.exports=function(r,e,t){var i,o;Ls(r);try{if(i=Lv(r,"return"),!i){if(e==="throw")throw t;return t}i=Nv(i,r)}catch(a){o=!0,i=a}if(e==="throw")throw t;if(o)throw i;return Ls(i),t}});var Er=n((ny,Fs)=>{"use strict";var kv=Oe(),Dv=C(),$v=U(),Mv=Pe(),jv=Ps(),Fv=ri(),$s=Xe(),Bv=Ns(),Uv=ti(),Ms=Ds(),Vv=TypeError,Sr=function(r,e){this.stopped=r,this.result=e},js=Sr.prototype;Fs.exports=function(r,e,t){var i=t&&t.that,o=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_RECORD),u=!!(t&&t.IS_ITERATOR),f=!!(t&&t.INTERRUPTED),d=kv(e,i),l,p,v,s,c,m,I,S=function(T){return l&&Ms(l,"normal",T),new Sr(!0,T)},y=function(T){return o?($v(T),f?d(T[0],T[1],S):d(T[0],T[1])):f?d(T,S):d(T)};if(a)l=r.iterator;else if(u)l=r;else{if(p=Uv(r),!p)throw new Vv(Mv(r)+" is not iterable");if(jv(p)){for(v=0,s=Fv(r);s>v;v++)if(c=y(r[v]),c&&$s(js,c))return c;return new Sr(!1)}l=Bv(r,p)}for(m=a?r.next:l.next;!(I=Dv(m,l)).done;){try{c=y(I.value)}catch(T){Ms(l,"throw",T)}if(typeof c=="object"&&c&&$s(js,c))return c}return new Sr(!1)}});var Ks=n((ay,Gs)=>{"use strict";var Gv=O(),Us=Gv("iterator"),Vs=!1;try{Bs=0,ii={next:function(){return{done:!!Bs++}},return:function(){Vs=!0}},ii[Us]=function(){return this},Array.from(ii,function(){throw 2})}catch(r){}var Bs,ii;Gs.exports=function(r,e){try{if(!e&&!Vs)return!1}catch(o){return!1}var t=!1;try{var i={};i[Us]=function(){return{next:function(){return{done:t=!0}}}},r(i)}catch(o){}return t}});var oi=n((sy,Ws)=>{"use strict";var Kv=J(),Wv=Ks(),Hv=le().CONSTRUCTOR;Ws.exports=Hv||!Wv(function(r){Kv.all(r).then(void 0,function(){})})});var Hs=n(()=>{"use strict";var zv=j(),Qv=C(),Yv=B(),Jv=fe(),Xv=lr(),Zv=Er(),eh=oi();zv({target:"Promise",stat:!0,forced:eh},{all:function(e){var t=this,i=Jv.f(t),o=i.resolve,a=i.reject,u=Xv(function(){var f=Yv(t.resolve),d=[],l=0,p=1;Zv(e,function(v){var s=l++,c=!1;p++,Qv(f,t,v).then(function(m){c||(c=!0,d[s]=m,--p||o(d))},a)}),--p||o(d)});return u.error&&a(u.value),i.promise}})});var Qs=n(()=>{"use strict";var rh=j(),th=$(),ih=le().CONSTRUCTOR,ai=J(),oh=F(),nh=P(),ah=se(),zs=ai&&ai.prototype;rh({target:"Promise",proto:!0,forced:ih,real:!0},{catch:function(r){return this.then(void 0,r)}});!th&&nh(ai)&&(ni=oh("Promise").prototype.catch,zs.catch!==ni&&ah(zs,"catch",ni,{unsafe:!0}));var ni});var Ys=n(()=>{"use strict";var sh=j(),uh=C(),ch=B(),lh=fe(),fh=lr(),dh=Er(),ph=oi();sh({target:"Promise",stat:!0,forced:ph},{race:function(e){var t=this,i=lh.f(t),o=i.reject,a=fh(function(){var u=ch(t.resolve);dh(e,function(f){uh(u,t,f).then(i.resolve,o)})});return a.error&&o(a.value),i.promise}})});var Js=n(()=>{"use strict";var vh=j(),hh=fe(),gh=le().CONSTRUCTOR;vh({target:"Promise",stat:!0,forced:gh},{reject:function(e){var t=hh.f(this),i=t.reject;return i(e),t.promise}})});var si=n((gy,Xs)=>{"use strict";var mh=U(),bh=A(),yh=fe();Xs.exports=function(r,e){if(mh(r),bh(e)&&e.constructor===r)return e;var t=yh.f(r),i=t.resolve;return i(e),t.promise}});var ru=n(()=>{"use strict";var Ih=j(),Sh=F(),Zs=$(),Eh=J(),eu=le().CONSTRUCTOR,Ph=si(),Th=Sh("Promise"),qh=Zs&&!eu;Ih({target:"Promise",stat:!0,forced:Zs||eu},{resolve:function(e){return Ph(qh&&this===Th?Eh:this,e)}})});var tu=n(()=>{"use strict";Is();Hs();Qs();Ys();Js();ru()});var au=n(()=>{"use strict";var Oh=j(),_h=$(),Pr=J(),wh=q(),ou=F(),nu=P(),Rh=Et(),iu=si(),xh=se(),ci=Pr&&Pr.prototype,Ch=!!Pr&&wh(function(){ci.finally.call({then:function(){}},function(){})});Oh({target:"Promise",proto:!0,real:!0,forced:Ch},{finally:function(r){var e=Rh(this,ou("Promise")),t=nu(r);return this.then(t?function(i){return iu(e,r()).then(function(){return i})}:r,t?function(i){return iu(e,r()).then(function(){throw i})}:r)}});!_h&&nu(Pr)&&(ui=ou("Promise").prototype.finally,ci.finally!==ui&&xh(ci,"finally",ui,{unsafe:!0}));var ui});var uu=n((Py,su)=>{"use strict";var Ah=F();su.exports=Ah});var lu=n((Ty,cu)=>{"use strict";Wi();tu();au();var Nh=uu();cu.exports=Nh("Promise","finally")});var du=n((qy,fu)=>{"use strict";var Lh=lu();fu.exports=Lh});var vu=n((Oy,pu)=>{"use strict";var kh=du();pu.exports=kh});var gu=n((_y,hu)=>{"use strict";hu.exports=function(){}});var yu=n((wy,bu)=>{"use strict";var li=x(),Dh=M(),mu=Function.prototype,$h=li&&Object.getOwnPropertyDescriptor,fi=Dh(mu,"name"),Mh=fi&&function(){}.name==="something",jh=fi&&(!li||li&&$h(mu,"name").configurable);bu.exports={EXISTS:fi,PROPER:Mh,CONFIGURABLE:jh}});var Su=n((Ry,Iu)=>{"use strict";var Fh=ei(),Bh=Math.max,Uh=Math.min;Iu.exports=function(r,e){var t=Fh(r);return t<0?Bh(t+e,0):Uh(t,e)}});var Tu=n((xy,Pu)=>{"use strict";var Vh=re(),Gh=Su(),Kh=ri(),Eu=function(r){return function(e,t,i){var o=Vh(e),a=Kh(o);if(a===0)return!r&&-1;var u=Gh(i,a),f;if(r&&t!==t){for(;a>u;)if(f=o[u++],f!==f)return!0}else for(;a>u;u++)if((r||u in o)&&o[u]===t)return r||u||0;return!r&&-1}};Pu.exports={includes:Eu(!0),indexOf:Eu(!1)}});var _u=n((Cy,Ou)=>{"use strict";var Wh=R(),di=M(),Hh=re(),zh=Tu().indexOf,Qh=dr(),qu=Wh([].push);Ou.exports=function(r,e){var t=Hh(r),i=0,o=[],a;for(a in t)!di(Qh,a)&&di(t,a)&&qu(o,a);for(;e.length>i;)di(t,a=e[i++])&&(~zh(o,a)||qu(o,a));return o}});var pi=n((Ay,wu)=>{"use strict";wu.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var xu=n((Ny,Ru)=>{"use strict";var Yh=_u(),Jh=pi();Ru.exports=Object.keys||function(e){return Yh(e,Jh)}});var Au=n(Cu=>{"use strict";var Xh=x(),Zh=dt(),eg=z(),rg=U(),tg=re(),ig=xu();Cu.f=Xh&&!Zh?Object.defineProperties:function(e,t){rg(e);for(var i=tg(t),o=ig(t),a=o.length,u=0,f;a>u;)eg.f(e,f=o[u++],i[f]);return e}});var mi=n((ky,ju)=>{"use strict";var og=U(),ng=Au(),Nu=pi(),ag=dr(),sg=Pt(),ug=rr(),cg=fr(),Lu=">",ku="<",hi="prototype",gi="script",$u=cg("IE_PROTO"),vi=function(){},Mu=function(r){return ku+gi+Lu+r+ku+"/"+gi+Lu},Du=function(r){r.write(Mu("")),r.close();var e=r.parentWindow.Object;return r=null,e},lg=function(){var r=ug("iframe"),e="java"+gi+":",t;return r.style.display="none",sg.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Mu("document.F=Object")),t.close(),t.F},Tr,qr=function(){try{Tr=new ActiveXObject("htmlfile")}catch(e){}qr=typeof document!="undefined"?document.domain&&Tr?Du(Tr):lg():Du(Tr);for(var r=Nu.length;r--;)delete qr[hi][Nu[r]];return qr()};ag[$u]=!0;ju.exports=Object.create||function(e,t){var i;return e!==null?(vi[hi]=og(e),i=new vi,vi[hi]=null,i[$u]=e):i=qr(),t===void 0?i:ng.f(i,t)}});var Bu=n((Dy,Fu)=>{"use strict";var fg=q();Fu.exports=!fg(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var yi=n(($y,Vu)=>{"use strict";var dg=M(),pg=P(),vg=nt(),hg=fr(),gg=Bu(),Uu=hg("IE_PROTO"),bi=Object,mg=bi.prototype;Vu.exports=gg?bi.getPrototypeOf:function(r){var e=vg(r);if(dg(e,Uu))return e[Uu];var t=e.constructor;return pg(t)&&e instanceof t?t.prototype:e instanceof bi?mg:null}});var Pi=n((My,Wu)=>{"use strict";var bg=q(),yg=P(),Ig=A(),Sg=mi(),Gu=yi(),Eg=se(),Pg=O(),Tg=$(),Ei=Pg("iterator"),Ku=!1,V,Ii,Si;[].keys&&(Si=[].keys(),"next"in Si?(Ii=Gu(Gu(Si)),Ii!==Object.prototype&&(V=Ii)):Ku=!0);var qg=!Ig(V)||bg(function(){var r={};return V[Ei].call(r)!==r});qg?V={}:Tg&&(V=Sg(V));yg(V[Ei])||Eg(V,Ei,function(){return this});Wu.exports={IteratorPrototype:V,BUGGY_SAFARI_ITERATORS:Ku}});var zu=n((jy,Hu)=>{"use strict";var Og=Pi().IteratorPrototype,_g=mi(),wg=Se(),Rg=Re(),xg=Z(),Cg=function(){return this};Hu.exports=function(r,e,t,i){var o=e+" Iterator";return r.prototype=_g(Og,{next:wg(+!i,t)}),Rg(r,o,!1,!0),xg[o]=Cg,r}});var nc=n((Fy,oc)=>{"use strict";var Ag=j(),Ng=C(),Or=$(),tc=yu(),Lg=P(),kg=zu(),Qu=yi(),Yu=bt(),Dg=Re(),$g=oe(),Ti=se(),Mg=O(),Ju=Z(),ic=Pi(),jg=tc.PROPER,Fg=tc.CONFIGURABLE,Xu=ic.IteratorPrototype,_r=ic.BUGGY_SAFARI_ITERATORS,$e=Mg("iterator"),Zu="keys",Me="values",ec="entries",rc=function(){return this};oc.exports=function(r,e,t,i,o,a,u){kg(t,e,i);var f=function(y){if(y===o&&s)return s;if(!_r&&y&&y in p)return p[y];switch(y){case Zu:return function(){return new t(this,y)};case Me:return function(){return new t(this,y)};case ec:return function(){return new t(this,y)}}return function(){return new t(this)}},d=e+" Iterator",l=!1,p=r.prototype,v=p[$e]||p["@@iterator"]||o&&p[o],s=!_r&&v||f(o),c=e==="Array"&&p.entries||v,m,I,S;if(c&&(m=Qu(c.call(new r)),m!==Object.prototype&&m.next&&(!Or&&Qu(m)!==Xu&&(Yu?Yu(m,Xu):Lg(m[$e])||Ti(m,$e,rc)),Dg(m,d,!0,!0),Or&&(Ju[d]=rc))),jg&&o===Me&&v&&v.name!==Me&&(!Or&&Fg?$g(p,"name",Me):(l=!0,s=function(){return Ng(v,this)})),o)if(I={values:f(Me),keys:a?s:f(Zu),entries:f(ec)},u)for(S in I)(_r||l||!(S in p))&&Ti(p,S,I[S]);else Ag({target:e,proto:!0,forced:_r||l},I);return(!Or||u)&&p[$e]!==s&&Ti(p,$e,s,{name:o}),Ju[e]=s,I}});var sc=n((By,ac)=>{"use strict";ac.exports=function(r,e){return{value:r,done:e}}});var Oi=n((Uy,dc)=>{"use strict";var Bg=re(),qi=gu(),uc=Z(),lc=Vt(),Ug=z().f,Vg=nc(),wr=sc(),Gg=$(),Kg=x(),fc="Array Iterator",Wg=lc.set,Hg=lc.getterFor(fc);dc.exports=Vg(Array,"Array",function(r,e){Wg(this,{type:fc,target:Bg(r),index:0,kind:e})},function(){var r=Hg(this),e=r.target,t=r.index++;if(!e||t>=e.length)return r.target=void 0,wr(void 0,!0);switch(r.kind){case"keys":return wr(t,!1);case"values":return wr(e[t],!1)}return wr([t,e[t]],!1)},"values");var cc=uc.Arguments=uc.Array;qi("keys");qi("values");qi("entries");if(!Gg&&Kg&&cc.name!=="values")try{Ug(cc,"name",{value:"values"})}catch(r){}});var vc=n((Vy,pc)=>{"use strict";var zg=x(),Qg=z(),Yg=Se();pc.exports=function(r,e,t){zg?Qg.f(r,e,Yg(0,t)):r[e]=t}});var hc=n(()=>{"use strict";var Jg=j(),Xg=Er(),Zg=vc();Jg({target:"Object",stat:!0},{fromEntries:function(e){var t={};return Xg(e,function(i,o){Zg(t,i,o)},{AS_ENTRIES:!0}),t}})});var mc=n((Wy,gc)=>{"use strict";Oi();hc();var em=Je();gc.exports=em.Object.fromEntries});var yc=n((Hy,bc)=>{"use strict";bc.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var Sc=n(()=>{"use strict";Oi();var rm=yc(),tm=E(),im=Re(),Ic=Z();for(Rr in rm)im(tm[Rr],Rr),Ic[Rr]=Ic.Array;var Rr});var Pc=n((Yy,Ec)=>{"use strict";var om=mc();Sc();Ec.exports=om});var qc=n((Jy,Tc)=>{"use strict";var nm=Pc();Tc.exports=nm});var sm={};zc(sm,{ApiEnv:()=>ee,ConnectionType:()=>He,ContentType:()=>We,InteractiveInterfaceClick:()=>Fr,OneStat:()=>$r,Quality:()=>Ke,SeekAction:()=>ze,VERSION:()=>je});module.exports=Qc(sm);var ee=(u=>(u.PROD="prod",u.VK_ALIAS="vk_alias",u.VIDEOTEST="videotest",u.TEST="test",u.OKCDN="okcdn",u.AUTO="auto",u))(ee||{}),Ke=(l=>(l.Q144P="mobile",l.Q240P="lowest",l.Q360P="low",l.Q480P="medium",l.Q720P="high",l.Q1080P="fullhd",l.Q1440P="quadhd",l.Q2160P="ultrahd",l.UNKNOWN="unknown",l))(Ke||{}),We=(c=>(c.MP4="mp4",c.DASH="dash",c.DASH_SEP="dash_sep",c.ONDEMAND_DASH="ondemand_dash",c.HLS="hls",c.ONDEMAND_HLS="ondemand_hls",c.WEBM="webm",c.AV1="av1",c.ONDEMAND_DASH_LIVE="ondemand_dash_live",c.ONDEMAND_HLS_LIVE="ondemand_hls_live",c.WEBRTC="webrtc",c.UNKNOWN="unknown",c.RTMP="rtmp",c))(We||{});var He=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.HTTP3="http3",i))(He||{});var ze=(f=>(f.SLIDER="slider",f.DOUBLE_TAP="double_tap",f.TIME_CODE="time_code",f.EPISODE="episode",f.REWIND="rewind",f.LIVE="live",f.UNKNOWN="unknown",f))(ze||{}),Fr=(a=>(a.GRAPH_SHOW="iGraphShow",a.GRAPH_HIDE="iGraphHide",a.NEXT_AREA="iNextChapterArea",a.NEXT_BUTTON="iNextChapterBtn",a.WATCH_AGAIN="iWatchAgainBtn",a))(Fr||{}),Fi={action_play:"ap",action_play_interactive:"api",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts",failover:"fo"},Bi={vsid:"si",isid:"is",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},Ui={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},Vi={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"};var Gi=require("@vkontakte/videoplayer-shared"),Yc={apiEnv:"vk_alias",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},Ki=r=>(0,Gi.fillWithDefault)(r,Yc);function Br(){let r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),t=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(t<=2&&(t=33554432+Math.random()*16777216|0),i=t&15,t=t>>4,e[o]=r[o===19?i&3|8:i]);return e.join("")}var h=require("@vkontakte/videoplayer-shared"),Mr=require("@vkontakte/videoplayer-shared");var xr=ji(vu(),1);var Oc=ji(qc(),1);var _c=r=>{var o;let{operation:e,custom:t}=r,i=(0,Oc.default)(Object.entries(t).map(([a,u])=>{var l,p,v;let f=(l=Bi[a])!=null?l:a,d=u;return u&&(a==="mode"?d=(p=Vi[u])!=null?p:u:a==="quality"&&(d=(v=Ui[u])!=null?v:u)),[f,d]}));return Ge(W({},r),{operation:(o=Fi[e])!=null?o:e,custom:i})};var je="1.0.53-beta.0",wc="CIOPGQJGDIHBABABA",_i={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};var k=require("@vkontakte/videoplayer-shared");var Fe=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new k.ValueSubject(!1);this.params=e}authorize(e){return D(this,null,function*(){return this.authToken=e!=null?e:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(e){let t="log.externalLog",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(t,i,o)||this.logRequest(e)}logRequest(e){return D(this,null,function*(){var u;let t="log.externalLog",i=this.createLogParams(e),o=(u=this.sessionKey)!=null?u:yield this._authorizeWithBackoff();if(!o)return;let a=(l,...p)=>D(this,[l,...p],function*(f,d=this.params.config.requestRetryCount){try{return yield this.params.apiTransport.sendRequest(t,i,o)}catch(v){if(!v||!("error_code"in v)){this.params.error$.next({id:"logRequestUnknown",category:k.ErrorCategory.NETWORK,message:`Unknown ${t} error`,thrown:v});return}let s=v==null?void 0:v.error_code;switch(s){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),d>0?a(f,d-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),d>0?a(f,d-1):void 0;default:{this.params.error$.next({id:`LogRequest#${s}`,category:k.ErrorCategory.EXTERNAL_API,message:`${t} error`,data:v});return}}}});return a(e)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return D(this,null,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,xr.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(e){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${je}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?e.map(_c):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=(0,k.getExponentialDelay)(this.consequentAuthErrors,this.params.config.backoff);return new Promise(t=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{(0,xr.default)(this._authorize().then(t).catch(i=>this.params.error$.next({id:"AuthorizeBackoff",category:k.ErrorCategory.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})),()=>this.backoffTimeoutId=0)},e))})}_authorize(){return D(this,null,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",t={session_data:{version:2,device_id:this.params.deviceId,client_version:je.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(t.session_data.auth_token=this.authToken,t.session_data.version=3),this.authorizePromise=(0,xr.default)(this.params.apiTransport.sendRequest(e,t).then(i=>{var o;return(!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:k.ErrorCategory.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=(o=i==null?void 0:i.session_key)!=null?o:void 0,this.sessionKey}).catch(i=>D(this,null,function*(){this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:k.ErrorCategory.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:k.ErrorCategory.NETWORK,message:"authorize error",thrown:i})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}};var Cr=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:i})}removeEventListener(e,t){if(!(e in this.listeners))return;let i=this.listeners[e];for(let o=0,a=i.length;o<a;o++)if(i[o].callback===t){i.splice(o,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let o=0,a=i.length;o<a;o++){let u=i[o];try{u.callback.call(this,e)}catch(f){Promise.resolve().then(()=>{throw f})}u.options&&u.options.once&&this.removeEventListener(e.type,u.callback)}return!e.defaultPrevented}},ge=class extends Cr{constructor(){super(),this.listeners||Cr.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}},Be=class{constructor(){Object.defineProperty(this,"signal",{value:new ge,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let i=e;if(i===void 0)if(typeof document=="undefined")i=new Error("This operation was aborted"),i.name="AbortError";else try{i=new DOMException("signal is aborted without reason")}catch(o){i=new Error("This operation was aborted"),i.name="AbortError"}this.signal.reason=i,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(Be.prototype[Symbol.toStringTag]="AbortController",ge.prototype[Symbol.toStringTag]="AbortSignal");function Ar(r){return r.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof r.Request=="function"&&!r.Request.prototype.hasOwnProperty("signal")||!r.AbortController}function wi(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=r;if(!Ar({fetch:e,Request:t,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:e,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||o)&&(a=function(l,p){let v;p&&p.signal&&(v=p.signal,delete p.signal);let s=new t(l,p);return v&&Object.defineProperty(s,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),s},a.prototype=t.prototype);let u=e;return{fetch:(d,l)=>{let p=a&&a.prototype.isPrototypeOf(d)?d.signal:l?l.signal:void 0;if(p){let v;try{v=new DOMException("Aborted","AbortError")}catch(c){v=new Error("Aborted"),v.name="AbortError"}if(p.aborted)return Promise.reject(v);let s=new Promise((c,m)=>{p.addEventListener("abort",()=>m(v),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([s,u(d,l)])}return u(d,l)},Request:a}}var Ue=Ar({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Rc=Ue?wi({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Ri=Ue?Rc.fetch:window.fetch,yI=Ue?Rc.Request:window.Request,II=Ue?Be:window.AbortController,SI=Ue?ge:window.AbortSignal;var G=require("@vkontakte/videoplayer-shared");var Ve=class{constructor(e){this.params=e,this.apiKey=e.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=_i[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){return D(this,null,function*(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let t=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield Ri(t,{method:"GET",mode:"cors",cache:"no-cache"})).json(),a=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!a)throw new Error("Wrong DNS response");return a}catch(t){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:G.ErrorCategory.NETWORK,message:"Unhandled resolve api base url error",thrown:t}),_i.vk_alias}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(e,t,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this._prepareQueryParams({method:e,queryParams:t,sessionKey:i}),a=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,a)}catch(u){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:G.ErrorCategory.NETWORK,message:"Unhandled beacon error",thrown:u,data:{method:e,params:t}})}return!1}sendRequest(e,t,i){return D(this,null,function*(){let o=(0,G.now)(),a=u=>{if(u instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(u.message)){this.params.error$.next({id:"Network",category:G.ErrorCategory.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:G.ErrorCategory.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:t,sessionKey:i,time:(0,G.now)()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),Ri(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:e,queryParams:t,sessionKey:i})}).then(u=>{var p,v;let f=Number(u.headers.get("content-length"))===0,d=new Date((p=u.headers.get("date"))!=null?p:"").getTime(),l=(0,G.now)()-o;if(isFinite(d)&&((v=this.timeSynchronisation)==null||v.addServerTime(d,l)),!f)return u.json().then(s=>Object.prototype.hasOwnProperty.call(s,"error_msg")?Promise.reject(s):s,a)},a)})}_prepareQueryParams(e){let t=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&t.append("session_key",e.sessionKey),Object.entries(e.queryParams).forEach(([i,o])=>t.append(i,typeof o=="string"?o:JSON.stringify(o))),t}};var w=require("@vkontakte/videoplayer-shared");var Nr="onestat_events",xi=r=>e=>e.timestamp+r>=(0,w.now)(),Lr=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:t}=e;return["action_play","watch_coverage_record","watch_coverage_live"].includes(t)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=(0,w.debounceFn)(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let t=w.safeStorage.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=(0,w.debounceFn)(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:t}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var e;try{this.flush()}catch(t){this.error$.next({id:"LoggerError",category:w.ErrorCategory.WTF,message:(e=String(t))!=null?e:"Unknown logger error",thrown:t})}}readFromStorage(){let e=w.safeStorage.get(Nr);try{return e?JSON.parse(e):{}}catch(t){}return{}}addToStorage(e){var a;if(!this.userSalt){this.unsaltedStorage.push(e);return}let t=this.readFromStorage(),o=((a=t[this.userSalt])!=null?a:[]).filter(xi(this.params.config.storageExpiration));w.safeStorage.set(Nr,JSON.stringify(Ge(W({},t),{[this.userSalt]:[...o,e]})))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(xi(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],w.safeStorage.set(Nr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[t,i]of Object.entries(e)){let o=i.filter(xi(this.params.config.storageExpiration));o.length?e[t]=o:delete e[t],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}w.safeStorage.set(Nr,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.custom.vsid)}flush(e=!1){let t=this.getFromStorage();t.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${t.length} events through beacon`}),this.api.logBeacon(t)):(this.loggerDebugLog({message:`Flushing ${t.length} events`}),this.api.logRequest(t)),this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};var g=require("@vkontakte/videoplayer-core"),Ci=require("@vkontakte/videoplayer-shared");var xc=r=>r&&{[g.VideoQuality.INVARIANT]:"unknown",[g.VideoQuality.Q_144P]:"mobile",[g.VideoQuality.Q_240P]:"lowest",[g.VideoQuality.Q_360P]:"low",[g.VideoQuality.Q_480P]:"medium",[g.VideoQuality.Q_720P]:"high",[g.VideoQuality.Q_1080P]:"fullhd",[g.VideoQuality.Q_1440P]:"quadhd",[g.VideoQuality.Q_2160P]:"ultrahd",[g.VideoQuality.Q_4320P]:"unknown"}[r],Ai=r=>r&&{[g.HttpConnectionType.HTTP1]:"http1",[g.HttpConnectionType.HTTP2]:"http2",[g.HttpConnectionType.QUIC]:"http3"}[r],Cc=r=>{if(r!==void 0)switch(r){case g.VideoFormat.MPEG:return"mp4";case g.VideoFormat.DASH:case g.VideoFormat.DASH_LIVE:case g.VideoFormat.DASH_STREAMS:return"dash";case g.VideoFormat.DASH_SEP:return"dash_sep";case g.VideoFormat.DASH_ONDEMAND:return"ondemand_dash";case g.VideoFormat.DASH_WEBM:case g.VideoFormat.DASH_LIVE_WEBM:return"webm";case g.VideoFormat.DASH_WEBM_AV1:return"av1";case g.VideoFormat.DASH_LIVE_CMAF:return"ondemand_dash_live";case g.VideoFormat.HLS:case g.VideoFormat.HLS_LIVE:return"hls";case g.VideoFormat.HLS_ONDEMAND:return"ondemand_hls";case g.VideoFormat.HLS_LIVE_CMAF:return"ondemand_hls_live";case g.VideoFormat.WEB_RTC_LIVE:return"webrtc";default:return(0,Ci.assertNever)(r)}},kr=r=>{if(r!==void 0)switch(r){case g.Surface.NONE:case g.Surface.INLINE:return;case g.Surface.FULLSCREEN:return"fullscreen";case g.Surface.SECOND_SCREEN:return"chromecast";case g.Surface.PIP:return"pip";case g.Surface.INVISIBLE:return"invisible";default:return(0,Ci.assertNever)(r)}},Ac=r=>{switch(r){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var Dr=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){var e;return(e=this.offset)!=null?e:0}setOffset(e){this.offset=e}now(){var e;return Date.now()+((e=this.offset)!=null?e:0)}date(e=new Date){var t;return e.setTime(e.getTime()+((t=this.offset)!=null?t:0)),e}addServerTime(e,t){let i=Date.now(),o=e-i-t/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var Nc=()=>Math.floor(Math.random()*4294967296).toString(36).padStart(7,"0"),Lc=()=>Math.floor(Math.random()*18446744073709552e3).toString(36).padStart(13,"0");var Ni=require("@vkontakte/videoplayer-core"),b=require("@vkontakte/videoplayer-shared"),kc=(r,e)=>new b.Observable(t=>{let i=new b.Subscription,o=(0,b.merge)((0,b.fromEvent)(window,"beforeunload"),r.events.willDestruct$),a=new b.ValueSubject(void 0),u;i.add(r.info.isLive$.pipe((0,b.filterChanged)()).subscribe(K=>{u&&(u.unsubscribe(),a.next(void 0)),K?u=r.info.liveTime$.pipe((0,b.map)(jr=>jr&&jr/1e3)).subscribe(a):u=r.info.position$.subscribe(a),i.add(u)}));let{playing$:f,paused$:d}=r.events,l=r.events.willSeek$.pipe((0,b.filter)(()=>r.info.playbackState$.getValue()===Ni.PlaybackState.PLAYING)),p=r.events.seeked$.pipe((0,b.filter)(()=>r.info.playbackState$.getValue()===Ni.PlaybackState.PLAYING)),v=!1,s=new b.Subject;i.add(l.subscribe(()=>{v||s.next(),v=!0})),i.add(p.subscribe(()=>v=!1));let c=new b.Subject,m=new b.Subject,I=(0,b.merge)(f,p,c),S=(0,b.merge)(d,s,o,r.events.looped$,m),y,T=()=>y=a.getValue(),jc=()=>{let K=a.getValue();(0,b.isNullable)(y)||y===K||(0,b.isNullable)(K)||(t.next({from:y,to:K}),y=void 0)},Fc=()=>{m.next(),c.next()};if(i.add(I.subscribe(T)),i.add(S.subscribe(jc)),e.forceInterval&&isFinite(e.forceInterval)){let K=0;i.add(I.subscribe(()=>K=window.setTimeout(Fc,e.forceInterval))),i.add(S.subscribe(()=>window.clearTimeout(K)))}return i});var Mc="_one-stat_",Dc=`${Mc}uuid`,$c=`${Mc}deviceId`,Li=()=>{let r=new h.Subscription;return{subscription:r,subscribe:(e,t)=>{e&&r.add(e.subscribe(t))}}},$r=class{constructor(e,t){this.subscription=new h.Subscription;this.debugLogger=new Mr.Logger;this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat");this.loopCounter=0;this.disabled=!1;this.vsid$=new h.ValueSubject(void 0);this.isid$=new h.ValueSubject(void 0);this.seekAction$=new h.ValueSubject("unknown");var l,p,v;this.statContext=e,this.config=Ki((l=t.config)!=null?l:{}),(0,h.isNonNullable)(t.apiEnv)&&(this.config.apiEnv=t.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Dr);let i=new h.Subject;this.experimental={error$:i},h.safeStorage.get(Dc)&&h.safeStorage.remove(Dc);let a=h.safeStorage.get($c);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:a?this.deviceId=a:(this.deviceId=Br(),h.safeStorage.set($c,this.deviceId)),this.resetViewSession(),t.useIsid&&this.isid$.next((p=t.isid)!=null?p:Lc());let u=new Ve({apiKey:wc,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Fe({config:this.config,apiTransport:u,refreshAuthToken:t.refreshAuthToken,mobile:(v=this.statContext.mobile)!=null?v:!1,deviceId:this.deviceId,error$:i}),this.logger=new Lr({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:t.userSalt});let{isEmbed:f,host:d}=(0,Mr.detectEmbed)();this.isEmbed=f,this.embedParent=d,this.subscribe()}updateContext(e){this.statContext=W(W({},this.statContext),e)}attachTo(e){let t=new h.Subscription,i=(s,c)=>t.add(s.subscribe(c));i(e.events.willStart$,()=>{let s=e.info.position$.getValue();this.logActionPlay({position:s}),this.statContext.projectId&&this.logActionPlayInteractive()}),i(e.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),this.logActionPlay({position:e.info.position$.getValue()})}),i(e.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:e.info.position$.getValue()}),this.seekAction$.next("unknown")}),i(e.events.paused$,()=>{this.logPause({position:e.info.position$.getValue()})}),i(e.events.willResume$,()=>{this.logPlay()}),i(e.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),i(e.events.playing$,()=>{this.logPlaying()}),i(kc(e,{forceInterval:this.config.watchCoverageInterval}),s=>{let c=e.info.isLive$.getValue(),m={start:parseFloat(s.from.toFixed(3)),end:parseFloat(s.to.toFixed(3))};c?this.logWatchCoverageLive(m):this.logWatchCoverageRecord(m)});let o;i(e.info.isStalled$,s=>{s?o=(0,h.now)():((0,h.isNonNullable)(o)&&this.logEmptyBuffer({duration:(0,h.now)()-o}),o=void 0)});let a=!1;t.add(e.events.fatalError$.pipe((0,h.once)()).subscribe(()=>a=!0)),i(e.events.willStop$,()=>{if(e.info.isStalled$.getValue()){let c=(0,h.isNonNullable)(o)?(0,h.now)()-o:void 0;this.logCloseAtEmptyBuffer({duration:c!=null?c:0}),o=void 0}else a||this.logActionStop()}),i(e.events.managedError$,({id:s})=>{this.logError({fatal:!1,errorType:s})}),i(e.events.fatalError$,({id:s})=>{this.logError({fatal:!0,errorType:s})});let u,f,d=!1;i(e.events.firstBytes$,s=>{u=(0,h.now)(),this.logFirstBytes({time:s})}),i(e.events.willStart$,()=>f=(0,h.now)()),i(e.info.currentBuffer$,s=>{!d&&s&&s.end-s.start>0&&(0,h.isNonNullable)(u)&&(this.logPlayerReady({duration:(0,h.now)()-u}),d=!0)}),i(e.events.firstFrame$,()=>{(0,h.isNonNullable)(u)&&!d&&(this.logPlayerReady({duration:(0,h.now)()-u}),d=!0),(0,h.isNonNullable)(f)&&this.logFirstFrame({time:(0,h.now)()-f})});let l;i(e.info.currentVideoStream$,s=>{s&&(l&&s.id!==l&&this.logTrackSwitch(s),l=s.id)});let p;i(e.info.currentAudioStream$,s=>{s&&(p&&s.id!==p&&this.logTrackSwitch(s),p=s.id)}),i(e.info.atLiveEdge$,s=>this.updateContext({liveEdge:s})),i((0,h.combine)({muted:e.info.muted$,volume:e.info.volume$}),({muted:s,volume:c})=>this.updateContext({audible:!s&&c>0})),i(e.info.currentQuality$,s=>this.updateContext({quality:xc(s)})),i(e.info.isAutoQualityEnabled$,s=>this.updateContext({autoQuality:s})),i(e.info.currentFormat$,s=>this.updateContext({contentType:Cc(s)})),i(e.info.currentPlaybackRate$,s=>this.updateContext({rate:s})),i(e.info.is3DVideo$,s=>this.updateContext({is3d:s}));let v;return i(e.info.hostname$,s=>{let c=v!==void 0&&v!==s;this.updateContext({cdnHostname:s,failover:c}),c&&this.logFailover(s),v=s}),i(e.info.throughputEstimation$,s=>this.updateContext({downloadSpeed:s})),i(e.info.httpConnectionType$,s=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:Ai(s)}),this.updateContext({connectionType:Ai(s)})}),i(e.info.httpConnectionReused$,s=>{(0,h.isNullable)(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:s}),this.updateContext({connectionReused:s})}),i(e.info.surface$,s=>this.updateContext({mode:kr(s)})),i((0,h.combine)({current:e.info.currentTextTrack$,available:e.info.availableTextTracks$}),({current:s,available:c})=>{let m=c.find(({id:S})=>S===s),I=m&&(m.isAuto?`${m.language}_auto`:m.language);this.updateContext({subtitles:I})}),this.player=e,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(t),t}attachToUi(e){this.uiEvents=e;let{subscription:t,subscribe:i}=Li();return this.player&&(i(e.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),i(e.actionSeek$,this.seekAction$),i(e.inPiP$,o=>{var u;let a=o?"pip":kr((u=this.player)==null?void 0:u.info.surface$.getValue());this.updateContext({mode:a})}),i(e.inFullscreen$,o=>{var u;let a=o?"fullscreen":kr((u=this.player)==null?void 0:u.info.surface$.getValue());this.updateContext({mode:a})}),i(e.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(t)),t}attachToAds(e){let{subscription:t,subscribe:i}=Li();return i(e.slotRequested$,()=>this.logAdSlotRequest()),i(e.started$,o=>this.logAdStarted(o)),i(e.paused$,()=>this.logAdPaused()),i(e.resumed$,()=>this.logAdResumed()),i(e.ended$,()=>this.logAdEnded()),i(e.skipped$,()=>this.logAdSkipped()),i(e.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(t),t}attachToInteractive(e){let{subscription:t,subscribe:i}=Li();return i(e.click$,o=>this.logInterfaceClick(o)),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(t),t}authorize(e){return this.api.authorize(e)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(Nc())}getDeviceId(){return this.deviceId}setFieldBlacklist(){}logInited(){}logReady(e){this.log({operation:"player_ready",param:String(e.time)})}logStarted(...e){this.logActionPlay(...e)}logPlay(){this.log({operation:"play_toggle"})}logPlaying(){this.log({operation:"playing"})}logPause(e){this.log({operation:"pause",param:String(Math.round(e.position))})}logSeek(e){this.log({operation:"seek",param:e.action,time:e.time})}logFirstBytes(e){this.log({operation:"first_bytes",param:String(e.time)})}logFirstFrame(e){this.log({operation:"first_frame",param:String(e.time)})}logError(e){this.log({operation:"content_error",param:`${e.fatal?"fatal":"recoverable"}_${e.errorType}`})}logWatchCoverageRecord(e){this.log({operation:"watch_coverage_record",param:`${e.start}-${e.end}`},{in_history:this.statContext.inHistory?1:void 0})}logWatchCoverageLive(e){var a,u;let t=(u=(a=this.timeSynchronisation)==null?void 0:a.getOffset())!=null?u:0,i=e.start+t,o=e.end+t;this.log({operation:"watch_coverage_live",param:`${i}-${o}`},{in_history:this.statContext.inHistory?1:void 0})}logEmptyBuffer(e){this.log({operation:"empty_buffer",param:String(e.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(e){this.log({operation:"adv",param:e})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(e){this.log({operation:"player_interface_click",param:e})}logNextMovie(e){this.log({operation:"next_movie",param:String(e)})}subscribe(){this.resubscribeBeforeunload();let e=window.navigator.connection;e&&"onchange"in e&&"effectiveType"in e&&this.subscription.add((0,h.merge)((0,h.fromEvent)(e,"change"),(0,h.observableFrom)(["init"])).subscribe(()=>this.updateContext({network:Ac(e.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(t=>{console.debug("%c stat ","background:#fa6470;",`component: ${t.component}.`,t.message)})}resubscribeBeforeunload(){var e;(e=this.beforeunloadSubscription)==null||e.unsubscribe(),this.beforeunloadSubscription=(0,h.fromEvent)(window,"beforeunload").subscribe(()=>this.logger.flush(!0)),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(e){this.log({operation:"player_ready",param:String(Math.round(e.duration))})}logActionPlay(e){this.log({operation:"action_play",param:String(Math.round(e.position))})}logActionPlayInteractive(){this.statContext.projectId&&this.log({operation:"action_play_interactive",param:String(this.statContext.movieId)},{vid:this.statContext.projectId})}logFailover(e){this.log({operation:"failover",param:e})}logCloseAtEmptyBuffer(e){this.log({operation:"close_at_empty_buffer",param:String(Math.round(e.duration))})}logActionStop(){this.log({operation:"action_stop"})}logTrackSwitch(e){this.log({operation:"track_switch",param:e.id})}log(e,t={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${e.operation} but statistics is disabled`});return}if(this.config.disabledOperations.includes(e.operation)){this.oneStatDebugLog({message:`operation ${e.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${e.operation} ${e.param}`});let i=this.createLogItem(e,t);this.logger.log(i)}createLogItem({operation:e,param:t,time:i},o={}){var c,m;let a=(m=(c=this.timeSynchronisation)==null?void 0:c.now())!=null?m:(0,h.now)(),u=this.vsid$.getValue();(0,h.assertNonNullable)(u);let f=this.isid$.getValue(),d=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,l=this.statContext.firstConnectionReused,p,v;if(this.isEmbed){p=this.embedParent;let I=[...new URLSearchParams(location.search).entries()].filter(([S,y])=>this.config.embedUrlParams.includes(S));v=new URLSearchParams(I).toString()}else this.statContext.place==="direct"&&((this.statContext.refDomain||document.referrer)&&(p=new URL(this.statContext.refDomain||document.referrer).hostname),v=location.href.substring(0,1024));let s=W({vsid:u,isid:f,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?"auto":this.statContext.autoplay===!1?"":void 0,param:t,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:d,connection_reused:l===!0?1:l===!1?0:void 0,cached_data:this.statContext.cached===!0?1:this.statContext.cached===!1?0:void 0,live:this.statContext.liveEdge?1:void 0,muted:this.statContext.audible===!1?1:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:1,ref_domain:p,direct_url:v,rate:this.statContext.rate===1||(0,h.isNullable)(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId},o);for(let I of this.config.disabledCustomFields)delete s[I];return{operation:e,type:1,time:i,network:this.statContext.network,timestamp:a,custom:s}}};
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-statistics v1.0.52-dev.f8fa60d9.0
3
- * Thu, 15 Aug 2024 18:55:46 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-52/doc/
2
+ * @vkontakte/videoplayer-statistics v1.0.53-beta.0
3
+ * Wed, 21 Aug 2024 12:58:20 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-53/doc/
5
5
  */
6
- var ke=Object.defineProperty,Le=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Re=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable;var se=(r,e,i)=>e in r?ke(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i,y=(r,e)=>{for(var i in e||(e={}))Re.call(e,i)&&se(r,i,e[i]);if(oe)for(var i of oe(e))Oe.call(e,i)&&se(r,i,e[i]);return r},L=(r,e)=>Le(r,$e(e));var m=(r,e,i)=>new Promise((t,o)=>{var a=u=>{try{l(i.next(u))}catch(c){o(c)}},n=u=>{try{l(i.throw(u))}catch(c){o(c)}},l=u=>u.done?t(u.value):Promise.resolve(u.value).then(a,n);l((i=i.apply(r,e)).next())});var C=(n=>(n.PROD="prod",n.VK_ALIAS="vk_alias",n.VIDEOTEST="videotest",n.TEST="test",n.OKCDN="okcdn",n.AUTO="auto",n))(C||{}),F=(c=>(c.Q144P="mobile",c.Q240P="lowest",c.Q360P="low",c.Q480P="medium",c.Q720P="high",c.Q1080P="fullhd",c.Q1440P="quadhd",c.Q2160P="ultrahd",c.UNKNOWN="unknown",c))(F||{}),V=(d=>(d.MP4="mp4",d.DASH="dash",d.DASH_SEP="dash_sep",d.ONDEMAND_DASH="ondemand_dash",d.HLS="hls",d.ONDEMAND_HLS="ondemand_hls",d.WEBM="webm",d.AV1="av1",d.ONDEMAND_DASH_LIVE="ondemand_dash_live",d.ONDEMAND_HLS_LIVE="ondemand_hls_live",d.WEBRTC="webrtc",d.UNKNOWN="unknown",d.RTMP="rtmp",d))(V||{});var U=(t=>(t.HTTP1="http1",t.HTTP2="http2",t.HTTP3="http3",t))(U||{});var W=(l=>(l.SLIDER="slider",l.DOUBLE_TAP="double_tap",l.TIME_CODE="time_code",l.EPISODE="episode",l.REWIND="rewind",l.LIVE="live",l.UNKNOWN="unknown",l))(W||{}),re=(a=>(a.GRAPH_SHOW="iGraphShow",a.GRAPH_HIDE="iGraphHide",a.NEXT_AREA="iNextChapterArea",a.NEXT_BUTTON="iNextChapterBtn",a.WATCH_AGAIN="iWatchAgainBtn",a))(re||{}),ne={action_play:"ap",action_play_interactive:"api",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts",failover:"fo"},ae={vsid:"si",isid:"is",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},de={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},ue={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"};import{fillWithDefault as Ne}from"@vkontakte/videoplayer-shared";var De={apiEnv:"vk_alias",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},ce=r=>Ne(r,De);function H(){let r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),i=0,t,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(i<=2&&(i=33554432+Math.random()*16777216|0),t=i&15,i=i>>4,e[o]=r[o===19?t&3|8:t]);return e.join("")}import{assertNonNullable as je,combine as Ae,fromEvent as Ee,isNonNullable as x,isNullable as xe,merge as Ge,now as v,observableFrom as Ye,once as Xe,safeStorage as X,Subject as Je,Subscription as te,ValueSubject as J}from"@vkontakte/videoplayer-shared";import{Logger as Ze,detectEmbed as et}from"@vkontakte/videoplayer-shared";var le=r=>{var o;let{operation:e,custom:i}=r,t=Object.fromEntries(Object.entries(i).map(([a,n])=>{var c,h,p;let l=(c=ae[a])!=null?c:a,u=n;return n&&(a==="mode"?u=(h=ue[n])!=null?h:n:a==="quality"&&(u=(p=de[n])!=null?p:n)),[l,u]}));return L(y({},r),{operation:(o=ne[e])!=null?o:e,custom:t})};var $="1.0.52-dev.f8fa60d9.0",pe="CIOPGQJGDIHBABABA",K={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};import{ValueSubject as Me,getExponentialDelay as Be,ErrorCategory as A}from"@vkontakte/videoplayer-shared";var T=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new Me(!1);this.params=e}authorize(e){return m(this,null,function*(){return this.authToken=e!=null?e:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(e){let i="log.externalLog",t=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(i,t,o)||this.logRequest(e)}logRequest(e){return m(this,null,function*(){var n;let i="log.externalLog",t=this.createLogParams(e),o=(n=this.sessionKey)!=null?n:yield this._authorizeWithBackoff();if(!o)return;let a=(c,...h)=>m(this,[c,...h],function*(l,u=this.params.config.requestRetryCount){try{return yield this.params.apiTransport.sendRequest(i,t,o)}catch(p){if(!p||!("error_code"in p)){this.params.error$.next({id:"logRequestUnknown",category:A.NETWORK,message:`Unknown ${i} error`,thrown:p});return}let s=p==null?void 0:p.error_code;switch(s){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),u>0?a(l,u-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),u>0?a(l,u-1):void 0;default:{this.params.error$.next({id:`LogRequest#${s}`,category:A.EXTERNAL_API,message:`${i} error`,data:p});return}}}});return a(e)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return m(this,null,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=this.params.refreshAuthToken().finally(()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(e){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${$}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?e.map(le):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=Be(this.consequentAuthErrors,this.params.config.backoff);return new Promise(i=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{this._authorize().then(i).catch(t=>this.params.error$.next({id:"AuthorizeBackoff",category:A.NETWORK,message:"Otherwise unhandled error in authorization",thrown:t})).finally(()=>this.backoffTimeoutId=0)},e))})}_authorize(){return m(this,null,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",i={session_data:{version:2,device_id:this.params.uuid,client_version:$.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(i.session_data.auth_token=this.authToken,i.session_data.version=3),this.authorizePromise=this.params.apiTransport.sendRequest(e,i).then(t=>{var o;return(!t||!t.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:A.EXTERNAL_API,message:"No session key",data:t}),this.sessionKey=(o=t==null?void 0:t.session_key)!=null?o:void 0,this.sessionKey}).catch(t=>m(this,null,function*(){this.sessionKey=void 0;let o=t==null?void 0:t.error_code;switch(o){case 401:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:A.EXTERNAL_API,message:"authorize error",data:t}):this.params.error$.next({id:"AuthorizeUnknown",category:A.NETWORK,message:"authorize error",thrown:t})})).finally(()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}};import{ErrorCategory as R,now as q}from"@vkontakte/videoplayer-shared";var w=class{constructor(e){this.params=e,this.apiKey=e.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=K[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){return m(this,null,function*(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let i=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield fetch(i,{method:"GET",mode:"cors",cache:"no-cache"})).json(),a=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!a)throw new Error("Wrong DNS response");return a}catch(i){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:R.NETWORK,message:"Unhandled resolve api base url error",thrown:i}),K.vk_alias}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(e,i,t){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this._prepareQueryParams({method:e,queryParams:i,sessionKey:t}),a=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,a)}catch(n){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:R.NETWORK,message:"Unhandled beacon error",thrown:n,data:{method:e,params:i}})}return!1}sendRequest(e,i,t){return m(this,null,function*(){let o=q(),a=n=>{if(n instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(n.message)){this.params.error$.next({id:"Network",category:R.NETWORK,message:"Request failed",thrown:n});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:R.NETWORK,message:"Unhandled request error",thrown:n,data:{method:e,params:i,sessionKey:t,time:q()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),fetch(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:e,queryParams:i,sessionKey:t})}).then(n=>{var h,p;let l=Number(n.headers.get("content-length"))===0,u=new Date((h=n.headers.get("date"))!=null?h:"").getTime(),c=q()-o;if(isFinite(u)&&((p=this.timeSynchronisation)==null||p.addServerTime(u,c)),!l)return n.json().then(s=>Object.prototype.hasOwnProperty.call(s,"error_msg")?Promise.reject(s):s,a)},a)})}_prepareQueryParams(e){let i=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&i.append("session_key",e.sessionKey),Object.entries(e.queryParams).forEach(([t,o])=>i.append(t,typeof o=="string"?o:JSON.stringify(o))),i}};import{ErrorCategory as Fe,now as Ve,safeStorage as k,debounceFn as he}from"@vkontakte/videoplayer-shared";var O="onestat_events",z=r=>e=>e.timestamp+r>=Ve(),N=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:i}=e;return["action_play","watch_coverage_record","watch_coverage_live"].includes(i)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=he(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let i=k.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=he(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:i}),this.subscription=this.api.authorized$.subscribe(t=>{t&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var e;try{this.flush()}catch(i){this.error$.next({id:"LoggerError",category:Fe.WTF,message:(e=String(i))!=null?e:"Unknown logger error",thrown:i})}}readFromStorage(){let e=k.get(O);try{return e?JSON.parse(e):{}}catch(i){}return{}}addToStorage(e){var a;if(!this.userSalt){this.unsaltedStorage.push(e);return}let i=this.readFromStorage(),o=((a=i[this.userSalt])!=null?a:[]).filter(z(this.params.config.storageExpiration));k.set(O,JSON.stringify(L(y({},i),{[this.userSalt]:[...o,e]})))}getFromStorage(){var t;return this.userSalt?((t=this.readFromStorage()[this.userSalt])!=null?t:[]).filter(z(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],k.set(O,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[i,t]of Object.entries(e)){let o=t.filter(z(this.params.config.storageExpiration));o.length?e[i]=o:delete e[i],this.loggerDebugLog({message:`${t.length} retrieved from storage, ${o.length} of them actual`})}k.set(O,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.custom.vsid)}flush(e=!1){let i=this.getFromStorage();i.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${i.length} events through beacon`}),this.api.logBeacon(i)):(this.loggerDebugLog({message:`Flushing ${i.length} events`}),this.api.logRequest(i)),this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};import{HttpConnectionType as Q,Surface as E,VideoFormat as f,VideoQuality as b}from"@vkontakte/videoplayer-core";import{assertNever as fe}from"@vkontakte/videoplayer-shared";var ge=r=>r&&{[b.INVARIANT]:"unknown",[b.Q_144P]:"mobile",[b.Q_240P]:"lowest",[b.Q_360P]:"low",[b.Q_480P]:"medium",[b.Q_720P]:"high",[b.Q_1080P]:"fullhd",[b.Q_1440P]:"quadhd",[b.Q_2160P]:"ultrahd",[b.Q_4320P]:"unknown"}[r],j=r=>r&&{[Q.HTTP1]:"http1",[Q.HTTP2]:"http2",[Q.QUIC]:"http3"}[r],me=r=>{if(r!==void 0)switch(r){case f.MPEG:return"mp4";case f.DASH:case f.DASH_LIVE:case f.DASH_STREAMS:return"dash";case f.DASH_SEP:return"dash_sep";case f.DASH_ONDEMAND:return"ondemand_dash";case f.DASH_WEBM:case f.DASH_LIVE_WEBM:return"webm";case f.DASH_WEBM_AV1:return"av1";case f.DASH_LIVE_CMAF:return"ondemand_dash_live";case f.HLS:case f.HLS_LIVE:return"hls";case f.HLS_ONDEMAND:return"ondemand_hls";case f.HLS_LIVE_CMAF:return"ondemand_hls_live";case f.WEB_RTC_LIVE:return"webrtc";default:return fe(r)}},D=r=>{if(r!==void 0)switch(r){case E.NONE:case E.INLINE:return;case E.FULLSCREEN:return"fullscreen";case E.SECOND_SCREEN:return"chromecast";case E.PIP:return"pip";case E.INVISIBLE:return"invisible";default:return fe(r)}},be=r=>{switch(r){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var M=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){var e;return(e=this.offset)!=null?e:0}setOffset(e){this.offset=e}now(){var e;return Date.now()+((e=this.offset)!=null?e:0)}date(e=new Date){var i;return e.setTime(e.getTime()+((i=this.offset)!=null?i:0)),e}addServerTime(e,i){let t=Date.now(),o=e-t-i/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var ve=()=>Math.floor(Math.random()*4294967296).toString(36).padStart(7,"0"),Ie=()=>Math.floor(Math.random()*18446744073709552e3).toString(36).padStart(13,"0");import{PlaybackState as Se}from"@vkontakte/videoplayer-core";import{filter as ye,filterChanged as We,fromEvent as He,isNullable as Pe,map as Ke,merge as G,Observable as qe,Subject as Y,Subscription as ze,ValueSubject as Qe}from"@vkontakte/videoplayer-shared";var _e=(r,e)=>new qe(i=>{let t=new ze,o=G(He(window,"beforeunload"),r.events.willDestruct$),a=new Qe(void 0),n;t.add(r.info.isLive$.pipe(We()).subscribe(S=>{n&&(n.unsubscribe(),a.next(void 0)),S?n=r.info.liveTime$.pipe(Ke(B=>B&&B/1e3)).subscribe(a):n=r.info.position$.subscribe(a),t.add(n)}));let{playing$:l,paused$:u}=r.events,c=r.events.willSeek$.pipe(ye(()=>r.info.playbackState$.getValue()===Se.PLAYING)),h=r.events.seeked$.pipe(ye(()=>r.info.playbackState$.getValue()===Se.PLAYING)),p=!1,s=new Y;t.add(c.subscribe(()=>{p||s.next(),p=!0})),t.add(h.subscribe(()=>p=!1));let d=new Y,g=new Y,I=G(l,h,d),P=G(u,s,o,r.events.looped$,g),_,Ce=()=>_=a.getValue(),Te=()=>{let S=a.getValue();Pe(_)||_===S||Pe(S)||(i.next({from:_,to:S}),_=void 0)},we=()=>{g.next(),d.next()};if(t.add(I.subscribe(Ce)),t.add(P.subscribe(Te)),e.forceInterval&&isFinite(e.forceInterval)){let S=0;t.add(I.subscribe(()=>S=window.setTimeout(we,e.forceInterval))),t.add(P.subscribe(()=>window.clearTimeout(S)))}return t});var tt="_one-stat_",Z=`${tt}uuid`,ee=()=>{let r=new te;return{subscription:r,subscribe:(e,i)=>{e&&r.add(e.subscribe(i))}}},ie=class{constructor(e,i){this.subscription=new te;this.debugLogger=new Ze;this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat");this.loopCounter=0;this.disabled=!1;this.vsid$=new J(void 0);this.isid$=new J(void 0);this.seekAction$=new J("unknown");var u,c,h;this.statContext=e,this.config=ce((u=i.config)!=null?u:{}),x(i.apiEnv)&&(this.config.apiEnv=i.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new M);let t=new Je;this.experimental={error$:t};let o=X.get(Z);o?o.startsWith('"')&&o.endsWith('"')?(this.uuid=o.replaceAll('"',""),X.set(Z,this.uuid)):this.uuid=o:(this.uuid=H(),X.set(Z,this.uuid)),this.resetViewSession(),i.useIsid&&this.isid$.next((c=i.isid)!=null?c:Ie());let a=new w({apiKey:pe,config:this.config,error$:t,timeSynchronisation:this.timeSynchronisation});this.api=new T({config:this.config,apiTransport:a,refreshAuthToken:i.refreshAuthToken,mobile:(h=this.statContext.mobile)!=null?h:!1,uuid:this.uuid,error$:t}),this.logger=new N({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:t,userSalt:i.userSalt});let{isEmbed:n,host:l}=et();this.isEmbed=n,this.embedParent=l,this.subscribe()}updateContext(e){this.statContext=y(y({},this.statContext),e)}attachTo(e){let i=new te,t=(s,d)=>i.add(s.subscribe(d));t(e.events.willStart$,()=>{let s=e.info.position$.getValue();this.logActionPlay({position:s}),this.statContext.projectId&&this.logActionPlayInteractive()}),t(e.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),this.logActionPlay({position:e.info.position$.getValue()})}),t(e.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:e.info.position$.getValue()}),this.seekAction$.next("unknown")}),t(e.events.paused$,()=>{this.logPause({position:e.info.position$.getValue()})}),t(e.events.willResume$,()=>{this.logPlay()}),t(e.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),t(e.events.playing$,()=>{this.logPlaying()}),t(_e(e,{forceInterval:this.config.watchCoverageInterval}),s=>{let d=e.info.isLive$.getValue(),g={start:parseFloat(s.from.toFixed(3)),end:parseFloat(s.to.toFixed(3))};d?this.logWatchCoverageLive(g):this.logWatchCoverageRecord(g)});let o;t(e.info.isStalled$,s=>{s?o=v():(x(o)&&this.logEmptyBuffer({duration:v()-o}),o=void 0)});let a=!1;i.add(e.events.fatalError$.pipe(Xe()).subscribe(()=>a=!0)),t(e.events.willStop$,()=>{if(e.info.isStalled$.getValue()){let d=x(o)?v()-o:void 0;this.logCloseAtEmptyBuffer({duration:d!=null?d:0}),o=void 0}else a||this.logActionStop()}),t(e.events.managedError$,({id:s})=>{this.logError({fatal:!1,errorType:s})}),t(e.events.fatalError$,({id:s})=>{this.logError({fatal:!0,errorType:s})});let n,l,u=!1;t(e.events.firstBytes$,s=>{n=v(),this.logFirstBytes({time:s})}),t(e.events.willStart$,()=>l=v()),t(e.info.currentBuffer$,s=>{!u&&s&&s.end-s.start>0&&x(n)&&(this.logPlayerReady({duration:v()-n}),u=!0)}),t(e.events.firstFrame$,()=>{x(n)&&!u&&(this.logPlayerReady({duration:v()-n}),u=!0),x(l)&&this.logFirstFrame({time:v()-l})});let c;t(e.info.currentVideoStream$,s=>{s&&(c&&s.id!==c&&this.logTrackSwitch(s),c=s.id)});let h;t(e.info.currentAudioStream$,s=>{s&&(h&&s.id!==h&&this.logTrackSwitch(s),h=s.id)}),t(e.info.atLiveEdge$,s=>this.updateContext({liveEdge:s})),t(Ae({muted:e.info.muted$,volume:e.info.volume$}),({muted:s,volume:d})=>this.updateContext({audible:!s&&d>0})),t(e.info.currentQuality$,s=>this.updateContext({quality:ge(s)})),t(e.info.isAutoQualityEnabled$,s=>this.updateContext({autoQuality:s})),t(e.info.currentFormat$,s=>this.updateContext({contentType:me(s)})),t(e.info.currentPlaybackRate$,s=>this.updateContext({rate:s})),t(e.info.is3DVideo$,s=>this.updateContext({is3d:s}));let p;return t(e.info.hostname$,s=>{let d=p!==void 0&&p!==s;this.updateContext({cdnHostname:s,failover:d}),d&&this.logFailover(s),p=s}),t(e.info.throughputEstimation$,s=>this.updateContext({downloadSpeed:s})),t(e.info.httpConnectionType$,s=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:j(s)}),this.updateContext({connectionType:j(s)})}),t(e.info.httpConnectionReused$,s=>{xe(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:s}),this.updateContext({connectionReused:s})}),t(e.info.surface$,s=>this.updateContext({mode:D(s)})),t(Ae({current:e.info.currentTextTrack$,available:e.info.availableTextTracks$}),({current:s,available:d})=>{let g=d.find(({id:P})=>P===s),I=g&&(g.isAuto?`${g.language}_auto`:g.language);this.updateContext({subtitles:I})}),this.player=e,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(i),i}attachToUi(e){this.uiEvents=e;let{subscription:i,subscribe:t}=ee();return this.player&&(t(e.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),t(e.actionSeek$,this.seekAction$),t(e.inPiP$,o=>{var n;let a=o?"pip":D((n=this.player)==null?void 0:n.info.surface$.getValue());this.updateContext({mode:a})}),t(e.inFullscreen$,o=>{var n;let a=o?"fullscreen":D((n=this.player)==null?void 0:n.info.surface$.getValue());this.updateContext({mode:a})}),t(e.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),t(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(i)),i}attachToAds(e){let{subscription:i,subscribe:t}=ee();return t(e.slotRequested$,()=>this.logAdSlotRequest()),t(e.started$,o=>this.logAdStarted(o)),t(e.paused$,()=>this.logAdPaused()),t(e.resumed$,()=>this.logAdResumed()),t(e.ended$,()=>this.logAdEnded()),t(e.skipped$,()=>this.logAdSkipped()),t(e.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(i),i}attachToInteractive(e){let{subscription:i,subscribe:t}=ee();return t(e.click$,o=>this.logInterfaceClick(o)),t(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(i),i}authorize(e){return this.api.authorize(e)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(ve())}getDeviceId(){return this.uuid}setFieldBlacklist(){}logInited(){}logReady(e){this.log({operation:"player_ready",param:String(e.time)})}logStarted(...e){this.logActionPlay(...e)}logPlay(){this.log({operation:"play_toggle"})}logPlaying(){this.log({operation:"playing"})}logPause(e){this.log({operation:"pause",param:String(Math.round(e.position))})}logSeek(e){this.log({operation:"seek",param:e.action,time:e.time})}logFirstBytes(e){this.log({operation:"first_bytes",param:String(e.time)})}logFirstFrame(e){this.log({operation:"first_frame",param:String(e.time)})}logError(e){this.log({operation:"content_error",param:`${e.fatal?"fatal":"recoverable"}_${e.errorType}`})}logWatchCoverageRecord(e){this.log({operation:"watch_coverage_record",param:`${e.start}-${e.end}`})}logWatchCoverageLive(e){var a,n;let i=(n=(a=this.timeSynchronisation)==null?void 0:a.getOffset())!=null?n:0,t=e.start+i,o=e.end+i;this.log({operation:"watch_coverage_live",param:`${t}-${o}`})}logEmptyBuffer(e){this.log({operation:"empty_buffer",param:String(e.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(e){this.log({operation:"adv",param:e})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(e){this.log({operation:"player_interface_click",param:e})}logNextMovie(e){this.log({operation:"next_movie",param:String(e)})}subscribe(){this.resubscribeBeforeunload();let e=window.navigator.connection;e&&"onchange"in e&&"effectiveType"in e&&this.subscription.add(Ge(Ee(e,"change"),Ye(["init"])).subscribe(()=>this.updateContext({network:be(e.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(i=>{console.debug("%c stat ","background:#fa6470;",`component: ${i.component}.`,i.message)})}resubscribeBeforeunload(){var e;(e=this.beforeunloadSubscription)==null||e.unsubscribe(),this.beforeunloadSubscription=Ee(window,"beforeunload").subscribe(()=>this.logger.flush(!0)),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(e){this.log({operation:"player_ready",param:String(Math.round(e.duration))})}logActionPlay(e){this.log({operation:"action_play",param:String(Math.round(e.position))})}logActionPlayInteractive(){this.statContext.projectId&&this.log({operation:"action_play_interactive",param:String(this.statContext.movieId)},{vid:this.statContext.projectId})}logFailover(e){this.log({operation:"failover",param:e})}logCloseAtEmptyBuffer(e){this.log({operation:"close_at_empty_buffer",param:String(Math.round(e.duration))})}logActionStop(){this.log({operation:"action_stop"})}logTrackSwitch(e){this.log({operation:"track_switch",param:e.id})}log(e,i={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${e.operation} but statistics is disabled`});return}if(this.config.disabledOperations.includes(e.operation)){this.oneStatDebugLog({message:`operation ${e.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${e.operation} ${e.param}`});let t=this.createLogItem(e,i);this.logger.log(t)}createLogItem({operation:e,param:i,time:t},o={}){var d,g;let a=(g=(d=this.timeSynchronisation)==null?void 0:d.now())!=null?g:v(),n=this.vsid$.getValue();je(n);let l=this.isid$.getValue(),u=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,c=this.statContext.firstConnectionReused,h,p;if(this.isEmbed){h=this.embedParent;let I=[...new URLSearchParams(location.search).entries()].filter(([P,_])=>this.config.embedUrlParams.includes(P));p=new URLSearchParams(I).toString()}else this.statContext.place==="direct"&&((this.statContext.refDomain||document.referrer)&&(h=new URL(this.statContext.refDomain||document.referrer).hostname),p=location.href.substring(0,1024));let s=y({vsid:n,isid:l,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?"auto":this.statContext.autoplay===!1?"":void 0,param:i,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:u,connection_reused:c===!0?1:c===!1?0:void 0,cached_data:this.statContext.cached===!0?1:this.statContext.cached===!1?0:void 0,live:this.statContext.liveEdge?1:void 0,muted:this.statContext.audible===!1?1:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:1,ref_domain:h,direct_url:p,rate:this.statContext.rate===1||xe(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId},o);for(let I of this.config.disabledCustomFields)delete s[I];return{operation:e,type:1,time:t,network:this.statContext.network,timestamp:a,custom:s}}};export{C as ApiEnv,U as ConnectionType,V as ContentType,re as InteractiveInterfaceClick,ie as OneStat,F as Quality,W as SeekAction,$ as VERSION};
6
+ var Zc=Object.create;var Dr=Object.defineProperty,el=Object.defineProperties,rl=Object.getOwnPropertyDescriptor,tl=Object.getOwnPropertyDescriptors,il=Object.getOwnPropertyNames,Fi=Object.getOwnPropertySymbols,ol=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty,nl=Object.prototype.propertyIsEnumerable;var Bi=(r,e,t)=>e in r?Dr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e)=>{for(var t in e||(e={}))Ui.call(e,t)&&Bi(r,t,e[t]);if(Fi)for(var t of Fi(e))nl.call(e,t)&&Bi(r,t,e[t]);return r},Ve=(r,e)=>el(r,tl(e));var n=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var al=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of il(e))!Ui.call(r,o)&&o!==t&&Dr(r,o,{get:()=>e[o],enumerable:!(i=rl(e,o))||i.enumerable});return r};var Vi=(r,e,t)=>(t=r!=null?Zc(ol(r)):{},al(e||!r||!r.__esModule?Dr(t,"default",{value:r,enumerable:!0}):t,r));var A=(r,e,t)=>new Promise((i,o)=>{var a=d=>{try{f(t.next(d))}catch(l){o(l)}},u=d=>{try{f(t.throw(d))}catch(l){o(l)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(a,u);f((t=t.apply(r,e)).next())});var Yi=n(()=>{"use strict"});var y=n((Ur,Ji)=>{"use strict";var me=function(r){return r&&r.Math===Math&&r};Ji.exports=me(typeof globalThis=="object"&&globalThis)||me(typeof window=="object"&&window)||me(typeof self=="object"&&self)||me(typeof global=="object"&&global)||me(typeof Ur=="object"&&Ur)||function(){return this}()||Function("return this")()});var P=n((Wm,Xi)=>{"use strict";Xi.exports=function(r){try{return!!r()}catch(e){return!0}}});var be=n((Hm,Zi)=>{"use strict";var cl=P();Zi.exports=!cl(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Vr=n((zm,io)=>{"use strict";var ll=be(),to=Function.prototype,eo=to.apply,ro=to.call;io.exports=typeof Reflect=="object"&&Reflect.apply||(ll?ro.bind(eo):function(){return ro.apply(eo,arguments)})});var O=n((Qm,ao)=>{"use strict";var oo=be(),no=Function.prototype,Gr=no.call,fl=oo&&no.bind.bind(Gr,Gr);ao.exports=oo?fl:function(r){return function(){return Gr.apply(r,arguments)}}});var ye=n((Ym,uo)=>{"use strict";var so=O(),dl=so({}.toString),pl=so("".slice);uo.exports=function(r){return pl(dl(r),8,-1)}});var Kr=n((Jm,co)=>{"use strict";var vl=ye(),hl=O();co.exports=function(r){if(vl(r)==="Function")return hl(r)}});var I=n((Xm,lo)=>{"use strict";var Wr=typeof document=="object"&&document.all;lo.exports=typeof Wr=="undefined"&&Wr!==void 0?function(r){return typeof r=="function"||r===Wr}:function(r){return typeof r=="function"}});var _=n((Zm,fo)=>{"use strict";var gl=P();fo.exports=!gl(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var w=n((eb,po)=>{"use strict";var ml=be(),Ge=Function.prototype.call;po.exports=ml?Ge.bind(Ge):function(){return Ge.apply(Ge,arguments)}});var mo=n(go=>{"use strict";var vo={}.propertyIsEnumerable,ho=Object.getOwnPropertyDescriptor,bl=ho&&!vo.call({1:2},1);go.f=bl?function(e){var t=ho(this,e);return!!t&&t.enumerable}:vo});var Ie=n((tb,bo)=>{"use strict";bo.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Io=n((ib,yo)=>{"use strict";var yl=O(),Il=P(),Sl=ye(),Hr=Object,El=yl("".split);yo.exports=Il(function(){return!Hr("z").propertyIsEnumerable(0)})?function(r){return Sl(r)==="String"?El(r,""):Hr(r)}:Hr});var Se=n((ob,So)=>{"use strict";So.exports=function(r){return r==null}});var Ke=n((nb,Eo)=>{"use strict";var Pl=Se(),Tl=TypeError;Eo.exports=function(r){if(Pl(r))throw new Tl("Can't call method on "+r);return r}});var J=n((ab,Po)=>{"use strict";var ql=Io(),Ol=Ke();Po.exports=function(r){return ql(Ol(r))}});var R=n((sb,To)=>{"use strict";var _l=I();To.exports=function(r){return typeof r=="object"?r!==null:_l(r)}});var We=n((ub,qo)=>{"use strict";qo.exports={}});var $=n((cb,_o)=>{"use strict";var zr=We(),Qr=y(),wl=I(),Oo=function(r){return wl(r)?r:void 0};_o.exports=function(r,e){return arguments.length<2?Oo(zr[r])||Oo(Qr[r]):zr[r]&&zr[r][e]||Qr[r]&&Qr[r][e]}});var He=n((lb,wo)=>{"use strict";var Rl=O();wo.exports=Rl({}.isPrototypeOf)});var X=n((fb,Co)=>{"use strict";var xl=y(),Ro=xl.navigator,xo=Ro&&Ro.userAgent;Co.exports=xo?String(xo):""});var Jr=n((db,$o)=>{"use strict";var Do=y(),Yr=X(),Ao=Do.process,No=Do.Deno,Lo=Ao&&Ao.versions||No&&No.version,ko=Lo&&Lo.v8,x,ze;ko&&(x=ko.split("."),ze=x[0]>0&&x[0]<4?1:+(x[0]+x[1]));!ze&&Yr&&(x=Yr.match(/Edge\/(\d+)/),(!x||x[1]>=74)&&(x=Yr.match(/Chrome\/(\d+)/),x&&(ze=+x[1])));$o.exports=ze});var Xr=n((pb,jo)=>{"use strict";var Mo=Jr(),Cl=P(),Al=y(),Nl=Al.String;jo.exports=!!Object.getOwnPropertySymbols&&!Cl(function(){var r=Symbol("symbol detection");return!Nl(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Mo&&Mo<41})});var Zr=n((vb,Fo)=>{"use strict";var Ll=Xr();Fo.exports=Ll&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var et=n((hb,Bo)=>{"use strict";var kl=$(),Dl=I(),$l=He(),Ml=Zr(),jl=Object;Bo.exports=Ml?function(r){return typeof r=="symbol"}:function(r){var e=kl("Symbol");return Dl(e)&&$l(e.prototype,jl(r))}});var Ee=n((gb,Uo)=>{"use strict";var Fl=String;Uo.exports=function(r){try{return Fl(r)}catch(e){return"Object"}}});var M=n((mb,Vo)=>{"use strict";var Bl=I(),Ul=Ee(),Vl=TypeError;Vo.exports=function(r){if(Bl(r))return r;throw new Vl(Ul(r)+" is not a function")}});var Qe=n((bb,Go)=>{"use strict";var Gl=M(),Kl=Se();Go.exports=function(r,e){var t=r[e];return Kl(t)?void 0:Gl(t)}});var Wo=n((yb,Ko)=>{"use strict";var rt=w(),tt=I(),it=R(),Wl=TypeError;Ko.exports=function(r,e){var t,i;if(e==="string"&&tt(t=r.toString)&&!it(i=rt(t,r))||tt(t=r.valueOf)&&!it(i=rt(t,r))||e!=="string"&&tt(t=r.toString)&&!it(i=rt(t,r)))return i;throw new Wl("Can't convert object to primitive value")}});var N=n((Ib,Ho)=>{"use strict";Ho.exports=!0});var Yo=n((Sb,Qo)=>{"use strict";var zo=y(),Hl=Object.defineProperty;Qo.exports=function(r,e){try{Hl(zo,r,{value:e,configurable:!0,writable:!0})}catch(t){zo[r]=e}return e}});var Pe=n((Eb,Zo)=>{"use strict";var zl=N(),Ql=y(),Yl=Yo(),Jo="__core-js_shared__",Xo=Zo.exports=Ql[Jo]||Yl(Jo,{});(Xo.versions||(Xo.versions=[])).push({version:"3.38.0",mode:zl?"pure":"global",copyright:"\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var ot=n((Pb,rn)=>{"use strict";var en=Pe();rn.exports=function(r,e){return en[r]||(en[r]=e||{})}});var nt=n((Tb,tn)=>{"use strict";var Jl=Ke(),Xl=Object;tn.exports=function(r){return Xl(Jl(r))}});var L=n((qb,on)=>{"use strict";var Zl=O(),ef=nt(),rf=Zl({}.hasOwnProperty);on.exports=Object.hasOwn||function(e,t){return rf(ef(e),t)}});var at=n((Ob,nn)=>{"use strict";var tf=O(),of=0,nf=Math.random(),af=tf(1 .toString);nn.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+af(++of+nf,36)}});var T=n((_b,sn)=>{"use strict";var sf=y(),uf=ot(),an=L(),cf=at(),lf=Xr(),ff=Zr(),Z=sf.Symbol,st=uf("wks"),df=ff?Z.for||Z:Z&&Z.withoutSetter||cf;sn.exports=function(r){return an(st,r)||(st[r]=lf&&an(Z,r)?Z[r]:df("Symbol."+r)),st[r]}});var fn=n((wb,ln)=>{"use strict";var pf=w(),un=R(),cn=et(),vf=Qe(),hf=Wo(),gf=T(),mf=TypeError,bf=gf("toPrimitive");ln.exports=function(r,e){if(!un(r)||cn(r))return r;var t=vf(r,bf),i;if(t){if(e===void 0&&(e="default"),i=pf(t,r,e),!un(i)||cn(i))return i;throw new mf("Can't convert object to primitive value")}return e===void 0&&(e="number"),hf(r,e)}});var ut=n((Rb,dn)=>{"use strict";var yf=fn(),If=et();dn.exports=function(r){var e=yf(r,"string");return If(e)?e:e+""}});var Ye=n((xb,vn)=>{"use strict";var Sf=y(),pn=R(),ct=Sf.document,Ef=pn(ct)&&pn(ct.createElement);vn.exports=function(r){return Ef?ct.createElement(r):{}}});var lt=n((Cb,hn)=>{"use strict";var Pf=_(),Tf=P(),qf=Ye();hn.exports=!Pf&&!Tf(function(){return Object.defineProperty(qf("div"),"a",{get:function(){return 7}}).a!==7})});var bn=n(mn=>{"use strict";var Of=_(),_f=w(),wf=mo(),Rf=Ie(),xf=J(),Cf=ut(),Af=L(),Nf=lt(),gn=Object.getOwnPropertyDescriptor;mn.f=Of?gn:function(e,t){if(e=xf(e),t=Cf(t),Nf)try{return gn(e,t)}catch(i){}if(Af(e,t))return Rf(!_f(wf.f,e,t),e[t])}});var ft=n((Nb,yn)=>{"use strict";var Lf=P(),kf=I(),Df=/#|\.prototype\./,Te=function(r,e){var t=Mf[$f(r)];return t===Ff?!0:t===jf?!1:kf(e)?Lf(e):!!e},$f=Te.normalize=function(r){return String(r).replace(Df,".").toLowerCase()},Mf=Te.data={},jf=Te.NATIVE="N",Ff=Te.POLYFILL="P";yn.exports=Te});var qe=n((Lb,Sn)=>{"use strict";var In=Kr(),Bf=M(),Uf=be(),Vf=In(In.bind);Sn.exports=function(r,e){return Bf(r),e===void 0?r:Uf?Vf(r,e):function(){return r.apply(e,arguments)}}});var dt=n((kb,En)=>{"use strict";var Gf=_(),Kf=P();En.exports=Gf&&Kf(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var j=n((Db,Pn)=>{"use strict";var Wf=R(),Hf=String,zf=TypeError;Pn.exports=function(r){if(Wf(r))return r;throw new zf(Hf(r)+" is not an object")}});var K=n(qn=>{"use strict";var Qf=_(),Yf=lt(),Jf=dt(),Je=j(),Tn=ut(),Xf=TypeError,pt=Object.defineProperty,Zf=Object.getOwnPropertyDescriptor,vt="enumerable",ht="configurable",gt="writable";qn.f=Qf?Jf?function(e,t,i){if(Je(e),t=Tn(t),Je(i),typeof e=="function"&&t==="prototype"&&"value"in i&&gt in i&&!i[gt]){var o=Zf(e,t);o&&o[gt]&&(e[t]=i.value,i={configurable:ht in i?i[ht]:o[ht],enumerable:vt in i?i[vt]:o[vt],writable:!1})}return pt(e,t,i)}:pt:function(e,t,i){if(Je(e),t=Tn(t),Je(i),Yf)try{return pt(e,t,i)}catch(o){}if("get"in i||"set"in i)throw new Xf("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var ee=n((Mb,On)=>{"use strict";var ed=_(),rd=K(),td=Ie();On.exports=ed?function(r,e,t){return rd.f(r,e,td(1,t))}:function(r,e,t){return r[e]=t,r}});var k=n((jb,wn)=>{"use strict";var Oe=y(),id=Vr(),od=Kr(),nd=I(),ad=bn().f,sd=ft(),re=We(),ud=qe(),te=ee(),_n=L();Pe();var cd=function(r){var e=function(t,i,o){if(this instanceof e){switch(arguments.length){case 0:return new r;case 1:return new r(t);case 2:return new r(t,i)}return new r(t,i,o)}return id(r,this,arguments)};return e.prototype=r.prototype,e};wn.exports=function(r,e){var t=r.target,i=r.global,o=r.stat,a=r.proto,u=i?Oe:o?Oe[t]:Oe[t]&&Oe[t].prototype,f=i?re:re[t]||te(re,t,{})[t],d=f.prototype,l,p,v,s,c,h,m,b,g;for(s in e)l=sd(i?s:t+(o?".":"#")+s,r.forced),p=!l&&u&&_n(u,s),h=f[s],p&&(r.dontCallGetSet?(g=ad(u,s),m=g&&g.value):m=u[s]),c=p&&m?m:e[s],!(!l&&!a&&typeof h==typeof c)&&(r.bind&&p?b=ud(c,Oe):r.wrap&&p?b=cd(c):a&&nd(c)?b=od(c):b=c,(r.sham||c&&c.sham||h&&h.sham)&&te(b,"sham",!0),te(f,s,b),a&&(v=t+"Prototype",_n(re,v)||te(re,v,{}),te(re[v],s,c),r.real&&d&&(l||!d[s])&&te(d,s,c)))}});var mt=n((Fb,Rn)=>{"use strict";var _e=y(),ld=X(),fd=ye(),Xe=function(r){return ld.slice(0,r.length)===r};Rn.exports=function(){return Xe("Bun/")?"BUN":Xe("Cloudflare-Workers")?"CLOUDFLARE":Xe("Deno/")?"DENO":Xe("Node.js/")?"NODE":_e.Bun&&typeof Bun.version=="string"?"BUN":_e.Deno&&typeof Deno.version=="object"?"DENO":fd(_e.process)==="process"?"NODE":_e.window&&_e.document?"BROWSER":"REST"}()});var Ze=n((Bb,xn)=>{"use strict";var dd=mt();xn.exports=dd==="NODE"});var ie=n((Ub,Cn)=>{"use strict";var pd=ee();Cn.exports=function(r,e,t,i){return i&&i.enumerable?r[e]=t:pd(r,e,t),r}});var Nn=n((Vb,An)=>{"use strict";var vd=O(),hd=M();An.exports=function(r,e,t){try{return vd(hd(Object.getOwnPropertyDescriptor(r,e)[t]))}catch(i){}}});var kn=n((Gb,Ln)=>{"use strict";var gd=R();Ln.exports=function(r){return gd(r)||r===null}});var $n=n((Kb,Dn)=>{"use strict";var md=kn(),bd=String,yd=TypeError;Dn.exports=function(r){if(md(r))return r;throw new yd("Can't set "+bd(r)+" as a prototype")}});var bt=n((Wb,Mn)=>{"use strict";var Id=Nn(),Sd=R(),Ed=Ke(),Pd=$n();Mn.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Id(Object.prototype,"__proto__","set"),t(e,[]),r=e instanceof Array}catch(i){}return function(o,a){return Ed(o),Pd(a),Sd(o)&&(r?t(o,a):o.__proto__=a),o}}():void 0)});var er=n((Hb,Fn)=>{"use strict";var Td=T(),qd=Td("toStringTag"),jn={};jn[qd]="z";Fn.exports=String(jn)==="[object z]"});var tr=n((zb,Bn)=>{"use strict";var Od=er(),_d=I(),rr=ye(),wd=T(),Rd=wd("toStringTag"),xd=Object,Cd=rr(function(){return arguments}())==="Arguments",Ad=function(r,e){try{return r[e]}catch(t){}};Bn.exports=Od?rr:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=Ad(e=xd(r),Rd))=="string"?t:Cd?rr(e):(i=rr(e))==="Object"&&_d(e.callee)?"Arguments":i}});var Vn=n((Qb,Un)=>{"use strict";var Nd=er(),Ld=tr();Un.exports=Nd?{}.toString:function(){return"[object "+Ld(this)+"]"}});var we=n((Yb,Kn)=>{"use strict";var kd=er(),Dd=K().f,$d=ee(),Md=L(),jd=Vn(),Fd=T(),Gn=Fd("toStringTag");Kn.exports=function(r,e,t,i){var o=t?r:r&&r.prototype;o&&(Md(o,Gn)||Dd(o,Gn,{configurable:!0,value:e}),i&&!kd&&$d(o,"toString",jd))}});var Hn=n((Jb,Wn)=>{"use strict";var Bd=K();Wn.exports=function(r,e,t){return Bd.f(r,e,t)}});var Yn=n((Xb,Qn)=>{"use strict";var Ud=$(),Vd=Hn(),Gd=T(),Kd=_(),zn=Gd("species");Qn.exports=function(r){var e=Ud(r);Kd&&e&&!e[zn]&&Vd(e,zn,{configurable:!0,get:function(){return this}})}});var Xn=n((Zb,Jn)=>{"use strict";var Wd=He(),Hd=TypeError;Jn.exports=function(r,e){if(Wd(e,r))return r;throw new Hd("Incorrect invocation")}});var It=n((ey,Zn)=>{"use strict";var zd=O(),Qd=I(),yt=Pe(),Yd=zd(Function.toString);Qd(yt.inspectSource)||(yt.inspectSource=function(r){return Yd(r)});Zn.exports=yt.inspectSource});var na=n((ry,oa)=>{"use strict";var Jd=O(),Xd=P(),ea=I(),Zd=tr(),ep=$(),rp=It(),ra=function(){},ta=ep("Reflect","construct"),St=/^\s*(?:class|function)\b/,tp=Jd(St.exec),ip=!St.test(ra),Re=function(e){if(!ea(e))return!1;try{return ta(ra,[],e),!0}catch(t){return!1}},ia=function(e){if(!ea(e))return!1;switch(Zd(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ip||!!tp(St,rp(e))}catch(t){return!0}};ia.sham=!0;oa.exports=!ta||Xd(function(){var r;return Re(Re.call)||!Re(Object)||!Re(function(){r=!0})||r})?ia:Re});var sa=n((ty,aa)=>{"use strict";var op=na(),np=Ee(),ap=TypeError;aa.exports=function(r){if(op(r))return r;throw new ap(np(r)+" is not a constructor")}});var Et=n((iy,ca)=>{"use strict";var ua=j(),sp=sa(),up=Se(),cp=T(),lp=cp("species");ca.exports=function(r,e){var t=ua(r).constructor,i;return t===void 0||up(i=ua(t)[lp])?e:sp(i)}});var Pt=n((oy,la)=>{"use strict";var fp=$();la.exports=fp("document","documentElement")});var da=n((ny,fa)=>{"use strict";var dp=O();fa.exports=dp([].slice)});var va=n((ay,pa)=>{"use strict";var pp=TypeError;pa.exports=function(r,e){if(r<e)throw new pp("Not enough arguments");return r}});var Tt=n((sy,ha)=>{"use strict";var vp=X();ha.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(vp)});var Nt=n((uy,Ta)=>{"use strict";var q=y(),hp=Vr(),gp=qe(),ga=I(),mp=L(),Pa=P(),ma=Pt(),bp=da(),ba=Ye(),yp=va(),Ip=Tt(),Sp=Ze(),xt=q.setImmediate,Ct=q.clearImmediate,Ep=q.process,qt=q.Dispatch,Pp=q.Function,ya=q.MessageChannel,Tp=q.String,Ot=0,xe={},Ia="onreadystatechange",Ce,W,_t,wt;Pa(function(){Ce=q.location});var At=function(r){if(mp(xe,r)){var e=xe[r];delete xe[r],e()}},Rt=function(r){return function(){At(r)}},Sa=function(r){At(r.data)},Ea=function(r){q.postMessage(Tp(r),Ce.protocol+"//"+Ce.host)};(!xt||!Ct)&&(xt=function(e){yp(arguments.length,1);var t=ga(e)?e:Pp(e),i=bp(arguments,1);return xe[++Ot]=function(){hp(t,void 0,i)},W(Ot),Ot},Ct=function(e){delete xe[e]},Sp?W=function(r){Ep.nextTick(Rt(r))}:qt&&qt.now?W=function(r){qt.now(Rt(r))}:ya&&!Ip?(_t=new ya,wt=_t.port2,_t.port1.onmessage=Sa,W=gp(wt.postMessage,wt)):q.addEventListener&&ga(q.postMessage)&&!q.importScripts&&Ce&&Ce.protocol!=="file:"&&!Pa(Ea)?(W=Ea,q.addEventListener("message",Sa,!1)):Ia in ba("script")?W=function(r){ma.appendChild(ba("script"))[Ia]=function(){ma.removeChild(this),At(r)}}:W=function(r){setTimeout(Rt(r),0)});Ta.exports={set:xt,clear:Ct}});var _a=n((cy,Oa)=>{"use strict";var qa=y(),qp=_(),Op=Object.getOwnPropertyDescriptor;Oa.exports=function(r){if(!qp)return qa[r];var e=Op(qa,r);return e&&e.value}});var Lt=n((ly,Ra)=>{"use strict";var wa=function(){this.head=null,this.tail=null};wa.prototype={add:function(r){var e={item:r,next:null},t=this.tail;t?t.next=e:this.head=e,this.tail=e},get:function(){var r=this.head;if(r){var e=this.head=r.next;return e===null&&(this.tail=null),r.item}}};Ra.exports=wa});var Ca=n((fy,xa)=>{"use strict";var _p=X();xa.exports=/ipad|iphone|ipod/i.test(_p)&&typeof Pebble!="undefined"});var Na=n((dy,Aa)=>{"use strict";var wp=X();Aa.exports=/web0s(?!.*chrome)/i.test(wp)});var Fa=n((py,ja)=>{"use strict";var ne=y(),Rp=_a(),La=qe(),kt=Nt().set,xp=Lt(),Cp=Tt(),Ap=Ca(),Np=Na(),Dt=Ze(),ka=ne.MutationObserver||ne.WebKitMutationObserver,Da=ne.document,$a=ne.process,ir=ne.Promise,jt=Rp("queueMicrotask"),oe,$t,Mt,or,Ma;jt||(Ae=new xp,Ne=function(){var r,e;for(Dt&&(r=$a.domain)&&r.exit();e=Ae.get();)try{e()}catch(t){throw Ae.head&&oe(),t}r&&r.enter()},!Cp&&!Dt&&!Np&&ka&&Da?($t=!0,Mt=Da.createTextNode(""),new ka(Ne).observe(Mt,{characterData:!0}),oe=function(){Mt.data=$t=!$t}):!Ap&&ir&&ir.resolve?(or=ir.resolve(void 0),or.constructor=ir,Ma=La(or.then,or),oe=function(){Ma(Ne)}):Dt?oe=function(){$a.nextTick(Ne)}:(kt=La(kt,ne),oe=function(){kt(Ne)}),jt=function(r){Ae.head||oe(),Ae.add(r)});var Ae,Ne;ja.exports=jt});var Ua=n((vy,Ba)=>{"use strict";Ba.exports=function(r,e){try{arguments.length===1?console.error(r):console.error(r,e)}catch(t){}}});var nr=n((hy,Va)=>{"use strict";Va.exports=function(r){try{return{error:!1,value:r()}}catch(e){return{error:!0,value:e}}}});var Wa=n((gy,Ka)=>{"use strict";var Lp=y(),kp=I(),Ga=Lp.WeakMap;Ka.exports=kp(Ga)&&/native code/.test(String(Ga))});var ar=n((my,za)=>{"use strict";var Dp=ot(),$p=at(),Ha=Dp("keys");za.exports=function(r){return Ha[r]||(Ha[r]=$p(r))}});var sr=n((by,Qa)=>{"use strict";Qa.exports={}});var Vt=n((yy,Xa)=>{"use strict";var Mp=Wa(),Ja=y(),jp=R(),Fp=ee(),Ft=L(),Bt=Pe(),Bp=ar(),Up=sr(),Ya="Object already initialized",Ut=Ja.TypeError,Vp=Ja.WeakMap,ur,Le,cr,Gp=function(r){return cr(r)?Le(r):ur(r,{})},Kp=function(r){return function(e){var t;if(!jp(e)||(t=Le(e)).type!==r)throw new Ut("Incompatible receiver, "+r+" required");return t}};Mp||Bt.state?(C=Bt.state||(Bt.state=new Vp),C.get=C.get,C.has=C.has,C.set=C.set,ur=function(r,e){if(C.has(r))throw new Ut(Ya);return e.facade=r,C.set(r,e),e},Le=function(r){return C.get(r)||{}},cr=function(r){return C.has(r)}):(H=Bp("state"),Up[H]=!0,ur=function(r,e){if(Ft(r,H))throw new Ut(Ya);return e.facade=r,Fp(r,H,e),e},Le=function(r){return Ft(r,H)?r[H]:{}},cr=function(r){return Ft(r,H)});var C,H;Xa.exports={set:ur,get:Le,has:cr,enforce:Gp,getterFor:Kp}});var z=n((Iy,Za)=>{"use strict";var Wp=y();Za.exports=Wp.Promise});var ae=n((Sy,is)=>{"use strict";var Hp=y(),ke=z(),zp=I(),Qp=ft(),Yp=It(),Jp=T(),es=mt(),Xp=N(),Gt=Jr(),rs=ke&&ke.prototype,Zp=Jp("species"),Kt=!1,ts=zp(Hp.PromiseRejectionEvent),ev=Qp("Promise",function(){var r=Yp(ke),e=r!==String(ke);if(!e&&Gt===66||Xp&&!(rs.catch&&rs.finally))return!0;if(!Gt||Gt<51||!/native code/.test(r)){var t=new ke(function(a){a(1)}),i=function(a){a(function(){},function(){})},o=t.constructor={};if(o[Zp]=i,Kt=t.then(function(){})instanceof i,!Kt)return!0}return!e&&(es==="BROWSER"||es==="DENO")&&!ts});is.exports={CONSTRUCTOR:ev,REJECTION_EVENT:ts,SUBCLASSING:Kt}});var se=n((Ey,ns)=>{"use strict";var os=M(),rv=TypeError,tv=function(r){var e,t;this.promise=new r(function(i,o){if(e!==void 0||t!==void 0)throw new rv("Bad Promise constructor");e=i,t=o}),this.resolve=os(e),this.reject=os(t)};ns.exports.f=function(r){return new tv(r)}});var Ts=n(()=>{"use strict";var iv=k(),ov=N(),pr=Ze(),G=y(),fe=w(),as=ie(),ss=bt(),nv=we(),av=Yn(),sv=M(),dr=I(),uv=R(),cv=Xn(),lv=Et(),ds=Nt().set,Yt=Fa(),fv=Ua(),dv=nr(),pv=Lt(),ps=Vt(),vr=z(),Jt=ae(),vs=se(),hr="Promise",hs=Jt.CONSTRUCTOR,vv=Jt.REJECTION_EVENT,hv=Jt.SUBCLASSING,Wt=ps.getterFor(hr),gv=ps.set,ue=vr&&vr.prototype,Q=vr,lr=ue,gs=G.TypeError,Ht=G.document,Xt=G.process,zt=vs.f,mv=zt,bv=!!(Ht&&Ht.createEvent&&G.dispatchEvent),ms="unhandledrejection",yv="rejectionhandled",us=0,bs=1,Iv=2,Zt=1,ys=2,fr,cs,Sv,ls,Is=function(r){var e;return uv(r)&&dr(e=r.then)?e:!1},Ss=function(r,e){var t=e.value,i=e.state===bs,o=i?r.ok:r.fail,a=r.resolve,u=r.reject,f=r.domain,d,l,p;try{o?(i||(e.rejection===ys&&Pv(e),e.rejection=Zt),o===!0?d=t:(f&&f.enter(),d=o(t),f&&(f.exit(),p=!0)),d===r.promise?u(new gs("Promise-chain cycle")):(l=Is(d))?fe(l,d,a,u):a(d)):u(t)}catch(v){f&&!p&&f.exit(),u(v)}},Es=function(r,e){r.notified||(r.notified=!0,Yt(function(){for(var t=r.reactions,i;i=t.get();)Ss(i,r);r.notified=!1,e&&!r.rejection&&Ev(r)}))},Ps=function(r,e,t){var i,o;bv?(i=Ht.createEvent("Event"),i.promise=e,i.reason=t,i.initEvent(r,!1,!0),G.dispatchEvent(i)):i={promise:e,reason:t},!vv&&(o=G["on"+r])?o(i):r===ms&&fv("Unhandled promise rejection",t)},Ev=function(r){fe(ds,G,function(){var e=r.facade,t=r.value,i=fs(r),o;if(i&&(o=dv(function(){pr?Xt.emit("unhandledRejection",t,e):Ps(ms,e,t)}),r.rejection=pr||fs(r)?ys:Zt,o.error))throw o.value})},fs=function(r){return r.rejection!==Zt&&!r.parent},Pv=function(r){fe(ds,G,function(){var e=r.facade;pr?Xt.emit("rejectionHandled",e):Ps(yv,e,r.value)})},ce=function(r,e,t){return function(i){r(e,i,t)}},le=function(r,e,t){r.done||(r.done=!0,t&&(r=t),r.value=e,r.state=Iv,Es(r,!0))},Qt=function(r,e,t){if(!r.done){r.done=!0,t&&(r=t);try{if(r.facade===e)throw new gs("Promise can't be resolved itself");var i=Is(e);i?Yt(function(){var o={done:!1};try{fe(i,e,ce(Qt,o,r),ce(le,o,r))}catch(a){le(o,a,r)}}):(r.value=e,r.state=bs,Es(r,!1))}catch(o){le({done:!1},o,r)}}};if(hs&&(Q=function(e){cv(this,lr),sv(e),fe(fr,this);var t=Wt(this);try{e(ce(Qt,t),ce(le,t))}catch(i){le(t,i)}},lr=Q.prototype,fr=function(e){gv(this,{type:hr,done:!1,notified:!1,parent:!1,reactions:new pv,rejection:!1,state:us,value:void 0})},fr.prototype=as(lr,"then",function(e,t){var i=Wt(this),o=zt(lv(this,Q));return i.parent=!0,o.ok=dr(e)?e:!0,o.fail=dr(t)&&t,o.domain=pr?Xt.domain:void 0,i.state===us?i.reactions.add(o):Yt(function(){Ss(o,i)}),o.promise}),cs=function(){var r=new fr,e=Wt(r);this.promise=r,this.resolve=ce(Qt,e),this.reject=ce(le,e)},vs.f=zt=function(r){return r===Q||r===Sv?new cs(r):mv(r)},!ov&&dr(vr)&&ue!==Object.prototype)){ls=ue.then,hv||as(ue,"then",function(e,t){var i=this;return new Q(function(o,a){fe(ls,i,o,a)}).then(e,t)},{unsafe:!0});try{delete ue.constructor}catch(r){}ss&&ss(ue,lr)}iv({global:!0,constructor:!0,wrap:!0,forced:hs},{Promise:Q});nv(Q,hr,!1,!0);av(hr)});var Y=n((qy,qs)=>{"use strict";qs.exports={}});var _s=n((Oy,Os)=>{"use strict";var Tv=T(),qv=Y(),Ov=Tv("iterator"),_v=Array.prototype;Os.exports=function(r){return r!==void 0&&(qv.Array===r||_v[Ov]===r)}});var Rs=n((_y,ws)=>{"use strict";var wv=Math.ceil,Rv=Math.floor;ws.exports=Math.trunc||function(e){var t=+e;return(t>0?Rv:wv)(t)}});var ei=n((wy,xs)=>{"use strict";var xv=Rs();xs.exports=function(r){var e=+r;return e!==e||e===0?0:xv(e)}});var As=n((Ry,Cs)=>{"use strict";var Cv=ei(),Av=Math.min;Cs.exports=function(r){var e=Cv(r);return e>0?Av(e,9007199254740991):0}});var ri=n((xy,Ns)=>{"use strict";var Nv=As();Ns.exports=function(r){return Nv(r.length)}});var ti=n((Cy,ks)=>{"use strict";var Lv=tr(),Ls=Qe(),kv=Se(),Dv=Y(),$v=T(),Mv=$v("iterator");ks.exports=function(r){if(!kv(r))return Ls(r,Mv)||Ls(r,"@@iterator")||Dv[Lv(r)]}});var $s=n((Ay,Ds)=>{"use strict";var jv=w(),Fv=M(),Bv=j(),Uv=Ee(),Vv=ti(),Gv=TypeError;Ds.exports=function(r,e){var t=arguments.length<2?Vv(r):e;if(Fv(t))return Bv(jv(t,r));throw new Gv(Uv(r)+" is not iterable")}});var Fs=n((Ny,js)=>{"use strict";var Kv=w(),Ms=j(),Wv=Qe();js.exports=function(r,e,t){var i,o;Ms(r);try{if(i=Wv(r,"return"),!i){if(e==="throw")throw t;return t}i=Kv(i,r)}catch(a){o=!0,i=a}if(e==="throw")throw t;if(o)throw i;return Ms(i),t}});var mr=n((Ly,Gs)=>{"use strict";var Hv=qe(),zv=w(),Qv=j(),Yv=Ee(),Jv=_s(),Xv=ri(),Bs=He(),Zv=$s(),eh=ti(),Us=Fs(),rh=TypeError,gr=function(r,e){this.stopped=r,this.result=e},Vs=gr.prototype;Gs.exports=function(r,e,t){var i=t&&t.that,o=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_RECORD),u=!!(t&&t.IS_ITERATOR),f=!!(t&&t.INTERRUPTED),d=Hv(e,i),l,p,v,s,c,h,m,b=function(S){return l&&Us(l,"normal",S),new gr(!0,S)},g=function(S){return o?(Qv(S),f?d(S[0],S[1],b):d(S[0],S[1])):f?d(S,b):d(S)};if(a)l=r.iterator;else if(u)l=r;else{if(p=eh(r),!p)throw new rh(Yv(r)+" is not iterable");if(Jv(p)){for(v=0,s=Xv(r);s>v;v++)if(c=g(r[v]),c&&Bs(Vs,c))return c;return new gr(!1)}l=Zv(r,p)}for(h=a?r.next:l.next;!(m=zv(h,l)).done;){try{c=g(m.value)}catch(S){Us(l,"throw",S)}if(typeof c=="object"&&c&&Bs(Vs,c))return c}return new gr(!1)}});var Qs=n((ky,zs)=>{"use strict";var th=T(),Ws=th("iterator"),Hs=!1;try{Ks=0,ii={next:function(){return{done:!!Ks++}},return:function(){Hs=!0}},ii[Ws]=function(){return this},Array.from(ii,function(){throw 2})}catch(r){}var Ks,ii;zs.exports=function(r,e){try{if(!e&&!Hs)return!1}catch(o){return!1}var t=!1;try{var i={};i[Ws]=function(){return{next:function(){return{done:t=!0}}}},r(i)}catch(o){}return t}});var oi=n((Dy,Ys)=>{"use strict";var ih=z(),oh=Qs(),nh=ae().CONSTRUCTOR;Ys.exports=nh||!oh(function(r){ih.all(r).then(void 0,function(){})})});var Js=n(()=>{"use strict";var ah=k(),sh=w(),uh=M(),ch=se(),lh=nr(),fh=mr(),dh=oi();ah({target:"Promise",stat:!0,forced:dh},{all:function(e){var t=this,i=ch.f(t),o=i.resolve,a=i.reject,u=lh(function(){var f=uh(t.resolve),d=[],l=0,p=1;fh(e,function(v){var s=l++,c=!1;p++,sh(f,t,v).then(function(h){c||(c=!0,d[s]=h,--p||o(d))},a)}),--p||o(d)});return u.error&&a(u.value),i.promise}})});var Zs=n(()=>{"use strict";var ph=k(),vh=N(),hh=ae().CONSTRUCTOR,ai=z(),gh=$(),mh=I(),bh=ie(),Xs=ai&&ai.prototype;ph({target:"Promise",proto:!0,forced:hh,real:!0},{catch:function(r){return this.then(void 0,r)}});!vh&&mh(ai)&&(ni=gh("Promise").prototype.catch,Xs.catch!==ni&&bh(Xs,"catch",ni,{unsafe:!0}));var ni});var eu=n(()=>{"use strict";var yh=k(),Ih=w(),Sh=M(),Eh=se(),Ph=nr(),Th=mr(),qh=oi();yh({target:"Promise",stat:!0,forced:qh},{race:function(e){var t=this,i=Eh.f(t),o=i.reject,a=Ph(function(){var u=Sh(t.resolve);Th(e,function(f){Ih(u,t,f).then(i.resolve,o)})});return a.error&&o(a.value),i.promise}})});var ru=n(()=>{"use strict";var Oh=k(),_h=se(),wh=ae().CONSTRUCTOR;Oh({target:"Promise",stat:!0,forced:wh},{reject:function(e){var t=_h.f(this),i=t.reject;return i(e),t.promise}})});var si=n((Ky,tu)=>{"use strict";var Rh=j(),xh=R(),Ch=se();tu.exports=function(r,e){if(Rh(r),xh(e)&&e.constructor===r)return e;var t=Ch.f(r),i=t.resolve;return i(e),t.promise}});var nu=n(()=>{"use strict";var Ah=k(),Nh=$(),iu=N(),Lh=z(),ou=ae().CONSTRUCTOR,kh=si(),Dh=Nh("Promise"),$h=iu&&!ou;Ah({target:"Promise",stat:!0,forced:iu||ou},{resolve:function(e){return kh($h&&this===Dh?Lh:this,e)}})});var au=n(()=>{"use strict";Ts();Js();Zs();eu();ru();nu()});var lu=n(()=>{"use strict";var Mh=k(),jh=N(),br=z(),Fh=P(),uu=$(),cu=I(),Bh=Et(),su=si(),Uh=ie(),ci=br&&br.prototype,Vh=!!br&&Fh(function(){ci.finally.call({then:function(){}},function(){})});Mh({target:"Promise",proto:!0,real:!0,forced:Vh},{finally:function(r){var e=Bh(this,uu("Promise")),t=cu(r);return this.then(t?function(i){return su(e,r()).then(function(){return i})}:r,t?function(i){return su(e,r()).then(function(){throw i})}:r)}});!jh&&cu(br)&&(ui=uu("Promise").prototype.finally,ci.finally!==ui&&Uh(ci,"finally",ui,{unsafe:!0}));var ui});var du=n((Xy,fu)=>{"use strict";var Gh=$();fu.exports=Gh});var vu=n((Zy,pu)=>{"use strict";Yi();au();lu();var Kh=du();pu.exports=Kh("Promise","finally")});var gu=n((eI,hu)=>{"use strict";var Wh=vu();hu.exports=Wh});var bu=n((rI,mu)=>{"use strict";var Hh=gu();mu.exports=Hh});var Iu=n((tI,yu)=>{"use strict";yu.exports=function(){}});var Pu=n((iI,Eu)=>{"use strict";var li=_(),zh=L(),Su=Function.prototype,Qh=li&&Object.getOwnPropertyDescriptor,fi=zh(Su,"name"),Yh=fi&&function(){}.name==="something",Jh=fi&&(!li||li&&Qh(Su,"name").configurable);Eu.exports={EXISTS:fi,PROPER:Yh,CONFIGURABLE:Jh}});var qu=n((oI,Tu)=>{"use strict";var Xh=ei(),Zh=Math.max,eg=Math.min;Tu.exports=function(r,e){var t=Xh(r);return t<0?Zh(t+e,0):eg(t,e)}});var wu=n((nI,_u)=>{"use strict";var rg=J(),tg=qu(),ig=ri(),Ou=function(r){return function(e,t,i){var o=rg(e),a=ig(o);if(a===0)return!r&&-1;var u=tg(i,a),f;if(r&&t!==t){for(;a>u;)if(f=o[u++],f!==f)return!0}else for(;a>u;u++)if((r||u in o)&&o[u]===t)return r||u||0;return!r&&-1}};_u.exports={includes:Ou(!0),indexOf:Ou(!1)}});var Cu=n((aI,xu)=>{"use strict";var og=O(),di=L(),ng=J(),ag=wu().indexOf,sg=sr(),Ru=og([].push);xu.exports=function(r,e){var t=ng(r),i=0,o=[],a;for(a in t)!di(sg,a)&&di(t,a)&&Ru(o,a);for(;e.length>i;)di(t,a=e[i++])&&(~ag(o,a)||Ru(o,a));return o}});var pi=n((sI,Au)=>{"use strict";Au.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Lu=n((uI,Nu)=>{"use strict";var ug=Cu(),cg=pi();Nu.exports=Object.keys||function(e){return ug(e,cg)}});var Du=n(ku=>{"use strict";var lg=_(),fg=dt(),dg=K(),pg=j(),vg=J(),hg=Lu();ku.f=lg&&!fg?Object.defineProperties:function(e,t){pg(e);for(var i=vg(t),o=hg(t),a=o.length,u=0,f;a>u;)dg.f(e,f=o[u++],i[f]);return e}});var mi=n((lI,Vu)=>{"use strict";var gg=j(),mg=Du(),$u=pi(),bg=sr(),yg=Pt(),Ig=Ye(),Sg=ar(),Mu=">",ju="<",hi="prototype",gi="script",Bu=Sg("IE_PROTO"),vi=function(){},Uu=function(r){return ju+gi+Mu+r+ju+"/"+gi+Mu},Fu=function(r){r.write(Uu("")),r.close();var e=r.parentWindow.Object;return r=null,e},Eg=function(){var r=Ig("iframe"),e="java"+gi+":",t;return r.style.display="none",yg.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Uu("document.F=Object")),t.close(),t.F},yr,Ir=function(){try{yr=new ActiveXObject("htmlfile")}catch(e){}Ir=typeof document!="undefined"?document.domain&&yr?Fu(yr):Eg():Fu(yr);for(var r=$u.length;r--;)delete Ir[hi][$u[r]];return Ir()};bg[Bu]=!0;Vu.exports=Object.create||function(e,t){var i;return e!==null?(vi[hi]=gg(e),i=new vi,vi[hi]=null,i[Bu]=e):i=Ir(),t===void 0?i:mg.f(i,t)}});var Ku=n((fI,Gu)=>{"use strict";var Pg=P();Gu.exports=!Pg(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var yi=n((dI,Hu)=>{"use strict";var Tg=L(),qg=I(),Og=nt(),_g=ar(),wg=Ku(),Wu=_g("IE_PROTO"),bi=Object,Rg=bi.prototype;Hu.exports=wg?bi.getPrototypeOf:function(r){var e=Og(r);if(Tg(e,Wu))return e[Wu];var t=e.constructor;return qg(t)&&e instanceof t?t.prototype:e instanceof bi?Rg:null}});var Pi=n((pI,Yu)=>{"use strict";var xg=P(),Cg=I(),Ag=R(),Ng=mi(),zu=yi(),Lg=ie(),kg=T(),Dg=N(),Ei=kg("iterator"),Qu=!1,F,Ii,Si;[].keys&&(Si=[].keys(),"next"in Si?(Ii=zu(zu(Si)),Ii!==Object.prototype&&(F=Ii)):Qu=!0);var $g=!Ag(F)||xg(function(){var r={};return F[Ei].call(r)!==r});$g?F={}:Dg&&(F=Ng(F));Cg(F[Ei])||Lg(F,Ei,function(){return this});Yu.exports={IteratorPrototype:F,BUGGY_SAFARI_ITERATORS:Qu}});var Xu=n((vI,Ju)=>{"use strict";var Mg=Pi().IteratorPrototype,jg=mi(),Fg=Ie(),Bg=we(),Ug=Y(),Vg=function(){return this};Ju.exports=function(r,e,t,i){var o=e+" Iterator";return r.prototype=jg(Mg,{next:Fg(+!i,t)}),Bg(r,o,!1,!0),Ug[o]=Vg,r}});var cc=n((hI,uc)=>{"use strict";var Gg=k(),Kg=w(),Sr=N(),ac=Pu(),Wg=I(),Hg=Xu(),Zu=yi(),ec=bt(),zg=we(),Qg=ee(),Ti=ie(),Yg=T(),rc=Y(),sc=Pi(),Jg=ac.PROPER,Xg=ac.CONFIGURABLE,tc=sc.IteratorPrototype,Er=sc.BUGGY_SAFARI_ITERATORS,De=Yg("iterator"),ic="keys",$e="values",oc="entries",nc=function(){return this};uc.exports=function(r,e,t,i,o,a,u){Hg(t,e,i);var f=function(g){if(g===o&&s)return s;if(!Er&&g&&g in p)return p[g];switch(g){case ic:return function(){return new t(this,g)};case $e:return function(){return new t(this,g)};case oc:return function(){return new t(this,g)}}return function(){return new t(this)}},d=e+" Iterator",l=!1,p=r.prototype,v=p[De]||p["@@iterator"]||o&&p[o],s=!Er&&v||f(o),c=e==="Array"&&p.entries||v,h,m,b;if(c&&(h=Zu(c.call(new r)),h!==Object.prototype&&h.next&&(!Sr&&Zu(h)!==tc&&(ec?ec(h,tc):Wg(h[De])||Ti(h,De,nc)),zg(h,d,!0,!0),Sr&&(rc[d]=nc))),Jg&&o===$e&&v&&v.name!==$e&&(!Sr&&Xg?Qg(p,"name",$e):(l=!0,s=function(){return Kg(v,this)})),o)if(m={values:f($e),keys:a?s:f(ic),entries:f(oc)},u)for(b in m)(Er||l||!(b in p))&&Ti(p,b,m[b]);else Gg({target:e,proto:!0,forced:Er||l},m);return(!Sr||u)&&p[De]!==s&&Ti(p,De,s,{name:o}),rc[e]=s,m}});var fc=n((gI,lc)=>{"use strict";lc.exports=function(r,e){return{value:r,done:e}}});var Oi=n((mI,gc)=>{"use strict";var Zg=J(),qi=Iu(),dc=Y(),vc=Vt(),em=K().f,rm=cc(),Pr=fc(),tm=N(),im=_(),hc="Array Iterator",om=vc.set,nm=vc.getterFor(hc);gc.exports=rm(Array,"Array",function(r,e){om(this,{type:hc,target:Zg(r),index:0,kind:e})},function(){var r=nm(this),e=r.target,t=r.index++;if(!e||t>=e.length)return r.target=void 0,Pr(void 0,!0);switch(r.kind){case"keys":return Pr(t,!1);case"values":return Pr(e[t],!1)}return Pr([t,e[t]],!1)},"values");var pc=dc.Arguments=dc.Array;qi("keys");qi("values");qi("entries");if(!tm&&im&&pc.name!=="values")try{em(pc,"name",{value:"values"})}catch(r){}});var bc=n((bI,mc)=>{"use strict";var am=_(),sm=K(),um=Ie();mc.exports=function(r,e,t){am?sm.f(r,e,um(0,t)):r[e]=t}});var yc=n(()=>{"use strict";var cm=k(),lm=mr(),fm=bc();cm({target:"Object",stat:!0},{fromEntries:function(e){var t={};return lm(e,function(i,o){fm(t,i,o)},{AS_ENTRIES:!0}),t}})});var Sc=n((SI,Ic)=>{"use strict";Oi();yc();var dm=We();Ic.exports=dm.Object.fromEntries});var Pc=n((EI,Ec)=>{"use strict";Ec.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var qc=n(()=>{"use strict";Oi();var pm=Pc(),vm=y(),hm=we(),Tc=Y();for(Tr in pm)hm(vm[Tr],Tr),Tc[Tr]=Tc.Array;var Tr});var _c=n((qI,Oc)=>{"use strict";var gm=Sc();qc();Oc.exports=gm});var Rc=n((OI,wc)=>{"use strict";var mm=_c();wc.exports=mm});var ge=(u=>(u.PROD="prod",u.VK_ALIAS="vk_alias",u.VIDEOTEST="videotest",u.TEST="test",u.OKCDN="okcdn",u.AUTO="auto",u))(ge||{}),$r=(l=>(l.Q144P="mobile",l.Q240P="lowest",l.Q360P="low",l.Q480P="medium",l.Q720P="high",l.Q1080P="fullhd",l.Q1440P="quadhd",l.Q2160P="ultrahd",l.UNKNOWN="unknown",l))($r||{}),Mr=(c=>(c.MP4="mp4",c.DASH="dash",c.DASH_SEP="dash_sep",c.ONDEMAND_DASH="ondemand_dash",c.HLS="hls",c.ONDEMAND_HLS="ondemand_hls",c.WEBM="webm",c.AV1="av1",c.ONDEMAND_DASH_LIVE="ondemand_dash_live",c.ONDEMAND_HLS_LIVE="ondemand_hls_live",c.WEBRTC="webrtc",c.UNKNOWN="unknown",c.RTMP="rtmp",c))(Mr||{});var jr=(i=>(i.HTTP1="http1",i.HTTP2="http2",i.HTTP3="http3",i))(jr||{});var Fr=(f=>(f.SLIDER="slider",f.DOUBLE_TAP="double_tap",f.TIME_CODE="time_code",f.EPISODE="episode",f.REWIND="rewind",f.LIVE="live",f.UNKNOWN="unknown",f))(Fr||{}),Gi=(a=>(a.GRAPH_SHOW="iGraphShow",a.GRAPH_HIDE="iGraphHide",a.NEXT_AREA="iNextChapterArea",a.NEXT_BUTTON="iNextChapterBtn",a.WATCH_AGAIN="iWatchAgainBtn",a))(Gi||{}),Ki={action_play:"ap",action_play_interactive:"api",first_bytes:"fb",player_ready:"pr",first_frame:"ff",seek:"sk",watch_coverage_record:"wr",watch_coverage_live:"wl",empty_buffer:"eb",action_stop:"as",close_at_empty_buffer:"cb",content_error:"er",player_interface_click:"pc",next_movie:"nm",track_switch:"ts",failover:"fo"},Wi={vsid:"si",isid:"is",vid:"vi",place:"pl",quality:"qt",cdn_host:"ch",stat_type:"st",param:"pm",vk_app_id:"va",track_code:"tc",connection_type:"cnt",connection_reused:"cr",cached_data:"cd",live:"lv",muted:"mu",mode:"mo",subtitles:"sb",failover:"fo",download_speed:"ds",manual_quality:"mq",ref_domain:"rd",direct_url:"du"},Hi={unknown:"un",mobile:"m",lowest:"ls",low:"l",medium:"md",high:"h",fullhd:"f",quadhd:"q",ultrahd:"u"},zi={pip:"pi",fullscreen:"fs",external:"ex",prefetch:"pr",airplay:"ap",chromecast:"cc",invisible:"iv"};import{fillWithDefault as sl}from"@vkontakte/videoplayer-shared";var ul={apiEnv:"vk_alias",requestRetryCount:1,firstFlushTime:5e3,flushDebounceTime:1e4,flushMaxWait:6e4,storageExpiration:36*60*60*1e3,watchCoverageInterval:15e3,disabledOperations:[],disabledCustomFields:[],shorten:!0,maxLoops:100,embedUrlParams:[],useBeacon:!0,synchronizeTime:!0,debugLog:!1,backoff:{start:1e3,factor:1.5,max:5*60*1e3,random:.1}},Qi=r=>sl(r,ul);function Br(){let r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),e=new Array(36),t=0,i,o;for(o=0;o<36;o++)o===8||o===13||o===18||o===23?e[o]="-":o===14?e[o]="4":(t<=2&&(t=33554432+Math.random()*16777216|0),i=t&15,t=t>>4,e[o]=r[o===19?i&3|8:i]);return e.join("")}import{assertNonNullable as Rm,combine as Kc,fromEvent as Wc,isNonNullable as he,isNullable as Hc,merge as xm,now as B,observableFrom as Cm,once as Am,safeStorage as Lr,Subject as Nm,Subscription as Mi,ValueSubject as Di}from"@vkontakte/videoplayer-shared";import{Logger as Lm,detectEmbed as km}from"@vkontakte/videoplayer-shared";var Or=Vi(bu(),1);var xc=Vi(Rc(),1);var Cc=r=>{var o;let{operation:e,custom:t}=r,i=(0,xc.default)(Object.entries(t).map(([a,u])=>{var l,p,v;let f=(l=Wi[a])!=null?l:a,d=u;return u&&(a==="mode"?d=(p=zi[u])!=null?p:u:a==="quality"&&(d=(v=Hi[u])!=null?v:u)),[f,d]}));return Ve(V({},r),{operation:(o=Ki[e])!=null?o:e,custom:i})};var qr="1.0.53-beta.0",Ac="CIOPGQJGDIHBABABA",_i={prod:"https://api.ok.ru",vk_alias:"https://api.mycdn.me",videotest:"https://videotestapi.ok.ru/api",test:"https://apitest.ok.ru",okcdn:"https://api.okcdn.ru",auto:""};import{ValueSubject as bm,getExponentialDelay as ym,ErrorCategory as de}from"@vkontakte/videoplayer-shared";var Me=class{constructor(e){this.consequentAuthErrors=0;this.authorized$=new bm(!1);this.params=e}authorize(e){return A(this,null,function*(){return this.authToken=e!=null?e:yield this.refreshAuthToken(),this._authorizeWithBackoff()})}logBeacon(e){let t="log.externalLog",i=this.createLogParams(e),o=this.sessionKey;if(!o)return;this.params.apiTransport.sendBeacon(t,i,o)||this.logRequest(e)}logRequest(e){return A(this,null,function*(){var u;let t="log.externalLog",i=this.createLogParams(e),o=(u=this.sessionKey)!=null?u:yield this._authorizeWithBackoff();if(!o)return;let a=(l,...p)=>A(this,[l,...p],function*(f,d=this.params.config.requestRetryCount){try{return yield this.params.apiTransport.sendRequest(t,i,o)}catch(v){if(!v||!("error_code"in v)){this.params.error$.next({id:"logRequestUnknown",category:de.NETWORK,message:`Unknown ${t} error`,thrown:v});return}let s=v==null?void 0:v.error_code;switch(s){case 102:case 103:case 104:return this.authorized$.next(!1),this.sessionKey=yield this._authorizeWithBackoff(),d>0?a(f,d-1):void 0;case 401:return this.authorized$.next(!1),this.authToken=yield this.refreshAuthToken(),this.sessionKey=yield this._authorizeWithBackoff(),d>0?a(f,d-1):void 0;default:{this.params.error$.next({id:`LogRequest#${s}`,category:de.EXTERNAL_API,message:`${t} error`,data:v});return}}}});return a(e)})}destroy(){window.clearTimeout(this.backoffTimeoutId),this.backoffTimeoutId=0}refreshAuthToken(){return A(this,null,function*(){if(this.params.refreshAuthToken)return this.refreshAuthTokenPromise||(this.refreshAuthTokenPromise=(0,Or.default)(this.params.refreshAuthToken(),()=>{this.refreshAuthTokenPromise=void 0})),this.refreshAuthTokenPromise})}createLogParams(e){return{collector:"ok.mobile.apps.video",data:JSON.stringify({application:`@vkontakte/videoplayer-statistics:${qr}`,platform:this.params.mobile?"M_WEB":"WEB",items:this.params.config.shorten?e.map(Cc):e})}}_authorizeWithBackoff(){if(!this.consequentAuthErrors)return this._authorize();let e=ym(this.consequentAuthErrors,this.params.config.backoff);return new Promise(t=>{this.backoffTimeoutId||(this.backoffTimeoutId=window.setTimeout(()=>{(0,Or.default)(this._authorize().then(t).catch(i=>this.params.error$.next({id:"AuthorizeBackoff",category:de.NETWORK,message:"Otherwise unhandled error in authorization",thrown:i})),()=>this.backoffTimeoutId=0)},e))})}_authorize(){return A(this,null,function*(){if(this.authorizePromise)return this.authorizePromise;this.sessionKey=void 0,this.authorized$.next(!1);let e="auth.anonymLogin",t={session_data:{version:2,device_id:this.params.deviceId,client_version:qr.split("-")[0],client_type:"SDK_JS"}};return this.authToken!==void 0&&(t.session_data.auth_token=this.authToken,t.session_data.version=3),this.authorizePromise=(0,Or.default)(this.params.apiTransport.sendRequest(e,t).then(i=>{var o;return(!i||!i.session_key)&&this.params.error$.next({id:"AuthorizeFailed",category:de.EXTERNAL_API,message:"No session key",data:i}),this.sessionKey=(o=i==null?void 0:i.session_key)!=null?o:void 0,this.sessionKey}).catch(i=>A(this,null,function*(){this.sessionKey=void 0;let o=i==null?void 0:i.error_code;switch(o){case 401:return this.authToken=yield this.refreshAuthToken(),this._authorizeWithBackoff()}o?this.params.error$.next({id:`Authorize#${o}`,category:de.EXTERNAL_API,message:"authorize error",data:i}):this.params.error$.next({id:"AuthorizeUnknown",category:de.NETWORK,message:"authorize error",thrown:i})})),()=>{this.authorizePromise=void 0,this.consequentAuthErrors=this.sessionKey?0:this.consequentAuthErrors+1,this.authorized$.next(this.sessionKey!==void 0)}),this.authorizePromise})}};var _r=class{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(e,t,i){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:i})}removeEventListener(e,t){if(!(e in this.listeners))return;let i=this.listeners[e];for(let o=0,a=i.length;o<a;o++)if(i[o].callback===t){i.splice(o,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let i=this.listeners[e.type].slice();for(let o=0,a=i.length;o<a;o++){let u=i[o];try{u.callback.call(this,e)}catch(f){Promise.resolve().then(()=>{throw f})}u.options&&u.options.once&&this.removeEventListener(e.type,u.callback)}return!e.defaultPrevented}},pe=class extends _r{constructor(){super(),this.listeners||_r.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,e)),super.dispatchEvent(e)}},je=class{constructor(){Object.defineProperty(this,"signal",{value:new pe,writable:!0,configurable:!0})}abort(e){let t;try{t=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let i=e;if(i===void 0)if(typeof document=="undefined")i=new Error("This operation was aborted"),i.name="AbortError";else try{i=new DOMException("signal is aborted without reason")}catch(o){i=new Error("This operation was aborted"),i.name="AbortError"}this.signal.reason=i,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}};typeof Symbol!="undefined"&&Symbol.toStringTag&&(je.prototype[Symbol.toStringTag]="AbortController",pe.prototype[Symbol.toStringTag]="AbortSignal");function wr(r){return r.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof r.Request=="function"&&!r.Request.prototype.hasOwnProperty("signal")||!r.AbortController}function wi(r){typeof r=="function"&&(r={fetch:r});let{fetch:e,Request:t=e.Request,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=r;if(!wr({fetch:e,Request:t,AbortController:i,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:e,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||o)&&(a=function(l,p){let v;p&&p.signal&&(v=p.signal,delete p.signal);let s=new t(l,p);return v&&Object.defineProperty(s,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),s},a.prototype=t.prototype);let u=e;return{fetch:(d,l)=>{let p=a&&a.prototype.isPrototypeOf(d)?d.signal:l?l.signal:void 0;if(p){let v;try{v=new DOMException("Aborted","AbortError")}catch(c){v=new Error("Aborted"),v.name="AbortError"}if(p.aborted)return Promise.reject(v);let s=new Promise((c,h)=>{p.addEventListener("abort",()=>h(v),{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([s,u(d,l)])}return u(d,l)},Request:a}}var Fe=wr({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Nc=Fe?wi({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Ri=Fe?Nc.fetch:window.fetch,QI=Fe?Nc.Request:window.Request,YI=Fe?je:window.AbortController,JI=Fe?pe:window.AbortSignal;import{ErrorCategory as Rr,now as xi}from"@vkontakte/videoplayer-shared";var Be=class{constructor(e){this.params=e,this.apiKey=e.apiKey,this.apiEnv=e.config.apiEnv,this.apiBaseUrl=_i[this.apiEnv],this.timeSynchronisation=e.timeSynchronisation,this.isApiBaseUrlFetched=!1}resolveApiBaseUrl(){return A(this,null,function*(){var e;if(this.apiEnv!=="auto"||this.isApiBaseUrlFetched)return this.apiBaseUrl;try{let t=atob("aHR0cHM6Ly9kbnMuZ29vZ2xlL3Jlc29sdmU/bmFtZT12aWRlby5fZW5kcG9pbnQub2sucnUmdHlwZT1UWFQ="),o=yield(yield Ri(t,{method:"GET",mode:"cors",cache:"no-cache"})).json(),a=(e=o==null?void 0:o.Answer[0])==null?void 0:e.data;if(!a)throw new Error("Wrong DNS response");return a}catch(t){return this.params.error$.next({id:"OneStat:ApiTransport:resolveApiBaseUrl",category:Rr.NETWORK,message:"Unhandled resolve api base url error",thrown:t}),_i.vk_alias}finally{this.isApiBaseUrlFetched=!0}})}sendBeacon(e,t,i){if(!window.Blob||!window.navigator.sendBeacon)return!1;let o=this._prepareQueryParams({method:e,queryParams:t,sessionKey:i}),a=new window.Blob([o.toString()],{type:"application/x-www-form-urlencoded"});try{return window.navigator.sendBeacon(`${this.apiBaseUrl}/fb.do`,a)}catch(u){this.params.error$.next({id:"OneStat:ApiTransport:sendBeacon",category:Rr.NETWORK,message:"Unhandled beacon error",thrown:u,data:{method:e,params:t}})}return!1}sendRequest(e,t,i){return A(this,null,function*(){let o=xi(),a=u=>{if(u instanceof TypeError&&["Failed to fetch","NetworkError when attempting to fetch resource."].includes(u.message)){this.params.error$.next({id:"Network",category:Rr.NETWORK,message:"Request failed",thrown:u});return}this.params.error$.next({id:"OneStat:ApiTransport:sendRequest",category:Rr.NETWORK,message:"Unhandled request error",thrown:u,data:{method:e,params:t,sessionKey:i,time:xi()-o}})};return this.apiBaseUrl=yield this.resolveApiBaseUrl(),Ri(`${this.apiBaseUrl}/fb.do`,{method:"post",headers:{"Content-type":"application/x-www-form-urlencoded"},body:this._prepareQueryParams({method:e,queryParams:t,sessionKey:i})}).then(u=>{var p,v;let f=Number(u.headers.get("content-length"))===0,d=new Date((p=u.headers.get("date"))!=null?p:"").getTime(),l=xi()-o;if(isFinite(d)&&((v=this.timeSynchronisation)==null||v.addServerTime(d,l)),!f)return u.json().then(s=>Object.prototype.hasOwnProperty.call(s,"error_msg")?Promise.reject(s):s,a)},a)})}_prepareQueryParams(e){let t=new URLSearchParams({format:"JSON",method:e.method,application_key:this.apiKey});return e.sessionKey!==void 0&&t.append("session_key",e.sessionKey),Object.entries(e.queryParams).forEach(([i,o])=>t.append(i,typeof o=="string"?o:JSON.stringify(o))),t}};import{ErrorCategory as Im,now as Sm,safeStorage as Ue,debounceFn as Lc}from"@vkontakte/videoplayer-shared";var xr="onestat_events",Ci=r=>e=>e.timestamp+r>=Sm(),Cr=class{constructor(e){this.unsaltedStorage=[];this.isPaused=!1;this.isUrgent=e=>{let{operation:t}=e;return["action_play","watch_coverage_record","watch_coverage_live"].includes(t)};this.params=e,this.api=e.api,this.error$=e.error$,this.userSalt=e.userSalt,this.loggerDebugLog=e.debugLogger.createComponentLog("stat logger"),this.firstFlush=Lc(()=>this.safeFlush(),this.params.config.firstFlushTime,{maxWait:this.params.config.firstFlushTime});let t=Ue.isPersistent()?this.params.config.flushMaxWait:0;this.debouncedFlush=Lc(()=>this.safeFlush(),this.params.config.flushDebounceTime,{maxWait:t}),this.subscription=this.api.authorized$.subscribe(i=>{i&&this.debouncedFlush()}),this.housekeepStorage()}safeFlush(){var e;try{this.flush()}catch(t){this.error$.next({id:"LoggerError",category:Im.WTF,message:(e=String(t))!=null?e:"Unknown logger error",thrown:t})}}readFromStorage(){let e=Ue.get(xr);try{return e?JSON.parse(e):{}}catch(t){}return{}}addToStorage(e){var a;if(!this.userSalt){this.unsaltedStorage.push(e);return}let t=this.readFromStorage(),o=((a=t[this.userSalt])!=null?a:[]).filter(Ci(this.params.config.storageExpiration));Ue.set(xr,JSON.stringify(Ve(V({},t),{[this.userSalt]:[...o,e]})))}getFromStorage(){var i;return this.userSalt?((i=this.readFromStorage()[this.userSalt])!=null?i:[]).filter(Ci(this.params.config.storageExpiration)):this.unsaltedStorage}markStorageSent(){if(!this.userSalt){this.unsaltedStorage=[];return}let e=this.readFromStorage();delete e[this.userSalt],Ue.set(xr,JSON.stringify(e))}housekeepStorage(){let e=this.readFromStorage();for(let[t,i]of Object.entries(e)){let o=i.filter(Ci(this.params.config.storageExpiration));o.length?e[t]=o:delete e[t],this.loggerDebugLog({message:`${i.length} retrieved from storage, ${o.length} of them actual`})}Ue.set(xr,JSON.stringify(e))}log(e){this.addToStorage(e),!this.isPaused&&(this.isUrgent(e)?this.flush():this.lastVsid!==e.custom.vsid?this.firstFlush():this.debouncedFlush(),this.lastVsid=e.custom.vsid)}flush(e=!1){let t=this.getFromStorage();t.length!==0&&(this.api.authorized$.getValue()?(e&&this.params.config.useBeacon?(this.loggerDebugLog({message:`Flushing ${t.length} events through beacon`}),this.api.logBeacon(t)):(this.loggerDebugLog({message:`Flushing ${t.length} events`}),this.api.logRequest(t)),this.markStorageSent()):this.api.authorize(),this.firstFlush.cancel(),this.debouncedFlush.cancel())}pause(){this.isPaused=!0,this.debouncedFlush.cancel()}resume(){this.isPaused=!1,this.debouncedFlush()}destroy(){this.subscription.unsubscribe(),this.firstFlush.cancel(),this.debouncedFlush.cancel()}};import{HttpConnectionType as Ai,Surface as ve,VideoFormat as E,VideoQuality as D}from"@vkontakte/videoplayer-core";import{assertNever as kc}from"@vkontakte/videoplayer-shared";var Dc=r=>r&&{[D.INVARIANT]:"unknown",[D.Q_144P]:"mobile",[D.Q_240P]:"lowest",[D.Q_360P]:"low",[D.Q_480P]:"medium",[D.Q_720P]:"high",[D.Q_1080P]:"fullhd",[D.Q_1440P]:"quadhd",[D.Q_2160P]:"ultrahd",[D.Q_4320P]:"unknown"}[r],Ni=r=>r&&{[Ai.HTTP1]:"http1",[Ai.HTTP2]:"http2",[Ai.QUIC]:"http3"}[r],$c=r=>{if(r!==void 0)switch(r){case E.MPEG:return"mp4";case E.DASH:case E.DASH_LIVE:case E.DASH_STREAMS:return"dash";case E.DASH_SEP:return"dash_sep";case E.DASH_ONDEMAND:return"ondemand_dash";case E.DASH_WEBM:case E.DASH_LIVE_WEBM:return"webm";case E.DASH_WEBM_AV1:return"av1";case E.DASH_LIVE_CMAF:return"ondemand_dash_live";case E.HLS:case E.HLS_LIVE:return"hls";case E.HLS_ONDEMAND:return"ondemand_hls";case E.HLS_LIVE_CMAF:return"ondemand_hls_live";case E.WEB_RTC_LIVE:return"webrtc";default:return kc(r)}},Ar=r=>{if(r!==void 0)switch(r){case ve.NONE:case ve.INLINE:return;case ve.FULLSCREEN:return"fullscreen";case ve.SECOND_SCREEN:return"chromecast";case ve.PIP:return"pip";case ve.INVISIBLE:return"invisible";default:return kc(r)}},Mc=r=>{switch(r){case"slow-2g":return"poor";case"2g":return"poor";case"3g":return"good";case"4g":return"excellent"}};var Nr=class{constructor(e){this.offset=void 0;this.offset=e}getOffset(){var e;return(e=this.offset)!=null?e:0}setOffset(e){this.offset=e}now(){var e;return Date.now()+((e=this.offset)!=null?e:0)}date(e=new Date){var t;return e.setTime(e.getTime()+((t=this.offset)!=null?t:0)),e}addServerTime(e,t){let i=Date.now(),o=e-i-t/2;if(Math.abs(o)<1e3){this.offset=0;return}this.offset===void 0?this.offset=Math.round(o):this.offset=Math.round(.2*o+(1-.2)*this.offset)}};var jc=()=>Math.floor(Math.random()*4294967296).toString(36).padStart(7,"0"),Fc=()=>Math.floor(Math.random()*18446744073709552e3).toString(36).padStart(13,"0");import{PlaybackState as Bc}from"@vkontakte/videoplayer-core";import{filter as Uc,filterChanged as Pm,fromEvent as Tm,isNullable as Vc,map as qm,merge as Li,Observable as Om,Subject as ki,Subscription as _m,ValueSubject as wm}from"@vkontakte/videoplayer-shared";var Gc=(r,e)=>new Om(t=>{let i=new _m,o=Li(Tm(window,"beforeunload"),r.events.willDestruct$),a=new wm(void 0),u;i.add(r.info.isLive$.pipe(Pm()).subscribe(U=>{u&&(u.unsubscribe(),a.next(void 0)),U?u=r.info.liveTime$.pipe(qm(kr=>kr&&kr/1e3)).subscribe(a):u=r.info.position$.subscribe(a),i.add(u)}));let{playing$:f,paused$:d}=r.events,l=r.events.willSeek$.pipe(Uc(()=>r.info.playbackState$.getValue()===Bc.PLAYING)),p=r.events.seeked$.pipe(Uc(()=>r.info.playbackState$.getValue()===Bc.PLAYING)),v=!1,s=new ki;i.add(l.subscribe(()=>{v||s.next(),v=!0})),i.add(p.subscribe(()=>v=!1));let c=new ki,h=new ki,m=Li(f,p,c),b=Li(d,s,o,r.events.looped$,h),g,S=()=>g=a.getValue(),Jc=()=>{let U=a.getValue();Vc(g)||g===U||Vc(U)||(t.next({from:g,to:U}),g=void 0)},Xc=()=>{h.next(),c.next()};if(i.add(m.subscribe(S)),i.add(b.subscribe(Jc)),e.forceInterval&&isFinite(e.forceInterval)){let U=0;i.add(m.subscribe(()=>U=window.setTimeout(Xc,e.forceInterval))),i.add(b.subscribe(()=>window.clearTimeout(U)))}return i});var Yc="_one-stat_",zc=`${Yc}uuid`,Qc=`${Yc}deviceId`,$i=()=>{let r=new Mi;return{subscription:r,subscribe:(e,t)=>{e&&r.add(e.subscribe(t))}}},ji=class{constructor(e,t){this.subscription=new Mi;this.debugLogger=new Lm;this.oneStatDebugLog=this.debugLogger.createComponentLog("onestat");this.loopCounter=0;this.disabled=!1;this.vsid$=new Di(void 0);this.isid$=new Di(void 0);this.seekAction$=new Di("unknown");var l,p,v;this.statContext=e,this.config=Qi((l=t.config)!=null?l:{}),he(t.apiEnv)&&(this.config.apiEnv=t.apiEnv),this.config.synchronizeTime&&(this.timeSynchronisation=new Nr);let i=new Nm;this.experimental={error$:i},Lr.get(zc)&&Lr.remove(zc);let a=Lr.get(Qc);this.statContext.deviceId?this.deviceId=this.statContext.deviceId:a?this.deviceId=a:(this.deviceId=Br(),Lr.set(Qc,this.deviceId)),this.resetViewSession(),t.useIsid&&this.isid$.next((p=t.isid)!=null?p:Fc());let u=new Be({apiKey:Ac,config:this.config,error$:i,timeSynchronisation:this.timeSynchronisation});this.api=new Me({config:this.config,apiTransport:u,refreshAuthToken:t.refreshAuthToken,mobile:(v=this.statContext.mobile)!=null?v:!1,deviceId:this.deviceId,error$:i}),this.logger=new Cr({config:this.config,debugLogger:this.debugLogger,api:this.api,error$:i,userSalt:t.userSalt});let{isEmbed:f,host:d}=km();this.isEmbed=f,this.embedParent=d,this.subscribe()}updateContext(e){this.statContext=V(V({},this.statContext),e)}attachTo(e){let t=new Mi,i=(s,c)=>t.add(s.subscribe(c));i(e.events.willStart$,()=>{let s=e.info.position$.getValue();this.logActionPlay({position:s}),this.statContext.projectId&&this.logActionPlayInteractive()}),i(e.events.looped$,()=>{this.resetViewSession(),++this.loopCounter>this.config.maxLoops&&(this.disabled=!0),this.logActionPlay({position:e.info.position$.getValue()})}),i(e.events.seeked$,()=>{this.logSeek({action:this.seekAction$.getValue(),time:e.info.position$.getValue()}),this.seekAction$.next("unknown")}),i(e.events.paused$,()=>{this.logPause({position:e.info.position$.getValue()})}),i(e.events.willResume$,()=>{this.logPlay()}),i(e.events.started$,()=>{this.statContext.clip&&this.logWatchCoverageRecord({start:0,end:0})}),i(e.events.playing$,()=>{this.logPlaying()}),i(Gc(e,{forceInterval:this.config.watchCoverageInterval}),s=>{let c=e.info.isLive$.getValue(),h={start:parseFloat(s.from.toFixed(3)),end:parseFloat(s.to.toFixed(3))};c?this.logWatchCoverageLive(h):this.logWatchCoverageRecord(h)});let o;i(e.info.isStalled$,s=>{s?o=B():(he(o)&&this.logEmptyBuffer({duration:B()-o}),o=void 0)});let a=!1;t.add(e.events.fatalError$.pipe(Am()).subscribe(()=>a=!0)),i(e.events.willStop$,()=>{if(e.info.isStalled$.getValue()){let c=he(o)?B()-o:void 0;this.logCloseAtEmptyBuffer({duration:c!=null?c:0}),o=void 0}else a||this.logActionStop()}),i(e.events.managedError$,({id:s})=>{this.logError({fatal:!1,errorType:s})}),i(e.events.fatalError$,({id:s})=>{this.logError({fatal:!0,errorType:s})});let u,f,d=!1;i(e.events.firstBytes$,s=>{u=B(),this.logFirstBytes({time:s})}),i(e.events.willStart$,()=>f=B()),i(e.info.currentBuffer$,s=>{!d&&s&&s.end-s.start>0&&he(u)&&(this.logPlayerReady({duration:B()-u}),d=!0)}),i(e.events.firstFrame$,()=>{he(u)&&!d&&(this.logPlayerReady({duration:B()-u}),d=!0),he(f)&&this.logFirstFrame({time:B()-f})});let l;i(e.info.currentVideoStream$,s=>{s&&(l&&s.id!==l&&this.logTrackSwitch(s),l=s.id)});let p;i(e.info.currentAudioStream$,s=>{s&&(p&&s.id!==p&&this.logTrackSwitch(s),p=s.id)}),i(e.info.atLiveEdge$,s=>this.updateContext({liveEdge:s})),i(Kc({muted:e.info.muted$,volume:e.info.volume$}),({muted:s,volume:c})=>this.updateContext({audible:!s&&c>0})),i(e.info.currentQuality$,s=>this.updateContext({quality:Dc(s)})),i(e.info.isAutoQualityEnabled$,s=>this.updateContext({autoQuality:s})),i(e.info.currentFormat$,s=>this.updateContext({contentType:$c(s)})),i(e.info.currentPlaybackRate$,s=>this.updateContext({rate:s})),i(e.info.is3DVideo$,s=>this.updateContext({is3d:s}));let v;return i(e.info.hostname$,s=>{let c=v!==void 0&&v!==s;this.updateContext({cdnHostname:s,failover:c}),c&&this.logFailover(s),v=s}),i(e.info.throughputEstimation$,s=>this.updateContext({downloadSpeed:s})),i(e.info.httpConnectionType$,s=>{this.statContext.firstConnectionType||this.updateContext({firstConnectionType:Ni(s)}),this.updateContext({connectionType:Ni(s)})}),i(e.info.httpConnectionReused$,s=>{Hc(this.statContext.firstConnectionReused)&&this.updateContext({firstConnectionReused:s}),this.updateContext({connectionReused:s})}),i(e.info.surface$,s=>this.updateContext({mode:Ar(s)})),i(Kc({current:e.info.currentTextTrack$,available:e.info.availableTextTracks$}),({current:s,available:c})=>{let h=c.find(({id:b})=>b===s),m=h&&(h.isAuto?`${h.language}_auto`:h.language);this.updateContext({subtitles:m})}),this.player=e,this.uiEvents&&this.attachToUi(this.uiEvents),this.resubscribeBeforeunload(),this.subscription.add(t),t}attachToUi(e){this.uiEvents=e;let{subscription:t,subscribe:i}=$i();return this.player&&(i(e.actionRewind$,()=>{this.player&&(this.resetViewSession(),this.logActionPlay({position:this.player.info.position$.getValue()}))}),i(e.actionSeek$,this.seekAction$),i(e.inPiP$,o=>{var u;let a=o?"pip":Ar((u=this.player)==null?void 0:u.info.surface$.getValue());this.updateContext({mode:a})}),i(e.inFullscreen$,o=>{var u;let a=o?"fullscreen":Ar((u=this.player)==null?void 0:u.info.surface$.getValue());this.updateContext({mode:a})}),i(e.actionSetSubtitle$,o=>this.updateContext({subtitles:o})),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(t)),t}attachToAds(e){let{subscription:t,subscribe:i}=$i();return i(e.slotRequested$,()=>this.logAdSlotRequest()),i(e.started$,o=>this.logAdStarted(o)),i(e.paused$,()=>this.logAdPaused()),i(e.resumed$,()=>this.logAdResumed()),i(e.ended$,()=>this.logAdEnded()),i(e.skipped$,()=>this.logAdSkipped()),i(e.clicked$,()=>this.logAdClicked()),this.resubscribeBeforeunload(),this.subscription.add(t),t}attachToInteractive(e){let{subscription:t,subscribe:i}=$i();return i(e.click$,o=>this.logInterfaceClick(o)),i(e.nextMovie$,o=>this.logNextMovie(o)),this.resubscribeBeforeunload(),this.subscription.add(t),t}authorize(e){return this.api.authorize(e)}pause(){this.logger.pause(),this.oneStatDebugLog({message:"paused"})}resume(){this.logger.resume(),this.oneStatDebugLog({message:"resumed"})}destroy(){this.logger.flush(),this.subscription.unsubscribe(),this.api.destroy(),this.logger.destroy()}resetViewSession(){this.oneStatDebugLog({message:"VSID reset"}),this.vsid$.next(jc())}getDeviceId(){return this.deviceId}setFieldBlacklist(){}logInited(){}logReady(e){this.log({operation:"player_ready",param:String(e.time)})}logStarted(...e){this.logActionPlay(...e)}logPlay(){this.log({operation:"play_toggle"})}logPlaying(){this.log({operation:"playing"})}logPause(e){this.log({operation:"pause",param:String(Math.round(e.position))})}logSeek(e){this.log({operation:"seek",param:e.action,time:e.time})}logFirstBytes(e){this.log({operation:"first_bytes",param:String(e.time)})}logFirstFrame(e){this.log({operation:"first_frame",param:String(e.time)})}logError(e){this.log({operation:"content_error",param:`${e.fatal?"fatal":"recoverable"}_${e.errorType}`})}logWatchCoverageRecord(e){this.log({operation:"watch_coverage_record",param:`${e.start}-${e.end}`},{in_history:this.statContext.inHistory?1:void 0})}logWatchCoverageLive(e){var a,u;let t=(u=(a=this.timeSynchronisation)==null?void 0:a.getOffset())!=null?u:0,i=e.start+t,o=e.end+t;this.log({operation:"watch_coverage_live",param:`${i}-${o}`},{in_history:this.statContext.inHistory?1:void 0})}logEmptyBuffer(e){this.log({operation:"empty_buffer",param:String(e.duration)})}logDownloadSpeed(){}logAdSlotRequest(){this.log({operation:"adv",param:"slot_request"})}logAdStarted(e){this.log({operation:"adv",param:e})}logAdPaused(){this.log({operation:"adv",param:"pause"})}logAdResumed(){this.log({operation:"adv",param:"resume"})}logAdEnded(){this.log({operation:"adv",param:"ended"})}logAdSkipped(){this.log({operation:"adv",param:"skip"})}logAdClicked(){this.log({operation:"adv",param:"click"})}logInterfaceClick(e){this.log({operation:"player_interface_click",param:e})}logNextMovie(e){this.log({operation:"next_movie",param:String(e)})}subscribe(){this.resubscribeBeforeunload();let e=window.navigator.connection;e&&"onchange"in e&&"effectiveType"in e&&this.subscription.add(xm(Wc(e,"change"),Cm(["init"])).subscribe(()=>this.updateContext({network:Mc(e.effectiveType)}))),this.config.debugLog&&this.debugLogger.log$.subscribe(t=>{console.debug("%c stat ","background:#fa6470;",`component: ${t.component}.`,t.message)})}resubscribeBeforeunload(){var e;(e=this.beforeunloadSubscription)==null||e.unsubscribe(),this.beforeunloadSubscription=Wc(window,"beforeunload").subscribe(()=>this.logger.flush(!0)),this.subscription.add(this.beforeunloadSubscription)}logPlayerReady(e){this.log({operation:"player_ready",param:String(Math.round(e.duration))})}logActionPlay(e){this.log({operation:"action_play",param:String(Math.round(e.position))})}logActionPlayInteractive(){this.statContext.projectId&&this.log({operation:"action_play_interactive",param:String(this.statContext.movieId)},{vid:this.statContext.projectId})}logFailover(e){this.log({operation:"failover",param:e})}logCloseAtEmptyBuffer(e){this.log({operation:"close_at_empty_buffer",param:String(Math.round(e.duration))})}logActionStop(){this.log({operation:"action_stop"})}logTrackSwitch(e){this.log({operation:"track_switch",param:e.id})}log(e,t={}){if(this.disabled){this.oneStatDebugLog({message:`operation ${e.operation} but statistics is disabled`});return}if(this.config.disabledOperations.includes(e.operation)){this.oneStatDebugLog({message:`operation ${e.operation} but it is disabled`});return}this.oneStatDebugLog({message:`operation ${e.operation} ${e.param}`});let i=this.createLogItem(e,t);this.logger.log(i)}createLogItem({operation:e,param:t,time:i},o={}){var c,h;let a=(h=(c=this.timeSynchronisation)==null?void 0:c.now())!=null?h:B(),u=this.vsid$.getValue();Rm(u);let f=this.isid$.getValue(),d=e==="empty_buffer"||e==="close_at_empty_buffer"?this.statContext.connectionType:this.statContext.firstConnectionType,l=this.statContext.firstConnectionReused,p,v;if(this.isEmbed){p=this.embedParent;let m=[...new URLSearchParams(location.search).entries()].filter(([b,g])=>this.config.embedUrlParams.includes(b));v=new URLSearchParams(m).toString()}else this.statContext.place==="direct"&&((this.statContext.refDomain||document.referrer)&&(p=new URL(this.statContext.refDomain||document.referrer).hostname),v=location.href.substring(0,1024));let s=V({vsid:u,isid:f,vid:this.statContext.movieId,ct:this.statContext.contentType,place:this.isEmbed?"embed":this.statContext.place,quality:this.statContext.quality,cdn_host:this.statContext.cdnHostname,stat_type:this.statContext.autoplay===!0?"auto":this.statContext.autoplay===!1?"":void 0,param:t,vk_app_id:this.statContext.vkAppId,track_code:this.statContext.trackCode,connection_type:d,connection_reused:l===!0?1:l===!1?0:void 0,cached_data:this.statContext.cached===!0?1:this.statContext.cached===!1?0:void 0,live:this.statContext.liveEdge?1:void 0,muted:this.statContext.audible===!1?1:void 0,mode:this.statContext.mode,subtitles:this.statContext.subtitles,download_speed:this.statContext.downloadSpeed,manual_quality:this.statContext.autoQuality?void 0:1,ref_domain:p,direct_url:v,rate:this.statContext.rate===1||Hc(this.statContext.rate)?void 0:this.statContext.rate.toFixed(2),view_360:this.statContext.is3d?1:void 0,aid:this.statContext.albumId,vk_playlist_id:this.statContext.vkPlaylistId},o);for(let m of this.config.disabledCustomFields)delete s[m];return{operation:e,type:1,time:i,network:this.statContext.network,timestamp:a,custom:s}}};export{ge as ApiEnv,jr as ConnectionType,Mr as ContentType,Gi as InteractiveInterfaceClick,ji as OneStat,$r as Quality,Fr as SeekAction,qr as VERSION};