@vkontakte/videoplayer-shared 1.0.40-dev.c0101e19.0 → 1.0.40-dev.ebad2f59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015.cjs.js +3 -3
- package/es2015.esm.js +3 -3
- package/es2018.cjs.js +3 -3
- package/es2018.esm.js +3 -3
- package/esnext.cjs.js +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +5 -2
- package/types/Tracer/Tracer.d.ts +18 -0
- package/types/Tracer/index.d.ts +4 -0
- package/types/Tracer/types.d.ts +22 -0
- package/types/Tracer/utils.d.ts +2 -0
- package/types/index.d.ts +1 -0
- package/types/types/index.d.ts +3 -0
- package/types/utils/flattenObject.d.ts +8 -0
- package/types/utils/index.d.ts +1 -0
package/evergreen.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.40-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.40-dev.ebad2f59.0
|
|
3
|
+
* Mon, 02 Sep 2024 11:17:58 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-40/doc/
|
|
5
5
|
*/
|
|
6
|
-
var xe=Object.defineProperty;var ye=(t,e)=>{for(var r in e)xe(t,r,{get:e[r],enumerable:!0})};var Oe="1.0.40-dev.c0101e19.0";var f=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var v=t=>{throw new Error(`${t} is value of unexpected type`)},we=t=>{};var g=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:g}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:g,error:g};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new f().add(()=>{switch(i.next=g,i.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return v(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var h=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new f().add(()=>this.subscribers.delete(n))}};var M=class{constructor(){this.log$=new h;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function Ee(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Se(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t<"u"&&t!==null}function V(t){return t==null}function Re(t,e){if(!t?.length)throw new Error(e)}function Ae(t,e){if(t?.length)throw new Error(e)}var ke=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{a(),c.remove()});let s=()=>{a(),i()},o=()=>{a(),n()},a=()=>{p&&clearTimeout(p),c.removeEventListener("load",o),c.removeEventListener("error",s)},p;r&&(p=window.setTimeout(s,r));let c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",s),c.src=t,document.head.appendChild(c)});var Ce=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Pe=(t,e)=>async(...r)=>{let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=o.done??!1,s=o.value}catch(o){await n.throw(o)}return s};var ee=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile,_=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||window?.screen.width>700,r=this._iosVersion;return!e||e&&!!r&&r<16}get isAndroid(){return this.device==="Android"}get isMobile(){return this._isMobile}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){let{userAgent:e,maxTouchPoints:r}=navigator;try{this._maxTouchPoints=r,this._isHdr=!!matchMedia("(dynamic-range: high)")?.matches}catch(n){console.error(n)}try{this._isMobile=ee()}catch(n){console.error(n)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let r=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,o=/firefox|fxios/i.test(e)?"Firefox":void 0,a=/webkit|safari|khtml/i.test(e)?"Safari":void 0,p=/opr\//i.test(e)?"Opera":void 0,c=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=r||n||o||p||c||i||s||a||"Rest"}catch(r){console.error(r)}}detectDevice(e){try{let r=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,o=/mac/i.test(e)?"Mac":void 0,a=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=r||n||i||s||a||o||"Desktop"}catch(r){console.error(r)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+(\.\d+)?)/i);if(!r)return;let n=r[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+)/);if(!r)return;let n=r[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},Le=new _;var Me=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var te={};ye(te,{clear:()=>Ue,get:()=>_e,has:()=>Qe,isPersistent:()=>Ve,remove:()=>De,set:()=>Ne});var O,x,N=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(x!==void 0)return x;try{localStorage.setItem(N,"test"),localStorage.removeItem(N),x=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(N),x=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)x=2;else throw e}else throw t}return x===2&&(O=new Map),x},Ve=()=>w()===0,_e=t=>{let e=w();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return O?.get(t);default:v(e)}},Ne=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void O?.set(t,e);default:v(r)}},Qe=t=>{let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return v(e),!1}},De=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void O?.delete(t);default:v(e)}},Ue=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:v(t)}};var Be=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var Q=(d=>(d.INVARIANT="Invariant quality",d.Q_144P="144p",d.Q_240P="240p",d.Q_360P="360p",d.Q_480P="480p",d.Q_720P="720p",d.Q_1080P="1080p",d.Q_1440P="1440p",d.Q_2160P="2160p",d.Q_4320P="4320p",d))(Q||{});var m={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"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}},Fe=(t,e)=>m[t].height>m[e].height,ze=(t,e)=>m[t].height>=m[e].height,D=(t,e)=>m[t].height<m[e].height,je=(t,e)=>m[t].height<=m[e].height,We=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:D(e,r)?1:-1)[0],re=Object.keys(m).sort((t,e)=>D(t,e)?-1:1),Ge=(t,e=.02)=>[...re].find(n=>m[n].height*(1+e)>=t),He=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return re.find(i=>{let s=m[i];return s.width>=n&&s.height>=r})},qe=t=>m[t].height,U=t=>t==="Invariant quality",Ke=t=>t.every(e=>!U(e));function Ye(t){if(U(t))throw new Error("Expected exact quality")}var $e=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=$e(s,i):r[n]=n in t?s:i}return r};var zt=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function B(t,e=0,r){let n,i,s,o,a,p,c=0,d=!1,b=!1,P=!0,$=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(d=!!r.leading,b="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,P="trailing"in r?!!r.trailing:P);function L(u){let T=n,I=i;return n=i=void 0,c=u,o=t.apply(I,T),o}function E(u,T){return $?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,T)}function me(u){if($){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Te(u){return c=u,a=E(S,e),d?L(u):o}function ve(u){let T=u-p,I=u-c,Z=e-T;return b?Math.min(Z,s-I):Z}function X(u){let T=u-p,I=u-c;return p===void 0||T>=e||T<0||b&&I>=s}function S(){let u=Date.now();if(X(u))return J(u);a=E(S,ve(u))}function J(u){return a=void 0,P&&n?L(u):(n=i=void 0,o)}function he(){a!==void 0&&me(a),c=0,n=p=i=a=void 0}function Ie(){return a===void 0?o:J(Date.now())}function ge(){return a!==void 0}function R(...u){let T=Date.now(),I=X(T);if(n=u,i=this,p=T,I){if(a===void 0)return Te(p);if(b)return a=E(S,e),L(p)}return a===void 0&&(a=E(S,e)),o}return R.cancel=he,R.flush=Ie,R.pending=ge,R}var F=(t,e=0,r)=>B(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var A=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=A(t[n],e):r[n]=t[n]}return r};var Xe=t=>A(t);var Je=300,Ze=(t,e=Je)=>new l(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(F(o=>{let a=o[0];if(!a)return;let p,c;a.contentBoxSize&&a.contentBoxSize[0]?(c=a.contentBoxSize[0].blockSize,p=a.contentBoxSize[0].inlineSize):a.contentRect&&(p=a.contentRect.width,c=a.contentRect.height),y(p)&&y(c)&&r.next({width:p,height:c})},e));return s.observe(t),()=>s.disconnect()});var et=t=>{t.removeAttribute("src"),t.load()};var k=class extends h{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 r=super._subscribe(e);return e.next(this.value),r}};function ne(t){return new l(e=>{let r={},n=Object.keys(t).length,i=s=>o=>{s in r||n--,r[s]=o,n===0&&e.next(r)};return Object.entries(t).reduce((s,[o,a])=>s.add(a.subscribe(i(o))),new f)})}function ie(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new f))}var tt=t=>new l(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var rt=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var nt=t=>new l(e=>{t.forEach(r=>e.next(r))});var it=(t,e)=>new l(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function oe(t){return e=>new l(r=>e.subscribe(new z(r,t)))}var z=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}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 ot={leading:!1,trailing:!0};function se(t,e=ot){return r=>new l(n=>r.subscribe(new j(n,t,e)))}var j=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var st={leading:!0,trailing:!1};function ae(t,e=st){return r=>new l(n=>r.subscribe(new W(n,t,e)))}var W=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,V(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function le(t){return e=>new l(r=>e.subscribe(new G(r,t)))}var G=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function ce(t=(e,r)=>e===r){return e=>new l(r=>e.subscribe(new H(r,t)))}var ue={},H=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=ue}next(e){let r;try{r=this.lastValue===ue||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function C(t){return e=>new l(r=>e.subscribe(new q(r,t)))}var q=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function pe(t){return C(()=>t)}function be(){return t=>new l(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{r=!0,e.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function de(){return t=>new l(e=>t.subscribe(new K(e)))}var K=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function fe(t){return e=>new l(r=>e.subscribe(new Y(r,t)))}var Y=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};var at=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(at||{});var lt=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(lt||{}),ut="vk.com",Mn=async(t,e,r)=>{let n=new URL(`https://${ut}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return ct(s,r)},ct=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),pt(n)])),pt=t=>Array.isArray(t)?t[0]:t;var bt=(r=>(r.RU="ru",r.EN="en",r))(bt||{});export{at as ErrorCategory,bt as InterfaceLanguage,M as Logger,l as Observable,h as Subject,f as Subscription,Oe as VERSION,lt as VKNumericLanguage,k as ValueSubject,Q as VideoQuality,Pe as abortable,ke as addScript,Ke as areQualitiesExact,Ae as assertEmptyArray,v as assertNever,Ee as assertNonNullable,Re as assertNotEmptyArray,Se as assertNullable,Ye as assertQualityIsExact,oe as buffer,we as checkNever,et as clearVideoElement,Le as clientChecker,Xe as cloneDeep,A as cloneDeepWith,ne as combine,se as debounce,B as debounceFn,Be as detectEmbed,$e as fillWithDefault,le as filter,ce as filterChanged,it as fromEvent,Me as getExponentialDelay,We as getHighestQuality,rt as interval,Fe as isHigher,ze as isHigherOrEqual,U as isInvariantQuality,D as isLower,je as isLowerOrEqual,ee as isMobile,y as isNonNullable,V as isNullable,Mn as loadVKLangPack,C as map,pe as mapTo,ie as merge,g as noop,Ce as now,nt as observableFrom,Ze as observeElementSize,be as once,de as pairwise,te as safeStorage,fe as tap,ae as throttle,F as throttleFn,zt as timeCodeToString,tt as timeout,Ge as videoHeightToQuality,qe as videoQualityToHeight,He as videoSizeToQuality};
|
|
6
|
+
var dt=Object.defineProperty;var mt=(t,e)=>{for(var r in e)dt(t,r,{get:e[r],enumerable:!0})};var bt="1.0.40-dev.ebad2f59.0";var b=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var g=t=>{throw new Error(`${t} is value of unexpected type`)},vt=t=>{};var S=()=>{};var u=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:S}:n={next:a=>r.next(a),error:a=>r.error?.(a)}:n={next:S,error:S};let i=typeof e=="function"?{next:a=>{try{e(a)}catch(s){n.next(s)}},error:a=>n.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):n.next(a)},o;try{o=this._subscribe(i)}catch(a){i.error?.(a)}return new b().add(()=>{switch(i.next=S,i.error=S,typeof o){case"function":o();return;case"object":o.unsubscribe();return;case"undefined":return;default:return g(o)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var y=class extends u{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new b().add(()=>this.subscribers.delete(n))}};var $=class{constructor(){this.log$=new y;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};var Ce=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};var h="1.8.0";var Pe=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Tt(t){var e=new Set([t]),r=new Set,n=t.match(Pe);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(c){return c===t};function o(s){return r.add(s),!1}function a(s){return e.add(s),!0}return function(c){if(e.has(c))return!0;if(r.has(c))return!1;var l=c.match(Pe);if(!l)return o(c);var p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||i.major!==p.major?o(c):i.major===0?i.minor===p.minor&&i.patch<=p.patch?a(c):o(c):i.minor<=p.minor?a(c):o(c)}}var Re=Tt(h);var gt=h.split(".")[0],V=Symbol.for("opentelemetry.js.api."+gt),k=Ce;function _(t,e,r,n){var i;n===void 0&&(n=!1);var o=k[V]=(i=k[V])!==null&&i!==void 0?i:{version:h};if(!n&&o[t]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(a.stack||a.message),!1}if(o.version!==h){var a=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+h);return r.error(a.stack||a.message),!1}return o[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+h+"."),!0}function x(t){var e,r,n=(e=k[V])===null||e===void 0?void 0:e.version;if(!(!n||!Re(n)))return(r=k[V])===null||r===void 0?void 0:r[t]}function A(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+h+".");var r=k[V];r&&delete r[t]}var ht=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},xt=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},Ne=function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return L("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return L("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return L("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return L("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return L("verbose",this._namespace,e)},t}();function L(t,e,r){var n=x("diag");if(n)return r.unshift(e),n[t].apply(n,xt([],ht(r),!1))}var m;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(m||(m={}));function Me(t,e){t<m.NONE?t=m.NONE:t>m.ALL&&(t=m.ALL),e=e||{};function r(n,i){var o=e[n];return typeof o=="function"&&t>=i?o.bind(e):function(){}}return{error:r("error",m.ERROR),warn:r("warn",m.WARN),info:r("info",m.INFO),debug:r("debug",m.DEBUG),verbose:r("verbose",m.VERBOSE)}}var yt=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},It=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},Ot="diag",C=function(){function t(){function e(i){return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=x("diag");if(s)return s[i].apply(s,It([],yt(o),!1))}}var r=this,n=function(i,o){var a,s,c;if(o===void 0&&(o={logLevel:m.INFO}),i===r){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=l.stack)!==null&&a!==void 0?a:l.message),!1}typeof o=="number"&&(o={logLevel:o});var p=x("diag"),d=Me((s=o.logLevel)!==null&&s!==void 0?s:m.INFO,i);if(p&&!o.suppressOverrideMessage){var E=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+E),d.warn("Current logger will overwrite one already registered from "+E)}return _("diag",d,r,!0)};r.setLogger=n,r.disable=function(){A(Ot,r)},r.createComponentLogger=function(i){return new Ne(i)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}();function Ve(t){return Symbol.for(t)}var St=function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var o=new t(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=function(n){var i=new t(r._currentContext);return i._currentContext.delete(n),i}}return t}(),ke=new St;var wt=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Et=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},Le=function(){function t(){}return t.prototype.active=function(){return ke},t.prototype.with=function(e,r,n){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return r.call.apply(r,Et([n],wt(i),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}();var _t=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},At=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))},J="context",Ct=new Le,P=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return _(J,e,C.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return(i=this._getContextManager()).with.apply(i,At([e,r,n],_t(o),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return x(J)||Ct},t.prototype.disable=function(){this._getContextManager().disable(),A(J,C.instance())},t}();var G;(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(G||(G={}));var Z="0000000000000000",ee="00000000000000000000000000000000",De={traceId:ee,spanId:Z,traceFlags:G.NONE};var I=function(){function t(e){e===void 0&&(e=De),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,r){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,r){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,r){},t}();var te=Ve("OpenTelemetry Context Key SPAN");function B(t){return t.getValue(te)||void 0}function Qe(){return B(P.getInstance().active())}function D(t,e){return t.setValue(te,e)}function Ue(t){return t.deleteValue(te)}function je(t,e){return D(t,new I(e))}function F(t){var e;return(e=B(t))===null||e===void 0?void 0:e.spanContext()}var Pt=/^([0-9a-f]{32})$/i,Rt=/^[0-9a-f]{16}$/i;function Nt(t){return Pt.test(t)&&t!==ee}function Mt(t){return Rt.test(t)&&t!==Z}function W(t){return Nt(t.traceId)&&Mt(t.spanId)}function Ge(t){return new I(t)}var re=P.getInstance(),z=function(){function t(){}return t.prototype.startSpan=function(e,r,n){n===void 0&&(n=re.active());var i=!!r?.root;if(i)return new I;var o=n&&F(n);return Vt(o)&&W(o)?new I(o):new I},t.prototype.startActiveSpan=function(e,r,n,i){var o,a,s;if(!(arguments.length<2)){arguments.length===2?s=r:arguments.length===3?(o=r,s=n):(o=r,a=n,s=i);var c=a??re.active(),l=this.startSpan(e,o,c),p=D(c,l);return re.with(p,s,void 0,l)}},t}();function Vt(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var kt=new z,Be=function(){function t(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}return t.prototype.startSpan=function(e,r,n){return this._getTracer().startSpan(e,r,n)},t.prototype.startActiveSpan=function(e,r,n,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):kt},t}();var Fe=function(){function t(){}return t.prototype.getTracer=function(e,r,n){return new z},t}();var Lt=new Fe,ne=function(){function t(){}return t.prototype.getTracer=function(e,r,n){var i;return(i=this.getDelegateTracer(e,r,n))!==null&&i!==void 0?i:new Be(this,e,r,n)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Lt},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,r,n)},t}();var oe=P.getInstance();var ie="trace",We=function(){function t(){this._proxyTracerProvider=new ne,this.wrapSpanContext=Ge,this.isSpanContextValid=W,this.deleteSpan=Ue,this.getSpan=B,this.getActiveSpan=Qe,this.getSpanContext=F,this.setSpan=D,this.setSpanContext=je}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var r=_(ie,this._proxyTracerProvider,C.instance());return r&&this._proxyTracerProvider.setDelegate(e),r},t.prototype.getTracerProvider=function(){return x(ie)||this._proxyTracerProvider},t.prototype.getTracer=function(e,r){return this.getTracerProvider().getTracer(e,r)},t.prototype.disable=function(){A(ie,C.instance()),this._proxyTracerProvider=new ne},t}();var ae=We.getInstance();import{TracerAllSpansProcessor as Dt,TracerMemorySpanExporter as ze,initTracerOpenTelemetry as Qt}from"@tracer/opentelemetry";var se=class t{constructor({name:e}){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}},ce=class t{constructor({name:e,parentContext:r,tracer:n}){this.childTracers=[];let i=!n;if(i){let a=Qt({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),s=new ze,c=new ze;this.spanExporter=s,a.addSpanProcessor(new Dt({startedSpansExporter:s,endedSpansExporter:c})),this.tracer=a.getTracer("sdk-videoplayer-tracer")}else this.tracer=n;this.span=this.tracer.startSpan(e,{root:i},r),this.context=ae.setSpan(oe.active(),this.span)}log(e,r){this.span.addEvent(e,{...r,type:"log"})}error(e,r){this.span.addEvent(e,{...r,type:"error"})}critical(e,r){this.span.addEvent(e,{...r,type:"critical"})}static createRootTracer(e=!1){return e?new t({name:"Root"}):new se({name:"Root"})}createComponentTracer(e){let r=new t({name:e,parentContext:this.context,tracer:this.tracer});return this.childTracers.push(r),r}end(){this.childTracers.forEach(e=>e.end()),this.span.end()}getFinishedSpans(){return this.spanExporter?.getJsonData()}getTraceId(){return this.span.spanContext().traceId}};function Ut(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function jt(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function R(t){return typeof t<"u"&&t!==null}function ue(t){return t==null}function Gt(t,e){if(!t?.length)throw new Error(e)}function Bt(t,e){if(t?.length)throw new Error(e)}var Ft=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{s(),l.remove()});let o=()=>{s(),i()},a=()=>{s(),n()},s=()=>{c&&clearTimeout(c),l.removeEventListener("load",a),l.removeEventListener("error",o)},c;r&&(c=window.setTimeout(o,r));let l=document.createElement("script");l.addEventListener("load",a),l.addEventListener("error",o),l.src=t,document.head.appendChild(l)});var Wt=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var zt=(t,e)=>async(...r)=>{let n=e(...r),i=t.aborted,o;for(;!i&&!t.aborted;)try{let a=await n.next(o);i=a.done??!1,o=a.value}catch(a){await n.throw(a)}return o};var Ke=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile,le=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||window?.screen.width>700,r=this._iosVersion;return!e||e&&!!r&&r<16}get isAndroid(){return this.device==="Android"}get isMobile(){return this._isMobile}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){let{userAgent:e,maxTouchPoints:r}=navigator;try{this._maxTouchPoints=r,this._isHdr=!!matchMedia("(dynamic-range: high)")?.matches}catch(n){console.error(n)}try{this._isMobile=Ke()}catch(n){console.error(n)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let r=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,o=/chromium/i.test(e)?"Chromium":void 0,a=/firefox|fxios/i.test(e)?"Firefox":void 0,s=/webkit|safari|khtml/i.test(e)?"Safari":void 0,c=/opr\//i.test(e)?"Opera":void 0,l=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=r||n||a||c||l||i||o||s||"Rest"}catch(r){console.error(r)}}detectDevice(e){try{let r=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,o=/ipod/i.test(e)?"iPod":void 0,a=/mac/i.test(e)?"Mac":void 0,s=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=r||n||i||o||s||a||"Desktop"}catch(r){console.error(r)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+(\.\d+)?)/i);if(!r)return;let n=r[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+)/);if(!r)return;let n=r[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},Kt=new le;var Ht=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:o=0}={})=>{let a=e;return a*=r**t,a*=1+(Math.random()*o*2-o),a=Math.round(a),a=Math.min(a,n),a=Math.max(a,i),a};var He={};mt(He,{clear:()=>Zt,get:()=>Xt,has:()=>$t,isPersistent:()=>qt,remove:()=>Jt,set:()=>Yt});var N,w,pe=`vk-videoplayer-dummy-key-${Math.random()}`,M=()=>{if(w!==void 0)return w;try{localStorage.setItem(pe,"test"),localStorage.removeItem(pe),w=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(pe),w=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)w=2;else throw e}else throw t}return w===2&&(N=new Map),w},qt=()=>M()===0,Xt=t=>{let e=M();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return N?.get(t);default:g(e)}},Yt=(t,e)=>{let r=M();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void N?.set(t,e);default:g(r)}},$t=t=>{let e=M();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return N?.has(t)??!1;default:return g(e),!1}},Jt=t=>{let e=M();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void N?.delete(t);default:g(e)}},Zt=()=>{let t=M();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return N?.clear();default:g(t)}};var er=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var fe=(p=>(p.INVARIANT="Invariant quality",p.Q_144P="144p",p.Q_240P="240p",p.Q_360P="360p",p.Q_480P="480p",p.Q_720P="720p",p.Q_1080P="1080p",p.Q_1440P="1440p",p.Q_2160P="2160p",p.Q_4320P="4320p",p))(fe||{});var v={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"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}},tr=(t,e)=>v[t].height>v[e].height,rr=(t,e)=>v[t].height>=v[e].height,de=(t,e)=>v[t].height<v[e].height,nr=(t,e)=>v[t].height<=v[e].height,or=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:de(e,r)?1:-1)[0],qe=Object.keys(v).sort((t,e)=>de(t,e)?-1:1),ir=(t,e=.02)=>[...qe].find(n=>v[n].height*(1+e)>=t),ar=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return qe.find(i=>{let o=v[i];return o.width>=n&&o.height>=r})},sr=t=>v[t].height,me=t=>t==="Invariant quality",cr=t=>t.every(e=>!me(e));function ur(t){if(me(t))throw new Error("Expected exact quality")}var lr=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],o=t[n];Array.isArray(i)&&Array.isArray(o)?r[n]=o:typeof i=="object"&&typeof o=="object"?r[n]=lr(o,i):r[n]=n in t?o:i}return r};var So=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function be(t,e=0,r){let n,i,o,a,s,c,l=0,p=!1,d=!1,E=!0,we=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(p=!!r.leading,d="maxWait"in r,o=r?.maxWait?Math.max(+r?.maxWait||0,e):o,E="trailing"in r?!!r.trailing:E);function Y(f){let T=n,O=i;return n=i=void 0,l=f,a=t.apply(O,T),a}function Q(f,T){return we?(s&&window.cancelAnimationFrame(s),window.requestAnimationFrame(f)):setTimeout(f,T)}function st(f){if(we){window.cancelAnimationFrame(f);return}clearTimeout(f)}function ct(f){return l=f,s=Q(U,e),p?Y(f):a}function ut(f){let T=f-c,O=f-l,Ae=e-T;return d?Math.min(Ae,o-O):Ae}function Ee(f){let T=f-c,O=f-l;return c===void 0||T>=e||T<0||d&&O>=o}function U(){let f=Date.now();if(Ee(f))return _e(f);s=Q(U,ut(f))}function _e(f){return s=void 0,E&&n?Y(f):(n=i=void 0,a)}function lt(){s!==void 0&&st(s),l=0,n=c=i=s=void 0}function pt(){return s===void 0?a:_e(Date.now())}function ft(){return s!==void 0}function j(...f){let T=Date.now(),O=Ee(T);if(n=f,i=this,c=T,O){if(s===void 0)return ct(c);if(d)return s=Q(U,e),Y(c)}return s===void 0&&(s=Q(U,e)),a}return j.cancel=lt,j.flush=pt,j.pending=ft,j}var ve=(t,e=0,r)=>be(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var K=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=K(t[n],e):r[n]=t[n]}return r};var pr=t=>K(t);var fr=300,dr=(t,e=fr)=>new u(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let o=new ResizeObserver(ve(a=>{let s=a[0];if(!s)return;let c,l;s.contentBoxSize&&s.contentBoxSize[0]?(l=s.contentBoxSize[0].blockSize,c=s.contentBoxSize[0].inlineSize):s.contentRect&&(c=s.contentRect.width,l=s.contentRect.height),R(c)&&R(l)&&r.next({width:c,height:l})},e));return o.observe(t),()=>o.disconnect()});var H=(t,e=".")=>{let r={};for(let n in t)if(t.hasOwnProperty(n))if(typeof t[n]=="object"&&t[n]!==null){let i=H(t[n]);for(let o in i)i.hasOwnProperty(o)&&(r[n+e+o]=i[o])}else r[n]=t[n];return r};var mr=t=>{t.removeAttribute("src"),t.load()};var br=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?H(r):{value:r})};var q=class extends y{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 r=super._subscribe(e);return e.next(this.value),r}};function Xe(t){return new u(e=>{let r={},n=Object.keys(t).length,i=o=>a=>{o in r||n--,r[o]=a,n===0&&e.next(r)};return Object.entries(t).reduce((o,[a,s])=>o.add(s.subscribe(i(a))),new b)})}function Ye(...t){return new u(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var vr=t=>new u(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var Tr=t=>new u(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var gr=t=>new u(e=>{t.forEach(r=>e.next(r))});var hr=(t,e)=>new u(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function $e(t){return e=>new u(r=>e.subscribe(new Te(r,t)))}var Te=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}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 xr={leading:!1,trailing:!0};function Je(t,e=xr){return r=>new u(n=>r.subscribe(new ge(n,t,e)))}var ge=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,R(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var yr={leading:!0,trailing:!1};function Ze(t,e=yr){return r=>new u(n=>r.subscribe(new he(n,t,e)))}var he=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,ue(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function et(t){return e=>new u(r=>e.subscribe(new xe(r,t)))}var xe=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function rt(t=(e,r)=>e===r){return e=>new u(r=>e.subscribe(new ye(r,t)))}var tt={},ye=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=tt}next(e){let r;try{r=this.lastValue===tt||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function X(t){return e=>new u(r=>e.subscribe(new Ie(r,t)))}var Ie=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function nt(t){return X(()=>t)}function ot(){return t=>new u(e=>{let r=!1,n=!1,i=t.subscribe(o=>{r||(r=!0,e.next(o)),n&&i.unsubscribe()},o=>{r=!0,e.error?.(o),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function it(){return t=>new u(e=>t.subscribe(new Oe(e)))}var Oe=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function at(t){return e=>new u(r=>e.subscribe(new Se(r,t)))}var Se=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};var Ir=(s=>(s.NETWORK="network",s.VIDEO_PIPELINE="video_pipeline",s.EXTERNAL_API="external_api",s.PARSER="parser",s.DOM="dom",s.WTF="wtf",s.FATAL="fatal",s))(Ir||{});var Or=(d=>(d.Armenian="58",d.Azerbaijani="57",d.Belarusian="114",d.English="3",d.Kazakh="97",d.Portuguese="73",d.Russian="0",d.Spanish="4",d.Ukrainian="1",d.Uzbek="65",d.Vietnamese="75",d))(Or||{}),Sr="vk.com",Oa=async(t,e,r)=>{let n=new URL(`https://${Sr}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let o=await(await fetch(n.toString())).json();return wr(o,r)},wr=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Er(n)])),Er=t=>Array.isArray(t)?t[0]:t;var _r=(r=>(r.RU="ru",r.EN="en",r))(_r||{});export{Ir as ErrorCategory,_r as InterfaceLanguage,$ as Logger,u as Observable,y as Subject,b as Subscription,ce as Tracer,bt as VERSION,Or as VKNumericLanguage,q as ValueSubject,fe as VideoQuality,zt as abortable,Ft as addScript,cr as areQualitiesExact,Bt as assertEmptyArray,g as assertNever,Ut as assertNonNullable,Gt as assertNotEmptyArray,jt as assertNullable,ur as assertQualityIsExact,$e as buffer,vt as checkNever,mr as clearVideoElement,Kt as clientChecker,pr as cloneDeep,K as cloneDeepWith,Xe as combine,Je as debounce,be as debounceFn,er as detectEmbed,lr as fillWithDefault,et as filter,rt as filterChanged,H as flattenObject,hr as fromEvent,Ht as getExponentialDelay,or as getHighestQuality,br as getTraceSubscriptionMethod,Tr as interval,tr as isHigher,rr as isHigherOrEqual,me as isInvariantQuality,de as isLower,nr as isLowerOrEqual,Ke as isMobile,R as isNonNullable,ue as isNullable,Oa as loadVKLangPack,X as map,nt as mapTo,Ye as merge,S as noop,Wt as now,gr as observableFrom,dr as observeElementSize,ot as once,it as pairwise,He as safeStorage,at as tap,Ze as throttle,ve as throttleFn,So as timeCodeToString,vr as timeout,ir as videoHeightToQuality,sr as videoQualityToHeight,ar as videoSizeToQuality};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-shared",
|
|
3
|
-
"version": "1.0.40-dev.
|
|
3
|
+
"version": "1.0.40-dev.ebad2f59.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Shared code for vk.com videoplayer",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -48,5 +48,8 @@
|
|
|
48
48
|
"*.esm.js",
|
|
49
49
|
"**/*.d.ts"
|
|
50
50
|
],
|
|
51
|
-
"dependencies": {
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@opentelemetry/sdk-trace-web": "^1.25.0",
|
|
53
|
+
"@tracer/opentelemetry": "^1.1.2"
|
|
54
|
+
}
|
|
52
55
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Attributes } from '@opentelemetry/api';
|
|
2
|
+
import { ITracer } from './types';
|
|
3
|
+
export declare class Tracer implements ITracer {
|
|
4
|
+
private readonly tracer;
|
|
5
|
+
private readonly span;
|
|
6
|
+
private readonly context;
|
|
7
|
+
private readonly childTracers;
|
|
8
|
+
private readonly spanExporter;
|
|
9
|
+
private constructor();
|
|
10
|
+
log(name: string, attributes?: Attributes): void;
|
|
11
|
+
error(name: string, attributes?: Attributes): void;
|
|
12
|
+
critical(name: string, attributes?: Attributes): void;
|
|
13
|
+
static createRootTracer(isRealTracer?: boolean): ITracer;
|
|
14
|
+
createComponentTracer(name: string): ITracer;
|
|
15
|
+
end(): void;
|
|
16
|
+
getFinishedSpans(): any | undefined;
|
|
17
|
+
getTraceId(): string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Attributes, Context } from '@opentelemetry/api';
|
|
2
|
+
import { ReadableSpan } from '@opentelemetry/sdk-trace-web';
|
|
3
|
+
import { Tracer as OtlpTracer } from '@opentelemetry/sdk-trace-base/build/src/Tracer';
|
|
4
|
+
export declare enum TraceEventType {
|
|
5
|
+
Log = "log",
|
|
6
|
+
Error = "error",
|
|
7
|
+
Critical = "critical"
|
|
8
|
+
}
|
|
9
|
+
export interface ITracerParams {
|
|
10
|
+
name: string;
|
|
11
|
+
parentContext?: Context;
|
|
12
|
+
tracer?: OtlpTracer;
|
|
13
|
+
}
|
|
14
|
+
export interface ITracer {
|
|
15
|
+
log: (name: string, attributes?: Attributes) => void;
|
|
16
|
+
error: (name: string, attributes?: Attributes) => void;
|
|
17
|
+
critical: (name: string, attributes?: Attributes) => void;
|
|
18
|
+
createComponentTracer: (name: string) => ITracer;
|
|
19
|
+
end: () => void;
|
|
20
|
+
getTraceId: () => string;
|
|
21
|
+
getFinishedSpans: () => ReadableSpan[] | undefined;
|
|
22
|
+
}
|
package/types/index.d.ts
CHANGED
package/types/types/index.d.ts
CHANGED
|
@@ -51,3 +51,6 @@ export interface IRectangle<Unit extends number = number> {
|
|
|
51
51
|
export type RecursivePartial<T> = {
|
|
52
52
|
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
|
|
53
53
|
};
|
|
54
|
+
export type WithRequired<T, K extends keyof T> = T & {
|
|
55
|
+
[P in K]-?: T[P];
|
|
56
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Функция, которая "сплющивает" вложенный объект. Делает так, чтобы все проперти в объекте были примитивами и
|
|
3
|
+
* не содержали вложенных объектов
|
|
4
|
+
* @param obj - исходный объект
|
|
5
|
+
* @param separator - символ разделитель. По умолчанию точка '.'
|
|
6
|
+
* @return - новый сплющенный объект, который не содержит больше вложенных объектов
|
|
7
|
+
*/
|
|
8
|
+
export declare const flattenObject: (obj: Record<string, any> | undefined, separator?: string) => Record<string, any>;
|
package/types/utils/index.d.ts
CHANGED
|
@@ -19,4 +19,5 @@ export { throttleFn, ThrottleOptions } from './throttleFn';
|
|
|
19
19
|
export { cloneDeep } from './cloneDeep';
|
|
20
20
|
export { observeElementSize } from './observeElementSize';
|
|
21
21
|
export { cloneDeepWith } from './cloneDeepWith';
|
|
22
|
+
export { flattenObject } from './flattenObject';
|
|
22
23
|
export { clearVideoElement } from './clearVideoElement';
|