@vkontakte/videoplayer-shared 1.0.5 → 1.0.6

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/index.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.5
3
- * Wed, 20 Oct 2021 11:37:08 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.6
3
+ * Mon, 17 Jan 2022 11:13:38 GMT
4
4
  */
5
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>"function"==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?"function"==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:r,error:r};const o="function"==typeof s?{next:s,error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},u=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof u){case"function":return void u();case"object":return void u.unsubscribe();case"undefined":return;default:return e(u)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}const u={leading:!1,trailing:!0};class c{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,i(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const a={leading:!0,trailing:!1};class l{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,o(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time))}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class h{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const d={};class b{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=d}next(t){let e;try{e=this.lastValue===d||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function p(t){return e=>new s((r=>e.subscribe(new x(r,t))))}class x{constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class w{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class v{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}exports.Logger=class{constructor(){this.log$=new n,this.logs=[],this.log=t=>{const e=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>Object.assign({component:t},e)))}},exports.Observable=s,exports.Subject=n,exports.Subscription=t,exports.ValueSubject=class extends n{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const e=super._subscribe(t);return t.next(this.value),e}},exports.addScript=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener("abort",(()=>{u(),a.remove()}));const i=()=>{u(),n()},o=()=>{u(),s()},u=()=>{c&&clearTimeout(c),a.removeEventListener("load",o),a.removeEventListener("error",i)};let c;r&&(c=window.setTimeout(i,r));const a=document.createElement("script");a.addEventListener("load",o),a.addEventListener("error",i),a.src=t,document.head.appendChild(a)})),exports.assertNever=e,exports.assertNonNullable=function(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)},exports.assertNullable=function(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)},exports.checkNever=t=>{},exports.combine=function(e){return new s((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))},exports.debounce=function(t,e=u){return r=>new s((s=>r.subscribe(new c(s,t,e))))},exports.filter=function(t){return e=>new s((r=>e.subscribe(new h(r,t))))},exports.filterChanged=function(t=((t,e)=>t===e)){return e=>new s((r=>e.subscribe(new b(r,t))))},exports.fromEvent=(t,e)=>new s((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)})),exports.isNonNullable=i,exports.isNullable=o,exports.map=p,exports.mapTo=function(t){return p((()=>t))},exports.merge=function(...e){return new s((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))},exports.noop=r,exports.observableFrom=t=>new s((e=>{t.forEach((t=>e.next(t)))})),exports.once=function(){return t=>new s((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))},exports.pairwise=function(){return t=>new s((e=>t.subscribe(new w(e))))},exports.tap=function(t){return e=>new s((r=>e.subscribe(new v(r,t))))},exports.throttle=function(t,e=a){return r=>new s((s=>r.subscribe(new l(s,t,e))))},exports.timeout=t=>new s((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)}));
5
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>"function"==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?"function"==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:r,error:r};const o="function"==typeof s?{next:t=>{try{s(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case"function":return void c();case"object":return void c.unsubscribe();case"undefined":return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}var c;const u="function"==typeof(null===(c=window.performance)||void 0===c?void 0:c.now)?()=>window.performance.now():()=>Date.now();const a={leading:!1,trailing:!0};class l{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,i(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const h={leading:!0,trailing:!1};class d{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,o(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time))}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class b{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const p={};class x{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=p}next(t){let e;try{e=this.lastValue===p||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function w(t){return e=>new s((r=>e.subscribe(new v(r,t))))}class v{constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class f{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class m{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}exports.Logger=class{constructor(){this.log$=new n,this.logs=[],this.log=t=>{const e=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>Object.assign({component:t},e)))}},exports.Observable=s,exports.Subject=n,exports.Subscription=t,exports.ValueSubject=class extends n{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const e=super._subscribe(t);return t.next(this.value),e}},exports.addScript=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener("abort",(()=>{c(),a.remove()}));const i=()=>{c(),n()},o=()=>{c(),s()},c=()=>{u&&clearTimeout(u),a.removeEventListener("load",o),a.removeEventListener("error",i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement("script");a.addEventListener("load",o),a.addEventListener("error",i),a.src=t,document.head.appendChild(a)})),exports.assertNever=e,exports.assertNonNullable=function(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)},exports.assertNullable=function(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)},exports.checkNever=t=>{},exports.combine=function(e){return new s((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))},exports.debounce=function(t,e=a){return r=>new s((s=>r.subscribe(new l(s,t,e))))},exports.filter=function(t){return e=>new s((r=>e.subscribe(new b(r,t))))},exports.filterChanged=function(t=((t,e)=>t===e)){return e=>new s((r=>e.subscribe(new x(r,t))))},exports.fromEvent=(t,e)=>new s((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)})),exports.isNonNullable=i,exports.isNullable=o,exports.map=w,exports.mapTo=function(t){return w((()=>t))},exports.merge=function(...e){return new s((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))},exports.noop=r,exports.now=u,exports.observableFrom=t=>new s((e=>{t.forEach((t=>e.next(t)))})),exports.once=function(){return t=>new s((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))},exports.pairwise=function(){return t=>new s((e=>t.subscribe(new f(e))))},exports.tap=function(t){return e=>new s((r=>e.subscribe(new m(r,t))))},exports.throttle=function(t,e=h){return r=>new s((s=>r.subscribe(new d(s,t,e))))},exports.timeout=t=>new s((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)}));
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.5
3
- * Wed, 20 Oct 2021 11:37:08 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.6
3
+ * Mon, 17 Jan 2022 11:13:38 GMT
4
4
  */
5
- class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>"function"==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=t=>{},s=()=>{};class n{constructor(t){t&&(this._subscribe=t)}subscribe(r,n){let i;i=n?"function"==typeof n?{next:n,error:s}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:s,error:s};const o="function"==typeof r?{next:r,error:t=>i.next(t)}:{next:t=>r.next(t),error:t=>r.error?r.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=s,o.error=s,typeof c){case"function":return void c();case"object":return void c.unsubscribe();case"undefined":return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class i extends n{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}class o{constructor(){this.log$=new i,this.logs=[],this.log=t=>{const e=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>Object.assign({component:t},e)))}}function c(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)}function u(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)}function a(t){return null!=t}function l(t){return null==t}const h=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener("abort",(()=>{c(),a.remove()}));const i=()=>{c(),n()},o=()=>{c(),s()},c=()=>{u&&clearTimeout(u),a.removeEventListener("load",o),a.removeEventListener("error",i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement("script");a.addEventListener("load",o),a.addEventListener("error",i),a.src=t,document.head.appendChild(a)}));class d extends i{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const e=super._subscribe(t);return t.next(this.value),e}}function b(e){return new n((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))}function w(...e){return new n((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))}var v=t=>new n((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)})),f=t=>new n((e=>{t.forEach((t=>e.next(t)))})),x=(t,e)=>new n((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)}));const m={leading:!1,trailing:!0};function p(t,e=m){return r=>new n((s=>r.subscribe(new g(s,t,e))))}class g{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,a(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const L={leading:!0,trailing:!1};function E(t,e=L){return r=>new n((s=>r.subscribe(new y(s,t,e))))}class y{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,l(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time))}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function V(t){return e=>new n((r=>e.subscribe(new C(r,t))))}class C{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function T(t=((t,e)=>t===e)){return e=>new n((r=>e.subscribe(new _(r,t))))}const j={};class _{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=j}next(t){let e;try{e=this.lastValue===j||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function O(t){return e=>new n((r=>e.subscribe(new k(r,t))))}class k{constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function A(t){return O((()=>t))}function $(){return t=>new n((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))}function D(){return t=>new n((e=>t.subscribe(new M(e))))}class M{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function P(t){return e=>new n((r=>e.subscribe(new q(r,t))))}class q{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}export{o as Logger,n as Observable,i as Subject,t as Subscription,d as ValueSubject,h as addScript,e as assertNever,c as assertNonNullable,u as assertNullable,r as checkNever,b as combine,p as debounce,V as filter,T as filterChanged,x as fromEvent,a as isNonNullable,l as isNullable,O as map,A as mapTo,w as merge,s as noop,f as observableFrom,$ as once,D as pairwise,P as tap,E as throttle,v as timeout};
5
+ class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>"function"==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=t=>{},s=()=>{};class n{constructor(t){t&&(this._subscribe=t)}subscribe(r,n){let i;i=n?"function"==typeof n?{next:n,error:s}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:s,error:s};const o="function"==typeof r?{next:t=>{try{r(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>r.next(t),error:t=>r.error?r.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=s,o.error=s,typeof c){case"function":return void c();case"object":return void c.unsubscribe();case"undefined":return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class i extends n{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}class o{constructor(){this.log$=new i,this.logs=[],this.log=t=>{const e=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>Object.assign({component:t},e)))}}function c(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)}function u(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)}function a(t){return null!=t}function l(t){return null==t}const h=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener("abort",(()=>{c(),a.remove()}));const i=()=>{c(),n()},o=()=>{c(),s()},c=()=>{u&&clearTimeout(u),a.removeEventListener("load",o),a.removeEventListener("error",i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement("script");a.addEventListener("load",o),a.addEventListener("error",i),a.src=t,document.head.appendChild(a)}));var d;const b="function"==typeof(null===(d=window.performance)||void 0===d?void 0:d.now)?()=>window.performance.now():()=>Date.now();class w extends i{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const e=super._subscribe(t);return t.next(this.value),e}}function v(e){return new n((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))}function f(...e){return new n((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))}var x=t=>new n((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)})),m=t=>new n((e=>{t.forEach((t=>e.next(t)))})),p=(t,e)=>new n((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)}));const g={leading:!1,trailing:!0};function L(t,e=g){return r=>new n((s=>r.subscribe(new y(s,t,e))))}class y{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,a(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const E={leading:!0,trailing:!1};function V(t,e=E){return r=>new n((s=>r.subscribe(new C(s,t,e))))}class C{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,l(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time))}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function T(t){return e=>new n((r=>e.subscribe(new j(r,t))))}class j{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function _(t=((t,e)=>t===e)){return e=>new n((r=>e.subscribe(new k(r,t))))}const O={};class k{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=O}next(t){let e;try{e=this.lastValue===O||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function A(t){return e=>new n((r=>e.subscribe(new $(r,t))))}class ${constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function D(t){return A((()=>t))}function M(){return t=>new n((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))}function P(){return t=>new n((e=>t.subscribe(new q(e))))}class q{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function z(t){return e=>new n((r=>e.subscribe(new B(r,t))))}class B{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}export{o as Logger,n as Observable,i as Subject,t as Subscription,w as ValueSubject,h as addScript,e as assertNever,c as assertNonNullable,u as assertNullable,r as checkNever,v as combine,L as debounce,T as filter,_ as filterChanged,p as fromEvent,a as isNonNullable,l as isNullable,A as map,D as mapTo,f as merge,s as noop,b as now,m as observableFrom,M as once,P as pairwise,z as tap,V as throttle,x as timeout};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",
package/utils/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { assertNever, checkNever } from './never';
3
3
  export { isNonNullable, isNullable, assertNonNullable, assertNullable } from './nullable';
4
4
  export { addScript } from './addScript';
5
5
  export type { Milliseconds, bps, Byte, Seconds, Kbps, Mbps } from './semanticTypes';
6
+ export { now } from './now';
package/utils/now.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { Milliseconds } from './semanticTypes';
2
+ export declare const now: () => Milliseconds;