@vkontakte/videoplayer-shared 1.0.83-dev.fa6bb797.0 → 1.0.83-dev.fd5ae4c1.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/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.83-dev.fa6bb797.0
3
- * Wed, 04 Mar 2026 14:17:57 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.83-dev.fd5ae4c1.0
3
+ * Tue, 10 Mar 2026 14:33:23 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-83/doc/
5
5
  */
6
- var Be=Object.defineProperty;var de=(t,e)=>{for(var r in e)Be(t,r,{get:e[r],enumerable:!0})};var Ge="1.0.83-dev.fa6bb797.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`)},He=t=>{};var S=()=>{};var qe=t=>{throw console.error(t),t},$e=t=>{console.error(t)},c=class{constructor(e){this.suppressErrors=!1;e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,r){let o=this.suppressErrors?$e:qe,n;r?typeof r=="function"?n={next:r,error:S}:n={next:a=>r.next(a),error:a=>r.error?.(a)}:n={next:o,error:S};let s=typeof e=="function"?{next:a=>{try{let p=e(a);p instanceof Promise&&p.catch(m=>n.next(m))}catch(p){n.next(p)}},error:a=>n.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):n.next(a)},i;try{i=this._subscribe(s)}catch(a){s.error?.(a)}return new b().add(()=>{switch(s.next=S,s.error=S,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return g(i)}})}pipe(...e){return e.reduce((r,o)=>o(r),this)}_subscribe(e){}};var h=class extends c{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(o=>o.next(r))}error(r){this.subscribers.forEach(o=>o.error?.(r))}_subscribe(r){let o=this.keyCounter++;return this.subscribers.set(o,r),new b().add(()=>this.subscribers.delete(o))}};var K=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 o;try{o=e(...r)}catch{o={message:"error in `createCustomLog`",component:"Logger"}}this.log(o)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function Ye(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Xe(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function v(t){return typeof t<"u"&&t!==null}function O(t){return t==null}var B=t=>Object.fromEntries(Object.entries(t).filter(([e,r])=>v(r)));function Je(t,e){if(!t?.length)throw new Error(e)}function Ze(t,e){if(t?.length)throw new Error(e)}var u=()=>globalThis,be=(t=u())=>!!(t.window&&t.screen);var et=(t,e,r)=>new Promise((o,n)=>{e.addEventListener("abort",()=>{a(),m.remove()});let s=()=>{a(),n("error")},i=()=>{a(),o()},a=()=>{p&&clearTimeout(p),m.removeEventListener("load",i),m.removeEventListener("error",s)},p;r&&(p=u().setTimeout(()=>{a(),n("timeout")},r));let m=document.createElement("script");m.addEventListener("load",i),m.addEventListener("error",s),m.src=t,document.head.appendChild(m)});var tt=typeof u().performance?.now=="function"?()=>u().performance.now():()=>Date.now();var rt=(t,e)=>async(...r)=>{let o=e(...r),n=t.aborted,s;for(;!n&&!t.aborted;)try{let i=await o.next(s);n=i.done??!1,s=i.value}catch(i){await o.throw(i)}return s};var ot=(t,{start:e=0,factor:r=2,max:o=1/0,min:n=e,random:s=0}={})=>{let i=e;return i*=r**t,i*=1+(Math.random()*s*2-s),i=Math.round(i),i=Math.min(i,o),i=Math.max(i,n),i};var fe={};de(fe,{clear:()=>pt,get:()=>it,has:()=>at,isPersistent:()=>nt,remove:()=>ct,set:()=>st});var A,w,G=`vk-videoplayer-dummy-key-${Math.random()}`,P=()=>{if(w!==void 0)return w;try{localStorage.setItem(G,"test"),localStorage.removeItem(G),w=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(G),w=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)w=2;else throw e}else throw t}return w===2&&(A=new Map),w},nt=()=>P()===0,it=t=>{let e=P();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return A?.get(t);default:g(e)}},st=(t,e)=>{let r=P();switch(r){case 0:try{localStorage.setItem(t,e)}catch(o){if(o instanceof DOMException)console.error(o);else throw o}break;case 1:try{sessionStorage.setItem(t,e)}catch(o){if(o instanceof DOMException)console.error(o);else throw o}break;case 2:A?.set(t,e);return;default:g(r)}},at=t=>{let e=P();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return A?.has(t)??!1;default:return g(e),!1}},ct=t=>{let e=P();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:A?.delete(t);return;default:g(e)}},pt=()=>{let t=P();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return A?.clear();default:g(t)}};var lt=()=>{let t,e=[],r=u();try{t=r.self!==r.top}catch(o){o instanceof DOMException&&o.name==="SecurityError"?t=!0:(t=!1,console.error(o))}try{r.location.ancestorOrigins&&(e=[...r.location.ancestorOrigins])}catch(o){console.error(o)}try{!e.length&&r.document.referrer&&(e=[new URL(r.document.referrer).origin])}catch(o){console.error(o)}return e=e.filter(o=>URL.canParse(o)),{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var H=(l=>(l.INVARIANT="Invariant quality",l.Q_144P="144p",l.Q_240P="240p",l.Q_360P="360p",l.Q_480P="480p",l.Q_576P="576p",l.Q_720P="720p",l.Q_1080P="1080p",l.Q_1440P="1440p",l.Q_2160P="2160p",l.Q_4320P="4320p",l))(H||{});var T={"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}},ut=(t,e)=>T[t].height>T[e].height,mt=(t,e)=>T[t].height>=T[e].height,q=(t,e)=>T[t].height<T[e].height,dt=(t,e)=>T[t].height<=T[e].height,bt=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:q(e,r)?1:-1)[0],Te=Object.keys(T).sort((t,e)=>q(t,e)?-1:1),ft=(t,e=.02)=>[...Te].find(o=>T[o].height*(1+e)>=t),Tt=({width:t,height:e})=>{let r=Math.min(t,e),o=Math.max(t,e);return Te.find(n=>{let s=T[n];return s.width>=o&&s.height>=r})},yt=t=>T[t].height,$=t=>t==="Invariant quality",It=t=>t.every(e=>!$(e));function ht(t){if($(t))throw new Error("Expected exact quality")}var gt=t=>{switch(t){case"4320p":return"8K";case"2160p":return"4K";case"1440p":return"QHD";case"1080p":return"FHD";case"720p":return"HD";default:return""}};var vt=(t,e)=>{let r={};for(let o of Object.keys(e)){let n=e[o],s=t[o];Array.isArray(n)&&Array.isArray(s)?r[o]=s:typeof n=="object"&&typeof s=="object"?r[o]=vt(s,n):r[o]=o in t?s:n}return r};var Nr=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 Y(t,e=0,r){let o,n,s,i,a,p,m=0,y=!1,l=!1,z=!0,pe=!e&&e!==0&&typeof u().requestAnimationFrame=="function";r&&(y=!!r.leading,l="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,z="trailing"in r?!!r.trailing:z);function F(d){let I=o,E=n;return o=n=void 0,m=d,i=t.apply(E,I),i}function R(d,I){return pe?(a&&u().cancelAnimationFrame(a),u().requestAnimationFrame(d)):setTimeout(d,I)}function Ue(d){if(pe){u().cancelAnimationFrame(d);return}clearTimeout(d)}function je(d){return m=d,a=R(L,e),y?F(d):i}function We(d){let I=d-p,E=d-m,me=e-I;return l?Math.min(me,s-E):me}function le(d){let I=d-p,E=d-m;return p===void 0||I>=e||I<0||l&&E>=s}function L(){let d=Date.now();if(le(d))return ue(d);a=R(L,We(d))}function ue(d){return a=void 0,z&&o?F(d):(o=n=void 0,i)}function ze(){a!==void 0&&Ue(a),m=0,o=p=n=a=void 0}function Fe(){return a===void 0?i:ue(Date.now())}function Ke(){return a!==void 0}function C(...d){let I=Date.now(),E=le(I);if(o=d,n=this,p=I,E){if(a===void 0)return je(p);if(l)return a=R(L,e),F(p)}return a===void 0&&(a=R(L,e)),i}return C.cancel=ze,C.flush=Fe,C.pending=Ke,C}var X=(t,e=0,r)=>Y(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var M=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let o in t){if(typeof e=="function"){let n=e(t[o],o,t,r);if(n!==void 0){r[o]=n;continue}}typeof t[o]=="object"?r[o]=M(t[o],e):r[o]=t[o]}return r};var xt=t=>M(t);var k=class extends h{constructor(r){super();this.buffer=[];this.cursorEnd=-1;this.cursorStart=0;this.bufferSize=r,this.buffer=Array(r)}next(r){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=r,this.subscribers.forEach(o=>o.next(r))}_subscribe(r){for(let n=this.cursorStart;n<=this.cursorEnd;n++)r.next(this.buffer[n%this.bufferSize]);let o=this.keyCounter++;return this.subscribers.set(o,r),new b().add(()=>this.subscribers.delete(o))}};var V=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 ye(t){return new c(e=>{let r={},o=Object.keys(t).length,n=s=>i=>{s in r||o--,r[s]=i,o===0&&e.next(r)};return Object.entries(t).reduce((s,[i,a])=>s.add(a.subscribe(n(i))),new b)})}function Ie(...t){return new c(e=>t.reduce((r,o)=>r.add(o.subscribe(e)),new b))}var Et=t=>new c(e=>{let r=u().setTimeout(()=>{try{e.next()}catch(o){if(e.error)e.error(o);else throw o}},t);return()=>u().clearTimeout(r)});var Ot=t=>new c(e=>{let r=u(),o=r.setInterval(()=>e.next(),t);return()=>{o&&(r.clearInterval(o),o=void 0)}});var wt=t=>new c(e=>{t.forEach(r=>e.next(r))});var St=(t,e)=>new c(r=>{let o=n=>r.next(n);return t.addEventListener(e,o),()=>t.removeEventListener(e,o)});var Q=class extends b{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function he(t){return e=>new c(r=>e.subscribe(new J(r,t)))}var J=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 At={leading:!1,trailing:!0};function ge(t,e=At){return r=>new c(o=>r.subscribe(new Z(o,t,e)))}var Z=class{constructor(e,r,o){this.destination=e;this.time=r;this.config=o}next(e){this.lastValue=e;let r=u();v(this.timeout)?r.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=r.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(o){if(this.destination.error)this.destination.error(o);else throw o}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var Pt={leading:!0,trailing:!1};function ve(t,e=Pt){return r=>new c(o=>r.subscribe(new ee(o,t,e)))}var ee=class{constructor(e,r,o){this.destination=e;this.time=r;this.config=o}next(e){this.lastValue=e,O(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=u().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function xe(t){return e=>new c(r=>e.subscribe(new te(r,t)))}var te=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(o){throw this.error(o),o}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};var kt=(t,e)=>{let r=(o,n)=>{let s=Object.keys(o);for(let i in n)if(!s.includes(i)||n[i]!==o[i])return!1;return!0};return r(t,e)&&r(e,t)},Nt=(t,e)=>t instanceof Object&&e instanceof Object?kt(t,e):t===e;function Oe(t=Nt){return e=>new c(r=>e.subscribe(new re(r,t)))}var Ee={},re=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=Ee}next(e){let r;try{r=this.lastValue===Ee||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(o){throw this.error(o),o}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function _(t){return e=>new c(r=>e.subscribe(new oe(r,t)))}var oe=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(o){throw this.error(o),o}this.destination.next(r)}error(e){this.destination.error?.(e)}};function we(t){return _(()=>t)}function Se(){return t=>new c(e=>{let r=!1,o=!1,n=t.subscribe(s=>{r||(r=!0,e.next(s)),o&&n.unsubscribe()},s=>{r=!0,e.error?.(s),o&&n.unsubscribe()});return o=!0,r&&n.unsubscribe(),n})}function Ae(){return t=>new c(e=>t.subscribe(new ne(e)))}var ne=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 Pe(t){return e=>new c(r=>e.subscribe(new ie(r,t)))}var ie=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)}};function ke(t){return e=>new c(r=>e.subscribe(new se(r,t)))}var se=class{constructor(e,r){this.destination=e;this.count=r;r<0&&this.destination.error?.(new 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 Ne(t=0){return e=>{let r=0,o=new k(t),n=e.subscribe(o),s=i=>()=>{i.unsubscribe(),r--,r===0&&n.unsubscribe()};return new c(i=>(r++,s(o.subscribe(i))))}}var Rt=300,Lt=(t,e=Rt)=>new c(r=>{let o=u(),{width:n,height:s}=t.getBoundingClientRect();if(r.next({width:n,height:s}),!be(o))return;let i=new o.ResizeObserver(X(a=>{let p=a[0];if(!p)return;let m,y;p.contentBoxSize&&p.contentBoxSize[0]?(y=p.contentBoxSize[0].blockSize,m=p.contentBoxSize[0].inlineSize):p.contentRect&&(m=p.contentRect.width,y=p.contentRect.height),v(m)&&v(y)&&r.next({width:m,height:y})},e));return i.observe(t),()=>i.disconnect()});var D=(t,e=6,r=".")=>{let o={};for(let n in t)if(!(!t.hasOwnProperty(n)||t[n]instanceof HTMLElement||!e))if(typeof t[n]=="object"&&t[n]!==null){let s=D(t[n],e-1);for(let i in s)s.hasOwnProperty(i)&&(o[n+r+i]=s[i])}else o[n]=t[n];return o};var Ct=(t,e=!1)=>{e&&(t.innerHTML=""),t.removeAttribute("src"),t.load()};var vn=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var Mt=(t,e)=>!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom);var Vt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),Qt=t=>t!==void 0&&t!==""?t:Vt().toString();function _t(t,e,r){if(t<=e[0])return r[0];if(t>=e[e.length-1])return r[r.length-1];let o=1;for(;o<e.length&&e[o]<t;)o++;o>=e.length&&(o=e.length-1);let n=e[o-1],s=e[o],i=r[o-1],a=r[o];if(t===n)return i;if(t===s)return a;let p=(t-n)/(s-n);return i+p*(a-i)}function Dt(t,e,r){if(t<=0||r<0)return[];let o=[],n=Math.floor((t-1)/2),s=Math.floor(t/2),i=e-n,a=e+s;i<0&&(a+=Math.abs(i),i=0),a>r&&(i-=a-r,a=r),i=Math.max(0,i),a=Math.min(r,a);for(let p=i;p<=a;p++)o.push(p);return o}var Re=t=>t instanceof DOMException&&(t.name==="AbortError"||t.code===20),Ut=t=>{if(!Re(t))throw t};var jt=t=>e=>r=>{let o=typeof r=="object";r==null||o&&!Object.keys(r).length||t(e,o?D(r):{value:r})},U=(t={})=>{let e=o=>{let n=o;return o===void 0?n="undefined":o===null?n="null":(typeof o=="number"||typeof o=="boolean")&&(n=o.toString()),n},r={};for(let o in t)Array.isArray(t[o])?r[o]=t[o].map(e):r[o]=e(t[o]);return r};var x=class t{constructor({name:e,getParentContext:r}){this.dynamicImportTimeout=5e3;this.childTracers=[];t.dynamicImportStatus==="not_started"&&(t.dynamicImportPromise=this.loadOpentelemetry());let o=Date.now();this.initPromise=t.dynamicImportPromise.then(n=>{t.dynamicImportStatus==="completed"&&this.init({name:e,getParentContext:r},o)})}static{this.dynamicImportStatus="not_started"}init({name:e,getParentContext:r},o){this.span=t.rootTracer.startSpan(e,{startTime:o},r?.()),this.context=t.dynamicImports.opentelemetryApi.trace.setSpan(t.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(t.dynamicImportStatus==="not_started"){t.dynamicImportStatus="in_progress";try{let e=new Promise((i,a)=>setTimeout(a,this.dynamicImportTimeout)),r=Promise.all([import("@opentelemetry/api"),import("@opentelemetry/sdk-trace-web"),import("@apptracer/opentelemetry")]),[o,n,s]=await Promise.race([r,e]);t.dynamicImports={opentelemetryApi:o,opentelemetrySdk:n,tracer:s},t.dynamicImportStatus="completed"}catch{t.dynamicImportStatus="failed"}}}isComponentTracerNotInitialized(){return O(this.span)||t.dynamicImportStatus==="failed"}log(e,r){let o=Date.now();this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(r),type:"log"},o)})}error(e,r){let o=Date.now();this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(r),type:"error"},o)})}critical(e,r){let o=Date.now();this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(r),type:"critical"},o)})}createComponentTracer(e){let r=new t({name:e,getParentContext:()=>this.context});return this.childTracers.push(r),r}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(r=>r.end()),this.span.end())})}};var j=class extends x{constructor(){super({name:"Root"})}init({name:e,getParentContext:r},o){let s=x.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),i=new x.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=i,s.addSpanProcessor(new x.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:i})),x.rootTracer=s.getTracer("sdk-videoplayer-tracer"),super.init({name:e,getParentContext:r},o)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?"":this.span.spanContext().traceId}};var W=class t{constructor(e){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}};var ae=class{static createRootTracer(e=!1){return e?new j:new W}};var Le=(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))(Le||{});var Wt=(l=>(l.Armenian="58",l.Azerbaijani="57",l.Belarusian="114",l.English="3",l.Kazakh="97",l.Portuguese="73",l.Russian="0",l.Spanish="4",l.Ukrainian="1",l.Uzbek="65",l.Vietnamese="75",l))(Wt||{}),zt="vk.com",Qi=async(t,e,r)=>{let o=new URL(`https://${zt}/js/lang-pack.js`);o.searchParams.set("format","json"),o.searchParams.set("name",e),t!==void 0&&o.searchParams.set("lang",t);let s=await(await fetch(o.toString())).json();return Ft(s,r)},Ft=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,o])=>[r.substring(`${e}_`.length),Kt(o)])),Kt=t=>Array.isArray(t)?t[0]:t;var Bt=(r=>(r.RU="ru",r.EN="en",r))(Bt||{});var f="__vk_vp_internals_exposure",Ce=class{constructor(e,r){this.playerId=r,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>"u")return{};let e=this.playerId,r=this.type;return window[f]?.[e]?.[r]??{}}initWindowObjects(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[f]||(window[f]={}),window[f][e]||(window[f][e]={}),window[f][e][r]||(window[f][e][r]={})}expose(e){typeof window>"u"||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[f]&&window[f][e]&&window[f][e][r]&&(delete window[f][e][r],Object.keys(window[f][e]).length||delete window[f][e],Object.keys(window[f]).length||delete window[f])}};var Me={};de(Me,{create:()=>Gt,destroy:()=>Ht,push:()=>qt,subscribe:()=>$t});var N=new Map,Gt=(t,e)=>N.set(t,e??[]),Ht=t=>N.delete(t),qt=(t,e)=>{let r=N.get(t);r&&(typeof r=="function"?r(e):r.push(e))},$t=(t,e)=>{let r=N.get(t);if(r){if(r&&Array.isArray(r))for(let o of r)e(o);N.set(t,e)}};var Ve="gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5";var Qe=t=>{let e={id:t.id,message:t.message,category:t.category,data:Yt(t.data),httpCode:t.httpCode,UVBackendErrorCode:t.UVBackendErrorCode};return B(e)};function Yt(t){switch(typeof t){case"boolean":case"string":case"number":return t;case"object":try{return JSON.stringify(t)}catch{return}default:return}}var _e=t=>{let e=t.thrown instanceof Error?t.thrown:new Error(t.message);return e.name=t.id,e},De=()=>{try{let{origin:t,pathname:e,search:r,hostname:o}=u().document.location;return o==="localhost"?void 0:{url:t+e,...new URLSearchParams(r).entries().reduce((n,[s,i])=>(n[`url.${s}`]=i,n),{})}}catch{}};var ce=class t{constructor(e,r,o,n){this.dynamicImportTimeout=5e3;this.subscription=new b;this.componentName=e,this.options=r,this.envParams=o,this.context=n,this.options.enabled&&(this.loadModule(),this.init())}static{this.tracerErrorMap=new Map}static{this.appTracerModule=null}static{this.loadPromise=null}error(e,r){let{blackErrorCategoryList:o,blackErrorIdList:n,sampleRate:s,whiteErrorCategoryList:i,whiteErrorIdList:a}=this.options,{id:p,category:m}=e;if(o.length&&o.includes(m)||n.length&&n.includes(p)||i.length&&!i.includes(m)||a.length&&!a.includes(p)||Math.random()>=s)return;t.tracerErrorMap.get(this.componentName)?.error(_e(e),{severity:r?.severity??(e.traceAsLog?"debug":void 0),keys:{...this.context,...Qe(e),...De()}})}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await t.loadPromise,t.tracerErrorMap.has(this.componentName)||O(t.appTracerModule))return;let{appTracerModule:e}=t,{initTracerError:r,initTracerErrorUploader:o,addTracerPlugin:n,getTracerModules:s}=e,i=s(this.componentName),a=!i.error,p=i.error??r(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});a&&o(this.componentName,{appToken:Ve,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),n(this.componentName,{name:"addedCategory",errorBeforeAdd(m){let y=m.keys?.category??"wtf";if(typeof y=="string")return{issueKey:y}}}),t.tracerErrorMap.set(this.componentName,p)}catch{}}loadModule(){if(v(t.loadPromise))return;let e=async()=>{try{let r=new Promise((n,s)=>u().setTimeout(s,this.dynamicImportTimeout)),o=await Promise.race([r,import("@apptracer/sdk/lite")]);t.appTracerModule=o}catch{t.loadPromise=null}};t.loadPromise=e()}};export{ce as AppTracer,Le as ErrorCategory,f as INTERNAL_EXPOSE_GLOBAL_KEY,Bt as InterfaceLanguage,Ce as InternalsExposure,K as Logger,c as Observable,k as ReplaySubject,h as Subject,b as Subscription,Q as SubscriptionRemovable,ae as TracerFactory,Ge as VERSION,Wt as VKNumericLanguage,V as ValueSubject,H as VideoQuality,rt as abortable,et as addScript,It as areQualitiesExact,Ze as assertEmptyArray,g as assertNever,Ye as assertNonNullable,Je as assertNotEmptyArray,Xe as assertNullable,ht as assertQualityIsExact,he as buffer,He as checkNever,Ct as clearVideoElement,xt as cloneDeep,M as cloneDeepWith,ye as combine,ge as debounce,Y as debounceFn,lt as detectEmbed,Me as devNull,vt as fillWithDefault,xe as filter,Oe as filterChanged,D as flattenObject,St as fromEvent,ot as getExponentialDelay,bt as getHighestQuality,Qt as getPlayerId,Dt as getRangeAroundIndex,jt as getTraceSubscriptionMethod,gt as getVideoQualityLabel,u as getWindow,_t as interpolate,Ot as interval,Re as isAbortError,be as isBrowserWindow,ut as isHigher,mt as isHigherOrEqual,Mt as isIntersecting,$ as isInvariantQuality,q as isLower,dt as isLowerOrEqual,v as isNonNullable,O as isNullable,vn as isValidURL,Qi as loadVKLangPack,_ as map,we as mapTo,Ie as merge,S as noop,tt as now,wt as observableFrom,Lt as observeElementSize,Se as once,Ae as pairwise,fe as safeStorage,Ne as shareReplay,ke as skip,Ut as suppressAbort,Pe as tap,ve as throttle,X as throttleFn,Nr as timeCodeToString,Et as timeout,ft as videoHeightToQuality,yt as videoQualityToHeight,Tt as videoSizeToQuality,B as withoutNullable};
6
+ var Ke=Object.defineProperty;var de=(t,e)=>{for(var r in e)Ke(t,r,{get:e[r],enumerable:!0})};var Be="1.0.83-dev.fd5ae4c1.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`)},Ge=t=>{};var S=()=>{};var He=t=>{throw console.error(t),t},qe=t=>{console.error(t)},c=class{constructor(e){this.suppressErrors=!1;e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,r){let o=this.suppressErrors?qe:He,n;r?typeof r=="function"?n={next:r,error:S}:n={next:a=>r.next(a),error:a=>r.error?.(a)}:n={next:o,error:S};let s=typeof e=="function"?{next:a=>{try{let p=e(a);p instanceof Promise&&p.catch(m=>n.next(m))}catch(p){n.next(p)}},error:a=>n.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):n.next(a)},i;try{i=this._subscribe(s)}catch(a){s.error?.(a)}return new b().add(()=>{switch(s.next=S,s.error=S,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return g(i)}})}pipe(...e){return e.reduce((r,o)=>o(r),this)}_subscribe(e){}};var h=class extends c{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(o=>o.next(r))}error(r){this.subscribers.forEach(o=>o.error?.(r))}_subscribe(r){let o=this.keyCounter++;return this.subscribers.set(o,r),new b().add(()=>this.subscribers.delete(o))}};var K=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 o;try{o=e(...r)}catch{o={message:"error in `createCustomLog`",component:"Logger"}}this.log(o)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function $e(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ye(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function v(t){return typeof t<"u"&&t!==null}function O(t){return t==null}var B=t=>Object.fromEntries(Object.entries(t).filter(([e,r])=>v(r)));function Xe(t,e){if(!t?.length)throw new Error(e)}function Je(t,e){if(t?.length)throw new Error(e)}var u=()=>globalThis,be=(t=u())=>!!(t.window&&t.screen);var Ze=(t,e,r)=>new Promise((o,n)=>{e.addEventListener("abort",()=>{a(),m.remove()});let s=()=>{a(),n("error")},i=()=>{a(),o()},a=()=>{p&&clearTimeout(p),m.removeEventListener("load",i),m.removeEventListener("error",s)},p;r&&(p=u().setTimeout(()=>{a(),n("timeout")},r));let m=document.createElement("script");m.addEventListener("load",i),m.addEventListener("error",s),m.src=t,document.head.appendChild(m)});var et=typeof u().performance?.now=="function"?()=>u().performance.now():()=>Date.now();var tt=(t,e)=>async(...r)=>{let o=e(...r),n=t.aborted,s;for(;!n&&!t.aborted;)try{let i=await o.next(s);n=i.done??!1,s=i.value}catch(i){await o.throw(i)}return s};var rt=(t,{start:e=0,factor:r=2,max:o=1/0,min:n=e,random:s=0}={})=>{let i=e;return i*=r**t,i*=1+(Math.random()*s*2-s),i=Math.round(i),i=Math.min(i,o),i=Math.max(i,n),i};var fe={};de(fe,{clear:()=>ct,get:()=>nt,has:()=>st,isPersistent:()=>ot,remove:()=>at,set:()=>it});var A,w,G=`vk-videoplayer-dummy-key-${Math.random()}`,P=()=>{if(w!==void 0)return w;try{localStorage.setItem(G,"test"),localStorage.removeItem(G),w=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(G),w=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)w=2;else throw e}else throw t}return w===2&&(A=new Map),w},ot=()=>P()===0,nt=t=>{let e=P();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return A?.get(t);default:g(e)}},it=(t,e)=>{let r=P();switch(r){case 0:try{localStorage.setItem(t,e)}catch(o){if(o instanceof DOMException)console.error(o);else throw o}break;case 1:try{sessionStorage.setItem(t,e)}catch(o){if(o instanceof DOMException)console.error(o);else throw o}break;case 2:A?.set(t,e);return;default:g(r)}},st=t=>{let e=P();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return A?.has(t)??!1;default:return g(e),!1}},at=t=>{let e=P();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:A?.delete(t);return;default:g(e)}},ct=()=>{let t=P();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return A?.clear();default:g(t)}};var pt=()=>{let t,e=[],r=u();try{t=r.self!==r.top}catch(o){o instanceof DOMException&&o.name==="SecurityError"?t=!0:(t=!1,console.error(o))}try{r.location.ancestorOrigins&&(e=[...r.location.ancestorOrigins])}catch(o){console.error(o)}try{!e.length&&r.document.referrer&&(e=[new URL(r.document.referrer).origin])}catch(o){console.error(o)}return e=e.filter(o=>URL.canParse(o)),{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var H=(l=>(l.INVARIANT="Invariant quality",l.Q_144P="144p",l.Q_240P="240p",l.Q_360P="360p",l.Q_480P="480p",l.Q_576P="576p",l.Q_720P="720p",l.Q_1080P="1080p",l.Q_1440P="1440p",l.Q_2160P="2160p",l.Q_4320P="4320p",l))(H||{});var T={"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}},lt=(t,e)=>T[t].height>T[e].height,ut=(t,e)=>T[t].height>=T[e].height,q=(t,e)=>T[t].height<T[e].height,mt=(t,e)=>T[t].height<=T[e].height,dt=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:q(e,r)?1:-1)[0],Te=Object.keys(T).sort((t,e)=>q(t,e)?-1:1),bt=(t,e=.02)=>[...Te].find(o=>T[o].height*(1+e)>=t),ft=({width:t,height:e})=>{let r=Math.min(t,e),o=Math.max(t,e);return Te.find(n=>{let s=T[n];return s.width>=o&&s.height>=r})},Tt=t=>T[t].height,$=t=>t==="Invariant quality",yt=t=>t.every(e=>!$(e));function It(t){if($(t))throw new Error("Expected exact quality")}var ht=t=>{switch(t){case"4320p":return"8K";case"2160p":return"4K";case"1440p":return"QHD";case"1080p":return"FHD";case"720p":return"HD";default:return""}};var gt=(t,e)=>{let r={};for(let o of Object.keys(e)){let n=e[o],s=t[o];Array.isArray(n)&&Array.isArray(s)?r[o]=s:typeof n=="object"&&typeof s=="object"?r[o]=gt(s,n):r[o]=o in t?s:n}return r};var kr=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 Y(t,e=0,r){let o,n,s,i,a,p,m=0,y=!1,l=!1,z=!0,pe=!e&&e!==0&&typeof u().requestAnimationFrame=="function";r&&(y=!!r.leading,l="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,z="trailing"in r?!!r.trailing:z);function F(d){let I=o,E=n;return o=n=void 0,m=d,i=t.apply(E,I),i}function R(d,I){return pe?(a&&u().cancelAnimationFrame(a),u().requestAnimationFrame(d)):setTimeout(d,I)}function De(d){if(pe){u().cancelAnimationFrame(d);return}clearTimeout(d)}function Ue(d){return m=d,a=R(L,e),y?F(d):i}function je(d){let I=d-p,E=d-m,me=e-I;return l?Math.min(me,s-E):me}function le(d){let I=d-p,E=d-m;return p===void 0||I>=e||I<0||l&&E>=s}function L(){let d=Date.now();if(le(d))return ue(d);a=R(L,je(d))}function ue(d){return a=void 0,z&&o?F(d):(o=n=void 0,i)}function We(){a!==void 0&&De(a),m=0,o=p=n=a=void 0}function ze(){return a===void 0?i:ue(Date.now())}function Fe(){return a!==void 0}function C(...d){let I=Date.now(),E=le(I);if(o=d,n=this,p=I,E){if(a===void 0)return Ue(p);if(l)return a=R(L,e),F(p)}return a===void 0&&(a=R(L,e)),i}return C.cancel=We,C.flush=ze,C.pending=Fe,C}var X=(t,e=0,r)=>Y(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var M=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let o in t){if(typeof e=="function"){let n=e(t[o],o,t,r);if(n!==void 0){r[o]=n;continue}}typeof t[o]=="object"?r[o]=M(t[o],e):r[o]=t[o]}return r};var vt=t=>M(t);var k=class extends h{constructor(r){super();this.buffer=[];this.cursorEnd=-1;this.cursorStart=0;this.bufferSize=r,this.buffer=Array(r)}next(r){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=r,this.subscribers.forEach(o=>o.next(r))}_subscribe(r){for(let n=this.cursorStart;n<=this.cursorEnd;n++)r.next(this.buffer[n%this.bufferSize]);let o=this.keyCounter++;return this.subscribers.set(o,r),new b().add(()=>this.subscribers.delete(o))}};var V=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 ye(t){return new c(e=>{let r={},o=Object.keys(t).length,n=s=>i=>{s in r||o--,r[s]=i,o===0&&e.next(r)};return Object.entries(t).reduce((s,[i,a])=>s.add(a.subscribe(n(i))),new b)})}function Ie(...t){return new c(e=>t.reduce((r,o)=>r.add(o.subscribe(e)),new b))}var xt=t=>new c(e=>{let r=u().setTimeout(()=>{try{e.next()}catch(o){if(e.error)e.error(o);else throw o}},t);return()=>u().clearTimeout(r)});var Et=t=>new c(e=>{let r=u(),o=r.setInterval(()=>e.next(),t);return()=>{o&&(r.clearInterval(o),o=void 0)}});var Ot=t=>new c(e=>{t.forEach(r=>e.next(r))});var wt=(t,e)=>new c(r=>{let o=n=>r.next(n);return t.addEventListener(e,o),()=>t.removeEventListener(e,o)});var Q=class extends b{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function he(t){return e=>new c(r=>e.subscribe(new J(r,t)))}var J=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 St={leading:!1,trailing:!0};function ge(t,e=St){return r=>new c(o=>r.subscribe(new Z(o,t,e)))}var Z=class{constructor(e,r,o){this.destination=e;this.time=r;this.config=o}next(e){this.lastValue=e;let r=u();v(this.timeout)?r.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=r.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(o){if(this.destination.error)this.destination.error(o);else throw o}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var At={leading:!0,trailing:!1};function ve(t,e=At){return r=>new c(o=>r.subscribe(new ee(o,t,e)))}var ee=class{constructor(e,r,o){this.destination=e;this.time=r;this.config=o}next(e){this.lastValue=e,O(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=u().setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function xe(t){return e=>new c(r=>e.subscribe(new te(r,t)))}var te=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(o){throw this.error(o),o}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};var Pt=(t,e)=>{let r=(o,n)=>{let s=Object.keys(o);for(let i in n)if(!s.includes(i)||n[i]!==o[i])return!1;return!0};return r(t,e)&&r(e,t)},kt=(t,e)=>t instanceof Object&&e instanceof Object?Pt(t,e):t===e;function Oe(t=kt){return e=>new c(r=>e.subscribe(new re(r,t)))}var Ee={},re=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=Ee}next(e){let r;try{r=this.lastValue===Ee||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(o){throw this.error(o),o}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function _(t){return e=>new c(r=>e.subscribe(new oe(r,t)))}var oe=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(o){throw this.error(o),o}this.destination.next(r)}error(e){this.destination.error?.(e)}};function we(t){return _(()=>t)}function Se(){return t=>new c(e=>{let r=!1,o=!1,n=t.subscribe(s=>{r||(r=!0,e.next(s)),o&&n.unsubscribe()},s=>{r=!0,e.error?.(s),o&&n.unsubscribe()});return o=!0,r&&n.unsubscribe(),n})}function Ae(){return t=>new c(e=>t.subscribe(new ne(e)))}var ne=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 Pe(t){return e=>new c(r=>e.subscribe(new ie(r,t)))}var ie=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)}};function ke(t){return e=>new c(r=>e.subscribe(new se(r,t)))}var se=class{constructor(e,r){this.destination=e;this.count=r;r<0&&this.destination.error?.(new 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 Ne(t=0){return e=>{let r=0,o=new k(t),n=e.subscribe(o),s=i=>()=>{i.unsubscribe(),r--,r===0&&n.unsubscribe()};return new c(i=>(r++,s(o.subscribe(i))))}}var Nt=300,Rt=(t,e=Nt)=>new c(r=>{let o=u(),{width:n,height:s}=t.getBoundingClientRect();if(r.next({width:n,height:s}),!be(o))return;let i=new o.ResizeObserver(X(a=>{let p=a[0];if(!p)return;let m,y;p.contentBoxSize&&p.contentBoxSize[0]?(y=p.contentBoxSize[0].blockSize,m=p.contentBoxSize[0].inlineSize):p.contentRect&&(m=p.contentRect.width,y=p.contentRect.height),v(m)&&v(y)&&r.next({width:m,height:y})},e));return i.observe(t),()=>i.disconnect()});var D=(t,e=6,r=".")=>{let o={};for(let n in t)if(!(!t.hasOwnProperty(n)||t[n]instanceof HTMLElement||!e))if(typeof t[n]=="object"&&t[n]!==null){let s=D(t[n],e-1);for(let i in s)s.hasOwnProperty(i)&&(o[n+r+i]=s[i])}else o[n]=t[n];return o};var Lt=(t,e=!1)=>{e&&(t.innerHTML=""),t.removeAttribute("src"),t.load()};var gn=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var Ct=(t,e)=>!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom);var Mt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),Vt=t=>t!==void 0&&t!==""?t:Mt().toString();function Qt(t,e,r){if(t<=e[0])return r[0];if(t>=e[e.length-1])return r[r.length-1];let o=1;for(;o<e.length&&e[o]<t;)o++;o>=e.length&&(o=e.length-1);let n=e[o-1],s=e[o],i=r[o-1],a=r[o];if(t===n)return i;if(t===s)return a;let p=(t-n)/(s-n);return i+p*(a-i)}function _t(t,e,r){if(t<=0||r<0)return[];let o=[],n=Math.floor((t-1)/2),s=Math.floor(t/2),i=e-n,a=e+s;i<0&&(a+=Math.abs(i),i=0),a>r&&(i-=a-r,a=r),i=Math.max(0,i),a=Math.min(r,a);for(let p=i;p<=a;p++)o.push(p);return o}var Re=t=>t instanceof DOMException&&(t.name==="AbortError"||t.code===20),Dt=t=>{if(!Re(t))throw t};var Ut=t=>e=>r=>{let o=typeof r=="object";r==null||o&&!Object.keys(r).length||t(e,o?D(r):{value:r})},U=(t={})=>{let e=o=>{let n=o;return o===void 0?n="undefined":o===null?n="null":(typeof o=="number"||typeof o=="boolean")&&(n=o.toString()),n},r={};for(let o in t)Array.isArray(t[o])?r[o]=t[o].map(e):r[o]=e(t[o]);return r};var x=class t{constructor({name:e,getParentContext:r}){this.dynamicImportTimeout=5e3;this.childTracers=[];t.dynamicImportStatus==="not_started"&&(t.dynamicImportPromise=this.loadOpentelemetry());let o=Date.now();this.initPromise=t.dynamicImportPromise.then(n=>{t.dynamicImportStatus==="completed"&&this.init({name:e,getParentContext:r},o)})}static{this.dynamicImportStatus="not_started"}init({name:e,getParentContext:r},o){this.span=t.rootTracer.startSpan(e,{startTime:o},r?.()),this.context=t.dynamicImports.opentelemetryApi.trace.setSpan(t.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(t.dynamicImportStatus==="not_started"){t.dynamicImportStatus="in_progress";try{let e=new Promise((i,a)=>setTimeout(a,this.dynamicImportTimeout)),r=Promise.all([import("@opentelemetry/api"),import("@opentelemetry/sdk-trace-web"),import("@apptracer/opentelemetry")]),[o,n,s]=await Promise.race([r,e]);t.dynamicImports={opentelemetryApi:o,opentelemetrySdk:n,tracer:s},t.dynamicImportStatus="completed"}catch{t.dynamicImportStatus="failed"}}}isComponentTracerNotInitialized(){return O(this.span)||t.dynamicImportStatus==="failed"}log(e,r){let o=Date.now();this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(r),type:"log"},o)})}error(e,r){let o=Date.now();this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(r),type:"error"},o)})}critical(e,r){let o=Date.now();this.initPromise.then(n=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...U(r),type:"critical"},o)})}createComponentTracer(e){let r=new t({name:e,getParentContext:()=>this.context});return this.childTracers.push(r),r}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(r=>r.end()),this.span.end())})}};var j=class extends x{constructor(){super({name:"Root"})}init({name:e,getParentContext:r},o){let s=x.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),i=new x.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=i,s.addSpanProcessor(new x.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:i})),x.rootTracer=s.getTracer("sdk-videoplayer-tracer"),super.init({name:e,getParentContext:r},o)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?"":this.span.spanContext().traceId}};var W=class t{constructor(e){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}};var ae=class{static createRootTracer(e=!1){return e?new j:new W}};var Le=(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))(Le||{});var jt=(l=>(l.Armenian="58",l.Azerbaijani="57",l.Belarusian="114",l.English="3",l.Kazakh="97",l.Portuguese="73",l.Russian="0",l.Spanish="4",l.Ukrainian="1",l.Uzbek="65",l.Vietnamese="75",l))(jt||{}),Wt="vk.com",Vi=async(t,e,r)=>{let o=new URL(`https://${Wt}/js/lang-pack.js`);o.searchParams.set("format","json"),o.searchParams.set("name",e),t!==void 0&&o.searchParams.set("lang",t);let s=await(await fetch(o.toString())).json();return zt(s,r)},zt=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,o])=>[r.substring(`${e}_`.length),Ft(o)])),Ft=t=>Array.isArray(t)?t[0]:t;var Kt=(r=>(r.RU="ru",r.EN="en",r))(Kt||{});var f="__vk_vp_internals_exposure",Ce=class{constructor(e,r){this.playerId=r,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>"u")return{};let e=this.playerId,r=this.type;return window[f]?.[e]?.[r]??{}}initWindowObjects(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[f]||(window[f]={}),window[f][e]||(window[f][e]={}),window[f][e][r]||(window[f][e][r]={})}expose(e){typeof window>"u"||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[f]&&window[f][e]&&window[f][e][r]&&(delete window[f][e][r],Object.keys(window[f][e]).length||delete window[f][e],Object.keys(window[f]).length||delete window[f])}};var Me={};de(Me,{create:()=>Bt,destroy:()=>Gt,push:()=>Ht,subscribe:()=>qt});var N=new Map,Bt=(t,e)=>N.set(t,e??[]),Gt=t=>N.delete(t),Ht=(t,e)=>{let r=N.get(t);r&&(typeof r=="function"?r(e):r.push(e))},qt=(t,e)=>{let r=N.get(t);if(r){if(r&&Array.isArray(r))for(let o of r)e(o);N.set(t,e)}};var Ve="gW5EerTD5QhAnsbpF7Hd2NSMRteYIUUMjFbSyI68Pf5";var Qe=t=>{let e={id:t.id,message:t.message,category:t.category,data:$t(t.data),httpCode:t.httpCode,UVBackendErrorCode:t.UVBackendErrorCode};return B(e)};function $t(t){switch(typeof t){case"boolean":case"string":case"number":return t;case"object":try{return JSON.stringify(t)}catch{return}default:return}}var _e=t=>{let e=t.thrown instanceof Error?t.thrown:new Error(t.message);return e.name=t.id,e};var ce=class t{constructor(e,r,o,n){this.dynamicImportTimeout=5e3;this.subscription=new b;this.componentName=e,this.options=r,this.envParams=o,this.context=n,this.options.enabled&&(this.loadModule(),this.init())}static{this.tracerErrorMap=new Map}static{this.appTracerModule=null}static{this.loadPromise=null}error(e,r){let{blackErrorCategoryList:o,blackErrorIdList:n,sampleRate:s,whiteErrorCategoryList:i,whiteErrorIdList:a}=this.options,{id:p,category:m}=e;if(o.length&&o.includes(m)||n.length&&n.includes(p)||i.length&&!i.includes(m)||a.length&&!a.includes(p)||Math.random()>=s)return;t.tracerErrorMap.get(this.componentName)?.error(_e(e),{severity:r?.severity??(e.traceAsLog?"debug":void 0),keys:{...this.context,...Qe(e)}})}addSubscription(e){this.subscription.add(e)}destroy(){this.subscription.unsubscribe()}async init(){try{if(await t.loadPromise,t.tracerErrorMap.has(this.componentName)||O(t.appTracerModule))return;let{appTracerModule:e}=t,{initTracerError:r,initTracerErrorUploader:o,addTracerPlugin:n,getTracerModules:s}=e,i=s(this.componentName),a=!i.error,p=i.error??r(this.componentName,{enableUnhandledErrorsListeners:!1,stringifyErrorDataObject:!0});a&&o(this.componentName,{appToken:Ve,environment:this.envParams.env,versionCode:1,versionName:this.envParams.version}),n(this.componentName,{name:"addedCategory",errorBeforeAdd(m){let y=m.keys?.category??"wtf";if(typeof y=="string")return{issueKey:y}}}),t.tracerErrorMap.set(this.componentName,p)}catch{}}loadModule(){if(v(t.loadPromise))return;let e=async()=>{try{let r=new Promise((n,s)=>u().setTimeout(s,this.dynamicImportTimeout)),o=await Promise.race([r,import("@apptracer/sdk/lite")]);t.appTracerModule=o}catch{t.loadPromise=null}};t.loadPromise=e()}};export{ce as AppTracer,Le as ErrorCategory,f as INTERNAL_EXPOSE_GLOBAL_KEY,Kt as InterfaceLanguage,Ce as InternalsExposure,K as Logger,c as Observable,k as ReplaySubject,h as Subject,b as Subscription,Q as SubscriptionRemovable,ae as TracerFactory,Be as VERSION,jt as VKNumericLanguage,V as ValueSubject,H as VideoQuality,tt as abortable,Ze as addScript,yt as areQualitiesExact,Je as assertEmptyArray,g as assertNever,$e as assertNonNullable,Xe as assertNotEmptyArray,Ye as assertNullable,It as assertQualityIsExact,he as buffer,Ge as checkNever,Lt as clearVideoElement,vt as cloneDeep,M as cloneDeepWith,ye as combine,ge as debounce,Y as debounceFn,pt as detectEmbed,Me as devNull,gt as fillWithDefault,xe as filter,Oe as filterChanged,D as flattenObject,wt as fromEvent,rt as getExponentialDelay,dt as getHighestQuality,Vt as getPlayerId,_t as getRangeAroundIndex,Ut as getTraceSubscriptionMethod,ht as getVideoQualityLabel,u as getWindow,Qt as interpolate,Et as interval,Re as isAbortError,be as isBrowserWindow,lt as isHigher,ut as isHigherOrEqual,Ct as isIntersecting,$ as isInvariantQuality,q as isLower,mt as isLowerOrEqual,v as isNonNullable,O as isNullable,gn as isValidURL,Vi as loadVKLangPack,_ as map,we as mapTo,Ie as merge,S as noop,et as now,Ot as observableFrom,Rt as observeElementSize,Se as once,Ae as pairwise,fe as safeStorage,Ne as shareReplay,ke as skip,Dt as suppressAbort,Pe as tap,ve as throttle,X as throttleFn,kr as timeCodeToString,xt as timeout,bt as videoHeightToQuality,Tt as videoQualityToHeight,ft as videoSizeToQuality,B as withoutNullable};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.83-dev.fa6bb797.0",
3
+ "version": "1.0.83-dev.fd5ae4c1.0",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",
@@ -2,6 +2,3 @@ import { IError } from '../types';
2
2
  import type { IAppTracerErrorDataKeys } from './types';
3
3
  export declare const mapIErrorToAppTracerErrorKeys: (error: IError) => IAppTracerErrorDataKeys;
4
4
  export declare const mapIErrorThrownToError: (error: IError) => Error;
5
- export declare const mapLocationData: () => {
6
- url: string;
7
- } | undefined;