@vkontakte/videoplayer-shared 1.0.24-dev.fd1a076.0 → 1.0.24

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-dev.fd1a076.0
3
- * Wed, 10 May 2023 11:23:18 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.24
3
+ * Mon, 19 Jun 2023 11:52:56 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
5
5
  */
6
- "use strict";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`)},T=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 S 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 I{constructor(){this.log$=new S,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 A(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function N(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 E;const R=typeof((E=window.performance)===null||E===void 0?void 0:E.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(p){s(p)}}function d(f){try{h(n.throw(f))}catch(p){s(p)}}function h(f){f.done?i(f.value):a(f.value).then(o,d)}h((n=n.apply(r,e||[])).next())})}const V=(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}),C=(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 _=`vk-videoplayer-dummy-key-${Math.random()}`,G=()=>{try{localStorage.setItem(_,"test"),localStorage.removeItem(_),u=c.LOCAL_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(_),u=c.SESSION_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)u=c.RUNTIME;else throw e}else throw r}};G();const D=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)}},j=(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)}},U=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}},F=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)}},$=()=>{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 P=Object.freeze({__proto__:null,clear:$,get:D,has:U,remove:F,set:j});class k extends S{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 z(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 K(...r){return new l(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new v))}var W=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)}),Y=r=>new l(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),B=r=>new l(e=>{r.forEach(t=>e.next(t))}),X=(r,e)=>new l(t=>{const n=a=>t.next(a);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function q(r){return e=>new l(t=>e.subscribe(new H(t,r)))}class H{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 J={leading:!1,trailing:!0};function Q(r,e=J){return t=>new l(n=>t.subscribe(new Z(n,r,e)))}class Z{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 ee={leading:!0,trailing:!1};function te(r,e=ee){return t=>new l(n=>t.subscribe(new re(n,r,e)))}class re{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 ne(r){return e=>new l(t=>e.subscribe(new se(t,r)))}class se{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 ie(r=(e,t)=>e===t){return e=>new l(t=>e.subscribe(new oe(t,r)))}const g={};class oe{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 ae(t,r)))}let ae=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 ce(r){return L(()=>r)}function le(){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 ue(){return r=>new l(e=>r.subscribe(new de(e)))}class de{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 he(r){return e=>new l(t=>e.subscribe(new fe(t,r)))}class fe{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 be=5;exports.ACTIVE_LIVE_VALID_DELAY=be;exports.Logger=I;exports.Observable=l;exports.Subject=S;exports.Subscription=v;exports.ValueSubject=k;exports.abortable=V;exports.addScript=y;exports.assertNever=b;exports.assertNonNullable=A;exports.assertNullable=N;exports.buffer=q;exports.checkNever=T;exports.combine=z;exports.debounce=Q;exports.filter=ne;exports.filterChanged=ie;exports.fromEvent=X;exports.getExponentialDelay=C;exports.interval=Y;exports.isNonNullable=x;exports.isNullable=O;exports.map=L;exports.mapTo=ce;exports.merge=K;exports.noop=w;exports.now=R;exports.observableFrom=B;exports.once=le;exports.pairwise=ue;exports.safeStorage=P;exports.tap=he;exports.throttle=te;exports.timeout=W;
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;
package/es2015.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24-dev.fd1a076.0
3
- * Wed, 10 May 2023 11:23:18 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.24
3
+ * Mon, 19 Jun 2023 11:52:56 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
5
5
  */
6
- 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`)},K=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 W{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 B(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function X(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 Y=(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 E;const q=typeof((E=window.performance)===null||E===void 0?void 0:E.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(p){s(p)}}function h(f){try{d(n.throw(f))}catch(p){s(p)}}function d(f){f.done?i(f.value):a(f.value).then(o,h)}d((n=n.apply(r,e||[])).next())})}const H=(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}),J=(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)}},y=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}},N=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 Q=Object.freeze({__proto__:null,clear:M,get:A,has:y,remove:N,set:R});class Z 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 ee(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 te(...r){return new u(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new m))}var re=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)}),ne=r=>new u(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),se=r=>new u(e=>{r.forEach(t=>e.next(t))}),ie=(r,e)=>new u(t=>{const n=a=>t.next(a);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function oe(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 ae(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 ce(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 ue(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 le(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 de(r){return $(()=>r)}function fe(){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 be(){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 we(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 ve=5;export{ve as ACTIVE_LIVE_VALID_DELAY,g as ErrorCategory,W as Logger,u as Observable,x as Subject,m as Subscription,Z as ValueSubject,H as abortable,Y as addScript,b as assertNever,B as assertNonNullable,X as assertNullable,oe as buffer,K as checkNever,ee as combine,ae as debounce,ue as filter,le as filterChanged,ie as fromEvent,J as getExponentialDelay,ne as interval,O as isNonNullable,L as isNullable,$ as map,de as mapTo,te as merge,w as noop,q as now,se as observableFrom,fe as once,be as pairwise,Q as safeStorage,we as tap,ce as throttle,re as timeout};
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};
package/es2018.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24-dev.fd1a076.0
3
- * Wed, 10 May 2023 11:23:18 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.24
3
+ * Mon, 19 Jun 2023 11:52:56 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
5
5
  */
6
- "use strict";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`)},L=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 O{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 T(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function I(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 A=(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 N=typeof((m=window.performance)===null||m===void 0?void 0:m.now)=="function"?()=>window.performance.now():()=>Date.now(),R=(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},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 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()}`,V=()=>{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}};V();const M=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)}},C=(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)}},G=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}},D=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)}},U=()=>{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 j=Object.freeze({__proto__:null,clear:U,get:M,has:G,remove:D,set:C});class F 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 P(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 $(...r){return new l(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new w))}var k=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)}),z=r=>new l(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),K=r=>new l(e=>{r.forEach(t=>e.next(t))}),W=(r,e)=>new l(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function Y(r){return e=>new l(t=>e.subscribe(new B(t,r)))}class B{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 X={leading:!1,trailing:!0};function q(r,e=X){return t=>new l(s=>t.subscribe(new H(s,r,e)))}class H{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 J={leading:!0,trailing:!1};function Q(r,e=J){return t=>new l(s=>t.subscribe(new Z(s,r,e)))}class Z{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 ee(r){return e=>new l(t=>e.subscribe(new te(t,r)))}class te{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 re(r=(e,t)=>e===t){return e=>new l(t=>e.subscribe(new se(t,r)))}const S={};class se{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 ne(t,r)))}let ne=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 ie(r){return x(()=>r)}function oe(){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 ae(){return r=>new l(e=>r.subscribe(new ce(e)))}class ce{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 le(r){return e=>new l(t=>e.subscribe(new ue(t,r)))}class ue{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 he=5;exports.ACTIVE_LIVE_VALID_DELAY=he;exports.Logger=O;exports.Observable=l;exports.Subject=p;exports.Subscription=w;exports.ValueSubject=F;exports.abortable=R;exports.addScript=A;exports.assertNever=f;exports.assertNonNullable=T;exports.assertNullable=I;exports.buffer=Y;exports.checkNever=L;exports.combine=P;exports.debounce=q;exports.filter=ee;exports.filterChanged=re;exports.fromEvent=W;exports.getExponentialDelay=y;exports.interval=z;exports.isNonNullable=_;exports.isNullable=g;exports.map=x;exports.mapTo=ie;exports.merge=$;exports.noop=b;exports.now=N;exports.observableFrom=K;exports.once=oe;exports.pairwise=ae;exports.safeStorage=j;exports.tap=le;exports.throttle=Q;exports.timeout=k;
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;
package/es2018.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24-dev.fd1a076.0
3
- * Wed, 10 May 2023 11:23:18 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.24
3
+ * Mon, 19 Jun 2023 11:52:56 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
5
5
  */
6
- 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`)},$=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 S 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 z{constructor(){this.log$=new S,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 K(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 W=(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 B=typeof((m=window.performance)===null||m===void 0?void 0:m.now)=="function"?()=>window.performance.now():()=>Date.now(),X=(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},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 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 q=Object.freeze({__proto__:null,clear:R,get:L,has:I,remove:A,set:T});class H extends S{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 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 Q(...r){return new u(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new v))}var Z=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)}),ee=r=>new u(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),te=r=>new u(e=>{r.forEach(t=>e.next(t))}),re=(r,e)=>new u(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function se(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 ne(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 ie(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 oe(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 ae(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 ue(r){return U(()=>r)}function le(){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 he(){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 de(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 _;(function(r){r.NETWORK="network",r.VIDEO_PIPELINE="video_pipeline",r.EXTERNAL_API="external_api",r.PARSER="parser",r.DOM="dom",r.WTF="wtf"})(_||(_={}));const fe=5;export{fe as ACTIVE_LIVE_VALID_DELAY,_ as ErrorCategory,z as Logger,u as Observable,S as Subject,v as Subscription,H as ValueSubject,X as abortable,W as addScript,f 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,g as isNonNullable,x as isNullable,U as map,ue as mapTo,Q as merge,b 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 $="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};
package/esnext.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24-dev.fd1a076.0
3
- * Wed, 10 May 2023 11:23:18 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.24
3
+ * Mon, 19 Jun 2023 11:52:56 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
5
5
  */
6
- "use strict";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`)},O=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 T{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 v(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function I(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function S(r){return typeof r<"u"&&r!==null}function x(r){return r==null}const _=(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)}),A=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),N=(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},R=(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 V=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)}},M=(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)}},C=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}},G=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)}},D=()=>{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 U=Object.freeze({__proto__:null,clear:D,get:V,has:C,remove:G,set:M});class j 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 F(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 P(...r){return new c(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new b))}var $=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)}),z=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))}),K=(r,e)=>new c(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function W(r){return e=>new c(t=>e.subscribe(new Y(t,r)))}class Y{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 B={leading:!1,trailing:!0};function X(r,e=B){return t=>new c(s=>t.subscribe(new q(s,r,e)))}class q{destination;time;config;lastValue;timeout;constructor(e,t,s){this.destination=e,this.time=t,this.config=s}next(e){this.lastValue=e,S(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 H={leading:!0,trailing:!1};function J(r,e=H){return t=>new c(s=>t.subscribe(new Q(s,r,e)))}class Q{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 Z(r){return e=>new c(t=>e.subscribe(new ee(t,r)))}class ee{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 te(r=(e,t)=>e===t){return e=>new c(t=>e.subscribe(new re(t,r)))}const g={};class re{destination;predicate;lastValue=g;constructor(e,t){this.destination=e,this.predicate=t}next(e){let t;try{t=this.lastValue===g||!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 se(t,r)))}let se=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 ne(r){return L(()=>r)}function ie(){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 oe(){return r=>new c(e=>r.subscribe(new ae(e)))}class ae{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 ce(r){return e=>new c(t=>e.subscribe(new ue(t,r)))}class ue{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 le=5;exports.ACTIVE_LIVE_VALID_DELAY=le;exports.Logger=T;exports.Observable=c;exports.Subject=p;exports.Subscription=b;exports.ValueSubject=j;exports.abortable=N;exports.addScript=_;exports.assertNever=d;exports.assertNonNullable=v;exports.assertNullable=I;exports.buffer=W;exports.checkNever=O;exports.combine=F;exports.debounce=X;exports.filter=Z;exports.filterChanged=te;exports.fromEvent=K;exports.getExponentialDelay=R;exports.interval=z;exports.isNonNullable=S;exports.isNullable=x;exports.map=L;exports.mapTo=ne;exports.merge=P;exports.noop=f;exports.now=A;exports.observableFrom=k;exports.once=ie;exports.pairwise=oe;exports.safeStorage=U;exports.tap=ce;exports.throttle=J;exports.timeout=$;
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;
package/esnext.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24-dev.fd1a076.0
3
- * Wed, 10 May 2023 11:23:18 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.24
3
+ * Mon, 19 Jun 2023 11:52:56 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
5
5
  */
6
- 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`)},P=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 ${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 z(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 K=(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)}),W=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),B=(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},X=(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)}},v=(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)}},I=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 Y=Object.freeze({__proto__:null,clear:A,get:T,has:I,remove:_,set:v});class q 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 H(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 J(...r){return new c(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new w))}var Q=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)}),Z=r=>new c(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),ee=r=>new c(e=>{r.forEach(t=>e.next(t))}),te=(r,e)=>new c(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function re(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 se(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 ne(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 ie(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 oe(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 ce(r){return D(()=>r)}function ue(){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 le(){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 he(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 de=5;export{de as ACTIVE_LIVE_VALID_DELAY,S as ErrorCategory,$ as Logger,c as Observable,g as Subject,w as Subscription,q as ValueSubject,B as abortable,K as addScript,d as assertNever,z as assertNonNullable,k as assertNullable,re as buffer,P as checkNever,H as combine,se as debounce,ie as filter,oe as filterChanged,te as fromEvent,X as getExponentialDelay,Z as interval,x as isNonNullable,O as isNullable,D as map,ce as mapTo,J as merge,f as noop,W as now,ee as observableFrom,ue as once,le as pairwise,Y as safeStorage,he as tap,ne as throttle,Q as timeout};
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};
package/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.24-dev.fd1a076.0
3
- * Wed, 10 May 2023 11:23:18 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.24
3
+ * Mon, 19 Jun 2023 11:52:56 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
5
5
  */
6
- 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`)},P=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 ${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 z(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 K=(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)}),W=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),B=(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},X=(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)}},v=(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)}},I=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 Y=Object.freeze({__proto__:null,clear:A,get:T,has:I,remove:_,set:v});class q 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 H(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 J(...r){return new c(e=>r.reduce((t,s)=>t.add(s.subscribe(e)),new w))}var Q=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)}),Z=r=>new c(e=>{const t=window.setInterval(()=>e.next(),r);return()=>window.clearInterval(t)}),ee=r=>new c(e=>{r.forEach(t=>e.next(t))}),te=(r,e)=>new c(t=>{const s=a=>t.next(a);return r.addEventListener(e,s),()=>r.removeEventListener(e,s)});function re(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 se(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 ne(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 ie(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 oe(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 ce(r){return D(()=>r)}function ue(){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 le(){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 he(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 de=5;export{de as ACTIVE_LIVE_VALID_DELAY,S as ErrorCategory,$ as Logger,c as Observable,g as Subject,w as Subscription,q as ValueSubject,B as abortable,K as addScript,d as assertNever,z as assertNonNullable,k as assertNullable,re as buffer,P as checkNever,H as combine,se as debounce,ie as filter,oe as filterChanged,te as fromEvent,X as getExponentialDelay,Z as interval,x as isNonNullable,O as isNullable,D as map,ce as mapTo,J as merge,f as noop,W as now,ee as observableFrom,ue as once,le as pairwise,Y as safeStorage,he as tap,ne as throttle,Q as timeout};
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};
package/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ declare const VERSION: string;
2
+
1
3
  type IUnsubscriber = () => void;
2
4
  interface ISubscription {
3
5
  unsubscribe: IUnsubscriber;
@@ -100,7 +102,8 @@ type Milliseconds = number;
100
102
  type bps = number;
101
103
  type Kbps = number;
102
104
  type Mbps = number;
103
- type Byte = number;
105
+ type Byte = number;
106
+ type Percentage = number;
104
107
 
105
108
  declare const now: () => Milliseconds;
106
109
 
@@ -257,4 +260,4 @@ interface IRectangle<Unit extends number = number> {
257
260
 
258
261
  declare const ACTIVE_LIVE_VALID_DELAY = 5;
259
262
 
260
- 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, Seconds, Subject, Subscription, 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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.24-dev.fd1a076.0",
3
+ "version": "1.0.24",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",