@vkontakte/videoplayer-shared 1.0.90-dev.524dbd943.0 → 1.0.90-dev.93411ef3c.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.90-dev.524dbd943.0
3
- * Thu, 14 May 2026 09:09:31 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.90-dev.93411ef3c.0
3
+ * Mon, 18 May 2026 11:32:01 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/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`),r=Object.defineProperty,i=Object.getOwnPropertyNames,a=Object.getOwnPropertyDescriptor,o=Object.prototype.hasOwnProperty;function s(e){return this[e]}var c=e=>{var t=(l??=new WeakMap).get(e),n;if(t)return t;if(t=r({},`__esModule`,{value:!0}),e&&typeof e==`object`||typeof e==`function`)for(var c of i(e))o.call(t,c)||r(t,c,{get:s.bind(e,c),enumerable:!(n=a(e,c))||n.enumerable});return l.set(e,t),t},l,u=e=>e;function d(e,t){this[e]=u.bind(null,t)}var f=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0,configurable:!0,set:d.bind(t,n)})},p={};f(p,{withoutNullable:()=>D,videoSizeToQuality:()=>we,videoQualityToHeight:()=>Te,videoHeightToQuality:()=>Ce,urlCanParsePolyfilled:()=>Wn,timeout:()=>Le,timeCodeToString:()=>Ae,throttleFn:()=>Me,throttle:()=>Ye,tap:()=>ct,suppressAbort:()=>St,stringTrimStart:()=>$,stringTrimRight:()=>Fn,stringTrimLeft:()=>Pn,stringTrimEnd:()=>Nn,stringReplaceAll:()=>Mn,stringPadStart:()=>jn,stringPadEnd:()=>An,stringMatchAll:()=>kn,stringAt:()=>On,skip:()=>ut,shareReplay:()=>ft,safeStorage:()=>le,requestIdleCallbackPolyfilled:()=>Vn,promiseWithResolvers:()=>hn,promiseTry:()=>mn,promiseFinally:()=>pn,promiseAny:()=>fn,promiseAllSettled:()=>dn,pairwise:()=>ot,once:()=>at,observeElementSize:()=>mt,observableFrom:()=>Be,objectValues:()=>un,objectHasOwn:()=>ln,objectFromEntries:()=>sn,objectEntries:()=>on,nowInt:()=>oe,now:()=>ae,noop:()=>v,merge:()=>Ie,mapTo:()=>it,map:()=>z,loadVKLangPack:()=>Mt,isValidURL:()=>gt,isNullable:()=>E,isNonNullable:()=>T,isLowerOrEqual:()=>be,isLower:()=>P,isInvariantQuality:()=>F,isIntersecting:()=>_t,isHigherOrEqual:()=>ye,isHigher:()=>ve,isBrowserWindow:()=>re,isAbortError:()=>V,interval:()=>Re,interpolate:()=>bt,includesPolyfilled:()=>Un,globalThisPolyfill:()=>an,getWindow:()=>O,getVideoQualityLabel:()=>Oe,getTraceSubscriptionMethod:()=>Ct,getRangeAroundIndex:()=>xt,getPlayerId:()=>yt,getHighestQuality:()=>xe,getExponentialDelay:()=>ce,fromEvent:()=>Ve,flattenObject:()=>B,filterChanged:()=>tt,filter:()=>Ze,fillWithDefault:()=>ke,fetchPolyfilled:()=>wn,devNull:()=>Lt,detectEmbed:()=>ge,debounceFn:()=>je,debounce:()=>Ke,createDIContainer:()=>qt,combine:()=>Fe,cloneDeepWith:()=>I,cloneDeep:()=>Ne,clearVideoElement:()=>ht,checkNever:()=>_,cancelIdleCallbackPolyfilled:()=>Hn,buffer:()=>Ue,atPolyfilled:()=>In,assertQualityIsExact:()=>De,assertNullable:()=>w,assertNotEmptyArray:()=>te,assertNonNullable:()=>C,assertNever:()=>g,assertEmptyArray:()=>ne,arrayWith:()=>rn,arrayToSpliced:()=>nn,arrayToSorted:()=>tn,arrayToReversed:()=>en,arrayIncludes:()=>$t,arrayFlatMap:()=>Qt,arrayFlat:()=>Zt,arrayFindLastIndex:()=>Xt,arrayFindLast:()=>Yt,arrayAt:()=>Jt,areQualitiesExact:()=>Ee,addScript:()=>ie,abortable:()=>se,VideoQuality:()=>_e,ValueSubject:()=>L,VKNumericLanguage:()=>At,VERSION:()=>m,TracerFactory:()=>Ot,SubscriptionRemovable:()=>He,Subscription:()=>h,Subject:()=>S,RequestPolyfilled:()=>Tn,ReplaySubject:()=>Pe,Observable:()=>x,Logger:()=>ee,InternalsExposure:()=>It,InterfaceLanguage:()=>Ft,InjectionToken:()=>Kt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>K,ErrorCategory:()=>kt,AppTracer:()=>J,AbortSignalPolyfilled:()=>Dn,AbortControllerPolyfilled:()=>En}),module.exports=c(p);var m=`1.0.90-dev.524dbd943.0`;class h{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 g=e=>{throw Error(`${e} is value of unexpected type`)},_=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 h().add(()=>{switch(i.next=v,i.error=v,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return g(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 h().add(()=>this.subscribers.delete(t))}}class ee{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 w(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function T(e){return e!=null}function E(e){return e==null}var D=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>T(t)));function te(e,t){if(!e?.length)throw Error(t)}function ne(e,t){if(e?.length)throw Error(t)}var O=()=>globalThis,re=(e=O())=>!!(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=O().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 O().performance?.now==`function`?()=>O().performance.now():()=>Date.now(),oe=()=>Math.trunc(ae()),se=(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}),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={};f(le,{set:()=>fe,remove:()=>me,isPersistent:()=>ue,has:()=>pe,get:()=>de,clear:()=>he});var k,A,j=`vk-videoplayer-dummy-key-${Math.random()}`,M=()=>{if(A!==void 0)return A;try{localStorage.setItem(j,`test`),localStorage.removeItem(j),A=0}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(j),A=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)A=2;else throw e}else throw e}return A===2&&(k=new Map),A},ue=()=>M()===0,de=e=>{let t=M();switch(t){case 0:return localStorage.getItem(e)??void 0;case 1:return sessionStorage.getItem(e)??void 0;case 2:return k?.get(e);default:g(t)}},fe=(e,t)=>{let n=M();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:k?.set(e,t);return;default:g(n)}},pe=e=>{let t=M();switch(t){case 0:return e in localStorage;case 1:return e in sessionStorage;case 2:return k?.has(e)??!1;default:return g(t),!1}},me=e=>{let t=M();switch(t){case 0:return localStorage.removeItem(e);case 1:return sessionStorage.removeItem(e);case 2:k?.delete(e);return;default:g(t)}},he=()=>{let e=M();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return k?.clear();default:g(e)}},ge=()=>{let e,t=[],n=O();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)}},_e;(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`})(_e||={});var N={"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)=>N[e].height>N[t].height,ye=(e,t)=>N[e].height>=N[t].height,P=(e,t)=>N[e].height<N[t].height,be=(e,t)=>N[e].height<=N[t].height,xe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:P(e,t)?1:-1)[0],Se=Object.keys(N).sort((e,t)=>P(e,t)?-1:1),Ce=(e,t=.02)=>[...Se].find(n=>N[n].height*(1+t)>=e),we=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return Se.find(e=>{let t=N[e];return t.width>=r&&t.height>=n})},Te=e=>N[e].height,F=e=>e===`Invariant quality`,Ee=e=>e.every(e=>!F(e));function De(e){if(F(e))throw Error(`Expected exact quality`)}var Oe=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``}},ke=(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]=ke(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ae=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 je(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof O().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&&O().cancelAnimationFrame(s),O().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){O().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 S(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function ee(){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=S,w.flush=ee,w.pending=C,w}var Me=(e,n=0,r)=>je(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},Ne=e=>I(e);class Pe 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 h().add(()=>this.subscribers.delete(t))}}class L 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 Fe(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 h)})}function Ie(...e){return new x(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new h))}var Le=e=>new x(t=>{let n=O().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>O().clearTimeout(n)}),Re=e=>new x(t=>{let n=O(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function ze(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 Be=ze,Ve=(e,t)=>new x(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class He extends h{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ue(e){return t=>new x(n=>t.subscribe(new We(n,e)))}class We{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 Ge={leading:!1,trailing:!0};function Ke(e,t=Ge){return n=>new x(r=>n.subscribe(new qe(r,e,t)))}class qe{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=O();T(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 Je={leading:!0,trailing:!1};function Ye(e,t=Je){return n=>new x(r=>n.subscribe(new Xe(r,e,t)))}class Xe{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,E(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=O().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 Ze(e){return t=>new x(n=>t.subscribe(new Qe(n,e)))}class Qe{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 $e=(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)},et=(e,t)=>e instanceof Object&&t instanceof Object?$e(e,t):e===t;function tt(e=et){return t=>new x(n=>t.subscribe(new nt(n,e)))}var R={};class nt{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,R),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===R||!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 z(e){return t=>new x(n=>t.subscribe(new rt(n,e)))}class rt{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 it(e){return z(()=>e)}function at(){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 ot(){return e=>new x(t=>e.subscribe(new st(t)))}class st{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 ct(e){return t=>new x(n=>t.subscribe(new lt(n,e)))}class lt{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 ut(e){return t=>new x(n=>t.subscribe(new dt(n,e)))}class dt{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 ft(e=0){return t=>{let n=0,r=new Pe(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new x(e=>(n++,a(r.subscribe(e))))}}var pt=300,mt=(e,t=pt)=>new x(n=>{let r=O(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!re(r))return;let o=new r.ResizeObserver(Me(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),T(r)&&T(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},ht=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},gt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},_t=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),vt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),yt=e=>e!==void 0&&e!==``?e:vt().toString();function bt(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 xt(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),St=e=>{if(!V(e))throw e},Ct=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?B(n):{value:n})},H=(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 U{constructor({name:t,getParentContext:n,getRootTracerContext:r}){e(this,`dynamicImportTimeout`,5e3),e(this,`subscription`,new h),e(this,`span`,void 0),e(this,`context`,void 0),e(this,`childTracers`,[]),e(this,`initPromise`,void 0),e(this,`getRootTracerContext`,void 0),U.dynamicImportStatus===`not_started`&&(U.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=U.dynamicImportPromise.then(e=>{U.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n,getRootTracerContext:r},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(E(i))return;let{opentelemetryApi:a}=U.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=>{T(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return n(function*(){if(U.dynamicImportStatus===`not_started`){U.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]);U.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},U.dynamicImportStatus=`completed`}catch{U.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return E(this.span)||U.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},H(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},H(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},H(n)),{},{type:`critical`}),r)})}createComponentTracer(e){let t=new U({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())})}}e(U,`dynamicImportStatus`,`not_started`),e(U,`dynamicImports`,void 0),e(U,`dynamicImportPromise`,void 0);var W=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class wt extends U{constructor(){super({name:`Root`}),e(this,`attributes$`,new L(null))}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=U.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:W}))]});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(H(e))}addSubscription(e){this.subscription.add(e)}}class Tt{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new Tt({name:e})}end(){}getTraceId(){return this.fakeTraceId}addSubscription(e){}setSpanAttributes(e){}}var Et=()=>!0,G={level:0,filter:Et,name:`Noname Tracer`,outputMethod:`log`};class Dt{constructor({name:t,level:n,filter:r,outputMethod:i}={}){e(this,`name`,void 0),e(this,`filter`,Et),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){this.logDebug(e,t)}error(e,t){this.logError(e,t)}critical(e,t){this.logError(e,t)}createComponentTracer(e){let t=new Dt({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)||O().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&O().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class Ot{static createRootTracer(e=`fake`){switch(e){case`real`:return new wt;case`debug`:return new Dt;default:return new Tt}}}var kt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(kt||={});var At;(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`})(At||={});var jt=`vk.com`,Mt=function(){var e=n(function*(e,t,n){let r=new URL(`https://${jt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Nt(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),Nt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Pt(n)])),Pt=e=>Array.isArray(e)?e[0]:e,Ft;(e=>{e.RU=`ru`,e.EN=`en`})(Ft||={});var K=`__vk_vp_internals_exposure`;class It{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 Lt={};f(Lt,{subscribe:()=>Vt,push:()=>Bt,destroy:()=>zt,create:()=>Rt});var q=new Map,Rt=(e,t)=>q.set(e,t??[]),zt=e=>q.delete(e),Bt=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Vt=(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)}},Ht=e=>D({id:e.id,message:e.message,category:e.category,data:Ut(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Ut(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Wt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Gt=()=>{try{var e;let{origin:n,pathname:r,search:i,hostname:a}=((e=O())==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 h),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),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=ge();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{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)return;let u=J.tracerErrorMap.get(this.componentName);try{let r=Wt(e);u?.error(r,{crashIdSource:r.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),Ht(e)),Gt()),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)||E(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});T(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:W,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),J.tracerErrorMap.set(e.componentName,s)}catch(e){console.error(e)}})()}loadModule(){var e=this;T(J.loadPromise)||(J.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>O().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 Kt{constructor(t,n){e(this,`options`,void 0),e(this,`symbol`,void 0),this.options=n,this.symbol=Symbol(t)}}var qt=()=>{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()}}},Jt=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},Yt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Xt=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},Zt=(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},Qt=(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},$t=(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},en=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},tn=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},nn=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},rn=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},an=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),on=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},sn=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},cn=Object.prototype.hasOwnProperty,ln=(e,t)=>cn.call(e,t),un=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},dn=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}))))},fn=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`))})})})},pn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),mn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},hn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:gn,NativeAbortController:_n}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function vn(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 yn(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 bn{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 bn{constructor(){super(),this.listeners||bn.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=yn(e),n=vn(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 xn(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 Sn(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!xn({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&&xn({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}),Cn=Q?Sn({fetch:Z.fetch,Request:Z.Request,AbortController:Z.AbortController}):void 0,wn=Q?Cn.fetch:Z.fetch,Tn=Q?Cn.Request:Z.Request,En=Q?X:Z.AbortController,Dn=Q?Y:Z.AbortSignal,On=(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*kn(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 An=(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)},jn=(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},Mn=(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)},$=e=>e.replace(/^\s+/,``),Nn=e=>e.replace(/\s+$/,``),Pn=$,Fn=Nn,In=(e,t)=>typeof e==`string`?On(e,t):Jt(e,t),Ln=(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)},Rn=e=>Z.clearTimeout(e),zn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Bn=!zn(Z.requestIdleCallback)||!zn(Z.cancelIdleCallback),Vn=Bn?Ln:Z.requestIdleCallback,Hn=Bn?Rn:Z.cancelIdleCallback,Un=(e,t,n)=>typeof e==`string`?e.includes(t,n):$t(e,t,n),Wn=(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=require(`@oxc-project/runtime/helpers/defineProperty`),t=require(`@oxc-project/runtime/helpers/objectSpread2`),n=require(`@oxc-project/runtime/helpers/asyncToGenerator`),r=Object.defineProperty,i=Object.getOwnPropertyNames,a=Object.getOwnPropertyDescriptor,o=Object.prototype.hasOwnProperty;function s(e){return this[e]}var c=e=>{var t=(l??=new WeakMap).get(e),n;if(t)return t;if(t=r({},`__esModule`,{value:!0}),e&&typeof e==`object`||typeof e==`function`)for(var c of i(e))o.call(t,c)||r(t,c,{get:s.bind(e,c),enumerable:!(n=a(e,c))||n.enumerable});return l.set(e,t),t},l,u=e=>e;function d(e,t){this[e]=u.bind(null,t)}var f=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0,configurable:!0,set:d.bind(t,n)})},p={};f(p,{withoutNullable:()=>ne,videoSizeToQuality:()=>we,videoQualityToHeight:()=>Te,videoHeightToQuality:()=>Ce,urlCanParsePolyfilled:()=>Wn,timeout:()=>Le,timeCodeToString:()=>Ae,throttleFn:()=>I,throttle:()=>Ye,tap:()=>ct,suppressAbort:()=>St,stringTrimStart:()=>Mn,stringTrimRight:()=>Fn,stringTrimLeft:()=>Pn,stringTrimEnd:()=>Nn,stringReplaceAll:()=>jn,stringPadStart:()=>An,stringPadEnd:()=>kn,stringMatchAll:()=>On,stringAt:()=>Dn,skip:()=>ut,shareReplay:()=>ft,safeStorage:()=>ue,requestIdleCallbackPolyfilled:()=>Vn,promiseWithResolvers:()=>mn,promiseTry:()=>pn,promiseFinally:()=>fn,promiseAny:()=>dn,promiseAllSettled:()=>un,pairwise:()=>ot,once:()=>at,observeElementSize:()=>mt,observableFrom:()=>Be,objectValues:()=>ln,objectHasOwn:()=>cn,objectFromEntries:()=>on,objectEntries:()=>an,nowInt:()=>se,now:()=>oe,noop:()=>_,merge:()=>Ie,mapTo:()=>it,map:()=>z,loadVKLangPack:()=>At,isValidURL:()=>gt,isNullable:()=>T,isNonNullable:()=>w,isLowerOrEqual:()=>be,isLower:()=>P,isInvariantQuality:()=>F,isIntersecting:()=>_t,isHigherOrEqual:()=>ye,isHigher:()=>ve,isBrowserWindow:()=>D,isAbortError:()=>V,interval:()=>Re,interpolate:()=>bt,includesPolyfilled:()=>Un,globalThisPolyfill:()=>rn,getWindow:()=>E,getVideoQualityLabel:()=>Oe,getTraceSubscriptionMethod:()=>Ct,getRangeAroundIndex:()=>xt,getPlayerId:()=>yt,getHighestQuality:()=>xe,getExponentialDelay:()=>le,fromEvent:()=>Ve,flattenObject:()=>B,filterChanged:()=>tt,filter:()=>Ze,fillWithDefault:()=>ke,fetchPolyfilled:()=>Cn,devNull:()=>Ft,detectEmbed:()=>M,debounceFn:()=>je,debounce:()=>Ke,createDIContainer:()=>Kt,combine:()=>Fe,cloneDeepWith:()=>L,cloneDeep:()=>Me,clearVideoElement:()=>ht,checkNever:()=>ee,cancelIdleCallbackPolyfilled:()=>Hn,buffer:()=>Ue,atPolyfilled:()=>In,assertQualityIsExact:()=>De,assertNullable:()=>C,assertNotEmptyArray:()=>re,assertNonNullable:()=>S,assertNever:()=>g,assertEmptyArray:()=>ie,arrayWith:()=>nn,arrayToSpliced:()=>tn,arrayToSorted:()=>en,arrayToReversed:()=>$t,arrayIncludes:()=>Qt,arrayFlatMap:()=>Zt,arrayFlat:()=>Xt,arrayFindLastIndex:()=>Yt,arrayFindLast:()=>Jt,arrayAt:()=>qt,areQualitiesExact:()=>Ee,addScript:()=>ae,abortable:()=>ce,VideoQuality:()=>_e,ValueSubject:()=>Pe,VKNumericLanguage:()=>Ot,VERSION:()=>m,TracerFactory:()=>Et,SubscriptionRemovable:()=>He,Subscription:()=>h,Subject:()=>x,RequestPolyfilled:()=>wn,ReplaySubject:()=>Ne,Observable:()=>b,Logger:()=>te,InternalsExposure:()=>Pt,InterfaceLanguage:()=>Nt,InjectionToken:()=>Gt,INTERNAL_EXPOSE_GLOBAL_KEY:()=>q,ErrorCategory:()=>Dt,AppTracer:()=>Y,AbortSignalPolyfilled:()=>En,AbortControllerPolyfilled:()=>Tn}),module.exports=c(p);var m=`1.0.90-dev.93411ef3c.0`;class h{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 g=e=>{throw Error(`${e} is value of unexpected type`)},ee=e=>{},_=()=>{},v=e=>{throw console.error(e),e},y=e=>{console.error(e)};class b{constructor(t){e(this,`suppressErrors`,!1),t&&(this._subscribe=t)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?y:v,r;r=t?typeof t==`function`?{next:t,error:_}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:_};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 h().add(()=>{switch(i.next=_,i.error=_,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return g(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class x extends b{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 h().add(()=>this.subscribers.delete(t))}}class te{constructor(){e(this,`log$`,new x),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 S(e,t=`Assertion "value is not nullable" failed`){if(e==null)throw Error(t)}function C(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 ne=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>w(t)));function re(e,t){if(!e?.length)throw Error(t)}function ie(e,t){if(e?.length)throw Error(t)}var E=()=>globalThis,D=(e=E())=>!!(e.window&&e.screen),ae=(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)}),oe=typeof E().performance?.now==`function`?()=>E().performance.now():()=>Date.now(),se=()=>Math.trunc(oe()),ce=(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}),le=(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},ue={};f(ue,{set:()=>pe,remove:()=>he,isPersistent:()=>de,has:()=>me,get:()=>fe,clear:()=>ge});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},de=()=>j()===0,fe=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:g(t)}},pe=(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:g(n)}},me=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 g(t),!1}},he=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:g(t)}},ge=()=>{let e=j();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:g(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)}},_e;(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`})(_e||={});var N={"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)=>N[e].height>N[t].height,ye=(e,t)=>N[e].height>=N[t].height,P=(e,t)=>N[e].height<N[t].height,be=(e,t)=>N[e].height<=N[t].height,xe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:P(e,t)?1:-1)[0],Se=Object.keys(N).sort((e,t)=>P(e,t)?-1:1),Ce=(e,t=.02)=>[...Se].find(n=>N[n].height*(1+t)>=e),we=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return Se.find(e=>{let t=N[e];return t.width>=r&&t.height>=n})},Te=e=>N[e].height,F=e=>e===`Invariant quality`,Ee=e=>e.every(e=>!F(e));function De(e){if(F(e))throw Error(`Expected exact quality`)}var Oe=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``}},ke=(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]=ke(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},Ae=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 je(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 ee(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&&g(s),l=0,r=c=i=s=void 0}function te(){return s===void 0?o:b(Date.now())}function S(){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 ee(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=te,C.pending=S,C}var I=(e,n=0,r)=>je(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),L=(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]=L(e[r],t):n[r]=e[r]}return n},Me=e=>L(e);class Ne extends x{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 h().add(()=>this.subscribers.delete(t))}}class Pe extends x{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 Fe(e){return new b(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 h)})}function Ie(...e){return new b(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new h))}var Le=e=>new b(t=>{let n=E().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>E().clearTimeout(n)}),Re=e=>new b(t=>{let n=E(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function ze(e){return new b(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 Be=ze,Ve=(e,t)=>new b(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class He extends h{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function Ue(e){return t=>new b(n=>t.subscribe(new We(n,e)))}class We{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 Ge={leading:!1,trailing:!0};function Ke(e,t=Ge){return n=>new b(r=>n.subscribe(new qe(r,e,t)))}class qe{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 Je={leading:!0,trailing:!1};function Ye(e,t=Je){return n=>new b(r=>n.subscribe(new Xe(r,e,t)))}class Xe{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 Ze(e){return t=>new b(n=>t.subscribe(new Qe(n,e)))}class Qe{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 $e=(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)},et=(e,t)=>e instanceof Object&&t instanceof Object?$e(e,t):e===t;function tt(e=et){return t=>new b(n=>t.subscribe(new nt(n,e)))}var R={};class nt{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,R),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===R||!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 z(e){return t=>new b(n=>t.subscribe(new rt(n,e)))}class rt{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 it(e){return z(()=>e)}function at(){return e=>new b(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 ot(){return e=>new b(t=>e.subscribe(new st(t)))}class st{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 ct(e){return t=>new b(n=>t.subscribe(new lt(n,e)))}class lt{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 ut(e){return t=>new b(n=>t.subscribe(new dt(n,e)))}class dt{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 ft(e=0){return t=>{let n=0,r=new Ne(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new b(e=>(n++,a(r.subscribe(e))))}}var pt=300,mt=(e,t=pt)=>new b(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(I(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()}),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},ht=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},gt=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},_t=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),vt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),yt=e=>e!==void 0&&e!==``?e:vt().toString();function bt(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 xt(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),St=e=>{if(!V(e))throw e},Ct=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?B(n):{value:n})},H=(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 U{constructor({name:t,getParentContext:n}){e(this,`dynamicImportTimeout`,5e3),e(this,`span`,void 0),e(this,`context`,void 0),e(this,`childTracers`,[]),e(this,`initPromise`,void 0),U.dynamicImportStatus===`not_started`&&(U.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=U.dynamicImportPromise.then(e=>{U.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n},r)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=U.dynamicImports,{context:i,trace:a}=r;this.span=U.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}loadOpentelemetry(){var e=this;return n(function*(){if(U.dynamicImportStatus===`not_started`){U.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]);U.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},U.dynamicImportStatus=`completed`}catch{U.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return T(this.span)||U.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},H(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},H(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},H(n)),{},{type:`critical`}),r)})}createComponentTracer(e){let t=new U({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}e(U,`rootTracer`,void 0),e(U,`dynamicImportStatus`,`not_started`),e(U,`dynamicImports`,void 0),e(U,`dynamicImportPromise`,void 0);class wt extends U{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=U.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:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),U.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class W{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new W({name:e})}end(){}getTraceId(){return this.fakeTraceId}}var G=()=>!0,K={level:0,filter:G,name:`Noname Tracer`,outputMethod:`log`};class Tt{constructor({name:t,level:n,filter:r,outputMethod:i}={}){e(this,`name`,void 0),e(this,`filter`,G),e(this,`level`,K.level),e(this,`outputMethod`,K.outputMethod),e(this,`childTracers`,[]),this.filter=r??this.filter,this.level=n??this.level,this.outputMethod=i??this.outputMethod,this.name=t??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 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)||E().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&E().console.error(this.createMessage(e,t))}}class Et{static createRootTracer(e=`fake`){switch(e){case`real`:return new wt;case`debug`:return new Tt;default:return new W}}}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.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=function(){var e=n(function*(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(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),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{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[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 Ft={};f(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=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Vt=e=>ne({id:e.id,message:e.message,category:e.category,data:Ht(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Ht(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Ut=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Wt=()=>{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 Y{constructor(n,r,i,a){e(this,`dynamicImportTimeout`,5e3),e(this,`componentName`,void 0),e(this,`subscription`,new h),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),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{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)return;let u=Y.tracerErrorMap.get(this.componentName);try{let r=Ut(e);u?.error(r,{crashIdSource:r.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),Vt(e)),Wt()),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 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:Bt,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s)}catch(e){console.error(e)}})()}loadModule(){var e=this;w(Y.loadPromise)||(Y.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>E().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)}}()())}}e(Y,`tracerErrorMap`,new Map),e(Y,`appTracerModule`,null),e(Y,`loadPromise`,null);class Gt{constructor(t,n){e(this,`options`,void 0),e(this,`symbol`,void 0),this.options=n,this.symbol=Symbol(t)}}var Kt=()=>{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},Jt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Yt=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},Xt=(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},Zt=(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},Qt=(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},$t=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},en=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},tn=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},nn=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},rn=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),an=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},on=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},sn=Object.prototype.hasOwnProperty,cn=(e,t)=>sn.call(e,t),ln=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},un=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}))))},dn=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`))})})})},fn=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),pn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},mn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:hn,NativeAbortController:gn}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function _n(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 vn(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 yn{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 yn{constructor(){super(),this.listeners||yn.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=vn(e),n=_n(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 bn(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 xn(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!bn({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&&bn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Sn=$?xn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Cn=$?Sn.fetch:Q.fetch,wn=$?Sn.Request:Q.Request,Tn=$?Z:Q.AbortController,En=$?X:Q.AbortSignal,Dn=(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*On(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 kn=(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)},An=(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},jn=(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)},Mn=e=>e.replace(/^\s+/,``),Nn=e=>e.replace(/\s+$/,``),Pn=Mn,Fn=Nn,In=(e,t)=>typeof e==`string`?Dn(e,t):qt(e,t),Ln=(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)},Rn=e=>Q.clearTimeout(e),zn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Bn=!zn(Q.requestIdleCallback)||!zn(Q.cancelIdleCallback),Vn=Bn?Ln:Q.requestIdleCallback,Hn=Bn?Rn:Q.cancelIdleCallback,Un=(e,t,n)=>typeof e==`string`?e.includes(t,n):Qt(e,t,n),Wn=(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.90-dev.524dbd943.0
3
- * Thu, 14 May 2026 09:09:31 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.90-dev.93411ef3c.0
3
+ * Mon, 18 May 2026 11:32:01 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/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";var r=Object.defineProperty,i=e=>e;function a(e,t){this[e]=i.bind(null,t)}var o=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0,configurable:!0,set:a.bind(t,n)})},s=`1.0.90-dev.524dbd943.0`;class c{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 l=e=>{throw Error(`${e} is value of unexpected type`)},u=e=>{},d=()=>{},f=e=>{throw console.error(e),e},p=e=>{console.error(e)};class m{constructor(t){e(this,`suppressErrors`,!1),t&&(this._subscribe=t)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?p:f,r;r=t?typeof t==`function`?{next:t,error:d}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:d};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=d,i.error=d,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return l(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class h extends m{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 c().add(()=>this.subscribers.delete(t))}}class g{constructor(){e(this,`log$`,new h),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 _(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 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 te(e,t){if(!e?.length)throw Error(t)}function x(e,t){if(e?.length)throw Error(t)}var S=()=>globalThis,C=(e=S())=>!!(e.window&&e.screen),w=(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=S().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)}),ne=typeof S().performance?.now==`function`?()=>S().performance.now():()=>Date.now(),re=()=>Math.trunc(ne()),ie=(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}),ae=(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},oe={};o(oe,{set:()=>le,remove:()=>de,isPersistent:()=>se,has:()=>ue,get:()=>ce,clear:()=>fe});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},se=()=>O()===0,ce=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:l(t)}},le=(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:l(n)}},ue=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 l(t),!1}},de=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:l(t)}},fe=()=>{let e=O();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return T?.clear();default:l(e)}},k=()=>{let e,t=[],n=S();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)}},pe;(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`})(pe||={});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}},me=(e,t)=>A[e].height>A[t].height,he=(e,t)=>A[e].height>=A[t].height,j=(e,t)=>A[e].height<A[t].height,ge=(e,t)=>A[e].height<=A[t].height,_e=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:j(e,t)?1:-1)[0],ve=Object.keys(A).sort((e,t)=>j(e,t)?-1:1),ye=(e,t=.02)=>[...ve].find(n=>A[n].height*(1+t)>=e),be=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return ve.find(e=>{let t=A[e];return t.width>=r&&t.height>=n})},xe=e=>A[e].height,M=e=>e===`Invariant quality`,Se=e=>e.every(e=>!M(e));function Ce(e){if(M(e))throw Error(`Expected exact quality`)}var we=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``}},Te=(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]=Te(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 De(e,t=0,n){let r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0,p=!t&&t!==0&&typeof S().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&&S().cancelAnimationFrame(s),S().requestAnimationFrame(e)):setTimeout(e,t)}function g(e){if(p){S().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 te(){s!==void 0&&g(s),l=0,r=c=i=s=void 0}function x(){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 _(c);if(d)return s=h(y,t),m(c)}return s===void 0&&(s=h(y,t)),o}return w.cancel=te,w.flush=x,w.pending=C,w}var Oe=(e,n=0,r)=>De(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),N=(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]=N(e[r],t):n[r]=e[r]}return n},ke=e=>N(e);class Ae extends h{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 c().add(()=>this.subscribers.delete(t))}}class P extends h{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 m(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 Me(...e){return new m(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new c))}var Ne=e=>new m(t=>{let n=S().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>S().clearTimeout(n)}),Pe=e=>new m(t=>{let n=S(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Fe(e){return new m(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 m(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Re extends c{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function ze(e){return t=>new m(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 m(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=S();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 We={leading:!0,trailing:!1};function Ge(e,t=We){return n=>new m(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,y(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=S().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 m(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 m(n=>t.subscribe(new Qe(n,e)))}var F={};class Qe{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,F),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===F||!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 I(e){return t=>new m(n=>t.subscribe(new $e(n,e)))}class $e{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 et(e){return I(()=>e)}function tt(){return e=>new m(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 nt(){return e=>new m(t=>e.subscribe(new rt(t)))}class rt{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 it(e){return t=>new m(n=>t.subscribe(new at(n,e)))}class at{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 ot(e){return t=>new m(n=>t.subscribe(new st(n,e)))}class st{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 ct(e=0){return t=>{let n=0,r=new Ae(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new m(e=>(n++,a(r.subscribe(e))))}}var lt=300,ut=(e,t=lt)=>new m(n=>{let r=S(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!C(r))return;let o=new r.ResizeObserver(Oe(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()}),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},dt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ft=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},pt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),mt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ht=e=>e!==void 0&&e!==``?e:mt().toString();function gt(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 _t(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),vt=e=>{if(!R(e))throw e},yt=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{constructor({name:t,getParentContext:n,getRootTracerContext:r}){e(this,`dynamicImportTimeout`,5e3),e(this,`subscription`,new c),e(this,`span`,void 0),e(this,`context`,void 0),e(this,`childTracers`,[]),e(this,`initPromise`,void 0),e(this,`getRootTracerContext`,void 0),B.dynamicImportStatus===`not_started`&&(B.dynamicImportPromise=this.loadOpentelemetry());let i=Date.now();this.initPromise=B.dynamicImportPromise.then(e=>{B.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n,getRootTracerContext:r},i)})}init({name:e,getParentContext:t,getRootTracerContext:n},r){let i=n?.();if(y(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=>{v(e)&&this.span.setAttributes(e)}))}loadOpentelemetry(){var e=this;return n(function*(){if(B.dynamicImportStatus===`not_started`){B.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]);B.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},B.dynamicImportStatus=`completed`}catch{B.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return y(this.span)||B.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},z(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},z(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},z(n)),{},{type:`critical`}),r)})}createComponentTracer(e){let t=new B({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())})}}e(B,`dynamicImportStatus`,`not_started`),e(B,`dynamicImports`,void 0),e(B,`dynamicImportPromise`,void 0);var V=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`;class bt extends B{constructor(){super({name:`Root`}),e(this,`attributes$`,new P(null))}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{constructor(t){e(this,`fakeTraceId`,void 0)}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{constructor({name:t,level:n,filter:r,outputMethod:i}={}){e(this,`name`,void 0),e(this,`filter`,U),e(this,`level`,W.level),e(this,`outputMethod`,W.outputMethod),e(this,`childTracers`,[]),this.filter=r??this.filter,this.level=n??this.level,this.outputMethod=i??this.outputMethod,this.name=t??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)||S().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&S().console.error(this.createMessage(e,t))}addSubscription(e){}setSpanAttributes(e){}}class xt{static createRootTracer(e=`fake`){switch(e){case`real`:return new bt;case`debug`:return new G;default:return new H}}}var St;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(St||={});var Ct;(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`})(Ct||={});var wt=`vk.com`,Tt=function(){var e=n(function*(e,t,n){let r=new URL(`https://${wt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Et(yield(yield fetch(r.toString())).json(),n)});return function(t,n,r){return e.apply(this,arguments)}}(),Et=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),Dt(n)])),Dt=e=>Array.isArray(e)?e[0]:e,Ot;(e=>{e.RU=`ru`,e.EN=`en`})(Ot||={});var K=`__vk_vp_internals_exposure`;class kt{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 At={};o(At,{subscribe:()=>Pt,push:()=>Nt,destroy:()=>Mt,create:()=>jt});var q=new Map,jt=(e,t)=>q.set(e,t??[]),Mt=e=>q.delete(e),Nt=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Pt=(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)}},Ft=e=>b({id:e.id,message:e.message,category:e.category,data:It(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function It(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Lt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Rt=()=>{try{var e;let{origin:n,pathname:r,search:i,hostname:a}=((e=S())==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 c),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),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=k();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{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)return;let u=J.tracerErrorMap.get(this.componentName);try{let r=Lt(e);u?.error(r,{crashIdSource:r.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},this.context),Ft(e)),Rt()),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:V,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),J.tracerErrorMap.set(e.componentName,s)}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)=>S().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 zt{constructor(t,n){e(this,`options`,void 0),e(this,`symbol`,void 0),this.options=n,this.symbol=Symbol(t)}}var Bt=()=>{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()}}},Vt=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},Ht=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Ut=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},Wt=(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},Gt=(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},Kt=(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},qt=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},Jt=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},Yt=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},Xt=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},Zt=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),Qt=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},$t=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},en=Object.prototype.hasOwnProperty,tn=(e,t)=>en.call(e,t),nn=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},rn=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}))))},an=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`))})})})},on=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),sn=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},cn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:ln,NativeAbortController:un}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function dn(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 fn(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 pn{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 pn{constructor(){super(),this.listeners||pn.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=fn(e),n=dn(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 mn(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}),hn=$?mn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,gn=$?hn.fetch:Q.fetch,_n=$?hn.Request:Q.Request,vn=$?X:Q.AbortController,yn=$?Y:Q.AbortSignal,bn=(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*xn(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 Sn=(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)},Cn=(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},wn=(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)},Tn=e=>e.replace(/^\s+/,``),En=e=>e.replace(/\s+$/,``),Dn=Tn,On=En,kn=(e,t)=>typeof e==`string`?bn(e,t):Vt(e,t),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)},jn=e=>Q.clearTimeout(e),Mn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Nn=!Mn(Q.requestIdleCallback)||!Mn(Q.cancelIdleCallback),Pn=Nn?An:Q.requestIdleCallback,Fn=Nn?jn:Q.cancelIdleCallback,In=(e,t,n)=>typeof e==`string`?e.includes(t,n):Kt(e,t,n),Ln=(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,be as videoSizeToQuality,xe as videoQualityToHeight,ye as videoHeightToQuality,Ln as urlCanParsePolyfilled,Ne as timeout,Ee as timeCodeToString,Oe as throttleFn,Ge as throttle,it as tap,vt as suppressAbort,Tn as stringTrimStart,On as stringTrimRight,Dn as stringTrimLeft,En as stringTrimEnd,wn as stringReplaceAll,Cn as stringPadStart,Sn as stringPadEnd,xn as stringMatchAll,bn as stringAt,ot as skip,ct as shareReplay,oe as safeStorage,Pn as requestIdleCallbackPolyfilled,cn as promiseWithResolvers,sn as promiseTry,on as promiseFinally,an as promiseAny,rn as promiseAllSettled,nt as pairwise,tt as once,ut as observeElementSize,Ie as observableFrom,nn as objectValues,tn as objectHasOwn,$t as objectFromEntries,Qt as objectEntries,re as nowInt,ne as now,d as noop,Me as merge,et as mapTo,I as map,Tt as loadVKLangPack,ft as isValidURL,y as isNullable,v as isNonNullable,ge as isLowerOrEqual,j as isLower,M as isInvariantQuality,pt as isIntersecting,he as isHigherOrEqual,me as isHigher,C as isBrowserWindow,R as isAbortError,Pe as interval,gt as interpolate,In as includesPolyfilled,Zt as globalThisPolyfill,S as getWindow,we as getVideoQualityLabel,yt as getTraceSubscriptionMethod,_t as getRangeAroundIndex,ht as getPlayerId,_e as getHighestQuality,ae as getExponentialDelay,Le as fromEvent,L as flattenObject,Ze as filterChanged,qe as filter,Te as fillWithDefault,gn as fetchPolyfilled,At as devNull,k as detectEmbed,De as debounceFn,He as debounce,Bt as createDIContainer,je as combine,N as cloneDeepWith,ke as cloneDeep,dt as clearVideoElement,u as checkNever,Fn as cancelIdleCallbackPolyfilled,ze as buffer,kn as atPolyfilled,Ce as assertQualityIsExact,ee as assertNullable,te as assertNotEmptyArray,_ as assertNonNullable,l as assertNever,x as assertEmptyArray,Xt as arrayWith,Yt as arrayToSpliced,Jt as arrayToSorted,qt as arrayToReversed,Kt as arrayIncludes,Gt as arrayFlatMap,Wt as arrayFlat,Ut as arrayFindLastIndex,Ht as arrayFindLast,Vt as arrayAt,Se as areQualitiesExact,w as addScript,ie as abortable,pe as VideoQuality,P as ValueSubject,Ct as VKNumericLanguage,s as VERSION,xt as TracerFactory,Re as SubscriptionRemovable,c as Subscription,h as Subject,_n as RequestPolyfilled,Ae as ReplaySubject,m as Observable,g as Logger,kt as InternalsExposure,Ot as InterfaceLanguage,zt as InjectionToken,K as INTERNAL_EXPOSE_GLOBAL_KEY,St as ErrorCategory,J as AppTracer,yn as AbortSignalPolyfilled,vn as AbortControllerPolyfilled};
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";var r=Object.defineProperty,i=e=>e;function a(e,t){this[e]=i.bind(null,t)}var o=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0,configurable:!0,set:a.bind(t,n)})},s=`1.0.90-dev.93411ef3c.0`;class c{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 l=e=>{throw Error(`${e} is value of unexpected type`)},u=e=>{},d=()=>{},f=e=>{throw console.error(e),e},p=e=>{console.error(e)};class m{constructor(t){e(this,`suppressErrors`,!1),t&&(this._subscribe=t)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,t){let n=this.suppressErrors?p:f,r;r=t?typeof t==`function`?{next:t,error:d}:{next:e=>t.next(e),error:e=>t.error?.call(t,e)}:{next:n,error:d};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=d,i.error=d,typeof a){case`function`:a();return;case`object`:a.unsubscribe();return;case`undefined`:return;default:return l(a)}})}pipe(...e){return e.reduce((e,t)=>t(e),this)}_subscribe(e){}}class h extends m{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 c().add(()=>this.subscribers.delete(t))}}class ee{constructor(){e(this,`log$`,new h),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 g(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function _(e){return e!=null}function v(e){return e==null}var y=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>_(t)));function ne(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)}),re=typeof x().performance?.now==`function`?()=>x().performance.now():()=>Date.now(),ie=()=>Math.trunc(re()),ae=(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}),oe=(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},se={};o(se,{set:()=>ue,remove:()=>fe,isPersistent:()=>ce,has:()=>de,get:()=>le,clear:()=>pe});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},ce=()=>D()===0,le=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:l(t)}},ue=(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:l(n)}},de=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 l(t),!1}},fe=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:l(t)}},pe=()=>{let e=D();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return w?.clear();default:l(e)}},O=()=>{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)}},me;(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`})(me||={});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}},he=(e,t)=>k[e].height>k[t].height,ge=(e,t)=>k[e].height>=k[t].height,A=(e,t)=>k[e].height<k[t].height,_e=(e,t)=>k[e].height<=k[t].height,ve=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:A(e,t)?1:-1)[0],ye=Object.keys(k).sort((e,t)=>A(e,t)?-1:1),be=(e,t=.02)=>[...ye].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 ye.find(e=>{let t=k[e];return t.width>=r&&t.height>=n})},Se=e=>k[e].height,j=e=>e===`Invariant quality`,Ce=e=>e.every(e=>!j(e));function we(e){if(j(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``}},M=(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]=M(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 N(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 ee(e){if(p){x().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 S(){return s!==void 0}function C(...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 C.cancel=ne,C.flush=b,C.pending=S,C}var De=(e,n=0,r)=>N(e,n,t(t(t({},{leading:!0,trailing:!0}),r),{},{maxWait:n})),P=(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]=P(e[r],t):n[r]=e[r]}return n},Oe=e=>P(e);class ke extends h{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 c().add(()=>this.subscribers.delete(t))}}class Ae extends h{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 m(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 Me(...e){return new m(t=>e.reduce((e,n)=>e.add(n.subscribe(t)),new c))}var Ne=e=>new m(t=>{let n=x().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>x().clearTimeout(n)}),Pe=e=>new m(t=>{let n=x(),r=n.setInterval(()=>t.next(),e);return()=>{r&&=(n.clearInterval(r),void 0)}});function Fe(e){return new m(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 m(n=>{let r=e=>n.next(e);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});class Re extends c{remove(e){this.subscriptions=this.subscriptions.filter(t=>t!==e)}}function ze(e){return t=>new m(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 m(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=x();_(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 m(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,v(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 qe(e){return t=>new m(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 m(n=>t.subscribe(new Qe(n,e)))}var F={};class Qe{constructor(t,n){e(this,`destination`,void 0),e(this,`predicate`,void 0),e(this,`lastValue`,F),this.destination=t,this.predicate=n}next(e){let n;try{n=this.lastValue===F||!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 I(e){return t=>new m(n=>t.subscribe(new $e(n,e)))}class $e{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 et(e){return I(()=>e)}function tt(){return e=>new m(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 nt(){return e=>new m(t=>e.subscribe(new rt(t)))}class rt{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 it(e){return t=>new m(n=>t.subscribe(new at(n,e)))}class at{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 ot(e){return t=>new m(n=>t.subscribe(new st(n,e)))}class st{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 ct(e=0){return t=>{let n=0,r=new ke(e),i=t.subscribe(r),a=e=>()=>{e.unsubscribe(),n--,n===0&&i.unsubscribe()};return new m(e=>(n++,a(r.subscribe(e))))}}var lt=300,ut=(e,t=lt)=>new m(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(De(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),_(r)&&_(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},dt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ft=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},pt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),mt=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),ht=e=>e!==void 0&&e!==``?e:mt().toString();function gt(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 _t(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),vt=e=>{if(!R(e))throw e},yt=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{constructor({name:t,getParentContext:n}){e(this,`dynamicImportTimeout`,5e3),e(this,`span`,void 0),e(this,`context`,void 0),e(this,`childTracers`,[]),e(this,`initPromise`,void 0),B.dynamicImportStatus===`not_started`&&(B.dynamicImportPromise=this.loadOpentelemetry());let r=Date.now();this.initPromise=B.dynamicImportPromise.then(e=>{B.dynamicImportStatus===`completed`&&this.init({name:t,getParentContext:n},r)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=B.dynamicImports,{context:i,trace:a}=r;this.span=B.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}loadOpentelemetry(){var e=this;return n(function*(){if(B.dynamicImportStatus===`not_started`){B.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]);B.dynamicImports={opentelemetryApi:r,opentelemetrySdk:i,tracer:a,opentelemetryResources:o,opentelemetrySemanticConventions:s},B.dynamicImportStatus=`completed`}catch{B.dynamicImportStatus=`failed`}}})()}isComponentTracerNotInitialized(){return v(this.span)||B.dynamicImportStatus===`failed`}log(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},z(n)),{},{type:`log`}),r)})}error(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},z(n)),{},{type:`error`}),r)})}critical(e,n){let r=Date.now();this.initPromise.then(i=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,t(t({},z(n)),{},{type:`critical`}),r)})}createComponentTracer(e){let t=new B({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}e(B,`rootTracer`,void 0),e(B,`dynamicImportStatus`,`not_started`),e(B,`dynamicImports`,void 0),e(B,`dynamicImportPromise`,void 0);class bt extends B{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:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),B.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class V{constructor(t){e(this,`fakeTraceId`,void 0)}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new V({name:e})}end(){}getTraceId(){return this.fakeTraceId}}var H=()=>!0,U={level:0,filter:H,name:`Noname Tracer`,outputMethod:`log`};class W{constructor({name:t,level:n,filter:r,outputMethod:i}={}){e(this,`name`,void 0),e(this,`filter`,H),e(this,`level`,U.level),e(this,`outputMethod`,U.outputMethod),e(this,`childTracers`,[]),this.filter=r??this.filter,this.level=n??this.level,this.outputMethod=i??this.outputMethod,this.name=t??U.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 W({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))}}class xt{static createRootTracer(e=`fake`){switch(e){case`real`:return new bt;case`debug`:return new W;default:return new V}}}var G;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(G||={});var K;(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`})(K||={});var St=`vk.com`,Ct=function(){var e=n(function*(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(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),Tt(n)])),Tt=e=>Array.isArray(e)?e[0]:e,Et;(e=>{e.RU=`ru`,e.EN=`en`})(Et||={});var q=`__vk_vp_internals_exposure`;class Dt{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[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 Ot={};o(Ot,{subscribe:()=>Mt,push:()=>jt,destroy:()=>At,create:()=>kt});var J=new Map,kt=(e,t)=>J.set(e,t??[]),At=e=>J.delete(e),jt=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Mt=(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)}},Nt=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Pt=e=>y({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&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Lt=()=>{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 Y{constructor(n,r,i,a){e(this,`dynamicImportTimeout`,5e3),e(this,`componentName`,void 0),e(this,`subscription`,new c),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),this.componentName=n,this.options=r,this.envParams=i,this.context=t({},a);let{isEmbed:o,topOrigin:s}=O();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{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)return;let u=Y.tracerErrorMap.get(this.componentName);try{let r=It(e);u?.error(r,{crashIdSource:r.name,severity:n?.severity??(e.traceAsLog?`debug`:void 0),keys:t(t(t(t({},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()}init(){var e=this;return n(function*(){try{if(yield Y.loadPromise,Y.tracerErrorMap.has(e.componentName)||v(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});_(e.options.userId)&&s.setUserId(e.options.userId),o&&r(e.componentName,{appToken:Nt,environment:e.envParams.env,versionCode:1,versionName:e.envParams.version}),Y.tracerErrorMap.set(e.componentName,s)}catch(e){console.error(e)}})()}loadModule(){var e=this;_(Y.loadPromise)||(Y.loadPromise=function(){var t=n(function*(){try{let t=new Promise((t,n)=>x().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)}}()())}}e(Y,`tracerErrorMap`,new Map),e(Y,`appTracerModule`,null),e(Y,`loadPromise`,null);class Rt{constructor(t,n){e(this,`options`,void 0),e(this,`symbol`,void 0),this.options=n,this.symbol=Symbol(t)}}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()}}},Bt=(e,t)=>{let n=e.length,r=t>=0?t:n+t;return r>=0&&r<n?e[r]:void 0},Vt=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}},Ht=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n],n,e))return n;return-1},Ut=(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},Wt=(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},Gt=(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},Kt=e=>{let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e[t-1-r];return n},qt=(e,t)=>{let n=e.slice();return t?n.sort(t):n.sort()},Jt=(e,t,n,...r)=>{let i=e.slice();return n===void 0?i.splice(t):i.splice(t,n,...r),i},Yt=(e,t,n)=>{let r=e.length,i=t>=0?t:r+t,a=e.slice();return a[i]=n,a},Xt=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:Function(`return this`)(),Zt=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},Qt=e=>{let t={};for(let[n,r]of e)t[n]=r;return t},$t=Object.prototype.hasOwnProperty,en=(e,t)=>$t.call(e,t),tn=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},nn=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}))))},rn=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`))})})})},an=(e,t)=>e.then(e=>Promise.resolve(t()).then(()=>e),e=>Promise.resolve(t()).then(()=>{throw e})),on=e=>{try{return Promise.resolve(e())}catch(e){return Promise.reject(e)}},sn=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},{NativeAbortSignal:cn,NativeAbortController:ln}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function un(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 dn(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 fn{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 fn{constructor(){super(),this.listeners||fn.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=dn(e),n=un(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 pn(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 mn(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!pn({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&&pn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),hn=$?mn({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,gn=$?hn.fetch:Q.fetch,_n=$?hn.Request:Q.Request,vn=$?Z:Q.AbortController,yn=$?X:Q.AbortSignal,bn=(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*xn(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 Sn=(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)},Cn=(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},wn=(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)},Tn=e=>e.replace(/^\s+/,``),En=e=>e.replace(/\s+$/,``),Dn=Tn,On=En,kn=(e,t)=>typeof e==`string`?bn(e,t):Bt(e,t),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)},jn=e=>Q.clearTimeout(e),Mn=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Nn=!Mn(Q.requestIdleCallback)||!Mn(Q.cancelIdleCallback),Pn=Nn?An:Q.requestIdleCallback,Fn=Nn?jn:Q.cancelIdleCallback,In=(e,t,n)=>typeof e==`string`?e.includes(t,n):Gt(e,t,n),Ln=(e,t,n)=>{if(typeof e.canParse==`function`)return e.canParse(t,n);try{return new e(t,n),!0}catch{return!1}};export{y as withoutNullable,xe as videoSizeToQuality,Se as videoQualityToHeight,be as videoHeightToQuality,Ln as urlCanParsePolyfilled,Ne as timeout,Ee as timeCodeToString,De as throttleFn,Ge as throttle,it as tap,vt as suppressAbort,Tn as stringTrimStart,On as stringTrimRight,Dn as stringTrimLeft,En as stringTrimEnd,wn as stringReplaceAll,Cn as stringPadStart,Sn as stringPadEnd,xn as stringMatchAll,bn as stringAt,ot as skip,ct as shareReplay,se as safeStorage,Pn as requestIdleCallbackPolyfilled,sn as promiseWithResolvers,on as promiseTry,an as promiseFinally,rn as promiseAny,nn as promiseAllSettled,nt as pairwise,tt as once,ut as observeElementSize,Ie as observableFrom,tn as objectValues,en as objectHasOwn,Qt as objectFromEntries,Zt as objectEntries,ie as nowInt,re as now,d as noop,Me as merge,et as mapTo,I as map,Ct as loadVKLangPack,ft as isValidURL,v as isNullable,_ as isNonNullable,_e as isLowerOrEqual,A as isLower,j as isInvariantQuality,pt as isIntersecting,ge as isHigherOrEqual,he as isHigher,S as isBrowserWindow,R as isAbortError,Pe as interval,gt as interpolate,In as includesPolyfilled,Xt as globalThisPolyfill,x as getWindow,Te as getVideoQualityLabel,yt as getTraceSubscriptionMethod,_t as getRangeAroundIndex,ht as getPlayerId,ve as getHighestQuality,oe as getExponentialDelay,Le as fromEvent,L as flattenObject,Ze as filterChanged,qe as filter,M as fillWithDefault,gn as fetchPolyfilled,Ot as devNull,O as detectEmbed,N as debounceFn,He as debounce,zt as createDIContainer,je as combine,P as cloneDeepWith,Oe as cloneDeep,dt as clearVideoElement,u as checkNever,Fn as cancelIdleCallbackPolyfilled,ze as buffer,kn as atPolyfilled,we as assertQualityIsExact,g as assertNullable,ne as assertNotEmptyArray,te as assertNonNullable,l as assertNever,b as assertEmptyArray,Yt as arrayWith,Jt as arrayToSpliced,qt as arrayToSorted,Kt as arrayToReversed,Gt as arrayIncludes,Wt as arrayFlatMap,Ut as arrayFlat,Ht as arrayFindLastIndex,Vt as arrayFindLast,Bt as arrayAt,Ce as areQualitiesExact,C as addScript,ae as abortable,me as VideoQuality,Ae as ValueSubject,K as VKNumericLanguage,s as VERSION,xt as TracerFactory,Re as SubscriptionRemovable,c as Subscription,h as Subject,_n as RequestPolyfilled,ke as ReplaySubject,m as Observable,ee as Logger,Dt as InternalsExposure,Et as InterfaceLanguage,Rt as InjectionToken,q as INTERNAL_EXPOSE_GLOBAL_KEY,G as ErrorCategory,Y as AppTracer,yn as AbortSignalPolyfilled,vn as AbortControllerPolyfilled};
package/esnext.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.90-dev.524dbd943.0
3
- * Thu, 14 May 2026 09:09:31 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.90-dev.93411ef3c.0
3
+ * Mon, 18 May 2026 11:32:01 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/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:()=>Ce,videoQualityToHeight:()=>we,videoHeightToQuality:()=>Se,urlCanParsePolyfilled:()=>ln,timeout:()=>Fe,timeCodeToString:()=>Oe,throttleFn:()=>ke,throttle:()=>qe,tap:()=>ot,suppressAbort:()=>bt,skip:()=>ct,shareReplay:()=>ut,safeStorage:()=>le,requestIdleCallbackPolyfilled:()=>sn,pairwise:()=>it,once:()=>rt,observeElementSize:()=>ft,observableFrom:()=>Re,nowInt:()=>oe,now:()=>ae,noop:()=>h,merge:()=>Pe,mapTo:()=>nt,map:()=>R,loadVKLangPack:()=>Ot,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:()=>xt,getRangeAroundIndex:()=>yt,getPlayerId:()=>_t,getHighestQuality:()=>be,getExponentialDelay:()=>ce,fromEvent:()=>ze,flattenObject:()=>z,filterChanged:()=>$e,filter:()=>Ye,fillWithDefault:()=>P,fetchPolyfilled:()=>Qt,devNull:()=>Nt,detectEmbed:()=>ge,debounceFn:()=>F,debounce:()=>We,createDIContainer:()=>Ut,combine:()=>Ne,cloneDeepWith:()=>I,cloneDeep:()=>Ae,clearVideoElement:()=>pt,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>cn,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:()=>Et,VERSION:()=>d,TracerFactory:()=>wt,SubscriptionRemovable:()=>Be,Subscription:()=>f,Subject:()=>v,RequestPolyfilled:()=>$t,ReplaySubject:()=>je,Observable:()=>_,Logger:()=>y,InternalsExposure:()=>Mt,InterfaceLanguage:()=>jt,InjectionToken:()=>Ht,INTERNAL_EXPOSE_GLOBAL_KEY:()=>q,ErrorCategory:()=>Tt,AppTracer:()=>Y,AbortSignalPolyfilled:()=>tn,AbortControllerPolyfilled:()=>en}),module.exports=a(u);var d=`1.0.90-dev.524dbd943.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},xt=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 St 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 Ct{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 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)||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 wt{static createRootTracer(e=`fake`){switch(e){case`real`:return new St;case`debug`:return new Ct;default:return new W}}}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.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=async(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(await(await fetch(r.toString())).json(),n)},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 q=`__vk_vp_internals_exposure`;class Mt{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 Nt={};l(Nt,{subscribe:()=>Lt,push:()=>It,destroy:()=>Ft,create:()=>Pt});var J=new Map,Pt=(e,t)=>J.set(e,t??[]),Ft=e=>J.delete(e),It=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Lt=(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)}},Rt=e=>w({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&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Vt=()=>{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;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{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=Y.tracerErrorMap.get(this.componentName);try{let n=Bt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...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()}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)}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 Ht{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Ut=()=>{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:Wt,NativeAbortController:Gt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Kt(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 qt(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 Jt{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 Jt{constructor(){super(),this.listeners||Jt.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=qt(e),n=Kt(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 Yt(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 Xt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Yt({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&&Yt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Zt=$?Xt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Qt=$?Zt.fetch:Q.fetch,$t=$?Zt.Request:Q.Request,en=$?Z:Q.AbortController,tn=$?X:Q.AbortSignal,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)},rn=e=>Q.clearTimeout(e),an=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),on=!an(Q.requestIdleCallback)||!an(Q.cancelIdleCallback),sn=on?nn:Q.requestIdleCallback,cn=on?rn:Q.cancelIdleCallback,ln=(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:()=>C,videoSizeToQuality:()=>we,videoQualityToHeight:()=>Te,videoHeightToQuality:()=>Ce,urlCanParsePolyfilled:()=>ln,timeout:()=>Fe,timeCodeToString:()=>ke,throttleFn:()=>F,throttle:()=>qe,tap:()=>st,suppressAbort:()=>xt,skip:()=>lt,shareReplay:()=>dt,safeStorage:()=>ue,requestIdleCallbackPolyfilled:()=>sn,pairwise:()=>at,once:()=>it,observeElementSize:()=>pt,observableFrom:()=>Re,nowInt:()=>se,now:()=>oe,noop:()=>h,merge:()=>Pe,mapTo:()=>rt,map:()=>L,loadVKLangPack:()=>Ot,isValidURL:()=>ht,isNullable:()=>S,isNonNullable:()=>x,isLowerOrEqual:()=>be,isLower:()=>j,isInvariantQuality:()=>M,isIntersecting:()=>gt,isHigherOrEqual:()=>ye,isHigher:()=>ve,isBrowserWindow:()=>ie,isAbortError:()=>z,interval:()=>Ie,interpolate:()=>yt,getWindow:()=>w,getVideoQualityLabel:()=>Oe,getTraceSubscriptionMethod:()=>St,getRangeAroundIndex:()=>bt,getPlayerId:()=>vt,getHighestQuality:()=>xe,getExponentialDelay:()=>le,fromEvent:()=>ze,flattenObject:()=>R,filterChanged:()=>$e,filter:()=>Ye,fillWithDefault:()=>N,fetchPolyfilled:()=>Qt,devNull:()=>Nt,detectEmbed:()=>_e,debounceFn:()=>P,debounce:()=>We,createDIContainer:()=>Wt,combine:()=>Ne,cloneDeepWith:()=>I,cloneDeep:()=>Ae,clearVideoElement:()=>mt,checkNever:()=>m,cancelIdleCallbackPolyfilled:()=>cn,buffer:()=>Ve,assertQualityIsExact:()=>De,assertNullable:()=>te,assertNotEmptyArray:()=>ne,assertNonNullable:()=>b,assertNever:()=>p,assertEmptyArray:()=>re,areQualitiesExact:()=>Ee,addScript:()=>ae,abortable:()=>ce,VideoQuality:()=>k,ValueSubject:()=>Me,VKNumericLanguage:()=>Et,VERSION:()=>d,TracerFactory:()=>wt,SubscriptionRemovable:()=>Be,Subscription:()=>f,Subject:()=>v,RequestPolyfilled:()=>$t,ReplaySubject:()=>je,Observable:()=>_,Logger:()=>y,InternalsExposure:()=>Mt,InterfaceLanguage:()=>jt,InjectionToken:()=>Ut,INTERNAL_EXPOSE_GLOBAL_KEY:()=>K,ErrorCategory:()=>Tt,AppTracer:()=>J,AbortSignalPolyfilled:()=>tn,AbortControllerPolyfilled:()=>en}),module.exports=a(u);var d=`1.0.90-dev.93411ef3c.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 te(e,t=`Assertion "value is nullable" failed`){if(e!=null)throw Error(t)}function x(e){return e!=null}function S(e){return e==null}var C=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>x(t)));function ne(e,t){if(!e?.length)throw Error(t)}function re(e,t){if(e?.length)throw Error(t)}var w=()=>globalThis,ie=(e=w())=>!!(e.window&&e.screen),ae=(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=w().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)}),oe=typeof w().performance?.now==`function`?()=>w().performance.now():()=>Date.now(),se=()=>Math.trunc(oe()),ce=(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},le=(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},ue={};l(ue,{set:()=>pe,remove:()=>he,isPersistent:()=>de,has:()=>me,get:()=>fe,clear:()=>ge});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},de=()=>O()===0,fe=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:p(t)}},pe=(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:p(n)}},me=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 p(t),!1}},he=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:p(t)}},ge=()=>{let e=O();switch(e){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return T?.clear();default:p(e)}},_e=()=>{let e,t=[],n=w();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)}},k;(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`})(k||={});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}},ve=(e,t)=>A[e].height>A[t].height,ye=(e,t)=>A[e].height>=A[t].height,j=(e,t)=>A[e].height<A[t].height,be=(e,t)=>A[e].height<=A[t].height,xe=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:j(e,t)?1:-1)[0],Se=Object.keys(A).sort((e,t)=>j(e,t)?-1:1),Ce=(e,t=.02)=>[...Se].find(n=>A[n].height*(1+t)>=e),we=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return Se.find(e=>{let t=A[e];return t.width>=r&&t.height>=n})},Te=e=>A[e].height,M=e=>e===`Invariant quality`,Ee=e=>e.every(e=>!M(e));function De(e){if(M(e))throw Error(`Expected exact quality`)}var Oe=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},ke=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 w().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&&w().cancelAnimationFrame(s),w().requestAnimationFrame(e)):setTimeout(e,t)}function ee(e){if(p){w().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 te(){s!==void 0&&ee(s),l=0,r=c=i=s=void 0}function x(){return s===void 0?o:b(Date.now())}function S(){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 g(c);if(d)return s=h(y,t),m(c)}return s===void 0&&(s=h(y,t)),o}return C.cancel=te,C.flush=x,C.pending=S,C}var F=(e,t=0,n)=>P(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=w().setTimeout(()=>{try{t.next()}catch(e){if(t.error)t.error(e);else throw e}},e);return()=>w().clearTimeout(n)}),Ie=e=>new _(t=>{let n=w(),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=w();x(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,S(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=w().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 tt(n,e)))}var et={};class tt{destination;predicate;lastValue=et;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===et||!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 L(e){return t=>new _(n=>t.subscribe(new nt(n,e)))}class nt{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 rt(e){return L(()=>e)}function it(){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 at(){return e=>new _(t=>e.subscribe(new ot(t)))}class ot{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 st(e){return t=>new _(n=>t.subscribe(new ct(n,e)))}class ct{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 lt(e){return t=>new _(n=>t.subscribe(new ut(n,e)))}class ut{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 dt(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 ft=300,pt=(e,t=ft)=>new _(n=>{let r=w(),{width:i,height:a}=e.getBoundingClientRect();if(n.next({width:i,height:a}),!ie(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),x(r)&&x(i)&&n.next({width:r,height:i})},t));return o.observe(e),()=>o.disconnect()}),R=(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=R(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},mt=(e,t=!1)=>{t&&(e.innerHTML=``),e.removeAttribute(`src`),e.load()},ht=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`https:`},gt=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),_t=(()=>{let e=0;return()=>{let t=e;return e=(e+1)%(2**53-1),t}})(),vt=e=>e!==void 0&&e!==``?e:_t().toString();function yt(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 bt(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 z=e=>e instanceof DOMException&&(e.name===`AbortError`||e.code===20),xt=e=>{if(!z(e))throw e},St=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?R(n):{value:n})},B=(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 V{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){V.dynamicImportStatus===`not_started`&&(V.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=V.dynamicImportPromise.then(r=>{V.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=V.dynamicImports,{context:i,trace:a}=r;this.span=V.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}async loadOpentelemetry(){if(V.dynamicImportStatus===`not_started`){V.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]);V.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},V.dynamicImportStatus=`completed`}catch{V.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return S(this.span)||V.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...B(t),type:`critical`},n)})}createComponentTracer(e){let t=new V({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}class Ct extends V{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=V.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:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),V.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}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}}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)||w().console[this.outputMethod](this.createMessage(e,t))}logError(e,t){this.filter(e,t)&&w().console.error(this.createMessage(e,t))}}class wt{static createRootTracer(e=`fake`){switch(e){case`real`:return new Ct;case`debug`:return new G;default:return new H}}}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.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=async(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(await(await fetch(r.toString())).json(),n)},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{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 Nt={};l(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=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,zt=e=>C({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&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Ht=()=>{try{let{origin:e,pathname:t,search:n,hostname:r}=w()?.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 f;options;envParams;context;isEmbed;embedParent;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=_e();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{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=J.tracerErrorMap.get(this.componentName);try{let n=Vt(e);l?.error(n,{crashIdSource:n.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 J.loadPromise,J.tracerErrorMap.has(this.componentName)||S(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});x(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:Rt,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),J.tracerErrorMap.set(this.componentName,o)}catch(e){console.error(e)}}loadModule(){x(J.loadPromise)||(J.loadPromise=(async()=>{try{let e=new Promise((e,t)=>w().setTimeout(t,this.dynamicImportTimeout));J.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){J.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 Y{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 Y{constructor(){super(),this.listeners||Y.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 Yt(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 Xt(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Yt({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&&Yt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Zt=$?Xt({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Qt=$?Zt.fetch:Q.fetch,$t=$?Zt.Request:Q.Request,en=$?Z:Q.AbortController,tn=$?X:Q.AbortSignal,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)},rn=e=>Q.clearTimeout(e),an=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),on=!an(Q.requestIdleCallback)||!an(Q.cancelIdleCallback),sn=on?nn:Q.requestIdleCallback,cn=on?rn:Q.cancelIdleCallback,ln=(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.90-dev.524dbd943.0
3
- * Thu, 14 May 2026 09:09:31 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.90-dev.93411ef3c.0
3
+ * Mon, 18 May 2026 11:32:01 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/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.90-dev.524dbd943.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},gt=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 _t 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 vt{static createRootTracer(e=`fake`){switch(e){case`real`:return new _t;case`debug`:return new G;default:return new H}}}var yt;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(yt||={});var bt;(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`})(bt||={});var xt=`vk.com`,St=async(e,t,n)=>{let r=new URL(`https://${xt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),Ct(await(await fetch(r.toString())).json(),n)},Ct=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),wt(n)])),wt=e=>Array.isArray(e)?e[0]:e,Tt;(e=>{e.RU=`ru`,e.EN=`en`})(Tt||={});var K=`__vk_vp_internals_exposure`;class Et{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 Dt={};r(Dt,{subscribe:()=>jt,push:()=>At,destroy:()=>kt,create:()=>Ot});var q=new Map,Ot=(e,t)=>q.set(e,t??[]),kt=e=>q.delete(e),At=(e,t)=>{let n=q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},jt=(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)}},Mt=e=>v({id:e.id,message:e.message,category:e.category,data:Nt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Nt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Pt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Ft=()=>{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;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{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=J.tracerErrorMap.get(this.componentName);try{let n=Pt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Mt(e),...Ft(),...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)}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 It{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Lt=()=>{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:Rt,NativeAbortController:zt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function Bt(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 Vt(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 Ht{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 Ht{constructor(){super(),this.listeners||Ht.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=Vt(e),n=Bt(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 Ut(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}),Wt=$?Ut({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Gt=$?Wt.fetch:Q.fetch,Kt=$?Wt.Request:Q.Request,qt=$?X:Q.AbortController,Jt=$?Y:Q.AbortSignal,Yt=(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)},Xt=e=>Q.clearTimeout(e),Zt=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Qt=!Zt(Q.requestIdleCallback)||!Zt(Q.cancelIdleCallback),$t=Qt?Yt:Q.requestIdleCallback,en=Qt?Xt:Q.cancelIdleCallback,tn=(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,tn 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,$t 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,St 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,gt as getTraceSubscriptionMethod,mt as getRangeAroundIndex,ft as getPlayerId,me as getHighestQuality,ne as getExponentialDelay,Me as fromEvent,L as flattenObject,Ke as filterChanged,He as filter,P as fillWithDefault,Gt as fetchPolyfilled,Dt as devNull,k as detectEmbed,F as debounceFn,Le as debounce,Lt as createDIContainer,Ee as combine,I as cloneDeepWith,Ce as cloneDeep,ct as clearVideoElement,s as checkNever,en 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,bt as VKNumericLanguage,i as VERSION,vt as TracerFactory,Ne as SubscriptionRemovable,a as Subscription,f as Subject,Kt as RequestPolyfilled,we as ReplaySubject,d as Observable,p as Logger,Et as InternalsExposure,Tt as InterfaceLanguage,It as InjectionToken,K as INTERNAL_EXPOSE_GLOBAL_KEY,yt as ErrorCategory,J as AppTracer,Jt as AbortSignalPolyfilled,qt 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.90-dev.93411ef3c.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)}},le=()=>{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],he=Object.keys(A).sort((e,t)=>j(e,t)?-1:1),ge=(e,t=.02)=>[...he].find(n=>A[n].height*(1+t)>=e),_e=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return he.find(e=>{let t=A[e];return t.width>=r&&t.height>=n})},ve=e=>A[e].height,M=e=>e===`Invariant quality`,ye=e=>e.every(e=>!M(e));function be(e){if(M(e))throw Error(`Expected exact quality`)}var xe=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},Se=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 _(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 F=(e,t=0,n)=>P(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(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),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},gt=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;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){B.dynamicImportStatus===`not_started`&&(B.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=B.dynamicImportPromise.then(r=>{B.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=B.dynamicImports,{context:i,trace:a}=r;this.span=B.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}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});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}class _t extends B{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:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),B.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class V{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new V({name:e})}end(){}getTraceId(){return this.fakeTraceId}}var H=()=>!0,U={level:0,filter:H,name:`Noname Tracer`,outputMethod:`log`};class W{name;filter=H;level=U.level;outputMethod=U.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??U.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 W({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))}}class vt{static createRootTracer(e=`fake`){switch(e){case`real`:return new _t;case`debug`:return new W;default:return new V}}}var G;(e=>{e.NETWORK=`network`,e.VIDEO_PIPELINE=`video_pipeline`,e.EXTERNAL_API=`external_api`,e.PARSER=`parser`,e.DOM=`dom`,e.WTF=`wtf`,e.FATAL=`fatal`})(G||={});var K;(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`})(K||={});var yt=`vk.com`,bt=async(e,t,n)=>{let r=new URL(`https://${yt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),xt(await(await fetch(r.toString())).json(),n)},xt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),St(n)])),St=e=>Array.isArray(e)?e[0]:e,Ct;(e=>{e.RU=`ru`,e.EN=`en`})(Ct||={});var q=`__vk_vp_internals_exposure`;class wt{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 Tt={};r(Tt,{subscribe:()=>kt,push:()=>Ot,destroy:()=>Dt,create:()=>Et});var J=new Map,Et=(e,t)=>J.set(e,t??[]),Dt=e=>J.delete(e),Ot=(e,t)=>{let n=J.get(e);n&&(typeof n==`function`?n(t):n.push(t))},kt=(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)}},At=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,jt=e=>v({id:e.id,message:e.message,category:e.category,data:Mt(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Mt(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var Nt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},Pt=()=>{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 Y{static tracerErrorMap=new Map;static appTracerModule=null;static loadPromise=null;dynamicImportTimeout=5e3;componentName;subscription=new a;options;envParams;context;isEmbed;embedParent;constructor(e,t,n,r){this.componentName=e,this.options=t,this.envParams=n,this.context={...r};let{isEmbed:i,topOrigin:a}=le();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{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=Y.tracerErrorMap.get(this.componentName);try{let n=Nt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...jt(e),...Pt(),...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)||_(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});g(this.options.userId)&&o.setUserId(this.options.userId),a&&n(this.componentName,{appToken:At,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),Y.tracerErrorMap.set(this.componentName,o)}catch(e){console.error(e)}}loadModule(){g(Y.loadPromise)||(Y.loadPromise=(async()=>{try{let e=new Promise((e,t)=>x().setTimeout(t,this.dynamicImportTimeout));Y.appTracerModule=await Promise.race([e,import(`@apptracer/sdk/lite`)])}catch(e){Y.loadPromise=null,console.error(e)}})())}}class Ft{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var It=()=>{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:Lt,NativeAbortController:Rt}=function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}}(typeof self<`u`?self:global);function zt(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 Bt(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 Vt{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 Vt{constructor(){super(),this.listeners||Vt.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=Bt(e),n=zt(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 Ht(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 Ut(e){typeof e==`function`&&(e={fetch:e});let{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!Ht({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&&Ht({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}),Wt=$?Ut({fetch:Q.fetch,Request:Q.Request,AbortController:Q.AbortController}):void 0,Gt=$?Wt.fetch:Q.fetch,Kt=$?Wt.Request:Q.Request,qt=$?Z:Q.AbortController,Jt=$?X:Q.AbortSignal,Yt=(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)},Xt=e=>Q.clearTimeout(e),Zt=e=>typeof e==`function`&&e?.toString().endsWith(`{ [native code] }`),Qt=!Zt(Q.requestIdleCallback)||!Zt(Q.cancelIdleCallback),$t=Qt?Yt:Q.requestIdleCallback,en=Qt?Xt:Q.cancelIdleCallback,tn=(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,_e as videoSizeToQuality,ve as videoQualityToHeight,ge as videoHeightToQuality,tn as urlCanParsePolyfilled,Oe as timeout,Se as timeCodeToString,F as throttleFn,Be as throttle,tt as tap,ht as suppressAbort,rt as skip,at as shareReplay,ne as safeStorage,$t as requestIdleCallbackPolyfilled,$e as pairwise,Qe as once,st as observeElementSize,je as observableFrom,w as nowInt,C as now,c as noop,De as merge,Ze as mapTo,Ye as map,bt as loadVKLangPack,lt as isValidURL,_ as isNullable,g as isNonNullable,pe as isLowerOrEqual,j as isLower,M 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,xe as getVideoQualityLabel,gt as getTraceSubscriptionMethod,mt as getRangeAroundIndex,ft as getPlayerId,me as getHighestQuality,te as getExponentialDelay,Me as fromEvent,L as flattenObject,Ke as filterChanged,He as filter,N as fillWithDefault,Gt as fetchPolyfilled,Tt as devNull,le as detectEmbed,P as debounceFn,Le as debounce,It as createDIContainer,Ee as combine,I as cloneDeepWith,Ce as cloneDeep,ct as clearVideoElement,s as checkNever,en as cancelIdleCallbackPolyfilled,Pe as buffer,be as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,ye as areQualitiesExact,ee as addScript,T as abortable,ue as VideoQuality,Te as ValueSubject,K as VKNumericLanguage,i as VERSION,vt as TracerFactory,Ne as SubscriptionRemovable,a as Subscription,f as Subject,Kt as RequestPolyfilled,we as ReplaySubject,d as Observable,p as Logger,wt as InternalsExposure,Ct as InterfaceLanguage,Ft as InjectionToken,q as INTERNAL_EXPOSE_GLOBAL_KEY,G as ErrorCategory,Y as AppTracer,Jt as AbortSignalPolyfilled,qt as AbortControllerPolyfilled};
package/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.90-dev.524dbd943.0
3
- * Thu, 14 May 2026 09:09:31 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.90-dev.93411ef3c.0
3
+ * Mon, 18 May 2026 11:32:01 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-90/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.90-dev.524dbd943.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},ft=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 pt 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 mt{static createRootTracer(e=`fake`){switch(e){case`real`:return new pt;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.FATAL=`fatal`})(X||={});var ht;(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`})(ht||={});var gt=`vk.com`,_t=async(e,t,n)=>{let r=new URL(`https://${gt}/js/lang-pack.js`);return r.searchParams.set(`format`,`json`),r.searchParams.set(`name`,t),e!==void 0&&r.searchParams.set(`lang`,e),vt(await(await fetch(r.toString())).json(),n)},vt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),yt(n)])),yt=e=>Array.isArray(e)?e[0]:e,bt;(e=>{e.RU=`ru`,e.EN=`en`})(bt||={});var Z=`__vk_vp_internals_exposure`;class xt{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 St={};r(St,{subscribe:()=>Et,push:()=>Tt,destroy:()=>wt,create:()=>Ct});var Q=new Map,Ct=(e,t)=>Q.set(e,t??[]),wt=e=>Q.delete(e),Tt=(e,t)=>{let n=Q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Et=(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)}},Dt=e=>v({id:e.id,message:e.message,category:e.category,data:Ot(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Ot(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var kt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},At=()=>{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;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{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=$.tracerErrorMap.get(this.componentName);try{let n=kt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Dt(e),...At(),...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)}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 jt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Mt=()=>{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,_t 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,ft as getTraceSubscriptionMethod,ut as getRangeAroundIndex,ct as getPlayerId,fe as getHighestQuality,te as getExponentialDelay,Ae as fromEvent,V as flattenObject,We as filterChanged,Be as filter,ye as fillWithDefault,St as devNull,ce as detectEmbed,xe as debounceFn,Fe as debounce,Mt 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,ht as VKNumericLanguage,i as VERSION,mt as TracerFactory,je as SubscriptionRemovable,a as Subscription,f as Subject,L as ReplaySubject,d as Observable,p as Logger,xt as InternalsExposure,bt as InterfaceLanguage,jt as InjectionToken,Z as INTERNAL_EXPOSE_GLOBAL_KEY,X as ErrorCategory,$ 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.90-dev.93411ef3c.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)}},M;(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`})(M||={});var N={"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)=>N[e].height>N[t].height,le=(e,t)=>N[e].height>=N[t].height,P=(e,t)=>N[e].height<N[t].height,ue=(e,t)=>N[e].height<=N[t].height,de=e=>e.sort((e,t)=>e===t?0:e===`Invariant quality`?1:t===`Invariant quality`?-1:P(e,t)?1:-1)[0],F=Object.keys(N).sort((e,t)=>P(e,t)?-1:1),fe=(e,t=.02)=>[...F].find(n=>N[n].height*(1+t)>=e),pe=({width:e,height:t})=>{let n=Math.min(e,t),r=Math.max(e,t);return F.find(e=>{let t=N[e];return t.width>=r&&t.height>=n})},me=e=>N[e].height,I=e=>e===`Invariant quality`,he=e=>e.every(e=>!I(e));function ge(e){if(I(e))throw Error(`Expected exact quality`)}var _e=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``}},L=(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]=L(a,i):n[r]=a??i:n[r]=r in e?a:i}return n},ve=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 R(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 z=(e,t=0,n)=>R(e,t,{leading:!0,trailing:!0,...n,maxWait:t}),B=(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]=B(e[r],t):n[r]=e[r]}return n},ye=e=>B(e);class V 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 be 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 V(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(z(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},lt=e=>t=>n=>{let r=typeof n==`object`;n==null||r&&!Object.keys(n).length||e(t,r?W(n):{value:n})},K=(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 q{dynamicImportTimeout=5e3;span;context;childTracers=[];initPromise;static rootTracer;static dynamicImportStatus=`not_started`;static dynamicImports;static dynamicImportPromise;constructor({name:e,getParentContext:t}){q.dynamicImportStatus===`not_started`&&(q.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=q.dynamicImportPromise.then(r=>{q.dynamicImportStatus===`completed`&&this.init({name:e,getParentContext:t},n)})}init({name:e,getParentContext:t},n){let{opentelemetryApi:r}=q.dynamicImports,{context:i,trace:a}=r;this.span=q.rootTracer.startSpan(e,{startTime:n},t?.()),this.context=a.setSpan(i.active(),this.span)}async loadOpentelemetry(){if(q.dynamicImportStatus===`not_started`){q.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]);q.dynamicImports={opentelemetryApi:n,opentelemetrySdk:r,tracer:i,opentelemetryResources:a,opentelemetrySemanticConventions:o},q.dynamicImportStatus=`completed`}catch{q.dynamicImportStatus=`failed`}}}isComponentTracerNotInitialized(){return _(this.span)||q.dynamicImportStatus===`failed`}log(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...K(t),type:`log`},n)})}error(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...K(t),type:`error`},n)})}critical(e,t){let n=Date.now();this.initPromise.then(r=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...K(t),type:`critical`},n)})}createComponentTracer(e){let t=new q({name:e,getParentContext:()=>this.context});return this.childTracers.push(t),t}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(e=>e.end()),this.span.end())})}}class ut extends q{constructor(){super({name:`Root`})}init({name:e,getParentContext:t},n){let{tracer:r,opentelemetryResources:i,opentelemetrySdk:a,opentelemetrySemanticConventions:o}=q.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:`L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb`}))]});f.register(),q.rootTracer=f.getTracer(`sdk-videoplayer-tracer`),super.init({name:e,getParentContext:t},n)}getTraceId(){return this.isComponentTracerNotInitialized()?``:this.span.spanContext().traceId}}class J{fakeTraceId;constructor(e){}log(e,t){}error(e,t){}critical(e,t){}createComponentTracer(e){return new J({name:e})}end(){}getTraceId(){return this.fakeTraceId}}var dt=()=>!0,Y={level:0,filter:dt,name:`Noname Tracer`,outputMethod:`log`};class ft{name;filter=dt;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){this.logDebug(e,t)}error(e,t){this.logError(e,t)}critical(e,t){this.logError(e,t)}createComponentTracer(e){let t=new ft({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))}}class pt{static createRootTracer(e=`fake`){switch(e){case`real`:return new ut;case`debug`:return new ft;default:return new J}}}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.FATAL=`fatal`})(mt||={});var X;(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`})(X||={});var ht=`vk.com`,gt=async(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),_t(await(await fetch(r.toString())).json(),n)},_t=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([e,n])=>[e.substring(`${t}_`.length),vt(n)])),vt=e=>Array.isArray(e)?e[0]:e,yt;(e=>{e.RU=`ru`,e.EN=`en`})(yt||={});var Z=`__vk_vp_internals_exposure`;class bt{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 xt={};r(xt,{subscribe:()=>Tt,push:()=>wt,destroy:()=>Ct,create:()=>St});var Q=new Map,St=(e,t)=>Q.set(e,t??[]),Ct=e=>Q.delete(e),wt=(e,t)=>{let n=Q.get(e);n&&(typeof n==`function`?n(t):n.push(t))},Tt=(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)}},Et=`gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5`,Dt=e=>v({id:e.id,message:e.message,category:e.category,data:Ot(e.data),httpCode:e.httpCode,UVBackendErrorCode:e.UVBackendErrorCode});function Ot(e){switch(typeof e){case`boolean`:case`string`:case`number`:return e;case`object`:try{return JSON.stringify(e)}catch{return}default:return}}var kt=e=>{let t=e.thrown instanceof Error&&!Object.isFrozen(e.thrown)?e.thrown:Error(e.message);return t.name=e.id,t},At=()=>{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;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{blackErrorCategoryList:n,blackErrorIdList:r,sampleRate:i,whiteErrorCategoryList:a,whiteErrorIdList:o}=this.options,{id:s,category:c}=e;if(n.length&&n.includes(c)||r.length&&r.includes(s)||a.length&&!a.includes(c)||o.length&&!o.includes(s)||Math.random()>=i)return;let l=$.tracerErrorMap.get(this.componentName);try{let n=kt(e);l?.error(n,{crashIdSource:n.name,severity:t?.severity??(e.traceAsLog?`debug`:void 0),keys:{...this.context,...Dt(e),...At(),...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:Et,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),$.tracerErrorMap.set(this.componentName,o)}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 jt{options;symbol;constructor(e,t){this.options=t,this.symbol=Symbol(e)}}var Mt=()=>{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,pe as videoSizeToQuality,me as videoQualityToHeight,fe as videoHeightToQuality,Ce as timeout,ve as timeCodeToString,z 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,gt as loadVKLangPack,nt as isValidURL,_ as isNullable,g as isNonNullable,ue as isLowerOrEqual,P as isLower,I as isInvariantQuality,rt as isIntersecting,le as isHigherOrEqual,ce as isHigher,S as isBrowserWindow,G as isAbortError,we as interval,ot as interpolate,x as getWindow,_e as getVideoQualityLabel,lt as getTraceSubscriptionMethod,st as getRangeAroundIndex,at as getPlayerId,de as getHighestQuality,ee as getExponentialDelay,De as fromEvent,W as flattenObject,Ve as filterChanged,Le as filter,L as fillWithDefault,xt as devNull,se as detectEmbed,R as debounceFn,Me as debounce,Mt as createDIContainer,xe as combine,B as cloneDeepWith,ye as cloneDeep,tt as clearVideoElement,s as checkNever,ke as buffer,ge as assertQualityIsExact,h as assertNullable,y as assertNotEmptyArray,m as assertNonNullable,o as assertNever,b as assertEmptyArray,he as areQualitiesExact,C as addScript,E as abortable,M as VideoQuality,be as ValueSubject,X as VKNumericLanguage,i as VERSION,pt as TracerFactory,Oe as SubscriptionRemovable,a as Subscription,f as Subject,V as ReplaySubject,d as Observable,p as Logger,bt as InternalsExposure,yt as InterfaceLanguage,jt as InjectionToken,Z as INTERNAL_EXPOSE_GLOBAL_KEY,mt as ErrorCategory,$ as AppTracer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.90-dev.524dbd943.0",
3
+ "version": "1.0.90-dev.93411ef3c.0",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",
@@ -1,6 +1,6 @@
1
- import type { Attributes, IRootTracer, ITracer } from "./types";
1
+ import type { Attributes } from "@opentelemetry/api";
2
+ import type { IRootTracer, ITracer } from "./types";
2
3
  import type { ReadableSpan } from "@opentelemetry/sdk-trace-web";
3
- import type { ISubscription } from "../reactive";
4
4
  export declare enum DebugTracerLevel {
5
5
  Log = 0,
6
6
  Error = 1
@@ -34,7 +34,5 @@ export declare class DebugTracer implements IRootTracer {
34
34
  private createMessage;
35
35
  private logDebug;
36
36
  private logError;
37
- addSubscription(_item: Parameters<ISubscription["add"]>[0]): void;
38
- setSpanAttributes(_attributes: Attributes): void;
39
37
  }
40
38
  export {};
@@ -1,14 +1,12 @@
1
- import type { ISubscription } from "../reactive";
2
- import type { Attributes, IRootTracer, ITracer, ITracerParams } from "./types";
1
+ import type { IRootTracer, ITracer, ITracerParams } from "./types";
2
+ import type { Attributes } from "@opentelemetry/api";
3
3
  export declare class FakeTracer implements IRootTracer {
4
4
  private readonly fakeTraceId;
5
- constructor(_params?: Partial<ITracerParams>);
6
- log(_name: string, _attributes?: Attributes): void;
7
- error(_name: string, _attributes?: Attributes): void;
8
- critical(_name: string, _attributes?: Attributes): void;
5
+ constructor(params?: Partial<ITracerParams>);
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;
12
- addSubscription(_item: Parameters<ISubscription["add"]>[0]): void;
13
- setSpanAttributes(_attributes: Attributes | null): void;
14
12
  }
@@ -1,12 +1,8 @@
1
- import type { IRootTracer, ITracerParams, Attributes } from "./types";
1
+ import type { IRootTracer, ITracerParams } from "./types";
2
2
  import { Tracer } from "./Tracer";
3
3
  import type { Milliseconds } from "../utils";
4
- import type { ISubscription } from "../reactive";
5
4
  export declare class RootTracer extends Tracer implements IRootTracer {
6
- private readonly attributes$;
7
5
  constructor();
8
6
  protected init({ name, getParentContext }: ITracerParams, startTime: Milliseconds): void;
9
7
  getTraceId(): string;
10
- setSpanAttributes(attributes: Attributes): void;
11
- addSubscription(item: Parameters<ISubscription["add"]>[0]): void;
12
8
  }
@@ -1,20 +1,19 @@
1
- import type { ITracer, ITracerDynamicImports, ITracerParams, Context, Span, Attributes } from "./types";
1
+ import type { Attributes, Context, Span } from "@opentelemetry/api";
2
+ import type { ITracer, ITracerDynamicImports, ITracerParams, OpentelemetryApi } from "./types";
2
3
  import { TracerDynamicImportStatus } from "./types";
3
4
  import type { Milliseconds } from "../utils";
4
- import type { ISubscription } from "../reactive";
5
5
  export declare class Tracer implements ITracer {
6
6
  private readonly dynamicImportTimeout;
7
- protected readonly subscription: ISubscription;
8
7
  protected span: Span;
9
8
  protected context: Context;
10
9
  protected childTracers: ITracer[];
11
10
  protected initPromise: Promise<void>;
12
- protected getRootTracerContext: ITracerParams["getRootTracerContext"];
11
+ protected static rootTracer: OpentelemetryApi.Tracer;
13
12
  protected static dynamicImportStatus: TracerDynamicImportStatus;
14
13
  protected static dynamicImports: ITracerDynamicImports;
15
14
  protected static dynamicImportPromise: Promise<void>;
16
- protected constructor({ name, getParentContext, getRootTracerContext }: ITracerParams);
17
- protected init({ name, getParentContext, getRootTracerContext }: ITracerParams, startTime: Milliseconds): void;
15
+ protected constructor({ name, getParentContext }: ITracerParams);
16
+ protected init({ name, getParentContext }: ITracerParams, startTime: Milliseconds): void;
18
17
  private loadOpentelemetry;
19
18
  protected isComponentTracerNotInitialized(): boolean;
20
19
  log(name: string, attributes?: Attributes): void;
@@ -3,11 +3,13 @@ import type * as OpentelemetryApi from "@opentelemetry/api";
3
3
  import type * as OpentelemetrySdk from "@opentelemetry/sdk-trace-web";
4
4
  import type * as OpentelemetryResources from "@opentelemetry/resources";
5
5
  import type * as OpentelemetrySemanticConventions from "@opentelemetry/semantic-conventions";
6
- import type { ISubscription, IValueSubject } from "../reactive";
7
- export type { TracerOpentelemetry, OpentelemetryApi, OpentelemetrySdk, OpentelemetryResources, OpentelemetrySemanticConventions };
8
- export type Attributes = OpentelemetryApi.Attributes;
9
- export type Context = OpentelemetryApi.Context;
10
- export type Span = OpentelemetryApi.Span;
6
+ export type { TracerOpentelemetry };
7
+ export type { OpentelemetryApi };
8
+ export type { OpentelemetrySdk };
9
+ export type { OpentelemetryResources };
10
+ export type { OpentelemetrySemanticConventions };
11
+ type Attributes = OpentelemetryApi.Attributes;
12
+ type Context = OpentelemetryApi.Context;
11
13
  export type TracerType = "real" | "fake" | "debug";
12
14
  export declare enum TracerDynamicImportStatus {
13
15
  NotStarted = "not_started",
@@ -23,11 +25,6 @@ export declare enum TraceEventType {
23
25
  export interface ITracerParams {
24
26
  name: string;
25
27
  getParentContext?: () => Context;
26
- getRootTracerContext?: () => IRootTracerContext | undefined;
27
- }
28
- export interface IRootTracerContext {
29
- tracer: OpentelemetryApi.Tracer;
30
- attributes$: IValueSubject<Attributes | null>;
31
28
  }
32
29
  export interface ITracerDynamicImports {
33
30
  opentelemetryApi: typeof OpentelemetryApi;
@@ -45,6 +42,4 @@ export interface ITracer {
45
42
  }
46
43
  export interface IRootTracer extends ITracer {
47
44
  getTraceId: () => string;
48
- setSpanAttributes: (attributes: Attributes) => void;
49
- addSubscription(item: Parameters<ISubscription["add"]>[0]): void;
50
45
  }