@vkontakte/videoplayer-shared 1.0.23 → 1.0.24-beta.1
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 +4 -4
- package/es2015.esm.js +4 -4
- package/es2018.cjs.js +4 -4
- package/es2018.esm.js +4 -4
- package/esnext.cjs.js +4 -4
- package/esnext.esm.js +4 -4
- package/evergreen.esm.js +4 -4
- package/index.d.ts +26 -2
- package/package.json +1 -1
package/es2015.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.24-beta.1
|
|
3
|
+
* Tue, 23 May 2023 15:50:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";class
|
|
6
|
+
"use strict";const T="1.0.24-beta.1";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.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.24-beta.1
|
|
3
|
+
* Tue, 23 May 2023 15:50:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
|
|
5
5
|
*/
|
|
6
|
-
class
|
|
6
|
+
const K="1.0.24-beta.1";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.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.24-beta.1
|
|
3
|
+
* Tue, 23 May 2023 15:50:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";class
|
|
6
|
+
"use strict";const L="1.0.24-beta.1";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.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.24-beta.1
|
|
3
|
+
* Tue, 23 May 2023 15:50:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
|
|
5
5
|
*/
|
|
6
|
-
class
|
|
6
|
+
const $="1.0.24-beta.1";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.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.24-beta.1
|
|
3
|
+
* Tue, 23 May 2023 15:50:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";class
|
|
6
|
+
"use strict";const O="1.0.24-beta.1";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.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.24-beta.1
|
|
3
|
+
* Tue, 23 May 2023 15:50:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
|
|
5
5
|
*/
|
|
6
|
-
class
|
|
6
|
+
const P="1.0.24-beta.1";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.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.24-beta.1
|
|
3
|
+
* Tue, 23 May 2023 15:50:45 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-24/doc/
|
|
5
5
|
*/
|
|
6
|
-
class
|
|
6
|
+
const P="1.0.24-beta.1";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
|
|
|
@@ -116,6 +119,27 @@ type ExponentialBackoffConfig = Partial<{
|
|
|
116
119
|
}>;
|
|
117
120
|
declare const getExponentialDelay: (errorsCount: number, { start, factor, max, min, random }?: ExponentialBackoffConfig) => Milliseconds;
|
|
118
121
|
|
|
122
|
+
declare const get: (key: string) => string | undefined;
|
|
123
|
+
declare const set: (key: string, value: string) => void;
|
|
124
|
+
declare const has: (key: string) => boolean;
|
|
125
|
+
declare const remove: (key: string) => void;
|
|
126
|
+
declare const clear: () => void;
|
|
127
|
+
|
|
128
|
+
declare const iframeSafeStorage_d_clear: typeof clear;
|
|
129
|
+
declare const iframeSafeStorage_d_get: typeof get;
|
|
130
|
+
declare const iframeSafeStorage_d_has: typeof has;
|
|
131
|
+
declare const iframeSafeStorage_d_remove: typeof remove;
|
|
132
|
+
declare const iframeSafeStorage_d_set: typeof set;
|
|
133
|
+
declare namespace iframeSafeStorage_d {
|
|
134
|
+
export {
|
|
135
|
+
iframeSafeStorage_d_clear as clear,
|
|
136
|
+
iframeSafeStorage_d_get as get,
|
|
137
|
+
iframeSafeStorage_d_has as has,
|
|
138
|
+
iframeSafeStorage_d_remove as remove,
|
|
139
|
+
iframeSafeStorage_d_set as set,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
119
143
|
declare class Subscription implements ISubscription {
|
|
120
144
|
private subscriptions;
|
|
121
145
|
unsubscribe(): void;
|
|
@@ -236,4 +260,4 @@ interface IRectangle<Unit extends number = number> {
|
|
|
236
260
|
|
|
237
261
|
declare const ACTIVE_LIVE_VALID_DELAY = 5;
|
|
238
262
|
|
|
239
|
-
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, 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 };
|