@vkontakte/videoplayer-shared 1.0.32-dev.0f82d9ff.0 → 1.0.32-dev.eddd3f7a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esnext.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.32-dev.0f82d9ff.0
3
- * Fri, 26 Jan 2024 03:16:46 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.32-dev.eddd3f7a.0
3
+ * Tue, 30 Jan 2024 06:25:12 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-32/doc/
5
5
  */
6
- "use strict";const q="1.0.32-dev.0f82d9ff.0";class v{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const p=e=>{throw new Error(`${e} is value of unexpected type`)},F=e=>{},m=()=>{};class l{constructor(t){t&&(this._subscribe=t)}subscribe(t,r){let n;r?typeof r=="function"?n={next:r,error:m}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:m,error:m};const s=typeof t=="function"?{next:o=>{try{t(o)}catch(u){n.next(u)}},error:o=>n.next(o)}:{next:o=>t.next(o),error:o=>t.error?t.error(o):n.next(o)};let i;try{i=this._subscribe(s)}catch(o){s.error?.(o)}return new v().add(()=>{switch(s.next=m,s.error=m,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return p(i)}})}pipe(...t){return t.reduce((r,n)=>n(r),this)}_subscribe(t){}}class A extends l{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(r=>r.next(t))}error(t){this.subscribers.forEach(r=>r.error?.(t))}_subscribe(t){const r=this.keyCounter++;return this.subscribers.set(r,t),new v().add(()=>this.subscribers.delete(r))}}class U{log$=new A;logs=[];log=t=>{const r={...t,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};createCustomLog(t){return(...r)=>{let n;try{n=t(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(r=>({component:t,...r}))}getAllLogs=()=>this.logs}function G(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function B(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function T(e){return typeof e<"u"&&e!==null}function I(e){return e==null}function z(e,t){if(!e?.length)throw new Error(t)}function H(e,t){if(e?.length)throw new Error(t)}const $=(e,t,r)=>new Promise((n,s)=>{t.addEventListener("abort",()=>{u(),c.remove()});const i=()=>{u(),s()},o=()=>{u(),n()},u=()=>{h&&clearTimeout(h),c.removeEventListener("load",o),c.removeEventListener("error",i)};let h;r&&(h=window.setTimeout(i,r));const c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",i),c.src=e,document.head.appendChild(c)}),Y=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),W=(e,t)=>async(...r)=>{const n=t(...r);let s=e.aborted,i;for(;!s&&!e.aborted;){const o=await n.next(i);s=o.done??!1,i=o.value}return i};exports.CurrentClientBrowser=void 0;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const x=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?exports.CurrentClientBrowser.Yandex:void 0,r=/chrome|crios/i.test(e)?exports.CurrentClientBrowser.Chrome:void 0,n=/chromium/i.test(e)?exports.CurrentClientBrowser.Chromium:void 0,s=/firefox|fxios/i.test(e)?exports.CurrentClientBrowser.Firefox:void 0,i=/webkit|safari|khtml/i.test(e)?exports.CurrentClientBrowser.Safari:void 0,o=/opr\//i.test(e)?exports.CurrentClientBrowser.Opera:void 0,u=/edg/i.test(e)?exports.CurrentClientBrowser.Edge:void 0,h=/android/i.test(e)?exports.CurrentClientDevice.Android:void 0,c=/iphone/i.test(e)?exports.CurrentClientDevice.iPhone:void 0,f=/ipad/i.test(e)?exports.CurrentClientDevice.iPad:void 0,b=/ipod/i.test(e)?exports.CurrentClientDevice.iPod:void 0,g=/mac/i.test(e)?exports.CurrentClientDevice.Mac:void 0,S=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:t||s||o||u||r||n||i||exports.CurrentClientBrowser.Rest,device:h||c||f||b||S||g||exports.CurrentClientDevice.Desktop}},K=(e=!1)=>{const r=[exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(x().device);if(!e)return r;const{userAgent:n,maxTouchPoints:s}=window.navigator;return!!(r||/macintosh/i.test(n)&&s>0)},X=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const r=t[1],n=parseFloat(r);return isNaN(n)?null:n},J=()=>[exports.CurrentClientDevice.Mac,exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(x().device),Z=(e,{start:t=0,factor:r=2,max:n=1/0,min:s=t,random:i=0}={})=>{let o=t;return o*=r**e,o*=1+(Math.random()*i*2-i),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,s),o};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));let E,w;const O=`vk-videoplayer-dummy-key-${Math.random()}`,y=()=>{if(w!==void 0)return w;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),w=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),w=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)w=a.RUNTIME;else throw t}else throw e}return w===a.RUNTIME&&(E=new Map),w},ee=()=>y()===a.LOCAL_STORAGE,te=e=>{const t=y();switch(t){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return E?.get(e);default:p(t)}},re=(e,t)=>{const r=y();switch(r){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.RUNTIME:return void E?.set(e,t);default:p(r)}},ne=e=>{const t=y();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return E?.has(e)??!1;default:return p(t),!1}},ie=e=>{const t=y();switch(t){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void E?.delete(e);default:p(t)}},se=()=>{const e=y();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return E?.clear();default:p(e)}};var oe=Object.freeze({__proto__:null,clear:se,get:te,has:ne,isPersistent:ee,remove:ie,set:re});const ae=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}};exports.VideoQuality=void 0;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const d={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},ce=(e,t)=>d[e].height>d[t].height,le=(e,t)=>d[e].height>=d[t].height,C=(e,t)=>d[e].height<d[t].height,ue=(e,t)=>d[e].height<=d[t].height,de=e=>e.sort((t,r)=>t===r?0:t===exports.VideoQuality.INVARIANT?1:r===exports.VideoQuality.INVARIANT?-1:C(t,r)?1:-1)[0],N=Object.keys(d).sort((e,t)=>C(e,t)?-1:1),he=(e,t=.02)=>[...N].find(n=>d[n].height*(1+t)>=e),fe=({width:e,height:t})=>{const r=Math.min(e,t),n=Math.max(e,t);return N.find(s=>{const i=d[s];return i.width>=n&&i.height>=r})},be=e=>d[e].height,R=e=>e===exports.VideoQuality.INVARIANT,we=e=>e.every(t=>!R(t));function pe(e){if(R(e))throw new Error("Expected exact quality")}const M=(e,t)=>{const r={};for(const n of Object.keys(t)){const s=t[n],i=e[n];Array.isArray(s)&&Array.isArray(i)?r[n]=i:typeof s=="object"&&typeof i=="object"?r[n]=M(i,s):r[n]=n in e?i:s}return r},ge=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};class me extends A{value;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 r=super._subscribe(t);return t.next(this.value),r}}function Ee(e){return new l(t=>{const r={};let n=Object.keys(e).length;const s=i=>o=>{i in r||n--,r[i]=o,n===0&&t.next(r)};return Object.entries(e).reduce((i,[o,u])=>i.add(u.subscribe(s(o))),new v)})}function ye(...e){return new l(t=>e.reduce((r,n)=>r.add(n.subscribe(t)),new v))}var ve=e=>new l(t=>{const r=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(r)}),Se=e=>new l(t=>{const r=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(r)}),Oe=e=>new l(t=>{e.forEach(r=>t.next(r))}),Ae=(e,t)=>new l(r=>{const n=s=>r.next(s);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function xe(e){return t=>new l(r=>t.subscribe(new Ce(r,e)))}class Ce{destination;size;lastValues=[];constructor(t,r){this.destination=t,this.size=r}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const Re={leading:!1,trailing:!0};function Le(e,t=Re){return r=>new l(n=>r.subscribe(new _e(n,e,t)))}class _e{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,T(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const Pe={leading:!0,trailing:!1};function Te(e,t=Pe){return r=>new l(n=>r.subscribe(new Ie(n,e,t)))}class Ie{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,I(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){this.destination.error?.(t)}}function Ne(e){return t=>new l(r=>t.subscribe(new Me(r,e)))}class Me{destination;predicate;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.predicate(t)}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Qe(e=(t,r)=>t===r){return t=>new l(r=>t.subscribe(new Ve(r,e)))}const _={};class Ve{destination;predicate;lastValue=_;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.lastValue===_||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Q(e){return t=>new l(r=>t.subscribe(new De(r,e)))}let De=class{destination;mapper;constructor(t,r){this.destination=t,this.mapper=r}next(t){let r;try{r=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(r)}error(t){this.destination.error?.(t)}};function je(e){return Q(()=>e)}function ke(){return e=>new l(t=>{let r=!1,n=!1;const s=e.subscribe(i=>{r||(r=!0,t.next(i)),n&&s.unsubscribe()},i=>{r=!0,t.error?.(i),n&&s.unsubscribe()});return n=!0,r&&s.unsubscribe(),s})}function qe(){return e=>new l(t=>e.subscribe(new Fe(t)))}class Fe{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const r=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,t])}error(t){this.destination.error?.(t)}}function Ue(e){return t=>new l(r=>t.subscribe(new Ge(r,e)))}class Ge{destination;effect;constructor(t,r){this.destination=t,this.effect=r}next(t){try{this.effect(t)}catch(r){throw this.error(r),r}this.destination.next(t)}error(t){this.destination.error?.(t)}}exports.ErrorCategory=void 0;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));class P{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let s=0,i=n.length;s<i;s++)if(n[s].callback===r){n.splice(s,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let s=0,i=n.length;s<i;s++){const o=n[s];try{o.callback.call(this,t)}catch(u){Promise.resolve().then(()=>{throw u})}o.options&&o.options.once&&this.removeEventListener(t.type,o.callback)}return!t.defaultPrevented}}class V extends P{constructor(){super(),this.listeners||P.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class Be{constructor(){Object.defineProperty(this,"signal",{value:new V,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch{typeof document<"u"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document>"u")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch{n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol<"u"&&Symbol.toStringTag&&(Be.prototype[Symbol.toStringTag]="AbortController",V.prototype[Symbol.toStringTag]="AbortSignal");function D(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function ze(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s=!1}=e;if(!D({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||s)&&(i=function(c,f){let b;f&&f.signal&&(b=f.signal,delete f.signal);const g=new r(c,f);return b&&Object.defineProperty(g,"signal",{writable:!1,enumerable:!1,configurable:!0,value:b}),g},i.prototype=r.prototype);const o=t;return{fetch:(h,c)=>{const f=i&&i.prototype.isPrototypeOf(h)?h.signal:c?c.signal:void 0;if(f){let b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(f.aborted)return Promise.reject(b);const g=new Promise((S,k)=>{f.addEventListener("abort",()=>k(b),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([g,o(h,c)])}return o(h,c)},Request:i}}const L=D({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),j=L?ze({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,He=L?j.fetch:window.fetch;L?j.Request:window.Request;exports.VKNumericLanguage=void 0;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(exports.VKNumericLanguage||(exports.VKNumericLanguage={}));const $e="vk.com",Ye=async(e,t,r)=>{const n=new URL(`https://${$e}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",t),e!==void 0&&n.searchParams.set("lang",e);const i=await(await He(n.toString())).json();return We(i,r)},We=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([r,n])=>[r.substring(`${t}_`.length),Ke(n)])),Ke=e=>Array.isArray(e)?e[0]:e;exports.InterfaceLanguage=void 0;(function(e){e.RU="ru",e.EN="en"})(exports.InterfaceLanguage||(exports.InterfaceLanguage={}));exports.Logger=U;exports.Observable=l;exports.Subject=A;exports.Subscription=v;exports.VERSION=q;exports.ValueSubject=me;exports.abortable=W;exports.addScript=$;exports.areQualitiesExact=we;exports.assertEmptyArray=H;exports.assertNever=p;exports.assertNonNullable=G;exports.assertNotEmptyArray=z;exports.assertNullable=B;exports.assertQualityIsExact=pe;exports.buffer=xe;exports.checkNever=F;exports.combine=Ee;exports.debounce=Le;exports.detectEmbed=ae;exports.fillWithDefault=M;exports.filter=Ne;exports.filterChanged=Qe;exports.fromEvent=Ae;exports.getCurrentBrowser=x;exports.getExponentialDelay=Z;exports.getHighestQuality=de;exports.getIOSVersion=X;exports.interval=Se;exports.isHigher=ce;exports.isHigherOrEqual=le;exports.isIOS=K;exports.isInvariantQuality=R;exports.isLower=C;exports.isLowerOrEqual=ue;exports.isMacLike=J;exports.isNonNullable=T;exports.isNullable=I;exports.loadVKLangPack=Ye;exports.map=Q;exports.mapTo=je;exports.merge=ye;exports.noop=m;exports.now=Y;exports.observableFrom=Oe;exports.once=ke;exports.pairwise=qe;exports.safeStorage=oe;exports.tap=Ue;exports.throttle=Te;exports.timeCodeToString=ge;exports.timeout=ve;exports.videoHeightToQuality=he;exports.videoQualityToHeight=be;exports.videoSizeToQuality=fe;
6
+ "use strict";const q="1.0.32-dev.eddd3f7a.0";class v{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const p=e=>{throw new Error(`${e} is value of unexpected type`)},F=e=>{},m=()=>{};class l{constructor(t){t&&(this._subscribe=t)}subscribe(t,r){let n;r?typeof r=="function"?n={next:r,error:m}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:m,error:m};const s=typeof t=="function"?{next:o=>{try{t(o)}catch(u){n.next(u)}},error:o=>n.next(o)}:{next:o=>t.next(o),error:o=>t.error?t.error(o):n.next(o)};let i;try{i=this._subscribe(s)}catch(o){s.error?.(o)}return new v().add(()=>{switch(s.next=m,s.error=m,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return p(i)}})}pipe(...t){return t.reduce((r,n)=>n(r),this)}_subscribe(t){}}class A extends l{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(r=>r.next(t))}error(t){this.subscribers.forEach(r=>r.error?.(t))}_subscribe(t){const r=this.keyCounter++;return this.subscribers.set(r,t),new v().add(()=>this.subscribers.delete(r))}}class U{log$=new A;logs=[];log=t=>{const r={...t,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};createCustomLog(t){return(...r)=>{let n;try{n=t(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(r=>({component:t,...r}))}getAllLogs=()=>this.logs}function G(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function B(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function T(e){return typeof e<"u"&&e!==null}function I(e){return e==null}function z(e,t){if(!e?.length)throw new Error(t)}function H(e,t){if(e?.length)throw new Error(t)}const $=(e,t,r)=>new Promise((n,s)=>{t.addEventListener("abort",()=>{u(),c.remove()});const i=()=>{u(),s()},o=()=>{u(),n()},u=()=>{h&&clearTimeout(h),c.removeEventListener("load",o),c.removeEventListener("error",i)};let h;r&&(h=window.setTimeout(i,r));const c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",i),c.src=e,document.head.appendChild(c)}),Y=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),W=(e,t)=>async(...r)=>{const n=t(...r);let s=e.aborted,i;for(;!s&&!e.aborted;){const o=await n.next(i);s=o.done??!1,i=o.value}return i};exports.CurrentClientBrowser=void 0;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const x=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?exports.CurrentClientBrowser.Yandex:void 0,r=/chrome|crios/i.test(e)?exports.CurrentClientBrowser.Chrome:void 0,n=/chromium/i.test(e)?exports.CurrentClientBrowser.Chromium:void 0,s=/firefox|fxios/i.test(e)?exports.CurrentClientBrowser.Firefox:void 0,i=/webkit|safari|khtml/i.test(e)?exports.CurrentClientBrowser.Safari:void 0,o=/opr\//i.test(e)?exports.CurrentClientBrowser.Opera:void 0,u=/edg/i.test(e)?exports.CurrentClientBrowser.Edge:void 0,h=/android/i.test(e)?exports.CurrentClientDevice.Android:void 0,c=/iphone/i.test(e)?exports.CurrentClientDevice.iPhone:void 0,f=/ipad/i.test(e)?exports.CurrentClientDevice.iPad:void 0,b=/ipod/i.test(e)?exports.CurrentClientDevice.iPod:void 0,g=/mac/i.test(e)?exports.CurrentClientDevice.Mac:void 0,S=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:t||s||o||u||r||n||i||exports.CurrentClientBrowser.Rest,device:h||c||f||b||S||g||exports.CurrentClientDevice.Desktop}},K=(e=!1)=>{const r=[exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(x().device);if(!e)return r;const{userAgent:n,maxTouchPoints:s}=window.navigator;return!!(r||/macintosh/i.test(n)&&s>0)},X=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const r=t[1],n=parseFloat(r);return isNaN(n)?null:n},J=()=>[exports.CurrentClientDevice.Mac,exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(x().device),Z=(e,{start:t=0,factor:r=2,max:n=1/0,min:s=t,random:i=0}={})=>{let o=t;return o*=r**e,o*=1+(Math.random()*i*2-i),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,s),o};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));let E,w;const O=`vk-videoplayer-dummy-key-${Math.random()}`,y=()=>{if(w!==void 0)return w;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),w=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),w=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)w=a.RUNTIME;else throw t}else throw e}return w===a.RUNTIME&&(E=new Map),w},ee=()=>y()===a.LOCAL_STORAGE,te=e=>{const t=y();switch(t){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return E?.get(e);default:p(t)}},re=(e,t)=>{const r=y();switch(r){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.RUNTIME:return void E?.set(e,t);default:p(r)}},ne=e=>{const t=y();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return E?.has(e)??!1;default:return p(t),!1}},ie=e=>{const t=y();switch(t){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void E?.delete(e);default:p(t)}},se=()=>{const e=y();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return E?.clear();default:p(e)}};var oe=Object.freeze({__proto__:null,clear:se,get:te,has:ne,isPersistent:ee,remove:ie,set:re});const ae=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}};exports.VideoQuality=void 0;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const d={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},ce=(e,t)=>d[e].height>d[t].height,le=(e,t)=>d[e].height>=d[t].height,C=(e,t)=>d[e].height<d[t].height,ue=(e,t)=>d[e].height<=d[t].height,de=e=>e.sort((t,r)=>t===r?0:t===exports.VideoQuality.INVARIANT?1:r===exports.VideoQuality.INVARIANT?-1:C(t,r)?1:-1)[0],N=Object.keys(d).sort((e,t)=>C(e,t)?-1:1),he=(e,t=.02)=>[...N].find(n=>d[n].height*(1+t)>=e),fe=({width:e,height:t})=>{const r=Math.min(e,t),n=Math.max(e,t);return N.find(s=>{const i=d[s];return i.width>=n&&i.height>=r})},be=e=>d[e].height,R=e=>e===exports.VideoQuality.INVARIANT,we=e=>e.every(t=>!R(t));function pe(e){if(R(e))throw new Error("Expected exact quality")}const M=(e,t)=>{const r={};for(const n of Object.keys(t)){const s=t[n],i=e[n];Array.isArray(s)&&Array.isArray(i)?r[n]=i:typeof s=="object"&&typeof i=="object"?r[n]=M(i,s):r[n]=n in e?i:s}return r},ge=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};class me extends A{value;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 r=super._subscribe(t);return t.next(this.value),r}}function Ee(e){return new l(t=>{const r={};let n=Object.keys(e).length;const s=i=>o=>{i in r||n--,r[i]=o,n===0&&t.next(r)};return Object.entries(e).reduce((i,[o,u])=>i.add(u.subscribe(s(o))),new v)})}function ye(...e){return new l(t=>e.reduce((r,n)=>r.add(n.subscribe(t)),new v))}var ve=e=>new l(t=>{const r=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(r)}),Se=e=>new l(t=>{const r=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(r)}),Oe=e=>new l(t=>{e.forEach(r=>t.next(r))}),Ae=(e,t)=>new l(r=>{const n=s=>r.next(s);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function xe(e){return t=>new l(r=>t.subscribe(new Ce(r,e)))}class Ce{destination;size;lastValues=[];constructor(t,r){this.destination=t,this.size=r}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const Re={leading:!1,trailing:!0};function Le(e,t=Re){return r=>new l(n=>r.subscribe(new _e(n,e,t)))}class _e{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,T(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const Pe={leading:!0,trailing:!1};function Te(e,t=Pe){return r=>new l(n=>r.subscribe(new Ie(n,e,t)))}class Ie{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,I(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){this.destination.error?.(t)}}function Ne(e){return t=>new l(r=>t.subscribe(new Me(r,e)))}class Me{destination;predicate;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.predicate(t)}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Qe(e=(t,r)=>t===r){return t=>new l(r=>t.subscribe(new Ve(r,e)))}const _={};class Ve{destination;predicate;lastValue=_;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.lastValue===_||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Q(e){return t=>new l(r=>t.subscribe(new De(r,e)))}let De=class{destination;mapper;constructor(t,r){this.destination=t,this.mapper=r}next(t){let r;try{r=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(r)}error(t){this.destination.error?.(t)}};function je(e){return Q(()=>e)}function ke(){return e=>new l(t=>{let r=!1,n=!1;const s=e.subscribe(i=>{r||(r=!0,t.next(i)),n&&s.unsubscribe()},i=>{r=!0,t.error?.(i),n&&s.unsubscribe()});return n=!0,r&&s.unsubscribe(),s})}function qe(){return e=>new l(t=>e.subscribe(new Fe(t)))}class Fe{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const r=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,t])}error(t){this.destination.error?.(t)}}function Ue(e){return t=>new l(r=>t.subscribe(new Ge(r,e)))}class Ge{destination;effect;constructor(t,r){this.destination=t,this.effect=r}next(t){try{this.effect(t)}catch(r){throw this.error(r),r}this.destination.next(t)}error(t){this.destination.error?.(t)}}exports.ErrorCategory=void 0;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(exports.ErrorCategory||(exports.ErrorCategory={}));class P{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let s=0,i=n.length;s<i;s++)if(n[s].callback===r){n.splice(s,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let s=0,i=n.length;s<i;s++){const o=n[s];try{o.callback.call(this,t)}catch(u){Promise.resolve().then(()=>{throw u})}o.options&&o.options.once&&this.removeEventListener(t.type,o.callback)}return!t.defaultPrevented}}class V extends P{constructor(){super(),this.listeners||P.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class Be{constructor(){Object.defineProperty(this,"signal",{value:new V,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch{typeof document<"u"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document>"u")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch{n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol<"u"&&Symbol.toStringTag&&(Be.prototype[Symbol.toStringTag]="AbortController",V.prototype[Symbol.toStringTag]="AbortSignal");function D(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function ze(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s=!1}=e;if(!D({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:t,Request:i};let i=r;(i&&!i.prototype.hasOwnProperty("signal")||s)&&(i=function(c,f){let b;f&&f.signal&&(b=f.signal,delete f.signal);const g=new r(c,f);return b&&Object.defineProperty(g,"signal",{writable:!1,enumerable:!1,configurable:!0,value:b}),g},i.prototype=r.prototype);const o=t;return{fetch:(h,c)=>{const f=i&&i.prototype.isPrototypeOf(h)?h.signal:c?c.signal:void 0;if(f){let b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(f.aborted)return Promise.reject(b);const g=new Promise((S,k)=>{f.addEventListener("abort",()=>k(b),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([g,o(h,c)])}return o(h,c)},Request:i}}const L=D({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),j=L?ze({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,He=L?j.fetch:window.fetch;L?j.Request:window.Request;exports.VKNumericLanguage=void 0;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(exports.VKNumericLanguage||(exports.VKNumericLanguage={}));const $e="vk.com",Ye=async(e,t,r)=>{const n=new URL(`https://${$e}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",t),e!==void 0&&n.searchParams.set("lang",e);const i=await(await He(n.toString())).json();return We(i,r)},We=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([r,n])=>[r.substring(`${t}_`.length),Ke(n)])),Ke=e=>Array.isArray(e)?e[0]:e;exports.InterfaceLanguage=void 0;(function(e){e.RU="ru",e.EN="en"})(exports.InterfaceLanguage||(exports.InterfaceLanguage={}));exports.Logger=U;exports.Observable=l;exports.Subject=A;exports.Subscription=v;exports.VERSION=q;exports.ValueSubject=me;exports.abortable=W;exports.addScript=$;exports.areQualitiesExact=we;exports.assertEmptyArray=H;exports.assertNever=p;exports.assertNonNullable=G;exports.assertNotEmptyArray=z;exports.assertNullable=B;exports.assertQualityIsExact=pe;exports.buffer=xe;exports.checkNever=F;exports.combine=Ee;exports.debounce=Le;exports.detectEmbed=ae;exports.fillWithDefault=M;exports.filter=Ne;exports.filterChanged=Qe;exports.fromEvent=Ae;exports.getCurrentBrowser=x;exports.getExponentialDelay=Z;exports.getHighestQuality=de;exports.getIOSVersion=X;exports.interval=Se;exports.isHigher=ce;exports.isHigherOrEqual=le;exports.isIOS=K;exports.isInvariantQuality=R;exports.isLower=C;exports.isLowerOrEqual=ue;exports.isMacLike=J;exports.isNonNullable=T;exports.isNullable=I;exports.loadVKLangPack=Ye;exports.map=Q;exports.mapTo=je;exports.merge=ye;exports.noop=m;exports.now=Y;exports.observableFrom=Oe;exports.once=ke;exports.pairwise=qe;exports.safeStorage=oe;exports.tap=Ue;exports.throttle=Te;exports.timeCodeToString=ge;exports.timeout=ve;exports.videoHeightToQuality=he;exports.videoQualityToHeight=be;exports.videoSizeToQuality=fe;
package/esnext.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.32-dev.0f82d9ff.0
3
- * Fri, 26 Jan 2024 03:16:46 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.32-dev.eddd3f7a.0
3
+ * Tue, 30 Jan 2024 06:25:12 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-32/doc/
5
5
  */
6
- const be="1.0.32-dev.0f82d9ff.0";class x{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const O=e=>{throw new Error(`${e} is value of unexpected type`)},we=e=>{},y=()=>{};class u{constructor(t){t&&(this._subscribe=t)}subscribe(t,r){let n;r?typeof r=="function"?n={next:r,error:y}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:y,error:y};const i=typeof t=="function"?{next:o=>{try{t(o)}catch(d){n.next(d)}},error:o=>n.next(o)}:{next:o=>t.next(o),error:o=>t.error?t.error(o):n.next(o)};let s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new x().add(()=>{switch(i.next=y,i.error=y,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return O(s)}})}pipe(...t){return t.reduce((r,n)=>n(r),this)}_subscribe(t){}}class N extends u{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(r=>r.next(t))}error(t){this.subscribers.forEach(r=>r.error?.(t))}_subscribe(t){const r=this.keyCounter++;return this.subscribers.set(r,t),new x().add(()=>this.subscribers.delete(r))}}class pe{log$=new N;logs=[];log=t=>{const r={...t,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};createCustomLog(t){return(...r)=>{let n;try{n=t(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(r=>({component:t,...r}))}getAllLogs=()=>this.logs}function me(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ge(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function V(e){return typeof e<"u"&&e!==null}function D(e){return e==null}function Ee(e,t){if(!e?.length)throw new Error(t)}function Oe(e,t){if(e?.length)throw new Error(t)}const Se=(e,t,r)=>new Promise((n,i)=>{t.addEventListener("abort",()=>{d(),c.remove()});const s=()=>{d(),i()},o=()=>{d(),n()},d=()=>{b&&clearTimeout(b),c.removeEventListener("load",o),c.removeEventListener("error",s)};let b;r&&(b=window.setTimeout(s,r));const c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",s),c.src=e,document.head.appendChild(c)}),Ae=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ye=(e,t)=>async(...r)=>{const n=t(...r);let i=e.aborted,s;for(;!i&&!e.aborted;){const o=await n.next(s);i=o.done??!1,s=o.value}return s};var m;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(m||(m={}));var l;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(l||(l={}));const j=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?m.Yandex:void 0,r=/chrome|crios/i.test(e)?m.Chrome:void 0,n=/chromium/i.test(e)?m.Chromium:void 0,i=/firefox|fxios/i.test(e)?m.Firefox:void 0,s=/webkit|safari|khtml/i.test(e)?m.Safari:void 0,o=/opr\//i.test(e)?m.Opera:void 0,d=/edg/i.test(e)?m.Edge:void 0,b=/android/i.test(e)?l.Android:void 0,c=/iphone/i.test(e)?l.iPhone:void 0,w=/ipad/i.test(e)?l.iPad:void 0,p=/ipod/i.test(e)?l.iPod:void 0,E=/mac/i.test(e)?l.Mac:void 0,v=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?l.RestMobile:void 0;return{browser:t||i||o||d||r||n||s||m.Rest,device:b||c||w||p||v||E||l.Desktop}},xe=(e=!1)=>{const r=[l.iPhone,l.iPad,l.iPod].includes(j().device);if(!e)return r;const{userAgent:n,maxTouchPoints:i}=window.navigator;return!!(r||/macintosh/i.test(n)&&i>0)},ve=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const r=t[1],n=parseFloat(r);return isNaN(n)?null:n},Re=()=>[l.Mac,l.iPhone,l.iPad,l.iPod].includes(j().device),_e=(e,{start:t=0,factor:r=2,max:n=1/0,min:i=t,random:s=0}={})=>{let o=t;return o*=r**e,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));let S,g;const R=`vk-videoplayer-dummy-key-${Math.random()}`,A=()=>{if(g!==void 0)return g;try{localStorage.setItem(R,"test"),localStorage.removeItem(R),g=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(R),g=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)g=a.RUNTIME;else throw t}else throw e}return g===a.RUNTIME&&(S=new Map),g},z=()=>A()===a.LOCAL_STORAGE,$=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return S?.get(e);default:O(t)}},Y=(e,t)=>{const r=A();switch(r){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.RUNTIME:return void S?.set(e,t);default:O(r)}},H=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return S?.has(e)??!1;default:return O(t),!1}},W=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void S?.delete(e);default:O(t)}},B=()=>{const e=A();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return S?.clear();default:O(e)}};var Pe=Object.freeze({__proto__:null,clear:B,get:$,has:H,isPersistent:z,remove:W,set:Y});const Le=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}};var h;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(h||(h={}));const f={[h.Q_144P]:{width:256,height:144},[h.Q_240P]:{width:428,height:240},[h.Q_360P]:{width:640,height:360},[h.Q_480P]:{width:856,height:480},[h.Q_720P]:{width:1280,height:720},[h.Q_1080P]:{width:1920,height:1080},[h.Q_1440P]:{width:2560,height:1440},[h.Q_2160P]:{width:3840,height:2160},[h.Q_4320P]:{width:7680,height:4320}},Te=(e,t)=>f[e].height>f[t].height,Ie=(e,t)=>f[e].height>=f[t].height,k=(e,t)=>f[e].height<f[t].height,Me=(e,t)=>f[e].height<=f[t].height,Ne=e=>e.sort((t,r)=>t===r?0:t===h.INVARIANT?1:r===h.INVARIANT?-1:k(t,r)?1:-1)[0],q=Object.keys(f).sort((e,t)=>k(e,t)?-1:1),je=(e,t=.02)=>[...q].find(n=>f[n].height*(1+t)>=e),ke=({width:e,height:t})=>{const r=Math.min(e,t),n=Math.max(e,t);return q.find(i=>{const s=f[i];return s.width>=n&&s.height>=r})},qe=e=>f[e].height,F=e=>e===h.INVARIANT,Fe=e=>e.every(t=>!F(t));function Ue(e){if(F(e))throw new Error("Expected exact quality")}const X=(e,t)=>{const r={};for(const n of Object.keys(t)){const i=t[n],s=e[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=X(s,i):r[n]=n in e?s:i}return r},Ce=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};class Qe extends N{value;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 r=super._subscribe(t);return t.next(this.value),r}}function Ge(e){return new u(t=>{const r={};let n=Object.keys(e).length;const i=s=>o=>{s in r||n--,r[s]=o,n===0&&t.next(r)};return Object.entries(e).reduce((s,[o,d])=>s.add(d.subscribe(i(o))),new x)})}function Ve(...e){return new u(t=>e.reduce((r,n)=>r.add(n.subscribe(t)),new x))}var De=e=>new u(t=>{const r=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(r)}),ze=e=>new u(t=>{const r=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(r)}),$e=e=>new u(t=>{e.forEach(r=>t.next(r))}),Ye=(e,t)=>new u(r=>{const n=i=>r.next(i);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function He(e){return t=>new u(r=>t.subscribe(new J(r,e)))}class J{destination;size;lastValues=[];constructor(t,r){this.destination=t,this.size=r}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const Z={leading:!1,trailing:!0};function We(e,t=Z){return r=>new u(n=>r.subscribe(new K(n,e,t)))}class K{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,V(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const ee={leading:!0,trailing:!1};function Be(e,t=ee){return r=>new u(n=>r.subscribe(new te(n,e,t)))}class te{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,D(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){this.destination.error?.(t)}}function Xe(e){return t=>new u(r=>t.subscribe(new re(r,e)))}class re{destination;predicate;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.predicate(t)}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Je(e=(t,r)=>t===r){return t=>new u(r=>t.subscribe(new ne(r,e)))}const P={};class ne{destination;predicate;lastValue=P;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.lastValue===P||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function se(e){return t=>new u(r=>t.subscribe(new ie(r,e)))}let ie=class{destination;mapper;constructor(t,r){this.destination=t,this.mapper=r}next(t){let r;try{r=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(r)}error(t){this.destination.error?.(t)}};function Ke(e){return se(()=>e)}function et(){return e=>new u(t=>{let r=!1,n=!1;const i=e.subscribe(s=>{r||(r=!0,t.next(s)),n&&i.unsubscribe()},s=>{r=!0,t.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function tt(){return e=>new u(t=>e.subscribe(new oe(t)))}class oe{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const r=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,t])}error(t){this.destination.error?.(t)}}function rt(e){return t=>new u(r=>t.subscribe(new ae(r,e)))}class ae{destination;effect;constructor(t,r){this.destination=t,this.effect=r}next(t){try{this.effect(t)}catch(r){throw this.error(r),r}this.destination.next(t)}error(t){this.destination.error?.(t)}}var L;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(L||(L={}));class T{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let i=0,s=n.length;i<s;i++)if(n[i].callback===r){n.splice(i,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let i=0,s=n.length;i<s;i++){const o=n[i];try{o.callback.call(this,t)}catch(d){Promise.resolve().then(()=>{throw d})}o.options&&o.options.once&&this.removeEventListener(t.type,o.callback)}return!t.defaultPrevented}}class U extends T{constructor(){super(),this.listeners||T.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class ce{constructor(){Object.defineProperty(this,"signal",{value:new U,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch{typeof document<"u"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document>"u")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch{n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol<"u"&&Symbol.toStringTag&&(ce.prototype[Symbol.toStringTag]="AbortController",U.prototype[Symbol.toStringTag]="AbortSignal");function C(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function le(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!C({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:s};let s=r;(s&&!s.prototype.hasOwnProperty("signal")||i)&&(s=function(c,w){let p;w&&w.signal&&(p=w.signal,delete w.signal);const E=new r(c,w);return p&&Object.defineProperty(E,"signal",{writable:!1,enumerable:!1,configurable:!0,value:p}),E},s.prototype=r.prototype);const o=t;return{fetch:(b,c)=>{const w=s&&s.prototype.isPrototypeOf(b)?b.signal:c?c.signal:void 0;if(w){let p;try{p=new DOMException("Aborted","AbortError")}catch{p=new Error("Aborted"),p.name="AbortError"}if(w.aborted)return Promise.reject(p);const E=new Promise((v,G)=>{w.addEventListener("abort",()=>G(p),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([E,o(b,c)])}return o(b,c)},Request:s}}const _=C({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Q=_?le({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ue=_?Q.fetch:window.fetch;_?Q.Request:window.Request;var I;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(I||(I={}));const he="vk.com",nt=async(e,t,r)=>{const n=new URL(`https://${he}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",t),e!==void 0&&n.searchParams.set("lang",e);const s=await(await ue(n.toString())).json();return de(s,r)},de=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([r,n])=>[r.substring(`${t}_`.length),fe(n)])),fe=e=>Array.isArray(e)?e[0]:e;var M;(function(e){e.RU="ru",e.EN="en"})(M||(M={}));export{m as CurrentClientBrowser,l as CurrentClientDevice,L as ErrorCategory,M as InterfaceLanguage,pe as Logger,u as Observable,N as Subject,x as Subscription,be as VERSION,I as VKNumericLanguage,Qe as ValueSubject,h as VideoQuality,ye as abortable,Se as addScript,Fe as areQualitiesExact,Oe as assertEmptyArray,O as assertNever,me as assertNonNullable,Ee as assertNotEmptyArray,ge as assertNullable,Ue as assertQualityIsExact,He as buffer,we as checkNever,Ge as combine,We as debounce,Le as detectEmbed,X as fillWithDefault,Xe as filter,Je as filterChanged,Ye as fromEvent,j as getCurrentBrowser,_e as getExponentialDelay,Ne as getHighestQuality,ve as getIOSVersion,ze as interval,Te as isHigher,Ie as isHigherOrEqual,xe as isIOS,F as isInvariantQuality,k as isLower,Me as isLowerOrEqual,Re as isMacLike,V as isNonNullable,D as isNullable,nt as loadVKLangPack,se as map,Ke as mapTo,Ve as merge,y as noop,Ae as now,$e as observableFrom,et as once,tt as pairwise,Pe as safeStorage,rt as tap,Be as throttle,Ce as timeCodeToString,De as timeout,je as videoHeightToQuality,qe as videoQualityToHeight,ke as videoSizeToQuality};
6
+ const be="1.0.32-dev.eddd3f7a.0";class x{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const O=e=>{throw new Error(`${e} is value of unexpected type`)},we=e=>{},y=()=>{};class u{constructor(t){t&&(this._subscribe=t)}subscribe(t,r){let n;r?typeof r=="function"?n={next:r,error:y}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:y,error:y};const i=typeof t=="function"?{next:o=>{try{t(o)}catch(d){n.next(d)}},error:o=>n.next(o)}:{next:o=>t.next(o),error:o=>t.error?t.error(o):n.next(o)};let s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new x().add(()=>{switch(i.next=y,i.error=y,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return O(s)}})}pipe(...t){return t.reduce((r,n)=>n(r),this)}_subscribe(t){}}class N extends u{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(r=>r.next(t))}error(t){this.subscribers.forEach(r=>r.error?.(t))}_subscribe(t){const r=this.keyCounter++;return this.subscribers.set(r,t),new x().add(()=>this.subscribers.delete(r))}}class pe{log$=new N;logs=[];log=t=>{const r={...t,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};createCustomLog(t){return(...r)=>{let n;try{n=t(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(t){return this.createCustomLog(r=>({component:t,...r}))}getAllLogs=()=>this.logs}function me(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ge(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function V(e){return typeof e<"u"&&e!==null}function D(e){return e==null}function Ee(e,t){if(!e?.length)throw new Error(t)}function Oe(e,t){if(e?.length)throw new Error(t)}const Se=(e,t,r)=>new Promise((n,i)=>{t.addEventListener("abort",()=>{d(),c.remove()});const s=()=>{d(),i()},o=()=>{d(),n()},d=()=>{b&&clearTimeout(b),c.removeEventListener("load",o),c.removeEventListener("error",s)};let b;r&&(b=window.setTimeout(s,r));const c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",s),c.src=e,document.head.appendChild(c)}),Ae=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ye=(e,t)=>async(...r)=>{const n=t(...r);let i=e.aborted,s;for(;!i&&!e.aborted;){const o=await n.next(s);i=o.done??!1,s=o.value}return s};var m;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(m||(m={}));var l;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(l||(l={}));const j=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?m.Yandex:void 0,r=/chrome|crios/i.test(e)?m.Chrome:void 0,n=/chromium/i.test(e)?m.Chromium:void 0,i=/firefox|fxios/i.test(e)?m.Firefox:void 0,s=/webkit|safari|khtml/i.test(e)?m.Safari:void 0,o=/opr\//i.test(e)?m.Opera:void 0,d=/edg/i.test(e)?m.Edge:void 0,b=/android/i.test(e)?l.Android:void 0,c=/iphone/i.test(e)?l.iPhone:void 0,w=/ipad/i.test(e)?l.iPad:void 0,p=/ipod/i.test(e)?l.iPod:void 0,E=/mac/i.test(e)?l.Mac:void 0,v=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?l.RestMobile:void 0;return{browser:t||i||o||d||r||n||s||m.Rest,device:b||c||w||p||v||E||l.Desktop}},xe=(e=!1)=>{const r=[l.iPhone,l.iPad,l.iPod].includes(j().device);if(!e)return r;const{userAgent:n,maxTouchPoints:i}=window.navigator;return!!(r||/macintosh/i.test(n)&&i>0)},ve=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const r=t[1],n=parseFloat(r);return isNaN(n)?null:n},Re=()=>[l.Mac,l.iPhone,l.iPad,l.iPod].includes(j().device),_e=(e,{start:t=0,factor:r=2,max:n=1/0,min:i=t,random:s=0}={})=>{let o=t;return o*=r**e,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));let S,g;const R=`vk-videoplayer-dummy-key-${Math.random()}`,A=()=>{if(g!==void 0)return g;try{localStorage.setItem(R,"test"),localStorage.removeItem(R),g=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(R),g=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)g=a.RUNTIME;else throw t}else throw e}return g===a.RUNTIME&&(S=new Map),g},z=()=>A()===a.LOCAL_STORAGE,$=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return S?.get(e);default:O(t)}},Y=(e,t)=>{const r=A();switch(r){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case a.RUNTIME:return void S?.set(e,t);default:O(r)}},H=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return S?.has(e)??!1;default:return O(t),!1}},W=e=>{const t=A();switch(t){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void S?.delete(e);default:O(t)}},B=()=>{const e=A();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return S?.clear();default:O(e)}};var Pe=Object.freeze({__proto__:null,clear:B,get:$,has:H,isPersistent:z,remove:W,set:Y});const Le=()=>{let e,t;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!t&&document.referrer&&(t=document.referrer)}catch(n){console.error(n)}const r=t?new URL(t).hostname:void 0;return{isEmbed:e,host:r}};var h;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(h||(h={}));const f={[h.Q_144P]:{width:256,height:144},[h.Q_240P]:{width:428,height:240},[h.Q_360P]:{width:640,height:360},[h.Q_480P]:{width:856,height:480},[h.Q_720P]:{width:1280,height:720},[h.Q_1080P]:{width:1920,height:1080},[h.Q_1440P]:{width:2560,height:1440},[h.Q_2160P]:{width:3840,height:2160},[h.Q_4320P]:{width:7680,height:4320}},Te=(e,t)=>f[e].height>f[t].height,Ie=(e,t)=>f[e].height>=f[t].height,k=(e,t)=>f[e].height<f[t].height,Me=(e,t)=>f[e].height<=f[t].height,Ne=e=>e.sort((t,r)=>t===r?0:t===h.INVARIANT?1:r===h.INVARIANT?-1:k(t,r)?1:-1)[0],q=Object.keys(f).sort((e,t)=>k(e,t)?-1:1),je=(e,t=.02)=>[...q].find(n=>f[n].height*(1+t)>=e),ke=({width:e,height:t})=>{const r=Math.min(e,t),n=Math.max(e,t);return q.find(i=>{const s=f[i];return s.width>=n&&s.height>=r})},qe=e=>f[e].height,F=e=>e===h.INVARIANT,Fe=e=>e.every(t=>!F(t));function Ue(e){if(F(e))throw new Error("Expected exact quality")}const X=(e,t)=>{const r={};for(const n of Object.keys(t)){const i=t[n],s=e[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=X(s,i):r[n]=n in e?s:i}return r},Ce=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};class Qe extends N{value;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 r=super._subscribe(t);return t.next(this.value),r}}function Ge(e){return new u(t=>{const r={};let n=Object.keys(e).length;const i=s=>o=>{s in r||n--,r[s]=o,n===0&&t.next(r)};return Object.entries(e).reduce((s,[o,d])=>s.add(d.subscribe(i(o))),new x)})}function Ve(...e){return new u(t=>e.reduce((r,n)=>r.add(n.subscribe(t)),new x))}var De=e=>new u(t=>{const r=window.setTimeout(()=>{try{t.next()}catch(n){if(t.error)t.error(n);else throw n}},e);return()=>window.clearTimeout(r)}),ze=e=>new u(t=>{const r=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(r)}),$e=e=>new u(t=>{e.forEach(r=>t.next(r))}),Ye=(e,t)=>new u(r=>{const n=i=>r.next(i);return e.addEventListener(t,n),()=>e.removeEventListener(t,n)});function He(e){return t=>new u(r=>t.subscribe(new J(r,e)))}class J{destination;size;lastValues=[];constructor(t,r){this.destination=t,this.size=r}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const Z={leading:!1,trailing:!0};function We(e,t=Z){return r=>new u(n=>r.subscribe(new K(n,e,t)))}class K{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,V(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const ee={leading:!0,trailing:!1};function Be(e,t=ee){return r=>new u(n=>r.subscribe(new te(n,e,t)))}class te{destination;time;config;lastValue;timeout;constructor(t,r,n){this.destination=t,this.time=r,this.config=n}next(t){this.lastValue=t,D(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){this.destination.error?.(t)}}function Xe(e){return t=>new u(r=>t.subscribe(new re(r,e)))}class re{destination;predicate;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.predicate(t)}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Je(e=(t,r)=>t===r){return t=>new u(r=>t.subscribe(new ne(r,e)))}const P={};class ne{destination;predicate;lastValue=P;constructor(t,r){this.destination=t,this.predicate=r}next(t){let r;try{r=this.lastValue===P||!this.predicate(this.lastValue,t),this.lastValue=t}catch(n){throw this.error(n),n}r&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function se(e){return t=>new u(r=>t.subscribe(new ie(r,e)))}let ie=class{destination;mapper;constructor(t,r){this.destination=t,this.mapper=r}next(t){let r;try{r=this.mapper(t)}catch(n){throw this.error(n),n}this.destination.next(r)}error(t){this.destination.error?.(t)}};function Ke(e){return se(()=>e)}function et(){return e=>new u(t=>{let r=!1,n=!1;const i=e.subscribe(s=>{r||(r=!0,t.next(s)),n&&i.unsubscribe()},s=>{r=!0,t.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function tt(){return e=>new u(t=>e.subscribe(new oe(t)))}class oe{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const r=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,t])}error(t){this.destination.error?.(t)}}function rt(e){return t=>new u(r=>t.subscribe(new ae(r,e)))}class ae{destination;effect;constructor(t,r){this.destination=t,this.effect=r}next(t){try{this.effect(t)}catch(r){throw this.error(r),r}this.destination.next(t)}error(t){this.destination.error?.(t)}}var L;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(L||(L={}));class T{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,r,n){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:r,options:n})}removeEventListener(t,r){if(!(t in this.listeners))return;const n=this.listeners[t];for(let i=0,s=n.length;i<s;i++)if(n[i].callback===r){n.splice(i,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const n=this.listeners[t.type].slice();for(let i=0,s=n.length;i<s;i++){const o=n[i];try{o.callback.call(this,t)}catch(d){Promise.resolve().then(()=>{throw d})}o.options&&o.options.once&&this.removeEventListener(t.type,o.callback)}return!t.defaultPrevented}}class U extends T{constructor(){super(),this.listeners||T.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class ce{constructor(){Object.defineProperty(this,"signal",{value:new U,writable:!0,configurable:!0})}abort(t){let r;try{r=new Event("abort")}catch{typeof document<"u"?document.createEvent?(r=document.createEvent("Event"),r.initEvent("abort",!1,!1)):(r=document.createEventObject(),r.type="abort"):r={type:"abort",bubbles:!1,cancelable:!1}}let n=t;if(n===void 0)if(typeof document>"u")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch{n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(r)}toString(){return"[object AbortController]"}}typeof Symbol<"u"&&Symbol.toStringTag&&(ce.prototype[Symbol.toStringTag]="AbortController",U.prototype[Symbol.toStringTag]="AbortSignal");function C(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function le(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:r=t.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i=!1}=e;if(!C({fetch:t,Request:r,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:i}))return{fetch:t,Request:s};let s=r;(s&&!s.prototype.hasOwnProperty("signal")||i)&&(s=function(c,w){let p;w&&w.signal&&(p=w.signal,delete w.signal);const E=new r(c,w);return p&&Object.defineProperty(E,"signal",{writable:!1,enumerable:!1,configurable:!0,value:p}),E},s.prototype=r.prototype);const o=t;return{fetch:(b,c)=>{const w=s&&s.prototype.isPrototypeOf(b)?b.signal:c?c.signal:void 0;if(w){let p;try{p=new DOMException("Aborted","AbortError")}catch{p=new Error("Aborted"),p.name="AbortError"}if(w.aborted)return Promise.reject(p);const E=new Promise((v,G)=>{w.addEventListener("abort",()=>G(p),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([E,o(b,c)])}return o(b,c)},Request:s}}const _=C({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Q=_?le({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,ue=_?Q.fetch:window.fetch;_?Q.Request:window.Request;var I;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(I||(I={}));const he="vk.com",nt=async(e,t,r)=>{const n=new URL(`https://${he}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",t),e!==void 0&&n.searchParams.set("lang",e);const s=await(await ue(n.toString())).json();return de(s,r)},de=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([r,n])=>[r.substring(`${t}_`.length),fe(n)])),fe=e=>Array.isArray(e)?e[0]:e;var M;(function(e){e.RU="ru",e.EN="en"})(M||(M={}));export{m as CurrentClientBrowser,l as CurrentClientDevice,L as ErrorCategory,M as InterfaceLanguage,pe as Logger,u as Observable,N as Subject,x as Subscription,be as VERSION,I as VKNumericLanguage,Qe as ValueSubject,h as VideoQuality,ye as abortable,Se as addScript,Fe as areQualitiesExact,Oe as assertEmptyArray,O as assertNever,me as assertNonNullable,Ee as assertNotEmptyArray,ge as assertNullable,Ue as assertQualityIsExact,He as buffer,we as checkNever,Ge as combine,We as debounce,Le as detectEmbed,X as fillWithDefault,Xe as filter,Je as filterChanged,Ye as fromEvent,j as getCurrentBrowser,_e as getExponentialDelay,Ne as getHighestQuality,ve as getIOSVersion,ze as interval,Te as isHigher,Ie as isHigherOrEqual,xe as isIOS,F as isInvariantQuality,k as isLower,Me as isLowerOrEqual,Re as isMacLike,V as isNonNullable,D as isNullable,nt as loadVKLangPack,se as map,Ke as mapTo,Ve as merge,y as noop,Ae as now,$e as observableFrom,et as once,tt as pairwise,Pe as safeStorage,rt as tap,Be as throttle,Ce as timeCodeToString,De as timeout,je as videoHeightToQuality,qe as videoQualityToHeight,ke as videoSizeToQuality};
package/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.32-dev.0f82d9ff.0
3
- * Fri, 26 Jan 2024 03:16:46 GMT
2
+ * @vkontakte/videoplayer-shared v1.0.32-dev.eddd3f7a.0
3
+ * Tue, 30 Jan 2024 06:25:12 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-32/doc/
5
5
  */
6
- const re="1.0.32-dev.0f82d9ff.0";class x{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(n=>typeof n=="function"?n():n.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const b=e=>{throw new Error(`${e} is value of unexpected type`)},oe=e=>{},S=()=>{};class u{constructor(t){t&&(this._subscribe=t)}subscribe(t,n){let s;n?typeof n=="function"?s={next:n,error:S}:s={next:r=>n.next(r),error:r=>n.error?.(r)}:s={next:S,error:S};const o=typeof t=="function"?{next:r=>{try{t(r)}catch(f){s.next(f)}},error:r=>s.next(r)}:{next:r=>t.next(r),error:r=>t.error?t.error(r):s.next(r)};let i;try{i=this._subscribe(o)}catch(r){o.error?.(r)}return new x().add(()=>{switch(o.next=S,o.error=S,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return b(i)}})}pipe(...t){return t.reduce((n,s)=>s(n),this)}_subscribe(t){}}class y extends u{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>n.error?.(t))}_subscribe(t){const n=this.keyCounter++;return this.subscribers.set(n,t),new x().add(()=>this.subscribers.delete(n))}}class ae{log$=new y;logs=[];log=t=>{const n={...t,timestamp:Date.now()};this.logs.push(n),this.log$.next(n)};createCustomLog(t){return(...n)=>{let s;try{s=t(...n)}catch{s={message:"error in `createCustomLog`",component:"Logger"}}this.log(s)}}createComponentLog(t){return this.createCustomLog(n=>({component:t,...n}))}getAllLogs=()=>this.logs}function ce(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ue(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function Q(e){return typeof e<"u"&&e!==null}function j(e){return e==null}function he(e,t){if(!e?.length)throw new Error(t)}function de(e,t){if(e?.length)throw new Error(t)}const le=(e,t,n)=>new Promise((s,o)=>{t.addEventListener("abort",()=>{f(),w.remove()});const i=()=>{f(),o()},r=()=>{f(),s()},f=()=>{E&&clearTimeout(E),w.removeEventListener("load",r),w.removeEventListener("error",i)};let E;n&&(E=window.setTimeout(i,n));const w=document.createElement("script");w.addEventListener("load",r),w.addEventListener("error",i),w.src=e,document.head.appendChild(w)}),fe=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),we=(e,t)=>async(...n)=>{const s=t(...n);let o=e.aborted,i;for(;!o&&!e.aborted;){const r=await s.next(i);o=r.done??!1,i=r.value}return i};var l;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(l||(l={}));var c;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(c||(c={}));const I=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?l.Yandex:void 0,n=/chrome|crios/i.test(e)?l.Chrome:void 0,s=/chromium/i.test(e)?l.Chromium:void 0,o=/firefox|fxios/i.test(e)?l.Firefox:void 0,i=/webkit|safari|khtml/i.test(e)?l.Safari:void 0,r=/opr\//i.test(e)?l.Opera:void 0,f=/edg/i.test(e)?l.Edge:void 0,E=/android/i.test(e)?c.Android:void 0,w=/iphone/i.test(e)?c.iPhone:void 0,L=/ipad/i.test(e)?c.iPad:void 0,N=/ipod/i.test(e)?c.iPod:void 0,U=/mac/i.test(e)?c.Mac:void 0,k=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?c.RestMobile:void 0;return{browser:t||o||r||f||n||s||i||l.Rest,device:E||w||L||N||k||U||c.Desktop}},me=(e=!1)=>{const n=[c.iPhone,c.iPad,c.iPod].includes(I().device);if(!e)return n;const{userAgent:s,maxTouchPoints:o}=window.navigator;return!!(n||/macintosh/i.test(s)&&o>0)},be=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const n=t[1],s=parseFloat(n);return isNaN(s)?null:s},pe=()=>[c.Mac,c.iPhone,c.iPad,c.iPod].includes(I().device),ge=(e,{start:t=0,factor:n=2,max:s=1/0,min:o=t,random:i=0}={})=>{let r=t;return r*=n**e,r*=1+(Math.random()*i*2-i),r=Math.round(r),r=Math.min(r,s),r=Math.max(r,o),r};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));let p,m;const O=`vk-videoplayer-dummy-key-${Math.random()}`,g=()=>{if(m!==void 0)return m;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),m=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),m=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)m=a.RUNTIME;else throw t}else throw e}return m===a.RUNTIME&&(p=new Map),m},G=()=>g()===a.LOCAL_STORAGE,V=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return p?.get(e);default:b(t)}},D=(e,t)=>{const n=g();switch(n){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(s){if(s instanceof DOMException)console.error(s);else throw s}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(s){if(s instanceof DOMException)console.error(s);else throw s}break;case a.RUNTIME:return void p?.set(e,t);default:b(n)}},F=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return p?.has(e)??!1;default:return b(t),!1}},z=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void p?.delete(e);default:b(t)}},$=()=>{const e=g();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return p?.clear();default:b(e)}};var Ee=Object.freeze({__proto__:null,clear:$,get:V,has:F,isPersistent:G,remove:z,set:D});const Se=()=>{let e,t;try{e=window.self!==window.top}catch(s){s instanceof DOMException&&s.name==="SecurityError"?e=!0:(e=!1,console.error(s))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(s){console.error(s)}try{!t&&document.referrer&&(t=document.referrer)}catch(s){console.error(s)}const n=t?new URL(t).hostname:void 0;return{isEmbed:e,host:n}};var h;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(h||(h={}));const d={[h.Q_144P]:{width:256,height:144},[h.Q_240P]:{width:428,height:240},[h.Q_360P]:{width:640,height:360},[h.Q_480P]:{width:856,height:480},[h.Q_720P]:{width:1280,height:720},[h.Q_1080P]:{width:1920,height:1080},[h.Q_1440P]:{width:2560,height:1440},[h.Q_2160P]:{width:3840,height:2160},[h.Q_4320P]:{width:7680,height:4320}},xe=(e,t)=>d[e].height>d[t].height,Oe=(e,t)=>d[e].height>=d[t].height,T=(e,t)=>d[e].height<d[t].height,Ae=(e,t)=>d[e].height<=d[t].height,ve=e=>e.sort((t,n)=>t===n?0:t===h.INVARIANT?1:n===h.INVARIANT?-1:T(t,n)?1:-1)[0],R=Object.keys(d).sort((e,t)=>T(e,t)?-1:1),_e=(e,t=.02)=>[...R].find(s=>d[s].height*(1+t)>=e),Pe=({width:e,height:t})=>{const n=Math.min(e,t),s=Math.max(e,t);return R.find(o=>{const i=d[o];return i.width>=s&&i.height>=n})},ye=e=>d[e].height,M=e=>e===h.INVARIANT,Ie=e=>e.every(t=>!M(t));function Te(e){if(M(e))throw new Error("Expected exact quality")}const q=(e,t)=>{const n={};for(const s of Object.keys(t)){const o=t[s],i=e[s];Array.isArray(o)&&Array.isArray(i)?n[s]=i:typeof o=="object"&&typeof i=="object"?n[s]=q(i,o):n[s]=s in e?i:o}return n},Re=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};class Me extends y{value;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 n=super._subscribe(t);return t.next(this.value),n}}function Le(e){return new u(t=>{const n={};let s=Object.keys(e).length;const o=i=>r=>{i in n||s--,n[i]=r,s===0&&t.next(n)};return Object.entries(e).reduce((i,[r,f])=>i.add(f.subscribe(o(r))),new x)})}function Ne(...e){return new u(t=>e.reduce((n,s)=>n.add(s.subscribe(t)),new x))}var Ue=e=>new u(t=>{const n=window.setTimeout(()=>{try{t.next()}catch(s){if(t.error)t.error(s);else throw s}},e);return()=>window.clearTimeout(n)}),ke=e=>new u(t=>{const n=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(n)}),Qe=e=>new u(t=>{e.forEach(n=>t.next(n))}),je=(e,t)=>new u(n=>{const s=o=>n.next(o);return e.addEventListener(t,s),()=>e.removeEventListener(t,s)});function Ge(e){return t=>new u(n=>t.subscribe(new H(n,e)))}class H{destination;size;lastValues=[];constructor(t,n){this.destination=t,this.size=n}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const Y={leading:!1,trailing:!0};function Ve(e,t=Y){return n=>new u(s=>n.subscribe(new W(s,e,t)))}class W{destination;time;config;lastValue;timeout;constructor(t,n,s){this.destination=t,this.time=n,this.config=s}next(t){this.lastValue=t,Q(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(n){if(this.destination.error)this.destination.error(n);else throw n}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const C={leading:!0,trailing:!1};function De(e,t=C){return n=>new u(s=>n.subscribe(new X(s,e,t)))}class X{destination;time;config;lastValue;timeout;constructor(t,n,s){this.destination=t,this.time=n,this.config=s}next(t){this.lastValue=t,j(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){this.destination.error?.(t)}}function Fe(e){return t=>new u(n=>t.subscribe(new J(n,e)))}class J{destination;predicate;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.predicate(t)}catch(s){throw this.error(s),s}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function ze(e=(t,n)=>t===n){return t=>new u(n=>t.subscribe(new Z(n,e)))}const A={};class Z{destination;predicate;lastValue=A;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.lastValue===A||!this.predicate(this.lastValue,t),this.lastValue=t}catch(s){throw this.error(s),s}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function B(e){return t=>new u(n=>t.subscribe(new K(n,e)))}let K=class{destination;mapper;constructor(t,n){this.destination=t,this.mapper=n}next(t){let n;try{n=this.mapper(t)}catch(s){throw this.error(s),s}this.destination.next(n)}error(t){this.destination.error?.(t)}};function qe(e){return B(()=>e)}function He(){return e=>new u(t=>{let n=!1,s=!1;const o=e.subscribe(i=>{n||(n=!0,t.next(i)),s&&o.unsubscribe()},i=>{n=!0,t.error?.(i),s&&o.unsubscribe()});return s=!0,n&&o.unsubscribe(),o})}function Ye(){return e=>new u(t=>e.subscribe(new ee(t)))}class ee{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const n=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([n,t])}error(t){this.destination.error?.(t)}}function We(e){return t=>new u(n=>t.subscribe(new te(n,e)))}class te{destination;effect;constructor(t,n){this.destination=t,this.effect=n}next(t){try{this.effect(t)}catch(n){throw this.error(n),n}this.destination.next(t)}error(t){this.destination.error?.(t)}}var v;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(v||(v={}));var _;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(_||(_={}));const ne="vk.com",Ce=async(e,t,n)=>{const s=new URL(`https://${ne}/js/lang-pack.js`);s.searchParams.set("format","json"),s.searchParams.set("name",t),e!==void 0&&s.searchParams.set("lang",e);const i=await(await fetch(s.toString())).json();return se(i,n)},se=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([n,s])=>[n.substring(`${t}_`.length),ie(s)])),ie=e=>Array.isArray(e)?e[0]:e;var P;(function(e){e.RU="ru",e.EN="en"})(P||(P={}));export{l as CurrentClientBrowser,c as CurrentClientDevice,v as ErrorCategory,P as InterfaceLanguage,ae as Logger,u as Observable,y as Subject,x as Subscription,re as VERSION,_ as VKNumericLanguage,Me as ValueSubject,h as VideoQuality,we as abortable,le as addScript,Ie as areQualitiesExact,de as assertEmptyArray,b as assertNever,ce as assertNonNullable,he as assertNotEmptyArray,ue as assertNullable,Te as assertQualityIsExact,Ge as buffer,oe as checkNever,Le as combine,Ve as debounce,Se as detectEmbed,q as fillWithDefault,Fe as filter,ze as filterChanged,je as fromEvent,I as getCurrentBrowser,ge as getExponentialDelay,ve as getHighestQuality,be as getIOSVersion,ke as interval,xe as isHigher,Oe as isHigherOrEqual,me as isIOS,M as isInvariantQuality,T as isLower,Ae as isLowerOrEqual,pe as isMacLike,Q as isNonNullable,j as isNullable,Ce as loadVKLangPack,B as map,qe as mapTo,Ne as merge,S as noop,fe as now,Qe as observableFrom,He as once,Ye as pairwise,Ee as safeStorage,We as tap,De as throttle,Re as timeCodeToString,Ue as timeout,_e as videoHeightToQuality,ye as videoQualityToHeight,Pe as videoSizeToQuality};
6
+ const re="1.0.32-dev.eddd3f7a.0";class x{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(n=>typeof n=="function"?n():n.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const b=e=>{throw new Error(`${e} is value of unexpected type`)},oe=e=>{},S=()=>{};class u{constructor(t){t&&(this._subscribe=t)}subscribe(t,n){let s;n?typeof n=="function"?s={next:n,error:S}:s={next:r=>n.next(r),error:r=>n.error?.(r)}:s={next:S,error:S};const o=typeof t=="function"?{next:r=>{try{t(r)}catch(f){s.next(f)}},error:r=>s.next(r)}:{next:r=>t.next(r),error:r=>t.error?t.error(r):s.next(r)};let i;try{i=this._subscribe(o)}catch(r){o.error?.(r)}return new x().add(()=>{switch(o.next=S,o.error=S,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return b(i)}})}pipe(...t){return t.reduce((n,s)=>s(n),this)}_subscribe(t){}}class y extends u{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>n.error?.(t))}_subscribe(t){const n=this.keyCounter++;return this.subscribers.set(n,t),new x().add(()=>this.subscribers.delete(n))}}class ae{log$=new y;logs=[];log=t=>{const n={...t,timestamp:Date.now()};this.logs.push(n),this.log$.next(n)};createCustomLog(t){return(...n)=>{let s;try{s=t(...n)}catch{s={message:"error in `createCustomLog`",component:"Logger"}}this.log(s)}}createComponentLog(t){return this.createCustomLog(n=>({component:t,...n}))}getAllLogs=()=>this.logs}function ce(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ue(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function Q(e){return typeof e<"u"&&e!==null}function j(e){return e==null}function he(e,t){if(!e?.length)throw new Error(t)}function de(e,t){if(e?.length)throw new Error(t)}const le=(e,t,n)=>new Promise((s,o)=>{t.addEventListener("abort",()=>{f(),w.remove()});const i=()=>{f(),o()},r=()=>{f(),s()},f=()=>{E&&clearTimeout(E),w.removeEventListener("load",r),w.removeEventListener("error",i)};let E;n&&(E=window.setTimeout(i,n));const w=document.createElement("script");w.addEventListener("load",r),w.addEventListener("error",i),w.src=e,document.head.appendChild(w)}),fe=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),we=(e,t)=>async(...n)=>{const s=t(...n);let o=e.aborted,i;for(;!o&&!e.aborted;){const r=await s.next(i);o=r.done??!1,i=r.value}return i};var l;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(l||(l={}));var c;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(c||(c={}));const I=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?l.Yandex:void 0,n=/chrome|crios/i.test(e)?l.Chrome:void 0,s=/chromium/i.test(e)?l.Chromium:void 0,o=/firefox|fxios/i.test(e)?l.Firefox:void 0,i=/webkit|safari|khtml/i.test(e)?l.Safari:void 0,r=/opr\//i.test(e)?l.Opera:void 0,f=/edg/i.test(e)?l.Edge:void 0,E=/android/i.test(e)?c.Android:void 0,w=/iphone/i.test(e)?c.iPhone:void 0,L=/ipad/i.test(e)?c.iPad:void 0,N=/ipod/i.test(e)?c.iPod:void 0,U=/mac/i.test(e)?c.Mac:void 0,k=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?c.RestMobile:void 0;return{browser:t||o||r||f||n||s||i||l.Rest,device:E||w||L||N||k||U||c.Desktop}},me=(e=!1)=>{const n=[c.iPhone,c.iPad,c.iPod].includes(I().device);if(!e)return n;const{userAgent:s,maxTouchPoints:o}=window.navigator;return!!(n||/macintosh/i.test(s)&&o>0)},be=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const n=t[1],s=parseFloat(n);return isNaN(s)?null:s},pe=()=>[c.Mac,c.iPhone,c.iPad,c.iPod].includes(I().device),ge=(e,{start:t=0,factor:n=2,max:s=1/0,min:o=t,random:i=0}={})=>{let r=t;return r*=n**e,r*=1+(Math.random()*i*2-i),r=Math.round(r),r=Math.min(r,s),r=Math.max(r,o),r};var a;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(a||(a={}));let p,m;const O=`vk-videoplayer-dummy-key-${Math.random()}`,g=()=>{if(m!==void 0)return m;try{localStorage.setItem(O,"test"),localStorage.removeItem(O),m=a.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(O),m=a.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)m=a.RUNTIME;else throw t}else throw e}return m===a.RUNTIME&&(p=new Map),m},G=()=>g()===a.LOCAL_STORAGE,V=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case a.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case a.RUNTIME:return p?.get(e);default:b(t)}},D=(e,t)=>{const n=g();switch(n){case a.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(s){if(s instanceof DOMException)console.error(s);else throw s}break;case a.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(s){if(s instanceof DOMException)console.error(s);else throw s}break;case a.RUNTIME:return void p?.set(e,t);default:b(n)}},F=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return e in localStorage;case a.SESSION_STORAGE:return e in sessionStorage;case a.RUNTIME:return p?.has(e)??!1;default:return b(t),!1}},z=e=>{const t=g();switch(t){case a.LOCAL_STORAGE:return localStorage.removeItem(e);case a.SESSION_STORAGE:return sessionStorage.removeItem(e);case a.RUNTIME:return void p?.delete(e);default:b(t)}},$=()=>{const e=g();switch(e){case a.LOCAL_STORAGE:return localStorage.clear();case a.SESSION_STORAGE:return sessionStorage.clear();case a.RUNTIME:return p?.clear();default:b(e)}};var Ee=Object.freeze({__proto__:null,clear:$,get:V,has:F,isPersistent:G,remove:z,set:D});const Se=()=>{let e,t;try{e=window.self!==window.top}catch(s){s instanceof DOMException&&s.name==="SecurityError"?e=!0:(e=!1,console.error(s))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(s){console.error(s)}try{!t&&document.referrer&&(t=document.referrer)}catch(s){console.error(s)}const n=t?new URL(t).hostname:void 0;return{isEmbed:e,host:n}};var h;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(h||(h={}));const d={[h.Q_144P]:{width:256,height:144},[h.Q_240P]:{width:428,height:240},[h.Q_360P]:{width:640,height:360},[h.Q_480P]:{width:856,height:480},[h.Q_720P]:{width:1280,height:720},[h.Q_1080P]:{width:1920,height:1080},[h.Q_1440P]:{width:2560,height:1440},[h.Q_2160P]:{width:3840,height:2160},[h.Q_4320P]:{width:7680,height:4320}},xe=(e,t)=>d[e].height>d[t].height,Oe=(e,t)=>d[e].height>=d[t].height,T=(e,t)=>d[e].height<d[t].height,Ae=(e,t)=>d[e].height<=d[t].height,ve=e=>e.sort((t,n)=>t===n?0:t===h.INVARIANT?1:n===h.INVARIANT?-1:T(t,n)?1:-1)[0],R=Object.keys(d).sort((e,t)=>T(e,t)?-1:1),_e=(e,t=.02)=>[...R].find(s=>d[s].height*(1+t)>=e),Pe=({width:e,height:t})=>{const n=Math.min(e,t),s=Math.max(e,t);return R.find(o=>{const i=d[o];return i.width>=s&&i.height>=n})},ye=e=>d[e].height,M=e=>e===h.INVARIANT,Ie=e=>e.every(t=>!M(t));function Te(e){if(M(e))throw new Error("Expected exact quality")}const q=(e,t)=>{const n={};for(const s of Object.keys(t)){const o=t[s],i=e[s];Array.isArray(o)&&Array.isArray(i)?n[s]=i:typeof o=="object"&&typeof i=="object"?n[s]=q(i,o):n[s]=s in e?i:o}return n},Re=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};class Me extends y{value;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 n=super._subscribe(t);return t.next(this.value),n}}function Le(e){return new u(t=>{const n={};let s=Object.keys(e).length;const o=i=>r=>{i in n||s--,n[i]=r,s===0&&t.next(n)};return Object.entries(e).reduce((i,[r,f])=>i.add(f.subscribe(o(r))),new x)})}function Ne(...e){return new u(t=>e.reduce((n,s)=>n.add(s.subscribe(t)),new x))}var Ue=e=>new u(t=>{const n=window.setTimeout(()=>{try{t.next()}catch(s){if(t.error)t.error(s);else throw s}},e);return()=>window.clearTimeout(n)}),ke=e=>new u(t=>{const n=window.setInterval(()=>t.next(),e);return()=>window.clearInterval(n)}),Qe=e=>new u(t=>{e.forEach(n=>t.next(n))}),je=(e,t)=>new u(n=>{const s=o=>n.next(o);return e.addEventListener(t,s),()=>e.removeEventListener(t,s)});function Ge(e){return t=>new u(n=>t.subscribe(new H(n,e)))}class H{destination;size;lastValues=[];constructor(t,n){this.destination=t,this.size=n}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const Y={leading:!1,trailing:!0};function Ve(e,t=Y){return n=>new u(s=>n.subscribe(new W(s,e,t)))}class W{destination;time;config;lastValue;timeout;constructor(t,n,s){this.destination=t,this.time=n,this.config=s}next(t){this.lastValue=t,Q(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(n){if(this.destination.error)this.destination.error(n);else throw n}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const C={leading:!0,trailing:!1};function De(e,t=C){return n=>new u(s=>n.subscribe(new X(s,e,t)))}class X{destination;time;config;lastValue;timeout;constructor(t,n,s){this.destination=t,this.time=n,this.config=s}next(t){this.lastValue=t,j(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){this.destination.error?.(t)}}function Fe(e){return t=>new u(n=>t.subscribe(new J(n,e)))}class J{destination;predicate;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.predicate(t)}catch(s){throw this.error(s),s}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function ze(e=(t,n)=>t===n){return t=>new u(n=>t.subscribe(new Z(n,e)))}const A={};class Z{destination;predicate;lastValue=A;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.lastValue===A||!this.predicate(this.lastValue,t),this.lastValue=t}catch(s){throw this.error(s),s}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function B(e){return t=>new u(n=>t.subscribe(new K(n,e)))}let K=class{destination;mapper;constructor(t,n){this.destination=t,this.mapper=n}next(t){let n;try{n=this.mapper(t)}catch(s){throw this.error(s),s}this.destination.next(n)}error(t){this.destination.error?.(t)}};function qe(e){return B(()=>e)}function He(){return e=>new u(t=>{let n=!1,s=!1;const o=e.subscribe(i=>{n||(n=!0,t.next(i)),s&&o.unsubscribe()},i=>{n=!0,t.error?.(i),s&&o.unsubscribe()});return s=!0,n&&o.unsubscribe(),o})}function Ye(){return e=>new u(t=>e.subscribe(new ee(t)))}class ee{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const n=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([n,t])}error(t){this.destination.error?.(t)}}function We(e){return t=>new u(n=>t.subscribe(new te(n,e)))}class te{destination;effect;constructor(t,n){this.destination=t,this.effect=n}next(t){try{this.effect(t)}catch(n){throw this.error(n),n}this.destination.next(t)}error(t){this.destination.error?.(t)}}var v;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf"})(v||(v={}));var _;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(_||(_={}));const ne="vk.com",Ce=async(e,t,n)=>{const s=new URL(`https://${ne}/js/lang-pack.js`);s.searchParams.set("format","json"),s.searchParams.set("name",t),e!==void 0&&s.searchParams.set("lang",e);const i=await(await fetch(s.toString())).json();return se(i,n)},se=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([n,s])=>[n.substring(`${t}_`.length),ie(s)])),ie=e=>Array.isArray(e)?e[0]:e;var P;(function(e){e.RU="ru",e.EN="en"})(P||(P={}));export{l as CurrentClientBrowser,c as CurrentClientDevice,v as ErrorCategory,P as InterfaceLanguage,ae as Logger,u as Observable,y as Subject,x as Subscription,re as VERSION,_ as VKNumericLanguage,Me as ValueSubject,h as VideoQuality,we as abortable,le as addScript,Ie as areQualitiesExact,de as assertEmptyArray,b as assertNever,ce as assertNonNullable,he as assertNotEmptyArray,ue as assertNullable,Te as assertQualityIsExact,Ge as buffer,oe as checkNever,Le as combine,Ve as debounce,Se as detectEmbed,q as fillWithDefault,Fe as filter,ze as filterChanged,je as fromEvent,I as getCurrentBrowser,ge as getExponentialDelay,ve as getHighestQuality,be as getIOSVersion,ke as interval,xe as isHigher,Oe as isHigherOrEqual,me as isIOS,M as isInvariantQuality,T as isLower,Ae as isLowerOrEqual,pe as isMacLike,Q as isNonNullable,j as isNullable,Ce as loadVKLangPack,B as map,qe as mapTo,Ne as merge,S as noop,fe as now,Qe as observableFrom,He as once,Ye as pairwise,Ee as safeStorage,We as tap,De as throttle,Re as timeCodeToString,Ue as timeout,_e as videoHeightToQuality,ye as videoQualityToHeight,Pe as videoSizeToQuality};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.32-dev.0f82d9ff.0",
3
+ "version": "1.0.32-dev.eddd3f7a.0",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",
@@ -41,12 +41,15 @@
41
41
  "./es2018.esm.js": "./es2018.esm.js",
42
42
  "./es2018.cjs.js": "./es2018.cjs.js",
43
43
  "./es2015.esm.js": "./es2015.esm.js",
44
- "./es2015.cjs.js": "./es2015.cjs.js"
44
+ "./es2015.cjs.js": "./es2015.cjs.js",
45
+ "./es2015.umd.js": "./es2015.umd.js",
46
+ "./es5.umd.js": "./es5.umd.js"
45
47
  },
46
48
  "files": [
47
49
  "*.cjs.js",
48
50
  "*.esm.js",
49
- "**/*.d.ts"
51
+ "**/*.d.ts",
52
+ "*.umd.js"
50
53
  ],
51
54
  "dependencies": {}
52
55
  }