@vkontakte/videoplayer-shared 1.0.92-dev.53fc4c12e.0 → 1.0.92-dev.82d0b1d07.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.92-dev.53fc4c12e.0
3
- * Mon, 08 Jun 2026 14:14:39 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.92-dev.82d0b1d07.0
3
+ * Thu, 11 Jun 2026 11:32:51 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-92/doc/
5
5
  */
6
- var e=require(`@oxc-project/runtime/helpers/defineProperty`),t=require(`@oxc-project/runtime/helpers/objectSpread2`),n=require(`@oxc-project/runtime/helpers/asyncToGenerator`);let r;var i=Object.defineProperty,a=Object.getOwnPropertyNames,o=Object.getOwnPropertyDescriptor,s=Object.prototype.hasOwnProperty;function c(e){return this[e]}var l=e=>{var t=(u??=new WeakMap).get(e),n;if(t)return t;if(t=i({},`__esModule`,{value:!0}),e&&typeof e==`object`||typeof e==`function`)for(var r of a(e))s.call(t,r)||i(t,r,{get:c.bind(e,r),enumerable:!(n=o(e,r))||n.enumerable});return u.set(e,t),t},u,d=e=>e;function f(e,t){this[e]=d.bind(null,t)}var p=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0,configurable:!0,set:f.bind(t,n)})},m={};p(m,{withoutNullable:()=>re,videoSizeToQuality:()=>Ce,videoQualityToHeight:()=>we,videoHeightToQuality:()=>Se,urlCanParsePolyfilled:()=>qn,timeout:()=>Ne,timeCodeToString:()=>Oe,throttleFn:()=>B,throttle:()=>Ge,tap:()=>ot,suppressAbort:()=>xt,stringTrimStart:()=>Fn,stringTrimRight:()=>Rn,stringTrimLeft:()=>Ln,stringTrimEnd:()=>In,stringReplaceAll:()=>Pn,stringPadStart:()=>Nn,stringPadEnd:()=>Mn,stringMatchAll:()=>jn,stringAt:()=>An,skip:()=>ct,shareReplay:()=>ut,safeStorage:()=>de,requestIdleCallbackPolyfilled:()=>Wn,promiseWithResolvers:()=>vn,promiseTry:()=>_n,promiseFinally:()=>gn,promiseAny:()=>hn,promiseAllSettled:()=>mn,pairwise:()=>it,once:()=>rt,observeElementSize:()=>ft,observableFrom:()=>Ie,objectValues:()=>pn,objectHasOwn:()=>fn,objectFromEntries:()=>un,objectEntries:()=>ln,nowInt:()=>ce,now:()=>se,noop:()=>v,merge:()=>Me,mapTo:()=>nt,map:()=>et,loadVKLangPack:()=>Ft,isValidURL:()=>mt,isNullable:()=>T,isNonNullable:()=>w,isLowerOrEqual:()=>be,isLower:()=>F,isInvariantQuality:()=>L,isIntersecting:()=>ht,isHigherOrEqual:()=>ye,isHigher:()=>ve,isBrowserWindow:()=>D,isAbortError:()=>bt,interval:()=>Pe,interpolate:()=>vt,includesPolyfilled:()=>Kn,globalThisPolyfill:()=>cn,getWindow:()=>E,getVideoQualityLabel:()=>De,getTraceSubscriptionMethod:()=>wt,getRangeAroundIndex:()=>yt,getPlayerId:()=>_t,getMessageFromError:()=>St,getHighestQuality:()=>xe,getExponentialDelay:()=>ue,fromEvent:()=>Le,flattenObject:()=>U,filterChanged:()=>Ze,filter:()=>qe,fillWithDefault:()=>R,fetchPolyfilled:()=>En,devNull:()=>Bt,detectEmbed:()=>M,debounceFn:()=>z,debounce:()=>He,createDIContainer:()=>Xt,combine:()=>je,cloneDeepWith:()=>V,cloneDeep:()=>ke,clearVideoElement:()=>pt,checkNever:()=>ee,cancelIdleCallbackPolyfilled:()=>Gn,buffer:()=>ze,atPolyfilled:()=>zn,assertQualityIsExact:()=>Ee,assertNullable:()=>ne,assertNotEmptyArray:()=>ie,assertNonNullable:()=>C,assertNever:()=>_,assertEmptyArray:()=>ae,arrayWith:()=>sn,arrayToSpliced:()=>on,arrayToSorted:()=>an,arrayToReversed:()=>rn,arrayIncludes:()=>nn,arrayFlatMap:()=>tn,arrayFlat:()=>en,arrayFindLastIndex:()=>$t,arrayFindLast:()=>Qt,arrayAt:()=>Zt,areQualitiesExact:()=>Te,addScript:()=>oe,abortable:()=>le,VideoQuality:()=>N,ValueSubject:()=>Ae,VKNumericLanguage:()=>Nt,VERSION:()=>h,TracerFactory:()=>jt,SubscriptionRemovable:()=>Re,Subscription:()=>g,Subject:()=>S,RequestPolyfilled:()=>Dn,ReplaySubject:()=>H,Observable:()=>x,Logger:()=>te,InternalsExposure:()=>zt,InterfaceLanguage:()=>Rt,InjectionToken:()=>Yt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>K,ErrorCategory:()=>Mt,CircularBuffer:()=>Ct,AppTracer:()=>J,AbortSignalPolyfilled:()=>kn,AbortControllerPolyfilled:()=>On}),module.exports=l(m);var h=`1.0.92-dev.53fc4c12e.0`;class g{constructor(){e(this,`subscriptions`,[])}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var _=e=>{throw Error(`${e} is value of unexpected type`)},ee=e=>{},v=()=>{},y=e=>{throw console.error(e),e},b=e=>{console.error(e)};class x{constructor(t){e(this,`suppressErrors`,!1),t&&(this._subscribe=t)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?b:y,r;r=t?typeof t==`function`?{next:t,error:v}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:v};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.call(i,e)}return new g().add(()=>{switch(i.next=v,i.error=v,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return _(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class S extends x{constructor(){super(),e(this,`keyCounter`,0),e(this,`subscribers`,new Map)}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.call(t,e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new g().add(()=>this.subscribers.delete(t))}}class te{constructor(){e(this,`log$`,new S),e(this,`logs`,[]),e(this,`log`,e=>{let n=t(t({},e),{},{timestamp:Date.now()});this.logs.push(n),this.log$.next(n)}),e(this,`getAllLogs`,()=>this.logs)}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(n=>t({component:e},n))}}function C(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function ne(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function w(e){return e!=null}function T(e){return e==null}var re=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>w(t)));function ie(e,t){if(!e?.length)throw Error(t)}function ae(e,t){if(e?.length)throw Error(t)}var E=()=>globalThis,D=(e=E())=>!!(e.window&&e.screen),oe=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=E().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),se=typeof E().performance?.now==`function`?()=>E().performance.now():()=>Date.now(),ce=()=>Math.trunc(se()),le=(e,t)=>n(function*(...n){let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=yield r.next(a);i=e.done??!1,a=e.value}catch(e){yield r.throw(e)}return a}),ue=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**+e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},de={};p(de,{set:()=>me,remove:()=>ge,isPersistent:()=>fe,has:()=>he,get:()=>pe,clear:()=>_e});var O,k,A=`vk-videoplayer-dummy-key-${Math.random()}`,j=()=>{if(k!==void 0)return k;try{localStorage.setItem(A,`test`),localStorage.removeItem(A),k=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),k=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)k=2;else throw e}else throw e}return k===2&&(O=new Map),k},fe=()=>j()===0,pe=e=>{let t=j();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return O?.get(e);default:_(t)}},me=(e,t)=>{let n=j();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:O?.set(e,t);return;default:_(n)}},he=e=>{let t=j();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return O?.has(e)??!1;default:return _(t),!1}},ge=e=>{let t=j();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:O?.delete(e);return;default:_(t)}},_e=()=>{let e=j();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:_(e)}},M=()=>{let e,t=[],n=E();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},N;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(N||={});var P={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},ve=(e,t)=>P[e].height>P[t].height,ye=(e,t)=>P[e].height>=P[t].height,F=(e,t)=>P[e].height<P[t].height,be=(e,t)=>P[e].height<=P[t].height,xe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:F(e,t)?1:-1)[0],I=Object.keys(P).sort((e,t)=>F(e,t)?-1:1),Se=(e,t=.02)=>[...I].find(n=>P[n].height*(1+t)>=e),Ce=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return I.find(e=>{let t=P[e];return t.width>=r&&t.height>=n})},we=e=>P[e].height,L=e=>e===`Invariant quality`,Te=e=>e.every(e=>!L(e));function Ee(e){if(L(e))throw Error(`Expected exact quality`)}var De=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},R=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=R(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Oe=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function z(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof E().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&E().cancelAnimationFrame(s),E().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){E().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(y,t),u?m(e):o}function ee(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function v(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function y(){let e=Date.now();if(v(e))return b(e);s=h(y,ee(e))}function b(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function x(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function S(){return s===void 0?o:b(Date.now())}function te(){return s!==void 0}function C(...e){let n=Date.now(),a=v(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(y,t),m(c)}return s===void 0&&(s=h(y,t)),o}return C.cancel=x,C.flush=S,C.pending=te,C}var B=(e,n=0,r)=>z(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),V=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=V(e[r],t):n[r]=e[r]}return n},ke=e=>V(e);class H extends S{constructor(t){super(),e(this,`bufferSize`,void 0),e(this,`buffer`,[]),e(this,`cursorEnd`,-1),e(this,`cursorStart`,0),this.bufferSize=t,this.buffer=Array(t)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new g().add(()=>this.subscribers.delete(t))}}class Ae extends S{constructor(t){super(),e(this,`value`,void 0),this.value=t}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function je(e){return new x(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new g)})}function Me(...e){return new x(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new g))}var Ne=e=>new x(t=>{let n=E().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>E().clearTimeout(n)}),Pe=e=>new x(t=>{let n=E(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Fe(e){return new x(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ie=Fe,Le=(e,t)=>new x(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Re extends g{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function ze(e){return t=>new x(n=>t.subscribe(new Be(n,e)))}class Be{constructor(t,n){e(this,`destination`,void 0),e(this,`size`,void 0),e(this,`lastValues`,[]),this.destination=t,this.size=n}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Ve={leading:!1,trailing:!0};function He(e,t=Ve){return n=>new x(r=>n.subscribe(new Ue(r,e,t)))}class Ue{constructor(t,n,r){e(this,`destination`,void 0),e(this,`time`,void 0),e(this,`config`,void 0),e(this,`lastValue`,void 0),e(this,`timeout`,void 0),this.destination=t,this.time=n,this.config=r}next(e){this.lastValue=e;let t=E();w(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){var t;(t=this.destination).error?.call(t,e)}}var We={leading:!0,trailing:!1};function Ge(e,t=We){return n=>new x(r=>n.subscribe(new Ke(r,e,t)))}class Ke{constructor(t,n,r){e(this,`destination`,void 0),e(this,`time`,void 0),e(this,`config`,void 0),e(this,`lastValue`,void 0),e(this,`timeout`,void 0),this.destination=t,this.time=n,this.config=r}next(e){this.lastValue=e,T(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=E().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t;(t=this.destination).error?.call(t,e)}}function qe(e){return t=>new x(n=>t.subscribe(new Je(n,e)))}class Je{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),this.destination=t,this.predicate=n}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Ye=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Xe=(e,t)=>e instanceof Object&&t instanceof Object?Ye(e,t):e===t;function Ze(e=Xe){return t=>new x(n=>t.subscribe(new $e(n,e)))}var Qe={};class $e{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,Qe),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===Qe||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?t({},e):e}catch(e){throw this.error(e),e}n&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function et(e){return t=>new x(n=>t.subscribe(new tt(n,e)))}class tt{constructor(t,n){e(this,`destination`,void 0),e(this,`mapper`,void 0),this.destination=t,this.mapper=n}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){var t;(t=this.destination).error?.call(t,e)}}function nt(e){return et(()=>e)}function rt(){return e=>new x(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.call(t,e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function it(){return e=>new x(t=>e.subscribe(new at(t)))}class at{constructor(t){e(this,`destination`,void 0),e(this,`last`,void 0),e(this,`hasLast`,!1),this.destination=t}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t;(t=this.destination).error?.call(t,e)}}function ot(e){return t=>new x(n=>t.subscribe(new st(n,e)))}class st{constructor(t,n){e(this,`destination`,void 0),e(this,`effect`,void 0),this.destination=t,this.effect=n}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function ct(e){return t=>new x(n=>t.subscribe(new lt(n,e)))}class lt{constructor(t,n){if(e(this,`destination`,void 0),e(this,`count`,void 0),this.destination=t,this.count=n,n<0){var r;(r=this.destination).error?.call(r,Error(`Count can not be less than zero`))}}next(e){this.count===0?this.destination.next(e):this.count--}error(e){var t;(t=this.destination).error?.call(t,e)}}function ut(e=0){return t=>{let n=0,r=new H(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new x(e=>(n++,a(r.subscribe(e))))}}var dt=300,ft=(e,t=dt)=>new x(n=>{let r=E(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!D(r))return;let o=new r.ResizeObserver(B(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),w(r)&&w(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),U=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=U(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},pt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},mt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ht=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),gt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),_t=e=>e!==void 0&&e!==``?e:gt().toString();function vt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function yt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var bt=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),xt=e=>{if(!bt(e))throw e};function St(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}r=Symbol.iterator;class Ct{constructor(t){if(e(this,`buffer`,void 0),e(this,`writeIndex`,0),e(this,`count`,0),e(this,`capacity`,void 0),t<=0)throw Error(`Capacity must be greater than 0`);this.capacity=t,this.buffer=Array.from({length:t}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[r](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];w(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var wt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?U(n):{value:n})},Tt=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class W{constructor({name:t,getParentContext:n,getRootTracerContext:r,eventsBufferSize:i}){e(this,`dynamicImportTimeout`,5e3),e(this,`subscription`,new g),e(this,`span`,void 0),e(this,`context`,void 0),e(this,`childTracers`,[]),e(this,`initPromise`,void 0),e(this,`getRootTracerContext`,void 0),e(this,`eventsBuffer`,null),w(i)&&i>0&&(this.eventsBuffer=new Ct(i)),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let a=Date.now();this.initPromise=W.dynamicImportPromise.then(e=>{W.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n,getRootTracerContext:r},a)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(T(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{w(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return n(function*(){if(W.dynamicImportStatus===`not_started`){W.dynamicImportStatus=`in_progress`;try{let t=new Promise((t,n)=>setTimeout(n,e.dynamicImportTimeout)),n=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[r,i,a,o,s]=yield Promise.race([n,t]);W.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return T(this.span)||W.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){w(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,n,r,i){this.span.addEvent(e,t(t({},Tt(n)),{},{type:r}),i)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.call(this),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(w(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}e(W,`dynamicImportStatus`,`not_started`),e(W,`dynamicImports`,void 0),e(W,`dynamicImportPromise`,void 0);var Et=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class Dt extends W{constructor(t){super({name:`Root`,eventsBufferSize:t}),e(this,`attributes$`,new Ae(null))}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=W.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:Et}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(Tt(e))}addSubscription(e){this.subscription.add(e)}}class Ot{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new Ot({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var kt=()=>!0,G={level:0,filter:kt,name:`Noname Tracer`,outputMethod:`log`};class At{constructor({name:t,level:n,filter:r,outputMethod:i}={}){e(this,`name`,void 0),e(this,`filter`,kt),e(this,`level`,G.level),e(this,`outputMethod`,G.outputMethod),e(this,`childTracers`,[]),this.filter=r??this.filter,this.level=n??this.level,this.outputMethod=i??this.outputMethod,this.name=t??G.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new At({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||E().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&E().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class jt{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new Dt(t);case`debug`:return new At;default:return new Ot}}}var Mt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Mt||={});var Nt;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(Nt||={});var Pt=`vk.com`,Ft=function(){var e=n(function*(e,t,n){let r=new URL(`https://${Pt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),It(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),It=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Lt(n)])),Lt=e=>Array.isArray(e)?e[0]:e,Rt;(e=>{e.RU=`ru`,e.EN=`en`})(Rt||={});var K=`__vk_vp_internals_exposure`;class zt{constructor(t,n){e(this,`playerId`,void 0),e(this,`type`,void 0),this.playerId=n,this.type=t,this.initWindowObjects()}getWindowObject(){var e;if(typeof window>`u`)return{};let t=this.playerId,n=this.type;return((e=window[K])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]||(window[K]={}),window[K][e]||(window[K][e]={}),window[K][e][t]||(window[K][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]&&window[K][e]&&window[K][e][t]&&(delete window[K][e][t],Object.keys(window[K][e]).length||delete window[K][e],Object.keys(window[K]).length||delete window[K])}}var Bt={};p(Bt,{subscribe:()=>Wt,push:()=>Ut,destroy:()=>Ht,create:()=>Vt});var q=new Map,Vt=(e,t)=>q.set(e,t??[]),Ht=e=>q.delete(e),Ut=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Wt=(e,t)=>{let n=q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);q.set(e,t)}},Gt=e=>re({id:e.id,message:e.message,category:e.category,data:Kt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Kt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var qt=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Jt=()=>{try{var e;let{origin:n,pathname:r,search:i,hostname:a}=((e=E())==null||(e=e.document)==null?void 0:e.location)??{};return!a||a===`localhost`?void 0:t({url:n+r},new URLSearchParams(i).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class J{constructor(n,r,i,a){e(this,`dynamicImportTimeout`,5e3),e(this,`componentName`,void 0),e(this,`subscription`,new g),e(this,`options`,void 0),e(this,`envParams`,void 0),e(this,`context`,void 0),e(this,`isEmbed`,void 0),e(this,`embedParent`,void 0),e(this,`beforeInitErrors`,[]),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=M();this.isEmbed=o,this.embedParent=s?new URL(s).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,n){let r=J.tracerErrorMap.get(this.componentName);if(!r){this.beforeInitErrors.push([e,n]);return}let{blackErrorCategoryList:i,blackErrorIdList:a,sampleRate:o,whiteErrorCategoryList:s,whiteErrorIdList:c}=this.options,{id:l,category:u}=e;if(!(i.length&&i.includes(u)||a.length&&a.includes(l)||s.length&&!s.includes(u)||c.length&&!c.includes(l)||Math.random()>=o))try{let i=qt(e);r?.error(i,{crashIdSource:i.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),Gt(e)),Jt()),this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent})})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return n(function*(){try{if(yield J.loadPromise,J.tracerErrorMap.has(e.componentName)||T(J.appTracerModule))return;let{appTracerModule:t}=J,{initTracerError:n,initTracerErrorUploader:r,getTracerModules:i}=t,a=i(e.componentName),o=!a.error,s=a.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});w(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:Et,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),J.tracerErrorMap.set(e.componentName,s),e.beforeInitErrors.forEach(t=>e.error.apply(e,t)),e.beforeInitErrors=[]}catch(e){console.error(e)}})()}loadModule(){var e=this;w(J.loadPromise)||(J.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>E().setTimeout(n,e.dynamicImportTimeout));J.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch(e){J.loadPromise=null,console.error(e)}});return function(){return t.apply(this,arguments)}}()())}}e(J,`tracerErrorMap`,new Map),e(J,`appTracerModule`,null),e(J,`loadPromise`,null);class Yt{constructor(t,n){e(this,`options`,void 0),e(this,`symbol`,void 0),this.options=n,this.symbol=Symbol(t)}}var Xt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},Zt=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},Qt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},$t=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},en=(e,t=1)=>{let n=[],r=(e,t)=>{for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i];t>0&&Array.isArray(a)?r(a,t-1):n.push(a)}};return r(e,t),n},tn=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r,e);if(Array.isArray(i))for(let e=0;e<i.length;e++)n.push(i[e]);else n.push(i)}return n},nn=(e,t,n=0)=>{let r=e.length,i=n>=0?n:Math.max(r+n,0);for(;i<r;i++){let n=e[i];if(n===t||n!==n&&t!==t)return!0}return!1},rn=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},an=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},on=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},sn=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},cn=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),ln=e=>{let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++){let i=n[r];t.push([i,e[i]])}return t},un=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},dn=Object.prototype.hasOwnProperty,fn=(e,t)=>dn.call(e,t),pn=e=>{let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},mn=e=>{let t=Array.from(e);return t.length===0?Promise.resolve([]):Promise.all(t.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))},hn=e=>{let t=Array.from(e);return t.length===0?Promise.reject(AggregateError([],`All promises were rejected`)):new Promise((e,n)=>{let r=Array(t.length),i=t.length;t.forEach((t,a)=>{Promise.resolve(t).then(e,e=>{r[a]=e,--i,i===0&&n(AggregateError(r,`All promises were rejected`))})})})},gn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),_n=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},vn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:yn,NativeAbortController:bn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function xn(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function Sn(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class Cn{constructor(){Object.defineProperty(this,`listeners`,{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class Y extends Cn{constructor(){super(),this.listeners||Cn.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new X;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new X;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class X{constructor(){Object.defineProperty(this,`signal`,{value:new Y,writable:!0,configurable:!0})}abort(e){let t=Sn(e),n=xn(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(X.prototype[Symbol.toStringTag]=`AbortController`,Y.prototype[Symbol.toStringTag]=`AbortSignal`);function Z(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log(`__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill`),!0):typeof e.Request==`function`&&!e.Request.prototype.hasOwnProperty(`signal`)||!e.AbortController}function wn(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Z({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&Z({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Tn=$?wn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,En=$?Tn.fetch:Q.fetch,Dn=$?Tn.Request:Q.Request,On=$?X:Q.AbortController,kn=$?Y:Q.AbortSignal,An=(e,t)=>{let n=e.length,r=t>=0?t:n+t;if(r<0||r>=n)return;let i=e.charCodeAt(r);if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343)return e[r]+e[r+1]}return e[r]};function*jn(e,t){let n=t.flags.includes(`g`)?t.flags:t.flags+`g`,r=new RegExp(t.source,n),i;for(;(i=r.exec(e))!==null;)yield i,i[0].length===0&&r.lastIndex++}var Mn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return e+n.repeat(Math.ceil(r/n.length)).slice(0,r)},Nn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return n.repeat(Math.ceil(r/n.length)).slice(0,r)+e},Pn=(e,t,n)=>{if(typeof t==`string`){if(typeof n==`string`)return t===``?n+e.split(``).join(n)+n:e.split(t).join(n);let r=[],i=0,a=e.indexOf(t,i);for(;a!==-1;)r.push(e.slice(i,a)),r.push(n(t,a,e)),i=a+t.length,a=e.indexOf(t,i);return r.push(e.slice(i)),r.join(``)}let r=t.flags.includes(`g`)?t.flags:t.flags+`g`,i=new RegExp(t.source,r);return e.replace(i,n)},Fn=e=>e.replace(/^\s+/,``),In=e=>e.replace(/\s+$/,``),Ln=Fn,Rn=In,zn=(e,t)=>typeof e==`string`?An(e,t):Zt(e,t),Bn=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Q.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},Vn=e=>Q.clearTimeout(e),Hn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Un=!Hn(Q.requestIdleCallback)||!Hn(Q.cancelIdleCallback),Wn=Un?Bn:Q.requestIdleCallback,Gn=Un?Vn:Q.cancelIdleCallback,Kn=(e,t,n)=>typeof e==`string`?e.includes(t,n):nn(e,t,n),qn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
6
+ function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}var t=e;function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol._oxc_toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@_oxc_toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var t=e,r=n;function i(e){var n=r(e,`string`);return t(n)==`symbol`?n:n+``}var a=i;function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=o;function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){u(a,r,i,o,s,`next`,e)}function s(e){u(a,r,i,o,s,`throw`,e)}o(void 0)})}}var f=l,p=d,m=Object.defineProperty,h=Object.getOwnPropertyNames,ee=Object.getOwnPropertyDescriptor,te=Object.prototype.hasOwnProperty;function g(e){return this[e]}var _=e=>{var t=(v??=new WeakMap).get(e),n;if(t)return t;if(t=m({},`__esModule`,{value:!0}),e&&typeof e==`object`||typeof e==`function`)for(var r of h(e))te.call(t,r)||m(t,r,{get:g.bind(e,r),enumerable:!(n=ee(e,r))||n.enumerable});return v.set(e,t),t},v,y=e=>e;function ne(e,t){this[e]=y.bind(null,t)}var b=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0,configurable:!0,set:ne.bind(t,n)})},x={};b(x,{withoutNullable:()=>le,videoSizeToQuality:()=>Ne,videoQualityToHeight:()=>Pe,videoHeightToQuality:()=>Me,urlCanParsePolyfilled:()=>nr,timeout:()=>Ge,timeCodeToString:()=>ze,throttleFn:()=>Ve,throttle:()=>rt,tap:()=>gt,suppressAbort:()=>jt,stringTrimStart:()=>Wn,stringTrimRight:()=>qn,stringTrimLeft:()=>Kn,stringTrimEnd:()=>Gn,stringReplaceAll:()=>Un,stringPadStart:()=>Hn,stringPadEnd:()=>Vn,stringMatchAll:()=>Bn,stringAt:()=>zn,skip:()=>vt,shareReplay:()=>bt,safeStorage:()=>ve,requestIdleCallbackPolyfilled:()=>$n,promiseWithResolvers:()=>En,promiseTry:()=>Tn,promiseFinally:()=>wn,promiseAny:()=>Cn,promiseAllSettled:()=>Sn,pairwise:()=>mt,once:()=>pt,observeElementSize:()=>St,observableFrom:()=>Je,objectValues:()=>xn,objectHasOwn:()=>bn,objectFromEntries:()=>vn,objectEntries:()=>_n,nowInt:()=>he,now:()=>me,noop:()=>T,merge:()=>We,mapTo:()=>ft,map:()=>H,loadVKLangPack:()=>Ut,isValidURL:()=>wt,isNullable:()=>k,isNonNullable:()=>O,isLowerOrEqual:()=>ke,isLower:()=>I,isInvariantQuality:()=>L,isIntersecting:()=>Tt,isHigherOrEqual:()=>Oe,isHigher:()=>De,isBrowserWindow:()=>fe,isAbortError:()=>At,interval:()=>Ke,interpolate:()=>Ot,includesPolyfilled:()=>tr,globalThisPolyfill:()=>gn,getWindow:()=>A,getVideoQualityLabel:()=>Le,getTraceSubscriptionMethod:()=>Nt,getRangeAroundIndex:()=>kt,getPlayerId:()=>Dt,getMessageFromError:()=>Mt,getHighestQuality:()=>Ae,getExponentialDelay:()=>_e,fromEvent:()=>Ye,flattenObject:()=>U,filterChanged:()=>lt,filter:()=>at,fillWithDefault:()=>Re,fetchPolyfilled:()=>Fn,devNull:()=>Jt,detectEmbed:()=>Te,debounceFn:()=>Be,debounce:()=>et,createDIContainer:()=>an,combine:()=>Ue,cloneDeepWith:()=>R,cloneDeep:()=>He,clearVideoElement:()=>Ct,checkNever:()=>re,cancelIdleCallbackPolyfilled:()=>er,buffer:()=>Ze,atPolyfilled:()=>Jn,assertQualityIsExact:()=>Ie,assertNullable:()=>ce,assertNotEmptyArray:()=>ue,assertNonNullable:()=>se,assertNever:()=>w,assertEmptyArray:()=>de,arrayWith:()=>hn,arrayToSpliced:()=>mn,arrayToSorted:()=>pn,arrayToReversed:()=>fn,arrayIncludes:()=>dn,arrayFlatMap:()=>un,arrayFlat:()=>ln,arrayFindLastIndex:()=>cn,arrayFindLast:()=>sn,arrayAt:()=>on,areQualitiesExact:()=>Fe,addScript:()=>pe,abortable:()=>ge,VideoQuality:()=>Ee,ValueSubject:()=>B,VKNumericLanguage:()=>Vt,VERSION:()=>S,TracerFactory:()=>zt,SubscriptionRemovable:()=>Xe,Subscription:()=>C,Subject:()=>D,RequestPolyfilled:()=>In,ReplaySubject:()=>z,Observable:()=>E,Logger:()=>oe,InternalsExposure:()=>qt,InterfaceLanguage:()=>Kt,InjectionToken:()=>rn,INTERNAL_EXPOSE_GLOBAL_KEY:()=>q,ErrorCategory:()=>Bt,AppTracer:()=>Y,AbortSignalPolyfilled:()=>Rn,AbortControllerPolyfilled:()=>Ln}),module.exports=_(x);var S=`1.0.92-dev.82d0b1d07.0`;class C{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var w=e=>{throw Error(`${e} is value of unexpected type`)},re=e=>{},T=()=>{},ie=e=>{throw console.error(e),e},ae=e=>{console.error(e)};class E{constructor(e){this.suppressErrors=!1,e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?ae:ie,r;r=t?typeof t==`function`?{next:t,error:T}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:T};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.call(i,e)}return new C().add(()=>{switch(i.next=T,i.error=T,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return w(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class D extends E{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.call(t,e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new C().add(()=>this.subscribers.delete(t))}}class oe{constructor(){this.log$=new D,this.logs=[],this.log=e=>{let t=f(f({},e),{},{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>f({component:e},t))}}function se(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function ce(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function O(e){return e!=null}function k(e){return e==null}var le=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>O(t)));function ue(e,t){if(!e?.length)throw Error(t)}function de(e,t){if(e?.length)throw Error(t)}var A=()=>globalThis,fe=(e=A())=>!!(e.window&&e.screen),pe=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=A().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),me=typeof A().performance?.now==`function`?()=>A().performance.now():()=>Date.now(),he=()=>Math.trunc(me()),ge=(e,t)=>p(function*(...n){let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=yield r.next(a);i=e.done??!1,a=e.value}catch(e){yield r.throw(e)}return a}),_e=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**+e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},ve={};b(ve,{set:()=>xe,remove:()=>Ce,isPersistent:()=>ye,has:()=>Se,get:()=>be,clear:()=>we});var j,M,N=`vk-videoplayer-dummy-key-${Math.random()}`,P=()=>{if(M!==void 0)return M;try{localStorage.setItem(N,`test`),localStorage.removeItem(N),M=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(N),M=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)M=2;else throw e}else throw e}return M===2&&(j=new Map),M},ye=()=>P()===0,be=e=>{let t=P();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return j?.get(e);default:w(t)}},xe=(e,t)=>{let n=P();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:j?.set(e,t);return;default:w(n)}},Se=e=>{let t=P();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return j?.has(e)??!1;default:return w(t),!1}},Ce=e=>{let t=P();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:j?.delete(e);return;default:w(t)}},we=()=>{let e=P();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return j?.clear();default:w(e)}},Te=()=>{let e,t=[],n=A();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},Ee;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(Ee||={});var F={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},De=(e,t)=>F[e].height>F[t].height,Oe=(e,t)=>F[e].height>=F[t].height,I=(e,t)=>F[e].height<F[t].height,ke=(e,t)=>F[e].height<=F[t].height,Ae=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:I(e,t)?1:-1)[0],je=Object.keys(F).sort((e,t)=>I(e,t)?-1:1),Me=(e,t=.02)=>[...je].find(n=>F[n].height*(1+t)>=e),Ne=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return je.find(e=>{let t=F[e];return t.width>=r&&t.height>=n})},Pe=e=>F[e].height,L=e=>e===`Invariant quality`,Fe=e=>e.every(e=>!L(e));function Ie(e){if(L(e))throw Error(`Expected exact quality`)}var Le=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},Re=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=Re(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},ze=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function Be(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof A().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&A().cancelAnimationFrame(s),A().requestAnimationFrame(e)):setTimeout(e,t)}function ee(e){if(p){A().cancelAnimationFrame(e);return}clearTimeout(e)}function te(e){return l=e,s=h(v,t),u?m(e):o}function g(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function _(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function v(){let e=Date.now();if(_(e))return y(e);s=h(v,g(e))}function y(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function ne(){s!==void 0&&ee(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:y(Date.now())}function x(){return s!==void 0}function S(...e){let n=Date.now(),a=_(n);if(r=e,i=this,c=n,a){if(s===void 0)return te(c);if(d)return s=h(v,t),m(c)}return s===void 0&&(s=h(v,t)),o}return S.cancel=ne,S.flush=b,S.pending=x,S}var Ve=(e,t=0,n)=>Be(e,t,f(f(f({},{leading:!0,trailing:!0}),n),{},{maxWait:t})),R=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=R(e[r],t):n[r]=e[r]}return n},He=e=>R(e);class z extends D{constructor(e){super(),this.bufferSize=void 0,this.buffer=[],this.cursorEnd=-1,this.cursorStart=0,this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new C().add(()=>this.subscribers.delete(t))}}class B extends D{constructor(e){super(),this.value=void 0,this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Ue(e){return new E(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new C)})}function We(...e){return new E(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new C))}var Ge=e=>new E(t=>{let n=A().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>A().clearTimeout(n)}),Ke=e=>new E(t=>{let n=A(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function qe(e){return new E(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Je=qe,Ye=(e,t)=>new E(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Xe extends C{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ze(e){return t=>new E(n=>t.subscribe(new Qe(n,e)))}class Qe{constructor(e,t){this.destination=void 0,this.size=void 0,this.lastValues=[],this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t;(t=this.destination).error?.call(t,e)}}var $e={leading:!1,trailing:!0};function et(e,t=$e){return n=>new E(r=>n.subscribe(new tt(r,e,t)))}class tt{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=A();O(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){var t;(t=this.destination).error?.call(t,e)}}var nt={leading:!0,trailing:!1};function rt(e,t=nt){return n=>new E(r=>n.subscribe(new it(r,e,t)))}class it{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,k(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=A().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t;(t=this.destination).error?.call(t,e)}}function at(e){return t=>new E(n=>t.subscribe(new ot(n,e)))}class ot{constructor(e,t){this.destination=void 0,this.predicate=void 0,this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}var st=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},ct=(e,t)=>e instanceof Object&&t instanceof Object?st(e,t):e===t;function lt(e=ct){return t=>new E(n=>t.subscribe(new ut(n,e)))}var V={};class ut{constructor(e,t){this.destination=void 0,this.predicate=void 0,this.lastValue=V,this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===V||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?f({},e):e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function H(e){return t=>new E(n=>t.subscribe(new dt(n,e)))}class dt{constructor(e,t){this.destination=void 0,this.mapper=void 0,this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){var t;(t=this.destination).error?.call(t,e)}}function ft(e){return H(()=>e)}function pt(){return e=>new E(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.call(t,e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function mt(){return e=>new E(t=>e.subscribe(new ht(t)))}class ht{constructor(e){this.destination=void 0,this.last=void 0,this.hasLast=!1,this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t;(t=this.destination).error?.call(t,e)}}function gt(e){return t=>new E(n=>t.subscribe(new _t(n,e)))}class _t{constructor(e,t){this.destination=void 0,this.effect=void 0,this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function vt(e){return t=>new E(n=>t.subscribe(new yt(n,e)))}class yt{constructor(e,t){if(this.destination=void 0,this.count=void 0,this.destination=e,this.count=t,t<0){var n;(n=this.destination).error?.call(n,Error(`Count can not be less than zero`))}}next(e){this.count===0?this.destination.next(e):this.count--}error(e){var t;(t=this.destination).error?.call(t,e)}}function bt(e=0){return t=>{let n=0,r=new z(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new E(e=>(n++,a(r.subscribe(e))))}}var xt=300,St=(e,t=xt)=>new E(n=>{let r=A(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!fe(r))return;let o=new r.ResizeObserver(Ve(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),O(r)&&O(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),U=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=U(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},Ct=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},wt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},Tt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),Et=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),Dt=e=>e!==void 0&&e!==``?e:Et().toString();function Ot(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function kt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var At=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),jt=e=>{if(!At(e))throw e};function Mt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}var Nt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?U(n):{value:n})},W=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class G{constructor({name:e,getParentContext:t,getRootTracerContext:n}){this.dynamicImportTimeout=5e3,this.subscription=new C,this.span=void 0,this.context=void 0,this.childTracers=[],this.initPromise=void 0,this.getRootTracerContext=void 0,G.dynamicImportStatus===`not_started`&&(G.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=G.dynamicImportPromise.then(i=>{G.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},r)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(k(i))return;let{opentelemetryApi:a}=G.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{O(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return p(function*(){if(G.dynamicImportStatus===`not_started`){G.dynamicImportStatus=`in_progress`;try{let t=new Promise((t,n)=>setTimeout(n,e.dynamicImportTimeout)),n=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[r,i,a,o,s]=yield Promise.race([n,t]);G.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},G.dynamicImportStatus=`completed`}catch{G.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return k(this.span)||G.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,f(f({},W(t)),{},{type:`log`}),n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,f(f({},W(t)),{},{type:`error`}),n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,f(f({},W(t)),{},{type:`critical`}),n)})}createComponentTracer(e){let t=new G({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.call(this)});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe())})}}G.dynamicImportStatus=`not_started`,G.dynamicImports=void 0,G.dynamicImportPromise=void 0;var Pt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class Ft extends G{constructor(){super({name:`Root`}),this.attributes$=new B(null)}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=G.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:Pt}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(W(e))}addSubscription(e){this.subscription.add(e)}}class It{constructor(e){this.fakeTraceId=void 0}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new It({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var Lt=()=>!0,K={level:0,filter:Lt,name:`Noname Tracer`,outputMethod:`log`};class Rt{constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.name=void 0,this.filter=Lt,this.level=K.level,this.outputMethod=K.outputMethod,this.childTracers=[],this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t){this.logDebug(e,t)}error(e,t){this.logError(e,t)}critical(e,t){this.logError(e,t)}createComponentTracer(e){let t=new Rt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||A().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&A().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class zt{static createRootTracer(e=`fake`){switch(e){case`real`:return new Ft;case`debug`:return new Rt;default:return new It}}}var Bt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Bt||={});var Vt;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(Vt||={});var Ht=`vk.com`,Ut=function(){var e=p(function*(e,t,n){let r=new URL(`https://${Ht}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Wt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),Wt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Gt(n)])),Gt=e=>Array.isArray(e)?e[0]:e,Kt;(e=>{e.RU=`ru`,e.EN=`en`})(Kt||={});var q=`__vk_vp_internals_exposure`;class qt{constructor(e,t){this.playerId=void 0,this.type=void 0,this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){var e;if(typeof window>`u`)return{};let t=this.playerId,n=this.type;return((e=window[q])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]||(window[q]={}),window[q][e]||(window[q][e]={}),window[q][e][t]||(window[q][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]&&window[q][e]&&window[q][e][t]&&(delete window[q][e][t],Object.keys(window[q][e]).length||delete window[q][e],Object.keys(window[q]).length||delete window[q])}}var Jt={};b(Jt,{subscribe:()=>Qt,push:()=>Zt,destroy:()=>Xt,create:()=>Yt});var J=new Map,Yt=(e,t)=>J.set(e,t??[]),Xt=e=>J.delete(e),Zt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Qt=(e,t)=>{let n=J.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);J.set(e,t)}},$t=e=>le({id:e.id,message:e.message,category:e.category,data:en(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function en(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var tn=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},nn=()=>{try{var e;let{origin:t,pathname:n,search:r,hostname:i}=((e=A())==null||(e=e.document)==null?void 0:e.location)??{};return!i||i===`localhost`?void 0:f({url:t+n},new URLSearchParams(r).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class Y{constructor(e,t,n,r){this.dynamicImportTimeout=5e3,this.componentName=void 0,this.subscription=new C,this.options=void 0,this.envParams=void 0,this.context=void 0,this.isEmbed=void 0,this.embedParent=void 0,this.beforeInitErrors=[],this.componentName=e,this.options=t,this.envParams=n,this.context=f({},r);let{isEmbed:i,topOrigin:a}=Te();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=tn(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:f(f(f(f({},this.context),$t(e)),nn()),this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent})})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return p(function*(){try{if(yield Y.loadPromise,Y.tracerErrorMap.has(e.componentName)||k(Y.appTracerModule))return;let{appTracerModule:t}=Y,{initTracerError:n,initTracerErrorUploader:r,getTracerModules:i}=t,a=i(e.componentName),o=!a.error,s=a.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});O(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:Pt,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s),e.beforeInitErrors.forEach(t=>e.error.apply(e,t)),e.beforeInitErrors=[]}catch(e){console.error(e)}})()}loadModule(){var e=this;O(Y.loadPromise)||(Y.loadPromise=function(){var t=p(function*(){try{let t=new Promise((t,n)=>A().setTimeout(n,e.dynamicImportTimeout));Y.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch(e){Y.loadPromise=null,console.error(e)}});return function(){return t.apply(this,arguments)}}()())}}Y.tracerErrorMap=new Map,Y.appTracerModule=null,Y.loadPromise=null;class rn{constructor(e,t){this.options=void 0,this.symbol=void 0,this.options=t,this.symbol=Symbol(e)}}var an=()=>{let e=new Map,t=new Map,n=new Map,r=new Map;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},clear(){e.clear(),t.clear(),r.clear(),n.clear()}}},on=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},sn=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},cn=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},ln=(e,t=1)=>{let n=[],r=(e,t)=>{for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i];t>0&&Array.isArray(a)?r(a,t-1):n.push(a)}};return r(e,t),n},un=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r,e);if(Array.isArray(i))for(let e=0;e<i.length;e++)n.push(i[e]);else n.push(i)}return n},dn=(e,t,n=0)=>{let r=e.length,i=n>=0?n:Math.max(r+n,0);for(;i<r;i++){let n=e[i];if(n===t||n!==n&&t!==t)return!0}return!1},fn=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},pn=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},mn=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},hn=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},gn=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),_n=e=>{let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++){let i=n[r];t.push([i,e[i]])}return t},vn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},yn=Object.prototype.hasOwnProperty,bn=(e,t)=>yn.call(e,t),xn=e=>{let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},Sn=e=>{let t=Array.from(e);return t.length===0?Promise.resolve([]):Promise.all(t.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))},Cn=e=>{let t=Array.from(e);return t.length===0?Promise.reject(AggregateError([],`All promises were rejected`)):new Promise((e,n)=>{let r=Array(t.length),i=t.length;t.forEach((t,a)=>{Promise.resolve(t).then(e,e=>{r[a]=e,--i,i===0&&n(AggregateError(r,`All promises were rejected`))})})})},wn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),Tn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},En=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:Dn,NativeAbortController:On}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function kn(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function An(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class jn{constructor(){Object.defineProperty(this,`listeners`,{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class X extends jn{constructor(){super(),this.listeners||jn.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new Z;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new Z;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class Z{constructor(){Object.defineProperty(this,`signal`,{value:new X,writable:!0,configurable:!0})}abort(e){let t=An(e),n=kn(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(Z.prototype[Symbol.toStringTag]=`AbortController`,X.prototype[Symbol.toStringTag]=`AbortSignal`);function Mn(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log(`__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill`),!0):typeof e.Request==`function`&&!e.Request.prototype.hasOwnProperty(`signal`)||!e.AbortController}function Nn(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Mn({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&Mn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Pn=$?Nn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Fn=$?Pn.fetch:Q.fetch,In=$?Pn.Request:Q.Request,Ln=$?Z:Q.AbortController,Rn=$?X:Q.AbortSignal,zn=(e,t)=>{let n=e.length,r=t>=0?t:n+t;if(r<0||r>=n)return;let i=e.charCodeAt(r);if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343)return e[r]+e[r+1]}return e[r]};function*Bn(e,t){let n=t.flags.includes(`g`)?t.flags:t.flags+`g`,r=new RegExp(t.source,n),i;for(;(i=r.exec(e))!==null;)yield i,i[0].length===0&&r.lastIndex++}var Vn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return e+n.repeat(Math.ceil(r/n.length)).slice(0,r)},Hn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return n.repeat(Math.ceil(r/n.length)).slice(0,r)+e},Un=(e,t,n)=>{if(typeof t==`string`){if(typeof n==`string`)return t===``?n+e.split(``).join(n)+n:e.split(t).join(n);let r=[],i=0,a=e.indexOf(t,i);for(;a!==-1;)r.push(e.slice(i,a)),r.push(n(t,a,e)),i=a+t.length,a=e.indexOf(t,i);return r.push(e.slice(i)),r.join(``)}let r=t.flags.includes(`g`)?t.flags:t.flags+`g`,i=new RegExp(t.source,r);return e.replace(i,n)},Wn=e=>e.replace(/^\s+/,``),Gn=e=>e.replace(/\s+$/,``),Kn=Wn,qn=Gn,Jn=(e,t)=>typeof e==`string`?zn(e,t):on(e,t),Yn=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Q.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},Xn=e=>Q.clearTimeout(e),Zn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Qn=!Zn(Q.requestIdleCallback)||!Zn(Q.cancelIdleCallback),$n=Qn?Yn:Q.requestIdleCallback,er=Qn?Xn:Q.cancelIdleCallback,tr=(e,t,n)=>typeof e==`string`?e.includes(t,n):dn(e,t,n),nr=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.92-dev.53fc4c12e.0
3
- * Mon, 08 Jun 2026 14:14:39 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.92-dev.82d0b1d07.0
3
+ * Thu, 11 Jun 2026 11:32:51 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-92/doc/
5
5
  */
6
- import e from"@oxc-project/runtime/helpers/defineProperty";import t from"@oxc-project/runtime/helpers/objectSpread2";import n from"@oxc-project/runtime/helpers/asyncToGenerator";let r;var i=Object.defineProperty,a=e=>e;function o(e,t){this[e]=a.bind(null,t)}var s=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0,configurable:!0,set:o.bind(t,n)})},c=`1.0.92-dev.53fc4c12e.0`;class l{constructor(){e(this,`subscriptions`,[])}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var u=e=>{throw Error(`${e} is value of unexpected type`)},d=e=>{},f=()=>{},p=e=>{throw console.error(e),e},m=e=>{console.error(e)};class h{constructor(t){e(this,`suppressErrors`,!1),t&&(this._subscribe=t)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?m:p,r;r=t?typeof t==`function`?{next:t,error:f}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:f};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.call(i,e)}return new l().add(()=>{switch(i.next=f,i.error=f,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return u(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class g extends h{constructor(){super(),e(this,`keyCounter`,0),e(this,`subscribers`,new Map)}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.call(t,e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new l().add(()=>this.subscribers.delete(t))}}class ee{constructor(){e(this,`log$`,new g),e(this,`logs`,[]),e(this,`log`,e=>{let n=t(t({},e),{},{timestamp:Date.now()});this.logs.push(n),this.log$.next(n)}),e(this,`getAllLogs`,()=>this.logs)}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(n=>t({component:e},n))}}function te(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function _(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function v(e){return e!=null}function y(e){return e==null}var b=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>v(t)));function ne(e,t){if(!e?.length)throw Error(t)}function re(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=(e=x())=>!!(e.window&&e.screen),ie=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=x().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),C=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),ae=()=>Math.trunc(C()),oe=(e,t)=>n(function*(...n){let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=yield r.next(a);i=e.done??!1,a=e.value}catch(e){yield r.throw(e)}return a}),se=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**+e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},ce={};s(ce,{set:()=>de,remove:()=>pe,isPersistent:()=>le,has:()=>fe,get:()=>ue,clear:()=>me});var w,T,E=`vk-videoplayer-dummy-key-${Math.random()}`,D=()=>{if(T!==void 0)return T;try{localStorage.setItem(E,`test`),localStorage.removeItem(E),T=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(E),T=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)T=2;else throw e}else throw e}return T===2&&(w=new Map),T},le=()=>D()===0,ue=e=>{let t=D();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return w?.get(e);default:u(t)}},de=(e,t)=>{let n=D();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:w?.set(e,t);return;default:u(n)}},fe=e=>{let t=D();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return w?.has(e)??!1;default:return u(t),!1}},pe=e=>{let t=D();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:w?.delete(e);return;default:u(t)}},me=()=>{let e=D();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return w?.clear();default:u(e)}},he=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},O;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(O||={});var k={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},ge=(e,t)=>k[e].height>k[t].height,_e=(e,t)=>k[e].height>=k[t].height,A=(e,t)=>k[e].height<k[t].height,ve=(e,t)=>k[e].height<=k[t].height,ye=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:A(e,t)?1:-1)[0],j=Object.keys(k).sort((e,t)=>A(e,t)?-1:1),be=(e,t=.02)=>[...j].find(n=>k[n].height*(1+t)>=e),xe=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return j.find(e=>{let t=k[e];return t.width>=r&&t.height>=n})},Se=e=>k[e].height,M=e=>e===`Invariant quality`,Ce=e=>e.every(e=>!M(e));function we(e){if(M(e))throw Error(`Expected exact quality`)}var Te=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},N=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=N(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ee=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function P(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}clearTimeout(e)}function ee(e){return l=e,s=h(v,t),u?m(e):o}function te(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function _(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function v(){let e=Date.now();if(_(e))return y(e);s=h(v,te(e))}function y(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function b(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function ne(){return s===void 0?o:y(Date.now())}function re(){return s!==void 0}function S(...e){let n=Date.now(),a=_(n);if(r=e,i=this,c=n,a){if(s===void 0)return ee(c);if(d)return s=h(v,t),m(c)}return s===void 0&&(s=h(v,t)),o}return S.cancel=b,S.flush=ne,S.pending=re,S}var F=(e,n=0,r)=>P(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),I=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=I(e[r],t):n[r]=e[r]}return n},De=e=>I(e);class L extends g{constructor(t){super(),e(this,`bufferSize`,void 0),e(this,`buffer`,[]),e(this,`cursorEnd`,-1),e(this,`cursorStart`,0),this.bufferSize=t,this.buffer=Array(t)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new l().add(()=>this.subscribers.delete(t))}}class R extends g{constructor(t){super(),e(this,`value`,void 0),this.value=t}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Oe(e){return new h(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new l)})}function ke(...e){return new h(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new l))}var Ae=e=>new h(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),je=e=>new h(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Me(e){return new h(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ne=Me,Pe=(e,t)=>new h(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Fe extends l{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ie(e){return t=>new h(n=>t.subscribe(new Le(n,e)))}class Le{constructor(t,n){e(this,`destination`,void 0),e(this,`size`,void 0),e(this,`lastValues`,[]),this.destination=t,this.size=n}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Re={leading:!1,trailing:!0};function ze(e,t=Re){return n=>new h(r=>n.subscribe(new Be(r,e,t)))}class Be{constructor(t,n,r){e(this,`destination`,void 0),e(this,`time`,void 0),e(this,`config`,void 0),e(this,`lastValue`,void 0),e(this,`timeout`,void 0),this.destination=t,this.time=n,this.config=r}next(e){this.lastValue=e;let t=x();v(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Ve={leading:!0,trailing:!1};function He(e,t=Ve){return n=>new h(r=>n.subscribe(new Ue(r,e,t)))}class Ue{constructor(t,n,r){e(this,`destination`,void 0),e(this,`time`,void 0),e(this,`config`,void 0),e(this,`lastValue`,void 0),e(this,`timeout`,void 0),this.destination=t,this.time=n,this.config=r}next(e){this.lastValue=e,y(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=x().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t;(t=this.destination).error?.call(t,e)}}function We(e){return t=>new h(n=>t.subscribe(new Ge(n,e)))}class Ge{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),this.destination=t,this.predicate=n}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Ke=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},qe=(e,t)=>e instanceof Object&&t instanceof Object?Ke(e,t):e===t;function Je(e=qe){return t=>new h(n=>t.subscribe(new Ye(n,e)))}var z={};class Ye{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,z),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===z||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?t({},e):e}catch(e){throw this.error(e),e}n&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function B(e){return t=>new h(n=>t.subscribe(new Xe(n,e)))}class Xe{constructor(t,n){e(this,`destination`,void 0),e(this,`mapper`,void 0),this.destination=t,this.mapper=n}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){var t;(t=this.destination).error?.call(t,e)}}function Ze(e){return B(()=>e)}function Qe(){return e=>new h(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.call(t,e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function $e(){return e=>new h(t=>e.subscribe(new et(t)))}class et{constructor(t){e(this,`destination`,void 0),e(this,`last`,void 0),e(this,`hasLast`,!1),this.destination=t}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t;(t=this.destination).error?.call(t,e)}}function tt(e){return t=>new h(n=>t.subscribe(new nt(n,e)))}class nt{constructor(t,n){e(this,`destination`,void 0),e(this,`effect`,void 0),this.destination=t,this.effect=n}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function rt(e){return t=>new h(n=>t.subscribe(new it(n,e)))}class it{constructor(t,n){if(e(this,`destination`,void 0),e(this,`count`,void 0),this.destination=t,this.count=n,n<0){var r;(r=this.destination).error?.call(r,Error(`Count can not be less than zero`))}}next(e){this.count===0?this.destination.next(e):this.count--}error(e){var t;(t=this.destination).error?.call(t,e)}}function at(e=0){return t=>{let n=0,r=new L(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new h(e=>(n++,a(r.subscribe(e))))}}var ot=300,st=(e,t=ot)=>new h(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!S(r))return;let o=new r.ResizeObserver(F(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),v(r)&&v(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),V=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=V(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},ct=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},lt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ut=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),dt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ft=e=>e!==void 0&&e!==``?e:dt().toString();function pt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function mt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var H=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),ht=e=>{if(!H(e))throw e};function gt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}r=Symbol.iterator;class U{constructor(t){if(e(this,`buffer`,void 0),e(this,`writeIndex`,0),e(this,`count`,0),e(this,`capacity`,void 0),t<=0)throw Error(`Capacity must be greater than 0`);this.capacity=t,this.buffer=Array.from({length:t}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[r](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];v(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var _t=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?V(n):{value:n})},vt=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class W{constructor({name:t,getParentContext:n,getRootTracerContext:r,eventsBufferSize:i}){e(this,`dynamicImportTimeout`,5e3),e(this,`subscription`,new l),e(this,`span`,void 0),e(this,`context`,void 0),e(this,`childTracers`,[]),e(this,`initPromise`,void 0),e(this,`getRootTracerContext`,void 0),e(this,`eventsBuffer`,null),v(i)&&i>0&&(this.eventsBuffer=new U(i)),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let a=Date.now();this.initPromise=W.dynamicImportPromise.then(e=>{W.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n,getRootTracerContext:r},a)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(y(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{v(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return n(function*(){if(W.dynamicImportStatus===`not_started`){W.dynamicImportStatus=`in_progress`;try{let t=new Promise((t,n)=>setTimeout(n,e.dynamicImportTimeout)),n=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[r,i,a,o,s]=yield Promise.race([n,t]);W.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return y(this.span)||W.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){v(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,n,r,i){this.span.addEvent(e,t(t({},vt(n)),{},{type:r}),i)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.call(this),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(v(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}e(W,`dynamicImportStatus`,`not_started`),e(W,`dynamicImports`,void 0),e(W,`dynamicImportPromise`,void 0);var yt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class bt extends W{constructor(t){super({name:`Root`,eventsBufferSize:t}),e(this,`attributes$`,new R(null))}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=W.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:yt}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(vt(e))}addSubscription(e){this.subscription.add(e)}}class xt{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new xt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var St=()=>!0,G={level:0,filter:St,name:`Noname Tracer`,outputMethod:`log`};class Ct{constructor({name:t,level:n,filter:r,outputMethod:i}={}){e(this,`name`,void 0),e(this,`filter`,St),e(this,`level`,G.level),e(this,`outputMethod`,G.outputMethod),e(this,`childTracers`,[]),this.filter=r??this.filter,this.level=n??this.level,this.outputMethod=i??this.outputMethod,this.name=t??G.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Ct({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class wt{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new bt(t);case`debug`:return new Ct;default:return new xt}}}var Tt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Tt||={});var Et;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(Et||={});var Dt=`vk.com`,Ot=function(){var e=n(function*(e,t,n){let r=new URL(`https://${Dt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),kt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),kt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),At(n)])),At=e=>Array.isArray(e)?e[0]:e,jt;(e=>{e.RU=`ru`,e.EN=`en`})(jt||={});var K=`__vk_vp_internals_exposure`;class Mt{constructor(t,n){e(this,`playerId`,void 0),e(this,`type`,void 0),this.playerId=n,this.type=t,this.initWindowObjects()}getWindowObject(){var e;if(typeof window>`u`)return{};let t=this.playerId,n=this.type;return((e=window[K])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]||(window[K]={}),window[K][e]||(window[K][e]={}),window[K][e][t]||(window[K][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]&&window[K][e]&&window[K][e][t]&&(delete window[K][e][t],Object.keys(window[K][e]).length||delete window[K][e],Object.keys(window[K]).length||delete window[K])}}var Nt={};s(Nt,{subscribe:()=>Lt,push:()=>It,destroy:()=>Ft,create:()=>Pt});var q=new Map,Pt=(e,t)=>q.set(e,t??[]),Ft=e=>q.delete(e),It=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Lt=(e,t)=>{let n=q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);q.set(e,t)}},Rt=e=>b({id:e.id,message:e.message,category:e.category,data:zt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function zt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Bt=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Vt=()=>{try{var e;let{origin:n,pathname:r,search:i,hostname:a}=((e=x())==null||(e=e.document)==null?void 0:e.location)??{};return!a||a===`localhost`?void 0:t({url:n+r},new URLSearchParams(i).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class J{constructor(n,r,i,a){e(this,`dynamicImportTimeout`,5e3),e(this,`componentName`,void 0),e(this,`subscription`,new l),e(this,`options`,void 0),e(this,`envParams`,void 0),e(this,`context`,void 0),e(this,`isEmbed`,void 0),e(this,`embedParent`,void 0),e(this,`beforeInitErrors`,[]),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=he();this.isEmbed=o,this.embedParent=s?new URL(s).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,n){let r=J.tracerErrorMap.get(this.componentName);if(!r){this.beforeInitErrors.push([e,n]);return}let{blackErrorCategoryList:i,blackErrorIdList:a,sampleRate:o,whiteErrorCategoryList:s,whiteErrorIdList:c}=this.options,{id:l,category:u}=e;if(!(i.length&&i.includes(u)||a.length&&a.includes(l)||s.length&&!s.includes(u)||c.length&&!c.includes(l)||Math.random()>=o))try{let i=Bt(e);r?.error(i,{crashIdSource:i.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),Rt(e)),Vt()),this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent})})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return n(function*(){try{if(yield J.loadPromise,J.tracerErrorMap.has(e.componentName)||y(J.appTracerModule))return;let{appTracerModule:t}=J,{initTracerError:n,initTracerErrorUploader:r,getTracerModules:i}=t,a=i(e.componentName),o=!a.error,s=a.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});v(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:yt,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),J.tracerErrorMap.set(e.componentName,s),e.beforeInitErrors.forEach(t=>e.error.apply(e,t)),e.beforeInitErrors=[]}catch(e){console.error(e)}})()}loadModule(){var e=this;v(J.loadPromise)||(J.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>x().setTimeout(n,e.dynamicImportTimeout));J.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch(e){J.loadPromise=null,console.error(e)}});return function(){return t.apply(this,arguments)}}()())}}e(J,`tracerErrorMap`,new Map),e(J,`appTracerModule`,null),e(J,`loadPromise`,null);class Ht{constructor(t,n){e(this,`options`,void 0),e(this,`symbol`,void 0),this.options=n,this.symbol=Symbol(t)}}var Ut=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},Wt=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},Gt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Kt=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},qt=(e,t=1)=>{let n=[],r=(e,t)=>{for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i];t>0&&Array.isArray(a)?r(a,t-1):n.push(a)}};return r(e,t),n},Jt=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r,e);if(Array.isArray(i))for(let e=0;e<i.length;e++)n.push(i[e]);else n.push(i)}return n},Yt=(e,t,n=0)=>{let r=e.length,i=n>=0?n:Math.max(r+n,0);for(;i<r;i++){let n=e[i];if(n===t||n!==n&&t!==t)return!0}return!1},Xt=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},Zt=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},Qt=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},$t=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},en=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),tn=e=>{let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++){let i=n[r];t.push([i,e[i]])}return t},nn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},rn=Object.prototype.hasOwnProperty,an=(e,t)=>rn.call(e,t),on=e=>{let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},sn=e=>{let t=Array.from(e);return t.length===0?Promise.resolve([]):Promise.all(t.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))},cn=e=>{let t=Array.from(e);return t.length===0?Promise.reject(AggregateError([],`All promises were rejected`)):new Promise((e,n)=>{let r=Array(t.length),i=t.length;t.forEach((t,a)=>{Promise.resolve(t).then(e,e=>{r[a]=e,--i,i===0&&n(AggregateError(r,`All promises were rejected`))})})})},ln=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),un=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},dn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:fn,NativeAbortController:pn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function mn(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function hn(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class gn{constructor(){Object.defineProperty(this,`listeners`,{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class Y extends gn{constructor(){super(),this.listeners||gn.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new X;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new X;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class X{constructor(){Object.defineProperty(this,`signal`,{value:new Y,writable:!0,configurable:!0})}abort(e){let t=hn(e),n=mn(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(X.prototype[Symbol.toStringTag]=`AbortController`,Y.prototype[Symbol.toStringTag]=`AbortSignal`);function Z(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log(`__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill`),!0):typeof e.Request==`function`&&!e.Request.prototype.hasOwnProperty(`signal`)||!e.AbortController}function _n(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Z({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&Z({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),vn=$?_n({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,yn=$?vn.fetch:Q.fetch,bn=$?vn.Request:Q.Request,xn=$?X:Q.AbortController,Sn=$?Y:Q.AbortSignal,Cn=(e,t)=>{let n=e.length,r=t>=0?t:n+t;if(r<0||r>=n)return;let i=e.charCodeAt(r);if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343)return e[r]+e[r+1]}return e[r]};function*wn(e,t){let n=t.flags.includes(`g`)?t.flags:t.flags+`g`,r=new RegExp(t.source,n),i;for(;(i=r.exec(e))!==null;)yield i,i[0].length===0&&r.lastIndex++}var Tn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return e+n.repeat(Math.ceil(r/n.length)).slice(0,r)},En=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return n.repeat(Math.ceil(r/n.length)).slice(0,r)+e},Dn=(e,t,n)=>{if(typeof t==`string`){if(typeof n==`string`)return t===``?n+e.split(``).join(n)+n:e.split(t).join(n);let r=[],i=0,a=e.indexOf(t,i);for(;a!==-1;)r.push(e.slice(i,a)),r.push(n(t,a,e)),i=a+t.length,a=e.indexOf(t,i);return r.push(e.slice(i)),r.join(``)}let r=t.flags.includes(`g`)?t.flags:t.flags+`g`,i=new RegExp(t.source,r);return e.replace(i,n)},On=e=>e.replace(/^\s+/,``),kn=e=>e.replace(/\s+$/,``),An=On,jn=kn,Mn=(e,t)=>typeof e==`string`?Cn(e,t):Wt(e,t),Nn=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Q.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},Pn=e=>Q.clearTimeout(e),Fn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),In=!Fn(Q.requestIdleCallback)||!Fn(Q.cancelIdleCallback),Ln=In?Nn:Q.requestIdleCallback,Rn=In?Pn:Q.cancelIdleCallback,zn=(e,t,n)=>typeof e==`string`?e.includes(t,n):Yt(e,t,n),Bn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};export{b as withoutNullable,xe as videoSizeToQuality,Se as videoQualityToHeight,be as videoHeightToQuality,Bn as urlCanParsePolyfilled,Ae as timeout,Ee as timeCodeToString,F as throttleFn,He as throttle,tt as tap,ht as suppressAbort,On as stringTrimStart,jn as stringTrimRight,An as stringTrimLeft,kn as stringTrimEnd,Dn as stringReplaceAll,En as stringPadStart,Tn as stringPadEnd,wn as stringMatchAll,Cn as stringAt,rt as skip,at as shareReplay,ce as safeStorage,Ln as requestIdleCallbackPolyfilled,dn as promiseWithResolvers,un as promiseTry,ln as promiseFinally,cn as promiseAny,sn as promiseAllSettled,$e as pairwise,Qe as once,st as observeElementSize,Ne as observableFrom,on as objectValues,an as objectHasOwn,nn as objectFromEntries,tn as objectEntries,ae as nowInt,C as now,f as noop,ke as merge,Ze as mapTo,B as map,Ot as loadVKLangPack,lt as isValidURL,y as isNullable,v as isNonNullable,ve as isLowerOrEqual,A as isLower,M as isInvariantQuality,ut as isIntersecting,_e as isHigherOrEqual,ge as isHigher,S as isBrowserWindow,H as isAbortError,je as interval,pt as interpolate,zn as includesPolyfilled,en as globalThisPolyfill,x as getWindow,Te as getVideoQualityLabel,_t as getTraceSubscriptionMethod,mt as getRangeAroundIndex,ft as getPlayerId,gt as getMessageFromError,ye as getHighestQuality,se as getExponentialDelay,Pe as fromEvent,V as flattenObject,Je as filterChanged,We as filter,N as fillWithDefault,yn as fetchPolyfilled,Nt as devNull,he as detectEmbed,P as debounceFn,ze as debounce,Ut as createDIContainer,Oe as combine,I as cloneDeepWith,De as cloneDeep,ct as clearVideoElement,d as checkNever,Rn as cancelIdleCallbackPolyfilled,Ie as buffer,Mn as atPolyfilled,we as assertQualityIsExact,_ as assertNullable,ne as assertNotEmptyArray,te as assertNonNullable,u as assertNever,re as assertEmptyArray,$t as arrayWith,Qt as arrayToSpliced,Zt as arrayToSorted,Xt as arrayToReversed,Yt as arrayIncludes,Jt as arrayFlatMap,qt as arrayFlat,Kt as arrayFindLastIndex,Gt as arrayFindLast,Wt as arrayAt,Ce as areQualitiesExact,ie as addScript,oe as abortable,O as VideoQuality,R as ValueSubject,Et as VKNumericLanguage,c as VERSION,wt as TracerFactory,Fe as SubscriptionRemovable,l as Subscription,g as Subject,bn as RequestPolyfilled,L as ReplaySubject,h as Observable,ee as Logger,Mt as InternalsExposure,jt as InterfaceLanguage,Ht as InjectionToken,K as INTERNAL_EXPOSE_GLOBAL_KEY,Tt as ErrorCategory,U as CircularBuffer,J as AppTracer,Sn as AbortSignalPolyfilled,xn as AbortControllerPolyfilled};
6
+ function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}var t=e;function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol._oxc_toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@_oxc_toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var t=e,r=n;function i(e){var n=r(e,`string`);return t(n)==`symbol`?n:n+``}var a=i;function o(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=o;function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){u(a,r,i,o,s,`next`,e)}function s(e){u(a,r,i,o,s,`throw`,e)}o(void 0)})}}var f=l,p=d,m=Object.defineProperty,h=e=>e;function ee(e,t){this[e]=h.bind(null,t)}var g=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0,configurable:!0,set:ee.bind(t,n)})},_=`1.0.92-dev.82d0b1d07.0`;class v{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var y=e=>{throw Error(`${e} is value of unexpected type`)},b=e=>{},x=()=>{},te=e=>{throw console.error(e),e},ne=e=>{console.error(e)};class S{constructor(e){this.suppressErrors=!1,e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?ne:te,r;r=t?typeof t==`function`?{next:t,error:x}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:x};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.call(i,e)}return new v().add(()=>{switch(i.next=x,i.error=x,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return y(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class C extends S{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.call(t,e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new v().add(()=>this.subscribers.delete(t))}}class re{constructor(){this.log$=new C,this.logs=[],this.log=e=>{let t=f(f({},e),{},{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>f({component:e},t))}}function ie(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function ae(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function w(e){return e!=null}function T(e){return e==null}var E=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>w(t)));function oe(e,t){if(!e?.length)throw Error(t)}function se(e,t){if(e?.length)throw Error(t)}var D=()=>globalThis,ce=(e=D())=>!!(e.window&&e.screen),le=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=D().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),ue=typeof D().performance?.now==`function`?()=>D().performance.now():()=>Date.now(),de=()=>Math.trunc(ue()),fe=(e,t)=>p(function*(...n){let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=yield r.next(a);i=e.done??!1,a=e.value}catch(e){yield r.throw(e)}return a}),pe=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**+e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},me={};g(me,{set:()=>_e,remove:()=>ye,isPersistent:()=>he,has:()=>ve,get:()=>ge,clear:()=>be});var O,k,A=`vk-videoplayer-dummy-key-${Math.random()}`,j=()=>{if(k!==void 0)return k;try{localStorage.setItem(A,`test`),localStorage.removeItem(A),k=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),k=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)k=2;else throw e}else throw e}return k===2&&(O=new Map),k},he=()=>j()===0,ge=e=>{let t=j();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return O?.get(e);default:y(t)}},_e=(e,t)=>{let n=j();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:O?.set(e,t);return;default:y(n)}},ve=e=>{let t=j();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return O?.has(e)??!1;default:return y(t),!1}},ye=e=>{let t=j();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:O?.delete(e);return;default:y(t)}},be=()=>{let e=j();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:y(e)}},xe=()=>{let e,t=[],n=D();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},Se;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(Se||={});var M={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Ce=(e,t)=>M[e].height>M[t].height,we=(e,t)=>M[e].height>=M[t].height,N=(e,t)=>M[e].height<M[t].height,Te=(e,t)=>M[e].height<=M[t].height,Ee=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:N(e,t)?1:-1)[0],De=Object.keys(M).sort((e,t)=>N(e,t)?-1:1),Oe=(e,t=.02)=>[...De].find(n=>M[n].height*(1+t)>=e),ke=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return De.find(e=>{let t=M[e];return t.width>=r&&t.height>=n})},Ae=e=>M[e].height,P=e=>e===`Invariant quality`,je=e=>e.every(e=>!P(e));function Me(e){if(P(e))throw Error(`Expected exact quality`)}var Ne=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},F=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=F(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Pe=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function Fe(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof D().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&D().cancelAnimationFrame(s),D().requestAnimationFrame(e)):setTimeout(e,t)}function ee(e){if(p){D().cancelAnimationFrame(e);return}clearTimeout(e)}function g(e){return l=e,s=h(y,t),u?m(e):o}function _(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function v(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function y(){let e=Date.now();if(v(e))return b(e);s=h(y,_(e))}function b(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function x(){s!==void 0&&ee(s),l=0,r=c=i=s=void 0}function te(){return s===void 0?o:b(Date.now())}function ne(){return s!==void 0}function S(...e){let n=Date.now(),a=v(n);if(r=e,i=this,c=n,a){if(s===void 0)return g(c);if(d)return s=h(y,t),m(c)}return s===void 0&&(s=h(y,t)),o}return S.cancel=x,S.flush=te,S.pending=ne,S}var Ie=(e,t=0,n)=>Fe(e,t,f(f(f({},{leading:!0,trailing:!0}),n),{},{maxWait:t})),I=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=I(e[r],t):n[r]=e[r]}return n},Le=e=>I(e);class L extends C{constructor(e){super(),this.bufferSize=void 0,this.buffer=[],this.cursorEnd=-1,this.cursorStart=0,this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new v().add(()=>this.subscribers.delete(t))}}class R extends C{constructor(e){super(),this.value=void 0,this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Re(e){return new S(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new v)})}function ze(...e){return new S(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new v))}var Be=e=>new S(t=>{let n=D().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>D().clearTimeout(n)}),Ve=e=>new S(t=>{let n=D(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function He(e){return new S(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.call(t,e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ue=He,We=(e,t)=>new S(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ge extends v{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ke(e){return t=>new S(n=>t.subscribe(new qe(n,e)))}class qe{constructor(e,t){this.destination=void 0,this.size=void 0,this.lastValues=[],this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Je={leading:!1,trailing:!0};function Ye(e,t=Je){return n=>new S(r=>n.subscribe(new Xe(r,e,t)))}class Xe{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=D();w(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){var t;(t=this.destination).error?.call(t,e)}}var Ze={leading:!0,trailing:!1};function Qe(e,t=Ze){return n=>new S(r=>n.subscribe(new $e(r,e,t)))}class $e{constructor(e,t,n){this.destination=void 0,this.time=void 0,this.config=void 0,this.lastValue=void 0,this.timeout=void 0,this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,T(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=D().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t;(t=this.destination).error?.call(t,e)}}function et(e){return t=>new S(n=>t.subscribe(new tt(n,e)))}class tt{constructor(e,t){this.destination=void 0,this.predicate=void 0,this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}var nt=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},rt=(e,t)=>e instanceof Object&&t instanceof Object?nt(e,t):e===t;function it(e=rt){return t=>new S(n=>t.subscribe(new at(n,e)))}var z={};class at{constructor(e,t){this.destination=void 0,this.predicate=void 0,this.lastValue=z,this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===z||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?f({},e):e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function B(e){return t=>new S(n=>t.subscribe(new ot(n,e)))}class ot{constructor(e,t){this.destination=void 0,this.mapper=void 0,this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){var t;(t=this.destination).error?.call(t,e)}}function st(e){return B(()=>e)}function ct(){return e=>new S(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.call(t,e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function lt(){return e=>new S(t=>e.subscribe(new ut(t)))}class ut{constructor(e){this.destination=void 0,this.last=void 0,this.hasLast=!1,this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t;(t=this.destination).error?.call(t,e)}}function dt(e){return t=>new S(n=>t.subscribe(new ft(n,e)))}class ft{constructor(e,t){this.destination=void 0,this.effect=void 0,this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){var t;(t=this.destination).error?.call(t,e)}}function pt(e){return t=>new S(n=>t.subscribe(new mt(n,e)))}class mt{constructor(e,t){if(this.destination=void 0,this.count=void 0,this.destination=e,this.count=t,t<0){var n;(n=this.destination).error?.call(n,Error(`Count can not be less than zero`))}}next(e){this.count===0?this.destination.next(e):this.count--}error(e){var t;(t=this.destination).error?.call(t,e)}}function ht(e=0){return t=>{let n=0,r=new L(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new S(e=>(n++,a(r.subscribe(e))))}}var gt=300,_t=(e,t=gt)=>new S(n=>{let r=D(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!ce(r))return;let o=new r.ResizeObserver(Ie(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),w(r)&&w(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),V=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=V(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},vt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},yt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},bt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),xt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),St=e=>e!==void 0&&e!==``?e:xt().toString();function Ct(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function wt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var H=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),Tt=e=>{if(!H(e))throw e};function Et(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}var Dt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?V(n):{value:n})},U=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class W{constructor({name:e,getParentContext:t,getRootTracerContext:n}){this.dynamicImportTimeout=5e3,this.subscription=new v,this.span=void 0,this.context=void 0,this.childTracers=[],this.initPromise=void 0,this.getRootTracerContext=void 0,W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=W.dynamicImportPromise.then(i=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},r)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(T(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{w(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return p(function*(){if(W.dynamicImportStatus===`not_started`){W.dynamicImportStatus=`in_progress`;try{let t=new Promise((t,n)=>setTimeout(n,e.dynamicImportTimeout)),n=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[r,i,a,o,s]=yield Promise.race([n,t]);W.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return T(this.span)||W.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,f(f({},U(t)),{},{type:`log`}),n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,f(f({},U(t)),{},{type:`error`}),n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,f(f({},U(t)),{},{type:`critical`}),n)})}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.call(this)});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe())})}}W.dynamicImportStatus=`not_started`,W.dynamicImports=void 0,W.dynamicImportPromise=void 0;var Ot=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class kt extends W{constructor(){super({name:`Root`}),this.attributes$=new R(null)}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=W.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:Ot}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(U(e))}addSubscription(e){this.subscription.add(e)}}class At{constructor(e){this.fakeTraceId=void 0}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new At({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var G=()=>!0,K={level:0,filter:G,name:`Noname Tracer`,outputMethod:`log`};class jt{constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.name=void 0,this.filter=G,this.level=K.level,this.outputMethod=K.outputMethod,this.childTracers=[],this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t){this.logDebug(e,t)}error(e,t){this.logError(e,t)}critical(e,t){this.logError(e,t)}createComponentTracer(e){let t=new jt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||D().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&D().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Mt{static createRootTracer(e=`fake`){switch(e){case`real`:return new kt;case`debug`:return new jt;default:return new At}}}var Nt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Nt||={});var Pt;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(Pt||={});var Ft=`vk.com`,It=function(){var e=p(function*(e,t,n){let r=new URL(`https://${Ft}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Lt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),Lt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Rt(n)])),Rt=e=>Array.isArray(e)?e[0]:e,zt;(e=>{e.RU=`ru`,e.EN=`en`})(zt||={});var q=`__vk_vp_internals_exposure`;class Bt{constructor(e,t){this.playerId=void 0,this.type=void 0,this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){var e;if(typeof window>`u`)return{};let t=this.playerId,n=this.type;return((e=window[q])==null||(e=e[t])==null?void 0:e[n])??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]||(window[q]={}),window[q][e]||(window[q][e]={}),window[q][e][t]||(window[q][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]&&window[q][e]&&window[q][e][t]&&(delete window[q][e][t],Object.keys(window[q][e]).length||delete window[q][e],Object.keys(window[q]).length||delete window[q])}}var Vt={};g(Vt,{subscribe:()=>Gt,push:()=>Wt,destroy:()=>Ut,create:()=>Ht});var J=new Map,Ht=(e,t)=>J.set(e,t??[]),Ut=e=>J.delete(e),Wt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Gt=(e,t)=>{let n=J.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);J.set(e,t)}},Kt=e=>E({id:e.id,message:e.message,category:e.category,data:qt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function qt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Jt=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Yt=()=>{try{var e;let{origin:t,pathname:n,search:r,hostname:i}=((e=D())==null||(e=e.document)==null?void 0:e.location)??{};return!i||i===`localhost`?void 0:f({url:t+n},new URLSearchParams(r).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{}))}catch{}};class Y{constructor(e,t,n,r){this.dynamicImportTimeout=5e3,this.componentName=void 0,this.subscription=new v,this.options=void 0,this.envParams=void 0,this.context=void 0,this.isEmbed=void 0,this.embedParent=void 0,this.beforeInitErrors=[],this.componentName=e,this.options=t,this.envParams=n,this.context=f({},r);let{isEmbed:i,topOrigin:a}=xe();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=Jt(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:f(f(f(f({},this.context),Kt(e)),Yt()),this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent})})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}init(){var e=this;return p(function*(){try{if(yield Y.loadPromise,Y.tracerErrorMap.has(e.componentName)||T(Y.appTracerModule))return;let{appTracerModule:t}=Y,{initTracerError:n,initTracerErrorUploader:r,getTracerModules:i}=t,a=i(e.componentName),o=!a.error,s=a.error??n(e.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});w(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:Ot,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s),e.beforeInitErrors.forEach(t=>e.error.apply(e,t)),e.beforeInitErrors=[]}catch(e){console.error(e)}})()}loadModule(){var e=this;w(Y.loadPromise)||(Y.loadPromise=function(){var t=p(function*(){try{let t=new Promise((t,n)=>D().setTimeout(n,e.dynamicImportTimeout));Y.appTracerModule=yield Promise.race([t,import(`@apptracer/sdk/lite`)])}catch(e){Y.loadPromise=null,console.error(e)}});return function(){return t.apply(this,arguments)}}()())}}Y.tracerErrorMap=new Map,Y.appTracerModule=null,Y.loadPromise=null;class Xt{constructor(e,t){this.options=void 0,this.symbol=void 0,this.options=t,this.symbol=Symbol(e)}}var Zt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},clear(){e.clear(),t.clear(),r.clear(),n.clear()}}},Qt=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},$t=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},en=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},tn=(e,t=1)=>{let n=[],r=(e,t)=>{for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i];t>0&&Array.isArray(a)?r(a,t-1):n.push(a)}};return r(e,t),n},nn=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r,e);if(Array.isArray(i))for(let e=0;e<i.length;e++)n.push(i[e]);else n.push(i)}return n},rn=(e,t,n=0)=>{let r=e.length,i=n>=0?n:Math.max(r+n,0);for(;i<r;i++){let n=e[i];if(n===t||n!==n&&t!==t)return!0}return!1},an=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},on=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},sn=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},cn=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},ln=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),un=e=>{let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++){let i=n[r];t.push([i,e[i]])}return t},dn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},fn=Object.prototype.hasOwnProperty,pn=(e,t)=>fn.call(e,t),mn=e=>{let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n},hn=e=>{let t=Array.from(e);return t.length===0?Promise.resolve([]):Promise.all(t.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))},gn=e=>{let t=Array.from(e);return t.length===0?Promise.reject(AggregateError([],`All promises were rejected`)):new Promise((e,n)=>{let r=Array(t.length),i=t.length;t.forEach((t,a)=>{Promise.resolve(t).then(e,e=>{r[a]=e,--i,i===0&&n(AggregateError(r,`All promises were rejected`))})})})},_n=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),vn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},yn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:bn,NativeAbortController:xn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Sn(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function Cn(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class wn{constructor(){Object.defineProperty(this,`listeners`,{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class X extends wn{constructor(){super(),this.listeners||wn.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new Z;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new Z;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class Z{constructor(){Object.defineProperty(this,`signal`,{value:new X,writable:!0,configurable:!0})}abort(e){let t=Cn(e),n=Sn(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(Z.prototype[Symbol.toStringTag]=`AbortController`,X.prototype[Symbol.toStringTag]=`AbortSignal`);function Tn(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log(`__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill`),!0):typeof e.Request==`function`&&!e.Request.prototype.hasOwnProperty(`signal`)||!e.AbortController}function En(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Tn({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&Tn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Dn=$?En({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,On=$?Dn.fetch:Q.fetch,kn=$?Dn.Request:Q.Request,An=$?Z:Q.AbortController,jn=$?X:Q.AbortSignal,Mn=(e,t)=>{let n=e.length,r=t>=0?t:n+t;if(r<0||r>=n)return;let i=e.charCodeAt(r);if(i>=55296&&i<=56319&&r+1<n){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343)return e[r]+e[r+1]}return e[r]};function*Nn(e,t){let n=t.flags.includes(`g`)?t.flags:t.flags+`g`,r=new RegExp(t.source,n),i;for(;(i=r.exec(e))!==null;)yield i,i[0].length===0&&r.lastIndex++}var Pn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return e+n.repeat(Math.ceil(r/n.length)).slice(0,r)},Fn=(e,t,n=` `)=>{if(n===``||e.length>=t)return e;let r=t-e.length;return n.repeat(Math.ceil(r/n.length)).slice(0,r)+e},In=(e,t,n)=>{if(typeof t==`string`){if(typeof n==`string`)return t===``?n+e.split(``).join(n)+n:e.split(t).join(n);let r=[],i=0,a=e.indexOf(t,i);for(;a!==-1;)r.push(e.slice(i,a)),r.push(n(t,a,e)),i=a+t.length,a=e.indexOf(t,i);return r.push(e.slice(i)),r.join(``)}let r=t.flags.includes(`g`)?t.flags:t.flags+`g`,i=new RegExp(t.source,r);return e.replace(i,n)},Ln=e=>e.replace(/^\s+/,``),Rn=e=>e.replace(/\s+$/,``),zn=Ln,Bn=Rn,Vn=(e,t)=>typeof e==`string`?Mn(e,t):Qt(e,t),Hn=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Q.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},Un=e=>Q.clearTimeout(e),Wn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Gn=!Wn(Q.requestIdleCallback)||!Wn(Q.cancelIdleCallback),Kn=Gn?Hn:Q.requestIdleCallback,qn=Gn?Un:Q.cancelIdleCallback,Jn=(e,t,n)=>typeof e==`string`?e.includes(t,n):rn(e,t,n),Yn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};export{E as withoutNullable,ke as videoSizeToQuality,Ae as videoQualityToHeight,Oe as videoHeightToQuality,Yn as urlCanParsePolyfilled,Be as timeout,Pe as timeCodeToString,Ie as throttleFn,Qe as throttle,dt as tap,Tt as suppressAbort,Ln as stringTrimStart,Bn as stringTrimRight,zn as stringTrimLeft,Rn as stringTrimEnd,In as stringReplaceAll,Fn as stringPadStart,Pn as stringPadEnd,Nn as stringMatchAll,Mn as stringAt,pt as skip,ht as shareReplay,me as safeStorage,Kn as requestIdleCallbackPolyfilled,yn as promiseWithResolvers,vn as promiseTry,_n as promiseFinally,gn as promiseAny,hn as promiseAllSettled,lt as pairwise,ct as once,_t as observeElementSize,Ue as observableFrom,mn as objectValues,pn as objectHasOwn,dn as objectFromEntries,un as objectEntries,de as nowInt,ue as now,x as noop,ze as merge,st as mapTo,B as map,It as loadVKLangPack,yt as isValidURL,T as isNullable,w as isNonNullable,Te as isLowerOrEqual,N as isLower,P as isInvariantQuality,bt as isIntersecting,we as isHigherOrEqual,Ce as isHigher,ce as isBrowserWindow,H as isAbortError,Ve as interval,Ct as interpolate,Jn as includesPolyfilled,ln as globalThisPolyfill,D as getWindow,Ne as getVideoQualityLabel,Dt as getTraceSubscriptionMethod,wt as getRangeAroundIndex,St as getPlayerId,Et as getMessageFromError,Ee as getHighestQuality,pe as getExponentialDelay,We as fromEvent,V as flattenObject,it as filterChanged,et as filter,F as fillWithDefault,On as fetchPolyfilled,Vt as devNull,xe as detectEmbed,Fe as debounceFn,Ye as debounce,Zt as createDIContainer,Re as combine,I as cloneDeepWith,Le as cloneDeep,vt as clearVideoElement,b as checkNever,qn as cancelIdleCallbackPolyfilled,Ke as buffer,Vn as atPolyfilled,Me as assertQualityIsExact,ae as assertNullable,oe as assertNotEmptyArray,ie as assertNonNullable,y as assertNever,se as assertEmptyArray,cn as arrayWith,sn as arrayToSpliced,on as arrayToSorted,an as arrayToReversed,rn as arrayIncludes,nn as arrayFlatMap,tn as arrayFlat,en as arrayFindLastIndex,$t as arrayFindLast,Qt as arrayAt,je as areQualitiesExact,le as addScript,fe as abortable,Se as VideoQuality,R as ValueSubject,Pt as VKNumericLanguage,_ as VERSION,Mt as TracerFactory,Ge as SubscriptionRemovable,v as Subscription,C as Subject,kn as RequestPolyfilled,L as ReplaySubject,S as Observable,re as Logger,Bt as InternalsExposure,zt as InterfaceLanguage,Xt as InjectionToken,q as INTERNAL_EXPOSE_GLOBAL_KEY,Nt as ErrorCategory,Y as AppTracer,jn as AbortSignalPolyfilled,An as AbortControllerPolyfilled};
package/esnext.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.92-dev.53fc4c12e.0
3
- * Mon, 08 Jun 2026 14:14:39 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.92-dev.82d0b1d07.0
3
+ * Thu, 11 Jun 2026 11:32:51 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-92/doc/
5
5
  */
6
- var e=Object.defineProperty,t=Object.getOwnPropertyNames,n=Object.getOwnPropertyDescriptor,r=Object.prototype.hasOwnProperty;function i(e){return this[e]}var a=a=>{var s=(o??=new WeakMap).get(a),c;if(s)return s;if(s=e({},`__esModule`,{value:!0}),a&&typeof a==`object`||typeof a==`function`)for(var l of t(a))r.call(s,l)||e(s,l,{get:i.bind(a,l),enumerable:!(c=n(a,l))||c.enumerable});return o.set(a,s),s},o,s=e=>e;function c(e,t){this[e]=s.bind(null,t)}var l=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0,configurable:!0,set:c.bind(n,r)})},u={};l(u,{withoutNullable:()=>w,videoSizeToQuality:()=>xe,videoQualityToHeight:()=>Se,videoHeightToQuality:()=>be,urlCanParsePolyfilled:()=>dn,timeout:()=>Ae,timeCodeToString:()=>Ee,throttleFn:()=>R,throttle:()=>He,tap:()=>tt,suppressAbort:()=>gt,skip:()=>rt,shareReplay:()=>at,safeStorage:()=>E,requestIdleCallbackPolyfilled:()=>ln,pairwise:()=>$e,once:()=>Qe,observeElementSize:()=>st,observableFrom:()=>Ne,nowInt:()=>oe,now:()=>ae,noop:()=>h,merge:()=>ke,mapTo:()=>Ze,map:()=>U,loadVKLangPack:()=>At,isValidURL:()=>lt,isNullable:()=>C,isNonNullable:()=>S,isLowerOrEqual:()=>ve,isLower:()=>N,isInvariantQuality:()=>F,isIntersecting:()=>ut,isHigherOrEqual:()=>_e,isHigher:()=>ge,isBrowserWindow:()=>re,isAbortError:()=>ht,interval:()=>je,interpolate:()=>pt,getWindow:()=>T,getVideoQualityLabel:()=>Te,getTraceSubscriptionMethod:()=>yt,getRangeAroundIndex:()=>mt,getPlayerId:()=>ft,getMessageFromError:()=>_t,getHighestQuality:()=>ye,getExponentialDelay:()=>ce,fromEvent:()=>Pe,flattenObject:()=>W,filterChanged:()=>Je,filter:()=>We,fillWithDefault:()=>I,fetchPolyfilled:()=>en,devNull:()=>Ft,detectEmbed:()=>j,debounceFn:()=>L,debounce:()=>ze,createDIContainer:()=>Gt,combine:()=>Oe,cloneDeepWith:()=>z,cloneDeep:()=>De,clearVideoElement:()=>ct,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>un,buffer:()=>Ie,assertQualityIsExact:()=>we,assertNullable:()=>ee,assertNotEmptyArray:()=>te,assertNonNullable:()=>x,assertNever:()=>p,assertEmptyArray:()=>ne,areQualitiesExact:()=>Ce,addScript:()=>ie,abortable:()=>se,VideoQuality:()=>he,ValueSubject:()=>V,VKNumericLanguage:()=>Ot,VERSION:()=>d,TracerFactory:()=>Et,SubscriptionRemovable:()=>Fe,Subscription:()=>f,Subject:()=>y,RequestPolyfilled:()=>tn,ReplaySubject:()=>B,Observable:()=>v,Logger:()=>b,InternalsExposure:()=>Pt,InterfaceLanguage:()=>Nt,InjectionToken:()=>Wt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>q,ErrorCategory:()=>Dt,CircularBuffer:()=>vt,AppTracer:()=>Y,AbortSignalPolyfilled:()=>rn,AbortControllerPolyfilled:()=>nn}),module.exports=a(u);var d=`1.0.92-dev.53fc4c12e.0`;class f{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var p=e=>{throw Error(`${e} is value of unexpected type`)},m=e=>{},h=()=>{},g=e=>{throw console.error(e),e},_=e=>{console.error(e)};class v{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?_:g,r;r=t?typeof t==`function`?{next:t,error:h}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:h};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.(e)}return new f().add(()=>{switch(i.next=h,i.error=h,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return p(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class y extends v{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new f().add(()=>this.subscribers.delete(t))}}class b{log$=new y;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function x(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function ee(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function S(e){return e!=null}function C(e){return e==null}var w=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>S(t)));function te(e,t){if(!e?.length)throw Error(t)}function ne(e,t){if(e?.length)throw Error(t)}var T=()=>globalThis,re=(e=T())=>!!(e.window&&e.screen),ie=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=T().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),ae=typeof T().performance?.now==`function`?()=>T().performance.now():()=>Date.now(),oe=()=>Math.trunc(ae()),se=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},ce=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},E={};l(E,{set:()=>de,remove:()=>pe,isPersistent:()=>le,has:()=>fe,get:()=>ue,clear:()=>me});var D,O,k=`vk-videoplayer-dummy-key-${Math.random()}`,A=()=>{if(O!==void 0)return O;try{localStorage.setItem(k,`test`),localStorage.removeItem(k),O=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(k),O=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)O=2;else throw e}else throw e}return O===2&&(D=new Map),O},le=()=>A()===0,ue=e=>{let t=A();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return D?.get(e);default:p(t)}},de=(e,t)=>{let n=A();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:D?.set(e,t);return;default:p(n)}},fe=e=>{let t=A();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return D?.has(e)??!1;default:return p(t),!1}},pe=e=>{let t=A();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:D?.delete(e);return;default:p(t)}},me=()=>{let e=A();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return D?.clear();default:p(e)}},j=()=>{let e,t=[],n=T();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},he;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(he||={});var M={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},ge=(e,t)=>M[e].height>M[t].height,_e=(e,t)=>M[e].height>=M[t].height,N=(e,t)=>M[e].height<M[t].height,ve=(e,t)=>M[e].height<=M[t].height,ye=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:N(e,t)?1:-1)[0],P=Object.keys(M).sort((e,t)=>N(e,t)?-1:1),be=(e,t=.02)=>[...P].find(n=>M[n].height*(1+t)>=e),xe=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return P.find(e=>{let t=M[e];return t.width>=r&&t.height>=n})},Se=e=>M[e].height,F=e=>e===`Invariant quality`,Ce=e=>e.every(e=>!F(e));function we(e){if(F(e))throw Error(`Expected exact quality`)}var Te=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},I=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=I(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ee=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function L(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof T().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&T().cancelAnimationFrame(s),T().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){T().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return x(e);s=h(b,v(e))}function x(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function ee(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function S(){return s===void 0?o:x(Date.now())}function C(){return s!==void 0}function w(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return w.cancel=ee,w.flush=S,w.pending=C,w}var R=(e,t=0,n)=>L(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),z=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=z(e[r],t):n[r]=e[r]}return n},De=e=>z(e);class B extends y{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new f().add(()=>this.subscribers.delete(t))}}class V extends y{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Oe(e){return new v(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new f)})}function ke(...e){return new v(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new f))}var Ae=e=>new v(t=>{let n=T().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>T().clearTimeout(n)}),je=e=>new v(t=>{let n=T(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Me(e){return new v(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ne=Me,Pe=(e,t)=>new v(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Fe extends f{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ie(e){return t=>new v(n=>t.subscribe(new Le(n,e)))}class Le{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}var Re={leading:!1,trailing:!0};function ze(e,t=Re){return n=>new v(r=>n.subscribe(new Be(r,e,t)))}class Be{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=T();S(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var Ve={leading:!0,trailing:!1};function He(e,t=Ve){return n=>new v(r=>n.subscribe(new Ue(r,e,t)))}class Ue{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,C(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=T().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function We(e){return t=>new v(n=>t.subscribe(new Ge(n,e)))}class Ge{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var Ke=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},qe=(e,t)=>e instanceof Object&&t instanceof Object?Ke(e,t):e===t;function Je(e=qe){return t=>new v(n=>t.subscribe(new Ye(n,e)))}var H={};class Ye{destination;predicate;lastValue=H;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===H||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function U(e){return t=>new v(n=>t.subscribe(new Xe(n,e)))}class Xe{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function Ze(e){return U(()=>e)}function Qe(){return e=>new v(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function $e(){return e=>new v(t=>e.subscribe(new et(t)))}class et{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function tt(e){return t=>new v(n=>t.subscribe(new nt(n,e)))}class nt{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function rt(e){return t=>new v(n=>t.subscribe(new it(n,e)))}class it{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(Error(`Count can not be less than zero`))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}}function at(e=0){return t=>{let n=0,r=new B(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new v(e=>(n++,a(r.subscribe(e))))}}var ot=300,st=(e,t=ot)=>new v(n=>{let r=T(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!re(r))return;let o=new r.ResizeObserver(R(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),S(r)&&S(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),W=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=W(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},ct=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},lt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ut=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),dt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ft=e=>e!==void 0&&e!==``?e:dt().toString();function pt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function mt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var ht=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),gt=e=>{if(!ht(e))throw e};function _t(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class vt{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];S(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var yt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?W(n):{value:n})},bt=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class G{dynamicImportTimeout=5e3;subscription=new f;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){S(r)&&r>0&&(this.eventsBuffer=new vt(r)),G.dynamicImportStatus===`not_started`&&(G.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=G.dynamicImportPromise.then(r=>{G.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(C(i))return;let{opentelemetryApi:a}=G.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{S(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(G.dynamicImportStatus===`not_started`){G.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);G.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},G.dynamicImportStatus=`completed`}catch{G.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return C(this.span)||G.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){S(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...bt(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new G({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(S(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var xt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class St extends G{attributes$=new V(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=G.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:xt}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(bt(e))}addSubscription(e){this.subscription.add(e)}}class Ct{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new Ct({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var wt=()=>!0,K={level:0,filter:wt,name:`Noname Tracer`,outputMethod:`log`};class Tt{name;filter=wt;level=K.level;outputMethod=K.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new Tt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||T().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&T().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Et{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new St(t);case`debug`:return new Tt;default:return new Ct}}}var Dt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Dt||={});var Ot;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(Ot||={});var kt=`vk.com`,At=async(e,t,n)=>{let r=new URL(`https://${kt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),jt(await(await fetch(r.toString())).json(),n)},jt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Mt(n)])),Mt=e=>Array.isArray(e)?e[0]:e,Nt;(e=>{e.RU=`ru`,e.EN=`en`})(Nt||={});var q=`__vk_vp_internals_exposure`;class Pt{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[q]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]||(window[q]={}),window[q][e]||(window[q][e]={}),window[q][e][t]||(window[q][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]&&window[q][e]&&window[q][e][t]&&(delete window[q][e][t],Object.keys(window[q][e]).length||delete window[q][e],Object.keys(window[q]).length||delete window[q])}}var Ft={};l(Ft,{subscribe:()=>zt,push:()=>Rt,destroy:()=>Lt,create:()=>It});var J=new Map,It=(e,t)=>J.set(e,t??[]),Lt=e=>J.delete(e),Rt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},zt=(e,t)=>{let n=J.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);J.set(e,t)}},Bt=e=>w({id:e.id,message:e.message,category:e.category,data:Vt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Vt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Ht=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Ut=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=T()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class Y{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new f;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=j();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=Ht(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Bt(e),...Ut(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await Y.loadPromise,Y.tracerErrorMap.has(this.componentName)||C(Y.appTracerModule))return;let{appTracerModule:e}=Y,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});S(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:xt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),Y.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){S(Y.loadPromise)||(Y.loadPromise=(async()=>{try{let e=new Promise((e,t)=>T().setTimeout(t,this.dynamicImportTimeout));Y.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){Y.loadPromise=null,console.error(e)}})())}}class Wt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Gt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},{NativeAbortSignal:Kt,NativeAbortController:qt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Jt(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function Yt(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class Xt{constructor(){Object.defineProperty(this,`listeners`,{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class X extends Xt{constructor(){super(),this.listeners||Xt.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new Z;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new Z;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class Z{constructor(){Object.defineProperty(this,`signal`,{value:new X,writable:!0,configurable:!0})}abort(e){let t=Yt(e),n=Jt(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(Z.prototype[Symbol.toStringTag]=`AbortController`,X.prototype[Symbol.toStringTag]=`AbortSignal`);function Zt(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log(`__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill`),!0):typeof e.Request==`function`&&!e.Request.prototype.hasOwnProperty(`signal`)||!e.AbortController}function Qt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Zt({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&Zt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),$t=$?Qt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,en=$?$t.fetch:Q.fetch,tn=$?$t.Request:Q.Request,nn=$?Z:Q.AbortController,rn=$?X:Q.AbortSignal,an=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Q.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},on=e=>Q.clearTimeout(e),sn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),cn=!sn(Q.requestIdleCallback)||!sn(Q.cancelIdleCallback),ln=cn?an:Q.requestIdleCallback,un=cn?on:Q.cancelIdleCallback,dn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
6
+ var e=Object.defineProperty,t=Object.getOwnPropertyNames,n=Object.getOwnPropertyDescriptor,r=Object.prototype.hasOwnProperty;function i(e){return this[e]}var a=a=>{var s=(o??=new WeakMap).get(a),c;if(s)return s;if(s=e({},`__esModule`,{value:!0}),a&&typeof a==`object`||typeof a==`function`)for(var l of t(a))r.call(s,l)||e(s,l,{get:i.bind(a,l),enumerable:!(c=n(a,l))||c.enumerable});return o.set(a,s),s},o,s=e=>e;function c(e,t){this[e]=s.bind(null,t)}var l=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0,configurable:!0,set:c.bind(n,r)})},u={};l(u,{withoutNullable:()=>w,videoSizeToQuality:()=>Ce,videoQualityToHeight:()=>we,videoHeightToQuality:()=>Se,urlCanParsePolyfilled:()=>un,timeout:()=>Fe,timeCodeToString:()=>Oe,throttleFn:()=>ke,throttle:()=>qe,tap:()=>ot,suppressAbort:()=>bt,skip:()=>ct,shareReplay:()=>ut,safeStorage:()=>le,requestIdleCallbackPolyfilled:()=>cn,pairwise:()=>it,once:()=>rt,observeElementSize:()=>ft,observableFrom:()=>Re,nowInt:()=>oe,now:()=>ae,noop:()=>h,merge:()=>Pe,mapTo:()=>nt,map:()=>R,loadVKLangPack:()=>kt,isValidURL:()=>mt,isNullable:()=>C,isNonNullable:()=>S,isLowerOrEqual:()=>ye,isLower:()=>M,isInvariantQuality:()=>N,isIntersecting:()=>ht,isHigherOrEqual:()=>ve,isHigher:()=>_e,isBrowserWindow:()=>re,isAbortError:()=>B,interval:()=>Ie,interpolate:()=>vt,getWindow:()=>T,getVideoQualityLabel:()=>De,getTraceSubscriptionMethod:()=>St,getRangeAroundIndex:()=>yt,getPlayerId:()=>_t,getMessageFromError:()=>xt,getHighestQuality:()=>be,getExponentialDelay:()=>ce,fromEvent:()=>ze,flattenObject:()=>z,filterChanged:()=>$e,filter:()=>Ye,fillWithDefault:()=>P,fetchPolyfilled:()=>$t,devNull:()=>Pt,detectEmbed:()=>ge,debounceFn:()=>F,debounce:()=>We,createDIContainer:()=>Wt,combine:()=>Ne,cloneDeepWith:()=>I,cloneDeep:()=>Ae,clearVideoElement:()=>pt,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>ln,buffer:()=>Ve,assertQualityIsExact:()=>Ee,assertNullable:()=>x,assertNotEmptyArray:()=>te,assertNonNullable:()=>b,assertNever:()=>p,assertEmptyArray:()=>ne,areQualitiesExact:()=>Te,addScript:()=>ie,abortable:()=>se,VideoQuality:()=>A,ValueSubject:()=>Me,VKNumericLanguage:()=>Dt,VERSION:()=>d,TracerFactory:()=>Tt,SubscriptionRemovable:()=>Be,Subscription:()=>f,Subject:()=>v,RequestPolyfilled:()=>en,ReplaySubject:()=>je,Observable:()=>_,Logger:()=>y,InternalsExposure:()=>Nt,InterfaceLanguage:()=>Mt,InjectionToken:()=>Ut,INTERNAL_EXPOSE_GLOBAL_KEY:()=>q,ErrorCategory:()=>Et,AppTracer:()=>Y,AbortSignalPolyfilled:()=>nn,AbortControllerPolyfilled:()=>tn}),module.exports=a(u);var d=`1.0.92-dev.82d0b1d07.0`;class f{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var p=e=>{throw Error(`${e} is value of unexpected type`)},m=e=>{},h=()=>{},ee=e=>{throw console.error(e),e},g=e=>{console.error(e)};class _{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?g:ee,r;r=t?typeof t==`function`?{next:t,error:h}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:h};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},a;try{a=this._subscribe(i)}catch(e){i.error?.(e)}return new f().add(()=>{switch(i.next=h,i.error=h,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return p(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class v extends _{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new f().add(()=>this.subscribers.delete(t))}}class y{log$=new v;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function b(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function x(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function S(e){return e!=null}function C(e){return e==null}var w=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>S(t)));function te(e,t){if(!e?.length)throw Error(t)}function ne(e,t){if(e?.length)throw Error(t)}var T=()=>globalThis,re=(e=T())=>!!(e.window&&e.screen),ie=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=T().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),ae=typeof T().performance?.now==`function`?()=>T().performance.now():()=>Date.now(),oe=()=>Math.trunc(ae()),se=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},ce=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},le={};l(le,{set:()=>fe,remove:()=>me,isPersistent:()=>ue,has:()=>pe,get:()=>de,clear:()=>he});var E,D,O=`vk-videoplayer-dummy-key-${Math.random()}`,k=()=>{if(D!==void 0)return D;try{localStorage.setItem(O,`test`),localStorage.removeItem(O),D=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),D=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)D=2;else throw e}else throw e}return D===2&&(E=new Map),D},ue=()=>k()===0,de=e=>{let t=k();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return E?.get(e);default:p(t)}},fe=(e,t)=>{let n=k();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:E?.set(e,t);return;default:p(n)}},pe=e=>{let t=k();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return E?.has(e)??!1;default:return p(t),!1}},me=e=>{let t=k();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:E?.delete(e);return;default:p(t)}},he=()=>{let e=k();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return E?.clear();default:p(e)}},ge=()=>{let e,t=[],n=T();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},A;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(A||={});var j={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},_e=(e,t)=>j[e].height>j[t].height,ve=(e,t)=>j[e].height>=j[t].height,M=(e,t)=>j[e].height<j[t].height,ye=(e,t)=>j[e].height<=j[t].height,be=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:M(e,t)?1:-1)[0],xe=Object.keys(j).sort((e,t)=>M(e,t)?-1:1),Se=(e,t=.02)=>[...xe].find(n=>j[n].height*(1+t)>=e),Ce=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return xe.find(e=>{let t=j[e];return t.width>=r&&t.height>=n})},we=e=>j[e].height,N=e=>e===`Invariant quality`,Te=e=>e.every(e=>!N(e));function Ee(e){if(N(e))throw Error(`Expected exact quality`)}var De=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},P=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=P(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Oe=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function F(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof T().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&T().cancelAnimationFrame(s),T().requestAnimationFrame(e)):setTimeout(e,t)}function ee(e){if(p){T().cancelAnimationFrame(e);return}clearTimeout(e)}function g(e){return l=e,s=h(y,t),u?m(e):o}function _(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function v(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function y(){let e=Date.now();if(v(e))return b(e);s=h(y,_(e))}function b(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function x(){s!==void 0&&ee(s),l=0,r=c=i=s=void 0}function S(){return s===void 0?o:b(Date.now())}function C(){return s!==void 0}function w(...e){let n=Date.now(),a=v(n);if(r=e,i=this,c=n,a){if(s===void 0)return g(c);if(d)return s=h(y,t),m(c)}return s===void 0&&(s=h(y,t)),o}return w.cancel=x,w.flush=S,w.pending=C,w}var ke=(e,t=0,n)=>F(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),I=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=I(e[r],t):n[r]=e[r]}return n},Ae=e=>I(e);class je extends v{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new f().add(()=>this.subscribers.delete(t))}}class Me extends v{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Ne(e){return new _(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new f)})}function Pe(...e){return new _(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new f))}var Fe=e=>new _(t=>{let n=T().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>T().clearTimeout(n)}),Ie=e=>new _(t=>{let n=T(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Le(e){return new _(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Re=Le,ze=(e,t)=>new _(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Be extends f{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ve(e){return t=>new _(n=>t.subscribe(new He(n,e)))}class He{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}var Ue={leading:!1,trailing:!0};function We(e,t=Ue){return n=>new _(r=>n.subscribe(new Ge(r,e,t)))}class Ge{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=T();S(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var Ke={leading:!0,trailing:!1};function qe(e,t=Ke){return n=>new _(r=>n.subscribe(new Je(r,e,t)))}class Je{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,C(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=T().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Ye(e){return t=>new _(n=>t.subscribe(new Xe(n,e)))}class Xe{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var Ze=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Qe=(e,t)=>e instanceof Object&&t instanceof Object?Ze(e,t):e===t;function $e(e=Qe){return t=>new _(n=>t.subscribe(new et(n,e)))}var L={};class et{destination;predicate;lastValue=L;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===L||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function R(e){return t=>new _(n=>t.subscribe(new tt(n,e)))}class tt{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function nt(e){return R(()=>e)}function rt(){return e=>new _(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function it(){return e=>new _(t=>e.subscribe(new at(t)))}class at{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function ot(e){return t=>new _(n=>t.subscribe(new st(n,e)))}class st{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function ct(e){return t=>new _(n=>t.subscribe(new lt(n,e)))}class lt{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(Error(`Count can not be less than zero`))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}}function ut(e=0){return t=>{let n=0,r=new je(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new _(e=>(n++,a(r.subscribe(e))))}}var dt=300,ft=(e,t=dt)=>new _(n=>{let r=T(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!re(r))return;let o=new r.ResizeObserver(ke(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),S(r)&&S(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),z=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=z(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},pt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},mt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ht=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),gt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),_t=e=>e!==void 0&&e!==``?e:gt().toString();function vt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function yt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var B=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),bt=e=>{if(!B(e))throw e};function xt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}var St=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?z(n):{value:n})},V=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class H{dynamicImportTimeout=5e3;subscription=new f;span;context;childTracers=[];initPromise;getRootTracerContext;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n}){H.dynamicImportStatus===`not_started`&&(H.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=H.dynamicImportPromise.then(i=>{H.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},r)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(C(i))return;let{opentelemetryApi:a}=H.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{S(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(H.dynamicImportStatus===`not_started`){H.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);H.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},H.dynamicImportStatus=`completed`}catch{H.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return C(this.span)||H.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...V(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...V(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...V(t),type:`critical`},n)})}createComponentTracer(e){let t=new H({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.()});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe())})}}var U=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class Ct extends H{attributes$=new Me(null);constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=H.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:U}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(V(e))}addSubscription(e){this.subscription.add(e)}}class W{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new W({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var G=()=>!0,K={level:0,filter:G,name:`Noname Tracer`,outputMethod:`log`};class wt{name;filter=G;level=K.level;outputMethod=K.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??K.name}log(e,t){this.logDebug(e,t)}error(e,t){this.logError(e,t)}critical(e,t){this.logError(e,t)}createComponentTracer(e){let t=new wt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||T().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&T().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Tt{static createRootTracer(e=`fake`){switch(e){case`real`:return new Ct;case`debug`:return new wt;default:return new W}}}var Et;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(Et||={});var Dt;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(Dt||={});var Ot=`vk.com`,kt=async(e,t,n)=>{let r=new URL(`https://${Ot}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),At(await(await fetch(r.toString())).json(),n)},At=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),jt(n)])),jt=e=>Array.isArray(e)?e[0]:e,Mt;(e=>{e.RU=`ru`,e.EN=`en`})(Mt||={});var q=`__vk_vp_internals_exposure`;class Nt{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[q]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]||(window[q]={}),window[q][e]||(window[q][e]={}),window[q][e][t]||(window[q][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[q]&&window[q][e]&&window[q][e][t]&&(delete window[q][e][t],Object.keys(window[q][e]).length||delete window[q][e],Object.keys(window[q]).length||delete window[q])}}var Pt={};l(Pt,{subscribe:()=>Rt,push:()=>Lt,destroy:()=>It,create:()=>Ft});var J=new Map,Ft=(e,t)=>J.set(e,t??[]),It=e=>J.delete(e),Lt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Rt=(e,t)=>{let n=J.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);J.set(e,t)}},zt=e=>w({id:e.id,message:e.message,category:e.category,data:Bt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Bt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Vt=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Ht=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=T()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class Y{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new f;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=ge();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=Y.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=Vt(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...zt(e),...Ht(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await Y.loadPromise,Y.tracerErrorMap.has(this.componentName)||C(Y.appTracerModule))return;let{appTracerModule:e}=Y,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});S(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:U,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),Y.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){S(Y.loadPromise)||(Y.loadPromise=(async()=>{try{let e=new Promise((e,t)=>T().setTimeout(t,this.dynamicImportTimeout));Y.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){Y.loadPromise=null,console.error(e)}})())}}class Ut{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Wt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},clear(){e.clear(),t.clear(),r.clear(),n.clear()}}},{NativeAbortSignal:Gt,NativeAbortController:Kt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function qt(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function Jt(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class Yt{constructor(){Object.defineProperty(this,`listeners`,{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class X extends Yt{constructor(){super(),this.listeners||Yt.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new Z;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new Z;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class Z{constructor(){Object.defineProperty(this,`signal`,{value:new X,writable:!0,configurable:!0})}abort(e){let t=Jt(e),n=qt(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(Z.prototype[Symbol.toStringTag]=`AbortController`,X.prototype[Symbol.toStringTag]=`AbortSignal`);function Xt(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log(`__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill`),!0):typeof e.Request==`function`&&!e.Request.prototype.hasOwnProperty(`signal`)||!e.AbortController}function Zt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Xt({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&Xt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Qt=$?Zt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,$t=$?Qt.fetch:Q.fetch,en=$?Qt.Request:Q.Request,tn=$?Z:Q.AbortController,nn=$?X:Q.AbortSignal,rn=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Q.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},an=e=>Q.clearTimeout(e),on=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),sn=!on(Q.requestIdleCallback)||!on(Q.cancelIdleCallback),cn=sn?rn:Q.requestIdleCallback,ln=sn?an:Q.cancelIdleCallback,un=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};
package/esnext.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.92-dev.53fc4c12e.0
3
- * Mon, 08 Jun 2026 14:14:39 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.92-dev.82d0b1d07.0
3
+ * Thu, 11 Jun 2026 11:32:51 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-92/doc/
5
5
  */
6
- var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i=`1.0.92-dev.53fc4c12e.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=(e=x())=>!!(e.window&&e.screen),ee=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=x().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),C=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),w=()=>Math.trunc(C()),T=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},te=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},ne={};r(ne,{set:()=>ae,remove:()=>se,isPersistent:()=>re,has:()=>oe,get:()=>ie,clear:()=>ce});var E,D,O=`vk-videoplayer-dummy-key-${Math.random()}`,k=()=>{if(D!==void 0)return D;try{localStorage.setItem(O,`test`),localStorage.removeItem(O),D=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),D=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)D=2;else throw e}else throw e}return D===2&&(E=new Map),D},re=()=>k()===0,ie=e=>{let t=k();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return E?.get(e);default:o(t)}},ae=(e,t)=>{let n=k();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:E?.set(e,t);return;default:o(n)}},oe=e=>{let t=k();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return E?.has(e)??!1;default:return o(t),!1}},se=e=>{let t=k();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:E?.delete(e);return;default:o(t)}},ce=()=>{let e=k();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return E?.clear();default:o(e)}},A=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},le;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(le||={});var j={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},ue=(e,t)=>j[e].height>j[t].height,de=(e,t)=>j[e].height>=j[t].height,M=(e,t)=>j[e].height<j[t].height,fe=(e,t)=>j[e].height<=j[t].height,pe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:M(e,t)?1:-1)[0],N=Object.keys(j).sort((e,t)=>M(e,t)?-1:1),me=(e,t=.02)=>[...N].find(n=>j[n].height*(1+t)>=e),he=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return N.find(e=>{let t=j[e];return t.width>=r&&t.height>=n})},ge=e=>j[e].height,P=e=>e===`Invariant quality`,_e=e=>e.every(e=>!P(e));function ve(e){if(P(e))throw Error(`Expected exact quality`)}var ye=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},be=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=be(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},xe=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function Se(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return S(e);s=h(b,v(e))}function S(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function ee(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function C(){return s===void 0?o:S(Date.now())}function w(){return s!==void 0}function T(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return T.cancel=ee,T.flush=C,T.pending=w,T}var Ce=(e,t=0,n)=>Se(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),F=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=F(e[r],t):n[r]=e[r]}return n},we=e=>F(e);class I extends f{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class L extends f{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Te(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function Ee(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var De=e=>new d(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),Oe=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function ke(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ae=ke,je=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Me extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ne(e){return t=>new d(n=>t.subscribe(new Pe(n,e)))}class Pe{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}var Fe={leading:!1,trailing:!0};function Ie(e,t=Fe){return n=>new d(r=>n.subscribe(new Le(r,e,t)))}class Le{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=x();g(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var Re={leading:!0,trailing:!1};function ze(e,t=Re){return n=>new d(r=>n.subscribe(new Be(r,e,t)))}class Be{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=x().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Ve(e){return t=>new d(n=>t.subscribe(new He(n,e)))}class He{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var Ue=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},We=(e,t)=>e instanceof Object&&t instanceof Object?Ue(e,t):e===t;function Ge(e=We){return t=>new d(n=>t.subscribe(new Ke(n,e)))}var R={};class Ke{destination;predicate;lastValue=R;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===R||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function z(e){return t=>new d(n=>t.subscribe(new qe(n,e)))}class qe{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function Je(e){return z(()=>e)}function Ye(){return e=>new d(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function Xe(){return e=>new d(t=>e.subscribe(new Ze(t)))}class Ze{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function Qe(e){return t=>new d(n=>t.subscribe(new $e(n,e)))}class $e{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function et(e){return t=>new d(n=>t.subscribe(new tt(n,e)))}class tt{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(Error(`Count can not be less than zero`))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}}function nt(e=0){return t=>{let n=0,r=new I(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var rt=300,it=(e,t=rt)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!S(r))return;let o=new r.ResizeObserver(Ce(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),B=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=B(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},at=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ot=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},st=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ct=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),lt=e=>e!==void 0&&e!==``?e:ct().toString();function ut(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function dt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var V=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),ft=e=>{if(!V(e))throw e};function pt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class H{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];g(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var mt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?B(n):{value:n})},U=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class W{dynamicImportTimeout=5e3;subscription=new a;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){g(r)&&r>0&&(this.eventsBuffer=new H(r)),W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=W.dynamicImportPromise.then(r=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(W.dynamicImportStatus===`not_started`){W.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);W.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||W.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){g(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...U(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(g(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var ht=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class gt extends W{attributes$=new L(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=W.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:ht}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(U(e))}addSubscription(e){this.subscription.add(e)}}class _t{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new _t({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var vt=()=>!0,G={level:0,filter:vt,name:`Noname Tracer`,outputMethod:`log`};class yt{name;filter=vt;level=G.level;outputMethod=G.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??G.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new yt({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class bt{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new gt(t);case`debug`:return new yt;default:return new _t}}}var xt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(xt||={});var St;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(St||={});var Ct=`vk.com`,wt=async(e,t,n)=>{let r=new URL(`https://${Ct}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Tt(await(await fetch(r.toString())).json(),n)},Tt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Et(n)])),Et=e=>Array.isArray(e)?e[0]:e,Dt;(e=>{e.RU=`ru`,e.EN=`en`})(Dt||={});var K=`__vk_vp_internals_exposure`;class Ot{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[K]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]||(window[K]={}),window[K][e]||(window[K][e]={}),window[K][e][t]||(window[K][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]&&window[K][e]&&window[K][e][t]&&(delete window[K][e][t],Object.keys(window[K][e]).length||delete window[K][e],Object.keys(window[K]).length||delete window[K])}}var kt={};r(kt,{subscribe:()=>Nt,push:()=>Mt,destroy:()=>jt,create:()=>At});var q=new Map,At=(e,t)=>q.set(e,t??[]),jt=e=>q.delete(e),Mt=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Nt=(e,t)=>{let n=q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);q.set(e,t)}},Pt=e=>v({id:e.id,message:e.message,category:e.category,data:Ft(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Ft(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var It=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Lt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class J{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=A();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=J.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=It(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Pt(e),...Lt(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await J.loadPromise,J.tracerErrorMap.has(this.componentName)||_(J.appTracerModule))return;let{appTracerModule:e}=J,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:ht,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),J.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){g(J.loadPromise)||(J.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));J.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){J.loadPromise=null,console.error(e)}})())}}class Rt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var zt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}},{NativeAbortSignal:Bt,NativeAbortController:Vt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Ht(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function Ut(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class Wt{constructor(){Object.defineProperty(this,`listeners`,{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class Y extends Wt{constructor(){super(),this.listeners||Wt.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new X;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new X;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class X{constructor(){Object.defineProperty(this,`signal`,{value:new Y,writable:!0,configurable:!0})}abort(e){let t=Ut(e),n=Ht(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(X.prototype[Symbol.toStringTag]=`AbortController`,Y.prototype[Symbol.toStringTag]=`AbortSignal`);function Gt(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log(`__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill`),!0):typeof e.Request==`function`&&!e.Request.prototype.hasOwnProperty(`signal`)||!e.AbortController}function Kt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Gt({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Z=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,Q=`fetch`in Z&&Gt({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}),qt=Q?Kt({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}):void 0,Jt=Q?qt.fetch:Z.fetch,Yt=Q?qt.Request:Z.Request,Xt=Q?X:Z.AbortController,Zt=Q?Y:Z.AbortSignal,Qt=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Z.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},$t=e=>Z.clearTimeout(e),en=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$=!en(Z.requestIdleCallback)||!en(Z.cancelIdleCallback),tn=$?Qt:Z.requestIdleCallback,nn=$?$t:Z.cancelIdleCallback,rn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};export{v as withoutNullable,he as videoSizeToQuality,ge as videoQualityToHeight,me as videoHeightToQuality,rn as urlCanParsePolyfilled,De as timeout,xe as timeCodeToString,Ce as throttleFn,ze as throttle,Qe as tap,ft as suppressAbort,et as skip,nt as shareReplay,ne as safeStorage,tn as requestIdleCallbackPolyfilled,Xe as pairwise,Ye as once,it as observeElementSize,Ae as observableFrom,w as nowInt,C as now,c as noop,Ee as merge,Je as mapTo,z as map,wt as loadVKLangPack,ot as isValidURL,_ as isNullable,g as isNonNullable,fe as isLowerOrEqual,M as isLower,P as isInvariantQuality,st as isIntersecting,de as isHigherOrEqual,ue as isHigher,S as isBrowserWindow,V as isAbortError,Oe as interval,ut as interpolate,x as getWindow,ye as getVideoQualityLabel,mt as getTraceSubscriptionMethod,dt as getRangeAroundIndex,lt as getPlayerId,pt as getMessageFromError,pe as getHighestQuality,te as getExponentialDelay,je as fromEvent,B as flattenObject,Ge as filterChanged,Ve as filter,be as fillWithDefault,Jt as fetchPolyfilled,kt as devNull,A as detectEmbed,Se as debounceFn,Ie as debounce,zt as createDIContainer,Te as combine,F as cloneDeepWith,we as cloneDeep,at as clearVideoElement,s as checkNever,nn as cancelIdleCallbackPolyfilled,Ne as buffer,ve as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,_e as areQualitiesExact,ee as addScript,T as abortable,le as VideoQuality,L as ValueSubject,St as VKNumericLanguage,i as VERSION,bt as TracerFactory,Me as SubscriptionRemovable,a as Subscription,f as Subject,Yt as RequestPolyfilled,I as ReplaySubject,d as Observable,p as Logger,Ot as InternalsExposure,Dt as InterfaceLanguage,Rt as InjectionToken,K as INTERNAL_EXPOSE_GLOBAL_KEY,xt as ErrorCategory,H as CircularBuffer,J as AppTracer,Zt as AbortSignalPolyfilled,Xt as AbortControllerPolyfilled};
6
+ var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i=`1.0.92-dev.82d0b1d07.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=(e=x())=>!!(e.window&&e.screen),ee=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=x().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),C=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),te=()=>Math.trunc(C()),w=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},ne=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},re={};r(re,{set:()=>oe,remove:()=>ce,isPersistent:()=>ie,has:()=>se,get:()=>ae,clear:()=>le});var T,E,D=`vk-videoplayer-dummy-key-${Math.random()}`,O=()=>{if(E!==void 0)return E;try{localStorage.setItem(D,`test`),localStorage.removeItem(D),E=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(D),E=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)E=2;else throw e}else throw e}return E===2&&(T=new Map),E},ie=()=>O()===0,ae=e=>{let t=O();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return T?.get(e);default:o(t)}},oe=(e,t)=>{let n=O();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:T?.set(e,t);return;default:o(n)}},se=e=>{let t=O();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return T?.has(e)??!1;default:return o(t),!1}},ce=e=>{let t=O();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:T?.delete(e);return;default:o(t)}},le=()=>{let e=O();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return T?.clear();default:o(e)}},k=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},ue;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(ue||={});var A={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},de=(e,t)=>A[e].height>A[t].height,fe=(e,t)=>A[e].height>=A[t].height,j=(e,t)=>A[e].height<A[t].height,pe=(e,t)=>A[e].height<=A[t].height,me=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:j(e,t)?1:-1)[0],M=Object.keys(A).sort((e,t)=>j(e,t)?-1:1),he=(e,t=.02)=>[...M].find(n=>A[n].height*(1+t)>=e),ge=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return M.find(e=>{let t=A[e];return t.width>=r&&t.height>=n})},_e=e=>A[e].height,N=e=>e===`Invariant quality`,ve=e=>e.every(e=>!N(e));function ye(e){if(N(e))throw Error(`Expected exact quality`)}var be=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},P=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=P(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},xe=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function F(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return S(e);s=h(b,v(e))}function S(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function ee(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function C(){return s===void 0?o:S(Date.now())}function te(){return s!==void 0}function w(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return w.cancel=ee,w.flush=C,w.pending=te,w}var Se=(e,t=0,n)=>F(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),I=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=I(e[r],t):n[r]=e[r]}return n},Ce=e=>I(e);class we extends f{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class Te extends f{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function Ee(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function De(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var Oe=e=>new d(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),ke=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Ae(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var je=Ae,Me=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Ne extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Pe(e){return t=>new d(n=>t.subscribe(new Fe(n,e)))}class Fe{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}var Ie={leading:!1,trailing:!0};function Le(e,t=Ie){return n=>new d(r=>n.subscribe(new Re(r,e,t)))}class Re{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=x();g(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var ze={leading:!0,trailing:!1};function Be(e,t=ze){return n=>new d(r=>n.subscribe(new Ve(r,e,t)))}class Ve{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=x().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function He(e){return t=>new d(n=>t.subscribe(new Ue(n,e)))}class Ue{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var We=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Ge=(e,t)=>e instanceof Object&&t instanceof Object?We(e,t):e===t;function Ke(e=Ge){return t=>new d(n=>t.subscribe(new Je(n,e)))}var qe={};class Je{destination;predicate;lastValue=qe;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===qe||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function Ye(e){return t=>new d(n=>t.subscribe(new Xe(n,e)))}class Xe{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function Ze(e){return Ye(()=>e)}function Qe(){return e=>new d(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function $e(){return e=>new d(t=>e.subscribe(new et(t)))}class et{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function tt(e){return t=>new d(n=>t.subscribe(new nt(n,e)))}class nt{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function rt(e){return t=>new d(n=>t.subscribe(new it(n,e)))}class it{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(Error(`Count can not be less than zero`))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}}function at(e=0){return t=>{let n=0,r=new we(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var ot=300,st=(e,t=ot)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!S(r))return;let o=new r.ResizeObserver(Se(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),L=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=L(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},ct=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},lt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ut=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),dt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ft=e=>e!==void 0&&e!==``?e:dt().toString();function pt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function mt(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var R=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),ht=e=>{if(!R(e))throw e};function gt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}var _t=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?L(n):{value:n})},z=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class B{dynamicImportTimeout=5e3;subscription=new a;span;context;childTracers=[];initPromise;getRootTracerContext;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n}){B.dynamicImportStatus===`not_started`&&(B.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=B.dynamicImportPromise.then(i=>{B.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},r)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=B.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(B.dynamicImportStatus===`not_started`){B.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);B.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},B.dynamicImportStatus=`completed`}catch{B.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||B.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...z(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...z(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...z(t),type:`critical`},n)})}createComponentTracer(e){let t=new B({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.()});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe())})}}var V=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class vt extends B{attributes$=new Te(null);constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=B.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:V}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(z(e))}addSubscription(e){this.subscription.add(e)}}class H{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new H({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var U=()=>!0,W={level:0,filter:U,name:`Noname Tracer`,outputMethod:`log`};class G{name;filter=U;level=W.level;outputMethod=W.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??W.name}log(e,t){this.logDebug(e,t)}error(e,t){this.logError(e,t)}critical(e,t){this.logError(e,t)}createComponentTracer(e){let t=new G({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class yt{static createRootTracer(e=`fake`){switch(e){case`real`:return new vt;case`debug`:return new G;default:return new H}}}var bt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(bt||={});var xt;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(xt||={});var St=`vk.com`,Ct=async(e,t,n)=>{let r=new URL(`https://${St}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),wt(await(await fetch(r.toString())).json(),n)},wt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Tt(n)])),Tt=e=>Array.isArray(e)?e[0]:e,Et;(e=>{e.RU=`ru`,e.EN=`en`})(Et||={});var K=`__vk_vp_internals_exposure`;class Dt{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[K]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]||(window[K]={}),window[K][e]||(window[K][e]={}),window[K][e][t]||(window[K][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[K]&&window[K][e]&&window[K][e][t]&&(delete window[K][e][t],Object.keys(window[K][e]).length||delete window[K][e],Object.keys(window[K]).length||delete window[K])}}var Ot={};r(Ot,{subscribe:()=>Mt,push:()=>jt,destroy:()=>At,create:()=>kt});var q=new Map,kt=(e,t)=>q.set(e,t??[]),At=e=>q.delete(e),jt=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Mt=(e,t)=>{let n=q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);q.set(e,t)}},Nt=e=>v({id:e.id,message:e.message,category:e.category,data:Pt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Pt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Ft=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},It=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class J{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=k();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=J.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=Ft(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Nt(e),...It(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await J.loadPromise,J.tracerErrorMap.has(this.componentName)||_(J.appTracerModule))return;let{appTracerModule:e}=J,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:V,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),J.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){g(J.loadPromise)||(J.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));J.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){J.loadPromise=null,console.error(e)}})())}}class Lt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Rt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},clear(){e.clear(),t.clear(),r.clear(),n.clear()}}},{NativeAbortSignal:zt,NativeAbortController:Bt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Vt(e){let t;try{t=new Event(`abort`)}catch{typeof document<`u`?document.createEvent?(t=document.createEvent(`Event`),t.initEvent(`abort`,!1,!1)):(t=document.createEventObject(),t.type=`abort`):t={type:`abort`,bubbles:!1,cancelable:!1}}return t.reason=e,t}function Ht(e){if(e===void 0)if(typeof document>`u`)e=Error(`This operation was aborted`),e.name=`AbortError`;else try{e=new DOMException(`signal is aborted without reason`),Object.defineProperty(e,`name`,{value:`AbortError`})}catch{e=Error(`This operation was aborted`),e.name=`AbortError`}return e}class Ut{constructor(){Object.defineProperty(this,`listeners`,{value:{},writable:!0,configurable:!0})}addEventListener(e,t,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push({callback:t,options:n})}removeEventListener(e,t){if(!(e in this.listeners))return;let n=this.listeners[e];for(let e=0,r=n.length;e<r;e++)if(n[e].callback===t){n.splice(e,1);return}}dispatchEvent(e){if(!(e.type in this.listeners))return;let t=this.listeners[e.type].slice();for(let n=0,r=t.length;n<r;n++){let r=t[n];try{r.callback.call(this,e)}catch(e){Promise.resolve().then(()=>{throw e})}r.options&&r.options.once&&this.removeEventListener(e.type,r.callback)}return!e.defaultPrevented}}class Y extends Ut{constructor(){super(),this.listeners||Ut.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)}throwIfAborted(){let{aborted:e,reason:t=`Aborted`}=this;if(e)throw t}static timeout(e){let t=new X;return setTimeout(()=>t.abort(new DOMException(`This signal is timeout in ${e}ms`,`TimeoutError`)),e),t.signal}static any(e){let t=new X;function n(){t.abort(this.reason),r()}function r(){for(let t of e)t.removeEventListener(`abort`,n)}for(let r of e)if(r.aborted){t.abort(r.reason);break}else r.addEventListener(`abort`,n);return t.signal}}class X{constructor(){Object.defineProperty(this,`signal`,{value:new Y,writable:!0,configurable:!0})}abort(e){let t=Ht(e),n=Vt(t);this.signal.reason=t,this.signal.dispatchEvent(n)}toString(){return`[object AbortController]`}}typeof Symbol<`u`&&Symbol.toStringTag&&(X.prototype[Symbol.toStringTag]=`AbortController`,Y.prototype[Symbol.toStringTag]=`AbortSignal`);function Z(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log(`__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill`),!0):typeof e.Request==`function`&&!e.Request.prototype.hasOwnProperty(`signal`)||!e.AbortController}function Wt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Z({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:a};let a=n;(a&&!a.prototype.hasOwnProperty(`signal`)||i)&&(a=function(e,t){let r;t&&t.signal&&(r=t.signal,delete t.signal);let i=new n(e,t);return r&&Object.defineProperty(i,`signal`,{writable:!1,enumerable:!1,configurable:!0,value:r}),i},a.prototype=n.prototype);let o=t;return{fetch:(e,t)=>{let n=a&&a.prototype.isPrototypeOf(e)?e.signal:t?t.signal:void 0;if(n){let r;try{r=new DOMException(`Aborted`,`AbortError`)}catch{r=Error(`Aborted`),r.name=`AbortError`}if(n.aborted)return Promise.reject(r);let i=new Promise((e,t)=>{n.addEventListener(`abort`,()=>t(r),{once:!0})});return t&&t.signal&&delete t.signal,Promise.race([i,o(e,t)])}return o(e,t)},Request:a}}var Q=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window,$=`fetch`in Q&&Z({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Gt=$?Wt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Kt=$?Gt.fetch:Q.fetch,qt=$?Gt.Request:Q.Request,Jt=$?X:Q.AbortController,Yt=$?Y:Q.AbortSignal,Xt=(e,t={})=>{let n=t.timeout||1,r=performance.now();return Q.setTimeout(()=>{e({get didTimeout(){return t.timeout?!1:performance.now()-r-1>n},timeRemaining(){return Math.max(0,1+(performance.now()-r))}})},1)},Zt=e=>Q.clearTimeout(e),Qt=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),$t=!Qt(Q.requestIdleCallback)||!Qt(Q.cancelIdleCallback),en=$t?Xt:Q.requestIdleCallback,tn=$t?Zt:Q.cancelIdleCallback,nn=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};export{v as withoutNullable,ge as videoSizeToQuality,_e as videoQualityToHeight,he as videoHeightToQuality,nn as urlCanParsePolyfilled,Oe as timeout,xe as timeCodeToString,Se as throttleFn,Be as throttle,tt as tap,ht as suppressAbort,rt as skip,at as shareReplay,re as safeStorage,en as requestIdleCallbackPolyfilled,$e as pairwise,Qe as once,st as observeElementSize,je as observableFrom,te as nowInt,C as now,c as noop,De as merge,Ze as mapTo,Ye as map,Ct as loadVKLangPack,lt as isValidURL,_ as isNullable,g as isNonNullable,pe as isLowerOrEqual,j as isLower,N as isInvariantQuality,ut as isIntersecting,fe as isHigherOrEqual,de as isHigher,S as isBrowserWindow,R as isAbortError,ke as interval,pt as interpolate,x as getWindow,be as getVideoQualityLabel,_t as getTraceSubscriptionMethod,mt as getRangeAroundIndex,ft as getPlayerId,gt as getMessageFromError,me as getHighestQuality,ne as getExponentialDelay,Me as fromEvent,L as flattenObject,Ke as filterChanged,He as filter,P as fillWithDefault,Kt as fetchPolyfilled,Ot as devNull,k as detectEmbed,F as debounceFn,Le as debounce,Rt as createDIContainer,Ee as combine,I as cloneDeepWith,Ce as cloneDeep,ct as clearVideoElement,s as checkNever,tn as cancelIdleCallbackPolyfilled,Pe as buffer,ye as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,ve as areQualitiesExact,ee as addScript,w as abortable,ue as VideoQuality,Te as ValueSubject,xt as VKNumericLanguage,i as VERSION,yt as TracerFactory,Ne as SubscriptionRemovable,a as Subscription,f as Subject,qt as RequestPolyfilled,we as ReplaySubject,d as Observable,p as Logger,Dt as InternalsExposure,Et as InterfaceLanguage,Lt as InjectionToken,K as INTERNAL_EXPOSE_GLOBAL_KEY,bt as ErrorCategory,J as AppTracer,Yt as AbortSignalPolyfilled,Jt as AbortControllerPolyfilled};
package/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.92-dev.53fc4c12e.0
3
- * Mon, 08 Jun 2026 14:14:39 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.92-dev.82d0b1d07.0
3
+ * Thu, 11 Jun 2026 11:32:51 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-92/doc/
5
5
  */
6
- var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i=`1.0.92-dev.53fc4c12e.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=(e=x())=>!!(e.window&&e.screen),C=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=x().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),w=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),T=()=>Math.trunc(w()),E=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},ee=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},D={};r(D,{set:()=>re,remove:()=>ae,isPersistent:()=>te,has:()=>ie,get:()=>ne,clear:()=>oe});var O,k,A=`vk-videoplayer-dummy-key-${Math.random()}`,j=()=>{if(k!==void 0)return k;try{localStorage.setItem(A,`test`),localStorage.removeItem(A),k=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),k=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)k=2;else throw e}else throw e}return k===2&&(O=new Map),k},te=()=>j()===0,ne=e=>{let t=j();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return O?.get(e);default:o(t)}},re=(e,t)=>{let n=j();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:O?.set(e,t);return;default:o(n)}},ie=e=>{let t=j();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return O?.has(e)??!1;default:return o(t),!1}},ae=e=>{let t=j();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:O?.delete(e);return;default:o(t)}},oe=()=>{let e=j();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:o(e)}},se=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},ce;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(ce||={});var M={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},le=(e,t)=>M[e].height>M[t].height,ue=(e,t)=>M[e].height>=M[t].height,N=(e,t)=>M[e].height<M[t].height,de=(e,t)=>M[e].height<=M[t].height,fe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:N(e,t)?1:-1)[0],P=Object.keys(M).sort((e,t)=>N(e,t)?-1:1),pe=(e,t=.02)=>[...P].find(n=>M[n].height*(1+t)>=e),me=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return P.find(e=>{let t=M[e];return t.width>=r&&t.height>=n})},he=e=>M[e].height,F=e=>e===`Invariant quality`,ge=e=>e.every(e=>!F(e));function _e(e){if(F(e))throw Error(`Expected exact quality`)}var ve=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},I=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=I(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},ye=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function L(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return S(e);s=h(b,v(e))}function S(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function C(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function w(){return s===void 0?o:S(Date.now())}function T(){return s!==void 0}function E(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return E.cancel=C,E.flush=w,E.pending=T,E}var R=(e,t=0,n)=>L(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),z=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=z(e[r],t):n[r]=e[r]}return n},be=e=>z(e);class B extends f{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class V extends f{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function xe(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function Se(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var Ce=e=>new d(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),we=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Te(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var Ee=Te,De=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Oe extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function ke(e){return t=>new d(n=>t.subscribe(new Ae(n,e)))}class Ae{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}var je={leading:!1,trailing:!0};function Me(e,t=je){return n=>new d(r=>n.subscribe(new Ne(r,e,t)))}class Ne{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=x();g(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var Pe={leading:!0,trailing:!1};function Fe(e,t=Pe){return n=>new d(r=>n.subscribe(new Ie(r,e,t)))}class Ie{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=x().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Le(e){return t=>new d(n=>t.subscribe(new Re(n,e)))}class Re{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var ze=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Be=(e,t)=>e instanceof Object&&t instanceof Object?ze(e,t):e===t;function Ve(e=Be){return t=>new d(n=>t.subscribe(new He(n,e)))}var H={};class He{destination;predicate;lastValue=H;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===H||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function U(e){return t=>new d(n=>t.subscribe(new Ue(n,e)))}class Ue{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function We(e){return U(()=>e)}function Ge(){return e=>new d(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function Ke(){return e=>new d(t=>e.subscribe(new qe(t)))}class qe{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function Je(e){return t=>new d(n=>t.subscribe(new Ye(n,e)))}class Ye{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function Xe(e){return t=>new d(n=>t.subscribe(new Ze(n,e)))}class Ze{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(Error(`Count can not be less than zero`))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}}function Qe(e=0){return t=>{let n=0,r=new B(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var $e=300,et=(e,t=$e)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!S(r))return;let o=new r.ResizeObserver(R(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),W=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=W(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},tt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},nt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},rt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),it=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),at=e=>e!==void 0&&e!==``?e:it().toString();function ot(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function st(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var G=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),ct=e=>{if(!G(e))throw e};function lt(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}class K{buffer;writeIndex=0;count=0;capacity;constructor(e){if(e<=0)throw Error(`Capacity must be greater than 0`);this.capacity=e,this.buffer=Array.from({length:e}).fill(null)}add(e){this.buffer[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.count<this.capacity&&this.count++}*[Symbol.iterator](){if(this.count===0)return;let e=this.count<this.capacity?0:this.writeIndex;for(let t=0;t<this.count;t++){let t=this.buffer[e];g(t)&&(yield t),e=(e+1)%this.capacity}}clear(){this.buffer.fill(null),this.writeIndex=0,this.count=0}get size(){return this.count}get maxCapacity(){return this.capacity}}var ut=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?W(n):{value:n})},q=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class J{dynamicImportTimeout=5e3;subscription=new a;span;context;childTracers=[];initPromise;getRootTracerContext;eventsBuffer=null;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n,eventsBufferSize:r}){g(r)&&r>0&&(this.eventsBuffer=new K(r)),J.dynamicImportStatus===`not_started`&&(J.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=J.dynamicImportPromise.then(r=>{J.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=J.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(J.dynamicImportStatus===`not_started`){J.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);J.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},J.dynamicImportStatus=`completed`}catch{J.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||J.dynamicImportStatus===`failed`}addEventToBuffer(e,t,n,r){g(this.eventsBuffer)&&this.eventsBuffer.add({name:e,attributes:t,type:n,timestamp:r})}addEventToSpan(e,t,n,r){this.span.addEvent(e,{...q(t),type:n},r)}log(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`log`,r)}):this.addEventToBuffer(e,t,`log`,r)}error(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`error`,r)}):this.addEventToBuffer(e,t,`error`,r)}critical(e,t,n=!1){let r=Date.now();n?this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.addEventToSpan(e,t,`critical`,r)}):this.addEventToBuffer(e,t,`critical`,r)}createComponentTracer(e){let t=new J({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.(),eventsBufferSize:this.eventsBuffer?.maxCapacity});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{if(!this.isComponentTracerNotInitialized()){if(g(this.eventsBuffer))for(let e of this.eventsBuffer)this.addEventToSpan(e.name,e.attributes,e.type,e.timestamp);this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe()}})}}var dt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class ft extends J{attributes$=new V(null);constructor(e){super({name:`Root`,eventsBufferSize:e})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=J.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:dt}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(q(e))}addSubscription(e){this.subscription.add(e)}}class pt{fakeTraceId;constructor(e){}log(e,t,n){}error(e,t,n){}critical(e,t,n){}createComponentTracer(e){return new pt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var mt=()=>!0,Y={level:0,filter:mt,name:`Noname Tracer`,outputMethod:`log`};class X{name;filter=mt;level=Y.level;outputMethod=Y.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??Y.name}log(e,t,n){this.logDebug(e,t)}error(e,t,n){this.logError(e,t)}critical(e,t,n){this.logError(e,t)}createComponentTracer(e){let t=new X({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class ht{static createRootTracer(e=`fake`,t){switch(e){case`real`:return new ft(t);case`debug`:return new X;default:return new pt}}}var gt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(gt||={});var _t;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(_t||={});var vt=`vk.com`,yt=async(e,t,n)=>{let r=new URL(`https://${vt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),bt(await(await fetch(r.toString())).json(),n)},bt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),xt(n)])),xt=e=>Array.isArray(e)?e[0]:e,St;(e=>{e.RU=`ru`,e.EN=`en`})(St||={});var Z=`__vk_vp_internals_exposure`;class Ct{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[Z]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[Z]||(window[Z]={}),window[Z][e]||(window[Z][e]={}),window[Z][e][t]||(window[Z][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[Z]&&window[Z][e]&&window[Z][e][t]&&(delete window[Z][e][t],Object.keys(window[Z][e]).length||delete window[Z][e],Object.keys(window[Z]).length||delete window[Z])}}var wt={};r(wt,{subscribe:()=>Ot,push:()=>Dt,destroy:()=>Et,create:()=>Tt});var Q=new Map,Tt=(e,t)=>Q.set(e,t??[]),Et=e=>Q.delete(e),Dt=(e,t)=>{let n=Q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Ot=(e,t)=>{let n=Q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);Q.set(e,t)}},kt=e=>v({id:e.id,message:e.message,category:e.category,data:At(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function At(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var jt=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},Mt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class ${static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=se();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=$.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=jt(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...kt(e),...Mt(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await $.loadPromise,$.tracerErrorMap.has(this.componentName)||_($.appTracerModule))return;let{appTracerModule:e}=$,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:dt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),$.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){g($.loadPromise)||($.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));$.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){$.loadPromise=null,console.error(e)}})())}}class Nt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Pt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map,i=new Set;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},registerCleanup(e){i.add(e)},clear(){i.forEach(e=>e()),i.clear(),e.clear(),t.clear(),r.clear(),n.clear()}}};export{v as withoutNullable,me as videoSizeToQuality,he as videoQualityToHeight,pe as videoHeightToQuality,Ce as timeout,ye as timeCodeToString,R as throttleFn,Fe as throttle,Je as tap,ct as suppressAbort,Xe as skip,Qe as shareReplay,D as safeStorage,Ke as pairwise,Ge as once,et as observeElementSize,Ee as observableFrom,T as nowInt,w as now,c as noop,Se as merge,We as mapTo,U as map,yt as loadVKLangPack,nt as isValidURL,_ as isNullable,g as isNonNullable,de as isLowerOrEqual,N as isLower,F as isInvariantQuality,rt as isIntersecting,ue as isHigherOrEqual,le as isHigher,S as isBrowserWindow,G as isAbortError,we as interval,ot as interpolate,x as getWindow,ve as getVideoQualityLabel,ut as getTraceSubscriptionMethod,st as getRangeAroundIndex,at as getPlayerId,lt as getMessageFromError,fe as getHighestQuality,ee as getExponentialDelay,De as fromEvent,W as flattenObject,Ve as filterChanged,Le as filter,I as fillWithDefault,wt as devNull,se as detectEmbed,L as debounceFn,Me as debounce,Pt as createDIContainer,xe as combine,z as cloneDeepWith,be as cloneDeep,tt as clearVideoElement,s as checkNever,ke as buffer,_e as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,ge as areQualitiesExact,C as addScript,E as abortable,ce as VideoQuality,V as ValueSubject,_t as VKNumericLanguage,i as VERSION,ht as TracerFactory,Oe as SubscriptionRemovable,a as Subscription,f as Subject,B as ReplaySubject,d as Observable,p as Logger,Ct as InternalsExposure,St as InterfaceLanguage,Nt as InjectionToken,Z as INTERNAL_EXPOSE_GLOBAL_KEY,gt as ErrorCategory,K as CircularBuffer,$ as AppTracer};
6
+ var e=Object.defineProperty,t=e=>e;function n(e,n){this[e]=t.bind(null,n)}var r=(t,r)=>{for(var i in r)e(t,i,{get:r[i],enumerable:!0,configurable:!0,set:n.bind(r,i)})},i=`1.0.92-dev.82d0b1d07.0`;class a{subscriptions=[];unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(e=>{typeof e==`function`?e():e.unsubscribe()})}add(e){return this.subscriptions.push(e),this}}var o=e=>{throw Error(`${e} is value of unexpected type`)},s=e=>{},c=()=>{},l=e=>{throw console.error(e),e},u=e=>{console.error(e)};class d{suppressErrors=!1;constructor(e){e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?u:l,r;r=t?typeof t==`function`?{next:t,error:c}:{next:e=>t.next(e),error:e=>t.error?.(e)}:{next:n,error:c};let i=typeof e==`function`?{next:t=>{try{let n=e(t);n instanceof Promise&&n.catch(e=>r.next(e))}catch(e){r.next(e)}},error:e=>r.next(e)}:{next:t=>e.next(t),error:t=>e.error?e.error(t):r.next(t)},s;try{s=this._subscribe(i)}catch(e){i.error?.(e)}return new a().add(()=>{switch(i.next=c,i.error=c,typeof s){case`function`:s();return;case`object`:s.unsubscribe();return;case`undefined`:return;default:return o(s)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class f extends d{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class p{log$=new f;logs=[];log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch{n={message:"error in `createCustomLog`",component:`Logger`}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function m(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function h(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function g(e){return e!=null}function _(e){return e==null}var v=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>g(t)));function y(e,t){if(!e?.length)throw Error(t)}function b(e,t){if(e?.length)throw Error(t)}var x=()=>globalThis,S=(e=x())=>!!(e.window&&e.screen),C=(e,t,n)=>new Promise((r,i)=>{t.addEventListener(`abort`,()=>{s(),l.remove()});let a=()=>{s(),i(`error`)},o=()=>{s(),r()},s=()=>{c&&clearTimeout(c),l.removeEventListener(`load`,o),l.removeEventListener(`error`,a)},c;n&&(c=x().setTimeout(()=>{s(),i(`timeout`)},n));let l=document.createElement(`script`);l.addEventListener(`load`,o),l.addEventListener(`error`,a),l.src=e,document.head.appendChild(l)}),w=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),ee=()=>Math.trunc(w()),T=(e,t)=>async(...n)=>{let r=t(...n),i=e.aborted,a;for(;!i&&!e.aborted;)try{let e=await r.next(a);i=e.done??!1,a=e.value}catch(e){await r.throw(e)}return a},te=(e,{start:t=0,factor:n=2,max:r=1/0,min:i=t,random:a=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*a*2-a),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,i),o},E={};r(E,{set:()=>ie,remove:()=>oe,isPersistent:()=>ne,has:()=>ae,get:()=>re,clear:()=>se});var D,O,k=`vk-videoplayer-dummy-key-${Math.random()}`,A=()=>{if(O!==void 0)return O;try{localStorage.setItem(k,`test`),localStorage.removeItem(k),O=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(k),O=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)O=2;else throw e}else throw e}return O===2&&(D=new Map),O},ne=()=>A()===0,re=e=>{let t=A();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return D?.get(e);default:o(t)}},ie=(e,t)=>{let n=A();switch(n){case 0:try{localStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 1:try{sessionStorage.setItem(e,t)}catch(e){if(e instanceof DOMException)console.error(e);else throw e}break;case 2:D?.set(e,t);return;default:o(n)}},ae=e=>{let t=A();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return D?.has(e)??!1;default:return o(t),!1}},oe=e=>{let t=A();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:D?.delete(e);return;default:o(t)}},se=()=>{let e=A();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return D?.clear();default:o(e)}},ce=()=>{let e,t=[],n=x();try{e=n.self!==n.top}catch(t){t instanceof DOMException&&t.name===`SecurityError`?e=!0:(e=!1,console.error(t))}try{n.location?.ancestorOrigins&&(t=[...n.location.ancestorOrigins])}catch(e){console.error(e)}try{!t.length&&n.document.referrer&&(t=[new URL(n.document.referrer).origin])}catch(e){console.error(e)}return t=t.filter(e=>URL.canParse(e)),{isEmbed:e,origins:t,topOrigin:t.at(-1),immediateOrigin:t.at(0)}},j;(e=>{e.INVARIANT=`Invariant quality`,e.Q_144P=`144p`,e.Q_240P=`240p`,e.Q_360P=`360p`,e.Q_480P=`480p`,e.Q_576P=`576p`,e.Q_720P=`720p`,e.Q_1080P=`1080p`,e.Q_1440P=`1440p`,e.Q_2160P=`2160p`,e.Q_4320P=`4320p`})(j||={});var M={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},le=(e,t)=>M[e].height>M[t].height,ue=(e,t)=>M[e].height>=M[t].height,N=(e,t)=>M[e].height<M[t].height,de=(e,t)=>M[e].height<=M[t].height,fe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:N(e,t)?1:-1)[0],P=Object.keys(M).sort((e,t)=>N(e,t)?-1:1),pe=(e,t=.02)=>[...P].find(n=>M[n].height*(1+t)>=e),me=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return P.find(e=>{let t=M[e];return t.width>=r&&t.height>=n})},he=e=>M[e].height,F=e=>e===`Invariant quality`,ge=e=>e.every(e=>!F(e));function _e(e){if(F(e))throw Error(`Expected exact quality`)}var ve=e=>{switch(e){case`4320p`:return`8K`;case`2160p`:return`4K`;case`1440p`:return`QHD`;case`1080p`:return`FHD`;case`720p`:return`HD`;default:return``}},ye=(e,t)=>{let n={};for(let r of Object.keys(t)){let i=t[r],a=e[r];Array.isArray(i)?n[r]=Array.isArray(a)?a:i:typeof i==`object`&&i?typeof a==`object`&&a&&!Array.isArray(a)?n[r]=ye(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},be=e=>{let t=``;return e>=3600&&(t+=Math.floor(e/3600)+`h`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`m`,e%=60),e>0&&(t+=Math.floor(e)+`s`),t};function xe(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof x().requestAnimationFrame==`function`;n&&(u=!!n.leading,d=`maxWait`in n,a=n?.maxWait?Math.max(+n?.maxWait||0,t):a,f=`trailing`in n?!!n.trailing:f);function m(t){let n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function h(e,t){return p?(s&&x().cancelAnimationFrame(s),x().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){x().cancelAnimationFrame(e);return}clearTimeout(e)}function _(e){return l=e,s=h(b,t),u?m(e):o}function v(e){let n=e-c,r=e-l,i=t-n;return d?Math.min(i,a-r):i}function y(e){let n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function b(){let e=Date.now();if(y(e))return S(e);s=h(b,v(e))}function S(e){return s=void 0,f&&r?m(e):(r=i=void 0,o)}function C(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function w(){return s===void 0?o:S(Date.now())}function ee(){return s!==void 0}function T(...e){let n=Date.now(),a=y(n);if(r=e,i=this,c=n,a){if(s===void 0)return _(c);if(d)return s=h(b,t),m(c)}return s===void 0&&(s=h(b,t)),o}return T.cancel=C,T.flush=w,T.pending=ee,T}var Se=(e,t=0,n)=>xe(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),I=(e,t)=>{if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){if(typeof t==`function`){let i=t(e[r],r,e,n);if(i!==void 0){n[r]=i;continue}}typeof e[r]==`object`?n[r]=I(e[r],t):n[r]=e[r]}return n},Ce=e=>I(e);class L extends f{bufferSize;buffer=[];cursorEnd=-1;cursorStart=0;constructor(e){super(),this.bufferSize=e,this.buffer=Array(e)}next(e){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=e,this.subscribers.forEach(t=>t.next(e))}_subscribe(e){for(let t=this.cursorStart;t<=this.cursorEnd;t++)e.next(this.buffer[t%this.bufferSize]);let t=this.keyCounter++;return this.subscribers.set(t,e),new a().add(()=>this.subscribers.delete(t))}}class R extends f{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}}function we(e){return new d(t=>{let n={},r=Object.keys(e).length,i=e=>i=>{e in n||r--,n[e]=i,r===0&&t.next(n)};return Object.entries(e).reduce((e,[t,n])=>e.add(n.subscribe(i(t))),new a)})}function Te(...e){return new d(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new a))}var Ee=e=>new d(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),De=e=>new d(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Oe(e){return new d(t=>{if(e instanceof Promise){let n=!1;return e.then(e=>{n||t.next(e)}).catch(e=>{n||t.error?.(e)}),()=>{n=!0}}for(let n=0;n<e.length;n++)t.next(e[n])})}var ke=Oe,Ae=(e,t)=>new d(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class je extends a{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Me(e){return t=>new d(n=>t.subscribe(new Ne(n,e)))}class Ne{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}var Pe={leading:!1,trailing:!0};function Fe(e,t=Pe){return n=>new d(r=>n.subscribe(new Ie(r,e,t)))}class Ie{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e;let t=x();g(this.timeout)?t.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=t.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(e){if(this.destination.error)this.destination.error(e);else throw e}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}var Le={leading:!0,trailing:!1};function Re(e,t=Le){return n=>new d(r=>n.subscribe(new ze(r,e,t)))}class ze{destination;time;config;lastValue;timeout;constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=x().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}}function Be(e){return t=>new d(n=>t.subscribe(new Ve(n,e)))}class Ve{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}var He=(e,t)=>{let n=(e,t)=>{let n=Object.keys(e);for(let r in t)if(!n.includes(r)||t[r]!==e[r])return!1;return!0};return n(e,t)&&n(t,e)},Ue=(e,t)=>e instanceof Object&&t instanceof Object?He(e,t):e===t;function We(e=Ue){return t=>new d(n=>t.subscribe(new Ge(n,e)))}var z={};class Ge{destination;predicate;lastValue=z;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===z||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(e){throw this.error(e),e}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function B(e){return t=>new d(n=>t.subscribe(new Ke(n,e)))}class Ke{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(e){throw this.error(e),e}this.destination.next(t)}error(e){this.destination.error?.(e)}}function qe(e){return B(()=>e)}function Je(){return e=>new d(t=>{let n=!1,r=!1,i=e.subscribe(e=>{n||(n=!0,t.next(e)),r&&i.unsubscribe()},e=>{n=!0,t.error?.(e),r&&i.unsubscribe()});return r=!0,n&&i.unsubscribe(),i})}function Ye(){return e=>new d(t=>e.subscribe(new Xe(t)))}class Xe{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function Ze(e){return t=>new d(n=>t.subscribe(new Qe(n,e)))}class Qe{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(e){throw this.error(e),e}this.destination.next(e)}error(e){this.destination.error?.(e)}}function $e(e){return t=>new d(n=>t.subscribe(new et(n,e)))}class et{destination;count;constructor(e,t){this.destination=e,this.count=t,t<0&&this.destination.error?.(Error(`Count can not be less than zero`))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}}function tt(e=0){return t=>{let n=0,r=new L(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new d(e=>(n++,a(r.subscribe(e))))}}var nt=300,rt=(e,t=nt)=>new d(n=>{let r=x(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!S(r))return;let o=new r.ResizeObserver(Se(e=>{let t=e[0];if(!t)return;let r,i;t.contentBoxSize&&t.contentBoxSize[0]?(i=t.contentBoxSize[0].blockSize,r=t.contentBoxSize[0].inlineSize):t.contentRect&&(r=t.contentRect.width,i=t.contentRect.height),g(r)&&g(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),V=(e,t=6,n=`.`)=>{let r={};for(let i in e)if(!(!e.hasOwnProperty(i)||e[i]instanceof HTMLElement||!t))if(typeof e[i]==`object`&&e[i]!==null){let a=V(e[i],t-1);for(let e in a)a.hasOwnProperty(e)&&(r[i+n+e]=a[e])}else r[i]=e[i];return r},it=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},at=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},ot=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),st=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ct=e=>e!==void 0&&e!==``?e:st().toString();function lt(e,t,n){if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];let r=1;for(;r<t.length&&t[r]<e;)r++;r>=t.length&&(r=t.length-1);let i=t[r-1],a=t[r],o=n[r-1],s=n[r];return e===i?o:e===a?s:o+(e-i)/(a-i)*(s-o)}function ut(e,t,n){if(e<=0||n<0)return[];let r=[],i=Math.floor((e-1)/2),a=Math.floor(e/2),o=t-i,s=t+a;o<0&&(s+=Math.abs(o),o=0),s>n&&(o-=s-n,s=n),o=Math.max(0,o),s=Math.min(n,s);for(let e=o;e<=s;e++)r.push(e);return r}var H=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),dt=e=>{if(!H(e))throw e};function ft(e){if(e&&typeof e==`object`){if(`message`in e)return String(e.message);try{return JSON.stringify(e)}catch{return`object serialization error`}}return String(e)}var pt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?V(n):{value:n})},U=(e={})=>{let t=e=>{let t=e;return e===void 0?t=`undefined`:e===null?t=`null`:(typeof e==`number`||typeof e==`boolean`)&&(t=e.toString()),t},n={};for(let r in e)Array.isArray(e[r])?n[r]=e[r].map(t):n[r]=t(e[r]);return n};class W{dynamicImportTimeout=5e3;subscription=new a;span;context;childTracers=[];initPromise;getRootTracerContext;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t,getRootTracerContext:n}){W.dynamicImportStatus===`not_started`&&(W.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=W.dynamicImportPromise.then(i=>{W.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t,getRootTracerContext:n},r)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(_(i))return;let{opentelemetryApi:a}=W.dynamicImports,{context:o,trace:s}=a,{tracer:c,attributes$:l}=i;this.span=c.startSpan(e,{startTime:r},t?.()),this.context=s.setSpan(o.active(),this.span),this.getRootTracerContext=n,this.subscription.add(l.subscribe(e=>{g(e)&&this.span.setAttributes(e)}))}async loadOpentelemetry(){if(W.dynamicImportStatus===`not_started`){W.dynamicImportStatus=`in_progress`;try{let e=new Promise((e,t)=>setTimeout(t,this.dynamicImportTimeout)),t=Promise.all([import(`@opentelemetry/api`),import(`@opentelemetry/sdk-trace-web`),import(`@apptracer/opentelemetry`),import(`@opentelemetry/resources`),import(`@opentelemetry/semantic-conventions`)]),[n,r,i,a,o]=await Promise.race([t,e]);W.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},W.dynamicImportStatus=`completed`}catch{W.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||W.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(t),type:`critical`},n)})}createComponentTracer(e){let t=new W({name:e,getParentContext:()=>this.context,getRootTracerContext:()=>this.getRootTracerContext?.()});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end(),this.subscription.unsubscribe())})}}var G=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class mt extends W{attributes$=new R(null);constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=W.dynamicImports,{TracerUploadSpanExporter:s}=r,{WebTracerProvider:c,BatchSpanProcessor:l}=a,{resourceFromAttributes:u}=i,{ATTR_SERVICE_NAME:d}=o,f=new c({resource:u({[d]:`videoplayer-sdk-web`}),spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0},spanProcessors:[new l(new s({appToken:G}))]});f.register();let p=f.getTracer(`sdk-videoplayer-tracer`);super.init({name:e,getParentContext:t,getRootTracerContext:()=>({tracer:p,attributes$:this.attributes$})},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}setSpanAttributes(e){this.attributes$.next(U(e))}addSubscription(e){this.subscription.add(e)}}class K{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new K({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var q=()=>!0,J={level:0,filter:q,name:`Noname Tracer`,outputMethod:`log`};class Y{name;filter=q;level=J.level;outputMethod=J.outputMethod;childTracers=[];constructor({name:e,level:t,filter:n,outputMethod:r}={}){this.filter=n??this.filter,this.level=t??this.level,this.outputMethod=r??this.outputMethod,this.name=e??J.name}log(e,t){this.logDebug(e,t)}error(e,t){this.logError(e,t)}critical(e,t){this.logError(e,t)}createComponentTracer(e){let t=new Y({filter:this.filter,level:this.level,name:`${this.name}/ ${e}`,outputMethod:this.outputMethod});return this.childTracers.push(t),t}end(){this.childTracers.forEach(e=>e.end()),this.childTracers=[]}setLevel(e){this.level=e,this.childTracers.forEach(t=>t.setLevel(e))}setOtputMethod(e){this.outputMethod=e,this.childTracers.forEach(t=>t.setOtputMethod(e))}setFilter(e){this.filter=e,this.childTracers.forEach(t=>t.setFilter(e))}getFinishedSpans(){}getTraceId(){return`debug_trace`}get verbose(){return this.level===0}createMessage(e,t){return[this.name,e,JSON.stringify(t)].join(`: `)}logDebug(e,t){!this.verbose||!this.filter(e,t)||x().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&x().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class ht{static createRootTracer(e=`fake`){switch(e){case`real`:return new mt;case`debug`:return new Y;default:return new K}}}var X;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.UI=`ui`,e.CALL_FROM_EXTERNAL=`call_from_external`,e.FATAL=`fatal`})(X||={});var gt;(e=>{e.Armenian=`58`,e.Azerbaijani=`57`,e.Belarusian=`114`,e.English=`3`,e.Kazakh=`97`,e.Portuguese=`73`,e.Russian=`0`,e.Spanish=`4`,e.Ukrainian=`1`,e.Uzbek=`65`,e.Vietnamese=`75`})(gt||={});var _t=`vk.com`,vt=async(e,t,n)=>{let r=new URL(`https://${_t}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),yt(await(await fetch(r.toString())).json(),n)},yt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),bt(n)])),bt=e=>Array.isArray(e)?e[0]:e,xt;(e=>{e.RU=`ru`,e.EN=`en`})(xt||={});var Z=`__vk_vp_internals_exposure`;class St{playerId;type;constructor(e,t){this.playerId=t,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>`u`)return{};let e=this.playerId,t=this.type;return window[Z]?.[e]?.[t]??{}}initWindowObjects(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[Z]||(window[Z]={}),window[Z][e]||(window[Z][e]={}),window[Z][e][t]||(window[Z][e][t]={})}expose(e){typeof window>`u`||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>`u`)return;let e=this.playerId,t=this.type;window[Z]&&window[Z][e]&&window[Z][e][t]&&(delete window[Z][e][t],Object.keys(window[Z][e]).length||delete window[Z][e],Object.keys(window[Z]).length||delete window[Z])}}var Ct={};r(Ct,{subscribe:()=>Dt,push:()=>Et,destroy:()=>Tt,create:()=>wt});var Q=new Map,wt=(e,t)=>Q.set(e,t??[]),Tt=e=>Q.delete(e),Et=(e,t)=>{let n=Q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Dt=(e,t)=>{let n=Q.get(e);if(n){if(n&&Array.isArray(n))for(let e of n)t(e);Q.set(e,t)}},Ot=e=>v({id:e.id,message:e.message,category:e.category,data:kt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function kt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var At=e=>{let t=e.thrown instanceof Error?e.thrown:Error(e.message),n=e.id.length>10240?e.id.substring(0,10240):e.id;try{t.name=n}catch{t=Error(e.message),t.name=n}return t},jt=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=x()?.document?.location??{};return!r||r===`localhost`?void 0:{url:e+t,...new URLSearchParams(n).entries().reduce((e,[t,n])=>(e[`url.${t}`]=n,e),{})}}catch{}};class ${static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;beforeInitErrors=[];constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=ce();this.isEmbed=i,this.embedParent=a?new URL(a).hostname:void 0,this.options.enabled&&(this.loadModule(),this.init())}updateContext(e){Object.assign(this.context,e)}error(e,t){let n=$.tracerErrorMap.get(this.componentName);if(!n){this.beforeInitErrors.push([e,t]);return}let{blackErrorCategoryList:r,blackErrorIdList:i,sampleRate:a,whiteErrorCategoryList:o,whiteErrorIdList:s}=this.options,{id:c,category:l}=e;if(!(r.length&&r.includes(l)||i.length&&i.includes(c)||o.length&&!o.includes(l)||s.length&&!s.includes(c)||Math.random()>=a))try{let r=At(e);n?.error(r,{crashIdSource:r.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Ot(e),...jt(),...this.isEmbed&&this.embedParent&&{iframe_host:this.embedParent}}})}catch(e){console.error(e)}}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await $.loadPromise,$.tracerErrorMap.has(this.componentName)||_($.appTracerModule))return;let{appTracerModule:e}=$,{initTracerError:t,initTracerErrorUploader:n,getTracerModules:r}=e,i=r(this.componentName),a=!i.error,o=i.error??t(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:G,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),$.tracerErrorMap.set(this.componentName,o),this.beforeInitErrors.forEach(e=>this.error.apply(this,e)),this.beforeInitErrors=[]}catch(e){console.error(e)}}loadModule(){g($.loadPromise)||($.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));$.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){$.loadPromise=null,console.error(e)}})())}}class Mt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Nt=()=>{let e=new Map,t=new Map,n=new Map,r=new Map;return{resolve(e){if(!r.has(e)){let t=n.get(e);if(!t)throw Error(`No constructor registered in DI container for ${e.name}`);r.set(e,new t)}return r.get(e)},resolveOptional(e){try{return this.resolve(e)}catch{return}},replace(e,t){r.forEach((t,n)=>{t instanceof e&&r.delete(n)}),n.set(e,t)},getToken(n){if(e.has(n.symbol))return e.get(n.symbol);if(t.has(n.symbol)){let r=t.get(n.symbol)();return e.set(n.symbol,r),r}if(n.options?.factory){let t=n.options.factory();return e.set(n.symbol,t),t}throw Error(`No value registered in DI container for token "${n.symbol.description}"`)},registerToken(t,n){e.set(t.symbol,n)},registerFactory(e,n){t.set(e.symbol,n)},hasToken(n){return e.has(n.symbol)||t.has(n.symbol)||!!n.options?.factory},clear(){e.clear(),t.clear(),r.clear(),n.clear()}}};export{v as withoutNullable,me as videoSizeToQuality,he as videoQualityToHeight,pe as videoHeightToQuality,Ee as timeout,be as timeCodeToString,Se as throttleFn,Re as throttle,Ze as tap,dt as suppressAbort,$e as skip,tt as shareReplay,E as safeStorage,Ye as pairwise,Je as once,rt as observeElementSize,ke as observableFrom,ee as nowInt,w as now,c as noop,Te as merge,qe as mapTo,B as map,vt as loadVKLangPack,at as isValidURL,_ as isNullable,g as isNonNullable,de as isLowerOrEqual,N as isLower,F as isInvariantQuality,ot as isIntersecting,ue as isHigherOrEqual,le as isHigher,S as isBrowserWindow,H as isAbortError,De as interval,lt as interpolate,x as getWindow,ve as getVideoQualityLabel,pt as getTraceSubscriptionMethod,ut as getRangeAroundIndex,ct as getPlayerId,ft as getMessageFromError,fe as getHighestQuality,te as getExponentialDelay,Ae as fromEvent,V as flattenObject,We as filterChanged,Be as filter,ye as fillWithDefault,Ct as devNull,ce as detectEmbed,xe as debounceFn,Fe as debounce,Nt as createDIContainer,we as combine,I as cloneDeepWith,Ce as cloneDeep,it as clearVideoElement,s as checkNever,Me as buffer,_e as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,ge as areQualitiesExact,C as addScript,T as abortable,j as VideoQuality,R as ValueSubject,gt as VKNumericLanguage,i as VERSION,ht as TracerFactory,je as SubscriptionRemovable,a as Subscription,f as Subject,L as ReplaySubject,d as Observable,p as Logger,St as InternalsExposure,xt as InterfaceLanguage,Mt as InjectionToken,Z as INTERNAL_EXPOSE_GLOBAL_KEY,X as ErrorCategory,$ as AppTracer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.92-dev.53fc4c12e.0",
3
+ "version": "1.0.92-dev.82d0b1d07.0",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",
@@ -20,9 +20,9 @@ export declare class DebugTracer implements IRootTracer {
20
20
  private outputMethod;
21
21
  private childTracers;
22
22
  constructor({ name, level, filter, outputMethod }?: Partial<Params>);
23
- log(name: string, attributes?: Attributes, _persistent?: boolean): void;
24
- error(name: string, attributes?: Attributes, _persistent?: boolean): void;
25
- critical(name: string, attributes?: Attributes, _persistent?: boolean): void;
23
+ log(name: string, attributes?: Attributes): void;
24
+ error(name: string, attributes?: Attributes): void;
25
+ critical(name: string, attributes?: Attributes): void;
26
26
  createComponentTracer(name: string): ITracer;
27
27
  end(): void;
28
28
  setLevel(level: DebugTracerLevel): void;
@@ -3,9 +3,9 @@ import type { Attributes, IRootTracer, ITracer, ITracerParams } from "./types";
3
3
  export declare class FakeTracer implements IRootTracer {
4
4
  private readonly fakeTraceId;
5
5
  constructor(_params?: Partial<ITracerParams>);
6
- log(_name: string, _attributes?: Attributes, _persistent?: boolean): void;
7
- error(_name: string, _attributes?: Attributes, _persistent?: boolean): void;
8
- critical(_name: string, _attributes?: Attributes, _persistent?: boolean): void;
6
+ log(_name: string, _attributes?: Attributes): void;
7
+ error(_name: string, _attributes?: Attributes): void;
8
+ critical(_name: string, _attributes?: Attributes): void;
9
9
  createComponentTracer(name: string): ITracer;
10
10
  end(): void;
11
11
  getTraceId(): string;
@@ -4,7 +4,7 @@ import type { Milliseconds } from "../utils";
4
4
  import type { ISubscription } from "../reactive";
5
5
  export declare class RootTracer extends Tracer implements IRootTracer {
6
6
  private readonly attributes$;
7
- constructor(eventsBufferSize?: number);
7
+ constructor();
8
8
  protected init({ name, getParentContext }: ITracerParams, startTime: Milliseconds): void;
9
9
  getTraceId(): string;
10
10
  setSpanAttributes(attributes: Attributes): void;
@@ -1,14 +1,7 @@
1
1
  import type { ITracer, ITracerDynamicImports, ITracerParams, Context, Span, Attributes } from "./types";
2
- import { TraceEventType, TracerDynamicImportStatus } from "./types";
2
+ import { TracerDynamicImportStatus } from "./types";
3
3
  import type { Milliseconds } from "../utils";
4
- import { CircularBuffer } from "../utils";
5
4
  import type { ISubscription } from "../reactive";
6
- interface IBufferedEvent {
7
- name: string;
8
- attributes?: Attributes;
9
- type: TraceEventType;
10
- timestamp: Milliseconds;
11
- }
12
5
  export declare class Tracer implements ITracer {
13
6
  private readonly dynamicImportTimeout;
14
7
  protected readonly subscription: ISubscription;
@@ -17,47 +10,16 @@ export declare class Tracer implements ITracer {
17
10
  protected childTracers: ITracer[];
18
11
  protected initPromise: Promise<void>;
19
12
  protected getRootTracerContext: ITracerParams["getRootTracerContext"];
20
- protected eventsBuffer: CircularBuffer<IBufferedEvent> | null;
21
13
  protected static dynamicImportStatus: TracerDynamicImportStatus;
22
14
  protected static dynamicImports: ITracerDynamicImports;
23
15
  protected static dynamicImportPromise: Promise<void>;
24
- protected constructor({ name, getParentContext, getRootTracerContext, eventsBufferSize }: ITracerParams);
16
+ protected constructor({ name, getParentContext, getRootTracerContext }: ITracerParams);
25
17
  protected init({ name, getParentContext, getRootTracerContext }: ITracerParams, startTime: Milliseconds): void;
26
18
  private loadOpentelemetry;
27
19
  protected isComponentTracerNotInitialized(): boolean;
28
- private addEventToBuffer;
29
- private addEventToSpan;
30
- /**
31
- * Логирует событие.
32
- * @param name Название события
33
- * @param attributes Атрибуты события
34
- * @param persistent Если true — событие сразу записывается в span.
35
- * Если false (по умолчанию) — событие попадает в буфер и будет записано в span при вызове end().
36
- * Это позволяет ограничить количество событий в span через eventsBufferSize,
37
- * сохраняя только последние N событий и предотвращая превышение лимита атрибутов.
38
- */
39
- log(name: string, attributes?: Attributes, persistent?: boolean): void;
40
- /**
41
- * Логирует ошибку.
42
- * @param name Название события
43
- * @param attributes Атрибуты события
44
- * @param persistent Если true — событие сразу записывается в span.
45
- * Если false (по умолчанию) — событие попадает в буфер и будет записано в span при вызове end().
46
- * Это позволяет ограничить количество событий в span через eventsBufferSize,
47
- * сохраняя только последние N событий и предотвращая превышение лимита атрибутов.
48
- */
49
- error(name: string, attributes?: Attributes, persistent?: boolean): void;
50
- /**
51
- * Логирует критическое событие.
52
- * @param name Название события
53
- * @param attributes Атрибуты события
54
- * @param persistent Если true — событие сразу записывается в span.
55
- * Если false (по умолчанию) — событие попадает в буфер и будет записано в span при вызове end().
56
- * Это позволяет ограничить количество событий в span через eventsBufferSize,
57
- * сохраняя только последние N событий и предотвращая превышение лимита атрибутов.
58
- */
59
- critical(name: string, attributes?: Attributes, persistent?: boolean): void;
20
+ log(name: string, attributes?: Attributes): void;
21
+ error(name: string, attributes?: Attributes): void;
22
+ critical(name: string, attributes?: Attributes): void;
60
23
  createComponentTracer(name: string): ITracer;
61
24
  end(): void;
62
25
  }
63
- export {};
@@ -1,4 +1,4 @@
1
1
  import type { IRootTracer, TracerType } from "./types";
2
2
  export declare class TracerFactory {
3
- static createRootTracer(type?: TracerType, eventsBufferSize?: number): IRootTracer;
3
+ static createRootTracer(type?: TracerType): IRootTracer;
4
4
  }
@@ -24,7 +24,6 @@ export interface ITracerParams {
24
24
  name: string;
25
25
  getParentContext?: () => Context;
26
26
  getRootTracerContext?: () => IRootTracerContext | undefined;
27
- eventsBufferSize?: number;
28
27
  }
29
28
  export interface IRootTracerContext {
30
29
  tracer: OpentelemetryApi.Tracer;
@@ -38,9 +37,9 @@ export interface ITracerDynamicImports {
38
37
  opentelemetrySemanticConventions: typeof OpentelemetrySemanticConventions;
39
38
  }
40
39
  export interface ITracer {
41
- log: (name: string, attributes?: Attributes, persistent?: boolean) => void;
42
- error: (name: string, attributes?: Attributes, persistent?: boolean) => void;
43
- critical: (name: string, attributes?: Attributes, persistent?: boolean) => void;
40
+ log: (name: string, attributes?: Attributes) => void;
41
+ error: (name: string, attributes?: Attributes) => void;
42
+ critical: (name: string, attributes?: Attributes) => void;
44
43
  createComponentTracer: (name: string) => ITracer;
45
44
  end: () => void;
46
45
  }
@@ -41,8 +41,6 @@ export interface IDIContainer {
41
41
  registerFactory<T>(token: InjectionToken<T>, factory: () => T): void;
42
42
  /** Проверить наличие токена */
43
43
  hasToken(token: InjectionToken<unknown>): boolean;
44
- /** Зарегистрировать функцию очистки (вызывается при clear) */
45
- registerCleanup(cleanup: () => void): void;
46
44
  /** Очистить контейнер */
47
45
  clear(): void;
48
46
  }
@@ -33,4 +33,3 @@ export { getRangeAroundIndex } from "./getRangeAroundIndex";
33
33
  export * from "./browser";
34
34
  export { suppressAbort, isAbortError } from "./suppressAbort";
35
35
  export * from "./getMessageFromError";
36
- export { CircularBuffer } from "./CircularBuffer";
@@ -1,31 +0,0 @@
1
- /**
2
- * Кольцевой буфер фиксированного размера.
3
- * При добавлении новых элементов старые перезаписываются по кругу.
4
- */
5
- export declare class CircularBuffer<T> implements Iterable<T> {
6
- private buffer;
7
- private writeIndex;
8
- private count;
9
- private capacity;
10
- constructor(capacity: number);
11
- /**
12
- * Добавляет элемент в буфер. При переполнении перезаписывает наиболее старый элемент.
13
- */
14
- add(item: T): void;
15
- /**
16
- * Итератор для перебора элементов от старых к новым.
17
- */
18
- [Symbol.iterator](): IterableIterator<T>;
19
- /**
20
- * Очищает буфер, записывая null во все ячейки.
21
- */
22
- clear(): void;
23
- /**
24
- * Возвращает текущее количество элементов в буфере.
25
- */
26
- get size(): number;
27
- /**
28
- * Возвращает вместимость буфера.
29
- */
30
- get maxCapacity(): number;
31
- }