@vkontakte/videoplayer-shared 1.0.24 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24
3
- * Mon, 19 Jun 2023 11:52:56 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- "use strict";const T="1.0.24";class v{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const b=r=>{throw new Error(`${r} is value of unexpected type`)},I=r=>{},w=()=>{};class l{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var n;let a;t?typeof t=="function"?a={next:t,error:w}:a={next:o=>t.next(o),error:o=>{var d;return(d=t.error)===null||d===void 0?void 0:d.call(t,o)}}:a={next:w,error:w};const i=typeof e=="function"?{next:o=>{try{e(o)}catch(d){a.next(d)}},error:o=>a.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):a.next(o)};let s;try{s=this._subscribe(i)}catch(o){(n=i.error)===null||n===void 0||n.call(i,o)}return new v().add(()=>{switch(i.next=w,i.error=w,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return b(s)}})}pipe(...e){return e.reduce((t,n)=>n(t),this)}_subscribe(e){}}class _ extends l{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>{var n;return(n=t.error)===null||n===void 0?void 0:n.call(t,e)})}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new v().add(()=>this.subscribers.delete(t))}}class A{constructor(){this.log$=new _,this.logs=[],this.log=e=>{const t=Object.assign(Object.assign({},e),{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch(a){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>Object.assign({component:e},t))}}function N(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function R(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function x(r){return typeof r!="undefined"&&r!==null}function O(r){return r==null}const y=(r,e,t)=>new Promise((n,a)=>{e.addEventListener("abort",()=>{o(),h.remove()});const i=()=>{o(),a()},s=()=>{o(),n()},o=()=>{d&&clearTimeout(d),h.removeEventListener("load",s),h.removeEventListener("error",i)};let d;t&&(d=window.setTimeout(i,t));const h=document.createElement("script");h.addEventListener("load",s),h.addEventListener("error",i),h.src=r,document.head.appendChild(h)});var p;const V=typeof((p=window.performance)===null||p===void 0?void 0:p.now)=="function"?()=>window.performance.now():()=>Date.now();function M(r,e,t,n){function a(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function o(f){try{h(n.next(f))}catch(E){s(E)}}function d(f){try{h(n.throw(f))}catch(E){s(E)}}function h(f){f.done?i(f.value):a(f.value).then(o,d)}h((n=n.apply(r,e||[])).next())})}const C=(r,e)=>(...t)=>M(void 0,void 0,void 0,function*(){var n;const a=e(...t);let i=r.aborted,s;for(;!i&&!r.aborted;){const o=yield a.next(s);i=(n=o.done)!==null&&n!==void 0?n:!1,s=o.value}return s}),G=(r,{start:e=0,factor:t=2,max:n=1/0,min:a=e,random:i=0}={})=>{let s=e;return s*=Math.pow(t,r),s*=1+(Math.random()*i*2-i),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,a),s};var c;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(c||(c={}));const m=new Map;let u=c.RUNTIME;const S=`vk-videoplayer-dummy-key-${Math.random()}`,D=()=>{try{localStorage.setItem(S,"test"),localStorage.removeItem(S),u=c.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(S),u=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)u=c.RUNTIME;else throw e}else throw r}};D();const j=r=>{var e,t;switch(u){case c.LOCAL_STORAGE:return(e=localStorage.getItem(r))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(t=sessionStorage.getItem(r))!==null&&t!==void 0?t:void 0;case c.RUNTIME:return m.get(r);default:b(u)}},U=(r,e)=>{switch(u){case c.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case c.RUNTIME:return void m.set(r,e);default:b(u)}},F=r=>{switch(u){case c.LOCAL_STORAGE:return r in localStorage;case c.SESSION_STORAGE:return r in sessionStorage;case c.RUNTIME:return m.has(r);default:return b(u),!1}},$=r=>{switch(u){case c.LOCAL_STORAGE:return localStorage.removeItem(r);case c.SESSION_STORAGE:return sessionStorage.removeItem(r);case c.RUNTIME:return void m.delete(r);default:b(u)}},P=()=>{switch(u){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return m.clear();default:b(u)}};var k=Object.freeze({__proto__:null,clear:P,get:j,has:F,remove:$,set:U});class z extends _{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){const t=super._subscribe(e);return e.next(this.value),t}}function K(r){return new l(e=>{const t={};let n=Object.keys(r).length;const a=i=>s=>{i in t||n--,t[i]=s,n===0&&e.next(t)};return Object.entries(r).reduce((i,[s,o])=>i.add(o.subscribe(a(s))),new v)})}function W(...r){return new l(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new v))}var Y=r=>new l(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},r);return()=>window.clearTimeout(t)}),B=r=>new l(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),X=r=>new l(e=>{r.forEach(t=>e.next(t))}),q=(r,e)=>new l(t=>{const n=a=>t.next(a);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function H(r){return e=>new l(t=>e.subscribe(new J(t,r)))}class J{constructor(e,t){this.destination=e,this.size=t,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}const Q={leading:!1,trailing:!0};function Z(r,e=Q){return t=>new l(n=>t.subscribe(new ee(n,r,e)))}class ee{constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,x(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}const te={leading:!0,trailing:!1};function re(r,e=te){return t=>new l(n=>t.subscribe(new ne(n,r,e)))}class ne{constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,O(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){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function se(r){return e=>new l(t=>e.subscribe(new ie(t,r)))}class ie{constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function oe(r=(e,t)=>e===t){return e=>new l(t=>e.subscribe(new ae(t,r)))}const g={};class ae{constructor(e,t){this.destination=e,this.predicate=t,this.lastValue=g}next(e){let t;try{t=this.lastValue===g||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function L(r){return e=>new l(t=>e.subscribe(new ce(t,r)))}let ce=class{constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(t)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}};function le(r){return L(()=>r)}function ue(){return r=>new l(e=>{let t=!1,n=!1;const a=r.subscribe(i=>{t||(t=!0,e.next(i)),n&&a.unsubscribe()},i=>{var s;t=!0,(s=e.error)===null||s===void 0||s.call(e,i),n&&a.unsubscribe()});return n=!0,t&&a.unsubscribe(),a})}function de(){return r=>new l(e=>r.subscribe(new he(e)))}class he{constructor(e){this.destination=e,this.hasLast=!1}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function fe(r){return e=>new l(t=>e.subscribe(new be(t,r)))}class be{constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}exports.ErrorCategory=void 0;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const we=5;exports.ACTIVE_LIVE_VALID_DELAY=we;exports.Logger=A;exports.Observable=l;exports.Subject=_;exports.Subscription=v;exports.VERSION=T;exports.ValueSubject=z;exports.abortable=C;exports.addScript=y;exports.assertNever=b;exports.assertNonNullable=N;exports.assertNullable=R;exports.buffer=H;exports.checkNever=I;exports.combine=K;exports.debounce=Z;exports.filter=se;exports.filterChanged=oe;exports.fromEvent=q;exports.getExponentialDelay=G;exports.interval=B;exports.isNonNullable=x;exports.isNullable=O;exports.map=L;exports.mapTo=le;exports.merge=W;exports.noop=w;exports.now=V;exports.observableFrom=X;exports.once=ue;exports.pairwise=de;exports.safeStorage=k;exports.tap=fe;exports.throttle=re;exports.timeout=Y;
6
+ "use strict";const R="1.0.26";class E{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const v=t=>{throw new Error(`${t} is value of unexpected type`)},Q=t=>{},g=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){var n;let o;i?typeof i=="function"?o={next:i,error:g}:o={next:a=>i.next(a),error:a=>{var d;return(d=i.error)===null||d===void 0?void 0:d.call(i,a)}}:o={next:g,error:g};const s=typeof e=="function"?{next:a=>{try{e(a)}catch(d){o.next(d)}},error:a=>o.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):o.next(a)};let r;try{r=this._subscribe(s)}catch(a){(n=s.error)===null||n===void 0||n.call(s,a)}return new E().add(()=>{switch(s.next=g,s.error=g,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return v(r)}})}pipe(...e){return e.reduce((i,n)=>n(i),this)}_subscribe(e){}}class x extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,e)})}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new E().add(()=>this.subscribers.delete(i))}}class V{constructor(){this.log$=new x,this.logs=[],this.log=e=>{const i=Object.assign(Object.assign({},e),{timestamp:Date.now()});this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...i)=>{let n;try{n=e(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(i=>Object.assign({component:e},i))}}function P(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function M(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function A(t){return typeof t!="undefined"&&t!==null}function T(t){return t==null}const D=(t,e,i)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),h.remove()});const s=()=>{a(),o()},r=()=>{a(),n()},a=()=>{d&&clearTimeout(d),h.removeEventListener("load",r),h.removeEventListener("error",s)};let d;i&&(d=window.setTimeout(s,i));const h=document.createElement("script");h.addEventListener("load",r),h.addEventListener("error",s),h.src=t,document.head.appendChild(h)});var _;const G=typeof((_=window.performance)===null||_===void 0?void 0:_.now)=="function"?()=>window.performance.now():()=>Date.now();function k(t,e,i,n){function o(s){return s instanceof i?s:new i(function(r){r(s)})}return new(i||(i=Promise))(function(s,r){function a(b){try{h(n.next(b))}catch(p){r(p)}}function d(b){try{h(n.throw(b))}catch(p){r(p)}}function h(b){b.done?s(b.value):o(b.value).then(a,d)}h((n=n.apply(t,e||[])).next())})}const U=(t,e)=>(...i)=>k(void 0,void 0,void 0,function*(){var n;const o=e(...i);let s=t.aborted,r;for(;!s&&!t.aborted;){const a=yield o.next(r);s=(n=a.done)!==null&&n!==void 0?n:!1,r=a.value}return r});exports.CurrentClientBrowser=void 0;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const j=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(t)?exports.CurrentClientBrowser.Chrome:void 0,n=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,r=/opr\//i.test(t)?exports.CurrentClientBrowser.Opera:void 0,a=/edg/i.test(t)?exports.CurrentClientBrowser.Edge:void 0,d=/android/i.test(t)?exports.CurrentClientDevice.Android:void 0,h=/iphone/i.test(t)?exports.CurrentClientDevice.iPhone:void 0,b=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,p=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,C=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||r||a||i||n||s||exports.CurrentClientBrowser.Rest,device:d||h||b||p||C||exports.CurrentClientDevice.Desktop}},F=(t,{start:e=0,factor:i=2,max:n=1/0,min:o=e,random:s=0}={})=>{let r=e;return r*=Math.pow(i,t),r*=1+(Math.random()*s*2-s),r=Math.round(r),r=Math.min(r,n),r=Math.max(r,o),r};var c;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(c||(c={}));let l,w;const S=`vk-videoplayer-dummy-key-${Math.random()}`,m=()=>{if(w!==void 0)return w;try{localStorage.setItem(S,"test"),localStorage.removeItem(S),w=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(S),w=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)w=c.RUNTIME;else throw e}else throw t}return w===c.RUNTIME&&(l=new Map),w},H=()=>m()===c.LOCAL_STORAGE,q=t=>{var e,i;const n=m();switch(n){case c.LOCAL_STORAGE:return(e=localStorage.getItem(t))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(t))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return l==null?void 0:l.get(t);default:v(n)}},B=(t,e)=>{const i=m();switch(i){case c.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.RUNTIME:return void(l==null?void 0:l.set(t,e));default:v(i)}},z=t=>{var e;const i=m();switch(i){case c.LOCAL_STORAGE:return t in localStorage;case c.SESSION_STORAGE:return t in sessionStorage;case c.RUNTIME:return(e=l==null?void 0:l.has(t))!==null&&e!==void 0?e:!1;default:return v(i),!1}},Y=t=>{const e=m();switch(e){case c.LOCAL_STORAGE:return localStorage.removeItem(t);case c.SESSION_STORAGE:return sessionStorage.removeItem(t);case c.RUNTIME:return void(l==null?void 0:l.delete(t));default:v(e)}},$=()=>{const t=m();switch(t){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return l==null?void 0:l.clear();default:v(t)}};var K=Object.freeze({__proto__:null,clear:$,get:q,has:z,isPersistent:H,remove:Y,set:B});exports.VideoQuality=void 0;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const f={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},W=(t,e)=>f[t].height>f[e].height,X=(t,e)=>f[t].height>=f[e].height,O=(t,e)=>f[t].height<f[e].height,J=(t,e)=>f[t].height<=f[e].height,Z=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:O(e,i)?1:-1)[0],L=Object.keys(f).sort((t,e)=>O(t,e)?-1:1),ee=(t,e=.02)=>[...L].find(n=>f[n].height*(1+e)>=t),te=({width:t,height:e})=>{const i=Math.min(t,e),n=Math.max(t,e);return L.find(o=>{const s=f[o];return s.width>=n&&s.height>=i})},ie=t=>f[t].height,y=t=>t===exports.VideoQuality.INVARIANT,ne=t=>t.every(e=>!y(e));function re(t){if(y(t))throw new Error("Expected exact quality")}class se extends x{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){const i=super._subscribe(e);return e.next(this.value),i}}function oe(t){return new u(e=>{const i={};let n=Object.keys(t).length;const o=s=>r=>{s in i||n--,i[s]=r,n===0&&e.next(i)};return Object.entries(t).reduce((s,[r,a])=>s.add(a.subscribe(o(r))),new E)})}function ae(...t){return new u(e=>t.reduce((i,n)=>i.add(n.subscribe(e)),new E))}var ce=t=>new u(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(i)}),ue=t=>new u(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),le=t=>new u(e=>{t.forEach(i=>e.next(i))}),de=(t,e)=>new u(i=>{const n=o=>i.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function he(t){return e=>new u(i=>e.subscribe(new fe(i,t)))}class fe{constructor(e,i){this.destination=e,this.size=i,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}const be={leading:!1,trailing:!0};function we(t,e=be){return i=>new u(n=>i.subscribe(new ve(n,t,e)))}class ve{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,A(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(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}const ge={leading:!0,trailing:!1};function me(t,e=ge){return i=>new u(n=>i.subscribe(new pe(n,t,e)))}class pe{constructor(e,i,n){this.destination=e,this.time=i,this.config=n}next(e){this.lastValue=e,T(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){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Ee(t){return e=>new u(i=>e.subscribe(new _e(i,t)))}class _e{constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(n){throw this.error(n),n}i&&this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Se(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new xe(i,t)))}const I={};class xe{constructor(e,i){this.destination=e,this.predicate=i,this.lastValue=I}next(e){let i;try{i=this.lastValue===I||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}i&&this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function N(t){return e=>new u(i=>e.subscribe(new Oe(i,t)))}let Oe=class{constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(i)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}};function ye(t){return N(()=>t)}function Ie(){return t=>new u(e=>{let i=!1,n=!1;const o=t.subscribe(s=>{i||(i=!0,e.next(s)),n&&o.unsubscribe()},s=>{var r;i=!0,(r=e.error)===null||r===void 0||r.call(e,s),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Ae(){return t=>new u(e=>t.subscribe(new Te(e)))}class Te{constructor(e){this.destination=e,this.hasLast=!1}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}function Le(t){return e=>new u(i=>e.subscribe(new Ne(i,t)))}class Ne{constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,e)}}exports.ErrorCategory=void 0;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const Ce=5;exports.ACTIVE_LIVE_VALID_DELAY=Ce;exports.Logger=V;exports.Observable=u;exports.Subject=x;exports.Subscription=E;exports.VERSION=R;exports.ValueSubject=se;exports.abortable=U;exports.addScript=D;exports.areQualitiesExact=ne;exports.assertNever=v;exports.assertNonNullable=P;exports.assertNullable=M;exports.assertQualityIsExact=re;exports.buffer=he;exports.checkNever=Q;exports.combine=oe;exports.debounce=we;exports.filter=Ee;exports.filterChanged=Se;exports.fromEvent=de;exports.getCurrentBrowser=j;exports.getExponentialDelay=F;exports.getHighestQuality=Z;exports.interval=ue;exports.isHigher=W;exports.isHigherOrEqual=X;exports.isInvariantQuality=y;exports.isLower=O;exports.isLowerOrEqual=J;exports.isNonNullable=A;exports.isNullable=T;exports.map=N;exports.mapTo=ye;exports.merge=ae;exports.noop=g;exports.now=G;exports.observableFrom=le;exports.once=Ie;exports.pairwise=Ae;exports.safeStorage=K;exports.tap=Le;exports.throttle=me;exports.timeout=ce;exports.videoHeightToQuality=ee;exports.videoQualityToHeight=ie;exports.videoSizeToQuality=te;
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24
3
- * Mon, 19 Jun 2023 11:52:56 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- const K="1.0.24";class m{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const b=r=>{throw new Error(`${r} is value of unexpected type`)},W=r=>{},w=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var n;let a;t?typeof t=="function"?a={next:t,error:w}:a={next:o=>t.next(o),error:o=>{var h;return(h=t.error)===null||h===void 0?void 0:h.call(t,o)}}:a={next:w,error:w};const i=typeof e=="function"?{next:o=>{try{e(o)}catch(h){a.next(h)}},error:o=>a.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):a.next(o)};let s;try{s=this._subscribe(i)}catch(o){(n=i.error)===null||n===void 0||n.call(i,o)}return new m().add(()=>{switch(i.next=w,i.error=w,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return b(s)}})}pipe(...e){return e.reduce((t,n)=>n(t),this)}_subscribe(e){}}class x extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>{var n;return(n=t.error)===null||n===void 0?void 0:n.call(t,e)})}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new m().add(()=>this.subscribers.delete(t))}}class B{constructor(){this.log$=new x,this.logs=[],this.log=e=>{const t=Object.assign(Object.assign({},e),{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch(a){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>Object.assign({component:e},t))}}function X(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function Y(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function O(r){return typeof r!="undefined"&&r!==null}function L(r){return r==null}const q=(r,e,t)=>new Promise((n,a)=>{e.addEventListener("abort",()=>{o(),d.remove()});const i=()=>{o(),a()},s=()=>{o(),n()},o=()=>{h&&clearTimeout(h),d.removeEventListener("load",s),d.removeEventListener("error",i)};let h;t&&(h=window.setTimeout(i,t));const d=document.createElement("script");d.addEventListener("load",s),d.addEventListener("error",i),d.src=r,document.head.appendChild(d)});var p;const H=typeof((p=window.performance)===null||p===void 0?void 0:p.now)=="function"?()=>window.performance.now():()=>Date.now();function T(r,e,t,n){function a(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function o(f){try{d(n.next(f))}catch(E){s(E)}}function h(f){try{d(n.throw(f))}catch(E){s(E)}}function d(f){f.done?i(f.value):a(f.value).then(o,h)}d((n=n.apply(r,e||[])).next())})}const J=(r,e)=>(...t)=>T(void 0,void 0,void 0,function*(){var n;const a=e(...t);let i=r.aborted,s;for(;!i&&!r.aborted;){const o=yield a.next(s);i=(n=o.done)!==null&&n!==void 0?n:!1,s=o.value}return s}),Q=(r,{start:e=0,factor:t=2,max:n=1/0,min:a=e,random:i=0}={})=>{let s=e;return s*=Math.pow(t,r),s*=1+(Math.random()*i*2-i),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,a),s};var c;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(c||(c={}));const v=new Map;let l=c.RUNTIME;const _=`vk-videoplayer-dummy-key-${Math.random()}`,I=()=>{try{localStorage.setItem(_,"test"),localStorage.removeItem(_),l=c.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(_),l=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)l=c.RUNTIME;else throw e}else throw r}};I();const A=r=>{var e,t;switch(l){case c.LOCAL_STORAGE:return(e=localStorage.getItem(r))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(t=sessionStorage.getItem(r))!==null&&t!==void 0?t:void 0;case c.RUNTIME:return v.get(r);default:b(l)}},R=(r,e)=>{switch(l){case c.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case c.RUNTIME:return void v.set(r,e);default:b(l)}},N=r=>{switch(l){case c.LOCAL_STORAGE:return r in localStorage;case c.SESSION_STORAGE:return r in sessionStorage;case c.RUNTIME:return v.has(r);default:return b(l),!1}},y=r=>{switch(l){case c.LOCAL_STORAGE:return localStorage.removeItem(r);case c.SESSION_STORAGE:return sessionStorage.removeItem(r);case c.RUNTIME:return void v.delete(r);default:b(l)}},M=()=>{switch(l){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return v.clear();default:b(l)}};var Z=Object.freeze({__proto__:null,clear:M,get:A,has:N,remove:y,set:R});class ee extends x{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){const t=super._subscribe(e);return e.next(this.value),t}}function te(r){return new u(e=>{const t={};let n=Object.keys(r).length;const a=i=>s=>{i in t||n--,t[i]=s,n===0&&e.next(t)};return Object.entries(r).reduce((i,[s,o])=>i.add(o.subscribe(a(s))),new m)})}function re(...r){return new u(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new m))}var ne=r=>new u(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},r);return()=>window.clearTimeout(t)}),se=r=>new u(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),ie=r=>new u(e=>{r.forEach(t=>e.next(t))}),oe=(r,e)=>new u(t=>{const n=a=>t.next(a);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function ae(r){return e=>new u(t=>e.subscribe(new V(t,r)))}class V{constructor(e,t){this.destination=e,this.size=t,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}const C={leading:!1,trailing:!0};function ce(r,e=C){return t=>new u(n=>t.subscribe(new G(n,r,e)))}class G{constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,O(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}const D={leading:!0,trailing:!1};function ue(r,e=D){return t=>new u(n=>t.subscribe(new U(n,r,e)))}class U{constructor(e,t,n){this.destination=e,this.time=t,this.config=n}next(e){this.lastValue=e,L(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){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function le(r){return e=>new u(t=>e.subscribe(new j(t,r)))}class j{constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function he(r=(e,t)=>e===t){return e=>new u(t=>e.subscribe(new F(t,r)))}const S={};class F{constructor(e,t){this.destination=e,this.predicate=t,this.lastValue=S}next(e){let t;try{t=this.lastValue===S||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function $(r){return e=>new u(t=>e.subscribe(new P(t,r)))}let P=class{constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(t)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}};function fe(r){return $(()=>r)}function be(){return r=>new u(e=>{let t=!1,n=!1;const a=r.subscribe(i=>{t||(t=!0,e.next(i)),n&&a.unsubscribe()},i=>{var s;t=!0,(s=e.error)===null||s===void 0||s.call(e,i),n&&a.unsubscribe()});return n=!0,t&&a.unsubscribe(),a})}function we(){return r=>new u(e=>r.subscribe(new z(e)))}class z{constructor(e){this.destination=e,this.hasLast=!1}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}function ve(r){return e=>new u(t=>e.subscribe(new k(t,r)))}class k{constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,e)}}var g;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(g||(g={}));const me=5;export{me as ACTIVE_LIVE_VALID_DELAY,g as ErrorCategory,B as Logger,u as Observable,x as Subject,m as Subscription,K as VERSION,ee as ValueSubject,J as abortable,q as addScript,b as assertNever,X as assertNonNullable,Y as assertNullable,ae as buffer,W as checkNever,te as combine,ce as debounce,le as filter,he as filterChanged,oe as fromEvent,Q as getExponentialDelay,se as interval,O as isNonNullable,L as isNullable,$ as map,fe as mapTo,re as merge,w as noop,H as now,ie as observableFrom,be as once,we as pairwise,Z as safeStorage,ve as tap,ue as throttle,ne as timeout};
6
+ const B="1.0.26";class S{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const p=e=>{throw new Error(`${e} is value of unexpected type`)},tt=e=>{},x=()=>{};class l{constructor(t){t&&(this._subscribe=t)}subscribe(t,i){var n;let o;i?typeof i=="function"?o={next:i,error:x}:o={next:a=>i.next(a),error:a=>{var h;return(h=i.error)===null||h===void 0?void 0:h.call(i,a)}}:o={next:x,error:x};const r=typeof t=="function"?{next:a=>{try{t(a)}catch(h){o.next(h)}},error:a=>o.next(a)}:{next:a=>t.next(a),error:a=>t.error?t.error(a):o.next(a)};let s;try{s=this._subscribe(r)}catch(a){(n=r.error)===null||n===void 0||n.call(r,a)}return new S().add(()=>{switch(r.next=x,r.error=x,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return p(s)}})}pipe(...t){return t.reduce((i,n)=>n(i),this)}_subscribe(t){}}class L extends l{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach(i=>i.next(t))}error(t){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,t)})}_subscribe(t){const i=this.keyCounter++;return this.subscribers.set(i,t),new S().add(()=>this.subscribers.delete(i))}}class et{constructor(){this.log$=new L,this.logs=[],this.log=t=>{const i=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...i)=>{let n;try{n=t(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(i=>Object.assign({component:t},i))}}function it(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function nt(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function y(e){return typeof e!="undefined"&&e!==null}function Q(e){return e==null}const st=(e,t,i)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{a(),f.remove()});const r=()=>{a(),o()},s=()=>{a(),n()},a=()=>{h&&clearTimeout(h),f.removeEventListener("load",s),f.removeEventListener("error",r)};let h;i&&(h=window.setTimeout(r,i));const f=document.createElement("script");f.addEventListener("load",s),f.addEventListener("error",r),f.src=e,document.head.appendChild(f)});var O;const rt=typeof((O=window.performance)===null||O===void 0?void 0:O.now)=="function"?()=>window.performance.now():()=>Date.now();function V(e,t,i,n){function o(r){return r instanceof i?r:new i(function(s){s(r)})}return new(i||(i=Promise))(function(r,s){function a(v){try{f(n.next(v))}catch(_){s(_)}}function h(v){try{f(n.throw(v))}catch(_){s(_)}}function f(v){v.done?r(v.value):o(v.value).then(a,h)}f((n=n.apply(e,t||[])).next())})}const ot=(e,t)=>(...i)=>V(void 0,void 0,void 0,function*(){var n;const o=t(...i);let r=e.aborted,s;for(;!r&&!e.aborted;){const a=yield o.next(s);r=(n=a.done)!==null&&n!==void 0?n:!1,s=a.value}return s});var w;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(w||(w={}));var g;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(g||(g={}));const at=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?w.Yandex:void 0,i=/chrome|crios/i.test(e)?w.Chrome:void 0,n=/chromium/i.test(e)?w.Chromium:void 0,o=/firefox|fxios/i.test(e)?w.Firefox:void 0,r=/webkit|safari|khtml/i.test(e)?w.Safari:void 0,s=/opr\//i.test(e)?w.Opera:void 0,a=/edg/i.test(e)?w.Edge:void 0,h=/android/i.test(e)?g.Android:void 0,f=/iphone/i.test(e)?g.iPhone:void 0,v=/ipad/i.test(e)?g.iPad:void 0,_=/ipod/i.test(e)?g.iPod:void 0,M=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?g.RestMobile:void 0;return{browser:t||o||s||a||i||n||r||w.Rest,device:h||f||v||_||M||g.Desktop}},ct=(e,{start:t=0,factor:i=2,max:n=1/0,min:o=t,random:r=0}={})=>{let s=t;return s*=Math.pow(i,e),s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var c;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(c||(c={}));let u,m;const A=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(m!==void 0)return m;try{localStorage.setItem(A,"test"),localStorage.removeItem(A),m=c.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(A),m=c.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)m=c.RUNTIME;else throw t}else throw e}return m===c.RUNTIME&&(u=new Map),m},G=()=>E()===c.LOCAL_STORAGE,U=e=>{var t,i;const n=E();switch(n){case c.LOCAL_STORAGE:return(t=localStorage.getItem(e))!==null&&t!==void 0?t:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(e))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return u==null?void 0:u.get(e);default:p(n)}},k=(e,t)=>{const i=E();switch(i){case c.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.RUNTIME:return void(u==null?void 0:u.set(e,t));default:p(i)}},j=e=>{var t;const i=E();switch(i){case c.LOCAL_STORAGE:return e in localStorage;case c.SESSION_STORAGE:return e in sessionStorage;case c.RUNTIME:return(t=u==null?void 0:u.has(e))!==null&&t!==void 0?t:!1;default:return p(i),!1}},D=e=>{const t=E();switch(t){case c.LOCAL_STORAGE:return localStorage.removeItem(e);case c.SESSION_STORAGE:return sessionStorage.removeItem(e);case c.RUNTIME:return void(u==null?void 0:u.delete(e));default:p(t)}},F=()=>{const e=E();switch(e){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return u==null?void 0:u.clear();default:p(e)}};var ut=Object.freeze({__proto__:null,clear:F,get:U,has:j,isPersistent:G,remove:D,set:k}),d;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(d||(d={}));const b={[d.Q_144P]:{width:256,height:144},[d.Q_240P]:{width:428,height:240},[d.Q_360P]:{width:640,height:360},[d.Q_480P]:{width:856,height:480},[d.Q_720P]:{width:1280,height:720},[d.Q_1080P]:{width:1920,height:1080},[d.Q_1440P]:{width:2560,height:1440},[d.Q_2160P]:{width:3840,height:2160},[d.Q_4320P]:{width:7680,height:4320}},lt=(e,t)=>b[e].height>b[t].height,dt=(e,t)=>b[e].height>=b[t].height,R=(e,t)=>b[e].height<b[t].height,ht=(e,t)=>b[e].height<=b[t].height,ft=e=>e.sort((t,i)=>t===i?0:t===d.INVARIANT?1:i===d.INVARIANT?-1:R(t,i)?1:-1)[0],N=Object.keys(b).sort((e,t)=>R(e,t)?-1:1),bt=(e,t=.02)=>[...N].find(n=>b[n].height*(1+t)>=e),wt=({width:e,height:t})=>{const i=Math.min(e,t),n=Math.max(e,t);return N.find(o=>{const r=b[o];return r.width>=n&&r.height>=i})},vt=e=>b[e].height,P=e=>e===d.INVARIANT,gt=e=>e.every(t=>!P(t));function mt(e){if(P(e))throw new Error("Expected exact quality")}class pt extends L{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const i=super._subscribe(t);return t.next(this.value),i}}function Et(e){return new l(t=>{const i={};let n=Object.keys(e).length;const o=r=>s=>{r in i||n--,i[r]=s,n===0&&t.next(i)};return Object.entries(e).reduce((r,[s,a])=>r.add(a.subscribe(o(s))),new S)})}function _t(...e){return new l(t=>e.reduce((i,n)=>i.add(n.subscribe(t)),new S))}var xt=e=>new l(t=>{const i=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(i)}),St=e=>new l(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),Ot=e=>new l(t=>{e.forEach(i=>t.next(i))}),At=(e,t)=>new l(i=>{const n=o=>i.next(o);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function It(e){return t=>new l(i=>t.subscribe(new q(i,e)))}class q{constructor(t,i){this.destination=t,this.size=i,this.lastValues=[]}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const z={leading:!1,trailing:!0};function Tt(e,t=z){return i=>new l(n=>i.subscribe(new $(n,e,t)))}class ${constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const H={leading:!0,trailing:!1};function Lt(e,t=H){return i=>new l(n=>i.subscribe(new Y(n,e,t)))}class Y{constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,Q(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Rt(e){return t=>new l(i=>t.subscribe(new C(i,e)))}class C{constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.predicate(t)}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Nt(e=(t,i)=>t===i){return t=>new l(i=>t.subscribe(new K(i,e)))}const I={};class K{constructor(t,i){this.destination=t,this.predicate=i,this.lastValue=I}next(t){let i;try{i=this.lastValue===I||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function W(e){return t=>new l(i=>t.subscribe(new X(i,e)))}let X=class{constructor(t,i){this.destination=t,this.mapper=i}next(t){let i;try{i=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(i)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}};function Mt(e){return W(()=>e)}function yt(){return e=>new l(t=>{let i=!1,n=!1;const o=e.subscribe(r=>{i||(i=!0,t.next(r)),n&&o.unsubscribe()},r=>{var s;i=!0,(s=t.error)===null||s===void 0||s.call(t,r),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function Qt(){return e=>new l(t=>e.subscribe(new J(t)))}class J{constructor(t){this.destination=t,this.hasLast=!1}next(t){const i=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,t])}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Vt(e){return t=>new l(i=>t.subscribe(new Z(i,e)))}class Z{constructor(t,i){this.destination=t,this.effect=i}next(t){try{this.effect(t)}catch(i){throw this.error(i),i}this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}var T;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(T||(T={}));const Gt=5;export{Gt as ACTIVE_LIVE_VALID_DELAY,w as CurrentClientBrowser,g as CurrentClientDevice,T as ErrorCategory,et as Logger,l as Observable,L as Subject,S as Subscription,B as VERSION,pt as ValueSubject,d as VideoQuality,ot as abortable,st as addScript,gt as areQualitiesExact,p as assertNever,it as assertNonNullable,nt as assertNullable,mt as assertQualityIsExact,It as buffer,tt as checkNever,Et as combine,Tt as debounce,Rt as filter,Nt as filterChanged,At as fromEvent,at as getCurrentBrowser,ct as getExponentialDelay,ft as getHighestQuality,St as interval,lt as isHigher,dt as isHigherOrEqual,P as isInvariantQuality,R as isLower,ht as isLowerOrEqual,y as isNonNullable,Q as isNullable,W as map,Mt as mapTo,_t as merge,x as noop,rt as now,Ot as observableFrom,yt as once,Qt as pairwise,ut as safeStorage,Vt as tap,Lt as throttle,xt as timeout,bt as videoHeightToQuality,vt as videoQualityToHeight,wt as videoSizeToQuality};
package/es2018.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24
3
- * Mon, 19 Jun 2023 11:52:56 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- "use strict";const L="1.0.24";class w{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const f=r=>{throw new Error(`${r} is value of unexpected type`)},O=r=>{},b=()=>{};class l{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var s;let a;t?typeof t=="function"?a={next:t,error:b}:a={next:o=>t.next(o),error:o=>{var h;return(h=t.error)===null||h===void 0?void 0:h.call(t,o)}}:a={next:b,error:b};const i=typeof e=="function"?{next:o=>{try{e(o)}catch(h){a.next(h)}},error:o=>a.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):a.next(o)};let n;try{n=this._subscribe(i)}catch(o){(s=i.error)===null||s===void 0||s.call(i,o)}return new w().add(()=>{switch(i.next=b,i.error=b,typeof n){case"function":n();return;case"object":n.unsubscribe();return;case"undefined":return;default:return f(n)}})}pipe(...e){return e.reduce((t,s)=>s(t),this)}_subscribe(e){}}class p extends l{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>{var s;return(s=t.error)===null||s===void 0?void 0:s.call(t,e)})}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new w().add(()=>this.subscribers.delete(t))}}class T{constructor(){this.log$=new p,this.logs=[],this.log=e=>{const t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let s;try{s=e(...t)}catch(a){s={message:"error in `createCustomLog`",component:"Logger"}}this.log(s)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}}function I(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function A(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function _(r){return typeof r!="undefined"&&r!==null}function g(r){return r==null}const N=(r,e,t)=>new Promise((s,a)=>{e.addEventListener("abort",()=>{o(),d.remove()});const i=()=>{o(),a()},n=()=>{o(),s()},o=()=>{h&&clearTimeout(h),d.removeEventListener("load",n),d.removeEventListener("error",i)};let h;t&&(h=window.setTimeout(i,t));const d=document.createElement("script");d.addEventListener("load",n),d.addEventListener("error",i),d.src=r,document.head.appendChild(d)});var m;const R=typeof((m=window.performance)===null||m===void 0?void 0:m.now)=="function"?()=>window.performance.now():()=>Date.now(),y=(r,e)=>async(...t)=>{var s;const a=e(...t);let i=r.aborted,n;for(;!i&&!r.aborted;){const o=await a.next(n);i=(s=o.done)!==null&&s!==void 0?s:!1,n=o.value}return n},V=(r,{start:e=0,factor:t=2,max:s=1/0,min:a=e,random:i=0}={})=>{let n=e;return n*=t**r,n*=1+(Math.random()*i*2-i),n=Math.round(n),n=Math.min(n,s),n=Math.max(n,a),n};var c;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(c||(c={}));const v=new Map;let u=c.RUNTIME;const E=`vk-videoplayer-dummy-key-${Math.random()}`,M=()=>{try{localStorage.setItem(E,"test"),localStorage.removeItem(E),u=c.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(E),u=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)u=c.RUNTIME;else throw e}else throw r}};M();const C=r=>{var e,t;switch(u){case c.LOCAL_STORAGE:return(e=localStorage.getItem(r))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(t=sessionStorage.getItem(r))!==null&&t!==void 0?t:void 0;case c.RUNTIME:return v.get(r);default:f(u)}},G=(r,e)=>{switch(u){case c.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case c.RUNTIME:return void v.set(r,e);default:f(u)}},D=r=>{switch(u){case c.LOCAL_STORAGE:return r in localStorage;case c.SESSION_STORAGE:return r in sessionStorage;case c.RUNTIME:return v.has(r);default:return f(u),!1}},U=r=>{switch(u){case c.LOCAL_STORAGE:return localStorage.removeItem(r);case c.SESSION_STORAGE:return sessionStorage.removeItem(r);case c.RUNTIME:return void v.delete(r);default:f(u)}},j=()=>{switch(u){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return v.clear();default:f(u)}};var F=Object.freeze({__proto__:null,clear:j,get:C,has:D,remove:U,set:G});class P extends p{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){const t=super._subscribe(e);return e.next(this.value),t}}function $(r){return new l(e=>{const t={};let s=Object.keys(r).length;const a=i=>n=>{i in t||s--,t[i]=n,s===0&&e.next(t)};return Object.entries(r).reduce((i,[n,o])=>i.add(o.subscribe(a(n))),new w)})}function k(...r){return new l(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new w))}var z=r=>new l(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(s){if(e.error)e.error(s);else throw s}},r);return()=>window.clearTimeout(t)}),K=r=>new l(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),W=r=>new l(e=>{r.forEach(t=>e.next(t))}),Y=(r,e)=>new l(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function B(r){return e=>new l(t=>e.subscribe(new X(t,r)))}class X{constructor(e,t){this.destination=e,this.size=t,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}const q={leading:!1,trailing:!0};function H(r,e=q){return t=>new l(s=>t.subscribe(new J(s,r,e)))}class J{constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,_(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}const Q={leading:!0,trailing:!1};function Z(r,e=Q){return t=>new l(s=>t.subscribe(new ee(s,r,e)))}class ee{constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,g(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){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}function te(r){return e=>new l(t=>e.subscribe(new re(t,r)))}class re{constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}function se(r=(e,t)=>e===t){return e=>new l(t=>e.subscribe(new ne(t,r)))}const S={};class ne{constructor(e,t){this.destination=e,this.predicate=t,this.lastValue=S}next(e){let t;try{t=this.lastValue===S||!this.predicate(this.lastValue,e),this.lastValue=e}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}function x(r){return e=>new l(t=>e.subscribe(new ie(t,r)))}let ie=class{constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(s){throw this.error(s),s}this.destination.next(t)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}};function oe(r){return x(()=>r)}function ae(){return r=>new l(e=>{let t=!1,s=!1;const a=r.subscribe(i=>{t||(t=!0,e.next(i)),s&&a.unsubscribe()},i=>{var n;t=!0,(n=e.error)===null||n===void 0||n.call(e,i),s&&a.unsubscribe()});return s=!0,t&&a.unsubscribe(),a})}function ce(){return r=>new l(e=>r.subscribe(new le(e)))}class le{constructor(e){this.destination=e,this.hasLast=!1}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}function ue(r){return e=>new l(t=>e.subscribe(new he(t,r)))}class he{constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}exports.ErrorCategory=void 0;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const de=5;exports.ACTIVE_LIVE_VALID_DELAY=de;exports.Logger=T;exports.Observable=l;exports.Subject=p;exports.Subscription=w;exports.VERSION=L;exports.ValueSubject=P;exports.abortable=y;exports.addScript=N;exports.assertNever=f;exports.assertNonNullable=I;exports.assertNullable=A;exports.buffer=B;exports.checkNever=O;exports.combine=$;exports.debounce=H;exports.filter=te;exports.filterChanged=se;exports.fromEvent=Y;exports.getExponentialDelay=V;exports.interval=K;exports.isNonNullable=_;exports.isNullable=g;exports.map=x;exports.mapTo=oe;exports.merge=k;exports.noop=b;exports.now=R;exports.observableFrom=W;exports.once=ae;exports.pairwise=ce;exports.safeStorage=F;exports.tap=ue;exports.throttle=Z;exports.timeout=z;
6
+ "use strict";const R="1.0.26";class m{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const v=t=>{throw new Error(`${t} is value of unexpected type`)},Q=t=>{},w=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){var r;let o;i?typeof i=="function"?o={next:i,error:w}:o={next:a=>i.next(a),error:a=>{var h;return(h=i.error)===null||h===void 0?void 0:h.call(i,a)}}:o={next:w,error:w};const s=typeof e=="function"?{next:a=>{try{e(a)}catch(h){o.next(h)}},error:a=>o.next(a)}:{next:a=>e.next(a),error:a=>e.error?e.error(a):o.next(a)};let n;try{n=this._subscribe(s)}catch(a){(r=s.error)===null||r===void 0||r.call(s,a)}return new m().add(()=>{switch(s.next=w,s.error=w,typeof n){case"function":n();return;case"object":n.unsubscribe();return;case"undefined":return;default:return v(n)}})}pipe(...e){return e.reduce((i,r)=>r(i),this)}_subscribe(e){}}class _ extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>{var r;return(r=i.error)===null||r===void 0?void 0:r.call(i,e)})}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new m().add(()=>this.subscribers.delete(i))}}class P{constructor(){this.log$=new _,this.logs=[],this.log=e=>{const i={...e,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...i)=>{let r;try{r=e(...i)}catch(o){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(e){return this.createCustomLog(i=>({component:e,...i}))}}function V(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function M(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function I(t){return typeof t!="undefined"&&t!==null}function A(t){return t==null}const D=(t,e,i)=>new Promise((r,o)=>{e.addEventListener("abort",()=>{a(),f.remove()});const s=()=>{a(),o()},n=()=>{a(),r()},a=()=>{h&&clearTimeout(h),f.removeEventListener("load",n),f.removeEventListener("error",s)};let h;i&&(h=window.setTimeout(s,i));const f=document.createElement("script");f.addEventListener("load",n),f.addEventListener("error",s),f.src=t,document.head.appendChild(f)});var E;const G=typeof((E=window.performance)===null||E===void 0?void 0:E.now)=="function"?()=>window.performance.now():()=>Date.now(),k=(t,e)=>async(...i)=>{var r;const o=e(...i);let s=t.aborted,n;for(;!s&&!t.aborted;){const a=await o.next(n);s=(r=a.done)!==null&&r!==void 0?r:!1,n=a.value}return n};exports.CurrentClientBrowser=void 0;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const U=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(t)?exports.CurrentClientBrowser.Chrome:void 0,r=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,n=/opr\//i.test(t)?exports.CurrentClientBrowser.Opera:void 0,a=/edg/i.test(t)?exports.CurrentClientBrowser.Edge:void 0,h=/android/i.test(t)?exports.CurrentClientDevice.Android:void 0,f=/iphone/i.test(t)?exports.CurrentClientDevice.iPhone:void 0,y=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,N=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,C=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||n||a||i||r||s||exports.CurrentClientBrowser.Rest,device:h||f||y||N||C||exports.CurrentClientDevice.Desktop}},F=(t,{start:e=0,factor:i=2,max:r=1/0,min:o=e,random:s=0}={})=>{let n=e;return n*=i**t,n*=1+(Math.random()*s*2-s),n=Math.round(n),n=Math.min(n,r),n=Math.max(n,o),n};var c;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(c||(c={}));let l,b;const p=`vk-videoplayer-dummy-key-${Math.random()}`,g=()=>{if(b!==void 0)return b;try{localStorage.setItem(p,"test"),localStorage.removeItem(p),b=c.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(p),b=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)b=c.RUNTIME;else throw e}else throw t}return b===c.RUNTIME&&(l=new Map),b},H=()=>g()===c.LOCAL_STORAGE,j=t=>{var e,i;const r=g();switch(r){case c.LOCAL_STORAGE:return(e=localStorage.getItem(t))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(t))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return l==null?void 0:l.get(t);default:v(r)}},q=(t,e)=>{const i=g();switch(i){case c.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case c.RUNTIME:return void(l==null?void 0:l.set(t,e));default:v(i)}},B=t=>{var e;const i=g();switch(i){case c.LOCAL_STORAGE:return t in localStorage;case c.SESSION_STORAGE:return t in sessionStorage;case c.RUNTIME:return(e=l==null?void 0:l.has(t))!==null&&e!==void 0?e:!1;default:return v(i),!1}},z=t=>{const e=g();switch(e){case c.LOCAL_STORAGE:return localStorage.removeItem(t);case c.SESSION_STORAGE:return sessionStorage.removeItem(t);case c.RUNTIME:return void(l==null?void 0:l.delete(t));default:v(e)}},Y=()=>{const t=g();switch(t){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return l==null?void 0:l.clear();default:v(t)}};var $=Object.freeze({__proto__:null,clear:Y,get:j,has:B,isPersistent:H,remove:z,set:q});exports.VideoQuality=void 0;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const d={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},K=(t,e)=>d[t].height>d[e].height,W=(t,e)=>d[t].height>=d[e].height,S=(t,e)=>d[t].height<d[e].height,X=(t,e)=>d[t].height<=d[e].height,J=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:S(e,i)?1:-1)[0],T=Object.keys(d).sort((t,e)=>S(t,e)?-1:1),Z=(t,e=.02)=>[...T].find(r=>d[r].height*(1+e)>=t),ee=({width:t,height:e})=>{const i=Math.min(t,e),r=Math.max(t,e);return T.find(o=>{const s=d[o];return s.width>=r&&s.height>=i})},te=t=>d[t].height,x=t=>t===exports.VideoQuality.INVARIANT,ie=t=>t.every(e=>!x(e));function re(t){if(x(t))throw new Error("Expected exact quality")}class ne extends _{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){const i=super._subscribe(e);return e.next(this.value),i}}function se(t){return new u(e=>{const i={};let r=Object.keys(t).length;const o=s=>n=>{s in i||r--,i[s]=n,r===0&&e.next(i)};return Object.entries(t).reduce((s,[n,a])=>s.add(a.subscribe(o(n))),new m)})}function oe(...t){return new u(e=>t.reduce((i,r)=>i.add(r.subscribe(e)),new m))}var ae=t=>new u(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(r){if(e.error)e.error(r);else throw r}},t);return()=>window.clearTimeout(i)}),ce=t=>new u(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),ue=t=>new u(e=>{t.forEach(i=>e.next(i))}),le=(t,e)=>new u(i=>{const r=o=>i.next(o);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)});function de(t){return e=>new u(i=>e.subscribe(new he(i,t)))}class he{constructor(e,i){this.destination=e,this.size=i,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}const fe={leading:!1,trailing:!0};function be(t,e=fe){return i=>new u(r=>i.subscribe(new ve(r,t,e)))}class ve{constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,I(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(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}const we={leading:!0,trailing:!1};function ge(t,e=we){return i=>new u(r=>i.subscribe(new me(r,t,e)))}class me{constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,A(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){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function Ee(t){return e=>new u(i=>e.subscribe(new pe(i,t)))}class pe{constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function _e(t=(e,i)=>e===i){return e=>new u(i=>e.subscribe(new Se(i,t)))}const O={};class Se{constructor(e,i){this.destination=e,this.predicate=i,this.lastValue=O}next(e){let i;try{i=this.lastValue===O||!this.predicate(this.lastValue,e),this.lastValue=e}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function L(t){return e=>new u(i=>e.subscribe(new xe(i,t)))}let xe=class{constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(r){throw this.error(r),r}this.destination.next(i)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}};function Oe(t){return L(()=>t)}function Ie(){return t=>new u(e=>{let i=!1,r=!1;const o=t.subscribe(s=>{i||(i=!0,e.next(s)),r&&o.unsubscribe()},s=>{var n;i=!0,(n=e.error)===null||n===void 0||n.call(e,s),r&&o.unsubscribe()});return r=!0,i&&o.unsubscribe(),o})}function Ae(){return t=>new u(e=>t.subscribe(new Te(e)))}class Te{constructor(e){this.destination=e,this.hasLast=!1}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}function Le(t){return e=>new u(i=>e.subscribe(new ye(i,t)))}class ye{constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){var i,r;(r=(i=this.destination).error)===null||r===void 0||r.call(i,e)}}exports.ErrorCategory=void 0;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const Ne=5;exports.ACTIVE_LIVE_VALID_DELAY=Ne;exports.Logger=P;exports.Observable=u;exports.Subject=_;exports.Subscription=m;exports.VERSION=R;exports.ValueSubject=ne;exports.abortable=k;exports.addScript=D;exports.areQualitiesExact=ie;exports.assertNever=v;exports.assertNonNullable=V;exports.assertNullable=M;exports.assertQualityIsExact=re;exports.buffer=de;exports.checkNever=Q;exports.combine=se;exports.debounce=be;exports.filter=Ee;exports.filterChanged=_e;exports.fromEvent=le;exports.getCurrentBrowser=U;exports.getExponentialDelay=F;exports.getHighestQuality=J;exports.interval=ce;exports.isHigher=K;exports.isHigherOrEqual=W;exports.isInvariantQuality=x;exports.isLower=S;exports.isLowerOrEqual=X;exports.isNonNullable=I;exports.isNullable=A;exports.map=L;exports.mapTo=Oe;exports.merge=oe;exports.noop=w;exports.now=G;exports.observableFrom=ue;exports.once=Ie;exports.pairwise=Ae;exports.safeStorage=$;exports.tap=Le;exports.throttle=ge;exports.timeout=ae;exports.videoHeightToQuality=Z;exports.videoQualityToHeight=te;exports.videoSizeToQuality=ee;
package/es2018.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24
3
- * Mon, 19 Jun 2023 11:52:56 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- const $="1.0.24";class v{constructor(){this.subscriptions=[]}unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const f=r=>{throw new Error(`${r} is value of unexpected type`)},z=r=>{},b=()=>{};class u{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var s;let a;t?typeof t=="function"?a={next:t,error:b}:a={next:o=>t.next(o),error:o=>{var h;return(h=t.error)===null||h===void 0?void 0:h.call(t,o)}}:a={next:b,error:b};const i=typeof e=="function"?{next:o=>{try{e(o)}catch(h){a.next(h)}},error:o=>a.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):a.next(o)};let n;try{n=this._subscribe(i)}catch(o){(s=i.error)===null||s===void 0||s.call(i,o)}return new v().add(()=>{switch(i.next=b,i.error=b,typeof n){case"function":n();return;case"object":n.unsubscribe();return;case"undefined":return;default:return f(n)}})}pipe(...e){return e.reduce((t,s)=>s(t),this)}_subscribe(e){}}class _ extends u{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>{var s;return(s=t.error)===null||s===void 0?void 0:s.call(t,e)})}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new v().add(()=>this.subscribers.delete(t))}}class k{constructor(){this.log$=new _,this.logs=[],this.log=e=>{const t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let s;try{s=e(...t)}catch(a){s={message:"error in `createCustomLog`",component:"Logger"}}this.log(s)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}}function K(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function W(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function g(r){return typeof r!="undefined"&&r!==null}function x(r){return r==null}const B=(r,e,t)=>new Promise((s,a)=>{e.addEventListener("abort",()=>{o(),d.remove()});const i=()=>{o(),a()},n=()=>{o(),s()},o=()=>{h&&clearTimeout(h),d.removeEventListener("load",n),d.removeEventListener("error",i)};let h;t&&(h=window.setTimeout(i,t));const d=document.createElement("script");d.addEventListener("load",n),d.addEventListener("error",i),d.src=r,document.head.appendChild(d)});var m;const X=typeof((m=window.performance)===null||m===void 0?void 0:m.now)=="function"?()=>window.performance.now():()=>Date.now(),Y=(r,e)=>async(...t)=>{var s;const a=e(...t);let i=r.aborted,n;for(;!i&&!r.aborted;){const o=await a.next(n);i=(s=o.done)!==null&&s!==void 0?s:!1,n=o.value}return n},q=(r,{start:e=0,factor:t=2,max:s=1/0,min:a=e,random:i=0}={})=>{let n=e;return n*=t**r,n*=1+(Math.random()*i*2-i),n=Math.round(n),n=Math.min(n,s),n=Math.max(n,a),n};var c;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(c||(c={}));const w=new Map;let l=c.RUNTIME;const E=`vk-videoplayer-dummy-key-${Math.random()}`,O=()=>{try{localStorage.setItem(E,"test"),localStorage.removeItem(E),l=c.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(E),l=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)l=c.RUNTIME;else throw e}else throw r}};O();const L=r=>{var e,t;switch(l){case c.LOCAL_STORAGE:return(e=localStorage.getItem(r))!==null&&e!==void 0?e:void 0;case c.SESSION_STORAGE:return(t=sessionStorage.getItem(r))!==null&&t!==void 0?t:void 0;case c.RUNTIME:return w.get(r);default:f(l)}},T=(r,e)=>{switch(l){case c.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case c.RUNTIME:return void w.set(r,e);default:f(l)}},I=r=>{switch(l){case c.LOCAL_STORAGE:return r in localStorage;case c.SESSION_STORAGE:return r in sessionStorage;case c.RUNTIME:return w.has(r);default:return f(l),!1}},A=r=>{switch(l){case c.LOCAL_STORAGE:return localStorage.removeItem(r);case c.SESSION_STORAGE:return sessionStorage.removeItem(r);case c.RUNTIME:return void w.delete(r);default:f(l)}},R=()=>{switch(l){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return w.clear();default:f(l)}};var H=Object.freeze({__proto__:null,clear:R,get:L,has:I,remove:A,set:T});class J extends _{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){const t=super._subscribe(e);return e.next(this.value),t}}function Q(r){return new u(e=>{const t={};let s=Object.keys(r).length;const a=i=>n=>{i in t||s--,t[i]=n,s===0&&e.next(t)};return Object.entries(r).reduce((i,[n,o])=>i.add(o.subscribe(a(n))),new v)})}function Z(...r){return new u(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new v))}var ee=r=>new u(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(s){if(e.error)e.error(s);else throw s}},r);return()=>window.clearTimeout(t)}),te=r=>new u(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),re=r=>new u(e=>{r.forEach(t=>e.next(t))}),se=(r,e)=>new u(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function ne(r){return e=>new u(t=>e.subscribe(new N(t,r)))}class N{constructor(e,t){this.destination=e,this.size=t,this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}const y={leading:!1,trailing:!0};function ie(r,e=y){return t=>new u(s=>t.subscribe(new M(s,r,e)))}class M{constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,g(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}const V={leading:!0,trailing:!1};function oe(r,e=V){return t=>new u(s=>t.subscribe(new C(s,r,e)))}class C{constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,x(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){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}function ae(r){return e=>new u(t=>e.subscribe(new G(t,r)))}class G{constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}function ce(r=(e,t)=>e===t){return e=>new u(t=>e.subscribe(new D(t,r)))}const p={};class D{constructor(e,t){this.destination=e,this.predicate=t,this.lastValue=p}next(e){let t;try{t=this.lastValue===p||!this.predicate(this.lastValue,e),this.lastValue=e}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}function U(r){return e=>new u(t=>e.subscribe(new j(t,r)))}let j=class{constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(s){throw this.error(s),s}this.destination.next(t)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}};function le(r){return U(()=>r)}function he(){return r=>new u(e=>{let t=!1,s=!1;const a=r.subscribe(i=>{t||(t=!0,e.next(i)),s&&a.unsubscribe()},i=>{var n;t=!0,(n=e.error)===null||n===void 0||n.call(e,i),s&&a.unsubscribe()});return s=!0,t&&a.unsubscribe(),a})}function de(){return r=>new u(e=>r.subscribe(new F(e)))}class F{constructor(e){this.destination=e,this.hasLast=!1}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}function fe(r){return e=>new u(t=>e.subscribe(new P(t,r)))}class P{constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,s;(s=(t=this.destination).error)===null||s===void 0||s.call(t,e)}}var S;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(S||(S={}));const be=5;export{be as ACTIVE_LIVE_VALID_DELAY,S as ErrorCategory,k as Logger,u as Observable,_ as Subject,v as Subscription,$ as VERSION,J as ValueSubject,Y as abortable,B as addScript,f as assertNever,K as assertNonNullable,W as assertNullable,ne as buffer,z as checkNever,Q as combine,ie as debounce,ae as filter,ce as filterChanged,se as fromEvent,q as getExponentialDelay,te as interval,g as isNonNullable,x as isNullable,U as map,le as mapTo,Z as merge,b as noop,X as now,re as observableFrom,he as once,de as pairwise,H as safeStorage,fe as tap,oe as throttle,ee as timeout};
6
+ const Z="1.0.26";class _{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const m=e=>{throw new Error(`${e} is value of unexpected type`)},B=e=>{},E=()=>{};class l{constructor(t){t&&(this._subscribe=t)}subscribe(t,i){var n;let o;i?typeof i=="function"?o={next:i,error:E}:o={next:a=>i.next(a),error:a=>{var f;return(f=i.error)===null||f===void 0?void 0:f.call(i,a)}}:o={next:E,error:E};const r=typeof t=="function"?{next:a=>{try{t(a)}catch(f){o.next(f)}},error:a=>o.next(a)}:{next:a=>t.next(a),error:a=>t.error?t.error(a):o.next(a)};let s;try{s=this._subscribe(r)}catch(a){(n=r.error)===null||n===void 0||n.call(r,a)}return new _().add(()=>{switch(r.next=E,r.error=E,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return m(s)}})}pipe(...t){return t.reduce((i,n)=>n(i),this)}_subscribe(t){}}class I extends l{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach(i=>i.next(t))}error(t){this.subscribers.forEach(i=>{var n;return(n=i.error)===null||n===void 0?void 0:n.call(i,t)})}_subscribe(t){const i=this.keyCounter++;return this.subscribers.set(i,t),new _().add(()=>this.subscribers.delete(i))}}class tt{constructor(){this.log$=new I,this.logs=[],this.log=t=>{const i={...t,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...i)=>{let n;try{n=t(...i)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(i=>({component:t,...i}))}}function et(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function it(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function y(e){return typeof e!="undefined"&&e!==null}function Q(e){return e==null}const nt=(e,t,i)=>new Promise((n,o)=>{t.addEventListener("abort",()=>{a(),w.remove()});const r=()=>{a(),o()},s=()=>{a(),n()},a=()=>{f&&clearTimeout(f),w.removeEventListener("load",s),w.removeEventListener("error",r)};let f;i&&(f=window.setTimeout(r,i));const w=document.createElement("script");w.addEventListener("load",s),w.addEventListener("error",r),w.src=e,document.head.appendChild(w)});var x;const st=typeof((x=window.performance)===null||x===void 0?void 0:x.now)=="function"?()=>window.performance.now():()=>Date.now(),rt=(e,t)=>async(...i)=>{var n;const o=t(...i);let r=e.aborted,s;for(;!r&&!e.aborted;){const a=await o.next(s);r=(n=a.done)!==null&&n!==void 0?n:!1,s=a.value}return s};var b;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(b||(b={}));var v;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Desktop="Desktop"})(v||(v={}));const ot=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?b.Yandex:void 0,i=/chrome|crios/i.test(e)?b.Chrome:void 0,n=/chromium/i.test(e)?b.Chromium:void 0,o=/firefox|fxios/i.test(e)?b.Firefox:void 0,r=/webkit|safari|khtml/i.test(e)?b.Safari:void 0,s=/opr\//i.test(e)?b.Opera:void 0,a=/edg/i.test(e)?b.Edge:void 0,f=/android/i.test(e)?v.Android:void 0,w=/iphone/i.test(e)?v.iPhone:void 0,P=/ipad/i.test(e)?v.iPad:void 0,N=/ipod/i.test(e)?v.iPod:void 0,M=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?v.RestMobile:void 0;return{browser:t||o||s||a||i||n||r||b.Rest,device:f||w||P||N||M||v.Desktop}},at=(e,{start:t=0,factor:i=2,max:n=1/0,min:o=t,random:r=0}={})=>{let s=t;return s*=i**e,s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var c;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(c||(c={}));let u,g;const S=`vk-videoplayer-dummy-key-${Math.random()}`,p=()=>{if(g!==void 0)return g;try{localStorage.setItem(S,"test"),localStorage.removeItem(S),g=c.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(S),g=c.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)g=c.RUNTIME;else throw t}else throw e}return g===c.RUNTIME&&(u=new Map),g},V=()=>p()===c.LOCAL_STORAGE,G=e=>{var t,i;const n=p();switch(n){case c.LOCAL_STORAGE:return(t=localStorage.getItem(e))!==null&&t!==void 0?t:void 0;case c.SESSION_STORAGE:return(i=sessionStorage.getItem(e))!==null&&i!==void 0?i:void 0;case c.RUNTIME:return u==null?void 0:u.get(e);default:m(n)}},U=(e,t)=>{const i=p();switch(i){case c.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case c.RUNTIME:return void(u==null?void 0:u.set(e,t));default:m(i)}},k=e=>{var t;const i=p();switch(i){case c.LOCAL_STORAGE:return e in localStorage;case c.SESSION_STORAGE:return e in sessionStorage;case c.RUNTIME:return(t=u==null?void 0:u.has(e))!==null&&t!==void 0?t:!1;default:return m(i),!1}},D=e=>{const t=p();switch(t){case c.LOCAL_STORAGE:return localStorage.removeItem(e);case c.SESSION_STORAGE:return sessionStorage.removeItem(e);case c.RUNTIME:return void(u==null?void 0:u.delete(e));default:m(t)}},F=()=>{const e=p();switch(e){case c.LOCAL_STORAGE:return localStorage.clear();case c.SESSION_STORAGE:return sessionStorage.clear();case c.RUNTIME:return u==null?void 0:u.clear();default:m(e)}};var ct=Object.freeze({__proto__:null,clear:F,get:G,has:k,isPersistent:V,remove:D,set:U}),d;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(d||(d={}));const h={[d.Q_144P]:{width:256,height:144},[d.Q_240P]:{width:428,height:240},[d.Q_360P]:{width:640,height:360},[d.Q_480P]:{width:856,height:480},[d.Q_720P]:{width:1280,height:720},[d.Q_1080P]:{width:1920,height:1080},[d.Q_1440P]:{width:2560,height:1440},[d.Q_2160P]:{width:3840,height:2160},[d.Q_4320P]:{width:7680,height:4320}},ut=(e,t)=>h[e].height>h[t].height,lt=(e,t)=>h[e].height>=h[t].height,T=(e,t)=>h[e].height<h[t].height,dt=(e,t)=>h[e].height<=h[t].height,ht=e=>e.sort((t,i)=>t===i?0:t===d.INVARIANT?1:i===d.INVARIANT?-1:T(t,i)?1:-1)[0],L=Object.keys(h).sort((e,t)=>T(e,t)?-1:1),ft=(e,t=.02)=>[...L].find(n=>h[n].height*(1+t)>=e),bt=({width:e,height:t})=>{const i=Math.min(e,t),n=Math.max(e,t);return L.find(o=>{const r=h[o];return r.width>=n&&r.height>=i})},wt=e=>h[e].height,R=e=>e===d.INVARIANT,vt=e=>e.every(t=>!R(t));function gt(e){if(R(e))throw new Error("Expected exact quality")}class mt extends I{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const i=super._subscribe(t);return t.next(this.value),i}}function pt(e){return new l(t=>{const i={};let n=Object.keys(e).length;const o=r=>s=>{r in i||n--,i[r]=s,n===0&&t.next(i)};return Object.entries(e).reduce((r,[s,a])=>r.add(a.subscribe(o(s))),new _)})}function Et(...e){return new l(t=>e.reduce((i,n)=>i.add(n.subscribe(t)),new _))}var _t=e=>new l(t=>{const i=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(i)}),xt=e=>new l(t=>{const i=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(i)}),St=e=>new l(t=>{e.forEach(i=>t.next(i))}),Ot=(e,t)=>new l(i=>{const n=o=>i.next(o);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function At(e){return t=>new l(i=>t.subscribe(new j(i,e)))}class j{constructor(t,i){this.destination=t,this.size=i,this.lastValues=[]}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const q={leading:!1,trailing:!0};function It(e,t=q){return i=>new l(n=>i.subscribe(new z(n,e,t)))}class z{constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}const $={leading:!0,trailing:!1};function Tt(e,t=$){return i=>new l(n=>i.subscribe(new H(n,e,t)))}class H{constructor(t,i,n){this.destination=t,this.time=i,this.config=n}next(t){this.lastValue=t,Q(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Lt(e){return t=>new l(i=>t.subscribe(new Y(i,e)))}class Y{constructor(t,i){this.destination=t,this.predicate=i}next(t){let i;try{i=this.predicate(t)}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Rt(e=(t,i)=>t===i){return t=>new l(i=>t.subscribe(new C(i,e)))}const O={};class C{constructor(t,i){this.destination=t,this.predicate=i,this.lastValue=O}next(t){let i;try{i=this.lastValue===O||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}i&&this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function K(e){return t=>new l(i=>t.subscribe(new W(i,e)))}let W=class{constructor(t,i){this.destination=t,this.mapper=i}next(t){let i;try{i=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(i)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}};function Nt(e){return K(()=>e)}function Mt(){return e=>new l(t=>{let i=!1,n=!1;const o=e.subscribe(r=>{i||(i=!0,t.next(r)),n&&o.unsubscribe()},r=>{var s;i=!0,(s=t.error)===null||s===void 0||s.call(t,r),n&&o.unsubscribe()});return n=!0,i&&o.unsubscribe(),o})}function yt(){return e=>new l(t=>e.subscribe(new X(t)))}class X{constructor(t){this.destination=t,this.hasLast=!1}next(t){const i=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,t])}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}function Qt(e){return t=>new l(i=>t.subscribe(new J(i,e)))}class J{constructor(t,i){this.destination=t,this.effect=i}next(t){try{this.effect(t)}catch(i){throw this.error(i),i}this.destination.next(t)}error(t){var i,n;(n=(i=this.destination).error)===null||n===void 0||n.call(i,t)}}var A;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(A||(A={}));const Vt=5;export{Vt as ACTIVE_LIVE_VALID_DELAY,b as CurrentClientBrowser,v as CurrentClientDevice,A as ErrorCategory,tt as Logger,l as Observable,I as Subject,_ as Subscription,Z as VERSION,mt as ValueSubject,d as VideoQuality,rt as abortable,nt as addScript,vt as areQualitiesExact,m as assertNever,et as assertNonNullable,it as assertNullable,gt as assertQualityIsExact,At as buffer,B as checkNever,pt as combine,It as debounce,Lt as filter,Rt as filterChanged,Ot as fromEvent,ot as getCurrentBrowser,at as getExponentialDelay,ht as getHighestQuality,xt as interval,ut as isHigher,lt as isHigherOrEqual,R as isInvariantQuality,T as isLower,dt as isLowerOrEqual,y as isNonNullable,Q as isNullable,K as map,Nt as mapTo,Et as merge,E as noop,st as now,St as observableFrom,Mt as once,yt as pairwise,ct as safeStorage,Qt as tap,Tt as throttle,_t as timeout,ft as videoHeightToQuality,wt as videoQualityToHeight,bt as videoSizeToQuality};
package/esnext.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24
3
- * Mon, 19 Jun 2023 11:52:56 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- "use strict";const O="1.0.24";class b{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const d=r=>{throw new Error(`${r} is value of unexpected type`)},T=r=>{},f=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){let s;t?typeof t=="function"?s={next:t,error:f}:s={next:n=>t.next(n),error:n=>t.error?.(n)}:s={next:f,error:f};const a=typeof e=="function"?{next:n=>{try{e(n)}catch(l){s.next(l)}},error:n=>s.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):s.next(n)};let i;try{i=this._subscribe(a)}catch(n){a.error?.(n)}return new b().add(()=>{switch(a.next=f,a.error=f,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return d(i)}})}pipe(...e){return e.reduce((t,s)=>s(t),this)}_subscribe(e){}}class p extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new b().add(()=>this.subscribers.delete(t))}}class v{log$=new p;logs=[];log=e=>{const t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let s;try{s=e(...t)}catch{s={message:"error in `createCustomLog`",component:"Logger"}}this.log(s)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function I(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function _(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function g(r){return typeof r<"u"&&r!==null}function x(r){return r==null}const A=(r,e,t)=>new Promise((s,a)=>{e.addEventListener("abort",()=>{l(),h.remove()});const i=()=>{l(),a()},n=()=>{l(),s()},l=()=>{w&&clearTimeout(w),h.removeEventListener("load",n),h.removeEventListener("error",i)};let w;t&&(w=window.setTimeout(i,t));const h=document.createElement("script");h.addEventListener("load",n),h.addEventListener("error",i),h.src=r,document.head.appendChild(h)}),N=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),R=(r,e)=>async(...t)=>{const s=e(...t);let a=r.aborted,i;for(;!a&&!r.aborted;){const n=await s.next(i);a=n.done??!1,i=n.value}return i},V=(r,{start:e=0,factor:t=2,max:s=1/0,min:a=e,random:i=0}={})=>{let n=e;return n*=t**r,n*=1+(Math.random()*i*2-i),n=Math.round(n),n=Math.min(n,s),n=Math.max(n,a),n};var o;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(o||(o={}));const m=new Map;let u=o.RUNTIME;const E=`vk-videoplayer-dummy-key-${Math.random()}`,y=()=>{try{localStorage.setItem(E,"test"),localStorage.removeItem(E),u=o.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(E),u=o.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)u=o.RUNTIME;else throw e}else throw r}};y();const M=r=>{switch(u){case o.LOCAL_STORAGE:return localStorage.getItem(r)??void 0;case o.SESSION_STORAGE:return sessionStorage.getItem(r)??void 0;case o.RUNTIME:return m.get(r);default:d(u)}},C=(r,e)=>{switch(u){case o.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case o.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case o.RUNTIME:return void m.set(r,e);default:d(u)}},G=r=>{switch(u){case o.LOCAL_STORAGE:return r in localStorage;case o.SESSION_STORAGE:return r in sessionStorage;case o.RUNTIME:return m.has(r);default:return d(u),!1}},D=r=>{switch(u){case o.LOCAL_STORAGE:return localStorage.removeItem(r);case o.SESSION_STORAGE:return sessionStorage.removeItem(r);case o.RUNTIME:return void m.delete(r);default:d(u)}},U=()=>{switch(u){case o.LOCAL_STORAGE:return localStorage.clear();case o.SESSION_STORAGE:return sessionStorage.clear();case o.RUNTIME:return m.clear();default:d(u)}};var j=Object.freeze({__proto__:null,clear:U,get:M,has:G,remove:D,set:C});class F extends p{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){const t=super._subscribe(e);return e.next(this.value),t}}function P(r){return new c(e=>{const t={};let s=Object.keys(r).length;const a=i=>n=>{i in t||s--,t[i]=n,s===0&&e.next(t)};return Object.entries(r).reduce((i,[n,l])=>i.add(l.subscribe(a(n))),new b)})}function $(...r){return new c(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new b))}var z=r=>new c(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(s){if(e.error)e.error(s);else throw s}},r);return()=>window.clearTimeout(t)}),k=r=>new c(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),K=r=>new c(e=>{r.forEach(t=>e.next(t))}),W=(r,e)=>new c(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function Y(r){return e=>new c(t=>e.subscribe(new B(t,r)))}class B{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}const X={leading:!1,trailing:!0};function q(r,e=X){return t=>new c(s=>t.subscribe(new H(s,r,e)))}class H{destination;time;config;lastValue;timeout;constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,g(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const J={leading:!0,trailing:!1};function Q(r,e=J){return t=>new c(s=>t.subscribe(new Z(s,r,e)))}class Z{destination;time;config;lastValue;timeout;constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,x(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 ee(r){return e=>new c(t=>e.subscribe(new te(t,r)))}class te{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function re(r=(e,t)=>e===t){return e=>new c(t=>e.subscribe(new se(t,r)))}const S={};class se{destination;predicate;lastValue=S;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===S||!this.predicate(this.lastValue,e),this.lastValue=e}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function L(r){return e=>new c(t=>e.subscribe(new ne(t,r)))}let ne=class{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(s){throw this.error(s),s}this.destination.next(t)}error(e){this.destination.error?.(e)}};function ie(r){return L(()=>r)}function oe(){return r=>new c(e=>{let t=!1,s=!1;const a=r.subscribe(i=>{t||(t=!0,e.next(i)),s&&a.unsubscribe()},i=>{t=!0,e.error?.(i),s&&a.unsubscribe()});return s=!0,t&&a.unsubscribe(),a})}function ae(){return r=>new c(e=>r.subscribe(new ce(e)))}class ce{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function ue(r){return e=>new c(t=>e.subscribe(new le(t,r)))}class le{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){this.destination.error?.(e)}}exports.ErrorCategory=void 0;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const he=5;exports.ACTIVE_LIVE_VALID_DELAY=he;exports.Logger=v;exports.Observable=c;exports.Subject=p;exports.Subscription=b;exports.VERSION=O;exports.ValueSubject=F;exports.abortable=R;exports.addScript=A;exports.assertNever=d;exports.assertNonNullable=I;exports.assertNullable=_;exports.buffer=Y;exports.checkNever=T;exports.combine=P;exports.debounce=q;exports.filter=ee;exports.filterChanged=re;exports.fromEvent=W;exports.getExponentialDelay=V;exports.interval=k;exports.isNonNullable=g;exports.isNullable=x;exports.map=L;exports.mapTo=ie;exports.merge=$;exports.noop=f;exports.now=N;exports.observableFrom=K;exports.once=oe;exports.pairwise=ae;exports.safeStorage=j;exports.tap=ue;exports.throttle=Q;exports.timeout=z;
6
+ "use strict";const C="1.0.26";class p{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(i=>typeof i=="function"?i():i.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const f=t=>{throw new Error(`${t} is value of unexpected type`)},R=t=>{},b=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,i){let r;i?typeof i=="function"?r={next:i,error:b}:r={next:n=>i.next(n),error:n=>i.error?.(n)}:r={next:b,error:b};const o=typeof e=="function"?{next:n=>{try{e(n)}catch(l){r.next(l)}},error:n=>r.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):r.next(n)};let s;try{s=this._subscribe(o)}catch(n){o.error?.(n)}return new p().add(()=>{switch(o.next=b,o.error=b,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return f(s)}})}pipe(...e){return e.reduce((i,r)=>r(i),this)}_subscribe(e){}}class S extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(i=>i.next(e))}error(e){this.subscribers.forEach(i=>i.error?.(e))}_subscribe(e){const i=this.keyCounter++;return this.subscribers.set(i,e),new p().add(()=>this.subscribers.delete(i))}}class Q{log$=new S;logs=[];log=e=>{const i={...e,timestamp:Date.now()};this.logs.push(i),this.log$.next(i)};createCustomLog(e){return(...i)=>{let r;try{r=e(...i)}catch{r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(e){return this.createCustomLog(i=>({component:e,...i}))}getAllLogs=()=>this.logs}function V(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function P(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function _(t){return typeof t<"u"&&t!==null}function I(t){return t==null}const M=(t,e,i)=>new Promise((r,o)=>{e.addEventListener("abort",()=>{l(),h.remove()});const s=()=>{l(),o()},n=()=>{l(),r()},l=()=>{m&&clearTimeout(m),h.removeEventListener("load",n),h.removeEventListener("error",s)};let m;i&&(m=window.setTimeout(s,i));const h=document.createElement("script");h.addEventListener("load",n),h.addEventListener("error",s),h.src=t,document.head.appendChild(h)}),D=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),G=(t,e)=>async(...i)=>{const r=e(...i);let o=t.aborted,s;for(;!o&&!t.aborted;){const n=await r.next(s);o=n.done??!1,s=n.value}return s};exports.CurrentClientBrowser=void 0;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const k=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?exports.CurrentClientBrowser.Yandex:void 0,i=/chrome|crios/i.test(t)?exports.CurrentClientBrowser.Chrome:void 0,r=/chromium/i.test(t)?exports.CurrentClientBrowser.Chromium:void 0,o=/firefox|fxios/i.test(t)?exports.CurrentClientBrowser.Firefox:void 0,s=/webkit|safari|khtml/i.test(t)?exports.CurrentClientBrowser.Safari:void 0,n=/opr\//i.test(t)?exports.CurrentClientBrowser.Opera:void 0,l=/edg/i.test(t)?exports.CurrentClientBrowser.Edge:void 0,m=/android/i.test(t)?exports.CurrentClientDevice.Android:void 0,h=/iphone/i.test(t)?exports.CurrentClientDevice.iPhone:void 0,L=/ipad/i.test(t)?exports.CurrentClientDevice.iPad:void 0,y=/ipod/i.test(t)?exports.CurrentClientDevice.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:e||o||n||l||i||r||s||exports.CurrentClientBrowser.Rest,device:m||h||L||y||N||exports.CurrentClientDevice.Desktop}},U=(t,{start:e=0,factor:i=2,max:r=1/0,min:o=e,random:s=0}={})=>{let n=e;return n*=i**t,n*=1+(Math.random()*s*2-s),n=Math.round(n),n=Math.min(n,r),n=Math.max(n,o),n};var a;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(a||(a={}));let w,d;const E=`vk-videoplayer-dummy-key-${Math.random()}`,g=()=>{if(d!==void 0)return d;try{localStorage.setItem(E,"test"),localStorage.removeItem(E),d=a.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(E),d=a.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)d=a.RUNTIME;else throw e}else throw t}return d===a.RUNTIME&&(w=new Map),d},F=()=>g()===a.LOCAL_STORAGE,H=t=>{const e=g();switch(e){case a.LOCAL_STORAGE:return localStorage.getItem(t)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(t)??void 0;case a.RUNTIME:return w?.get(t);default:f(e)}},j=(t,e)=>{const i=g();switch(i){case a.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case a.RUNTIME:return void w?.set(t,e);default:f(i)}},q=t=>{const e=g();switch(e){case a.LOCAL_STORAGE:return t in localStorage;case a.SESSION_STORAGE:return t in sessionStorage;case a.RUNTIME:return w?.has(t)??!1;default:return f(e),!1}},z=t=>{const e=g();switch(e){case a.LOCAL_STORAGE:return localStorage.removeItem(t);case a.SESSION_STORAGE:return sessionStorage.removeItem(t);case a.RUNTIME:return void w?.delete(t);default:f(e)}},B=()=>{const t=g();switch(t){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return w?.clear();default:f(t)}};var Y=Object.freeze({__proto__:null,clear:B,get:H,has:q,isPersistent:F,remove:z,set:j});exports.VideoQuality=void 0;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const u={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},$=(t,e)=>u[t].height>u[e].height,K=(t,e)=>u[t].height>=u[e].height,x=(t,e)=>u[t].height<u[e].height,W=(t,e)=>u[t].height<=u[e].height,X=t=>t.sort((e,i)=>e===i?0:e===exports.VideoQuality.INVARIANT?1:i===exports.VideoQuality.INVARIANT?-1:x(e,i)?1:-1)[0],A=Object.keys(u).sort((t,e)=>x(t,e)?-1:1),J=(t,e=.02)=>[...A].find(r=>u[r].height*(1+e)>=t),Z=({width:t,height:e})=>{const i=Math.min(t,e),r=Math.max(t,e);return A.find(o=>{const s=u[o];return s.width>=r&&s.height>=i})},ee=t=>u[t].height,v=t=>t===exports.VideoQuality.INVARIANT,te=t=>t.every(e=>!v(e));function ie(t){if(v(t))throw new Error("Expected exact quality")}class re extends S{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){const i=super._subscribe(e);return e.next(this.value),i}}function ne(t){return new c(e=>{const i={};let r=Object.keys(t).length;const o=s=>n=>{s in i||r--,i[s]=n,r===0&&e.next(i)};return Object.entries(t).reduce((s,[n,l])=>s.add(l.subscribe(o(n))),new p)})}function se(...t){return new c(e=>t.reduce((i,r)=>i.add(r.subscribe(e)),new p))}var oe=t=>new c(e=>{const i=window.setTimeout(()=>{try{e.next()}catch(r){if(e.error)e.error(r);else throw r}},t);return()=>window.clearTimeout(i)}),ae=t=>new c(e=>{const i=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(i)}),ce=t=>new c(e=>{t.forEach(i=>e.next(i))}),ue=(t,e)=>new c(i=>{const r=o=>i.next(o);return t.addEventListener(e,r),()=>t.removeEventListener(e,r)});function le(t){return e=>new c(i=>e.subscribe(new he(i,t)))}class he{destination;size;lastValues=[];constructor(e,i){this.destination=e,this.size=i}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)}}const de={leading:!1,trailing:!0};function fe(t,e=de){return i=>new c(r=>i.subscribe(new be(r,t,e)))}class be{destination;time;config;lastValue;timeout;constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,_(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(i){if(this.destination.error)this.destination.error(i);else throw i}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const we={leading:!0,trailing:!1};function ge(t,e=we){return i=>new c(r=>i.subscribe(new me(r,t,e)))}class me{destination;time;config;lastValue;timeout;constructor(e,i,r){this.destination=e,this.time=i,this.config=r}next(e){this.lastValue=e,I(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 pe(t){return e=>new c(i=>e.subscribe(new Ee(i,t)))}class Ee{destination;predicate;constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.predicate(e)}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function Se(t=(e,i)=>e===i){return e=>new c(i=>e.subscribe(new xe(i,t)))}const O={};class xe{destination;predicate;lastValue=O;constructor(e,i){this.destination=e,this.predicate=i}next(e){let i;try{i=this.lastValue===O||!this.predicate(this.lastValue,e),this.lastValue=e}catch(r){throw this.error(r),r}i&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function T(t){return e=>new c(i=>e.subscribe(new ve(i,t)))}let ve=class{destination;mapper;constructor(e,i){this.destination=e,this.mapper=i}next(e){let i;try{i=this.mapper(e)}catch(r){throw this.error(r),r}this.destination.next(i)}error(e){this.destination.error?.(e)}};function Oe(t){return T(()=>t)}function _e(){return t=>new c(e=>{let i=!1,r=!1;const o=t.subscribe(s=>{i||(i=!0,e.next(s)),r&&o.unsubscribe()},s=>{i=!0,e.error?.(s),r&&o.unsubscribe()});return r=!0,i&&o.unsubscribe(),o})}function Ie(){return t=>new c(e=>t.subscribe(new Ae(e)))}class Ae{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const i=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([i,e])}error(e){this.destination.error?.(e)}}function Te(t){return e=>new c(i=>e.subscribe(new Le(i,t)))}class Le{destination;effect;constructor(e,i){this.destination=e,this.effect=i}next(e){try{this.effect(e)}catch(i){throw this.error(i),i}this.destination.next(e)}error(e){this.destination.error?.(e)}}exports.ErrorCategory=void 0;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));const ye=5;exports.ACTIVE_LIVE_VALID_DELAY=ye;exports.Logger=Q;exports.Observable=c;exports.Subject=S;exports.Subscription=p;exports.VERSION=C;exports.ValueSubject=re;exports.abortable=G;exports.addScript=M;exports.areQualitiesExact=te;exports.assertNever=f;exports.assertNonNullable=V;exports.assertNullable=P;exports.assertQualityIsExact=ie;exports.buffer=le;exports.checkNever=R;exports.combine=ne;exports.debounce=fe;exports.filter=pe;exports.filterChanged=Se;exports.fromEvent=ue;exports.getCurrentBrowser=k;exports.getExponentialDelay=U;exports.getHighestQuality=X;exports.interval=ae;exports.isHigher=$;exports.isHigherOrEqual=K;exports.isInvariantQuality=v;exports.isLower=x;exports.isLowerOrEqual=W;exports.isNonNullable=_;exports.isNullable=I;exports.map=T;exports.mapTo=Oe;exports.merge=se;exports.noop=b;exports.now=D;exports.observableFrom=ce;exports.once=_e;exports.pairwise=Ie;exports.safeStorage=Y;exports.tap=Te;exports.throttle=ge;exports.timeout=oe;exports.videoHeightToQuality=J;exports.videoQualityToHeight=ee;exports.videoSizeToQuality=Z;
package/esnext.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24
3
- * Mon, 19 Jun 2023 11:52:56 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- const P="1.0.24";class w{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const d=r=>{throw new Error(`${r} is value of unexpected type`)},$=r=>{},f=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){let s;t?typeof t=="function"?s={next:t,error:f}:s={next:n=>t.next(n),error:n=>t.error?.(n)}:s={next:f,error:f};const a=typeof e=="function"?{next:n=>{try{e(n)}catch(l){s.next(l)}},error:n=>s.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):s.next(n)};let i;try{i=this._subscribe(a)}catch(n){a.error?.(n)}return new w().add(()=>{switch(a.next=f,a.error=f,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return d(i)}})}pipe(...e){return e.reduce((t,s)=>s(t),this)}_subscribe(e){}}class g extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new w().add(()=>this.subscribers.delete(t))}}class z{log$=new g;logs=[];log=e=>{const t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let s;try{s=e(...t)}catch{s={message:"error in `createCustomLog`",component:"Logger"}}this.log(s)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function k(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function K(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function x(r){return typeof r<"u"&&r!==null}function O(r){return r==null}const W=(r,e,t)=>new Promise((s,a)=>{e.addEventListener("abort",()=>{l(),h.remove()});const i=()=>{l(),a()},n=()=>{l(),s()},l=()=>{m&&clearTimeout(m),h.removeEventListener("load",n),h.removeEventListener("error",i)};let m;t&&(m=window.setTimeout(i,t));const h=document.createElement("script");h.addEventListener("load",n),h.addEventListener("error",i),h.src=r,document.head.appendChild(h)}),B=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),X=(r,e)=>async(...t)=>{const s=e(...t);let a=r.aborted,i;for(;!a&&!r.aborted;){const n=await s.next(i);a=n.done??!1,i=n.value}return i},Y=(r,{start:e=0,factor:t=2,max:s=1/0,min:a=e,random:i=0}={})=>{let n=e;return n*=t**r,n*=1+(Math.random()*i*2-i),n=Math.round(n),n=Math.min(n,s),n=Math.max(n,a),n};var o;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(o||(o={}));const b=new Map;let u=o.RUNTIME;const E=`vk-videoplayer-dummy-key-${Math.random()}`,L=()=>{try{localStorage.setItem(E,"test"),localStorage.removeItem(E),u=o.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(E),u=o.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)u=o.RUNTIME;else throw e}else throw r}};L();const T=r=>{switch(u){case o.LOCAL_STORAGE:return localStorage.getItem(r)??void 0;case o.SESSION_STORAGE:return sessionStorage.getItem(r)??void 0;case o.RUNTIME:return b.get(r);default:d(u)}},I=(r,e)=>{switch(u){case o.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case o.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case o.RUNTIME:return void b.set(r,e);default:d(u)}},v=r=>{switch(u){case o.LOCAL_STORAGE:return r in localStorage;case o.SESSION_STORAGE:return r in sessionStorage;case o.RUNTIME:return b.has(r);default:return d(u),!1}},_=r=>{switch(u){case o.LOCAL_STORAGE:return localStorage.removeItem(r);case o.SESSION_STORAGE:return sessionStorage.removeItem(r);case o.RUNTIME:return void b.delete(r);default:d(u)}},A=()=>{switch(u){case o.LOCAL_STORAGE:return localStorage.clear();case o.SESSION_STORAGE:return sessionStorage.clear();case o.RUNTIME:return b.clear();default:d(u)}};var q=Object.freeze({__proto__:null,clear:A,get:T,has:v,remove:_,set:I});class H extends g{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){const t=super._subscribe(e);return e.next(this.value),t}}function J(r){return new c(e=>{const t={};let s=Object.keys(r).length;const a=i=>n=>{i in t||s--,t[i]=n,s===0&&e.next(t)};return Object.entries(r).reduce((i,[n,l])=>i.add(l.subscribe(a(n))),new w)})}function Q(...r){return new c(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new w))}var Z=r=>new c(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(s){if(e.error)e.error(s);else throw s}},r);return()=>window.clearTimeout(t)}),ee=r=>new c(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),te=r=>new c(e=>{r.forEach(t=>e.next(t))}),re=(r,e)=>new c(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function se(r){return e=>new c(t=>e.subscribe(new R(t,r)))}class R{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}const N={leading:!1,trailing:!0};function ne(r,e=N){return t=>new c(s=>t.subscribe(new y(s,r,e)))}class y{destination;time;config;lastValue;timeout;constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,x(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const M={leading:!0,trailing:!1};function ie(r,e=M){return t=>new c(s=>t.subscribe(new V(s,r,e)))}class V{destination;time;config;lastValue;timeout;constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,O(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 oe(r){return e=>new c(t=>e.subscribe(new C(t,r)))}class C{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function ae(r=(e,t)=>e===t){return e=>new c(t=>e.subscribe(new G(t,r)))}const p={};class G{destination;predicate;lastValue=p;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===p||!this.predicate(this.lastValue,e),this.lastValue=e}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function D(r){return e=>new c(t=>e.subscribe(new U(t,r)))}let U=class{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(s){throw this.error(s),s}this.destination.next(t)}error(e){this.destination.error?.(e)}};function ue(r){return D(()=>r)}function le(){return r=>new c(e=>{let t=!1,s=!1;const a=r.subscribe(i=>{t||(t=!0,e.next(i)),s&&a.unsubscribe()},i=>{t=!0,e.error?.(i),s&&a.unsubscribe()});return s=!0,t&&a.unsubscribe(),a})}function he(){return r=>new c(e=>r.subscribe(new j(e)))}class j{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function de(r){return e=>new c(t=>e.subscribe(new F(t,r)))}class F{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){this.destination.error?.(e)}}var S;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(S||(S={}));const fe=5;export{fe as ACTIVE_LIVE_VALID_DELAY,S as ErrorCategory,z as Logger,c as Observable,g as Subject,w as Subscription,P as VERSION,H as ValueSubject,X as abortable,W as addScript,d as assertNever,k as assertNonNullable,K as assertNullable,se as buffer,$ as checkNever,J as combine,ne as debounce,oe as filter,ae as filterChanged,re as fromEvent,Y as getExponentialDelay,ee as interval,x as isNonNullable,O as isNullable,D as map,ue as mapTo,Q as merge,f as noop,B as now,te as observableFrom,le as once,he as pairwise,q as safeStorage,de as tap,ie as throttle,Z as timeout};
6
+ const J="1.0.26";class S{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(s=>typeof s=="function"?s():s.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const w=t=>{throw new Error(`${t} is value of unexpected type`)},Z=t=>{},x=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,s){let i;s?typeof s=="function"?i={next:s,error:x}:i={next:n=>s.next(n),error:n=>s.error?.(n)}:i={next:x,error:x};const o=typeof e=="function"?{next:n=>{try{e(n)}catch(l){i.next(l)}},error:n=>i.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):i.next(n)};let r;try{r=this._subscribe(o)}catch(n){o.error?.(n)}return new S().add(()=>{switch(o.next=x,o.error=x,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return w(r)}})}pipe(...e){return e.reduce((s,i)=>i(s),this)}_subscribe(e){}}class I extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(s=>s.next(e))}error(e){this.subscribers.forEach(s=>s.error?.(e))}_subscribe(e){const s=this.keyCounter++;return this.subscribers.set(s,e),new S().add(()=>this.subscribers.delete(s))}}class B{log$=new I;logs=[];log=e=>{const s={...e,timestamp:Date.now()};this.logs.push(s),this.log$.next(s)};createCustomLog(e){return(...s)=>{let i;try{i=e(...s)}catch{i={message:"error in `createCustomLog`",component:"Logger"}}this.log(i)}}createComponentLog(e){return this.createCustomLog(s=>({component:e,...s}))}getAllLogs=()=>this.logs}function ee(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function te(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function M(t){return typeof t<"u"&&t!==null}function y(t){return t==null}const se=(t,e,s)=>new Promise((i,o)=>{e.addEventListener("abort",()=>{l(),f.remove()});const r=()=>{l(),o()},n=()=>{l(),i()},l=()=>{E&&clearTimeout(E),f.removeEventListener("load",n),f.removeEventListener("error",r)};let E;s&&(E=window.setTimeout(r,s));const f=document.createElement("script");f.addEventListener("load",n),f.addEventListener("error",r),f.src=t,document.head.appendChild(f)}),ie=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ne=(t,e)=>async(...s)=>{const i=e(...s);let o=t.aborted,r;for(;!o&&!t.aborted;){const n=await i.next(r);o=n.done??!1,r=n.value}return r};var d;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(d||(d={}));var b;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(b||(b={}));const re=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?d.Yandex:void 0,s=/chrome|crios/i.test(t)?d.Chrome:void 0,i=/chromium/i.test(t)?d.Chromium:void 0,o=/firefox|fxios/i.test(t)?d.Firefox:void 0,r=/webkit|safari|khtml/i.test(t)?d.Safari:void 0,n=/opr\//i.test(t)?d.Opera:void 0,l=/edg/i.test(t)?d.Edge:void 0,E=/android/i.test(t)?b.Android:void 0,f=/iphone/i.test(t)?b.iPhone:void 0,R=/ipad/i.test(t)?b.iPad:void 0,P=/ipod/i.test(t)?b.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?b.RestMobile:void 0;return{browser:e||o||n||l||s||i||r||d.Rest,device:E||f||R||P||N||b.Desktop}},oe=(t,{start:e=0,factor:s=2,max:i=1/0,min:o=e,random:r=0}={})=>{let n=e;return n*=s**t,n*=1+(Math.random()*r*2-r),n=Math.round(n),n=Math.min(n,i),n=Math.max(n,o),n};var a;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(a||(a={}));let g,m;const O=`vk-videoplayer-dummy-key-${Math.random()}`,p=()=>{if(m!==void 0)return m;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),m=a.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(O),m=a.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)m=a.RUNTIME;else throw e}else throw t}return m===a.RUNTIME&&(g=new Map),m},V=()=>p()===a.LOCAL_STORAGE,Q=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return localStorage.getItem(t)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(t)??void 0;case a.RUNTIME:return g?.get(t);default:w(e)}},G=(t,e)=>{const s=p();switch(s){case a.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.RUNTIME:return void g?.set(t,e);default:w(s)}},U=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return t in localStorage;case a.SESSION_STORAGE:return t in sessionStorage;case a.RUNTIME:return g?.has(t)??!1;default:return w(e),!1}},k=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return localStorage.removeItem(t);case a.SESSION_STORAGE:return sessionStorage.removeItem(t);case a.RUNTIME:return void g?.delete(t);default:w(e)}},D=()=>{const t=p();switch(t){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return g?.clear();default:w(t)}};var ae=Object.freeze({__proto__:null,clear:D,get:Q,has:U,isPersistent:V,remove:k,set:G}),u;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(u||(u={}));const h={[u.Q_144P]:{width:256,height:144},[u.Q_240P]:{width:428,height:240},[u.Q_360P]:{width:640,height:360},[u.Q_480P]:{width:856,height:480},[u.Q_720P]:{width:1280,height:720},[u.Q_1080P]:{width:1920,height:1080},[u.Q_1440P]:{width:2560,height:1440},[u.Q_2160P]:{width:3840,height:2160},[u.Q_4320P]:{width:7680,height:4320}},ce=(t,e)=>h[t].height>h[e].height,ue=(t,e)=>h[t].height>=h[e].height,T=(t,e)=>h[t].height<h[e].height,he=(t,e)=>h[t].height<=h[e].height,de=t=>t.sort((e,s)=>e===s?0:e===u.INVARIANT?1:s===u.INVARIANT?-1:T(e,s)?1:-1)[0],L=Object.keys(h).sort((t,e)=>T(t,e)?-1:1),le=(t,e=.02)=>[...L].find(i=>h[i].height*(1+e)>=t),fe=({width:t,height:e})=>{const s=Math.min(t,e),i=Math.max(t,e);return L.find(o=>{const r=h[o];return r.width>=i&&r.height>=s})},be=t=>h[t].height,v=t=>t===u.INVARIANT,me=t=>t.every(e=>!v(e));function we(t){if(v(t))throw new Error("Expected exact quality")}class ge extends I{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){const s=super._subscribe(e);return e.next(this.value),s}}function pe(t){return new c(e=>{const s={};let i=Object.keys(t).length;const o=r=>n=>{r in s||i--,s[r]=n,i===0&&e.next(s)};return Object.entries(t).reduce((r,[n,l])=>r.add(l.subscribe(o(n))),new S)})}function Ee(...t){return new c(e=>t.reduce((s,i)=>s.add(i.subscribe(e)),new S))}var xe=t=>new c(e=>{const s=window.setTimeout(()=>{try{e.next()}catch(i){if(e.error)e.error(i);else throw i}},t);return()=>window.clearTimeout(s)}),Se=t=>new c(e=>{const s=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(s)}),Oe=t=>new c(e=>{t.forEach(s=>e.next(s))}),_e=(t,e)=>new c(s=>{const i=o=>s.next(o);return t.addEventListener(e,i),()=>t.removeEventListener(e,i)});function Ae(t){return e=>new c(s=>e.subscribe(new F(s,t)))}class F{destination;size;lastValues=[];constructor(e,s){this.destination=e,this.size=s}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)}}const j={leading:!1,trailing:!0};function Ie(t,e=j){return s=>new c(i=>s.subscribe(new z(i,t,e)))}class z{destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,M(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(s){if(this.destination.error)this.destination.error(s);else throw s}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const q={leading:!0,trailing:!1};function Te(t,e=q){return s=>new c(i=>s.subscribe(new $(i,t,e)))}class ${destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,y(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 c(s=>e.subscribe(new H(s,t)))}class H{destination;predicate;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.predicate(e)}catch(i){throw this.error(i),i}s&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function ve(t=(e,s)=>e===s){return e=>new c(s=>e.subscribe(new Y(s,t)))}const _={};class Y{destination;predicate;lastValue=_;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.lastValue===_||!this.predicate(this.lastValue,e),this.lastValue=e}catch(i){throw this.error(i),i}s&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function C(t){return e=>new c(s=>e.subscribe(new K(s,t)))}let K=class{destination;mapper;constructor(e,s){this.destination=e,this.mapper=s}next(e){let s;try{s=this.mapper(e)}catch(i){throw this.error(i),i}this.destination.next(s)}error(e){this.destination.error?.(e)}};function Pe(t){return C(()=>t)}function Ne(){return t=>new c(e=>{let s=!1,i=!1;const o=t.subscribe(r=>{s||(s=!0,e.next(r)),i&&o.unsubscribe()},r=>{s=!0,e.error?.(r),i&&o.unsubscribe()});return i=!0,s&&o.unsubscribe(),o})}function Me(){return t=>new c(e=>t.subscribe(new W(e)))}class W{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const s=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([s,e])}error(e){this.destination.error?.(e)}}function ye(t){return e=>new c(s=>e.subscribe(new X(s,t)))}class X{destination;effect;constructor(e,s){this.destination=e,this.effect=s}next(e){try{this.effect(e)}catch(s){throw this.error(s),s}this.destination.next(e)}error(e){this.destination.error?.(e)}}var A;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(A||(A={}));const Ve=5;export{Ve as ACTIVE_LIVE_VALID_DELAY,d as CurrentClientBrowser,b as CurrentClientDevice,A as ErrorCategory,B as Logger,c as Observable,I as Subject,S as Subscription,J as VERSION,ge as ValueSubject,u as VideoQuality,ne as abortable,se as addScript,me as areQualitiesExact,w as assertNever,ee as assertNonNullable,te as assertNullable,we as assertQualityIsExact,Ae as buffer,Z as checkNever,pe as combine,Ie as debounce,Le as filter,ve as filterChanged,_e as fromEvent,re as getCurrentBrowser,oe as getExponentialDelay,de as getHighestQuality,Se as interval,ce as isHigher,ue as isHigherOrEqual,v as isInvariantQuality,T as isLower,he as isLowerOrEqual,M as isNonNullable,y as isNullable,C as map,Pe as mapTo,Ee as merge,x as noop,ie as now,Oe as observableFrom,Ne as once,Me as pairwise,ae as safeStorage,ye as tap,Te as throttle,xe as timeout,le as videoHeightToQuality,be as videoQualityToHeight,fe as videoSizeToQuality};
package/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24
3
- * Mon, 19 Jun 2023 11:52:56 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.26
3
+ * Mon, 10 Jul 2023 13:37:00 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-26/doc/
5
5
  */
6
- const P="1.0.24";class w{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const d=r=>{throw new Error(`${r} is value of unexpected type`)},$=r=>{},f=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){let s;t?typeof t=="function"?s={next:t,error:f}:s={next:n=>t.next(n),error:n=>t.error?.(n)}:s={next:f,error:f};const a=typeof e=="function"?{next:n=>{try{e(n)}catch(l){s.next(l)}},error:n=>s.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):s.next(n)};let i;try{i=this._subscribe(a)}catch(n){a.error?.(n)}return new w().add(()=>{switch(a.next=f,a.error=f,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return d(i)}})}pipe(...e){return e.reduce((t,s)=>s(t),this)}_subscribe(e){}}class g extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(t=>t.next(e))}error(e){this.subscribers.forEach(t=>t.error?.(e))}_subscribe(e){const t=this.keyCounter++;return this.subscribers.set(t,e),new w().add(()=>this.subscribers.delete(t))}}class z{log$=new g;logs=[];log=e=>{const t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};createCustomLog(e){return(...t)=>{let s;try{s=e(...t)}catch{s={message:"error in `createCustomLog`",component:"Logger"}}this.log(s)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}getAllLogs=()=>this.logs}function k(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function K(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function x(r){return typeof r<"u"&&r!==null}function O(r){return r==null}const W=(r,e,t)=>new Promise((s,a)=>{e.addEventListener("abort",()=>{l(),h.remove()});const i=()=>{l(),a()},n=()=>{l(),s()},l=()=>{m&&clearTimeout(m),h.removeEventListener("load",n),h.removeEventListener("error",i)};let m;t&&(m=window.setTimeout(i,t));const h=document.createElement("script");h.addEventListener("load",n),h.addEventListener("error",i),h.src=r,document.head.appendChild(h)}),B=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),X=(r,e)=>async(...t)=>{const s=e(...t);let a=r.aborted,i;for(;!a&&!r.aborted;){const n=await s.next(i);a=n.done??!1,i=n.value}return i},Y=(r,{start:e=0,factor:t=2,max:s=1/0,min:a=e,random:i=0}={})=>{let n=e;return n*=t**r,n*=1+(Math.random()*i*2-i),n=Math.round(n),n=Math.min(n,s),n=Math.max(n,a),n};var o;(function(r){r[r.LOCAL_STORAGE=0]="LOCAL_STORAGE",r[r.SESSION_STORAGE=1]="SESSION_STORAGE",r[r.RUNTIME=2]="RUNTIME"})(o||(o={}));const b=new Map;let u=o.RUNTIME;const E=`vk-videoplayer-dummy-key-${Math.random()}`,L=()=>{try{localStorage.setItem(E,"test"),localStorage.removeItem(E),u=o.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(E),u=o.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)u=o.RUNTIME;else throw e}else throw r}};L();const T=r=>{switch(u){case o.LOCAL_STORAGE:return localStorage.getItem(r)??void 0;case o.SESSION_STORAGE:return sessionStorage.getItem(r)??void 0;case o.RUNTIME:return b.get(r);default:d(u)}},I=(r,e)=>{switch(u){case o.LOCAL_STORAGE:try{localStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case o.SESSION_STORAGE:try{sessionStorage.setItem(r,e)}catch(t){if(t instanceof DOMException)console.error(t);else throw t}break;case o.RUNTIME:return void b.set(r,e);default:d(u)}},v=r=>{switch(u){case o.LOCAL_STORAGE:return r in localStorage;case o.SESSION_STORAGE:return r in sessionStorage;case o.RUNTIME:return b.has(r);default:return d(u),!1}},_=r=>{switch(u){case o.LOCAL_STORAGE:return localStorage.removeItem(r);case o.SESSION_STORAGE:return sessionStorage.removeItem(r);case o.RUNTIME:return void b.delete(r);default:d(u)}},A=()=>{switch(u){case o.LOCAL_STORAGE:return localStorage.clear();case o.SESSION_STORAGE:return sessionStorage.clear();case o.RUNTIME:return b.clear();default:d(u)}};var q=Object.freeze({__proto__:null,clear:A,get:T,has:v,remove:_,set:I});class H extends g{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){const t=super._subscribe(e);return e.next(this.value),t}}function J(r){return new c(e=>{const t={};let s=Object.keys(r).length;const a=i=>n=>{i in t||s--,t[i]=n,s===0&&e.next(t)};return Object.entries(r).reduce((i,[n,l])=>i.add(l.subscribe(a(n))),new w)})}function Q(...r){return new c(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new w))}var Z=r=>new c(e=>{const t=window.setTimeout(()=>{try{e.next()}catch(s){if(e.error)e.error(s);else throw s}},r);return()=>window.clearTimeout(t)}),ee=r=>new c(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),te=r=>new c(e=>{r.forEach(t=>e.next(t))}),re=(r,e)=>new c(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function se(r){return e=>new c(t=>e.subscribe(new R(t,r)))}class R{destination;size;lastValues=[];constructor(e,t){this.destination=e,this.size=t}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}}const N={leading:!1,trailing:!0};function ne(r,e=N){return t=>new c(s=>t.subscribe(new y(s,r,e)))}class y{destination;time;config;lastValue;timeout;constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,x(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(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const M={leading:!0,trailing:!1};function ie(r,e=M){return t=>new c(s=>t.subscribe(new V(s,r,e)))}class V{destination;time;config;lastValue;timeout;constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,O(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 oe(r){return e=>new c(t=>e.subscribe(new C(t,r)))}class C{destination;predicate;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function ae(r=(e,t)=>e===t){return e=>new c(t=>e.subscribe(new G(t,r)))}const p={};class G{destination;predicate;lastValue=p;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===p||!this.predicate(this.lastValue,e),this.lastValue=e}catch(s){throw this.error(s),s}t&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function D(r){return e=>new c(t=>e.subscribe(new U(t,r)))}let U=class{destination;mapper;constructor(e,t){this.destination=e,this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(s){throw this.error(s),s}this.destination.next(t)}error(e){this.destination.error?.(e)}};function ue(r){return D(()=>r)}function le(){return r=>new c(e=>{let t=!1,s=!1;const a=r.subscribe(i=>{t||(t=!0,e.next(i)),s&&a.unsubscribe()},i=>{t=!0,e.error?.(i),s&&a.unsubscribe()});return s=!0,t&&a.unsubscribe(),a})}function he(){return r=>new c(e=>r.subscribe(new j(e)))}class j{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){this.destination.error?.(e)}}function de(r){return e=>new c(t=>e.subscribe(new F(t,r)))}class F{destination;effect;constructor(e,t){this.destination=e,this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){this.destination.error?.(e)}}var S;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(S||(S={}));const fe=5;export{fe as ACTIVE_LIVE_VALID_DELAY,S as ErrorCategory,z as Logger,c as Observable,g as Subject,w as Subscription,P as VERSION,H as ValueSubject,X as abortable,W as addScript,d as assertNever,k as assertNonNullable,K as assertNullable,se as buffer,$ as checkNever,J as combine,ne as debounce,oe as filter,ae as filterChanged,re as fromEvent,Y as getExponentialDelay,ee as interval,x as isNonNullable,O as isNullable,D as map,ue as mapTo,Q as merge,f as noop,B as now,te as observableFrom,le as once,he as pairwise,q as safeStorage,de as tap,ie as throttle,Z as timeout};
6
+ const J="1.0.26";class S{subscriptions=[];unsubscribe(){const e=this.subscriptions;this.subscriptions=[],e.forEach(s=>typeof s=="function"?s():s.unsubscribe())}add(e){return this.subscriptions.push(e),this}}const w=t=>{throw new Error(`${t} is value of unexpected type`)},Z=t=>{},x=()=>{};class c{constructor(e){e&&(this._subscribe=e)}subscribe(e,s){let i;s?typeof s=="function"?i={next:s,error:x}:i={next:n=>s.next(n),error:n=>s.error?.(n)}:i={next:x,error:x};const o=typeof e=="function"?{next:n=>{try{e(n)}catch(l){i.next(l)}},error:n=>i.next(n)}:{next:n=>e.next(n),error:n=>e.error?e.error(n):i.next(n)};let r;try{r=this._subscribe(o)}catch(n){o.error?.(n)}return new S().add(()=>{switch(o.next=x,o.error=x,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return w(r)}})}pipe(...e){return e.reduce((s,i)=>i(s),this)}_subscribe(e){}}class I extends c{keyCounter=0;subscribers=new Map;constructor(){super()}next(e){this.subscribers.forEach(s=>s.next(e))}error(e){this.subscribers.forEach(s=>s.error?.(e))}_subscribe(e){const s=this.keyCounter++;return this.subscribers.set(s,e),new S().add(()=>this.subscribers.delete(s))}}class B{log$=new I;logs=[];log=e=>{const s={...e,timestamp:Date.now()};this.logs.push(s),this.log$.next(s)};createCustomLog(e){return(...s)=>{let i;try{i=e(...s)}catch{i={message:"error in `createCustomLog`",component:"Logger"}}this.log(i)}}createComponentLog(e){return this.createCustomLog(s=>({component:e,...s}))}getAllLogs=()=>this.logs}function ee(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function te(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function M(t){return typeof t<"u"&&t!==null}function y(t){return t==null}const se=(t,e,s)=>new Promise((i,o)=>{e.addEventListener("abort",()=>{l(),f.remove()});const r=()=>{l(),o()},n=()=>{l(),i()},l=()=>{E&&clearTimeout(E),f.removeEventListener("load",n),f.removeEventListener("error",r)};let E;s&&(E=window.setTimeout(r,s));const f=document.createElement("script");f.addEventListener("load",n),f.addEventListener("error",r),f.src=t,document.head.appendChild(f)}),ie=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ne=(t,e)=>async(...s)=>{const i=e(...s);let o=t.aborted,r;for(;!o&&!t.aborted;){const n=await i.next(r);o=n.done??!1,r=n.value}return r};var d;(function(t){t.Unknown="Unknown",t.Yandex="Yandex",t.Chrome="Chrome",t.Chromium="Chromium",t.Firefox="Firefox",t.Safari="Safari",t.Opera="Opera",t.Edge="Edge",t.Rest="Rest"})(d||(d={}));var b;(function(t){t.Unknown="Unknown",t.Android="Android",t.iPhone="iPhone",t.iPad="iPad",t.iPod="iPod",t.RestMobile="RestMobile",t.Desktop="Desktop"})(b||(b={}));const re=()=>{const{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?d.Yandex:void 0,s=/chrome|crios/i.test(t)?d.Chrome:void 0,i=/chromium/i.test(t)?d.Chromium:void 0,o=/firefox|fxios/i.test(t)?d.Firefox:void 0,r=/webkit|safari|khtml/i.test(t)?d.Safari:void 0,n=/opr\//i.test(t)?d.Opera:void 0,l=/edg/i.test(t)?d.Edge:void 0,E=/android/i.test(t)?b.Android:void 0,f=/iphone/i.test(t)?b.iPhone:void 0,R=/ipad/i.test(t)?b.iPad:void 0,P=/ipod/i.test(t)?b.iPod:void 0,N=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?b.RestMobile:void 0;return{browser:e||o||n||l||s||i||r||d.Rest,device:E||f||R||P||N||b.Desktop}},oe=(t,{start:e=0,factor:s=2,max:i=1/0,min:o=e,random:r=0}={})=>{let n=e;return n*=s**t,n*=1+(Math.random()*r*2-r),n=Math.round(n),n=Math.min(n,i),n=Math.max(n,o),n};var a;(function(t){t[t.LOCAL_STORAGE=0]="LOCAL_STORAGE",t[t.SESSION_STORAGE=1]="SESSION_STORAGE",t[t.RUNTIME=2]="RUNTIME"})(a||(a={}));let g,m;const O=`vk-videoplayer-dummy-key-${Math.random()}`,p=()=>{if(m!==void 0)return m;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),m=a.LOCAL_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(O),m=a.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)m=a.RUNTIME;else throw e}else throw t}return m===a.RUNTIME&&(g=new Map),m},V=()=>p()===a.LOCAL_STORAGE,Q=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return localStorage.getItem(t)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(t)??void 0;case a.RUNTIME:return g?.get(t);default:w(e)}},G=(t,e)=>{const s=p();switch(s){case a.LOCAL_STORAGE:try{localStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(t,e)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case a.RUNTIME:return void g?.set(t,e);default:w(s)}},U=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return t in localStorage;case a.SESSION_STORAGE:return t in sessionStorage;case a.RUNTIME:return g?.has(t)??!1;default:return w(e),!1}},k=t=>{const e=p();switch(e){case a.LOCAL_STORAGE:return localStorage.removeItem(t);case a.SESSION_STORAGE:return sessionStorage.removeItem(t);case a.RUNTIME:return void g?.delete(t);default:w(e)}},D=()=>{const t=p();switch(t){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return g?.clear();default:w(t)}};var ae=Object.freeze({__proto__:null,clear:D,get:Q,has:U,isPersistent:V,remove:k,set:G}),u;(function(t){t.INVARIANT="Invariant quality",t.Q_144P="144p",t.Q_240P="240p",t.Q_360P="360p",t.Q_480P="480p",t.Q_720P="720p",t.Q_1080P="1080p",t.Q_1440P="1440p",t.Q_2160P="2160p",t.Q_4320P="4320p"})(u||(u={}));const h={[u.Q_144P]:{width:256,height:144},[u.Q_240P]:{width:428,height:240},[u.Q_360P]:{width:640,height:360},[u.Q_480P]:{width:856,height:480},[u.Q_720P]:{width:1280,height:720},[u.Q_1080P]:{width:1920,height:1080},[u.Q_1440P]:{width:2560,height:1440},[u.Q_2160P]:{width:3840,height:2160},[u.Q_4320P]:{width:7680,height:4320}},ce=(t,e)=>h[t].height>h[e].height,ue=(t,e)=>h[t].height>=h[e].height,T=(t,e)=>h[t].height<h[e].height,he=(t,e)=>h[t].height<=h[e].height,de=t=>t.sort((e,s)=>e===s?0:e===u.INVARIANT?1:s===u.INVARIANT?-1:T(e,s)?1:-1)[0],L=Object.keys(h).sort((t,e)=>T(t,e)?-1:1),le=(t,e=.02)=>[...L].find(i=>h[i].height*(1+e)>=t),fe=({width:t,height:e})=>{const s=Math.min(t,e),i=Math.max(t,e);return L.find(o=>{const r=h[o];return r.width>=i&&r.height>=s})},be=t=>h[t].height,v=t=>t===u.INVARIANT,me=t=>t.every(e=>!v(e));function we(t){if(v(t))throw new Error("Expected exact quality")}class ge extends I{value;constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){const s=super._subscribe(e);return e.next(this.value),s}}function pe(t){return new c(e=>{const s={};let i=Object.keys(t).length;const o=r=>n=>{r in s||i--,s[r]=n,i===0&&e.next(s)};return Object.entries(t).reduce((r,[n,l])=>r.add(l.subscribe(o(n))),new S)})}function Ee(...t){return new c(e=>t.reduce((s,i)=>s.add(i.subscribe(e)),new S))}var xe=t=>new c(e=>{const s=window.setTimeout(()=>{try{e.next()}catch(i){if(e.error)e.error(i);else throw i}},t);return()=>window.clearTimeout(s)}),Se=t=>new c(e=>{const s=window.setInterval(()=>e.next(),t);return()=>window.clearInterval(s)}),Oe=t=>new c(e=>{t.forEach(s=>e.next(s))}),_e=(t,e)=>new c(s=>{const i=o=>s.next(o);return t.addEventListener(e,i),()=>t.removeEventListener(e,i)});function Ae(t){return e=>new c(s=>e.subscribe(new F(s,t)))}class F{destination;size;lastValues=[];constructor(e,s){this.destination=e,this.size=s}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)}}const j={leading:!1,trailing:!0};function Ie(t,e=j){return s=>new c(i=>s.subscribe(new z(i,t,e)))}class z{destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,M(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(s){if(this.destination.error)this.destination.error(s);else throw s}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}}const q={leading:!0,trailing:!1};function Te(t,e=q){return s=>new c(i=>s.subscribe(new $(i,t,e)))}class ${destination;time;config;lastValue;timeout;constructor(e,s,i){this.destination=e,this.time=s,this.config=i}next(e){this.lastValue=e,y(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 c(s=>e.subscribe(new H(s,t)))}class H{destination;predicate;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.predicate(e)}catch(i){throw this.error(i),i}s&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function ve(t=(e,s)=>e===s){return e=>new c(s=>e.subscribe(new Y(s,t)))}const _={};class Y{destination;predicate;lastValue=_;constructor(e,s){this.destination=e,this.predicate=s}next(e){let s;try{s=this.lastValue===_||!this.predicate(this.lastValue,e),this.lastValue=e}catch(i){throw this.error(i),i}s&&this.destination.next(e)}error(e){this.destination.error?.(e)}}function C(t){return e=>new c(s=>e.subscribe(new K(s,t)))}let K=class{destination;mapper;constructor(e,s){this.destination=e,this.mapper=s}next(e){let s;try{s=this.mapper(e)}catch(i){throw this.error(i),i}this.destination.next(s)}error(e){this.destination.error?.(e)}};function Pe(t){return C(()=>t)}function Ne(){return t=>new c(e=>{let s=!1,i=!1;const o=t.subscribe(r=>{s||(s=!0,e.next(r)),i&&o.unsubscribe()},r=>{s=!0,e.error?.(r),i&&o.unsubscribe()});return i=!0,s&&o.unsubscribe(),o})}function Me(){return t=>new c(e=>t.subscribe(new W(e)))}class W{destination;last;hasLast=!1;constructor(e){this.destination=e}next(e){const s=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([s,e])}error(e){this.destination.error?.(e)}}function ye(t){return e=>new c(s=>e.subscribe(new X(s,t)))}class X{destination;effect;constructor(e,s){this.destination=e,this.effect=s}next(e){try{this.effect(e)}catch(s){throw this.error(s),s}this.destination.next(e)}error(e){this.destination.error?.(e)}}var A;(function(t){t.NETWORK="network",t.VIDEO_PIPELINE="video_pipeline",t.EXTERNAL_API="external_api",t.PARSER="parser",t.DOM="dom",t.WTF="wtf"})(A||(A={}));const Ve=5;export{Ve as ACTIVE_LIVE_VALID_DELAY,d as CurrentClientBrowser,b as CurrentClientDevice,A as ErrorCategory,B as Logger,c as Observable,I as Subject,S as Subscription,J as VERSION,ge as ValueSubject,u as VideoQuality,ne as abortable,se as addScript,me as areQualitiesExact,w as assertNever,ee as assertNonNullable,te as assertNullable,we as assertQualityIsExact,Ae as buffer,Z as checkNever,pe as combine,Ie as debounce,Le as filter,ve as filterChanged,_e as fromEvent,re as getCurrentBrowser,oe as getExponentialDelay,de as getHighestQuality,Se as interval,ce as isHigher,ue as isHigherOrEqual,v as isInvariantQuality,T as isLower,he as isLowerOrEqual,M as isNonNullable,y as isNullable,C as map,Pe as mapTo,Ee as merge,x as noop,ie as now,Oe as observableFrom,Ne as once,Me as pairwise,ae as safeStorage,ye as tap,Te as throttle,xe as timeout,le as videoHeightToQuality,be as videoQualityToHeight,fe as videoSizeToQuality};
package/index.d.ts CHANGED
@@ -1,133 +1,161 @@
1
1
  declare const VERSION: string;
2
2
 
3
- type IUnsubscriber = () => void;
4
- interface ISubscription {
5
- unsubscribe: IUnsubscriber;
6
- add(item: ISubscription | IUnsubscriber): ISubscription;
7
- }
8
- interface IObservable<T> {
9
- subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
10
- pipe<T1>(op1: IOperator<T, T1>): IObservable<T1>;
11
- pipe<T1, T2>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>): IObservable<T2>;
12
- pipe<T1, T2, T3>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>): IObservable<T3>;
13
- pipe<T1, T2, T3, T4>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>, op4: IOperator<T3, T4>): IObservable<T4>;
14
- pipe<T1, T2, T3, T4, T5>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>, op4: IOperator<T3, T4>, op5: IOperator<T4, T5>): IObservable<T5>;
15
- }
16
- interface IValue<T> {
17
- getValue(): T;
18
- }
19
- interface IEmitter<T> {
20
- next(value: T): void;
21
- error?(value: Error | unknown): void;
22
- }
23
- interface IValueObservable<T> extends IObservable<T>, IValue<T> {
24
- }
25
- interface ISubject<T> extends IEmitter<T>, IObservable<T> {
26
- }
27
- interface IValueSubject<T> extends IEmitter<T>, IObservable<T>, IValue<T> {
28
- }
29
- type IListener<T> = IEmitter<T> | ((value: T) => void);
30
- type IOperator<TInput, TOutput = TInput> = (input: IObservable<TInput>) => IObservable<TOutput>;
3
+ type IUnsubscriber = () => void;
4
+ interface ISubscription {
5
+ unsubscribe: IUnsubscriber;
6
+ add(item: ISubscription | IUnsubscriber): ISubscription;
7
+ }
8
+ interface IObservable<T> {
9
+ subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
10
+ pipe<T1>(op1: IOperator<T, T1>): IObservable<T1>;
11
+ pipe<T1, T2>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>): IObservable<T2>;
12
+ pipe<T1, T2, T3>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>): IObservable<T3>;
13
+ pipe<T1, T2, T3, T4>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>, op4: IOperator<T3, T4>): IObservable<T4>;
14
+ pipe<T1, T2, T3, T4, T5>(op1: IOperator<T, T1>, op2: IOperator<T1, T2>, op3: IOperator<T2, T3>, op4: IOperator<T3, T4>, op5: IOperator<T4, T5>): IObservable<T5>;
15
+ }
16
+ interface IValue<T> {
17
+ getValue(): T;
18
+ }
19
+ interface IEmitter<T> {
20
+ next(value: T): void;
21
+ error?(value: Error | unknown): void;
22
+ }
23
+ interface IValueObservable<T> extends IObservable<T>, IValue<T> {
24
+ }
25
+ interface ISubject<T> extends IEmitter<T>, IObservable<T> {
26
+ }
27
+ interface IValueSubject<T> extends IEmitter<T>, IObservable<T>, IValue<T> {
28
+ }
29
+ type IListener<T> = IEmitter<T> | ((value: T) => void);
30
+ type IOperator<TInput, TOutput = TInput> = (input: IObservable<TInput>) => IObservable<TOutput>;
31
31
  type TypeOfObservable<TObservable> = TObservable extends IObservable<infer TType> ? TType : never;
32
32
 
33
- declare class Observable<T> implements IObservable<T> {
34
- constructor(subscribe?: (emitter: IEmitter<T>) => IUnsubscriber | ISubscription | void);
35
- subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
36
- pipe(...operators: IOperator<unknown, unknown>[]): IObservable<unknown>;
37
- protected _subscribe(_emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
33
+ declare class Observable<T> implements IObservable<T> {
34
+ constructor(subscribe?: (emitter: IEmitter<T>) => IUnsubscriber | ISubscription | void);
35
+ subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
36
+ pipe(...operators: IOperator<unknown, unknown>[]): IObservable<unknown>;
37
+ protected _subscribe(_emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
38
38
  }
39
39
 
40
- declare class Subject<T> extends Observable<T> implements ISubject<T> {
41
- private keyCounter;
42
- private subscribers;
43
- constructor();
44
- next(value: T): void;
45
- error(value: T): void;
46
- protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
40
+ declare class Subject<T> extends Observable<T> implements ISubject<T> {
41
+ private keyCounter;
42
+ private subscribers;
43
+ constructor();
44
+ next(value: T): void;
45
+ error(value: T): void;
46
+ protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
47
47
  }
48
48
 
49
- interface ILogger {
50
- log: (entry: ILogInputEntry) => void;
51
- createCustomLog: <TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry) => (...args: TArgs) => void;
52
- createComponentLog: (component: string) => IComponentLogger;
53
- getAllLogs: () => ILogEntry[];
54
- log$: IObservable<ILogEntry>;
55
- }
56
- interface ILogEntry {
57
- /**
58
- * Сообщение.
59
- */
60
- message: string;
61
- /**
62
- * Компонент, в котором залогировано событие. (модуль, класс или функция)
63
- */
64
- component: string;
65
- /**
66
- * Время, в которое случилось логируемое событие
67
- */
68
- timestamp: number;
69
- }
70
- type IComponentLogger = (entry: IComponentLogEntry) => void;
71
- type ILogInputEntry = Omit<ILogEntry, 'timestamp'>;
72
- interface IComponentLogEntry extends Omit<ILogInputEntry, 'component'>, IOptionalComponent {
73
- }
74
- interface IOptionalComponent {
75
- component?: ILogInputEntry['component'];
49
+ interface ILogger {
50
+ log: (entry: ILogInputEntry) => void;
51
+ createCustomLog: <TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry) => (...args: TArgs) => void;
52
+ createComponentLog: (component: string) => IComponentLogger;
53
+ getAllLogs: () => ILogEntry[];
54
+ log$: IObservable<ILogEntry>;
55
+ }
56
+ interface ILogEntry {
57
+ /**
58
+ * Сообщение.
59
+ */
60
+ message: string;
61
+ /**
62
+ * Компонент, в котором залогировано событие. (модуль, класс или функция)
63
+ */
64
+ component: string;
65
+ /**
66
+ * Время, в которое случилось логируемое событие
67
+ */
68
+ timestamp: number;
69
+ }
70
+ type IComponentLogger = (entry: IComponentLogEntry) => void;
71
+ type ILogInputEntry = Omit<ILogEntry, 'timestamp'>;
72
+ interface IComponentLogEntry extends Omit<ILogInputEntry, 'component'>, IOptionalComponent {
73
+ }
74
+ interface IOptionalComponent {
75
+ component?: ILogInputEntry['component'];
76
76
  }
77
77
 
78
- declare class Logger implements ILogger {
79
- log$: Subject<ILogEntry>;
80
- private logs;
81
- log: (inputEntry: ILogInputEntry) => void;
82
- createCustomLog<TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry): (...args: TArgs) => void;
83
- createComponentLog(component: string): IComponentLogger;
84
- getAllLogs: () => ILogEntry[];
78
+ declare class Logger implements ILogger {
79
+ log$: Subject<ILogEntry>;
80
+ private logs;
81
+ log: (inputEntry: ILogInputEntry) => void;
82
+ createCustomLog<TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry): (...args: TArgs) => void;
83
+ createComponentLog(component: string): IComponentLogger;
84
+ getAllLogs: () => ILogEntry[];
85
85
  }
86
86
 
87
87
  declare const noop: () => void;
88
88
 
89
- declare const assertNever: (x: never) => never;
89
+ declare const assertNever: (x: never) => never;
90
90
  declare const checkNever: (_x: never) => void;
91
91
 
92
- declare function assertNonNullable<T>(value: T, failMessage?: string): asserts value is NonNullable<T>;
93
- declare function assertNullable<T extends INullable = INullable>(value: unknown, failMessage?: string): asserts value is T;
94
- declare function isNonNullable<T>(value: T): value is NonNullable<T>;
95
- declare function isNullable<T extends INullable = INullable>(value: unknown): value is T;
92
+ declare function assertNonNullable<T>(value: T, failMessage?: string): asserts value is NonNullable<T>;
93
+ declare function assertNullable<T extends INullable = INullable>(value: unknown, failMessage?: string): asserts value is T;
94
+ declare function isNonNullable<T>(value: T): value is NonNullable<T>;
95
+ declare function isNullable<T extends INullable = INullable>(value: unknown): value is T;
96
96
  type INullable = null | undefined;
97
97
 
98
98
  declare const addScript: (scriptSrc: string, abortSignal: AbortSignal, timeout?: number) => Promise<void>;
99
99
 
100
- type Seconds = number;
101
- type Milliseconds = number;
102
- type bps = number;
103
- type Kbps = number;
104
- type Mbps = number;
105
- type Byte = number;
100
+ type Seconds = number;
101
+ type Milliseconds = number;
102
+ type bps = number;
103
+ type Kbps = number;
104
+ type Mbps = number;
105
+ type Byte = number;
106
106
  type Percentage = number;
107
107
 
108
108
  declare const now: () => Milliseconds;
109
109
 
110
- type AbortableDecorator = <Params extends unknown[] = void[], Return = void>(signal: AbortSignal, createGenerator: (...param: Params) => AsyncGenerator<unknown, Return, unknown>) => (...param: Params) => Promise<Return | undefined>;
110
+ type AbortableDecorator = <Params extends unknown[] = void[], Return = void>(signal: AbortSignal, createGenerator: (...param: Params) => AsyncGenerator<unknown, Return, unknown>) => (...param: Params) => Promise<Return | undefined>;
111
111
  declare const abortable: AbortableDecorator;
112
112
 
113
- type ExponentialBackoffConfig = Partial<{
114
- start: Milliseconds;
115
- factor: number;
116
- min: Milliseconds;
117
- max: Milliseconds;
118
- random: number;
119
- }>;
113
+ declare enum CurrentClientBrowser {
114
+ Unknown = "Unknown",
115
+ Yandex = "Yandex",
116
+ Chrome = "Chrome",
117
+ Chromium = "Chromium",
118
+ Firefox = "Firefox",
119
+ Safari = "Safari",
120
+ Opera = "Opera",
121
+ Edge = "Edge",
122
+ Rest = "Rest"
123
+ }
124
+ declare enum CurrentClientDevice {
125
+ Unknown = "Unknown",
126
+ Android = "Android",
127
+ iPhone = "iPhone",
128
+ iPad = "iPad",
129
+ iPod = "iPod",
130
+ RestMobile = "RestMobile",
131
+ Desktop = "Desktop"
132
+ }
133
+ type ICurrentBrowserInfo = {
134
+ browser: CurrentClientBrowser;
135
+ device: CurrentClientDevice;
136
+ };
137
+ declare const getCurrentBrowser: () => ICurrentBrowserInfo;
138
+
139
+ type ExponentialBackoffConfig = Partial<{
140
+ start: Milliseconds;
141
+ factor: number;
142
+ min: Milliseconds;
143
+ max: Milliseconds;
144
+ random: number;
145
+ }>;
120
146
  declare const getExponentialDelay: (errorsCount: number, { start, factor, max, min, random }?: ExponentialBackoffConfig) => Milliseconds;
121
147
 
122
- declare const get: (key: string) => string | undefined;
123
- declare const set: (key: string, value: string) => void;
124
- declare const has: (key: string) => boolean;
125
- declare const remove: (key: string) => void;
148
+ declare const isPersistent: () => boolean;
149
+ declare const get: (key: string) => string | undefined;
150
+ declare const set: (key: string, value: string) => void;
151
+ declare const has: (key: string) => boolean;
152
+ declare const remove: (key: string) => void;
126
153
  declare const clear: () => void;
127
154
 
128
155
  declare const iframeSafeStorage_d_clear: typeof clear;
129
156
  declare const iframeSafeStorage_d_get: typeof get;
130
157
  declare const iframeSafeStorage_d_has: typeof has;
158
+ declare const iframeSafeStorage_d_isPersistent: typeof isPersistent;
131
159
  declare const iframeSafeStorage_d_remove: typeof remove;
132
160
  declare const iframeSafeStorage_d_set: typeof set;
133
161
  declare namespace iframeSafeStorage_d {
@@ -135,45 +163,137 @@ declare namespace iframeSafeStorage_d {
135
163
  iframeSafeStorage_d_clear as clear,
136
164
  iframeSafeStorage_d_get as get,
137
165
  iframeSafeStorage_d_has as has,
166
+ iframeSafeStorage_d_isPersistent as isPersistent,
138
167
  iframeSafeStorage_d_remove as remove,
139
168
  iframeSafeStorage_d_set as set,
140
169
  };
141
170
  }
142
171
 
143
- declare class Subscription implements ISubscription {
144
- private subscriptions;
145
- unsubscribe(): void;
146
- add(item: ISubscription | IUnsubscriber): ISubscription;
172
+ declare enum VideoQuality {
173
+ INVARIANT = "Invariant quality",
174
+ Q_144P = "144p",
175
+ Q_240P = "240p",
176
+ Q_360P = "360p",
177
+ Q_480P = "480p",
178
+ Q_720P = "720p",
179
+ Q_1080P = "1080p",
180
+ Q_1440P = "1440p",
181
+ Q_2160P = "2160p",
182
+ Q_4320P = "4320p"
183
+ }
184
+ type ExactVideoQuality = Exclude<VideoQuality, VideoQuality.INVARIANT>;
185
+ /**
186
+ * Лимиты трактуются включительно
187
+ * Значение undefined снимает лимит
188
+ */
189
+ type QualityLimits = {
190
+ max?: ExactVideoQuality;
191
+ min?: ExactVideoQuality;
192
+ };
193
+
194
+ interface IError {
195
+ /**
196
+ * Код или другой идентификатор для статистики
197
+ */
198
+ id: string;
199
+ category: ErrorCategory;
200
+ /**
201
+ * Сообщение по которому можно разобрать что случилось
202
+ */
203
+ message: string;
204
+ /**
205
+ * Данные, полезные для отладки
206
+ */
207
+ data?: any;
208
+ /**
209
+ * Возникшее исключение
210
+ */
211
+ thrown?: Error | unknown;
212
+ }
213
+ interface IWarning {
214
+ /**
215
+ * Код или другой идентификатор для статистики
216
+ */
217
+ id: string;
218
+ /**
219
+ * Сообщение по которому можно разобрать что случилось
220
+ */
221
+ message: string;
222
+ /**
223
+ * Данные, полезные для отладки
224
+ */
225
+ data?: any;
226
+ }
227
+ declare enum ErrorCategory {
228
+ NETWORK = "network",
229
+ VIDEO_PIPELINE = "video_pipeline",
230
+ EXTERNAL_API = "external_api",
231
+ PARSER = "parser",
232
+ DOM = "dom",
233
+ WTF = "wtf"
234
+ }
235
+ interface IRange<Unit extends number = number> {
236
+ from: Unit;
237
+ to: Unit;
238
+ }
239
+ interface IRectangle<Unit extends number = number> {
240
+ width: Unit;
241
+ height: Unit;
147
242
  }
148
243
 
149
- declare class ValueSubject<T> extends Subject<T> implements IValueSubject<T> {
150
- private value;
151
- constructor(initialValue: T);
152
- next(value: T): void;
153
- error(value: T): void;
154
- getValue(): T;
155
- protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
244
+ declare const isHigher: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
245
+ declare const isHigherOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
246
+ declare const isLower: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
247
+ declare const isLowerOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
248
+ declare const getHighestQuality: (qualities: VideoQuality[]) => VideoQuality | undefined;
249
+ /**
250
+ * Выбирает качество, наиболее близкое к указанной высоте кадра, но не менее её.
251
+ * @param tolerance позволяет выбрать качество менее заданной высоты на величину погрешности (в процентах)
252
+ */
253
+ declare const videoHeightToQuality: (height: number, tolerance?: number) => ExactVideoQuality | undefined;
254
+ /**
255
+ * Выбирает качество описывающее заданные размеры видео потока, т.е. не меньше его.
256
+ */
257
+ declare const videoSizeToQuality: ({ width, height }: IRectangle) => ExactVideoQuality | undefined;
258
+ declare const videoQualityToHeight: (quality: ExactVideoQuality) => number;
259
+ declare const isInvariantQuality: (quality: VideoQuality) => quality is VideoQuality.INVARIANT;
260
+ declare const areQualitiesExact: (qualities: VideoQuality[]) => qualities is ExactVideoQuality[];
261
+ declare function assertQualityIsExact(quality: VideoQuality): asserts quality is ExactVideoQuality;
262
+
263
+ declare class Subscription implements ISubscription {
264
+ private subscriptions;
265
+ unsubscribe(): void;
266
+ add(item: ISubscription | IUnsubscriber): ISubscription;
156
267
  }
157
268
 
158
- /**
159
- * Создаёт Observable, который состоит из объектов, ключами которых являются последние значения исходных Observable.
160
- * Первое событие возникает тогда, когда каждый исходный Observable выдал хотя бы одно значение.
161
- */
162
- type CombineObservables<T extends Record<string, IObservable<unknown>>> = {
163
- [key in keyof T]: TypeOfObservable<T[key]>;
164
- };
269
+ declare class ValueSubject<T> extends Subject<T> implements IValueSubject<T> {
270
+ private value;
271
+ constructor(initialValue: T);
272
+ next(value: T): void;
273
+ error(value: T): void;
274
+ getValue(): T;
275
+ protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
276
+ }
277
+
278
+ /**
279
+ * Создаёт Observable, который состоит из объектов, ключами которых являются последние значения исходных Observable.
280
+ * Первое событие возникает тогда, когда каждый исходный Observable выдал хотя бы одно значение.
281
+ */
282
+ type CombineObservables<T extends Record<string, IObservable<unknown>>> = {
283
+ [key in keyof T]: TypeOfObservable<T[key]>;
284
+ };
165
285
  declare function combine<T extends Record<string, IObservable<unknown>>>(observables: T): IObservable<CombineObservables<T>>;
166
286
 
167
- declare function merge<T1, T2>(v1: IObservable<T1>, v2: IObservable<T2>): IObservable<T1 | T2>;
168
- declare function merge<T1, T2, T3>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>): IObservable<T1 | T2 | T3>;
169
- declare function merge<T1, T2, T3, T4>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>): IObservable<T1 | T2 | T3 | T4>;
170
- declare function merge<T1, T2, T3, T4, T5>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>): IObservable<T1 | T2 | T3 | T4 | T5>;
171
- declare function merge<T1, T2, T3, T4, T5, T6>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>): IObservable<T1 | T2 | T3 | T4 | T5 | T6>;
172
- declare function merge<T1, T2, T3, T4, T5, T6>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>): IObservable<T1 | T2 | T3 | T4 | T5 | T6>;
173
- declare function merge<T1, T2, T3, T4, T5, T6, T7>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
174
- declare function merge<T1, T2, T3, T4, T5, T6, T7, T8>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
175
- declare function merge<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>, v9: IObservable<T9>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
176
- declare function merge<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>, v9: IObservable<T9>, v10: IObservable<T10>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
287
+ declare function merge<T1, T2>(v1: IObservable<T1>, v2: IObservable<T2>): IObservable<T1 | T2>;
288
+ declare function merge<T1, T2, T3>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>): IObservable<T1 | T2 | T3>;
289
+ declare function merge<T1, T2, T3, T4>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>): IObservable<T1 | T2 | T3 | T4>;
290
+ declare function merge<T1, T2, T3, T4, T5>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>): IObservable<T1 | T2 | T3 | T4 | T5>;
291
+ declare function merge<T1, T2, T3, T4, T5, T6>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>): IObservable<T1 | T2 | T3 | T4 | T5 | T6>;
292
+ declare function merge<T1, T2, T3, T4, T5, T6>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>): IObservable<T1 | T2 | T3 | T4 | T5 | T6>;
293
+ declare function merge<T1, T2, T3, T4, T5, T6, T7>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
294
+ declare function merge<T1, T2, T3, T4, T5, T6, T7, T8>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
295
+ declare function merge<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>, v9: IObservable<T9>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
296
+ declare function merge<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>, v5: IObservable<T5>, v6: IObservable<T6>, v7: IObservable<T7>, v8: IObservable<T8>, v9: IObservable<T9>, v10: IObservable<T10>): IObservable<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
177
297
  declare function merge<R>(...observables: IObservable<unknown>[]): IObservable<R>;
178
298
 
179
299
  declare const _default$3: (time: Milliseconds) => IObservable<void>;
@@ -182,82 +302,46 @@ declare const _default$2: (time: Milliseconds) => IObservable<void>;
182
302
 
183
303
  declare const _default$1: <T>(values: T[]) => IObservable<T>;
184
304
 
185
- interface IEventTarget {
186
- addEventListener(type: string, handler: (...params: any[]) => void): void;
187
- removeEventListener(type: string, handler: (...params: any[]) => void): void;
188
- }
305
+ interface IEventTarget {
306
+ addEventListener(type: string, handler: (...params: any[]) => void): void;
307
+ removeEventListener(type: string, handler: (...params: any[]) => void): void;
308
+ }
189
309
  declare const _default: <T>(target: IEventTarget, eventName: string) => IObservable<T>;
190
310
 
191
311
  declare function buffer<T>(size: number): IOperator<T, T[]>;
192
312
 
193
- declare function debounce<T>(time: Milliseconds, config?: {
194
- leading: boolean;
195
- trailing: boolean;
313
+ declare function debounce<T>(time: Milliseconds, config?: {
314
+ leading: boolean;
315
+ trailing: boolean;
196
316
  }): IOperator<T>;
197
317
 
198
- declare function throttle<T>(time: number, config?: {
199
- leading: boolean;
200
- trailing: boolean;
318
+ declare function throttle<T>(time: number, config?: {
319
+ leading: boolean;
320
+ trailing: boolean;
201
321
  }): IOperator<T>;
202
322
 
203
- declare function filter<T, S extends T>(predicate: (value: T) => value is S): IOperator<T, S>;
323
+ declare function filter<T, S extends T>(predicate: (value: T) => value is S): IOperator<T, S>;
204
324
  declare function filter<T>(predicate: (value: T) => boolean): IOperator<T>;
205
325
 
206
- /**
207
- * Пропускает только события, содержащие значения, отличные от предыдущего
208
- */
326
+ /**
327
+ * Пропускает только события, содержащие значения, отличные от предыдущего
328
+ */
209
329
  declare function filterChanged<T>(equal?: (prev: T, next: T) => boolean): IOperator<T>;
210
330
 
211
331
  declare function map<T, S>(mapper: (value: T) => S): IOperator<T, S>;
212
332
 
213
333
  declare function mapTo<T, S>(value: S): IOperator<T, S>;
214
334
 
215
- /**
216
- * Отписывается от исходного потока после получения первого события.
217
- */
335
+ /**
336
+ * Отписывается от исходного потока после получения первого события.
337
+ */
218
338
  declare function once<T>(): IOperator<T>;
219
339
 
220
- type IPair<T> = [previous: T, current: T];
340
+ type IPair<T> = [previous: T, current: T];
221
341
  declare function pairwise<T>(): IOperator<T, IPair<T>>;
222
342
 
223
343
  declare function tap<T>(effect: (value: T) => void): IOperator<T>;
224
344
 
225
- interface IError {
226
- /**
227
- * Код или другой идентификатор для статистики
228
- */
229
- id: string;
230
- category: ErrorCategory;
231
- /**
232
- * Сообщение по которому можно разобрать что случилось
233
- */
234
- message: string;
235
- /**
236
- * Данные, полезные для отладки
237
- */
238
- data?: any;
239
- /**
240
- * Возникшее исключение
241
- */
242
- thrown?: Error | unknown;
243
- }
244
- declare enum ErrorCategory {
245
- NETWORK = "network",
246
- VIDEO_PIPELINE = "video_pipeline",
247
- EXTERNAL_API = "external_api",
248
- PARSER = "parser",
249
- DOM = "dom",
250
- WTF = "wtf"
251
- }
252
- interface IRange<Unit extends number = number> {
253
- from: Unit;
254
- to: Unit;
255
- }
256
- interface IRectangle<Unit extends number = number> {
257
- width: Unit;
258
- height: Unit;
259
- }
260
-
261
345
  declare const ACTIVE_LIVE_VALID_DELAY = 5;
262
346
 
263
- export { ACTIVE_LIVE_VALID_DELAY, Byte, ErrorCategory, ExponentialBackoffConfig, IComponentLogEntry, IComponentLogger, IEmitter, IError, IListener, ILogEntry, ILogInputEntry, ILogger, IObservable, IOperator, IRange, IRectangle, ISubject, ISubscription, IUnsubscriber, IValue, IValueObservable, IValueSubject, Kbps, Logger, Mbps, Milliseconds, Observable, Percentage, Seconds, Subject, Subscription, VERSION, ValueSubject, abortable, addScript, assertNever, assertNonNullable, assertNullable, bps, buffer, checkNever, combine, debounce, filter, filterChanged, _default as fromEvent, getExponentialDelay, _default$2 as interval, isNonNullable, isNullable, map, mapTo, merge, noop, now, _default$1 as observableFrom, once, pairwise, iframeSafeStorage_d as safeStorage, tap, throttle, _default$3 as timeout };
347
+ export { ACTIVE_LIVE_VALID_DELAY, Byte, CurrentClientBrowser, CurrentClientDevice, ErrorCategory, ExactVideoQuality, ExponentialBackoffConfig, IComponentLogEntry, IComponentLogger, ICurrentBrowserInfo, IEmitter, IError, IListener, ILogEntry, ILogInputEntry, ILogger, IObservable, IOperator, IRange, IRectangle, ISubject, ISubscription, IUnsubscriber, IValue, IValueObservable, IValueSubject, IWarning, Kbps, Logger, Mbps, Milliseconds, Observable, Percentage, QualityLimits, Seconds, Subject, Subscription, VERSION, ValueSubject, VideoQuality, abortable, addScript, areQualitiesExact, assertNever, assertNonNullable, assertNullable, assertQualityIsExact, bps, buffer, checkNever, combine, debounce, filter, filterChanged, _default as fromEvent, getCurrentBrowser, getExponentialDelay, getHighestQuality, _default$2 as interval, isHigher, isHigherOrEqual, isInvariantQuality, isLower, isLowerOrEqual, isNonNullable, isNullable, map, mapTo, merge, noop, now, _default$1 as observableFrom, once, pairwise, iframeSafeStorage_d as safeStorage, tap, throttle, _default$3 as timeout, videoHeightToQuality, videoQualityToHeight, videoSizeToQuality };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",