@vkontakte/videoplayer-shared 1.0.38-dev.736aea74.0 → 1.0.38-dev.876770ad.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/es2015.cjs.js +3 -3
- package/es2015.esm.js +3 -3
- package/es2018.cjs.js +3 -3
- package/es2018.esm.js +3 -3
- package/esnext.cjs.js +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +1 -1
- package/types/utils/clearVideoElement.d.ts +1 -0
- package/types/utils/clientChecker.d.ts +52 -0
- package/types/utils/cloneDeepWith.d.ts +1 -1
- package/types/utils/detectEmbed.d.ts +1 -1
- package/types/utils/index.d.ts +2 -2
- package/types/utils/detectBrowser.d.ts +0 -31
package/es2015.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.38-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.38-dev.876770ad.0
|
|
3
|
+
* Thu, 15 Aug 2024 18:48:59 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-38/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var V=Object.defineProperty,dt=Object.defineProperties,ft=Object.getOwnPropertyDescriptor,mt=Object.getOwnPropertyDescriptors,Tt=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable;var ge=Math.pow,xe=(t,e,r)=>e in t?V(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e)=>{for(var r in e||(e={}))he.call(e,r)&&xe(t,r,e[r]);if(Ie)for(var r of Ie(e))vt.call(e,r)&&xe(t,r,e[r]);return t},Q=(t,e)=>dt(t,mt(e));var ye=(t,e)=>{for(var r in e)V(t,r,{get:e[r],enumerable:!0})},It=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tt(e))!he.call(t,i)&&i!==r&&V(t,i,{get:()=>e[i],enumerable:!(n=ft(e,i))||n.enumerable});return t};var xt=t=>It(V({},"__esModule",{value:!0}),t);var _=(t,e,r)=>new Promise((n,i)=>{var s=a=>{try{o(r.next(a))}catch(c){i(c)}},u=a=>{try{o(r.throw(a))}catch(c){i(c)}},o=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,u);o((r=r.apply(t,e)).next())});var Nt={};ye(Nt,{CurrentClientBrowser:()=>H,CurrentClientDevice:()=>K,ErrorCategory:()=>ot,InterfaceLanguage:()=>st,Logger:()=>D,Observable:()=>l,Subject:()=>x,Subscription:()=>m,VERSION:()=>Oe,VKNumericLanguage:()=>it,ValueSubject:()=>C,VideoQuality:()=>z,abortable:()=>Pe,addScript:()=>Ce,areQualitiesExact:()=>Ke,assertEmptyArray:()=>Re,assertNever:()=>I,assertNonNullable:()=>Ee,assertNotEmptyArray:()=>Ae,assertNullable:()=>Se,assertQualityIsExact:()=>$e,buffer:()=>Z,checkNever:()=>we,cloneDeep:()=>Xe,cloneDeepWith:()=>R,combine:()=>Y,debounce:()=>te,debounceFn:()=>W,detectEmbed:()=>Ue,fillWithDefault:()=>Ye,filter:()=>ie,filterChanged:()=>ae,fromEvent:()=>rt,getCurrentBrowser:()=>A,getExponentialDelay:()=>De,getHighestQuality:()=>Be,getIOSVersion:()=>Ne,interval:()=>et,isAndroid:()=>Ve,isHigher:()=>Fe,isHigherOrEqual:()=>ze,isIOS:()=>Me,isInvariantQuality:()=>B,isLower:()=>j,isLowerOrEqual:()=>je,isMacLike:()=>Qe,isMobile:()=>_e,isNonNullable:()=>y,isNullable:()=>U,loadVKLangPack:()=>Lt,map:()=>k,mapTo:()=>ue,merge:()=>X,noop:()=>h,now:()=>Le,observableFrom:()=>tt,observeElementSize:()=>Je,once:()=>ce,pairwise:()=>be,safeStorage:()=>F,tap:()=>fe,throttle:()=>ne,throttleFn:()=>G,timeCodeToString:()=>St,timeout:()=>Ze,videoHeightToQuality:()=>Ge,videoQualityToHeight:()=>He,videoSizeToQuality:()=>qe});module.exports=xt(Nt);var Oe="1.0.38-dev.736aea74.0";var m=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var I=t=>{throw new Error(`${t} is value of unexpected type`)},we=t=>{};var h=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){var u;let n;r?typeof r=="function"?n={next:r,error:h}:n={next:o=>r.next(o),error:o=>{var a;return(a=r.error)==null?void 0:a.call(r,o)}}:n={next:h,error:h};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){(u=i.error)==null||u.call(i,o)}return new m().add(()=>{switch(i.next=h,i.error=h,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return I(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var x=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>{var i;return(i=n.error)==null?void 0:i.call(n,r)})}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new m().add(()=>this.subscribers.delete(n))}};var D=class{constructor(){this.log$=new x;this.logs=[];this.log=e=>{let r=Q(w({},e),{timestamp:Date.now()});this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch(i){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>w({component:e},r))}};function Ee(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Se(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t!="undefined"&&t!==null}function U(t){return t==null}function Ae(t,e){if(!(t!=null&&t.length))throw new Error(e)}function Re(t,e){if(t!=null&&t.length)throw new Error(e)}var Ce=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{o(),c.remove()});let s=()=>{o(),i()},u=()=>{o(),n()},o=()=>{a&&clearTimeout(a),c.removeEventListener("load",u),c.removeEventListener("error",s)},a;r&&(a=window.setTimeout(s,r));let c=document.createElement("script");c.addEventListener("load",u),c.addEventListener("error",s),c.src=t,document.head.appendChild(c)});var ke,Le=typeof((ke=window.performance)==null?void 0:ke.now)=="function"?()=>window.performance.now():()=>Date.now();var Pe=(t,e)=>(...r)=>_(void 0,null,function*(){var u;let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=yield n.next(s);i=(u=o.done)!=null?u:!1,s=o.value}catch(o){yield n.throw(o)}return s});var H=(c=>(c.Unknown="Unknown",c.Yandex="Yandex",c.Chrome="Chrome",c.Chromium="Chromium",c.Firefox="Firefox",c.Safari="Safari",c.Opera="Opera",c.Edge="Edge",c.Rest="Rest",c))(H||{}),K=(a=>(a.Unknown="Unknown",a.Android="Android",a.iPhone="iPhone",a.iPad="iPad",a.iPod="iPod",a.RestMobile="RestMobile",a.Mac="Mac",a.Desktop="Desktop",a))(K||{}),A=()=>{let{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?"Yandex":void 0,r=/chrome|crios/i.test(t)?"Chrome":void 0,n=/chromium/i.test(t)?"Chromium":void 0,i=/firefox|fxios/i.test(t)?"Firefox":void 0,s=/webkit|safari|khtml/i.test(t)?"Safari":void 0,u=/opr\//i.test(t)?"Opera":void 0,o=/edg/i.test(t)?"Edge":void 0,a=/android/i.test(t)?"Android":void 0,c=/iphone/i.test(t)?"iPhone":void 0,f=/ipad/i.test(t)?"iPad":void 0,b=/ipod/i.test(t)?"iPod":void 0,S=/mac/i.test(t)?"Mac":void 0,L=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?"RestMobile":void 0;return{browser:e||i||u||o||r||n||s||"Rest",device:a||c||f||b||L||S||"Desktop"}},Me=(t=!1)=>{let r=["iPhone","iPad","iPod"].includes(A().device);if(!t)return r;let{userAgent:n,maxTouchPoints:i}=window.navigator;return!!(r||/macintosh/i.test(n)&&i>0)},Ne=()=>{let{userAgent:t}=window.navigator,e=t.match(/Version\/(\d+(\.\d+)?)/i);if(!e)return null;let r=e[1],n=parseFloat(r);return isNaN(n)?null:n},Ve=()=>A().device==="Android",Qe=()=>["Mac","iPhone","iPad","iPod"].includes(A().device),_e=()=>{var t,e;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((t=navigator.appVersion)!=null?t:navigator.userAgent)||((e=navigator==null?void 0:navigator.userAgentData)==null?void 0:e.mobile)};var De=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let u=e;return u*=ge(r,t),u*=1+(Math.random()*s*2-s),u=Math.round(u),u=Math.min(u,n),u=Math.max(u,i),u};var F={};ye(F,{clear:()=>Et,get:()=>gt,has:()=>Ot,isPersistent:()=>ht,remove:()=>wt,set:()=>yt});var d,O,$=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(O!==void 0)return O;try{localStorage.setItem($,"test"),localStorage.removeItem($),O=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem($),O=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)O=2;else throw e}else throw t}return O===2&&(d=new Map),O},ht=()=>E()===0,gt=t=>{var r,n;let e=E();switch(e){case 0:return(r=localStorage.getItem(t))!=null?r:void 0;case 1:return(n=sessionStorage.getItem(t))!=null?n:void 0;case 2:return d==null?void 0:d.get(t);default:I(e)}},yt=(t,e)=>{let r=E();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void(d==null?void 0:d.set(t,e));default:I(r)}},Ot=t=>{var r;let e=E();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return(r=d==null?void 0:d.has(t))!=null?r:!1;default:return I(e),!1}},wt=t=>{let e=E();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void(d==null?void 0:d.delete(t));default:I(e)}},Et=()=>{let t=E();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return d==null?void 0:d.clear();default:I(t)}};var Ue=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var z=(f=>(f.INVARIANT="Invariant quality",f.Q_144P="144p",f.Q_240P="240p",f.Q_360P="360p",f.Q_480P="480p",f.Q_720P="720p",f.Q_1080P="1080p",f.Q_1440P="1440p",f.Q_2160P="2160p",f.Q_4320P="4320p",f))(z||{});var T={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Fe=(t,e)=>T[t].height>T[e].height,ze=(t,e)=>T[t].height>=T[e].height,j=(t,e)=>T[t].height<T[e].height,je=(t,e)=>T[t].height<=T[e].height,Be=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:j(e,r)?1:-1)[0],We=Object.keys(T).sort((t,e)=>j(t,e)?-1:1),Ge=(t,e=.02)=>[...We].find(n=>T[n].height*(1+e)>=t),qe=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return We.find(i=>{let s=T[i];return s.width>=n&&s.height>=r})},He=t=>T[t].height,B=t=>t==="Invariant quality",Ke=t=>t.every(e=>!B(e));function $e(t){if(B(t))throw new Error("Expected exact quality")}var Ye=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=Ye(s,i):r[n]=n in t?s:i}return r};var St=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function W(t,e=0,r){let n,i,s,u,o,a,c=0,f=!1,b=!1,S=!0,L=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(f=!!r.leading,b="maxWait"in r,s=r!=null&&r.maxWait?Math.max(+(r==null?void 0:r.maxWait)||0,e):s,S="trailing"in r?!!r.trailing:S);function q(p){let v=n,g=i;return n=i=void 0,c=p,u=t.apply(g,v),u}function P(p,v){return L?(o&&window.cancelAnimationFrame(o),window.requestAnimationFrame(p)):setTimeout(p,v)}function at(p){if(L){window.cancelAnimationFrame(p);return}clearTimeout(p)}function lt(p){return c=p,o=P(M,e),f?q(p):u}function ut(p){let v=p-a,g=p-c,ve=e-v;return b?Math.min(ve,s-g):ve}function me(p){let v=p-a,g=p-c;return a===void 0||v>=e||v<0||b&&g>=s}function M(){let p=Date.now();if(me(p))return Te(p);o=P(M,ut(p))}function Te(p){return o=void 0,S&&n?q(p):(n=i=void 0,u)}function ct(){o!==void 0&&at(o),c=0,n=a=i=o=void 0}function pt(){return o===void 0?u:Te(Date.now())}function bt(){return o!==void 0}function N(...p){let v=Date.now(),g=me(v);if(n=p,i=this,a=v,g){if(o===void 0)return lt(a);if(b)return o=P(M,e),q(a)}return o===void 0&&(o=P(M,e)),u}return N.cancel=ct,N.flush=pt,N.pending=bt,N}var G=(t,e=0,r)=>W(t,e,Q(w(w({},{leading:!0,trailing:!0}),r),{maxWait:e}));var R=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=R(t[n],e):r[n]=t[n]}return r};var Xe=t=>R(t);var At=300,Je=(t,e=At)=>new l(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(G(u=>{let o=u[0];if(!o)return;let a,c;o.contentBoxSize&&o.contentBoxSize[0]?(c=o.contentBoxSize[0].blockSize,a=o.contentBoxSize[0].inlineSize):o.contentRect&&(a=o.contentRect.width,c=o.contentRect.height),y(a)&&y(c)&&r.next({width:a,height:c})},e));return s.observe(t),()=>s.disconnect()});var C=class extends x{constructor(r){super();this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){let n=super._subscribe(r);return r.next(this.value),n}};function Y(t){return new l(e=>{let r={},n=Object.keys(t).length,i=s=>u=>{s in r||n--,r[s]=u,n===0&&e.next(r)};return Object.entries(t).reduce((s,[u,o])=>s.add(o.subscribe(i(u))),new m)})}function X(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new m))}var Ze=t=>new l(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var et=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var tt=t=>new l(e=>{t.forEach(r=>e.next(r))});var rt=(t,e)=>new l(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function Z(t){return e=>new l(r=>e.subscribe(new J(r,t)))}var J=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var Rt={leading:!1,trailing:!0};function te(t,e=Rt){return r=>new l(n=>r.subscribe(new ee(n,t,e)))}var ee=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var Ct={leading:!0,trailing:!1};function ne(t,e=Ct){return r=>new l(n=>r.subscribe(new re(n,t,e)))}var re=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,U(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function ie(t){return e=>new l(r=>e.subscribe(new oe(r,t)))}var oe=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function ae(t=(e,r)=>e===r){return e=>new l(r=>e.subscribe(new se(r,t)))}var nt={},se=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=nt}next(e){let r;try{r=this.lastValue===nt||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function k(t){return e=>new l(r=>e.subscribe(new le(r,t)))}var le=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function ue(t){return k(()=>t)}function ce(){return t=>new l(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{var u;r=!0,(u=e.error)==null||u.call(e,s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function be(){return t=>new l(e=>t.subscribe(new pe(e)))}var pe=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function fe(t){return e=>new l(r=>e.subscribe(new de(r,t)))}var de=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var ot=(o=>(o.NETWORK="network",o.VIDEO_PIPELINE="video_pipeline",o.EXTERNAL_API="external_api",o.PARSER="parser",o.DOM="dom",o.WTF="wtf",o.FATAL="fatal",o))(ot||{});var it=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(it||{}),kt="vk.com",Lt=(t,e,r)=>_(void 0,null,function*(){let n=new URL(`https://${kt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=yield(yield fetch(n.toString())).json();return Pt(s,r)}),Pt=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Mt(n)])),Mt=t=>Array.isArray(t)?t[0]:t;var st=(r=>(r.RU="ru",r.EN="en",r))(st||{});
|
|
6
|
+
"use strict";var L=Object.defineProperty,lt=Object.defineProperties,ct=Object.getOwnPropertyDescriptor,ut=Object.getOwnPropertyDescriptors,pt=Object.getOwnPropertyNames,Te=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;var Ie=Math.pow,ve=(r,e,t)=>e in r?L(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,w=(r,e)=>{for(var t in e||(e={}))he.call(e,t)&&ve(r,t,e[t]);if(Te)for(var t of Te(e))bt.call(e,t)&&ve(r,t,e[t]);return r},V=(r,e)=>lt(r,ut(e));var xe=(r,e)=>{for(var t in e)L(r,t,{get:e[t],enumerable:!0})},dt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of pt(e))!he.call(r,i)&&i!==t&&L(r,i,{get:()=>e[i],enumerable:!(n=ct(e,i))||n.enumerable});return r};var ft=r=>dt(L({},"__esModule",{value:!0}),r);var M=(r,e,t)=>new Promise((n,i)=>{var s=c=>{try{o(t.next(c))}catch(u){i(u)}},a=c=>{try{o(t.throw(c))}catch(u){i(u)}},o=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);o((t=t.apply(r,e)).next())});var Ct={};xe(Ct,{CC:()=>ke,ErrorCategory:()=>Ze,InterfaceLanguage:()=>tt,Logger:()=>N,Observable:()=>l,Subject:()=>I,Subscription:()=>m,VERSION:()=>ge,VKNumericLanguage:()=>et,ValueSubject:()=>R,VideoQuality:()=>D,abortable:()=>Pe,addScript:()=>Re,areQualitiesExact:()=>ze,assertEmptyArray:()=>Se,assertNever:()=>h,assertNonNullable:()=>Oe,assertNotEmptyArray:()=>Ee,assertNullable:()=>we,assertQualityIsExact:()=>je,buffer:()=>$,checkNever:()=>ye,clearVideoElement:()=>qe,cloneDeep:()=>Ge,cloneDeepWith:()=>S,combine:()=>q,debounce:()=>J,debounceFn:()=>F,detectEmbed:()=>Ve,fillWithDefault:()=>We,filter:()=>re,filterChanged:()=>ie,fromEvent:()=>Xe,getExponentialDelay:()=>Le,getHighestQuality:()=>Qe,interval:()=>Ye,isHigher:()=>Me,isHigherOrEqual:()=>Ne,isInvariantQuality:()=>B,isLower:()=>U,isLowerOrEqual:()=>_e,isNonNullable:()=>y,isNullable:()=>_,loadVKLangPack:()=>St,map:()=>A,mapTo:()=>se,merge:()=>K,noop:()=>x,now:()=>Ce,observableFrom:()=>$e,observeElementSize:()=>He,once:()=>ae,pairwise:()=>ce,safeStorage:()=>Q,tap:()=>pe,throttle:()=>ee,throttleFn:()=>z,timeCodeToString:()=>gt,timeout:()=>Ke,videoHeightToQuality:()=>Ue,videoQualityToHeight:()=>Fe,videoSizeToQuality:()=>Be});module.exports=ft(Ct);var ge="1.0.38-dev.876770ad.0";var m=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var h=r=>{throw new Error(`${r} is value of unexpected type`)},ye=r=>{};var x=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var a;let n;t?typeof t=="function"?n={next:t,error:x}:n={next:o=>t.next(o),error:o=>{var c;return(c=t.error)==null?void 0:c.call(t,o)}}:n={next:x,error:x};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(c){n.next(c)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){(a=i.error)==null||a.call(i,o)}return new m().add(()=>{switch(i.next=x,i.error=x,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return h(s)}})}pipe(...e){return e.reduce((t,n)=>n(t),this)}_subscribe(e){}};var I=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>{var i;return(i=n.error)==null?void 0:i.call(n,t)})}_subscribe(t){let n=this.keyCounter++;return this.subscribers.set(n,t),new m().add(()=>this.subscribers.delete(n))}};var N=class{constructor(){this.log$=new I;this.logs=[];this.log=e=>{let t=V(w({},e),{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch(i){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>w({component:e},t))}};function Oe(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function we(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function y(r){return typeof r!="undefined"&&r!==null}function _(r){return r==null}function Ee(r,e){if(!(r!=null&&r.length))throw new Error(e)}function Se(r,e){if(r!=null&&r.length)throw new Error(e)}var Re=(r,e,t)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{o(),u.remove()});let s=()=>{o(),i()},a=()=>{o(),n()},o=()=>{c&&clearTimeout(c),u.removeEventListener("load",a),u.removeEventListener("error",s)},c;t&&(c=window.setTimeout(s,t));let u=document.createElement("script");u.addEventListener("load",a),u.addEventListener("error",s),u.src=r,document.head.appendChild(u)});var Ae,Ce=typeof((Ae=window.performance)==null?void 0:Ae.now)=="function"?()=>window.performance.now():()=>Date.now();var Pe=(r,e)=>(...t)=>M(void 0,null,function*(){var a;let n=e(...t),i=r.aborted,s;for(;!i&&!r.aborted;)try{let o=yield n.next(s);i=(a=o.done)!=null?a:!1,s=o.value}catch(o){yield n.throw(o)}return s});var G=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||(window==null?void 0:window.screen.width)>700,t=this._iosVersion;return!e||e&&!!t&&t<16}get isAndroid(){return this.device==="Android"}get isMobile(){var e,t;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((e=navigator.appVersion)!=null?e:navigator.userAgent)||((t=navigator==null?void 0:navigator.userAgentData)==null?void 0:t.mobile)}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){var n;let{userAgent:e,maxTouchPoints:t}=navigator;try{this._maxTouchPoints=t,this._isHdr=!!((n=matchMedia("(dynamic-range: high)"))!=null&&n.matches)}catch(i){console.error(i)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let t=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,a=/firefox|fxios/i.test(e)?"Firefox":void 0,o=/webkit|safari|khtml/i.test(e)?"Safari":void 0,c=/opr\//i.test(e)?"Opera":void 0,u=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=t||n||a||c||u||i||s||o||"Rest"}catch(t){console.error(t)}}detectDevice(e){try{let t=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,a=/mac/i.test(e)?"Mac":void 0,o=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=t||n||i||s||o||a||"Desktop"}catch(t){console.error(t)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return;let n=t[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+)/);if(!t)return;let n=t[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},ke=new G;var Le=(r,{start:e=0,factor:t=2,max:n=1/0,min:i=e,random:s=0}={})=>{let a=e;return a*=Ie(t,r),a*=1+(Math.random()*s*2-s),a=Math.round(a),a=Math.min(a,n),a=Math.max(a,i),a};var Q={};xe(Q,{clear:()=>xt,get:()=>Tt,has:()=>ht,isPersistent:()=>mt,remove:()=>It,set:()=>vt});var d,O,H=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(O!==void 0)return O;try{localStorage.setItem(H,"test"),localStorage.removeItem(H),O=0}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(H),O=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)O=2;else throw e}else throw r}return O===2&&(d=new Map),O},mt=()=>E()===0,Tt=r=>{var t,n;let e=E();switch(e){case 0:return(t=localStorage.getItem(r))!=null?t:void 0;case 1:return(n=sessionStorage.getItem(r))!=null?n:void 0;case 2:return d==null?void 0:d.get(r);default:h(e)}},vt=(r,e)=>{let t=E();switch(t){case 0:try{localStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void(d==null?void 0:d.set(r,e));default:h(t)}},ht=r=>{var t;let e=E();switch(e){case 0:return r in localStorage;case 1:return r in sessionStorage;case 2:return(t=d==null?void 0:d.has(r))!=null?t:!1;default:return h(e),!1}},It=r=>{let e=E();switch(e){case 0:return localStorage.removeItem(r);case 1:return sessionStorage.removeItem(r);case 2:return void(d==null?void 0:d.delete(r));default:h(e)}},xt=()=>{let r=E();switch(r){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return d==null?void 0:d.clear();default:h(r)}};var Ve=()=>{let r,e;try{r=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?r=!0:(r=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let t=e?new URL(e).hostname:void 0;return{isEmbed:r,host:t}};var D=(f=>(f.INVARIANT="Invariant quality",f.Q_144P="144p",f.Q_240P="240p",f.Q_360P="360p",f.Q_480P="480p",f.Q_720P="720p",f.Q_1080P="1080p",f.Q_1440P="1440p",f.Q_2160P="2160p",f.Q_4320P="4320p",f))(D||{});var T={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Me=(r,e)=>T[r].height>T[e].height,Ne=(r,e)=>T[r].height>=T[e].height,U=(r,e)=>T[r].height<T[e].height,_e=(r,e)=>T[r].height<=T[e].height,Qe=r=>r.sort((e,t)=>e===t?0:e==="Invariant quality"?1:t==="Invariant quality"?-1:U(e,t)?1:-1)[0],De=Object.keys(T).sort((r,e)=>U(r,e)?-1:1),Ue=(r,e=.02)=>[...De].find(n=>T[n].height*(1+e)>=r),Be=({width:r,height:e})=>{let t=Math.min(r,e),n=Math.max(r,e);return De.find(i=>{let s=T[i];return s.width>=n&&s.height>=t})},Fe=r=>T[r].height,B=r=>r==="Invariant quality",ze=r=>r.every(e=>!B(e));function je(r){if(B(r))throw new Error("Expected exact quality")}var We=(r,e)=>{let t={};for(let n of Object.keys(e)){let i=e[n],s=r[n];Array.isArray(i)&&Array.isArray(s)?t[n]=s:typeof i=="object"&&typeof s=="object"?t[n]=We(s,i):t[n]=n in r?s:i}return t};var gt=r=>{let e="";return r>=3600&&(e+=Math.floor(r/3600)+"h",r=r%3600),r>=60&&(e+=Math.floor(r/60)+"m",r=r%60),r>0&&(e+=Math.floor(r)+"s"),e};function F(r,e=0,t){let n,i,s,a,o,c,u=0,f=!1,b=!1,j=!0,be=!e&&e!==0&&typeof window.requestAnimationFrame=="function";t&&(f=!!t.leading,b="maxWait"in t,s=t!=null&&t.maxWait?Math.max(+(t==null?void 0:t.maxWait)||0,e):s,j="trailing"in t?!!t.trailing:j);function W(p){let v=n,g=i;return n=i=void 0,u=p,a=r.apply(g,v),a}function C(p,v){return be?(o&&window.cancelAnimationFrame(o),window.requestAnimationFrame(p)):setTimeout(p,v)}function rt(p){if(be){window.cancelAnimationFrame(p);return}clearTimeout(p)}function nt(p){return u=p,o=C(P,e),f?W(p):a}function it(p){let v=p-c,g=p-u,me=e-v;return b?Math.min(me,s-g):me}function de(p){let v=p-c,g=p-u;return c===void 0||v>=e||v<0||b&&g>=s}function P(){let p=Date.now();if(de(p))return fe(p);o=C(P,it(p))}function fe(p){return o=void 0,j&&n?W(p):(n=i=void 0,a)}function ot(){o!==void 0&&rt(o),u=0,n=c=i=o=void 0}function st(){return o===void 0?a:fe(Date.now())}function at(){return o!==void 0}function k(...p){let v=Date.now(),g=de(v);if(n=p,i=this,c=v,g){if(o===void 0)return nt(c);if(b)return o=C(P,e),W(c)}return o===void 0&&(o=C(P,e)),a}return k.cancel=ot,k.flush=st,k.pending=at,k}var z=(r,e=0,t)=>F(r,e,V(w(w({},{leading:!0,trailing:!0}),t),{maxWait:e}));var S=(r,e)=>{if(r===null||typeof r!="object")return r;let t=Array.isArray(r)?[]:{};for(let n in r){if(typeof e=="function"){let i=e(r[n],n,r,t);if(i!==void 0){t[n]=i;continue}}typeof r[n]=="object"?t[n]=S(r[n],e):t[n]=r[n]}return t};var Ge=r=>S(r);var yt=300,He=(r,e=yt)=>new l(t=>{let{width:n,height:i}=r.getBoundingClientRect();if(t.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(z(a=>{let o=a[0];if(!o)return;let c,u;o.contentBoxSize&&o.contentBoxSize[0]?(u=o.contentBoxSize[0].blockSize,c=o.contentBoxSize[0].inlineSize):o.contentRect&&(c=o.contentRect.width,u=o.contentRect.height),y(c)&&y(u)&&t.next({width:c,height:u})},e));return s.observe(r),()=>s.disconnect()});var qe=r=>{r.removeAttribute("src"),r.load()};var R=class extends I{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}};function q(r){return new l(e=>{let t={},n=Object.keys(r).length,i=s=>a=>{s in t||n--,t[s]=a,n===0&&e.next(t)};return Object.entries(r).reduce((s,[a,o])=>s.add(o.subscribe(i(a))),new m)})}function K(...r){return new l(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new m))}var Ke=r=>new l(e=>{let t=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},r);return()=>window.clearTimeout(t)});var Ye=r=>new l(e=>{let t=window.setInterval(()=>e.next(),r);return()=>{t&&(window.clearInterval(t),t=void 0)}});var $e=r=>new l(e=>{r.forEach(t=>e.next(t))});var Xe=(r,e)=>new l(t=>{let n=i=>t.next(i);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function $(r){return e=>new l(t=>e.subscribe(new Y(t,r)))}var Y=class{constructor(e,t){this.destination=e;this.size=t;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var Ot={leading:!1,trailing:!0};function J(r,e=Ot){return t=>new l(n=>t.subscribe(new X(n,r,e)))}var X=class{constructor(e,t,n){this.destination=e;this.time=t;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var wt={leading:!0,trailing:!1};function ee(r,e=wt){return t=>new l(n=>t.subscribe(new Z(n,r,e)))}var Z=class{constructor(e,t,n){this.destination=e;this.time=t;this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function re(r){return e=>new l(t=>e.subscribe(new te(t,r)))}var te=class{constructor(e,t){this.destination=e;this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function ie(r=(e,t)=>e===t){return e=>new l(t=>e.subscribe(new ne(t,r)))}var Je={},ne=class{constructor(e,t){this.destination=e;this.predicate=t;this.lastValue=Je}next(e){let t;try{t=this.lastValue===Je||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function A(r){return e=>new l(t=>e.subscribe(new oe(t,r)))}var oe=class{constructor(e,t){this.destination=e;this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(t)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function se(r){return A(()=>r)}function ae(){return r=>new l(e=>{let t=!1,n=!1,i=r.subscribe(s=>{t||(t=!0,e.next(s)),n&&i.unsubscribe()},s=>{var a;t=!0,(a=e.error)==null||a.call(e,s),n&&i.unsubscribe()});return n=!0,t&&i.unsubscribe(),i})}function ce(){return r=>new l(e=>r.subscribe(new le(e)))}var le=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function pe(r){return e=>new l(t=>e.subscribe(new ue(t,r)))}var ue=class{constructor(e,t){this.destination=e;this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var Ze=(o=>(o.NETWORK="network",o.VIDEO_PIPELINE="video_pipeline",o.EXTERNAL_API="external_api",o.PARSER="parser",o.DOM="dom",o.WTF="wtf",o.FATAL="fatal",o))(Ze||{});var et=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(et||{}),Et="vk.com",St=(r,e,t)=>M(void 0,null,function*(){let n=new URL(`https://${Et}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),r!==void 0&&n.searchParams.set("lang",r);let s=yield(yield fetch(n.toString())).json();return Rt(s,t)}),Rt=(r,e)=>Object.fromEntries(Object.entries(r.keys).map(([t,n])=>[t.substring(`${e}_`.length),At(n)])),At=r=>Array.isArray(r)?r[0]:r;var tt=(t=>(t.RU="ru",t.EN="en",t))(tt||{});
|
package/es2015.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.38-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.38-dev.876770ad.0
|
|
3
|
+
* Thu, 15 Aug 2024 18:48:59 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-38/doc/
|
|
5
5
|
*/
|
|
6
|
-
var se=Object.defineProperty,ke=Object.defineProperties;var Le=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var ae=Math.pow,ie=(t,e,r)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,O=(t,e)=>{for(var r in e||(e={}))Pe.call(e,r)&&ie(t,r,e[r]);if(oe)for(var r of oe(e))Me.call(e,r)&&ie(t,r,e[r]);return t},L=(t,e)=>ke(t,Le(e));var Ne=(t,e)=>{for(var r in e)se(t,r,{get:e[r],enumerable:!0})};var P=(t,e,r)=>new Promise((n,i)=>{var s=a=>{try{o(r.next(a))}catch(c){i(c)}},l=a=>{try{o(r.throw(a))}catch(c){i(c)}},o=a=>a.done?n(a.value):Promise.resolve(a.value).then(s,l);o((r=r.apply(t,e)).next())});var Ve="1.0.38-dev.736aea74.0";var m=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var I=t=>{throw new Error(`${t} is value of unexpected type`)},Qe=t=>{};var g=()=>{};var u=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){var l;let n;r?typeof r=="function"?n={next:r,error:g}:n={next:o=>r.next(o),error:o=>{var a;return(a=r.error)==null?void 0:a.call(r,o)}}:n={next:g,error:g};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){(l=i.error)==null||l.call(i,o)}return new m().add(()=>{switch(i.next=g,i.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return I(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var x=class extends u{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>{var i;return(i=n.error)==null?void 0:i.call(n,r)})}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new m().add(()=>this.subscribers.delete(n))}};var D=class{constructor(){this.log$=new x;this.logs=[];this.log=e=>{let r=L(O({},e),{timestamp:Date.now()});this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch(i){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>O({component:e},r))}};function _e(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function De(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function w(t){return typeof t!="undefined"&&t!==null}function U(t){return t==null}function Ue(t,e){if(!(t!=null&&t.length))throw new Error(e)}function Fe(t,e){if(t!=null&&t.length)throw new Error(e)}var ze=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{o(),c.remove()});let s=()=>{o(),i()},l=()=>{o(),n()},o=()=>{a&&clearTimeout(a),c.removeEventListener("load",l),c.removeEventListener("error",s)},a;r&&(a=window.setTimeout(s,r));let c=document.createElement("script");c.addEventListener("load",l),c.addEventListener("error",s),c.src=t,document.head.appendChild(c)});var le,je=typeof((le=window.performance)==null?void 0:le.now)=="function"?()=>window.performance.now():()=>Date.now();var Be=(t,e)=>(...r)=>P(void 0,null,function*(){var l;let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=yield n.next(s);i=(l=o.done)!=null?l:!1,s=o.value}catch(o){yield n.throw(o)}return s});var ue=(c=>(c.Unknown="Unknown",c.Yandex="Yandex",c.Chrome="Chrome",c.Chromium="Chromium",c.Firefox="Firefox",c.Safari="Safari",c.Opera="Opera",c.Edge="Edge",c.Rest="Rest",c))(ue||{}),ce=(a=>(a.Unknown="Unknown",a.Android="Android",a.iPhone="iPhone",a.iPad="iPad",a.iPod="iPod",a.RestMobile="RestMobile",a.Mac="Mac",a.Desktop="Desktop",a))(ce||{}),M=()=>{let{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?"Yandex":void 0,r=/chrome|crios/i.test(t)?"Chrome":void 0,n=/chromium/i.test(t)?"Chromium":void 0,i=/firefox|fxios/i.test(t)?"Firefox":void 0,s=/webkit|safari|khtml/i.test(t)?"Safari":void 0,l=/opr\//i.test(t)?"Opera":void 0,o=/edg/i.test(t)?"Edge":void 0,a=/android/i.test(t)?"Android":void 0,c=/iphone/i.test(t)?"iPhone":void 0,f=/ipad/i.test(t)?"iPad":void 0,b=/ipod/i.test(t)?"iPod":void 0,S=/mac/i.test(t)?"Mac":void 0,A=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?"RestMobile":void 0;return{browser:e||i||l||o||r||n||s||"Rest",device:a||c||f||b||A||S||"Desktop"}},We=(t=!1)=>{let r=["iPhone","iPad","iPod"].includes(M().device);if(!t)return r;let{userAgent:n,maxTouchPoints:i}=window.navigator;return!!(r||/macintosh/i.test(n)&&i>0)},Ge=()=>{let{userAgent:t}=window.navigator,e=t.match(/Version\/(\d+(\.\d+)?)/i);if(!e)return null;let r=e[1],n=parseFloat(r);return isNaN(n)?null:n},qe=()=>M().device==="Android",He=()=>["Mac","iPhone","iPad","iPod"].includes(M().device),Ke=()=>{var t,e;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((t=navigator.appVersion)!=null?t:navigator.userAgent)||((e=navigator==null?void 0:navigator.userAgentData)==null?void 0:e.mobile)};var $e=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let l=e;return l*=ae(r,t),l*=1+(Math.random()*s*2-s),l=Math.round(l),l=Math.min(l,n),l=Math.max(l,i),l};var z={};Ne(z,{clear:()=>tt,get:()=>Xe,has:()=>Ze,isPersistent:()=>Ye,remove:()=>et,set:()=>Je});var d,y,F=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(y!==void 0)return y;try{localStorage.setItem(F,"test"),localStorage.removeItem(F),y=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(F),y=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)y=2;else throw e}else throw t}return y===2&&(d=new Map),y},Ye=()=>E()===0,Xe=t=>{var r,n;let e=E();switch(e){case 0:return(r=localStorage.getItem(t))!=null?r:void 0;case 1:return(n=sessionStorage.getItem(t))!=null?n:void 0;case 2:return d==null?void 0:d.get(t);default:I(e)}},Je=(t,e)=>{let r=E();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void(d==null?void 0:d.set(t,e));default:I(r)}},Ze=t=>{var r;let e=E();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return(r=d==null?void 0:d.has(t))!=null?r:!1;default:return I(e),!1}},et=t=>{let e=E();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void(d==null?void 0:d.delete(t));default:I(e)}},tt=()=>{let t=E();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return d==null?void 0:d.clear();default:I(t)}};var rt=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var j=(f=>(f.INVARIANT="Invariant quality",f.Q_144P="144p",f.Q_240P="240p",f.Q_360P="360p",f.Q_480P="480p",f.Q_720P="720p",f.Q_1080P="1080p",f.Q_1440P="1440p",f.Q_2160P="2160p",f.Q_4320P="4320p",f))(j||{});var T={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},nt=(t,e)=>T[t].height>T[e].height,ot=(t,e)=>T[t].height>=T[e].height,B=(t,e)=>T[t].height<T[e].height,it=(t,e)=>T[t].height<=T[e].height,st=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:B(e,r)?1:-1)[0],pe=Object.keys(T).sort((t,e)=>B(t,e)?-1:1),at=(t,e=.02)=>[...pe].find(n=>T[n].height*(1+e)>=t),lt=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return pe.find(i=>{let s=T[i];return s.width>=n&&s.height>=r})},ut=t=>T[t].height,W=t=>t==="Invariant quality",ct=t=>t.every(e=>!W(e));function pt(t){if(W(t))throw new Error("Expected exact quality")}var bt=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=bt(s,i):r[n]=n in t?s:i}return r};var sr=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function G(t,e=0,r){let n,i,s,l,o,a,c=0,f=!1,b=!1,S=!0,A=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(f=!!r.leading,b="maxWait"in r,s=r!=null&&r.maxWait?Math.max(+(r==null?void 0:r.maxWait)||0,e):s,S="trailing"in r?!!r.trailing:S);function _(p){let v=n,h=i;return n=i=void 0,c=p,l=t.apply(h,v),l}function R(p,v){return A?(o&&window.cancelAnimationFrame(o),window.requestAnimationFrame(p)):setTimeout(p,v)}function we(p){if(A){window.cancelAnimationFrame(p);return}clearTimeout(p)}function Ee(p){return c=p,o=R(C,e),f?_(p):l}function Se(p){let v=p-a,h=p-c,ne=e-v;return b?Math.min(ne,s-h):ne}function te(p){let v=p-a,h=p-c;return a===void 0||v>=e||v<0||b&&h>=s}function C(){let p=Date.now();if(te(p))return re(p);o=R(C,Se(p))}function re(p){return o=void 0,S&&n?_(p):(n=i=void 0,l)}function Ae(){o!==void 0&&we(o),c=0,n=a=i=o=void 0}function Re(){return o===void 0?l:re(Date.now())}function Ce(){return o!==void 0}function k(...p){let v=Date.now(),h=te(v);if(n=p,i=this,a=v,h){if(o===void 0)return Ee(a);if(b)return o=R(C,e),_(a)}return o===void 0&&(o=R(C,e)),l}return k.cancel=Ae,k.flush=Re,k.pending=Ce,k}var q=(t,e=0,r)=>G(t,e,L(O(O({},{leading:!0,trailing:!0}),r),{maxWait:e}));var N=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=N(t[n],e):r[n]=t[n]}return r};var dt=t=>N(t);var ft=300,mt=(t,e=ft)=>new u(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(q(l=>{let o=l[0];if(!o)return;let a,c;o.contentBoxSize&&o.contentBoxSize[0]?(c=o.contentBoxSize[0].blockSize,a=o.contentBoxSize[0].inlineSize):o.contentRect&&(a=o.contentRect.width,c=o.contentRect.height),w(a)&&w(c)&&r.next({width:a,height:c})},e));return s.observe(t),()=>s.disconnect()});var V=class extends x{constructor(r){super();this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){let n=super._subscribe(r);return r.next(this.value),n}};function be(t){return new u(e=>{let r={},n=Object.keys(t).length,i=s=>l=>{s in r||n--,r[s]=l,n===0&&e.next(r)};return Object.entries(t).reduce((s,[l,o])=>s.add(o.subscribe(i(l))),new m)})}function de(...t){return new u(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new m))}var Tt=t=>new u(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var vt=t=>new u(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var It=t=>new u(e=>{t.forEach(r=>e.next(r))});var xt=(t,e)=>new u(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function fe(t){return e=>new u(r=>e.subscribe(new H(r,t)))}var H=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var ht={leading:!1,trailing:!0};function me(t,e=ht){return r=>new u(n=>r.subscribe(new K(n,t,e)))}var K=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,w(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var gt={leading:!0,trailing:!1};function Te(t,e=gt){return r=>new u(n=>r.subscribe(new $(n,t,e)))}var $=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,U(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function ve(t){return e=>new u(r=>e.subscribe(new Y(r,t)))}var Y=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function xe(t=(e,r)=>e===r){return e=>new u(r=>e.subscribe(new X(r,t)))}var Ie={},X=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=Ie}next(e){let r;try{r=this.lastValue===Ie||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function Q(t){return e=>new u(r=>e.subscribe(new J(r,t)))}var J=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function he(t){return Q(()=>t)}function ge(){return t=>new u(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{var l;r=!0,(l=e.error)==null||l.call(e,s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function ye(){return t=>new u(e=>t.subscribe(new Z(e)))}var Z=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function Oe(t){return e=>new u(r=>e.subscribe(new ee(r,t)))}var ee=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var yt=(o=>(o.NETWORK="network",o.VIDEO_PIPELINE="video_pipeline",o.EXTERNAL_API="external_api",o.PARSER="parser",o.DOM="dom",o.WTF="wtf",o.FATAL="fatal",o))(yt||{});var Ot=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(Ot||{}),wt="vk.com",Yn=(t,e,r)=>P(void 0,null,function*(){let n=new URL(`https://${wt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=yield(yield fetch(n.toString())).json();return Et(s,r)}),Et=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),St(n)])),St=t=>Array.isArray(t)?t[0]:t;var At=(r=>(r.RU="ru",r.EN="en",r))(At||{});export{ue as CurrentClientBrowser,ce as CurrentClientDevice,yt as ErrorCategory,At as InterfaceLanguage,D as Logger,u as Observable,x as Subject,m as Subscription,Ve as VERSION,Ot as VKNumericLanguage,V as ValueSubject,j as VideoQuality,Be as abortable,ze as addScript,ct as areQualitiesExact,Fe as assertEmptyArray,I as assertNever,_e as assertNonNullable,Ue as assertNotEmptyArray,De as assertNullable,pt as assertQualityIsExact,fe as buffer,Qe as checkNever,dt as cloneDeep,N as cloneDeepWith,be as combine,me as debounce,G as debounceFn,rt as detectEmbed,bt as fillWithDefault,ve as filter,xe as filterChanged,xt as fromEvent,M as getCurrentBrowser,$e as getExponentialDelay,st as getHighestQuality,Ge as getIOSVersion,vt as interval,qe as isAndroid,nt as isHigher,ot as isHigherOrEqual,We as isIOS,W as isInvariantQuality,B as isLower,it as isLowerOrEqual,He as isMacLike,Ke as isMobile,w as isNonNullable,U as isNullable,Yn as loadVKLangPack,Q as map,he as mapTo,de as merge,g as noop,je as now,It as observableFrom,mt as observeElementSize,ge as once,ye as pairwise,z as safeStorage,Oe as tap,Te as throttle,q as throttleFn,sr as timeCodeToString,Tt as timeout,at as videoHeightToQuality,ut as videoQualityToHeight,lt as videoSizeToQuality};
|
|
6
|
+
var se=Object.defineProperty,Ae=Object.defineProperties;var Ce=Object.getOwnPropertyDescriptors;var ie=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable;var ae=Math.pow,oe=(r,e,t)=>e in r?se(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,O=(r,e)=>{for(var t in e||(e={}))Pe.call(e,t)&&oe(r,t,e[t]);if(ie)for(var t of ie(e))ke.call(e,t)&&oe(r,t,e[t]);return r},C=(r,e)=>Ae(r,Ce(e));var Le=(r,e)=>{for(var t in e)se(r,t,{get:e[t],enumerable:!0})};var P=(r,e,t)=>new Promise((n,o)=>{var s=c=>{try{i(t.next(c))}catch(u){o(u)}},a=c=>{try{i(t.throw(c))}catch(u){o(u)}},i=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);i((t=t.apply(r,e)).next())});var Ve="1.0.38-dev.876770ad.0";var m=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var h=r=>{throw new Error(`${r} is value of unexpected type`)},Me=r=>{};var g=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var a;let n;t?typeof t=="function"?n={next:t,error:g}:n={next:i=>t.next(i),error:i=>{var c;return(c=t.error)==null?void 0:c.call(t,i)}}:n={next:g,error:g};let o=typeof e=="function"?{next:i=>{try{e(i)}catch(c){n.next(c)}},error:i=>n.next(i)}:{next:i=>e.next(i),error:i=>e.error?e.error(i):n.next(i)},s;try{s=this._subscribe(o)}catch(i){(a=o.error)==null||a.call(o,i)}return new m().add(()=>{switch(o.next=g,o.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return h(s)}})}pipe(...e){return e.reduce((t,n)=>n(t),this)}_subscribe(e){}};var I=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>{var o;return(o=n.error)==null?void 0:o.call(n,t)})}_subscribe(t){let n=this.keyCounter++;return this.subscribers.set(n,t),new m().add(()=>this.subscribers.delete(n))}};var _=class{constructor(){this.log$=new I;this.logs=[];this.log=e=>{let t=C(O({},e),{timestamp:Date.now()});this.logs.push(t),this.log$.next(t)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>O({component:e},t))}};function Ne(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function _e(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function w(r){return typeof r!="undefined"&&r!==null}function Q(r){return r==null}function Qe(r,e){if(!(r!=null&&r.length))throw new Error(e)}function De(r,e){if(r!=null&&r.length)throw new Error(e)}var Ue=(r,e,t)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{i(),u.remove()});let s=()=>{i(),o()},a=()=>{i(),n()},i=()=>{c&&clearTimeout(c),u.removeEventListener("load",a),u.removeEventListener("error",s)},c;t&&(c=window.setTimeout(s,t));let u=document.createElement("script");u.addEventListener("load",a),u.addEventListener("error",s),u.src=r,document.head.appendChild(u)});var le,Be=typeof((le=window.performance)==null?void 0:le.now)=="function"?()=>window.performance.now():()=>Date.now();var Fe=(r,e)=>(...t)=>P(void 0,null,function*(){var a;let n=e(...t),o=r.aborted,s;for(;!o&&!r.aborted;)try{let i=yield n.next(s);o=(a=i.done)!=null?a:!1,s=i.value}catch(i){yield n.throw(i)}return s});var D=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||(window==null?void 0:window.screen.width)>700,t=this._iosVersion;return!e||e&&!!t&&t<16}get isAndroid(){return this.device==="Android"}get isMobile(){var e,t;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((e=navigator.appVersion)!=null?e:navigator.userAgent)||((t=navigator==null?void 0:navigator.userAgentData)==null?void 0:t.mobile)}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){var n;let{userAgent:e,maxTouchPoints:t}=navigator;try{this._maxTouchPoints=t,this._isHdr=!!((n=matchMedia("(dynamic-range: high)"))!=null&&n.matches)}catch(o){console.error(o)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let t=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,o=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,a=/firefox|fxios/i.test(e)?"Firefox":void 0,i=/webkit|safari|khtml/i.test(e)?"Safari":void 0,c=/opr\//i.test(e)?"Opera":void 0,u=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=t||n||a||c||u||o||s||i||"Rest"}catch(t){console.error(t)}}detectDevice(e){try{let t=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,o=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,a=/mac/i.test(e)?"Mac":void 0,i=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=t||n||o||s||i||a||"Desktop"}catch(t){console.error(t)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return;let n=t[1],o=parseFloat(n);if(isNaN(o))return;this._iosVersion=o}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+)/);if(!t)return;let n=t[1],o=parseInt(n,10);if(isNaN(o))return;this._macVersion=o}catch(e){console.error(e)}}},ze=new D;var je=(r,{start:e=0,factor:t=2,max:n=1/0,min:o=e,random:s=0}={})=>{let a=e;return a*=ae(t,r),a*=1+(Math.random()*s*2-s),a=Math.round(a),a=Math.min(a,n),a=Math.max(a,o),a};var B={};Le(B,{clear:()=>Ye,get:()=>Ge,has:()=>qe,isPersistent:()=>We,remove:()=>Ke,set:()=>He});var d,y,U=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(y!==void 0)return y;try{localStorage.setItem(U,"test"),localStorage.removeItem(U),y=0}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(U),y=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)y=2;else throw e}else throw r}return y===2&&(d=new Map),y},We=()=>E()===0,Ge=r=>{var t,n;let e=E();switch(e){case 0:return(t=localStorage.getItem(r))!=null?t:void 0;case 1:return(n=sessionStorage.getItem(r))!=null?n:void 0;case 2:return d==null?void 0:d.get(r);default:h(e)}},He=(r,e)=>{let t=E();switch(t){case 0:try{localStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void(d==null?void 0:d.set(r,e));default:h(t)}},qe=r=>{var t;let e=E();switch(e){case 0:return r in localStorage;case 1:return r in sessionStorage;case 2:return(t=d==null?void 0:d.has(r))!=null?t:!1;default:return h(e),!1}},Ke=r=>{let e=E();switch(e){case 0:return localStorage.removeItem(r);case 1:return sessionStorage.removeItem(r);case 2:return void(d==null?void 0:d.delete(r));default:h(e)}},Ye=()=>{let r=E();switch(r){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return d==null?void 0:d.clear();default:h(r)}};var $e=()=>{let r,e;try{r=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?r=!0:(r=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let t=e?new URL(e).hostname:void 0;return{isEmbed:r,host:t}};var F=(f=>(f.INVARIANT="Invariant quality",f.Q_144P="144p",f.Q_240P="240p",f.Q_360P="360p",f.Q_480P="480p",f.Q_720P="720p",f.Q_1080P="1080p",f.Q_1440P="1440p",f.Q_2160P="2160p",f.Q_4320P="4320p",f))(F||{});var T={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Xe=(r,e)=>T[r].height>T[e].height,Je=(r,e)=>T[r].height>=T[e].height,z=(r,e)=>T[r].height<T[e].height,Ze=(r,e)=>T[r].height<=T[e].height,et=r=>r.sort((e,t)=>e===t?0:e==="Invariant quality"?1:t==="Invariant quality"?-1:z(e,t)?1:-1)[0],ce=Object.keys(T).sort((r,e)=>z(r,e)?-1:1),tt=(r,e=.02)=>[...ce].find(n=>T[n].height*(1+e)>=r),rt=({width:r,height:e})=>{let t=Math.min(r,e),n=Math.max(r,e);return ce.find(o=>{let s=T[o];return s.width>=n&&s.height>=t})},nt=r=>T[r].height,j=r=>r==="Invariant quality",it=r=>r.every(e=>!j(e));function ot(r){if(j(r))throw new Error("Expected exact quality")}var st=(r,e)=>{let t={};for(let n of Object.keys(e)){let o=e[n],s=r[n];Array.isArray(o)&&Array.isArray(s)?t[n]=s:typeof o=="object"&&typeof s=="object"?t[n]=st(s,o):t[n]=n in r?s:o}return t};var tr=r=>{let e="";return r>=3600&&(e+=Math.floor(r/3600)+"h",r=r%3600),r>=60&&(e+=Math.floor(r/60)+"m",r=r%60),r>0&&(e+=Math.floor(r)+"s"),e};function W(r,e=0,t){let n,o,s,a,i,c,u=0,f=!1,b=!1,M=!0,ee=!e&&e!==0&&typeof window.requestAnimationFrame=="function";t&&(f=!!t.leading,b="maxWait"in t,s=t!=null&&t.maxWait?Math.max(+(t==null?void 0:t.maxWait)||0,e):s,M="trailing"in t?!!t.trailing:M);function N(p){let v=n,x=o;return n=o=void 0,u=p,a=r.apply(x,v),a}function S(p,v){return ee?(i&&window.cancelAnimationFrame(i),window.requestAnimationFrame(p)):setTimeout(p,v)}function ye(p){if(ee){window.cancelAnimationFrame(p);return}clearTimeout(p)}function Oe(p){return u=p,i=S(R,e),f?N(p):a}function we(p){let v=p-c,x=p-u,ne=e-v;return b?Math.min(ne,s-x):ne}function te(p){let v=p-c,x=p-u;return c===void 0||v>=e||v<0||b&&x>=s}function R(){let p=Date.now();if(te(p))return re(p);i=S(R,we(p))}function re(p){return i=void 0,M&&n?N(p):(n=o=void 0,a)}function Ee(){i!==void 0&&ye(i),u=0,n=c=o=i=void 0}function Se(){return i===void 0?a:re(Date.now())}function Re(){return i!==void 0}function A(...p){let v=Date.now(),x=te(v);if(n=p,o=this,c=v,x){if(i===void 0)return Oe(c);if(b)return i=S(R,e),N(c)}return i===void 0&&(i=S(R,e)),a}return A.cancel=Ee,A.flush=Se,A.pending=Re,A}var G=(r,e=0,t)=>W(r,e,C(O(O({},{leading:!0,trailing:!0}),t),{maxWait:e}));var k=(r,e)=>{if(r===null||typeof r!="object")return r;let t=Array.isArray(r)?[]:{};for(let n in r){if(typeof e=="function"){let o=e(r[n],n,r,t);if(o!==void 0){t[n]=o;continue}}typeof r[n]=="object"?t[n]=k(r[n],e):t[n]=r[n]}return t};var at=r=>k(r);var lt=300,ct=(r,e=lt)=>new l(t=>{let{width:n,height:o}=r.getBoundingClientRect();if(t.next({width:n,height:o}),!window.ResizeObserver)return;let s=new ResizeObserver(G(a=>{let i=a[0];if(!i)return;let c,u;i.contentBoxSize&&i.contentBoxSize[0]?(u=i.contentBoxSize[0].blockSize,c=i.contentBoxSize[0].inlineSize):i.contentRect&&(c=i.contentRect.width,u=i.contentRect.height),w(c)&&w(u)&&t.next({width:c,height:u})},e));return s.observe(r),()=>s.disconnect()});var ut=r=>{r.removeAttribute("src"),r.load()};var L=class extends I{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}};function ue(r){return new l(e=>{let t={},n=Object.keys(r).length,o=s=>a=>{s in t||n--,t[s]=a,n===0&&e.next(t)};return Object.entries(r).reduce((s,[a,i])=>s.add(i.subscribe(o(a))),new m)})}function pe(...r){return new l(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new m))}var pt=r=>new l(e=>{let t=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},r);return()=>window.clearTimeout(t)});var bt=r=>new l(e=>{let t=window.setInterval(()=>e.next(),r);return()=>{t&&(window.clearInterval(t),t=void 0)}});var dt=r=>new l(e=>{r.forEach(t=>e.next(t))});var ft=(r,e)=>new l(t=>{let n=o=>t.next(o);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function be(r){return e=>new l(t=>e.subscribe(new H(t,r)))}var H=class{constructor(e,t){this.destination=e;this.size=t;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var mt={leading:!1,trailing:!0};function de(r,e=mt){return t=>new l(n=>t.subscribe(new q(n,r,e)))}var q=class{constructor(e,t,n){this.destination=e;this.time=t;this.config=n}next(e){this.lastValue=e,w(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var Tt={leading:!0,trailing:!1};function fe(r,e=Tt){return t=>new l(n=>t.subscribe(new K(n,r,e)))}var K=class{constructor(e,t,n){this.destination=e;this.time=t;this.config=n}next(e){this.lastValue=e,Q(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function me(r){return e=>new l(t=>e.subscribe(new Y(t,r)))}var Y=class{constructor(e,t){this.destination=e;this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function ve(r=(e,t)=>e===t){return e=>new l(t=>e.subscribe(new $(t,r)))}var Te={},$=class{constructor(e,t){this.destination=e;this.predicate=t;this.lastValue=Te}next(e){let t;try{t=this.lastValue===Te||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function V(r){return e=>new l(t=>e.subscribe(new X(t,r)))}var X=class{constructor(e,t){this.destination=e;this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(t)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function he(r){return V(()=>r)}function Ie(){return r=>new l(e=>{let t=!1,n=!1,o=r.subscribe(s=>{t||(t=!0,e.next(s)),n&&o.unsubscribe()},s=>{var a;t=!0,(a=e.error)==null||a.call(e,s),n&&o.unsubscribe()});return n=!0,t&&o.unsubscribe(),o})}function xe(){return r=>new l(e=>r.subscribe(new J(e)))}var J=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function ge(r){return e=>new l(t=>e.subscribe(new Z(t,r)))}var Z=class{constructor(e,t){this.destination=e;this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var vt=(i=>(i.NETWORK="network",i.VIDEO_PIPELINE="video_pipeline",i.EXTERNAL_API="external_api",i.PARSER="parser",i.DOM="dom",i.WTF="wtf",i.FATAL="fatal",i))(vt||{});var ht=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(ht||{}),It="vk.com",qn=(r,e,t)=>P(void 0,null,function*(){let n=new URL(`https://${It}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),r!==void 0&&n.searchParams.set("lang",r);let s=yield(yield fetch(n.toString())).json();return xt(s,t)}),xt=(r,e)=>Object.fromEntries(Object.entries(r.keys).map(([t,n])=>[t.substring(`${e}_`.length),gt(n)])),gt=r=>Array.isArray(r)?r[0]:r;var yt=(t=>(t.RU="ru",t.EN="en",t))(yt||{});export{ze as CC,vt as ErrorCategory,yt as InterfaceLanguage,_ as Logger,l as Observable,I as Subject,m as Subscription,Ve as VERSION,ht as VKNumericLanguage,L as ValueSubject,F as VideoQuality,Fe as abortable,Ue as addScript,it as areQualitiesExact,De as assertEmptyArray,h as assertNever,Ne as assertNonNullable,Qe as assertNotEmptyArray,_e as assertNullable,ot as assertQualityIsExact,be as buffer,Me as checkNever,ut as clearVideoElement,at as cloneDeep,k as cloneDeepWith,ue as combine,de as debounce,W as debounceFn,$e as detectEmbed,st as fillWithDefault,me as filter,ve as filterChanged,ft as fromEvent,je as getExponentialDelay,et as getHighestQuality,bt as interval,Xe as isHigher,Je as isHigherOrEqual,j as isInvariantQuality,z as isLower,Ze as isLowerOrEqual,w as isNonNullable,Q as isNullable,qn as loadVKLangPack,V as map,he as mapTo,pe as merge,g as noop,Be as now,dt as observableFrom,ct as observeElementSize,Ie as once,xe as pairwise,B as safeStorage,ge as tap,fe as throttle,G as throttleFn,tr as timeCodeToString,pt as timeout,tt as videoHeightToQuality,nt as videoQualityToHeight,rt as videoSizeToQuality};
|
package/es2018.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.38-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.38-dev.876770ad.0
|
|
3
|
+
* Thu, 15 Aug 2024 18:48:59 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-38/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var B=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var me=(t,e)=>{for(var r in e)B(t,r,{get:e[r],enumerable:!0})},ut=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of at(e))!lt.call(t,i)&&i!==r&&B(t,i,{get:()=>e[i],enumerable:!(n=st(e,i))||n.enumerable});return t};var ct=t=>ut(B({},"__esModule",{value:!0}),t);var Et={};me(Et,{CurrentClientBrowser:()=>W,CurrentClientDevice:()=>G,ErrorCategory:()=>Xe,InterfaceLanguage:()=>Ze,Logger:()=>N,Observable:()=>a,Subject:()=>x,Subscription:()=>m,VERSION:()=>Te,VKNumericLanguage:()=>Je,ValueSubject:()=>R,VideoQuality:()=>_,abortable:()=>Ee,addScript:()=>ye,areQualitiesExact:()=>ze,assertEmptyArray:()=>ge,assertNever:()=>I,assertNonNullable:()=>Ie,assertNotEmptyArray:()=>he,assertNullable:()=>xe,assertQualityIsExact:()=>je,buffer:()=>Y,checkNever:()=>ve,cloneDeep:()=>We,cloneDeepWith:()=>A,combine:()=>H,debounce:()=>J,debounceFn:()=>F,detectEmbed:()=>Pe,fillWithDefault:()=>Be,filter:()=>re,filterChanged:()=>oe,fromEvent:()=>$e,getCurrentBrowser:()=>S,getExponentialDelay:()=>Le,getHighestQuality:()=>Qe,getIOSVersion:()=>Ae,interval:()=>He,isAndroid:()=>Re,isHigher:()=>Me,isHigherOrEqual:()=>Ne,isIOS:()=>Se,isInvariantQuality:()=>U,isLower:()=>D,isLowerOrEqual:()=>Ve,isMacLike:()=>Ce,isMobile:()=>ke,isNonNullable:()=>y,isNullable:()=>V,loadVKLangPack:()=>yt,map:()=>C,mapTo:()=>se,merge:()=>K,noop:()=>h,now:()=>we,observableFrom:()=>Ke,observeElementSize:()=>Ge,once:()=>ae,pairwise:()=>ue,safeStorage:()=>Q,tap:()=>pe,throttle:()=>ee,throttleFn:()=>z,timeCodeToString:()=>vt,timeout:()=>qe,videoHeightToQuality:()=>De,videoQualityToHeight:()=>Fe,videoSizeToQuality:()=>Ue});module.exports=ct(Et);var Te="1.0.38-dev.736aea74.0";var m=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var I=t=>{throw new Error(`${t} is value of unexpected type`)},ve=t=>{};var h=()=>{};var a=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){var l;let n;r?typeof r=="function"?n={next:r,error:h}:n={next:o=>r.next(o),error:o=>{var u;return(u=r.error)==null?void 0:u.call(r,o)}}:n={next:h,error:h};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(u){n.next(u)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){(l=i.error)==null||l.call(i,o)}return new m().add(()=>{switch(i.next=h,i.error=h,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return I(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var x=class extends a{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>{var i;return(i=n.error)==null?void 0:i.call(n,r)})}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new m().add(()=>this.subscribers.delete(n))}};var N=class{constructor(){this.log$=new x;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch(i){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function Ie(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function xe(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t!="undefined"&&t!==null}function V(t){return t==null}function he(t,e){if(!(t!=null&&t.length))throw new Error(e)}function ge(t,e){if(t!=null&&t.length)throw new Error(e)}var ye=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{o(),c.remove()});let s=()=>{o(),i()},l=()=>{o(),n()},o=()=>{u&&clearTimeout(u),c.removeEventListener("load",l),c.removeEventListener("error",s)},u;r&&(u=window.setTimeout(s,r));let c=document.createElement("script");c.addEventListener("load",l),c.addEventListener("error",s),c.src=t,document.head.appendChild(c)});var Oe,we=typeof((Oe=window.performance)==null?void 0:Oe.now)=="function"?()=>window.performance.now():()=>Date.now();var Ee=(t,e)=>async(...r)=>{var l;let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=(l=o.done)!=null?l:!1,s=o.value}catch(o){await n.throw(o)}return s};var W=(c=>(c.Unknown="Unknown",c.Yandex="Yandex",c.Chrome="Chrome",c.Chromium="Chromium",c.Firefox="Firefox",c.Safari="Safari",c.Opera="Opera",c.Edge="Edge",c.Rest="Rest",c))(W||{}),G=(u=>(u.Unknown="Unknown",u.Android="Android",u.iPhone="iPhone",u.iPad="iPad",u.iPod="iPod",u.RestMobile="RestMobile",u.Mac="Mac",u.Desktop="Desktop",u))(G||{}),S=()=>{let{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?"Yandex":void 0,r=/chrome|crios/i.test(t)?"Chrome":void 0,n=/chromium/i.test(t)?"Chromium":void 0,i=/firefox|fxios/i.test(t)?"Firefox":void 0,s=/webkit|safari|khtml/i.test(t)?"Safari":void 0,l=/opr\//i.test(t)?"Opera":void 0,o=/edg/i.test(t)?"Edge":void 0,u=/android/i.test(t)?"Android":void 0,c=/iphone/i.test(t)?"iPhone":void 0,f=/ipad/i.test(t)?"iPad":void 0,b=/ipod/i.test(t)?"iPod":void 0,E=/mac/i.test(t)?"Mac":void 0,k=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?"RestMobile":void 0;return{browser:e||i||l||o||r||n||s||"Rest",device:u||c||f||b||k||E||"Desktop"}},Se=(t=!1)=>{let r=["iPhone","iPad","iPod"].includes(S().device);if(!t)return r;let{userAgent:n,maxTouchPoints:i}=window.navigator;return!!(r||/macintosh/i.test(n)&&i>0)},Ae=()=>{let{userAgent:t}=window.navigator,e=t.match(/Version\/(\d+(\.\d+)?)/i);if(!e)return null;let r=e[1],n=parseFloat(r);return isNaN(n)?null:n},Re=()=>S().device==="Android",Ce=()=>["Mac","iPhone","iPad","iPod"].includes(S().device),ke=()=>{var t,e;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((t=navigator.appVersion)!=null?t:navigator.userAgent)||((e=navigator==null?void 0:navigator.userAgentData)==null?void 0:e.mobile)};var Le=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let l=e;return l*=r**t,l*=1+(Math.random()*s*2-s),l=Math.round(l),l=Math.min(l,n),l=Math.max(l,i),l};var Q={};me(Q,{clear:()=>Tt,get:()=>bt,has:()=>ft,isPersistent:()=>pt,remove:()=>mt,set:()=>dt});var d,O,q=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(O!==void 0)return O;try{localStorage.setItem(q,"test"),localStorage.removeItem(q),O=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(q),O=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)O=2;else throw e}else throw t}return O===2&&(d=new Map),O},pt=()=>w()===0,bt=t=>{var r,n;let e=w();switch(e){case 0:return(r=localStorage.getItem(t))!=null?r:void 0;case 1:return(n=sessionStorage.getItem(t))!=null?n:void 0;case 2:return d==null?void 0:d.get(t);default:I(e)}},dt=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void(d==null?void 0:d.set(t,e));default:I(r)}},ft=t=>{var r;let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return(r=d==null?void 0:d.has(t))!=null?r:!1;default:return I(e),!1}},mt=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void(d==null?void 0:d.delete(t));default:I(e)}},Tt=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return d==null?void 0:d.clear();default:I(t)}};var Pe=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var _=(f=>(f.INVARIANT="Invariant quality",f.Q_144P="144p",f.Q_240P="240p",f.Q_360P="360p",f.Q_480P="480p",f.Q_720P="720p",f.Q_1080P="1080p",f.Q_1440P="1440p",f.Q_2160P="2160p",f.Q_4320P="4320p",f))(_||{});var T={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Me=(t,e)=>T[t].height>T[e].height,Ne=(t,e)=>T[t].height>=T[e].height,D=(t,e)=>T[t].height<T[e].height,Ve=(t,e)=>T[t].height<=T[e].height,Qe=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:D(e,r)?1:-1)[0],_e=Object.keys(T).sort((t,e)=>D(t,e)?-1:1),De=(t,e=.02)=>[..._e].find(n=>T[n].height*(1+e)>=t),Ue=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return _e.find(i=>{let s=T[i];return s.width>=n&&s.height>=r})},Fe=t=>T[t].height,U=t=>t==="Invariant quality",ze=t=>t.every(e=>!U(e));function je(t){if(U(t))throw new Error("Expected exact quality")}var Be=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=Be(s,i):r[n]=n in t?s:i}return r};var vt=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function F(t,e=0,r){let n,i,s,l,o,u,c=0,f=!1,b=!1,E=!0,k=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(f=!!r.leading,b="maxWait"in r,s=r!=null&&r.maxWait?Math.max(+(r==null?void 0:r.maxWait)||0,e):s,E="trailing"in r?!!r.trailing:E);function j(p){let v=n,g=i;return n=i=void 0,c=p,l=t.apply(g,v),l}function L(p,v){return k?(o&&window.cancelAnimationFrame(o),window.requestAnimationFrame(p)):setTimeout(p,v)}function et(p){if(k){window.cancelAnimationFrame(p);return}clearTimeout(p)}function tt(p){return c=p,o=L(P,e),f?j(p):l}function rt(p){let v=p-u,g=p-c,fe=e-v;return b?Math.min(fe,s-g):fe}function be(p){let v=p-u,g=p-c;return u===void 0||v>=e||v<0||b&&g>=s}function P(){let p=Date.now();if(be(p))return de(p);o=L(P,rt(p))}function de(p){return o=void 0,E&&n?j(p):(n=i=void 0,l)}function nt(){o!==void 0&&et(o),c=0,n=u=i=o=void 0}function ot(){return o===void 0?l:de(Date.now())}function it(){return o!==void 0}function M(...p){let v=Date.now(),g=be(v);if(n=p,i=this,u=v,g){if(o===void 0)return tt(u);if(b)return o=L(P,e),j(u)}return o===void 0&&(o=L(P,e)),l}return M.cancel=nt,M.flush=ot,M.pending=it,M}var z=(t,e=0,r)=>F(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var A=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=A(t[n],e):r[n]=t[n]}return r};var We=t=>A(t);var It=300,Ge=(t,e=It)=>new a(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(z(l=>{let o=l[0];if(!o)return;let u,c;o.contentBoxSize&&o.contentBoxSize[0]?(c=o.contentBoxSize[0].blockSize,u=o.contentBoxSize[0].inlineSize):o.contentRect&&(u=o.contentRect.width,c=o.contentRect.height),y(u)&&y(c)&&r.next({width:u,height:c})},e));return s.observe(t),()=>s.disconnect()});var R=class extends x{constructor(r){super();this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){let n=super._subscribe(r);return r.next(this.value),n}};function H(t){return new a(e=>{let r={},n=Object.keys(t).length,i=s=>l=>{s in r||n--,r[s]=l,n===0&&e.next(r)};return Object.entries(t).reduce((s,[l,o])=>s.add(o.subscribe(i(l))),new m)})}function K(...t){return new a(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new m))}var qe=t=>new a(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var He=t=>new a(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var Ke=t=>new a(e=>{t.forEach(r=>e.next(r))});var $e=(t,e)=>new a(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function Y(t){return e=>new a(r=>e.subscribe(new $(r,t)))}var $=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var xt={leading:!1,trailing:!0};function J(t,e=xt){return r=>new a(n=>r.subscribe(new X(n,t,e)))}var X=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var ht={leading:!0,trailing:!1};function ee(t,e=ht){return r=>new a(n=>r.subscribe(new Z(n,t,e)))}var Z=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,V(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function re(t){return e=>new a(r=>e.subscribe(new te(r,t)))}var te=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function oe(t=(e,r)=>e===r){return e=>new a(r=>e.subscribe(new ne(r,t)))}var Ye={},ne=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=Ye}next(e){let r;try{r=this.lastValue===Ye||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function C(t){return e=>new a(r=>e.subscribe(new ie(r,t)))}var ie=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function se(t){return C(()=>t)}function ae(){return t=>new a(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{var l;r=!0,(l=e.error)==null||l.call(e,s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function ue(){return t=>new a(e=>t.subscribe(new le(e)))}var le=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function pe(t){return e=>new a(r=>e.subscribe(new ce(r,t)))}var ce=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var Xe=(o=>(o.NETWORK="network",o.VIDEO_PIPELINE="video_pipeline",o.EXTERNAL_API="external_api",o.PARSER="parser",o.DOM="dom",o.WTF="wtf",o.FATAL="fatal",o))(Xe||{});var Je=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(Je||{}),gt="vk.com",yt=async(t,e,r)=>{let n=new URL(`https://${gt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return Ot(s,r)},Ot=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),wt(n)])),wt=t=>Array.isArray(t)?t[0]:t;var Ze=(r=>(r.RU="ru",r.EN="en",r))(Ze||{});
|
|
6
|
+
"use strict";var F=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var nt=Object.prototype.hasOwnProperty;var de=(r,e)=>{for(var t in e)F(r,t,{get:e[t],enumerable:!0})},it=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rt(e))!nt.call(r,i)&&i!==t&&F(r,i,{get:()=>e[i],enumerable:!(n=tt(e,i))||n.enumerable});return r};var ot=r=>it(F({},"__esModule",{value:!0}),r);var xt={};de(xt,{CC:()=>we,ErrorCategory:()=>He,InterfaceLanguage:()=>Ke,Logger:()=>k,Observable:()=>a,Subject:()=>I,Subscription:()=>m,VERSION:()=>fe,VKNumericLanguage:()=>qe,ValueSubject:()=>S,VideoQuality:()=>M,abortable:()=>Oe,addScript:()=>xe,areQualitiesExact:()=>Ne,assertEmptyArray:()=>Ie,assertNever:()=>h,assertNonNullable:()=>Te,assertNotEmptyArray:()=>he,assertNullable:()=>ve,assertQualityIsExact:()=>_e,buffer:()=>q,checkNever:()=>me,clearVideoElement:()=>Be,cloneDeep:()=>De,cloneDeepWith:()=>E,combine:()=>W,debounce:()=>Y,debounceFn:()=>Q,detectEmbed:()=>Se,fillWithDefault:()=>Qe,filter:()=>Z,filterChanged:()=>te,fromEvent:()=>We,getExponentialDelay:()=>Ee,getHighestQuality:()=>Pe,interval:()=>ze,isHigher:()=>Re,isHigherOrEqual:()=>Ae,isInvariantQuality:()=>_,isLower:()=>N,isLowerOrEqual:()=>Ce,isNonNullable:()=>y,isNullable:()=>L,loadVKLangPack:()=>vt,map:()=>R,mapTo:()=>ne,merge:()=>G,noop:()=>x,now:()=>ye,observableFrom:()=>je,observeElementSize:()=>Ue,once:()=>ie,pairwise:()=>se,safeStorage:()=>V,tap:()=>le,throttle:()=>X,throttleFn:()=>D,timeCodeToString:()=>bt,timeout:()=>Fe,videoHeightToQuality:()=>Le,videoQualityToHeight:()=>Me,videoSizeToQuality:()=>Ve});module.exports=ot(xt);var fe="1.0.38-dev.876770ad.0";var m=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var h=r=>{throw new Error(`${r} is value of unexpected type`)},me=r=>{};var x=()=>{};var a=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var l;let n;t?typeof t=="function"?n={next:t,error:x}:n={next:o=>t.next(o),error:o=>{var u;return(u=t.error)==null?void 0:u.call(t,o)}}:n={next:x,error:x};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(u){n.next(u)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){(l=i.error)==null||l.call(i,o)}return new m().add(()=>{switch(i.next=x,i.error=x,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return h(s)}})}pipe(...e){return e.reduce((t,n)=>n(t),this)}_subscribe(e){}};var I=class extends a{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>{var i;return(i=n.error)==null?void 0:i.call(n,t)})}_subscribe(t){let n=this.keyCounter++;return this.subscribers.set(n,t),new m().add(()=>this.subscribers.delete(n))}};var k=class{constructor(){this.log$=new I;this.logs=[];this.log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch(i){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}};function Te(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function ve(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function y(r){return typeof r!="undefined"&&r!==null}function L(r){return r==null}function he(r,e){if(!(r!=null&&r.length))throw new Error(e)}function Ie(r,e){if(r!=null&&r.length)throw new Error(e)}var xe=(r,e,t)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{o(),p.remove()});let s=()=>{o(),i()},l=()=>{o(),n()},o=()=>{u&&clearTimeout(u),p.removeEventListener("load",l),p.removeEventListener("error",s)},u;t&&(u=window.setTimeout(s,t));let p=document.createElement("script");p.addEventListener("load",l),p.addEventListener("error",s),p.src=r,document.head.appendChild(p)});var ge,ye=typeof((ge=window.performance)==null?void 0:ge.now)=="function"?()=>window.performance.now():()=>Date.now();var Oe=(r,e)=>async(...t)=>{var l;let n=e(...t),i=r.aborted,s;for(;!i&&!r.aborted;)try{let o=await n.next(s);i=(l=o.done)!=null?l:!1,s=o.value}catch(o){await n.throw(o)}return s};var z=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||(window==null?void 0:window.screen.width)>700,t=this._iosVersion;return!e||e&&!!t&&t<16}get isAndroid(){return this.device==="Android"}get isMobile(){var e,t;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((e=navigator.appVersion)!=null?e:navigator.userAgent)||((t=navigator==null?void 0:navigator.userAgentData)==null?void 0:t.mobile)}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){var n;let{userAgent:e,maxTouchPoints:t}=navigator;try{this._maxTouchPoints=t,this._isHdr=!!((n=matchMedia("(dynamic-range: high)"))!=null&&n.matches)}catch(i){console.error(i)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let t=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,l=/firefox|fxios/i.test(e)?"Firefox":void 0,o=/webkit|safari|khtml/i.test(e)?"Safari":void 0,u=/opr\//i.test(e)?"Opera":void 0,p=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=t||n||l||u||p||i||s||o||"Rest"}catch(t){console.error(t)}}detectDevice(e){try{let t=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,l=/mac/i.test(e)?"Mac":void 0,o=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=t||n||i||s||o||l||"Desktop"}catch(t){console.error(t)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return;let n=t[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+)/);if(!t)return;let n=t[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},we=new z;var Ee=(r,{start:e=0,factor:t=2,max:n=1/0,min:i=e,random:s=0}={})=>{let l=e;return l*=t**r,l*=1+(Math.random()*s*2-s),l=Math.round(l),l=Math.min(l,n),l=Math.max(l,i),l};var V={};de(V,{clear:()=>pt,get:()=>at,has:()=>ct,isPersistent:()=>st,remove:()=>ut,set:()=>lt});var d,O,j=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(O!==void 0)return O;try{localStorage.setItem(j,"test"),localStorage.removeItem(j),O=0}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(j),O=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)O=2;else throw e}else throw r}return O===2&&(d=new Map),O},st=()=>w()===0,at=r=>{var t,n;let e=w();switch(e){case 0:return(t=localStorage.getItem(r))!=null?t:void 0;case 1:return(n=sessionStorage.getItem(r))!=null?n:void 0;case 2:return d==null?void 0:d.get(r);default:h(e)}},lt=(r,e)=>{let t=w();switch(t){case 0:try{localStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void(d==null?void 0:d.set(r,e));default:h(t)}},ct=r=>{var t;let e=w();switch(e){case 0:return r in localStorage;case 1:return r in sessionStorage;case 2:return(t=d==null?void 0:d.has(r))!=null?t:!1;default:return h(e),!1}},ut=r=>{let e=w();switch(e){case 0:return localStorage.removeItem(r);case 1:return sessionStorage.removeItem(r);case 2:return void(d==null?void 0:d.delete(r));default:h(e)}},pt=()=>{let r=w();switch(r){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return d==null?void 0:d.clear();default:h(r)}};var Se=()=>{let r,e;try{r=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?r=!0:(r=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let t=e?new URL(e).hostname:void 0;return{isEmbed:r,host:t}};var M=(f=>(f.INVARIANT="Invariant quality",f.Q_144P="144p",f.Q_240P="240p",f.Q_360P="360p",f.Q_480P="480p",f.Q_720P="720p",f.Q_1080P="1080p",f.Q_1440P="1440p",f.Q_2160P="2160p",f.Q_4320P="4320p",f))(M||{});var T={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Re=(r,e)=>T[r].height>T[e].height,Ae=(r,e)=>T[r].height>=T[e].height,N=(r,e)=>T[r].height<T[e].height,Ce=(r,e)=>T[r].height<=T[e].height,Pe=r=>r.sort((e,t)=>e===t?0:e==="Invariant quality"?1:t==="Invariant quality"?-1:N(e,t)?1:-1)[0],ke=Object.keys(T).sort((r,e)=>N(r,e)?-1:1),Le=(r,e=.02)=>[...ke].find(n=>T[n].height*(1+e)>=r),Ve=({width:r,height:e})=>{let t=Math.min(r,e),n=Math.max(r,e);return ke.find(i=>{let s=T[i];return s.width>=n&&s.height>=t})},Me=r=>T[r].height,_=r=>r==="Invariant quality",Ne=r=>r.every(e=>!_(e));function _e(r){if(_(r))throw new Error("Expected exact quality")}var Qe=(r,e)=>{let t={};for(let n of Object.keys(e)){let i=e[n],s=r[n];Array.isArray(i)&&Array.isArray(s)?t[n]=s:typeof i=="object"&&typeof s=="object"?t[n]=Qe(s,i):t[n]=n in r?s:i}return t};var bt=r=>{let e="";return r>=3600&&(e+=Math.floor(r/3600)+"h",r=r%3600),r>=60&&(e+=Math.floor(r/60)+"m",r=r%60),r>0&&(e+=Math.floor(r)+"s"),e};function Q(r,e=0,t){let n,i,s,l,o,u,p=0,f=!1,b=!1,U=!0,ce=!e&&e!==0&&typeof window.requestAnimationFrame=="function";t&&(f=!!t.leading,b="maxWait"in t,s=t!=null&&t.maxWait?Math.max(+(t==null?void 0:t.maxWait)||0,e):s,U="trailing"in t?!!t.trailing:U);function B(c){let v=n,g=i;return n=i=void 0,p=c,l=r.apply(g,v),l}function A(c,v){return ce?(o&&window.cancelAnimationFrame(o),window.requestAnimationFrame(c)):setTimeout(c,v)}function Ye(c){if(ce){window.cancelAnimationFrame(c);return}clearTimeout(c)}function $e(c){return p=c,o=A(C,e),f?B(c):l}function Xe(c){let v=c-u,g=c-p,be=e-v;return b?Math.min(be,s-g):be}function ue(c){let v=c-u,g=c-p;return u===void 0||v>=e||v<0||b&&g>=s}function C(){let c=Date.now();if(ue(c))return pe(c);o=A(C,Xe(c))}function pe(c){return o=void 0,U&&n?B(c):(n=i=void 0,l)}function Je(){o!==void 0&&Ye(o),p=0,n=u=i=o=void 0}function Ze(){return o===void 0?l:pe(Date.now())}function et(){return o!==void 0}function P(...c){let v=Date.now(),g=ue(v);if(n=c,i=this,u=v,g){if(o===void 0)return $e(u);if(b)return o=A(C,e),B(u)}return o===void 0&&(o=A(C,e)),l}return P.cancel=Je,P.flush=Ze,P.pending=et,P}var D=(r,e=0,t)=>Q(r,e,{...{leading:!0,trailing:!0},...t,maxWait:e});var E=(r,e)=>{if(r===null||typeof r!="object")return r;let t=Array.isArray(r)?[]:{};for(let n in r){if(typeof e=="function"){let i=e(r[n],n,r,t);if(i!==void 0){t[n]=i;continue}}typeof r[n]=="object"?t[n]=E(r[n],e):t[n]=r[n]}return t};var De=r=>E(r);var dt=300,Ue=(r,e=dt)=>new a(t=>{let{width:n,height:i}=r.getBoundingClientRect();if(t.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(D(l=>{let o=l[0];if(!o)return;let u,p;o.contentBoxSize&&o.contentBoxSize[0]?(p=o.contentBoxSize[0].blockSize,u=o.contentBoxSize[0].inlineSize):o.contentRect&&(u=o.contentRect.width,p=o.contentRect.height),y(u)&&y(p)&&t.next({width:u,height:p})},e));return s.observe(r),()=>s.disconnect()});var Be=r=>{r.removeAttribute("src"),r.load()};var S=class extends I{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}};function W(r){return new a(e=>{let t={},n=Object.keys(r).length,i=s=>l=>{s in t||n--,t[s]=l,n===0&&e.next(t)};return Object.entries(r).reduce((s,[l,o])=>s.add(o.subscribe(i(l))),new m)})}function G(...r){return new a(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new m))}var Fe=r=>new a(e=>{let t=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},r);return()=>window.clearTimeout(t)});var ze=r=>new a(e=>{let t=window.setInterval(()=>e.next(),r);return()=>{t&&(window.clearInterval(t),t=void 0)}});var je=r=>new a(e=>{r.forEach(t=>e.next(t))});var We=(r,e)=>new a(t=>{let n=i=>t.next(i);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function q(r){return e=>new a(t=>e.subscribe(new H(t,r)))}var H=class{constructor(e,t){this.destination=e;this.size=t;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var ft={leading:!1,trailing:!0};function Y(r,e=ft){return t=>new a(n=>t.subscribe(new K(n,r,e)))}var K=class{constructor(e,t,n){this.destination=e;this.time=t;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var mt={leading:!0,trailing:!1};function X(r,e=mt){return t=>new a(n=>t.subscribe(new $(n,r,e)))}var $=class{constructor(e,t,n){this.destination=e;this.time=t;this.config=n}next(e){this.lastValue=e,L(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function Z(r){return e=>new a(t=>e.subscribe(new J(t,r)))}var J=class{constructor(e,t){this.destination=e;this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function te(r=(e,t)=>e===t){return e=>new a(t=>e.subscribe(new ee(t,r)))}var Ge={},ee=class{constructor(e,t){this.destination=e;this.predicate=t;this.lastValue=Ge}next(e){let t;try{t=this.lastValue===Ge||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function R(r){return e=>new a(t=>e.subscribe(new re(t,r)))}var re=class{constructor(e,t){this.destination=e;this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(t)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function ne(r){return R(()=>r)}function ie(){return r=>new a(e=>{let t=!1,n=!1,i=r.subscribe(s=>{t||(t=!0,e.next(s)),n&&i.unsubscribe()},s=>{var l;t=!0,(l=e.error)==null||l.call(e,s),n&&i.unsubscribe()});return n=!0,t&&i.unsubscribe(),i})}function se(){return r=>new a(e=>r.subscribe(new oe(e)))}var oe=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function le(r){return e=>new a(t=>e.subscribe(new ae(t,r)))}var ae=class{constructor(e,t){this.destination=e;this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var He=(o=>(o.NETWORK="network",o.VIDEO_PIPELINE="video_pipeline",o.EXTERNAL_API="external_api",o.PARSER="parser",o.DOM="dom",o.WTF="wtf",o.FATAL="fatal",o))(He||{});var qe=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(qe||{}),Tt="vk.com",vt=async(r,e,t)=>{let n=new URL(`https://${Tt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),r!==void 0&&n.searchParams.set("lang",r);let s=await(await fetch(n.toString())).json();return ht(s,t)},ht=(r,e)=>Object.fromEntries(Object.entries(r.keys).map(([t,n])=>[t.substring(`${e}_`.length),It(n)])),It=r=>Array.isArray(r)?r[0]:r;var Ke=(t=>(t.RU="ru",t.EN="en",t))(Ke||{});
|
package/es2018.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.38-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.38-dev.876770ad.0
|
|
3
|
+
* Thu, 15 Aug 2024 18:48:59 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-38/doc/
|
|
5
5
|
*/
|
|
6
|
-
var Oe=Object.defineProperty;var we=(t,e)=>{for(var r in e)Oe(t,r,{get:e[r],enumerable:!0})};var Ee="1.0.38-dev.736aea74.0";var m=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var I=t=>{throw new Error(`${t} is value of unexpected type`)},Se=t=>{};var g=()=>{};var a=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){var l;let n;r?typeof r=="function"?n={next:r,error:g}:n={next:o=>r.next(o),error:o=>{var u;return(u=r.error)==null?void 0:u.call(r,o)}}:n={next:g,error:g};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(u){n.next(u)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){(l=i.error)==null||l.call(i,o)}return new m().add(()=>{switch(i.next=g,i.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return I(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var x=class extends a{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>{var i;return(i=n.error)==null?void 0:i.call(n,r)})}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new m().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new x;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch(i){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function Ae(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Re(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function O(t){return typeof t!="undefined"&&t!==null}function Q(t){return t==null}function Ce(t,e){if(!(t!=null&&t.length))throw new Error(e)}function ke(t,e){if(t!=null&&t.length)throw new Error(e)}var Le=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{o(),c.remove()});let s=()=>{o(),i()},l=()=>{o(),n()},o=()=>{u&&clearTimeout(u),c.removeEventListener("load",l),c.removeEventListener("error",s)},u;r&&(u=window.setTimeout(s,r));let c=document.createElement("script");c.addEventListener("load",l),c.addEventListener("error",s),c.src=t,document.head.appendChild(c)});var te,Pe=typeof((te=window.performance)==null?void 0:te.now)=="function"?()=>window.performance.now():()=>Date.now();var Me=(t,e)=>async(...r)=>{var l;let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=(l=o.done)!=null?l:!1,s=o.value}catch(o){await n.throw(o)}return s};var re=(c=>(c.Unknown="Unknown",c.Yandex="Yandex",c.Chrome="Chrome",c.Chromium="Chromium",c.Firefox="Firefox",c.Safari="Safari",c.Opera="Opera",c.Edge="Edge",c.Rest="Rest",c))(re||{}),ne=(u=>(u.Unknown="Unknown",u.Android="Android",u.iPhone="iPhone",u.iPad="iPad",u.iPod="iPod",u.RestMobile="RestMobile",u.Mac="Mac",u.Desktop="Desktop",u))(ne||{}),k=()=>{let{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?"Yandex":void 0,r=/chrome|crios/i.test(t)?"Chrome":void 0,n=/chromium/i.test(t)?"Chromium":void 0,i=/firefox|fxios/i.test(t)?"Firefox":void 0,s=/webkit|safari|khtml/i.test(t)?"Safari":void 0,l=/opr\//i.test(t)?"Opera":void 0,o=/edg/i.test(t)?"Edge":void 0,u=/android/i.test(t)?"Android":void 0,c=/iphone/i.test(t)?"iPhone":void 0,f=/ipad/i.test(t)?"iPad":void 0,b=/ipod/i.test(t)?"iPod":void 0,E=/mac/i.test(t)?"Mac":void 0,S=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?"RestMobile":void 0;return{browser:e||i||l||o||r||n||s||"Rest",device:u||c||f||b||S||E||"Desktop"}},Ne=(t=!1)=>{let r=["iPhone","iPad","iPod"].includes(k().device);if(!t)return r;let{userAgent:n,maxTouchPoints:i}=window.navigator;return!!(r||/macintosh/i.test(n)&&i>0)},Ve=()=>{let{userAgent:t}=window.navigator,e=t.match(/Version\/(\d+(\.\d+)?)/i);if(!e)return null;let r=e[1],n=parseFloat(r);return isNaN(n)?null:n},Qe=()=>k().device==="Android",_e=()=>["Mac","iPhone","iPad","iPod"].includes(k().device),De=()=>{var t,e;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((t=navigator.appVersion)!=null?t:navigator.userAgent)||((e=navigator==null?void 0:navigator.userAgentData)==null?void 0:e.mobile)};var Ue=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let l=e;return l*=r**t,l*=1+(Math.random()*s*2-s),l=Math.round(l),l=Math.min(l,n),l=Math.max(l,i),l};var D={};we(D,{clear:()=>Ge,get:()=>ze,has:()=>Be,isPersistent:()=>Fe,remove:()=>We,set:()=>je});var d,y,_=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(y!==void 0)return y;try{localStorage.setItem(_,"test"),localStorage.removeItem(_),y=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(_),y=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)y=2;else throw e}else throw t}return y===2&&(d=new Map),y},Fe=()=>w()===0,ze=t=>{var r,n;let e=w();switch(e){case 0:return(r=localStorage.getItem(t))!=null?r:void 0;case 1:return(n=sessionStorage.getItem(t))!=null?n:void 0;case 2:return d==null?void 0:d.get(t);default:I(e)}},je=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void(d==null?void 0:d.set(t,e));default:I(r)}},Be=t=>{var r;let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return(r=d==null?void 0:d.has(t))!=null?r:!1;default:return I(e),!1}},We=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void(d==null?void 0:d.delete(t));default:I(e)}},Ge=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return d==null?void 0:d.clear();default:I(t)}};var qe=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var U=(f=>(f.INVARIANT="Invariant quality",f.Q_144P="144p",f.Q_240P="240p",f.Q_360P="360p",f.Q_480P="480p",f.Q_720P="720p",f.Q_1080P="1080p",f.Q_1440P="1440p",f.Q_2160P="2160p",f.Q_4320P="4320p",f))(U||{});var T={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},He=(t,e)=>T[t].height>T[e].height,Ke=(t,e)=>T[t].height>=T[e].height,F=(t,e)=>T[t].height<T[e].height,$e=(t,e)=>T[t].height<=T[e].height,Ye=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:F(e,r)?1:-1)[0],oe=Object.keys(T).sort((t,e)=>F(t,e)?-1:1),Xe=(t,e=.02)=>[...oe].find(n=>T[n].height*(1+e)>=t),Je=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return oe.find(i=>{let s=T[i];return s.width>=n&&s.height>=r})},Ze=t=>T[t].height,z=t=>t==="Invariant quality",et=t=>t.every(e=>!z(e));function tt(t){if(z(t))throw new Error("Expected exact quality")}var rt=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=rt(s,i):r[n]=n in t?s:i}return r};var Ht=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function j(t,e=0,r){let n,i,s,l,o,u,c=0,f=!1,b=!1,E=!0,S=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(f=!!r.leading,b="maxWait"in r,s=r!=null&&r.maxWait?Math.max(+(r==null?void 0:r.maxWait)||0,e):s,E="trailing"in r?!!r.trailing:E);function N(p){let v=n,h=i;return n=i=void 0,c=p,l=t.apply(h,v),l}function A(p,v){return S?(o&&window.cancelAnimationFrame(o),window.requestAnimationFrame(p)):setTimeout(p,v)}function ve(p){if(S){window.cancelAnimationFrame(p);return}clearTimeout(p)}function Ie(p){return c=p,o=A(R,e),f?N(p):l}function xe(p){let v=p-u,h=p-c,ee=e-v;return b?Math.min(ee,s-h):ee}function J(p){let v=p-u,h=p-c;return u===void 0||v>=e||v<0||b&&h>=s}function R(){let p=Date.now();if(J(p))return Z(p);o=A(R,xe(p))}function Z(p){return o=void 0,E&&n?N(p):(n=i=void 0,l)}function he(){o!==void 0&&ve(o),c=0,n=u=i=o=void 0}function ge(){return o===void 0?l:Z(Date.now())}function ye(){return o!==void 0}function C(...p){let v=Date.now(),h=J(v);if(n=p,i=this,u=v,h){if(o===void 0)return Ie(u);if(b)return o=A(R,e),N(u)}return o===void 0&&(o=A(R,e)),l}return C.cancel=he,C.flush=ge,C.pending=ye,C}var B=(t,e=0,r)=>j(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var L=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=L(t[n],e):r[n]=t[n]}return r};var nt=t=>L(t);var ot=300,it=(t,e=ot)=>new a(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(B(l=>{let o=l[0];if(!o)return;let u,c;o.contentBoxSize&&o.contentBoxSize[0]?(c=o.contentBoxSize[0].blockSize,u=o.contentBoxSize[0].inlineSize):o.contentRect&&(u=o.contentRect.width,c=o.contentRect.height),O(u)&&O(c)&&r.next({width:u,height:c})},e));return s.observe(t),()=>s.disconnect()});var P=class extends x{constructor(r){super();this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){let n=super._subscribe(r);return r.next(this.value),n}};function ie(t){return new a(e=>{let r={},n=Object.keys(t).length,i=s=>l=>{s in r||n--,r[s]=l,n===0&&e.next(r)};return Object.entries(t).reduce((s,[l,o])=>s.add(o.subscribe(i(l))),new m)})}function se(...t){return new a(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new m))}var st=t=>new a(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var at=t=>new a(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var lt=t=>new a(e=>{t.forEach(r=>e.next(r))});var ut=(t,e)=>new a(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function ae(t){return e=>new a(r=>e.subscribe(new W(r,t)))}var W=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var ct={leading:!1,trailing:!0};function le(t,e=ct){return r=>new a(n=>r.subscribe(new G(n,t,e)))}var G=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,O(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var pt={leading:!0,trailing:!1};function ue(t,e=pt){return r=>new a(n=>r.subscribe(new q(n,t,e)))}var q=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,Q(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function ce(t){return e=>new a(r=>e.subscribe(new H(r,t)))}var H=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function be(t=(e,r)=>e===r){return e=>new a(r=>e.subscribe(new K(r,t)))}var pe={},K=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=pe}next(e){let r;try{r=this.lastValue===pe||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function M(t){return e=>new a(r=>e.subscribe(new $(r,t)))}var $=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function de(t){return M(()=>t)}function fe(){return t=>new a(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{var l;r=!0,(l=e.error)==null||l.call(e,s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function me(){return t=>new a(e=>t.subscribe(new Y(e)))}var Y=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};function Te(t){return e=>new a(r=>e.subscribe(new X(r,t)))}var X=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){var r,n;(n=(r=this.destination).error)==null||n.call(r,e)}};var bt=(o=>(o.NETWORK="network",o.VIDEO_PIPELINE="video_pipeline",o.EXTERNAL_API="external_api",o.PARSER="parser",o.DOM="dom",o.WTF="wtf",o.FATAL="fatal",o))(bt||{});var dt=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(dt||{}),ft="vk.com",Qn=async(t,e,r)=>{let n=new URL(`https://${ft}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return mt(s,r)},mt=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Tt(n)])),Tt=t=>Array.isArray(t)?t[0]:t;var vt=(r=>(r.RU="ru",r.EN="en",r))(vt||{});export{re as CurrentClientBrowser,ne as CurrentClientDevice,bt as ErrorCategory,vt as InterfaceLanguage,V as Logger,a as Observable,x as Subject,m as Subscription,Ee as VERSION,dt as VKNumericLanguage,P as ValueSubject,U as VideoQuality,Me as abortable,Le as addScript,et as areQualitiesExact,ke as assertEmptyArray,I as assertNever,Ae as assertNonNullable,Ce as assertNotEmptyArray,Re as assertNullable,tt as assertQualityIsExact,ae as buffer,Se as checkNever,nt as cloneDeep,L as cloneDeepWith,ie as combine,le as debounce,j as debounceFn,qe as detectEmbed,rt as fillWithDefault,ce as filter,be as filterChanged,ut as fromEvent,k as getCurrentBrowser,Ue as getExponentialDelay,Ye as getHighestQuality,Ve as getIOSVersion,at as interval,Qe as isAndroid,He as isHigher,Ke as isHigherOrEqual,Ne as isIOS,z as isInvariantQuality,F as isLower,$e as isLowerOrEqual,_e as isMacLike,De as isMobile,O as isNonNullable,Q as isNullable,Qn as loadVKLangPack,M as map,de as mapTo,se as merge,g as noop,Pe as now,lt as observableFrom,it as observeElementSize,fe as once,me as pairwise,D as safeStorage,Te as tap,ue as throttle,B as throttleFn,Ht as timeCodeToString,st as timeout,Xe as videoHeightToQuality,Ze as videoQualityToHeight,Je as videoSizeToQuality};
|
|
6
|
+
var ge=Object.defineProperty;var ye=(r,e)=>{for(var t in e)ge(r,t,{get:e[t],enumerable:!0})};var Oe="1.0.38-dev.876770ad.0";var m=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var h=r=>{throw new Error(`${r} is value of unexpected type`)},we=r=>{};var g=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,t){var a;let n;t?typeof t=="function"?n={next:t,error:g}:n={next:i=>t.next(i),error:i=>{var u;return(u=t.error)==null?void 0:u.call(t,i)}}:n={next:g,error:g};let o=typeof e=="function"?{next:i=>{try{e(i)}catch(u){n.next(u)}},error:i=>n.next(i)}:{next:i=>e.next(i),error:i=>e.error?e.error(i):n.next(i)},s;try{s=this._subscribe(o)}catch(i){(a=o.error)==null||a.call(o,i)}return new m().add(()=>{switch(o.next=g,o.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return h(s)}})}pipe(...e){return e.reduce((t,n)=>n(t),this)}_subscribe(e){}};var I=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>{var o;return(o=n.error)==null?void 0:o.call(n,t)})}_subscribe(t){let n=this.keyCounter++;return this.subscribers.set(n,t),new m().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new I;this.logs=[];this.log=e=>{let t={...e,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...t)=>{let n;try{n=e(...t)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(t=>({component:e,...t}))}};function Ee(r,e='Assertion "value is not nullable" failed'){if(r==null)throw new Error(e)}function Se(r,e='Assertion "value is nullable" failed'){if(r!=null)throw new Error(e)}function O(r){return typeof r!="undefined"&&r!==null}function M(r){return r==null}function Re(r,e){if(!(r!=null&&r.length))throw new Error(e)}function Ae(r,e){if(r!=null&&r.length)throw new Error(e)}var Ce=(r,e,t)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{i(),p.remove()});let s=()=>{i(),o()},a=()=>{i(),n()},i=()=>{u&&clearTimeout(u),p.removeEventListener("load",a),p.removeEventListener("error",s)},u;t&&(u=window.setTimeout(s,t));let p=document.createElement("script");p.addEventListener("load",a),p.addEventListener("error",s),p.src=r,document.head.appendChild(p)});var te,Pe=typeof((te=window.performance)==null?void 0:te.now)=="function"?()=>window.performance.now():()=>Date.now();var ke=(r,e)=>async(...t)=>{var a;let n=e(...t),o=r.aborted,s;for(;!o&&!r.aborted;)try{let i=await n.next(s);o=(a=i.done)!=null?a:!1,s=i.value}catch(i){await n.throw(i)}return s};var N=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||(window==null?void 0:window.screen.width)>700,t=this._iosVersion;return!e||e&&!!t&&t<16}get isAndroid(){return this.device==="Android"}get isMobile(){var e,t;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((e=navigator.appVersion)!=null?e:navigator.userAgent)||((t=navigator==null?void 0:navigator.userAgentData)==null?void 0:t.mobile)}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){var n;let{userAgent:e,maxTouchPoints:t}=navigator;try{this._maxTouchPoints=t,this._isHdr=!!((n=matchMedia("(dynamic-range: high)"))!=null&&n.matches)}catch(o){console.error(o)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let t=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,o=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,a=/firefox|fxios/i.test(e)?"Firefox":void 0,i=/webkit|safari|khtml/i.test(e)?"Safari":void 0,u=/opr\//i.test(e)?"Opera":void 0,p=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=t||n||a||u||p||o||s||i||"Rest"}catch(t){console.error(t)}}detectDevice(e){try{let t=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,o=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,a=/mac/i.test(e)?"Mac":void 0,i=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=t||n||o||s||i||a||"Desktop"}catch(t){console.error(t)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return;let n=t[1],o=parseFloat(n);if(isNaN(o))return;this._iosVersion=o}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+)/);if(!t)return;let n=t[1],o=parseInt(n,10);if(isNaN(o))return;this._macVersion=o}catch(e){console.error(e)}}},Le=new N;var Ve=(r,{start:e=0,factor:t=2,max:n=1/0,min:o=e,random:s=0}={})=>{let a=e;return a*=t**r,a*=1+(Math.random()*s*2-s),a=Math.round(a),a=Math.min(a,n),a=Math.max(a,o),a};var Q={};ye(Q,{clear:()=>Ue,get:()=>Ne,has:()=>Qe,isPersistent:()=>Me,remove:()=>De,set:()=>_e});var d,y,_=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(y!==void 0)return y;try{localStorage.setItem(_,"test"),localStorage.removeItem(_),y=0}catch(r){if(r instanceof DOMException||r instanceof TypeError)try{sessionStorage.getItem(_),y=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)y=2;else throw e}else throw r}return y===2&&(d=new Map),y},Me=()=>w()===0,Ne=r=>{var t,n;let e=w();switch(e){case 0:return(t=localStorage.getItem(r))!=null?t:void 0;case 1:return(n=sessionStorage.getItem(r))!=null?n:void 0;case 2:return d==null?void 0:d.get(r);default:h(e)}},_e=(r,e)=>{let t=w();switch(t){case 0:try{localStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(r,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void(d==null?void 0:d.set(r,e));default:h(t)}},Qe=r=>{var t;let e=w();switch(e){case 0:return r in localStorage;case 1:return r in sessionStorage;case 2:return(t=d==null?void 0:d.has(r))!=null?t:!1;default:return h(e),!1}},De=r=>{let e=w();switch(e){case 0:return localStorage.removeItem(r);case 1:return sessionStorage.removeItem(r);case 2:return void(d==null?void 0:d.delete(r));default:h(e)}},Ue=()=>{let r=w();switch(r){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return d==null?void 0:d.clear();default:h(r)}};var Be=()=>{let r,e;try{r=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?r=!0:(r=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let t=e?new URL(e).hostname:void 0;return{isEmbed:r,host:t}};var D=(f=>(f.INVARIANT="Invariant quality",f.Q_144P="144p",f.Q_240P="240p",f.Q_360P="360p",f.Q_480P="480p",f.Q_720P="720p",f.Q_1080P="1080p",f.Q_1440P="1440p",f.Q_2160P="2160p",f.Q_4320P="4320p",f))(D||{});var T={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Fe=(r,e)=>T[r].height>T[e].height,ze=(r,e)=>T[r].height>=T[e].height,U=(r,e)=>T[r].height<T[e].height,je=(r,e)=>T[r].height<=T[e].height,We=r=>r.sort((e,t)=>e===t?0:e==="Invariant quality"?1:t==="Invariant quality"?-1:U(e,t)?1:-1)[0],re=Object.keys(T).sort((r,e)=>U(r,e)?-1:1),Ge=(r,e=.02)=>[...re].find(n=>T[n].height*(1+e)>=r),He=({width:r,height:e})=>{let t=Math.min(r,e),n=Math.max(r,e);return re.find(o=>{let s=T[o];return s.width>=n&&s.height>=t})},qe=r=>T[r].height,B=r=>r==="Invariant quality",Ke=r=>r.every(e=>!B(e));function Ye(r){if(B(r))throw new Error("Expected exact quality")}var $e=(r,e)=>{let t={};for(let n of Object.keys(e)){let o=e[n],s=r[n];Array.isArray(o)&&Array.isArray(s)?t[n]=s:typeof o=="object"&&typeof s=="object"?t[n]=$e(s,o):t[n]=n in r?s:o}return t};var zt=r=>{let e="";return r>=3600&&(e+=Math.floor(r/3600)+"h",r=r%3600),r>=60&&(e+=Math.floor(r/60)+"m",r=r%60),r>0&&(e+=Math.floor(r)+"s"),e};function F(r,e=0,t){let n,o,s,a,i,u,p=0,f=!1,b=!1,k=!0,X=!e&&e!==0&&typeof window.requestAnimationFrame=="function";t&&(f=!!t.leading,b="maxWait"in t,s=t!=null&&t.maxWait?Math.max(+(t==null?void 0:t.maxWait)||0,e):s,k="trailing"in t?!!t.trailing:k);function L(c){let v=n,x=o;return n=o=void 0,p=c,a=r.apply(x,v),a}function E(c,v){return X?(i&&window.cancelAnimationFrame(i),window.requestAnimationFrame(c)):setTimeout(c,v)}function me(c){if(X){window.cancelAnimationFrame(c);return}clearTimeout(c)}function Te(c){return p=c,i=E(S,e),f?L(c):a}function ve(c){let v=c-u,x=c-p,ee=e-v;return b?Math.min(ee,s-x):ee}function J(c){let v=c-u,x=c-p;return u===void 0||v>=e||v<0||b&&x>=s}function S(){let c=Date.now();if(J(c))return Z(c);i=E(S,ve(c))}function Z(c){return i=void 0,k&&n?L(c):(n=o=void 0,a)}function he(){i!==void 0&&me(i),p=0,n=u=o=i=void 0}function Ie(){return i===void 0?a:Z(Date.now())}function xe(){return i!==void 0}function R(...c){let v=Date.now(),x=J(v);if(n=c,o=this,u=v,x){if(i===void 0)return Te(u);if(b)return i=E(S,e),L(u)}return i===void 0&&(i=E(S,e)),a}return R.cancel=he,R.flush=Ie,R.pending=xe,R}var z=(r,e=0,t)=>F(r,e,{...{leading:!0,trailing:!0},...t,maxWait:e});var A=(r,e)=>{if(r===null||typeof r!="object")return r;let t=Array.isArray(r)?[]:{};for(let n in r){if(typeof e=="function"){let o=e(r[n],n,r,t);if(o!==void 0){t[n]=o;continue}}typeof r[n]=="object"?t[n]=A(r[n],e):t[n]=r[n]}return t};var Xe=r=>A(r);var Je=300,Ze=(r,e=Je)=>new l(t=>{let{width:n,height:o}=r.getBoundingClientRect();if(t.next({width:n,height:o}),!window.ResizeObserver)return;let s=new ResizeObserver(z(a=>{let i=a[0];if(!i)return;let u,p;i.contentBoxSize&&i.contentBoxSize[0]?(p=i.contentBoxSize[0].blockSize,u=i.contentBoxSize[0].inlineSize):i.contentRect&&(u=i.contentRect.width,p=i.contentRect.height),O(u)&&O(p)&&t.next({width:u,height:p})},e));return s.observe(r),()=>s.disconnect()});var et=r=>{r.removeAttribute("src"),r.load()};var C=class extends I{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let t=super._subscribe(e);return e.next(this.value),t}};function ne(r){return new l(e=>{let t={},n=Object.keys(r).length,o=s=>a=>{s in t||n--,t[s]=a,n===0&&e.next(t)};return Object.entries(r).reduce((s,[a,i])=>s.add(i.subscribe(o(a))),new m)})}function ie(...r){return new l(e=>r.reduce((t,n)=>t.add(n.subscribe(e)),new m))}var tt=r=>new l(e=>{let t=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},r);return()=>window.clearTimeout(t)});var rt=r=>new l(e=>{let t=window.setInterval(()=>e.next(),r);return()=>{t&&(window.clearInterval(t),t=void 0)}});var nt=r=>new l(e=>{r.forEach(t=>e.next(t))});var it=(r,e)=>new l(t=>{let n=o=>t.next(o);return r.addEventListener(e,n),()=>r.removeEventListener(e,n)});function oe(r){return e=>new l(t=>e.subscribe(new j(t,r)))}var j=class{constructor(e,t){this.destination=e;this.size=t;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var ot={leading:!1,trailing:!0};function se(r,e=ot){return t=>new l(n=>t.subscribe(new W(n,r,e)))}var W=class{constructor(e,t,n){this.destination=e;this.time=t;this.config=n}next(e){this.lastValue=e,O(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(t){if(this.destination.error)this.destination.error(t);else throw t}this.timeout=void 0},this.time)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var st={leading:!0,trailing:!1};function ae(r,e=st){return t=>new l(n=>t.subscribe(new G(n,r,e)))}var G=class{constructor(e,t,n){this.destination=e;this.time=t;this.config=n}next(e){this.lastValue=e,M(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function le(r){return e=>new l(t=>e.subscribe(new H(t,r)))}var H=class{constructor(e,t){this.destination=e;this.predicate=t}next(e){let t;try{t=this.predicate(e)}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function ue(r=(e,t)=>e===t){return e=>new l(t=>e.subscribe(new q(t,r)))}var ce={},q=class{constructor(e,t){this.destination=e;this.predicate=t;this.lastValue=ce}next(e){let t;try{t=this.lastValue===ce||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}t&&this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function P(r){return e=>new l(t=>e.subscribe(new K(t,r)))}var K=class{constructor(e,t){this.destination=e;this.mapper=t}next(e){let t;try{t=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(t)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function pe(r){return P(()=>r)}function be(){return r=>new l(e=>{let t=!1,n=!1,o=r.subscribe(s=>{t||(t=!0,e.next(s)),n&&o.unsubscribe()},s=>{var a;t=!0,(a=e.error)==null||a.call(e,s),n&&o.unsubscribe()});return n=!0,t&&o.unsubscribe(),o})}function de(){return r=>new l(e=>r.subscribe(new Y(e)))}var Y=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let t=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,e])}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};function fe(r){return e=>new l(t=>e.subscribe(new $(t,r)))}var $=class{constructor(e,t){this.destination=e;this.effect=t}next(e){try{this.effect(e)}catch(t){throw this.error(t),t}this.destination.next(e)}error(e){var t,n;(n=(t=this.destination).error)==null||n.call(t,e)}};var at=(i=>(i.NETWORK="network",i.VIDEO_PIPELINE="video_pipeline",i.EXTERNAL_API="external_api",i.PARSER="parser",i.DOM="dom",i.WTF="wtf",i.FATAL="fatal",i))(at||{});var lt=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(lt||{}),ct="vk.com",Vn=async(r,e,t)=>{let n=new URL(`https://${ct}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),r!==void 0&&n.searchParams.set("lang",r);let s=await(await fetch(n.toString())).json();return ut(s,t)},ut=(r,e)=>Object.fromEntries(Object.entries(r.keys).map(([t,n])=>[t.substring(`${e}_`.length),pt(n)])),pt=r=>Array.isArray(r)?r[0]:r;var bt=(t=>(t.RU="ru",t.EN="en",t))(bt||{});export{Le as CC,at as ErrorCategory,bt as InterfaceLanguage,V as Logger,l as Observable,I as Subject,m as Subscription,Oe as VERSION,lt as VKNumericLanguage,C as ValueSubject,D as VideoQuality,ke as abortable,Ce as addScript,Ke as areQualitiesExact,Ae as assertEmptyArray,h as assertNever,Ee as assertNonNullable,Re as assertNotEmptyArray,Se as assertNullable,Ye as assertQualityIsExact,oe as buffer,we as checkNever,et as clearVideoElement,Xe as cloneDeep,A as cloneDeepWith,ne as combine,se as debounce,F as debounceFn,Be as detectEmbed,$e as fillWithDefault,le as filter,ue as filterChanged,it as fromEvent,Ve as getExponentialDelay,We as getHighestQuality,rt as interval,Fe as isHigher,ze as isHigherOrEqual,B as isInvariantQuality,U as isLower,je as isLowerOrEqual,O as isNonNullable,M as isNullable,Vn as loadVKLangPack,P as map,pe as mapTo,ie as merge,g as noop,Pe as now,nt as observableFrom,Ze as observeElementSize,be as once,de as pairwise,Q as safeStorage,fe as tap,ae as throttle,z as throttleFn,zt as timeCodeToString,tt as timeout,Ge as videoHeightToQuality,qe as videoQualityToHeight,He as videoSizeToQuality};
|
package/esnext.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.38-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.38-dev.876770ad.0
|
|
3
|
+
* Thu, 15 Aug 2024 18:48:59 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-38/doc/
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var j=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var me=(t,e)=>{for(var r in e)j(t,r,{get:e[r],enumerable:!0})},lt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of st(e))!at.call(t,o)&&o!==r&&j(t,o,{get:()=>e[o],enumerable:!(n=it(e,o))||n.enumerable});return t};var ut=t=>lt(j({},"__esModule",{value:!0}),t);var wt={};me(wt,{CurrentClientBrowser:()=>B,CurrentClientDevice:()=>W,ErrorCategory:()=>Ye,InterfaceLanguage:()=>Je,Logger:()=>N,Observable:()=>l,Subject:()=>I,Subscription:()=>f,VERSION:()=>Te,VKNumericLanguage:()=>Xe,ValueSubject:()=>R,VideoQuality:()=>Q,abortable:()=>we,addScript:()=>ye,areQualitiesExact:()=>Fe,assertEmptyArray:()=>ge,assertNever:()=>v,assertNonNullable:()=>Ie,assertNotEmptyArray:()=>he,assertNullable:()=>xe,assertQualityIsExact:()=>ze,buffer:()=>Y,checkNever:()=>ve,cloneDeep:()=>Be,cloneDeepWith:()=>A,combine:()=>H,debounce:()=>J,debounceFn:()=>U,detectEmbed:()=>Le,fillWithDefault:()=>je,filter:()=>re,filterChanged:()=>oe,fromEvent:()=>Ke,getCurrentBrowser:()=>S,getExponentialDelay:()=>ke,getHighestQuality:()=>Ve,getIOSVersion:()=>Se,interval:()=>qe,isAndroid:()=>Ae,isHigher:()=>Pe,isHigherOrEqual:()=>Me,isIOS:()=>Ee,isInvariantQuality:()=>D,isLower:()=>_,isLowerOrEqual:()=>Ne,isMacLike:()=>Re,isMobile:()=>Ce,isNonNullable:()=>g,isNullable:()=>V,loadVKLangPack:()=>gt,map:()=>C,mapTo:()=>se,merge:()=>K,noop:()=>x,now:()=>Oe,observableFrom:()=>He,observeElementSize:()=>We,once:()=>ae,pairwise:()=>ue,safeStorage:()=>q,tap:()=>pe,throttle:()=>ee,throttleFn:()=>F,timeCodeToString:()=>Tt,timeout:()=>Ge,videoHeightToQuality:()=>_e,videoQualityToHeight:()=>Ue,videoSizeToQuality:()=>De});module.exports=ut(wt);var Te="1.0.38-dev.736aea74.0";var f=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var v=t=>{throw new Error(`${t} is value of unexpected type`)},ve=t=>{};var x=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:x}:n={next:i=>r.next(i),error:i=>r.error?.(i)}:n={next:x,error:x};let o=typeof e=="function"?{next:i=>{try{e(i)}catch(a){n.next(a)}},error:i=>n.next(i)}:{next:i=>e.next(i),error:i=>e.error?e.error(i):n.next(i)},s;try{s=this._subscribe(o)}catch(i){o.error?.(i)}return new f().add(()=>{switch(o.next=x,o.error=x,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return v(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var I=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new f().add(()=>this.subscribers.delete(n))}};var N=class{constructor(){this.log$=new I;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function Ie(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function xe(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function g(t){return typeof t<"u"&&t!==null}function V(t){return t==null}function he(t,e){if(!t?.length)throw new Error(e)}function ge(t,e){if(t?.length)throw new Error(e)}var ye=(t,e,r)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),u.remove()});let s=()=>{a(),o()},i=()=>{a(),n()},a=()=>{c&&clearTimeout(c),u.removeEventListener("load",i),u.removeEventListener("error",s)},c;r&&(c=window.setTimeout(s,r));let u=document.createElement("script");u.addEventListener("load",i),u.addEventListener("error",s),u.src=t,document.head.appendChild(u)});var Oe=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var we=(t,e)=>async(...r)=>{let n=e(...r),o=t.aborted,s;for(;!o&&!t.aborted;)try{let i=await n.next(s);o=i.done??!1,s=i.value}catch(i){await n.throw(i)}return s};var B=(u=>(u.Unknown="Unknown",u.Yandex="Yandex",u.Chrome="Chrome",u.Chromium="Chromium",u.Firefox="Firefox",u.Safari="Safari",u.Opera="Opera",u.Edge="Edge",u.Rest="Rest",u))(B||{}),W=(c=>(c.Unknown="Unknown",c.Android="Android",c.iPhone="iPhone",c.iPad="iPad",c.iPod="iPod",c.RestMobile="RestMobile",c.Mac="Mac",c.Desktop="Desktop",c))(W||{}),S=()=>{let{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?"Yandex":void 0,r=/chrome|crios/i.test(t)?"Chrome":void 0,n=/chromium/i.test(t)?"Chromium":void 0,o=/firefox|fxios/i.test(t)?"Firefox":void 0,s=/webkit|safari|khtml/i.test(t)?"Safari":void 0,i=/opr\//i.test(t)?"Opera":void 0,a=/edg/i.test(t)?"Edge":void 0,c=/android/i.test(t)?"Android":void 0,u=/iphone/i.test(t)?"iPhone":void 0,d=/ipad/i.test(t)?"iPad":void 0,b=/ipod/i.test(t)?"iPod":void 0,E=/mac/i.test(t)?"Mac":void 0,k=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?"RestMobile":void 0;return{browser:e||o||i||a||r||n||s||"Rest",device:c||u||d||b||k||E||"Desktop"}},Ee=(t=!1)=>{let r=["iPhone","iPad","iPod"].includes(S().device);if(!t)return r;let{userAgent:n,maxTouchPoints:o}=window.navigator;return!!(r||/macintosh/i.test(n)&&o>0)},Se=()=>{let{userAgent:t}=window.navigator,e=t.match(/Version\/(\d+(\.\d+)?)/i);if(!e)return null;let r=e[1],n=parseFloat(r);return isNaN(n)?null:n},Ae=()=>S().device==="Android",Re=()=>["Mac","iPhone","iPad","iPod"].includes(S().device),Ce=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile;var ke=(t,{start:e=0,factor:r=2,max:n=1/0,min:o=e,random:s=0}={})=>{let i=e;return i*=r**t,i*=1+(Math.random()*s*2-s),i=Math.round(i),i=Math.min(i,n),i=Math.max(i,o),i};var q={};me(q,{clear:()=>mt,get:()=>pt,has:()=>dt,isPersistent:()=>ct,remove:()=>ft,set:()=>bt});var O,y,G=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(y!==void 0)return y;try{localStorage.setItem(G,"test"),localStorage.removeItem(G),y=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(G),y=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)y=2;else throw e}else throw t}return y===2&&(O=new Map),y},ct=()=>w()===0,pt=t=>{let e=w();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return O?.get(t);default:v(e)}},bt=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void O?.set(t,e);default:v(r)}},dt=t=>{let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return v(e),!1}},ft=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void O?.delete(t);default:v(e)}},mt=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:v(t)}};var Le=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var Q=(d=>(d.INVARIANT="Invariant quality",d.Q_144P="144p",d.Q_240P="240p",d.Q_360P="360p",d.Q_480P="480p",d.Q_720P="720p",d.Q_1080P="1080p",d.Q_1440P="1440p",d.Q_2160P="2160p",d.Q_4320P="4320p",d))(Q||{});var m={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Pe=(t,e)=>m[t].height>m[e].height,Me=(t,e)=>m[t].height>=m[e].height,_=(t,e)=>m[t].height<m[e].height,Ne=(t,e)=>m[t].height<=m[e].height,Ve=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:_(e,r)?1:-1)[0],Qe=Object.keys(m).sort((t,e)=>_(t,e)?-1:1),_e=(t,e=.02)=>[...Qe].find(n=>m[n].height*(1+e)>=t),De=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return Qe.find(o=>{let s=m[o];return s.width>=n&&s.height>=r})},Ue=t=>m[t].height,D=t=>t==="Invariant quality",Fe=t=>t.every(e=>!D(e));function ze(t){if(D(t))throw new Error("Expected exact quality")}var je=(t,e)=>{let r={};for(let n of Object.keys(e)){let o=e[n],s=t[n];Array.isArray(o)&&Array.isArray(s)?r[n]=s:typeof o=="object"&&typeof s=="object"?r[n]=je(s,o):r[n]=n in t?s:o}return r};var Tt=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function U(t,e=0,r){let n,o,s,i,a,c,u=0,d=!1,b=!1,E=!0,k=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(d=!!r.leading,b="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,E="trailing"in r?!!r.trailing:E);function z(p){let T=n,h=o;return n=o=void 0,u=p,i=t.apply(h,T),i}function L(p,T){return k?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(p)):setTimeout(p,T)}function Ze(p){if(k){window.cancelAnimationFrame(p);return}clearTimeout(p)}function et(p){return u=p,a=L(P,e),d?z(p):i}function tt(p){let T=p-c,h=p-u,fe=e-T;return b?Math.min(fe,s-h):fe}function be(p){let T=p-c,h=p-u;return c===void 0||T>=e||T<0||b&&h>=s}function P(){let p=Date.now();if(be(p))return de(p);a=L(P,tt(p))}function de(p){return a=void 0,E&&n?z(p):(n=o=void 0,i)}function rt(){a!==void 0&&Ze(a),u=0,n=c=o=a=void 0}function nt(){return a===void 0?i:de(Date.now())}function ot(){return a!==void 0}function M(...p){let T=Date.now(),h=be(T);if(n=p,o=this,c=T,h){if(a===void 0)return et(c);if(b)return a=L(P,e),z(c)}return a===void 0&&(a=L(P,e)),i}return M.cancel=rt,M.flush=nt,M.pending=ot,M}var F=(t,e=0,r)=>U(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var A=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let o=e(t[n],n,t,r);if(o!==void 0){r[n]=o;continue}}typeof t[n]=="object"?r[n]=A(t[n],e):r[n]=t[n]}return r};var Be=t=>A(t);var vt=300,We=(t,e=vt)=>new l(r=>{let{width:n,height:o}=t.getBoundingClientRect();if(r.next({width:n,height:o}),!window.ResizeObserver)return;let s=new ResizeObserver(F(i=>{let a=i[0];if(!a)return;let c,u;a.contentBoxSize&&a.contentBoxSize[0]?(u=a.contentBoxSize[0].blockSize,c=a.contentBoxSize[0].inlineSize):a.contentRect&&(c=a.contentRect.width,u=a.contentRect.height),g(c)&&g(u)&&r.next({width:c,height:u})},e));return s.observe(t),()=>s.disconnect()});var R=class extends I{constructor(r){super();this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){let n=super._subscribe(r);return r.next(this.value),n}};function H(t){return new l(e=>{let r={},n=Object.keys(t).length,o=s=>i=>{s in r||n--,r[s]=i,n===0&&e.next(r)};return Object.entries(t).reduce((s,[i,a])=>s.add(a.subscribe(o(i))),new f)})}function K(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new f))}var Ge=t=>new l(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var qe=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var He=t=>new l(e=>{t.forEach(r=>e.next(r))});var Ke=(t,e)=>new l(r=>{let n=o=>r.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function Y(t){return e=>new l(r=>e.subscribe(new $(r,t)))}var $=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}};var It={leading:!1,trailing:!0};function J(t,e=It){return r=>new l(n=>r.subscribe(new X(n,t,e)))}var X=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,g(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var xt={leading:!0,trailing:!1};function ee(t,e=xt){return r=>new l(n=>r.subscribe(new Z(n,t,e)))}var Z=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,V(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function re(t){return e=>new l(r=>e.subscribe(new te(r,t)))}var te=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function oe(t=(e,r)=>e===r){return e=>new l(r=>e.subscribe(new ne(r,t)))}var $e={},ne=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=$e}next(e){let r;try{r=this.lastValue===$e||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function C(t){return e=>new l(r=>e.subscribe(new ie(r,t)))}var ie=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function se(t){return C(()=>t)}function ae(){return t=>new l(e=>{let r=!1,n=!1,o=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&o.unsubscribe()},s=>{r=!0,e.error?.(s),n&&o.unsubscribe()});return n=!0,r&&o.unsubscribe(),o})}function ue(){return t=>new l(e=>t.subscribe(new le(e)))}var le=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function pe(t){return e=>new l(r=>e.subscribe(new ce(r,t)))}var ce=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};var Ye=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(Ye||{});var Xe=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(Xe||{}),ht="vk.com",gt=async(t,e,r)=>{let n=new URL(`https://${ht}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return yt(s,r)},yt=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Ot(n)])),Ot=t=>Array.isArray(t)?t[0]:t;var Je=(r=>(r.RU="ru",r.EN="en",r))(Je||{});
|
|
6
|
+
"use strict";var B=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var de=(t,e)=>{for(var r in e)B(t,r,{get:e[r],enumerable:!0})},nt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of tt(e))!rt.call(t,i)&&i!==r&&B(t,i,{get:()=>e[i],enumerable:!(n=et(e,i))||n.enumerable});return t};var it=t=>nt(B({},"__esModule",{value:!0}),t);var It={};de(It,{CC:()=>Oe,ErrorCategory:()=>Ge,InterfaceLanguage:()=>qe,Logger:()=>k,Observable:()=>l,Subject:()=>h,Subscription:()=>f,VERSION:()=>fe,VKNumericLanguage:()=>He,ValueSubject:()=>S,VideoQuality:()=>V,abortable:()=>ye,addScript:()=>ge,areQualitiesExact:()=>Me,assertEmptyArray:()=>Ie,assertNever:()=>v,assertNonNullable:()=>Te,assertNotEmptyArray:()=>he,assertNullable:()=>ve,assertQualityIsExact:()=>Ne,buffer:()=>q,checkNever:()=>me,clearVideoElement:()=>Ue,cloneDeep:()=>Qe,cloneDeepWith:()=>E,combine:()=>W,debounce:()=>Y,debounceFn:()=>_,detectEmbed:()=>Ee,fillWithDefault:()=>_e,filter:()=>Z,filterChanged:()=>te,fromEvent:()=>je,getExponentialDelay:()=>we,getHighestQuality:()=>Ce,interval:()=>Fe,isHigher:()=>Se,isHigherOrEqual:()=>Re,isInvariantQuality:()=>N,isLower:()=>M,isLowerOrEqual:()=>Ae,isNonNullable:()=>x,isNullable:()=>L,loadVKLangPack:()=>Tt,map:()=>R,mapTo:()=>ne,merge:()=>G,noop:()=>I,now:()=>xe,observableFrom:()=>ze,observeElementSize:()=>De,once:()=>ie,pairwise:()=>se,safeStorage:()=>j,tap:()=>le,throttle:()=>X,throttleFn:()=>Q,timeCodeToString:()=>pt,timeout:()=>Be,videoHeightToQuality:()=>ke,videoQualityToHeight:()=>Ve,videoSizeToQuality:()=>Le});module.exports=it(It);var fe="1.0.38-dev.876770ad.0";var f=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var v=t=>{throw new Error(`${t} is value of unexpected type`)},me=t=>{};var I=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:I}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:I,error:I};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new f().add(()=>{switch(i.next=I,i.error=I,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return v(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var h=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new f().add(()=>this.subscribers.delete(n))}};var k=class{constructor(){this.log$=new h;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function Te(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function ve(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function x(t){return typeof t<"u"&&t!==null}function L(t){return t==null}function he(t,e){if(!t?.length)throw new Error(e)}function Ie(t,e){if(t?.length)throw new Error(e)}var ge=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{a(),c.remove()});let s=()=>{a(),i()},o=()=>{a(),n()},a=()=>{p&&clearTimeout(p),c.removeEventListener("load",o),c.removeEventListener("error",s)},p;r&&(p=window.setTimeout(s,r));let c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",s),c.src=t,document.head.appendChild(c)});var xe=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var ye=(t,e)=>async(...r)=>{let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=o.done??!1,s=o.value}catch(o){await n.throw(o)}return s};var F=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||window?.screen.width>700,r=this._iosVersion;return!e||e&&!!r&&r<16}get isAndroid(){return this.device==="Android"}get isMobile(){return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){let{userAgent:e,maxTouchPoints:r}=navigator;try{this._maxTouchPoints=r,this._isHdr=!!matchMedia("(dynamic-range: high)")?.matches}catch(n){console.error(n)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let r=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,o=/firefox|fxios/i.test(e)?"Firefox":void 0,a=/webkit|safari|khtml/i.test(e)?"Safari":void 0,p=/opr\//i.test(e)?"Opera":void 0,c=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=r||n||o||p||c||i||s||a||"Rest"}catch(r){console.error(r)}}detectDevice(e){try{let r=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,o=/mac/i.test(e)?"Mac":void 0,a=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=r||n||i||s||a||o||"Desktop"}catch(r){console.error(r)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+(\.\d+)?)/i);if(!r)return;let n=r[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+)/);if(!r)return;let n=r[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},Oe=new F;var we=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var j={};de(j,{clear:()=>ct,get:()=>st,has:()=>lt,isPersistent:()=>ot,remove:()=>ut,set:()=>at});var O,y,z=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(y!==void 0)return y;try{localStorage.setItem(z,"test"),localStorage.removeItem(z),y=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(z),y=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)y=2;else throw e}else throw t}return y===2&&(O=new Map),y},ot=()=>w()===0,st=t=>{let e=w();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return O?.get(t);default:v(e)}},at=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void O?.set(t,e);default:v(r)}},lt=t=>{let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return v(e),!1}},ut=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void O?.delete(t);default:v(e)}},ct=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:v(t)}};var Ee=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var V=(d=>(d.INVARIANT="Invariant quality",d.Q_144P="144p",d.Q_240P="240p",d.Q_360P="360p",d.Q_480P="480p",d.Q_720P="720p",d.Q_1080P="1080p",d.Q_1440P="1440p",d.Q_2160P="2160p",d.Q_4320P="4320p",d))(V||{});var m={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Se=(t,e)=>m[t].height>m[e].height,Re=(t,e)=>m[t].height>=m[e].height,M=(t,e)=>m[t].height<m[e].height,Ae=(t,e)=>m[t].height<=m[e].height,Ce=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:M(e,r)?1:-1)[0],Pe=Object.keys(m).sort((t,e)=>M(t,e)?-1:1),ke=(t,e=.02)=>[...Pe].find(n=>m[n].height*(1+e)>=t),Le=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return Pe.find(i=>{let s=m[i];return s.width>=n&&s.height>=r})},Ve=t=>m[t].height,N=t=>t==="Invariant quality",Me=t=>t.every(e=>!N(e));function Ne(t){if(N(t))throw new Error("Expected exact quality")}var _e=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=_e(s,i):r[n]=n in t?s:i}return r};var pt=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function _(t,e=0,r){let n,i,s,o,a,p,c=0,d=!1,b=!1,D=!0,ue=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(d=!!r.leading,b="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,D="trailing"in r?!!r.trailing:D);function U(u){let T=n,g=i;return n=i=void 0,c=u,o=t.apply(g,T),o}function A(u,T){return ue?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,T)}function Ke(u){if(ue){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Ye(u){return c=u,a=A(C,e),d?U(u):o}function $e(u){let T=u-p,g=u-c,be=e-T;return b?Math.min(be,s-g):be}function ce(u){let T=u-p,g=u-c;return p===void 0||T>=e||T<0||b&&g>=s}function C(){let u=Date.now();if(ce(u))return pe(u);a=A(C,$e(u))}function pe(u){return a=void 0,D&&n?U(u):(n=i=void 0,o)}function Xe(){a!==void 0&&Ke(a),c=0,n=p=i=a=void 0}function Je(){return a===void 0?o:pe(Date.now())}function Ze(){return a!==void 0}function P(...u){let T=Date.now(),g=ce(T);if(n=u,i=this,p=T,g){if(a===void 0)return Ye(p);if(b)return a=A(C,e),U(p)}return a===void 0&&(a=A(C,e)),o}return P.cancel=Xe,P.flush=Je,P.pending=Ze,P}var Q=(t,e=0,r)=>_(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var E=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=E(t[n],e):r[n]=t[n]}return r};var Qe=t=>E(t);var bt=300,De=(t,e=bt)=>new l(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(Q(o=>{let a=o[0];if(!a)return;let p,c;a.contentBoxSize&&a.contentBoxSize[0]?(c=a.contentBoxSize[0].blockSize,p=a.contentBoxSize[0].inlineSize):a.contentRect&&(p=a.contentRect.width,c=a.contentRect.height),x(p)&&x(c)&&r.next({width:p,height:c})},e));return s.observe(t),()=>s.disconnect()});var Ue=t=>{t.removeAttribute("src"),t.load()};var S=class extends h{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let r=super._subscribe(e);return e.next(this.value),r}};function W(t){return new l(e=>{let r={},n=Object.keys(t).length,i=s=>o=>{s in r||n--,r[s]=o,n===0&&e.next(r)};return Object.entries(t).reduce((s,[o,a])=>s.add(a.subscribe(i(o))),new f)})}function G(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new f))}var Be=t=>new l(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var Fe=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var ze=t=>new l(e=>{t.forEach(r=>e.next(r))});var je=(t,e)=>new l(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function q(t){return e=>new l(r=>e.subscribe(new H(r,t)))}var H=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}};var dt={leading:!1,trailing:!0};function Y(t,e=dt){return r=>new l(n=>r.subscribe(new K(n,t,e)))}var K=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,x(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var ft={leading:!0,trailing:!1};function X(t,e=ft){return r=>new l(n=>r.subscribe(new $(n,t,e)))}var $=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,L(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function Z(t){return e=>new l(r=>e.subscribe(new J(r,t)))}var J=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function te(t=(e,r)=>e===r){return e=>new l(r=>e.subscribe(new ee(r,t)))}var We={},ee=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=We}next(e){let r;try{r=this.lastValue===We||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function R(t){return e=>new l(r=>e.subscribe(new re(r,t)))}var re=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function ne(t){return R(()=>t)}function ie(){return t=>new l(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{r=!0,e.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function se(){return t=>new l(e=>t.subscribe(new oe(e)))}var oe=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function le(t){return e=>new l(r=>e.subscribe(new ae(r,t)))}var ae=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};var Ge=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(Ge||{});var He=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(He||{}),mt="vk.com",Tt=async(t,e,r)=>{let n=new URL(`https://${mt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return vt(s,r)},vt=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),ht(n)])),ht=t=>Array.isArray(t)?t[0]:t;var qe=(r=>(r.RU="ru",r.EN="en",r))(qe||{});
|
package/esnext.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.38-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.38-dev.876770ad.0
|
|
3
|
+
* Thu, 15 Aug 2024 18:48:59 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-38/doc/
|
|
5
5
|
*/
|
|
6
|
-
var ye=Object.defineProperty;var Oe=(t,e)=>{for(var r in e)ye(t,r,{get:e[r],enumerable:!0})};var we="1.0.38-dev.736aea74.0";var f=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var v=t=>{throw new Error(`${t} is value of unexpected type`)},Ee=t=>{};var h=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:h}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:h,error:h};let s=typeof e=="function"?{next:o=>{try{e(o)}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},i;try{i=this._subscribe(s)}catch(o){s.error?.(o)}return new f().add(()=>{switch(s.next=h,s.error=h,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return v(i)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var I=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new f().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new I;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function Se(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ae(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t<"u"&&t!==null}function Q(t){return t==null}function Re(t,e){if(!t?.length)throw new Error(e)}function Ce(t,e){if(t?.length)throw new Error(e)}var ke=(t,e,r)=>new Promise((n,s)=>{e.addEventListener("abort",()=>{a(),u.remove()});let i=()=>{a(),s()},o=()=>{a(),n()},a=()=>{c&&clearTimeout(c),u.removeEventListener("load",o),u.removeEventListener("error",i)},c;r&&(c=window.setTimeout(i,r));let u=document.createElement("script");u.addEventListener("load",o),u.addEventListener("error",i),u.src=t,document.head.appendChild(u)});var Le=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Pe=(t,e)=>async(...r)=>{let n=e(...r),s=t.aborted,i;for(;!s&&!t.aborted;)try{let o=await n.next(i);s=o.done??!1,i=o.value}catch(o){await n.throw(o)}return i};var ee=(u=>(u.Unknown="Unknown",u.Yandex="Yandex",u.Chrome="Chrome",u.Chromium="Chromium",u.Firefox="Firefox",u.Safari="Safari",u.Opera="Opera",u.Edge="Edge",u.Rest="Rest",u))(ee||{}),te=(c=>(c.Unknown="Unknown",c.Android="Android",c.iPhone="iPhone",c.iPad="iPad",c.iPod="iPod",c.RestMobile="RestMobile",c.Mac="Mac",c.Desktop="Desktop",c))(te||{}),k=()=>{let{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?"Yandex":void 0,r=/chrome|crios/i.test(t)?"Chrome":void 0,n=/chromium/i.test(t)?"Chromium":void 0,s=/firefox|fxios/i.test(t)?"Firefox":void 0,i=/webkit|safari|khtml/i.test(t)?"Safari":void 0,o=/opr\//i.test(t)?"Opera":void 0,a=/edg/i.test(t)?"Edge":void 0,c=/android/i.test(t)?"Android":void 0,u=/iphone/i.test(t)?"iPhone":void 0,d=/ipad/i.test(t)?"iPad":void 0,b=/ipod/i.test(t)?"iPod":void 0,E=/mac/i.test(t)?"Mac":void 0,S=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?"RestMobile":void 0;return{browser:e||s||o||a||r||n||i||"Rest",device:c||u||d||b||S||E||"Desktop"}},Me=(t=!1)=>{let r=["iPhone","iPad","iPod"].includes(k().device);if(!t)return r;let{userAgent:n,maxTouchPoints:s}=window.navigator;return!!(r||/macintosh/i.test(n)&&s>0)},Ne=()=>{let{userAgent:t}=window.navigator,e=t.match(/Version\/(\d+(\.\d+)?)/i);if(!e)return null;let r=e[1],n=parseFloat(r);return isNaN(n)?null:n},Ve=()=>k().device==="Android",Qe=()=>["Mac","iPhone","iPad","iPod"].includes(k().device),_e=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile;var De=(t,{start:e=0,factor:r=2,max:n=1/0,min:s=e,random:i=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*i*2-i),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,s),o};var re={};Oe(re,{clear:()=>We,get:()=>Fe,has:()=>je,isPersistent:()=>Ue,remove:()=>Be,set:()=>ze});var O,g,_=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(g!==void 0)return g;try{localStorage.setItem(_,"test"),localStorage.removeItem(_),g=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(_),g=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)g=2;else throw e}else throw t}return g===2&&(O=new Map),g},Ue=()=>w()===0,Fe=t=>{let e=w();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return O?.get(t);default:v(e)}},ze=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void O?.set(t,e);default:v(r)}},je=t=>{let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return v(e),!1}},Be=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void O?.delete(t);default:v(e)}},We=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:v(t)}};var Ge=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var D=(d=>(d.INVARIANT="Invariant quality",d.Q_144P="144p",d.Q_240P="240p",d.Q_360P="360p",d.Q_480P="480p",d.Q_720P="720p",d.Q_1080P="1080p",d.Q_1440P="1440p",d.Q_2160P="2160p",d.Q_4320P="4320p",d))(D||{});var m={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},qe=(t,e)=>m[t].height>m[e].height,He=(t,e)=>m[t].height>=m[e].height,U=(t,e)=>m[t].height<m[e].height,Ke=(t,e)=>m[t].height<=m[e].height,$e=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:U(e,r)?1:-1)[0],ne=Object.keys(m).sort((t,e)=>U(t,e)?-1:1),Ye=(t,e=.02)=>[...ne].find(n=>m[n].height*(1+e)>=t),Xe=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return ne.find(s=>{let i=m[s];return i.width>=n&&i.height>=r})},Je=t=>m[t].height,F=t=>t==="Invariant quality",Ze=t=>t.every(e=>!F(e));function et(t){if(F(t))throw new Error("Expected exact quality")}var tt=(t,e)=>{let r={};for(let n of Object.keys(e)){let s=e[n],i=t[n];Array.isArray(s)&&Array.isArray(i)?r[n]=i:typeof s=="object"&&typeof i=="object"?r[n]=tt(i,s):r[n]=n in t?i:s}return r};var qt=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function z(t,e=0,r){let n,s,i,o,a,c,u=0,d=!1,b=!1,E=!0,S=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(d=!!r.leading,b="maxWait"in r,i=r?.maxWait?Math.max(+r?.maxWait||0,e):i,E="trailing"in r?!!r.trailing:E);function N(p){let T=n,x=s;return n=s=void 0,u=p,o=t.apply(x,T),o}function A(p,T){return S?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(p)):setTimeout(p,T)}function Te(p){if(S){window.cancelAnimationFrame(p);return}clearTimeout(p)}function ve(p){return u=p,a=A(R,e),d?N(p):o}function Ie(p){let T=p-c,x=p-u,Z=e-T;return b?Math.min(Z,i-x):Z}function X(p){let T=p-c,x=p-u;return c===void 0||T>=e||T<0||b&&x>=i}function R(){let p=Date.now();if(X(p))return J(p);a=A(R,Ie(p))}function J(p){return a=void 0,E&&n?N(p):(n=s=void 0,o)}function xe(){a!==void 0&&Te(a),u=0,n=c=s=a=void 0}function he(){return a===void 0?o:J(Date.now())}function ge(){return a!==void 0}function C(...p){let T=Date.now(),x=X(T);if(n=p,s=this,c=T,x){if(a===void 0)return ve(c);if(b)return a=A(R,e),N(c)}return a===void 0&&(a=A(R,e)),o}return C.cancel=xe,C.flush=he,C.pending=ge,C}var j=(t,e=0,r)=>z(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var L=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let s=e(t[n],n,t,r);if(s!==void 0){r[n]=s;continue}}typeof t[n]=="object"?r[n]=L(t[n],e):r[n]=t[n]}return r};var rt=t=>L(t);var nt=300,ot=(t,e=nt)=>new l(r=>{let{width:n,height:s}=t.getBoundingClientRect();if(r.next({width:n,height:s}),!window.ResizeObserver)return;let i=new ResizeObserver(j(o=>{let a=o[0];if(!a)return;let c,u;a.contentBoxSize&&a.contentBoxSize[0]?(u=a.contentBoxSize[0].blockSize,c=a.contentBoxSize[0].inlineSize):a.contentRect&&(c=a.contentRect.width,u=a.contentRect.height),y(c)&&y(u)&&r.next({width:c,height:u})},e));return i.observe(t),()=>i.disconnect()});var P=class extends I{constructor(r){super();this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){let n=super._subscribe(r);return r.next(this.value),n}};function oe(t){return new l(e=>{let r={},n=Object.keys(t).length,s=i=>o=>{i in r||n--,r[i]=o,n===0&&e.next(r)};return Object.entries(t).reduce((i,[o,a])=>i.add(a.subscribe(s(o))),new f)})}function ie(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new f))}var it=t=>new l(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var st=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var at=t=>new l(e=>{t.forEach(r=>e.next(r))});var lt=(t,e)=>new l(r=>{let n=s=>r.next(s);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function se(t){return e=>new l(r=>e.subscribe(new B(r,t)))}var B=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}};var ut={leading:!1,trailing:!0};function ae(t,e=ut){return r=>new l(n=>r.subscribe(new W(n,t,e)))}var W=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var ct={leading:!0,trailing:!1};function le(t,e=ct){return r=>new l(n=>r.subscribe(new G(n,t,e)))}var G=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,Q(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function ue(t){return e=>new l(r=>e.subscribe(new q(r,t)))}var q=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function pe(t=(e,r)=>e===r){return e=>new l(r=>e.subscribe(new H(r,t)))}var ce={},H=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=ce}next(e){let r;try{r=this.lastValue===ce||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function M(t){return e=>new l(r=>e.subscribe(new K(r,t)))}var K=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function be(t){return M(()=>t)}function de(){return t=>new l(e=>{let r=!1,n=!1,s=t.subscribe(i=>{r||(r=!0,e.next(i)),n&&s.unsubscribe()},i=>{r=!0,e.error?.(i),n&&s.unsubscribe()});return n=!0,r&&s.unsubscribe(),s})}function fe(){return t=>new l(e=>t.subscribe(new $(e)))}var $=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function me(t){return e=>new l(r=>e.subscribe(new Y(r,t)))}var Y=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};var pt=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(pt||{});var bt=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(bt||{}),dt="vk.com",Vn=async(t,e,r)=>{let n=new URL(`https://${dt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let i=await(await fetch(n.toString())).json();return ft(i,r)},ft=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),mt(n)])),mt=t=>Array.isArray(t)?t[0]:t;var Tt=(r=>(r.RU="ru",r.EN="en",r))(Tt||{});export{ee as CurrentClientBrowser,te as CurrentClientDevice,pt as ErrorCategory,Tt as InterfaceLanguage,V as Logger,l as Observable,I as Subject,f as Subscription,we as VERSION,bt as VKNumericLanguage,P as ValueSubject,D as VideoQuality,Pe as abortable,ke as addScript,Ze as areQualitiesExact,Ce as assertEmptyArray,v as assertNever,Se as assertNonNullable,Re as assertNotEmptyArray,Ae as assertNullable,et as assertQualityIsExact,se as buffer,Ee as checkNever,rt as cloneDeep,L as cloneDeepWith,oe as combine,ae as debounce,z as debounceFn,Ge as detectEmbed,tt as fillWithDefault,ue as filter,pe as filterChanged,lt as fromEvent,k as getCurrentBrowser,De as getExponentialDelay,$e as getHighestQuality,Ne as getIOSVersion,st as interval,Ve as isAndroid,qe as isHigher,He as isHigherOrEqual,Me as isIOS,F as isInvariantQuality,U as isLower,Ke as isLowerOrEqual,Qe as isMacLike,_e as isMobile,y as isNonNullable,Q as isNullable,Vn as loadVKLangPack,M as map,be as mapTo,ie as merge,h as noop,Le as now,at as observableFrom,ot as observeElementSize,de as once,fe as pairwise,re as safeStorage,me as tap,le as throttle,j as throttleFn,qt as timeCodeToString,it as timeout,Ye as videoHeightToQuality,Je as videoQualityToHeight,Xe as videoSizeToQuality};
|
|
6
|
+
var ge=Object.defineProperty;var xe=(t,e)=>{for(var r in e)ge(t,r,{get:e[r],enumerable:!0})};var ye="1.0.38-dev.876770ad.0";var f=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var v=t=>{throw new Error(`${t} is value of unexpected type`)},Oe=t=>{};var g=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:g}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:g,error:g};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new f().add(()=>{switch(i.next=g,i.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return v(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var h=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new f().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new h;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function we(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ee(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t<"u"&&t!==null}function M(t){return t==null}function Se(t,e){if(!t?.length)throw new Error(e)}function Re(t,e){if(t?.length)throw new Error(e)}var Ae=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{a(),c.remove()});let s=()=>{a(),i()},o=()=>{a(),n()},a=()=>{p&&clearTimeout(p),c.removeEventListener("load",o),c.removeEventListener("error",s)},p;r&&(p=window.setTimeout(s,r));let c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",s),c.src=t,document.head.appendChild(c)});var Ce=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Pe=(t,e)=>async(...r)=>{let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=o.done??!1,s=o.value}catch(o){await n.throw(o)}return s};var N=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||window?.screen.width>700,r=this._iosVersion;return!e||e&&!!r&&r<16}get isAndroid(){return this.device==="Android"}get isMobile(){return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){let{userAgent:e,maxTouchPoints:r}=navigator;try{this._maxTouchPoints=r,this._isHdr=!!matchMedia("(dynamic-range: high)")?.matches}catch(n){console.error(n)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let r=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,o=/firefox|fxios/i.test(e)?"Firefox":void 0,a=/webkit|safari|khtml/i.test(e)?"Safari":void 0,p=/opr\//i.test(e)?"Opera":void 0,c=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=r||n||o||p||c||i||s||a||"Rest"}catch(r){console.error(r)}}detectDevice(e){try{let r=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,o=/mac/i.test(e)?"Mac":void 0,a=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=r||n||i||s||a||o||"Desktop"}catch(r){console.error(r)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+(\.\d+)?)/i);if(!r)return;let n=r[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+)/);if(!r)return;let n=r[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},ke=new N;var Le=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var ee={};xe(ee,{clear:()=>De,get:()=>Me,has:()=>_e,isPersistent:()=>Ve,remove:()=>Qe,set:()=>Ne});var O,x,_=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(x!==void 0)return x;try{localStorage.setItem(_,"test"),localStorage.removeItem(_),x=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(_),x=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)x=2;else throw e}else throw t}return x===2&&(O=new Map),x},Ve=()=>w()===0,Me=t=>{let e=w();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return O?.get(t);default:v(e)}},Ne=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void O?.set(t,e);default:v(r)}},_e=t=>{let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return v(e),!1}},Qe=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void O?.delete(t);default:v(e)}},De=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:v(t)}};var Ue=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var Q=(d=>(d.INVARIANT="Invariant quality",d.Q_144P="144p",d.Q_240P="240p",d.Q_360P="360p",d.Q_480P="480p",d.Q_720P="720p",d.Q_1080P="1080p",d.Q_1440P="1440p",d.Q_2160P="2160p",d.Q_4320P="4320p",d))(Q||{});var m={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Be=(t,e)=>m[t].height>m[e].height,Fe=(t,e)=>m[t].height>=m[e].height,D=(t,e)=>m[t].height<m[e].height,ze=(t,e)=>m[t].height<=m[e].height,je=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:D(e,r)?1:-1)[0],te=Object.keys(m).sort((t,e)=>D(t,e)?-1:1),We=(t,e=.02)=>[...te].find(n=>m[n].height*(1+e)>=t),Ge=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return te.find(i=>{let s=m[i];return s.width>=n&&s.height>=r})},He=t=>m[t].height,U=t=>t==="Invariant quality",qe=t=>t.every(e=>!U(e));function Ke(t){if(U(t))throw new Error("Expected exact quality")}var Ye=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=Ye(s,i):r[n]=n in t?s:i}return r};var Ft=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function B(t,e=0,r){let n,i,s,o,a,p,c=0,d=!1,b=!1,k=!0,$=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(d=!!r.leading,b="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,k="trailing"in r?!!r.trailing:k);function L(u){let T=n,I=i;return n=i=void 0,c=u,o=t.apply(I,T),o}function E(u,T){return $?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,T)}function fe(u){if($){window.cancelAnimationFrame(u);return}clearTimeout(u)}function me(u){return c=u,a=E(S,e),d?L(u):o}function Te(u){let T=u-p,I=u-c,Z=e-T;return b?Math.min(Z,s-I):Z}function X(u){let T=u-p,I=u-c;return p===void 0||T>=e||T<0||b&&I>=s}function S(){let u=Date.now();if(X(u))return J(u);a=E(S,Te(u))}function J(u){return a=void 0,k&&n?L(u):(n=i=void 0,o)}function ve(){a!==void 0&&fe(a),c=0,n=p=i=a=void 0}function he(){return a===void 0?o:J(Date.now())}function Ie(){return a!==void 0}function R(...u){let T=Date.now(),I=X(T);if(n=u,i=this,p=T,I){if(a===void 0)return me(p);if(b)return a=E(S,e),L(p)}return a===void 0&&(a=E(S,e)),o}return R.cancel=ve,R.flush=he,R.pending=Ie,R}var F=(t,e=0,r)=>B(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var A=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=A(t[n],e):r[n]=t[n]}return r};var $e=t=>A(t);var Xe=300,Je=(t,e=Xe)=>new l(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(F(o=>{let a=o[0];if(!a)return;let p,c;a.contentBoxSize&&a.contentBoxSize[0]?(c=a.contentBoxSize[0].blockSize,p=a.contentBoxSize[0].inlineSize):a.contentRect&&(p=a.contentRect.width,c=a.contentRect.height),y(p)&&y(c)&&r.next({width:p,height:c})},e));return s.observe(t),()=>s.disconnect()});var Ze=t=>{t.removeAttribute("src"),t.load()};var C=class extends h{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let r=super._subscribe(e);return e.next(this.value),r}};function re(t){return new l(e=>{let r={},n=Object.keys(t).length,i=s=>o=>{s in r||n--,r[s]=o,n===0&&e.next(r)};return Object.entries(t).reduce((s,[o,a])=>s.add(a.subscribe(i(o))),new f)})}function ne(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new f))}var et=t=>new l(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var tt=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var rt=t=>new l(e=>{t.forEach(r=>e.next(r))});var nt=(t,e)=>new l(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function ie(t){return e=>new l(r=>e.subscribe(new z(r,t)))}var z=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}};var it={leading:!1,trailing:!0};function oe(t,e=it){return r=>new l(n=>r.subscribe(new j(n,t,e)))}var j=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var ot={leading:!0,trailing:!1};function se(t,e=ot){return r=>new l(n=>r.subscribe(new W(n,t,e)))}var W=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,M(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function ae(t){return e=>new l(r=>e.subscribe(new G(r,t)))}var G=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function ue(t=(e,r)=>e===r){return e=>new l(r=>e.subscribe(new H(r,t)))}var le={},H=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=le}next(e){let r;try{r=this.lastValue===le||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function P(t){return e=>new l(r=>e.subscribe(new q(r,t)))}var q=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function ce(t){return P(()=>t)}function pe(){return t=>new l(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{r=!0,e.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function be(){return t=>new l(e=>t.subscribe(new K(e)))}var K=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function de(t){return e=>new l(r=>e.subscribe(new Y(r,t)))}var Y=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};var st=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(st||{});var at=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(at||{}),lt="vk.com",Ln=async(t,e,r)=>{let n=new URL(`https://${lt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return ut(s,r)},ut=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),ct(n)])),ct=t=>Array.isArray(t)?t[0]:t;var pt=(r=>(r.RU="ru",r.EN="en",r))(pt||{});export{ke as CC,st as ErrorCategory,pt as InterfaceLanguage,V as Logger,l as Observable,h as Subject,f as Subscription,ye as VERSION,at as VKNumericLanguage,C as ValueSubject,Q as VideoQuality,Pe as abortable,Ae as addScript,qe as areQualitiesExact,Re as assertEmptyArray,v as assertNever,we as assertNonNullable,Se as assertNotEmptyArray,Ee as assertNullable,Ke as assertQualityIsExact,ie as buffer,Oe as checkNever,Ze as clearVideoElement,$e as cloneDeep,A as cloneDeepWith,re as combine,oe as debounce,B as debounceFn,Ue as detectEmbed,Ye as fillWithDefault,ae as filter,ue as filterChanged,nt as fromEvent,Le as getExponentialDelay,je as getHighestQuality,tt as interval,Be as isHigher,Fe as isHigherOrEqual,U as isInvariantQuality,D as isLower,ze as isLowerOrEqual,y as isNonNullable,M as isNullable,Ln as loadVKLangPack,P as map,ce as mapTo,ne as merge,g as noop,Ce as now,rt as observableFrom,Je as observeElementSize,pe as once,be as pairwise,ee as safeStorage,de as tap,se as throttle,F as throttleFn,Ft as timeCodeToString,et as timeout,We as videoHeightToQuality,He as videoQualityToHeight,Ge as videoSizeToQuality};
|
package/evergreen.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.38-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.38-dev.876770ad.0
|
|
3
|
+
* Thu, 15 Aug 2024 18:48:59 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-38/doc/
|
|
5
5
|
*/
|
|
6
|
-
var ye=Object.defineProperty;var Oe=(t,e)=>{for(var r in e)ye(t,r,{get:e[r],enumerable:!0})};var we="1.0.38-dev.736aea74.0";var f=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var v=t=>{throw new Error(`${t} is value of unexpected type`)},Ee=t=>{};var h=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:h}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:h,error:h};let s=typeof e=="function"?{next:o=>{try{e(o)}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},i;try{i=this._subscribe(s)}catch(o){s.error?.(o)}return new f().add(()=>{switch(s.next=h,s.error=h,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return v(i)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var I=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new f().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new I;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function Se(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ae(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t<"u"&&t!==null}function Q(t){return t==null}function Re(t,e){if(!t?.length)throw new Error(e)}function Ce(t,e){if(t?.length)throw new Error(e)}var ke=(t,e,r)=>new Promise((n,s)=>{e.addEventListener("abort",()=>{a(),u.remove()});let i=()=>{a(),s()},o=()=>{a(),n()},a=()=>{c&&clearTimeout(c),u.removeEventListener("load",o),u.removeEventListener("error",i)},c;r&&(c=window.setTimeout(i,r));let u=document.createElement("script");u.addEventListener("load",o),u.addEventListener("error",i),u.src=t,document.head.appendChild(u)});var Le=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Pe=(t,e)=>async(...r)=>{let n=e(...r),s=t.aborted,i;for(;!s&&!t.aborted;)try{let o=await n.next(i);s=o.done??!1,i=o.value}catch(o){await n.throw(o)}return i};var ee=(u=>(u.Unknown="Unknown",u.Yandex="Yandex",u.Chrome="Chrome",u.Chromium="Chromium",u.Firefox="Firefox",u.Safari="Safari",u.Opera="Opera",u.Edge="Edge",u.Rest="Rest",u))(ee||{}),te=(c=>(c.Unknown="Unknown",c.Android="Android",c.iPhone="iPhone",c.iPad="iPad",c.iPod="iPod",c.RestMobile="RestMobile",c.Mac="Mac",c.Desktop="Desktop",c))(te||{}),k=()=>{let{userAgent:t}=window.navigator,e=/yabrowser/i.test(t)?"Yandex":void 0,r=/chrome|crios/i.test(t)?"Chrome":void 0,n=/chromium/i.test(t)?"Chromium":void 0,s=/firefox|fxios/i.test(t)?"Firefox":void 0,i=/webkit|safari|khtml/i.test(t)?"Safari":void 0,o=/opr\//i.test(t)?"Opera":void 0,a=/edg/i.test(t)?"Edge":void 0,c=/android/i.test(t)?"Android":void 0,u=/iphone/i.test(t)?"iPhone":void 0,d=/ipad/i.test(t)?"iPad":void 0,b=/ipod/i.test(t)?"iPod":void 0,E=/mac/i.test(t)?"Mac":void 0,S=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(t)?"RestMobile":void 0;return{browser:e||s||o||a||r||n||i||"Rest",device:c||u||d||b||S||E||"Desktop"}},Me=(t=!1)=>{let r=["iPhone","iPad","iPod"].includes(k().device);if(!t)return r;let{userAgent:n,maxTouchPoints:s}=window.navigator;return!!(r||/macintosh/i.test(n)&&s>0)},Ne=()=>{let{userAgent:t}=window.navigator,e=t.match(/Version\/(\d+(\.\d+)?)/i);if(!e)return null;let r=e[1],n=parseFloat(r);return isNaN(n)?null:n},Ve=()=>k().device==="Android",Qe=()=>["Mac","iPhone","iPad","iPod"].includes(k().device),_e=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile;var De=(t,{start:e=0,factor:r=2,max:n=1/0,min:s=e,random:i=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*i*2-i),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,s),o};var re={};Oe(re,{clear:()=>We,get:()=>Fe,has:()=>je,isPersistent:()=>Ue,remove:()=>Be,set:()=>ze});var O,g,_=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(g!==void 0)return g;try{localStorage.setItem(_,"test"),localStorage.removeItem(_),g=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(_),g=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)g=2;else throw e}else throw t}return g===2&&(O=new Map),g},Ue=()=>w()===0,Fe=t=>{let e=w();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return O?.get(t);default:v(e)}},ze=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void O?.set(t,e);default:v(r)}},je=t=>{let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return v(e),!1}},Be=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void O?.delete(t);default:v(e)}},We=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:v(t)}};var Ge=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var D=(d=>(d.INVARIANT="Invariant quality",d.Q_144P="144p",d.Q_240P="240p",d.Q_360P="360p",d.Q_480P="480p",d.Q_720P="720p",d.Q_1080P="1080p",d.Q_1440P="1440p",d.Q_2160P="2160p",d.Q_4320P="4320p",d))(D||{});var m={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},qe=(t,e)=>m[t].height>m[e].height,He=(t,e)=>m[t].height>=m[e].height,U=(t,e)=>m[t].height<m[e].height,Ke=(t,e)=>m[t].height<=m[e].height,$e=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:U(e,r)?1:-1)[0],ne=Object.keys(m).sort((t,e)=>U(t,e)?-1:1),Ye=(t,e=.02)=>[...ne].find(n=>m[n].height*(1+e)>=t),Xe=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return ne.find(s=>{let i=m[s];return i.width>=n&&i.height>=r})},Je=t=>m[t].height,F=t=>t==="Invariant quality",Ze=t=>t.every(e=>!F(e));function et(t){if(F(t))throw new Error("Expected exact quality")}var tt=(t,e)=>{let r={};for(let n of Object.keys(e)){let s=e[n],i=t[n];Array.isArray(s)&&Array.isArray(i)?r[n]=i:typeof s=="object"&&typeof i=="object"?r[n]=tt(i,s):r[n]=n in t?i:s}return r};var qt=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function z(t,e=0,r){let n,s,i,o,a,c,u=0,d=!1,b=!1,E=!0,S=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(d=!!r.leading,b="maxWait"in r,i=r?.maxWait?Math.max(+r?.maxWait||0,e):i,E="trailing"in r?!!r.trailing:E);function N(p){let T=n,x=s;return n=s=void 0,u=p,o=t.apply(x,T),o}function A(p,T){return S?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(p)):setTimeout(p,T)}function Te(p){if(S){window.cancelAnimationFrame(p);return}clearTimeout(p)}function ve(p){return u=p,a=A(R,e),d?N(p):o}function Ie(p){let T=p-c,x=p-u,Z=e-T;return b?Math.min(Z,i-x):Z}function X(p){let T=p-c,x=p-u;return c===void 0||T>=e||T<0||b&&x>=i}function R(){let p=Date.now();if(X(p))return J(p);a=A(R,Ie(p))}function J(p){return a=void 0,E&&n?N(p):(n=s=void 0,o)}function xe(){a!==void 0&&Te(a),u=0,n=c=s=a=void 0}function he(){return a===void 0?o:J(Date.now())}function ge(){return a!==void 0}function C(...p){let T=Date.now(),x=X(T);if(n=p,s=this,c=T,x){if(a===void 0)return ve(c);if(b)return a=A(R,e),N(c)}return a===void 0&&(a=A(R,e)),o}return C.cancel=xe,C.flush=he,C.pending=ge,C}var j=(t,e=0,r)=>z(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var L=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let s=e(t[n],n,t,r);if(s!==void 0){r[n]=s;continue}}typeof t[n]=="object"?r[n]=L(t[n],e):r[n]=t[n]}return r};var rt=t=>L(t);var nt=300,ot=(t,e=nt)=>new l(r=>{let{width:n,height:s}=t.getBoundingClientRect();if(r.next({width:n,height:s}),!window.ResizeObserver)return;let i=new ResizeObserver(j(o=>{let a=o[0];if(!a)return;let c,u;a.contentBoxSize&&a.contentBoxSize[0]?(u=a.contentBoxSize[0].blockSize,c=a.contentBoxSize[0].inlineSize):a.contentRect&&(c=a.contentRect.width,u=a.contentRect.height),y(c)&&y(u)&&r.next({width:c,height:u})},e));return i.observe(t),()=>i.disconnect()});var P=class extends I{constructor(r){super();this.value=r}next(r){super.next(this.value=r)}error(r){super.error(this.value=r)}getValue(){return this.value}_subscribe(r){let n=super._subscribe(r);return r.next(this.value),n}};function oe(t){return new l(e=>{let r={},n=Object.keys(t).length,s=i=>o=>{i in r||n--,r[i]=o,n===0&&e.next(r)};return Object.entries(t).reduce((i,[o,a])=>i.add(a.subscribe(s(o))),new f)})}function ie(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new f))}var it=t=>new l(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var st=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var at=t=>new l(e=>{t.forEach(r=>e.next(r))});var lt=(t,e)=>new l(r=>{let n=s=>r.next(s);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function se(t){return e=>new l(r=>e.subscribe(new B(r,t)))}var B=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}};var ut={leading:!1,trailing:!0};function ae(t,e=ut){return r=>new l(n=>r.subscribe(new W(n,t,e)))}var W=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var ct={leading:!0,trailing:!1};function le(t,e=ct){return r=>new l(n=>r.subscribe(new G(n,t,e)))}var G=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,Q(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function ue(t){return e=>new l(r=>e.subscribe(new q(r,t)))}var q=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function pe(t=(e,r)=>e===r){return e=>new l(r=>e.subscribe(new H(r,t)))}var ce={},H=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=ce}next(e){let r;try{r=this.lastValue===ce||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function M(t){return e=>new l(r=>e.subscribe(new K(r,t)))}var K=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function be(t){return M(()=>t)}function de(){return t=>new l(e=>{let r=!1,n=!1,s=t.subscribe(i=>{r||(r=!0,e.next(i)),n&&s.unsubscribe()},i=>{r=!0,e.error?.(i),n&&s.unsubscribe()});return n=!0,r&&s.unsubscribe(),s})}function fe(){return t=>new l(e=>t.subscribe(new $(e)))}var $=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function me(t){return e=>new l(r=>e.subscribe(new Y(r,t)))}var Y=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};var pt=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(pt||{});var bt=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(bt||{}),dt="vk.com",Vn=async(t,e,r)=>{let n=new URL(`https://${dt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let i=await(await fetch(n.toString())).json();return ft(i,r)},ft=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),mt(n)])),mt=t=>Array.isArray(t)?t[0]:t;var Tt=(r=>(r.RU="ru",r.EN="en",r))(Tt||{});export{ee as CurrentClientBrowser,te as CurrentClientDevice,pt as ErrorCategory,Tt as InterfaceLanguage,V as Logger,l as Observable,I as Subject,f as Subscription,we as VERSION,bt as VKNumericLanguage,P as ValueSubject,D as VideoQuality,Pe as abortable,ke as addScript,Ze as areQualitiesExact,Ce as assertEmptyArray,v as assertNever,Se as assertNonNullable,Re as assertNotEmptyArray,Ae as assertNullable,et as assertQualityIsExact,se as buffer,Ee as checkNever,rt as cloneDeep,L as cloneDeepWith,oe as combine,ae as debounce,z as debounceFn,Ge as detectEmbed,tt as fillWithDefault,ue as filter,pe as filterChanged,lt as fromEvent,k as getCurrentBrowser,De as getExponentialDelay,$e as getHighestQuality,Ne as getIOSVersion,st as interval,Ve as isAndroid,qe as isHigher,He as isHigherOrEqual,Me as isIOS,F as isInvariantQuality,U as isLower,Ke as isLowerOrEqual,Qe as isMacLike,_e as isMobile,y as isNonNullable,Q as isNullable,Vn as loadVKLangPack,M as map,be as mapTo,ie as merge,h as noop,Le as now,at as observableFrom,ot as observeElementSize,de as once,fe as pairwise,re as safeStorage,me as tap,le as throttle,j as throttleFn,qt as timeCodeToString,it as timeout,Ye as videoHeightToQuality,Je as videoQualityToHeight,Xe as videoSizeToQuality};
|
|
6
|
+
var ge=Object.defineProperty;var xe=(t,e)=>{for(var r in e)ge(t,r,{get:e[r],enumerable:!0})};var ye="1.0.38-dev.876770ad.0";var f=class{constructor(){this.subscriptions=[]}unsubscribe(){let e=this.subscriptions;this.subscriptions=[],e.forEach(r=>typeof r=="function"?r():r.unsubscribe())}add(e){return this.subscriptions.push(e),this}};var v=t=>{throw new Error(`${t} is value of unexpected type`)},Oe=t=>{};var g=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:g}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:g,error:g};let i=typeof e=="function"?{next:o=>{try{e(o)}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new f().add(()=>{switch(i.next=g,i.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return v(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var h=class extends l{constructor(){super();this.keyCounter=0;this.subscribers=new Map}next(r){this.subscribers.forEach(n=>n.next(r))}error(r){this.subscribers.forEach(n=>n.error?.(r))}_subscribe(r){let n=this.keyCounter++;return this.subscribers.set(n,r),new f().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new h;this.logs=[];this.log=e=>{let r={...e,timestamp:Date.now()};this.logs.push(r),this.log$.next(r)};this.getAllLogs=()=>this.logs}createCustomLog(e){return(...r)=>{let n;try{n=e(...r)}catch{n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(e){return this.createCustomLog(r=>({component:e,...r}))}};function we(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ee(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function y(t){return typeof t<"u"&&t!==null}function M(t){return t==null}function Se(t,e){if(!t?.length)throw new Error(e)}function Re(t,e){if(t?.length)throw new Error(e)}var Ae=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{a(),c.remove()});let s=()=>{a(),i()},o=()=>{a(),n()},a=()=>{p&&clearTimeout(p),c.removeEventListener("load",o),c.removeEventListener("error",s)},p;r&&(p=window.setTimeout(s,r));let c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",s),c.src=t,document.head.appendChild(c)});var Ce=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Pe=(t,e)=>async(...r)=>{let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=o.done??!1,s=o.value}catch(o){await n.throw(o)}return s};var N=class{constructor(){this.detect()}get browser(){return this._currentBrowser}get device(){return this._currentDevice}get isTouch(){return this._maxTouchPoints>0}get isIOS(){return["iPhone","iPad","iPod"].includes(this.device)}get isMac(){return this.device==="Mac"}get isApple(){return this.isIOS||this.isMac}get isIphoneOrOldIpad(){if(!this.isApple||!this.isTouch)return!1;let e=this.device==="iPad"||window?.screen.width>700,r=this._iosVersion;return!e||e&&!!r&&r<16}get isAndroid(){return this.device==="Android"}get isMobile(){return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile}get iOSVersion(){return this._iosVersion}get macVersion(){return this._macVersion}get isYandex(){return this.browser==="Yandex"}get isSafari(){return this.browser==="Safari"}get isSamsungBrowser(){return this.browser==="SamsungBrowser"}get isHDR(){return this._isHdr}detect(){let{userAgent:e,maxTouchPoints:r}=navigator;try{this._maxTouchPoints=r,this._isHdr=!!matchMedia("(dynamic-range: high)")?.matches}catch(n){console.error(n)}this.detectBrowser(e),this.detectDevice(e),this.isIOS&&this.detectIOSVersion(),this.isMac&&this.detectMacVersion()}detectBrowser(e){try{let r=/yabrowser/i.test(e)?"Yandex":void 0,n=/samsungbrowser/i.test(e)?"SamsungBrowser":void 0,i=/chrome|crios/i.test(e)?"Chrome":void 0,s=/chromium/i.test(e)?"Chromium":void 0,o=/firefox|fxios/i.test(e)?"Firefox":void 0,a=/webkit|safari|khtml/i.test(e)?"Safari":void 0,p=/opr\//i.test(e)?"Opera":void 0,c=/edg/i.test(e)?"Edge":void 0;this._currentBrowser=r||n||o||p||c||i||s||a||"Rest"}catch(r){console.error(r)}}detectDevice(e){try{let r=/android/i.test(e)?"Android":void 0,n=/iphone/i.test(e)?"iPhone":void 0,i=/ipad/i.test(e)?"iPad":void 0,s=/ipod/i.test(e)?"iPod":void 0,o=/mac/i.test(e)?"Mac":void 0,a=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?"RestMobile":void 0;this._currentDevice=r||n||i||s||a||o||"Desktop"}catch(r){console.error(r)}}detectIOSVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+(\.\d+)?)/i);if(!r)return;let n=r[1],i=parseFloat(n);if(isNaN(i))return;this._iosVersion=i}catch(e){console.error(e)}}detectMacVersion(){try{let{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+)/);if(!r)return;let n=r[1],i=parseInt(n,10);if(isNaN(i))return;this._macVersion=i}catch(e){console.error(e)}}},ke=new N;var Le=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var ee={};xe(ee,{clear:()=>De,get:()=>Me,has:()=>_e,isPersistent:()=>Ve,remove:()=>Qe,set:()=>Ne});var O,x,_=`vk-videoplayer-dummy-key-${Math.random()}`,w=()=>{if(x!==void 0)return x;try{localStorage.setItem(_,"test"),localStorage.removeItem(_),x=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(_),x=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)x=2;else throw e}else throw t}return x===2&&(O=new Map),x},Ve=()=>w()===0,Me=t=>{let e=w();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return O?.get(t);default:v(e)}},Ne=(t,e)=>{let r=w();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:return void O?.set(t,e);default:v(r)}},_e=t=>{let e=w();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return v(e),!1}},Qe=t=>{let e=w();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:return void O?.delete(t);default:v(e)}},De=()=>{let t=w();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:v(t)}};var Ue=()=>{let t,e;try{t=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?t=!0:(t=!1,console.error(n))}try{window.location.ancestorOrigins&&(e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!e&&document.referrer&&(e=document.referrer)}catch(n){console.error(n)}let r=e?new URL(e).hostname:void 0;return{isEmbed:t,host:r}};var Q=(d=>(d.INVARIANT="Invariant quality",d.Q_144P="144p",d.Q_240P="240p",d.Q_360P="360p",d.Q_480P="480p",d.Q_720P="720p",d.Q_1080P="1080p",d.Q_1440P="1440p",d.Q_2160P="2160p",d.Q_4320P="4320p",d))(Q||{});var m={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"720p":{width:1280,height:720},"1080p":{width:1920,height:1080},"1440p":{width:2560,height:1440},"2160p":{width:3840,height:2160},"4320p":{width:7680,height:4320}},Be=(t,e)=>m[t].height>m[e].height,Fe=(t,e)=>m[t].height>=m[e].height,D=(t,e)=>m[t].height<m[e].height,ze=(t,e)=>m[t].height<=m[e].height,je=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:D(e,r)?1:-1)[0],te=Object.keys(m).sort((t,e)=>D(t,e)?-1:1),We=(t,e=.02)=>[...te].find(n=>m[n].height*(1+e)>=t),Ge=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return te.find(i=>{let s=m[i];return s.width>=n&&s.height>=r})},He=t=>m[t].height,U=t=>t==="Invariant quality",qe=t=>t.every(e=>!U(e));function Ke(t){if(U(t))throw new Error("Expected exact quality")}var Ye=(t,e)=>{let r={};for(let n of Object.keys(e)){let i=e[n],s=t[n];Array.isArray(i)&&Array.isArray(s)?r[n]=s:typeof i=="object"&&typeof s=="object"?r[n]=Ye(s,i):r[n]=n in t?s:i}return r};var Ft=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function B(t,e=0,r){let n,i,s,o,a,p,c=0,d=!1,b=!1,k=!0,$=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(d=!!r.leading,b="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,k="trailing"in r?!!r.trailing:k);function L(u){let T=n,I=i;return n=i=void 0,c=u,o=t.apply(I,T),o}function E(u,T){return $?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,T)}function fe(u){if($){window.cancelAnimationFrame(u);return}clearTimeout(u)}function me(u){return c=u,a=E(S,e),d?L(u):o}function Te(u){let T=u-p,I=u-c,Z=e-T;return b?Math.min(Z,s-I):Z}function X(u){let T=u-p,I=u-c;return p===void 0||T>=e||T<0||b&&I>=s}function S(){let u=Date.now();if(X(u))return J(u);a=E(S,Te(u))}function J(u){return a=void 0,k&&n?L(u):(n=i=void 0,o)}function ve(){a!==void 0&&fe(a),c=0,n=p=i=a=void 0}function he(){return a===void 0?o:J(Date.now())}function Ie(){return a!==void 0}function R(...u){let T=Date.now(),I=X(T);if(n=u,i=this,p=T,I){if(a===void 0)return me(p);if(b)return a=E(S,e),L(p)}return a===void 0&&(a=E(S,e)),o}return R.cancel=ve,R.flush=he,R.pending=Ie,R}var F=(t,e=0,r)=>B(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var A=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let i=e(t[n],n,t,r);if(i!==void 0){r[n]=i;continue}}typeof t[n]=="object"?r[n]=A(t[n],e):r[n]=t[n]}return r};var $e=t=>A(t);var Xe=300,Je=(t,e=Xe)=>new l(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(F(o=>{let a=o[0];if(!a)return;let p,c;a.contentBoxSize&&a.contentBoxSize[0]?(c=a.contentBoxSize[0].blockSize,p=a.contentBoxSize[0].inlineSize):a.contentRect&&(p=a.contentRect.width,c=a.contentRect.height),y(p)&&y(c)&&r.next({width:p,height:c})},e));return s.observe(t),()=>s.disconnect()});var Ze=t=>{t.removeAttribute("src"),t.load()};var C=class extends h{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let r=super._subscribe(e);return e.next(this.value),r}};function re(t){return new l(e=>{let r={},n=Object.keys(t).length,i=s=>o=>{s in r||n--,r[s]=o,n===0&&e.next(r)};return Object.entries(t).reduce((s,[o,a])=>s.add(a.subscribe(i(o))),new f)})}function ne(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new f))}var et=t=>new l(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var tt=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var rt=t=>new l(e=>{t.forEach(r=>e.next(r))});var nt=(t,e)=>new l(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function ie(t){return e=>new l(r=>e.subscribe(new z(r,t)))}var z=class{constructor(e,r){this.destination=e;this.size=r;this.lastValues=[]}next(e){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(e),this.destination.next(this.lastValues)}error(e){this.destination.error?.(e)}};var it={leading:!1,trailing:!0};function oe(t,e=it){return r=>new l(n=>r.subscribe(new j(n,t,e)))}var j=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,y(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var ot={leading:!0,trailing:!1};function se(t,e=ot){return r=>new l(n=>r.subscribe(new W(n,t,e)))}var W=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,M(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function ae(t){return e=>new l(r=>e.subscribe(new G(r,t)))}var G=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function ue(t=(e,r)=>e===r){return e=>new l(r=>e.subscribe(new H(r,t)))}var le={},H=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=le}next(e){let r;try{r=this.lastValue===le||!this.predicate(this.lastValue,e),this.lastValue=e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function P(t){return e=>new l(r=>e.subscribe(new q(r,t)))}var q=class{constructor(e,r){this.destination=e;this.mapper=r}next(e){let r;try{r=this.mapper(e)}catch(n){throw this.error(n),n}this.destination.next(r)}error(e){this.destination.error?.(e)}};function ce(t){return P(()=>t)}function pe(){return t=>new l(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{r=!0,e.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function be(){return t=>new l(e=>t.subscribe(new K(e)))}var K=class{constructor(e){this.destination=e;this.hasLast=!1}next(e){let r=this.last;if(this.last=e,!this.hasLast){this.hasLast=!0;return}this.destination.next([r,e])}error(e){this.destination.error?.(e)}};function de(t){return e=>new l(r=>e.subscribe(new Y(r,t)))}var Y=class{constructor(e,r){this.destination=e;this.effect=r}next(e){try{this.effect(e)}catch(r){throw this.error(r),r}this.destination.next(e)}error(e){this.destination.error?.(e)}};var st=(a=>(a.NETWORK="network",a.VIDEO_PIPELINE="video_pipeline",a.EXTERNAL_API="external_api",a.PARSER="parser",a.DOM="dom",a.WTF="wtf",a.FATAL="fatal",a))(st||{});var at=(b=>(b.Armenian="58",b.Azerbaijani="57",b.Belarusian="114",b.English="3",b.Kazakh="97",b.Portuguese="73",b.Russian="0",b.Spanish="4",b.Ukrainian="1",b.Uzbek="65",b.Vietnamese="75",b))(at||{}),lt="vk.com",Ln=async(t,e,r)=>{let n=new URL(`https://${lt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return ut(s,r)},ut=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),ct(n)])),ct=t=>Array.isArray(t)?t[0]:t;var pt=(r=>(r.RU="ru",r.EN="en",r))(pt||{});export{ke as CC,st as ErrorCategory,pt as InterfaceLanguage,V as Logger,l as Observable,h as Subject,f as Subscription,ye as VERSION,at as VKNumericLanguage,C as ValueSubject,Q as VideoQuality,Pe as abortable,Ae as addScript,qe as areQualitiesExact,Re as assertEmptyArray,v as assertNever,we as assertNonNullable,Se as assertNotEmptyArray,Ee as assertNullable,Ke as assertQualityIsExact,ie as buffer,Oe as checkNever,Ze as clearVideoElement,$e as cloneDeep,A as cloneDeepWith,re as combine,oe as debounce,B as debounceFn,Ue as detectEmbed,Ye as fillWithDefault,ae as filter,ue as filterChanged,nt as fromEvent,Le as getExponentialDelay,je as getHighestQuality,tt as interval,Be as isHigher,Fe as isHigherOrEqual,U as isInvariantQuality,D as isLower,ze as isLowerOrEqual,y as isNonNullable,M as isNullable,Ln as loadVKLangPack,P as map,ce as mapTo,ne as merge,g as noop,Ce as now,rt as observableFrom,Je as observeElementSize,pe as once,be as pairwise,ee as safeStorage,de as tap,se as throttle,F as throttleFn,Ft as timeCodeToString,et as timeout,We as videoHeightToQuality,He as videoQualityToHeight,Ge as videoSizeToQuality};
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const clearVideoElement: (video: HTMLVideoElement) => void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare enum CurrentClientBrowser {
|
|
2
|
+
Unknown = "Unknown",
|
|
3
|
+
Yandex = "Yandex",
|
|
4
|
+
Chrome = "Chrome",
|
|
5
|
+
Chromium = "Chromium",//Хром и хромиум разделяем специально. Почти единственное отличие, поддержка H.264 как раз важна для нас
|
|
6
|
+
Firefox = "Firefox",
|
|
7
|
+
Safari = "Safari",
|
|
8
|
+
Opera = "Opera",
|
|
9
|
+
Edge = "Edge",
|
|
10
|
+
SamsungBrowser = "SamsungBrowser",
|
|
11
|
+
Rest = "Rest"
|
|
12
|
+
}
|
|
13
|
+
export declare enum CurrentClientDevice {
|
|
14
|
+
Unknown = "Unknown",
|
|
15
|
+
Android = "Android",
|
|
16
|
+
iPhone = "iPhone",
|
|
17
|
+
iPad = "iPad",
|
|
18
|
+
iPod = "iPod",
|
|
19
|
+
RestMobile = "RestMobile",
|
|
20
|
+
Mac = "Mac",
|
|
21
|
+
Desktop = "Desktop"
|
|
22
|
+
}
|
|
23
|
+
export declare class ClientChecker {
|
|
24
|
+
private _currentBrowser;
|
|
25
|
+
private _currentDevice;
|
|
26
|
+
private _iosVersion;
|
|
27
|
+
private _macVersion;
|
|
28
|
+
private _maxTouchPoints;
|
|
29
|
+
private _isHdr;
|
|
30
|
+
constructor();
|
|
31
|
+
get browser(): CurrentClientBrowser;
|
|
32
|
+
get device(): CurrentClientDevice;
|
|
33
|
+
get isTouch(): boolean;
|
|
34
|
+
get isIOS(): boolean;
|
|
35
|
+
get isMac(): boolean;
|
|
36
|
+
get isApple(): boolean;
|
|
37
|
+
get isIphoneOrOldIpad(): boolean;
|
|
38
|
+
get isAndroid(): boolean;
|
|
39
|
+
get isMobile(): boolean;
|
|
40
|
+
get iOSVersion(): number | undefined;
|
|
41
|
+
get macVersion(): number | undefined;
|
|
42
|
+
get isYandex(): boolean;
|
|
43
|
+
get isSafari(): boolean;
|
|
44
|
+
get isSamsungBrowser(): boolean;
|
|
45
|
+
get isHDR(): boolean;
|
|
46
|
+
detect(): void;
|
|
47
|
+
private detectBrowser;
|
|
48
|
+
private detectDevice;
|
|
49
|
+
private detectIOSVersion;
|
|
50
|
+
private detectMacVersion;
|
|
51
|
+
}
|
|
52
|
+
export declare const CC: ClientChecker;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
type CloneDeepWithCustomizer<TObject> = (value: unknown, key: number | string | undefined, object: TObject | undefined, stack: any) => any;
|
|
2
|
-
export declare const cloneDeepWith: <T>(obj: T, customizer?: CloneDeepWithCustomizer<T>
|
|
2
|
+
export declare const cloneDeepWith: <T>(obj: T, customizer?: CloneDeepWithCustomizer<T>) => T;
|
|
3
3
|
export {};
|
package/types/utils/index.d.ts
CHANGED
|
@@ -6,8 +6,7 @@ export { addScript } from './addScript';
|
|
|
6
6
|
export type { Milliseconds, bps, Byte, Seconds, Kbps, Mbps, Percentage } from './semanticTypes';
|
|
7
7
|
export { now } from './now';
|
|
8
8
|
export { abortable } from './abortable';
|
|
9
|
-
export {
|
|
10
|
-
export type { ICurrentBrowserInfo } from './detectBrowser';
|
|
9
|
+
export { CC } from './clientChecker';
|
|
11
10
|
export { getExponentialDelay, ExponentialBackoffConfig } from './exponentialBackoff';
|
|
12
11
|
export * as safeStorage from './iframeSafeStorage';
|
|
13
12
|
export { detectEmbed } from './detectEmbed';
|
|
@@ -20,3 +19,4 @@ export { throttleFn, ThrottleOptions } from './throttleFn';
|
|
|
20
19
|
export { cloneDeep } from './cloneDeep';
|
|
21
20
|
export { observeElementSize } from './observeElementSize';
|
|
22
21
|
export { cloneDeepWith } from './cloneDeepWith';
|
|
22
|
+
export { clearVideoElement } from './clearVideoElement';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare enum CurrentClientBrowser {
|
|
2
|
-
Unknown = "Unknown",
|
|
3
|
-
Yandex = "Yandex",
|
|
4
|
-
Chrome = "Chrome",
|
|
5
|
-
Chromium = "Chromium",
|
|
6
|
-
Firefox = "Firefox",
|
|
7
|
-
Safari = "Safari",
|
|
8
|
-
Opera = "Opera",
|
|
9
|
-
Edge = "Edge",
|
|
10
|
-
Rest = "Rest"
|
|
11
|
-
}
|
|
12
|
-
export declare enum CurrentClientDevice {
|
|
13
|
-
Unknown = "Unknown",
|
|
14
|
-
Android = "Android",
|
|
15
|
-
iPhone = "iPhone",
|
|
16
|
-
iPad = "iPad",
|
|
17
|
-
iPod = "iPod",
|
|
18
|
-
RestMobile = "RestMobile",
|
|
19
|
-
Mac = "Mac",
|
|
20
|
-
Desktop = "Desktop"
|
|
21
|
-
}
|
|
22
|
-
export type ICurrentBrowserInfo = {
|
|
23
|
-
browser: CurrentClientBrowser;
|
|
24
|
-
device: CurrentClientDevice;
|
|
25
|
-
};
|
|
26
|
-
export declare const getCurrentBrowser: () => ICurrentBrowserInfo;
|
|
27
|
-
export declare const isIOS: (checkForceDesktop?: boolean) => boolean;
|
|
28
|
-
export declare const getIOSVersion: () => number | null;
|
|
29
|
-
export declare const isAndroid: () => boolean;
|
|
30
|
-
export declare const isMacLike: () => boolean;
|
|
31
|
-
export declare const isMobile: () => any;
|