@vkontakte/videoplayer-shared 1.0.36 → 1.0.37-dev.7467b46e.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.
Files changed (62) hide show
  1. package/es2015.cjs.js +4 -4
  2. package/es2015.esm.js +4 -4
  3. package/es2018.cjs.js +4 -4
  4. package/es2018.esm.js +4 -4
  5. package/esnext.cjs.js +4 -4
  6. package/esnext.esm.js +4 -4
  7. package/evergreen.esm.js +4 -4
  8. package/package.json +7 -7
  9. package/types/Logger/Logger.d.ts +10 -0
  10. package/types/Logger/index.d.ts +2 -0
  11. package/types/Logger/types.d.ts +30 -0
  12. package/types/env.d.ts +1 -0
  13. package/types/index.d.ts +6 -0
  14. package/types/reactive/Observable.d.ts +7 -0
  15. package/types/reactive/Subject.d.ts +10 -0
  16. package/types/reactive/Subscription.d.ts +6 -0
  17. package/types/reactive/ValueSubject.d.ts +10 -0
  18. package/types/reactive/combine.d.ts +10 -0
  19. package/types/reactive/fromEvent.d.ts +7 -0
  20. package/types/reactive/index.d.ts +21 -0
  21. package/types/reactive/interval.d.ts +4 -0
  22. package/types/reactive/merge.d.ts +12 -0
  23. package/types/reactive/observableFrom.d.ts +3 -0
  24. package/types/reactive/operators/buffer.d.ts +2 -0
  25. package/types/reactive/operators/debounce.d.ts +6 -0
  26. package/types/reactive/operators/filter.d.ts +3 -0
  27. package/types/reactive/operators/filterChanged.d.ts +5 -0
  28. package/types/reactive/operators/map.d.ts +2 -0
  29. package/types/reactive/operators/mapTo.d.ts +2 -0
  30. package/types/reactive/operators/once.d.ts +5 -0
  31. package/types/reactive/operators/pairwise.d.ts +4 -0
  32. package/types/reactive/operators/tap.d.ts +2 -0
  33. package/types/reactive/operators/throttle.d.ts +5 -0
  34. package/types/reactive/timeout.d.ts +4 -0
  35. package/types/reactive/types.d.ts +29 -0
  36. package/types/translation/index.d.ts +2 -0
  37. package/types/translation/loadVKLangPack.d.ts +16 -0
  38. package/types/translation/types.d.ts +5 -0
  39. package/types/types/index.d.ts +53 -0
  40. package/types/utils/abortable.d.ts +3 -0
  41. package/types/utils/addScript.d.ts +1 -0
  42. package/types/utils/cloneDeep.d.ts +1 -0
  43. package/types/utils/cloneDeepWith.d.ts +3 -0
  44. package/types/utils/config.d.ts +2 -0
  45. package/types/utils/debounceFn.d.ts +13 -0
  46. package/types/utils/detectBrowser.d.ts +31 -0
  47. package/types/utils/detectEmbed.d.ts +4 -0
  48. package/types/utils/empty.d.ts +2 -0
  49. package/types/utils/exponentialBackoff.d.ts +9 -0
  50. package/types/utils/iframeSafeStorage.d.ts +6 -0
  51. package/types/utils/index.d.ts +22 -0
  52. package/types/utils/never.d.ts +2 -0
  53. package/types/utils/noop.d.ts +1 -0
  54. package/types/utils/now.d.ts +2 -0
  55. package/types/utils/nullable.d.ts +7 -0
  56. package/types/utils/observeElementSize.d.ts +3 -0
  57. package/types/utils/quality/index.d.ts +20 -0
  58. package/types/utils/quality/types.d.ts +21 -0
  59. package/types/utils/semanticTypes.d.ts +7 -0
  60. package/types/utils/throttleFn.d.ts +5 -0
  61. package/types/utils/timecode.d.ts +1 -0
  62. package/index.d.ts +0 -415
package/es2018.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.36
3
- * Tue, 18 Jun 2024 13:17:03 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-36/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.37-dev.7467b46e.0
3
+ * Fri, 05 Jul 2024 10:31:04 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-37/doc/
5
5
  */
6
- const sl="1.0.36";class ge{constructor(){this.subscriptions=[]}unsubscribe(){const r=this.subscriptions;this.subscriptions=[],r.forEach(t=>typeof t=="function"?t():t.unsubscribe())}add(r){return this.subscriptions.push(r),this}}const K=e=>{throw new Error(`${e} is value of unexpected type`)},cl=e=>{},X=()=>{};class O{constructor(r){r&&(this._subscribe=r)}subscribe(r,t){var n;let o;t?typeof t=="function"?o={next:t,error:X}:o={next:i=>t.next(i),error:i=>{var l;return(l=t.error)===null||l===void 0?void 0:l.call(t,i)}}:o={next:X,error:X};const a=typeof r=="function"?{next:i=>{try{r(i)}catch(l){o.next(l)}},error:i=>o.next(i)}:{next:i=>r.next(i),error:i=>r.error?r.error(i):o.next(i)};let s;try{s=this._subscribe(a)}catch(i){(n=a.error)===null||n===void 0||n.call(a,i)}return new ge().add(()=>{switch(a.next=X,a.error=X,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return K(s)}})}pipe(...r){return r.reduce((t,n)=>n(t),this)}_subscribe(r){}}class dt extends O{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(r){this.subscribers.forEach(t=>t.next(r))}error(r){this.subscribers.forEach(t=>{var n;return(n=t.error)===null||n===void 0?void 0:n.call(t,r)})}_subscribe(r){const t=this.keyCounter++;return this.subscribers.set(t,r),new ge().add(()=>this.subscribers.delete(t))}}class ll{constructor(){this.log$=new dt,this.logs=[],this.log=r=>{const t={...r,timestamp:Date.now()};this.logs.push(t),this.log$.next(t)},this.getAllLogs=()=>this.logs}createCustomLog(r){return(...t)=>{let n;try{n=r(...t)}catch(o){n={message:"error in `createCustomLog`",component:"Logger"}}this.log(n)}}createComponentLog(r){return this.createCustomLog(t=>({component:r,...t}))}}function ul(e,r='Assertion "value is not nullable" failed'){if(e==null)throw new Error(r)}function fl(e,r='Assertion "value is nullable" failed'){if(e!=null)throw new Error(r)}function Ke(e){return typeof e!="undefined"&&e!==null}function wn(e){return e==null}function vl(e,r){if(!(e!=null&&e.length))throw new Error(r)}function dl(e,r){if(e!=null&&e.length)throw new Error(r)}const hl=(e,r,t)=>new Promise((n,o)=>{r.addEventListener("abort",()=>{i(),c.remove()});const a=()=>{i(),o()},s=()=>{i(),n()},i=()=>{l&&clearTimeout(l),c.removeEventListener("load",s),c.removeEventListener("error",a)};let l;t&&(l=window.setTimeout(a,t));const c=document.createElement("script");c.addEventListener("load",s),c.addEventListener("error",a),c.src=e,document.head.appendChild(c)});var we;const pl=typeof((we=window.performance)===null||we===void 0?void 0:we.now)=="function"?()=>window.performance.now():()=>Date.now(),bl=(e,r)=>async(...t)=>{var n;const o=r(...t);let a=e.aborted,s;for(;!a&&!e.aborted;)try{const i=await o.next(s);a=(n=i.done)!==null&&n!==void 0?n:!1,s=i.value}catch(i){await o.throw(i)}return s};var x;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(x||(x={}));var $;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})($||($={}));const ht=()=>{const{userAgent:e}=window.navigator,r=/yabrowser/i.test(e)?x.Yandex:void 0,t=/chrome|crios/i.test(e)?x.Chrome:void 0,n=/chromium/i.test(e)?x.Chromium:void 0,o=/firefox|fxios/i.test(e)?x.Firefox:void 0,a=/webkit|safari|khtml/i.test(e)?x.Safari:void 0,s=/opr\//i.test(e)?x.Opera:void 0,i=/edg/i.test(e)?x.Edge:void 0,l=/android/i.test(e)?$.Android:void 0,c=/iphone/i.test(e)?$.iPhone:void 0,u=/ipad/i.test(e)?$.iPad:void 0,v=/ipod/i.test(e)?$.iPod:void 0,f=/mac/i.test(e)?$.Mac:void 0,d=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?$.RestMobile:void 0;return{browser:r||o||s||i||t||n||a||x.Rest,device:l||c||u||v||d||f||$.Desktop}},yl=(e=!1)=>{const t=[$.iPhone,$.iPad,$.iPod].includes(ht().device);if(!e)return t;const{userAgent:n,maxTouchPoints:o}=window.navigator;return!!(t||/macintosh/i.test(n)&&o>0)},gl=()=>{const{userAgent:e}=window.navigator,r=e.match(/Version\/(\d+(\.\d+)?)/i);if(!r)return null;const t=r[1],n=parseFloat(t);return isNaN(n)?null:n},ml=()=>[$.Mac,$.iPhone,$.iPad,$.iPod].includes(ht().device),Ol=()=>{var e,r;return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test((e=navigator.appVersion)!==null&&e!==void 0?e:navigator.userAgent)||((r=navigator==null?void 0:navigator.userAgentData)===null||r===void 0?void 0:r.mobile)},wl=(e,{start:r=0,factor:t=2,max:n=1/0,min:o=r,random:a=0}={})=>{let s=r;return s*=t**e,s*=1+(Math.random()*a*2-a),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var p;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(p||(p={}));let S,C;const $e=`vk-videoplayer-dummy-key-${Math.random()}`,Y=()=>{if(C!==void 0)return C;try{localStorage.setItem($e,"test"),localStorage.removeItem($e),C=p.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem($e),C=p.SESSION_STORAGE}catch(r){if(r instanceof DOMException||r instanceof TypeError)C=p.RUNTIME;else throw r}else throw e}return C===p.RUNTIME&&(S=new Map),C},$n=()=>Y()===p.LOCAL_STORAGE,Sn=e=>{var r,t;const n=Y();switch(n){case p.LOCAL_STORAGE:return(r=localStorage.getItem(e))!==null&&r!==void 0?r:void 0;case p.SESSION_STORAGE:return(t=sessionStorage.getItem(e))!==null&&t!==void 0?t:void 0;case p.RUNTIME:return S==null?void 0:S.get(e);default:K(n)}},En=(e,r)=>{const t=Y();switch(t){case p.LOCAL_STORAGE:try{localStorage.setItem(e,r)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case p.SESSION_STORAGE:try{sessionStorage.setItem(e,r)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case p.RUNTIME:return void(S==null?void 0:S.set(e,r));default:K(t)}},Tn=e=>{var r;const t=Y();switch(t){case p.LOCAL_STORAGE:return e in localStorage;case p.SESSION_STORAGE:return e in sessionStorage;case p.RUNTIME:return(r=S==null?void 0:S.has(e))!==null&&r!==void 0?r:!1;default:return K(t),!1}},In=e=>{const r=Y();switch(r){case p.LOCAL_STORAGE:return localStorage.removeItem(e);case p.SESSION_STORAGE:return sessionStorage.removeItem(e);case p.RUNTIME:return void(S==null?void 0:S.delete(e));default:K(r)}},Rn=()=>{const e=Y();switch(e){case p.LOCAL_STORAGE:return localStorage.clear();case p.SESSION_STORAGE:return sessionStorage.clear();case p.RUNTIME:return S==null?void 0:S.clear();default:K(e)}};var $l=Object.freeze({__proto__:null,clear:Rn,get:Sn,has:Tn,isPersistent:$n,remove:In,set:En});const Sl=()=>{let e,r;try{e=window.self!==window.top}catch(n){n instanceof DOMException&&n.name==="SecurityError"?e=!0:(e=!1,console.error(n))}try{window.location.ancestorOrigins&&(r=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(n){console.error(n)}try{!r&&document.referrer&&(r=document.referrer)}catch(n){console.error(n)}const t=r?new URL(r).hostname:void 0;return{isEmbed:e,host:t}};var E;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(E||(E={}));const T={[E.Q_144P]:{width:256,height:144},[E.Q_240P]:{width:428,height:240},[E.Q_360P]:{width:640,height:360},[E.Q_480P]:{width:856,height:480},[E.Q_720P]:{width:1280,height:720},[E.Q_1080P]:{width:1920,height:1080},[E.Q_1440P]:{width:2560,height:1440},[E.Q_2160P]:{width:3840,height:2160},[E.Q_4320P]:{width:7680,height:4320}},El=(e,r)=>T[e].height>T[r].height,Tl=(e,r)=>T[e].height>=T[r].height,pt=(e,r)=>T[e].height<T[r].height,Il=(e,r)=>T[e].height<=T[r].height,Rl=e=>e.sort((r,t)=>r===t?0:r===E.INVARIANT?1:t===E.INVARIANT?-1:pt(r,t)?1:-1)[0],bt=Object.keys(T).sort((e,r)=>pt(e,r)?-1:1),Pl=(e,r=.02)=>[...bt].find(n=>T[n].height*(1+r)>=e),_l=({width:e,height:r})=>{const t=Math.min(e,r),n=Math.max(e,r);return bt.find(o=>{const a=T[o];return a.width>=n&&a.height>=t})},Al=e=>T[e].height,yt=e=>e===E.INVARIANT,xl=e=>e.every(r=>!yt(r));function jl(e){if(yt(e))throw new Error("Expected exact quality")}const Pn=(e,r)=>{const t={};for(const n of Object.keys(r)){const o=r[n],a=e[n];Array.isArray(o)&&Array.isArray(a)?t[n]=a:typeof o=="object"&&typeof a=="object"?t[n]=Pn(a,o):t[n]=n in e?a:o}return t},Ll=e=>{let r="";return e>=3600&&(r+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(r+=Math.floor(e/60)+"m",e=e%60),e>0&&(r+=Math.floor(e)+"s"),r};function _n(e,r=0,t){let n,o,a,s,i,l,c=0,u=!1,v=!1,f=!0;const d=!r&&r!==0&&typeof window.requestAnimationFrame=="function";t&&(u=!!t.leading,v="maxWait"in t,a=t!=null&&t.maxWait?Math.max(+(t==null?void 0:t.maxWait)||0,r):a,f="trailing"in t?!!t.trailing:f);function b(h){const I=n,F=o;return n=o=void 0,c=h,s=e.apply(F,I),s}function y(h,I){return d?(i&&window.cancelAnimationFrame(i),window.requestAnimationFrame(h)):setTimeout(h,I)}function w(h){if(d){window.cancelAnimationFrame(h);return}clearTimeout(h)}function g(h){return c=h,i=y(te,r),u?b(h):s}function m(h){const I=h-l,F=h-c,br=r-I;return v?Math.min(br,a-F):br}function hr(h){const I=h-l,F=h-c;return l===void 0||I>=r||I<0||v&&F>=a}function te(){const h=Date.now();if(hr(h))return pr(h);i=y(te,m(h))}function pr(h){return i=void 0,f&&n?b(h):(n=o=void 0,s)}function gn(){i!==void 0&&w(i),c=0,n=l=o=i=void 0}function mn(){return i===void 0?s:pr(Date.now())}function On(){return i!==void 0}function ne(...h){const I=Date.now(),F=hr(I);if(n=h,o=this,l=I,F){if(i===void 0)return g(l);if(v)return i=y(te,r),b(l)}return i===void 0&&(i=y(te,r)),s}return ne.cancel=gn,ne.flush=mn,ne.pending=On,ne}const An=(e,r=0,t)=>_n(e,r,{...{leading:!0,trailing:!0},...t,maxWait:r}),gt=(e,r)=>{if(e===null||typeof e!="object")return e;const t=Array.isArray(e)?[]:{};for(const n in e){if(typeof r=="function"){const o=r(e[n],n,e,t);if(o!==void 0){t[n]=o;continue}}typeof e[n]=="object"?t[n]=gt(e[n],r):t[n]=e[n]}return t},Ml=e=>gt(e),xn=300,Nl=(e,r=xn)=>new O(t=>{const{width:n,height:o}=e.getBoundingClientRect();if(t.next({width:n,height:o}),!window.ResizeObserver)return;const a=new ResizeObserver(An(s=>{const i=s[0];if(!i)return;let l,c;i.contentBoxSize&&i.contentBoxSize[0]?(c=i.contentBoxSize[0].blockSize,l=i.contentBoxSize[0].inlineSize):i.contentRect&&(l=i.contentRect.width,c=i.contentRect.height),Ke(l)&&Ke(c)&&t.next({width:l,height:c})},r));return a.observe(e),()=>a.disconnect()});class Fl extends dt{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){const t=super._subscribe(r);return r.next(this.value),t}}function Cl(e){return new O(r=>{const t={};let n=Object.keys(e).length;const o=a=>s=>{a in t||n--,t[a]=s,n===0&&r.next(t)};return Object.entries(e).reduce((a,[s,i])=>a.add(i.subscribe(o(s))),new ge)})}function Dl(...e){return new O(r=>e.reduce((t,n)=>t.add(n.subscribe(r)),new ge))}var Gl=e=>new O(r=>{const t=window.setTimeout(()=>{try{r.next()}catch(n){if(r.error)r.error(n);else throw n}},e);return()=>window.clearTimeout(t)}),kl=e=>new O(r=>{let t=window.setInterval(()=>r.next(),e);return()=>{t&&(window.clearInterval(t),t=void 0)}}),Ul=e=>new O(r=>{e.forEach(t=>r.next(t))}),Bl=(e,r)=>new O(t=>{const n=o=>t.next(o);return e.addEventListener(r,n),()=>e.removeEventListener(r,n)});function Vl(e){return r=>new O(t=>r.subscribe(new jn(t,e)))}class jn{constructor(r,t){this.destination=r,this.size=t,this.lastValues=[]}next(r){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(r),this.destination.next(this.lastValues)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}const Ln={leading:!1,trailing:!0};function ql(e,r=Ln){return t=>new O(n=>t.subscribe(new Mn(n,e,r)))}class Mn{constructor(r,t,n){this.destination=r,this.time=t,this.config=n}next(r){this.lastValue=r,Ke(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(r),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(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}const Nn={leading:!0,trailing:!1};function Kl(e,r=Nn){return t=>new O(n=>t.subscribe(new Fn(n,e,r)))}class Fn{constructor(r,t,n){this.destination=r,this.time=t,this.config=n}next(r){this.lastValue=r,wn(this.timeout)&&(this.config.leading&&this.destination.next(r),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function Yl(e){return r=>new O(t=>r.subscribe(new Cn(t,e)))}class Cn{constructor(r,t){this.destination=r,this.predicate=t}next(r){let t;try{t=this.predicate(r)}catch(n){throw this.error(n),n}t&&this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function zl(e=(r,t)=>r===t){return r=>new O(t=>r.subscribe(new Dn(t,e)))}const yr={};class Dn{constructor(r,t){this.destination=r,this.predicate=t,this.lastValue=yr}next(r){let t;try{t=this.lastValue===yr||!this.predicate(this.lastValue,r),this.lastValue=r}catch(n){throw this.error(n),n}t&&this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function Gn(e){return r=>new O(t=>r.subscribe(new kn(t,e)))}let kn=class{constructor(r,t){this.destination=r,this.mapper=t}next(r){let t;try{t=this.mapper(r)}catch(n){throw this.error(n),n}this.destination.next(t)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}};function Ql(e){return Gn(()=>e)}function Hl(){return e=>new O(r=>{let t=!1,n=!1;const o=e.subscribe(a=>{t||(t=!0,r.next(a)),n&&o.unsubscribe()},a=>{var s;t=!0,(s=r.error)===null||s===void 0||s.call(r,a),n&&o.unsubscribe()});return n=!0,t&&o.unsubscribe(),o})}function Xl(){return e=>new O(r=>e.subscribe(new Un(r)))}class Un{constructor(r){this.destination=r,this.hasLast=!1}next(r){const t=this.last;if(this.last=r,!this.hasLast){this.hasLast=!0;return}this.destination.next([t,r])}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}function Jl(e){return r=>new O(t=>r.subscribe(new Bn(t,e)))}class Bn{constructor(r,t){this.destination=r,this.effect=t}next(r){try{this.effect(r)}catch(t){throw this.error(t),t}this.destination.next(r)}error(r){var t,n;(n=(t=this.destination).error)===null||n===void 0||n.call(t,r)}}var gr;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf",e.FATAL="fatal"})(gr||(gr={}));class mr{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(r,t,n){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:t,options:n})}removeEventListener(r,t){if(!(r in this.listeners))return;const n=this.listeners[r];for(let o=0,a=n.length;o<a;o++)if(n[o].callback===t){n.splice(o,1);return}}dispatchEvent(r){if(!(r.type in this.listeners))return;const n=this.listeners[r.type].slice();for(let o=0,a=n.length;o<a;o++){const s=n[o];try{s.callback.call(this,r)}catch(i){Promise.resolve().then(()=>{throw i})}s.options&&s.options.once&&this.removeEventListener(r.type,s.callback)}return!r.defaultPrevented}}class mt extends mr{constructor(){super(),this.listeners||mr.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(r){r.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,r)),super.dispatchEvent(r)}}class Vn{constructor(){Object.defineProperty(this,"signal",{value:new mt,writable:!0,configurable:!0})}abort(r){let t;try{t=new Event("abort")}catch(o){typeof document!="undefined"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}let n=r;if(n===void 0)if(typeof document=="undefined")n=new Error("This operation was aborted"),n.name="AbortError";else try{n=new DOMException("signal is aborted without reason")}catch(o){n=new Error("This operation was aborted"),n.name="AbortError"}this.signal.reason=n,this.signal.dispatchEvent(t)}toString(){return"[object AbortController]"}}typeof Symbol!="undefined"&&Symbol.toStringTag&&(Vn.prototype[Symbol.toStringTag]="AbortController",mt.prototype[Symbol.toStringTag]="AbortSignal");function Ot(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function qn(e){typeof e=="function"&&(e={fetch:e});const{fetch:r,Request:t=r.Request,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o=!1}=e;if(!Ot({fetch:r,Request:t,AbortController:n,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:o}))return{fetch:r,Request:a};let a=t;(a&&!a.prototype.hasOwnProperty("signal")||o)&&(a=function(c,u){let v;u&&u.signal&&(v=u.signal,delete u.signal);const f=new t(c,u);return v&&Object.defineProperty(f,"signal",{writable:!1,enumerable:!1,configurable:!0,value:v}),f},a.prototype=t.prototype);const s=r;return{fetch:(l,c)=>{const u=a&&a.prototype.isPrototypeOf(l)?l.signal:c?c.signal:void 0;if(u){let v;try{v=new DOMException("Aborted","AbortError")}catch(d){v=new Error("Aborted"),v.name="AbortError"}if(u.aborted)return Promise.reject(v);const f=new Promise((d,b)=>{u.addEventListener("abort",()=>b(v),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([f,s(l,c)])}return s(l,c)},Request:a}}const rr=Ot({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),wt=rr?qn({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,Kn=rr?wt.fetch:window.fetch;rr?wt.Request:window.Request;var Se=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Yn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var L=function(e){try{return!!e()}catch(r){return!0}},zn=L,me=!zn(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),$t=me,St=Function.prototype,Ye=St.call,Wn=$t&&St.bind.bind(Ye,Ye),D=$t?Wn:function(e){return function(){return Ye.apply(e,arguments)}},Et=D,Qn=Et({}.toString),Hn=Et("".slice),tr=function(e){return Hn(Qn(e),8,-1)},Xn=D,Jn=L,Zn=tr,Ee=Object,eo=Xn("".split),ro=Jn(function(){return!Ee("z").propertyIsEnumerable(0)})?function(e){return Zn(e)=="String"?eo(e,""):Ee(e)}:Ee,nr=function(e){return e==null},to=nr,no=TypeError,Tt=function(e){if(to(e))throw no("Can't call method on "+e);return e},oo=ro,ao=Tt,Z=function(e){return oo(ao(e))},z={},oe=function(e){return e&&e.Math==Math&&e},P=oe(typeof globalThis=="object"&&globalThis)||oe(typeof window=="object"&&window)||oe(typeof self=="object"&&self)||oe(typeof Se=="object"&&Se)||function(){return this}()||Se||Function("return this")(),ze=typeof document=="object"&&document.all,io=typeof ze=="undefined"&&ze!==void 0,It={all:ze,IS_HTMLDDA:io},Rt=It,so=Rt.all,_=Rt.IS_HTMLDDA?function(e){return typeof e=="function"||e===so}:function(e){return typeof e=="function"},co=P,lo=_,Or=co.WeakMap,uo=lo(Or)&&/native code/.test(String(Or)),wr=_,Pt=It,fo=Pt.all,W=Pt.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:wr(e)||e===fo}:function(e){return typeof e=="object"?e!==null:wr(e)},vo=L,G=!vo(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Q={},ho=P,$r=W,We=ho.document,po=$r(We)&&$r(We.createElement),_t=function(e){return po?We.createElement(e):{}},bo=G,yo=L,go=_t,At=!bo&&!yo(function(){return Object.defineProperty(go("div"),"a",{get:function(){return 7}}).a!=7}),mo=G,Oo=L,xt=mo&&Oo(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),wo=W,$o=String,So=TypeError,H=function(e){if(wo(e))return e;throw So($o(e)+" is not an object")},Eo=me,ae=Function.prototype.call,k=Eo?ae.bind(ae):function(){return ae.apply(ae,arguments)},or={},Te=or,Ie=P,To=_,Sr=function(e){return To(e)?e:void 0},jt=function(e,r){return arguments.length<2?Sr(Te[e])||Sr(Ie[e]):Te[e]&&Te[e][r]||Ie[e]&&Ie[e][r]},Io=D,Lt=Io({}.isPrototypeOf),Ro=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Mt=P,Re=Ro,Er=Mt.process,Tr=Mt.Deno,Ir=Er&&Er.versions||Tr&&Tr.version,Rr=Ir&&Ir.v8,R,pe;Rr&&(R=Rr.split("."),pe=R[0]>0&&R[0]<4?1:+(R[0]+R[1]));!pe&&Re&&(R=Re.match(/Edge\/(\d+)/),(!R||R[1]>=74)&&(R=Re.match(/Chrome\/(\d+)/),R&&(pe=+R[1])));var Po=pe,Pr=Po,_o=L,Ao=P,xo=Ao.String,Nt=!!Object.getOwnPropertySymbols&&!_o(function(){var e=Symbol();return!xo(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Pr&&Pr<41}),jo=Nt,Ft=jo&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Lo=jt,Mo=_,No=Lt,Fo=Ft,Co=Object,Ct=Fo?function(e){return typeof e=="symbol"}:function(e){var r=Lo("Symbol");return Mo(r)&&No(r.prototype,Co(e))},Do=String,ar=function(e){try{return Do(e)}catch(r){return"Object"}},Go=_,ko=ar,Uo=TypeError,ir=function(e){if(Go(e))return e;throw Uo(ko(e)+" is not a function")},Bo=ir,Vo=nr,sr=function(e,r){var t=e[r];return Vo(t)?void 0:Bo(t)},Pe=k,_e=_,Ae=W,qo=TypeError,Ko=function(e,r){var t,n;if(r==="string"&&_e(t=e.toString)&&!Ae(n=Pe(t,e))||_e(t=e.valueOf)&&!Ae(n=Pe(t,e))||r!=="string"&&_e(t=e.toString)&&!Ae(n=Pe(t,e)))return n;throw qo("Can't convert object to primitive value")},Dt={exports:{}},_r=P,Yo=Object.defineProperty,zo=function(e,r){try{Yo(_r,e,{value:r,configurable:!0,writable:!0})}catch(t){_r[e]=r}return r},Wo=P,Qo=zo,Ar="__core-js_shared__",Ho=Wo[Ar]||Qo(Ar,{}),Gt=Ho,xr=Gt;(Dt.exports=function(e,r){return xr[e]||(xr[e]=r!==void 0?r:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var kt=Dt.exports,Xo=Tt,Jo=Object,Ut=function(e){return Jo(Xo(e))},Zo=D,ea=Ut,ra=Zo({}.hasOwnProperty),N=Object.hasOwn||function(r,t){return ra(ea(r),t)},ta=D,na=0,oa=Math.random(),aa=ta(1 .toString),Bt=function(e){return"Symbol("+(e===void 0?"":e)+")_"+aa(++na+oa,36)},ia=P,sa=kt,jr=N,ca=Bt,la=Nt,ua=Ft,q=ia.Symbol,xe=sa("wks"),fa=ua?q.for||q:q&&q.withoutSetter||ca,M=function(e){return jr(xe,e)||(xe[e]=la&&jr(q,e)?q[e]:fa("Symbol."+e)),xe[e]},va=k,Lr=W,Mr=Ct,da=sr,ha=Ko,pa=M,ba=TypeError,ya=pa("toPrimitive"),ga=function(e,r){if(!Lr(e)||Mr(e))return e;var t=da(e,ya),n;if(t){if(r===void 0&&(r="default"),n=va(t,e,r),!Lr(n)||Mr(n))return n;throw ba("Can't convert object to primitive value")}return r===void 0&&(r="number"),ha(e,r)},ma=ga,Oa=Ct,cr=function(e){var r=ma(e,"string");return Oa(r)?r:r+""},wa=G,$a=At,Sa=xt,ie=H,Nr=cr,Ea=TypeError,je=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,Le="enumerable",Me="configurable",Ne="writable";Q.f=wa?Sa?function(r,t,n){if(ie(r),t=Nr(t),ie(n),typeof r=="function"&&t==="prototype"&&"value"in n&&Ne in n&&!n[Ne]){var o=Ta(r,t);o&&o[Ne]&&(r[t]=n.value,n={configurable:Me in n?n[Me]:o[Me],enumerable:Le in n?n[Le]:o[Le],writable:!1})}return je(r,t,n)}:je:function(r,t,n){if(ie(r),t=Nr(t),ie(n),$a)try{return je(r,t,n)}catch(o){}if("get"in n||"set"in n)throw Ea("Accessors not supported");return"value"in n&&(r[t]=n.value),r};var Oe=function(e,r){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:r}},Ia=G,Ra=Q,Pa=Oe,ee=Ia?function(e,r,t){return Ra.f(e,r,Pa(1,t))}:function(e,r,t){return e[r]=t,e},_a=kt,Aa=Bt,Fr=_a("keys"),lr=function(e){return Fr[e]||(Fr[e]=Aa(e))},ur={},xa=uo,Vt=P,ja=W,La=ee,Fe=N,Ce=Gt,Ma=lr,Na=ur,Cr="Object already initialized",Qe=Vt.TypeError,Fa=Vt.WeakMap,be,J,ye,Ca=function(e){return ye(e)?J(e):be(e,{})},Da=function(e){return function(r){var t;if(!ja(r)||(t=J(r)).type!==e)throw Qe("Incompatible receiver, "+e+" required");return t}};if(xa||Ce.state){var A=Ce.state||(Ce.state=new Fa);A.get=A.get,A.has=A.has,A.set=A.set,be=function(e,r){if(A.has(e))throw Qe(Cr);return r.facade=e,A.set(e,r),r},J=function(e){return A.get(e)||{}},ye=function(e){return A.has(e)}}else{var U=Ma("state");Na[U]=!0,be=function(e,r){if(Fe(e,U))throw Qe(Cr);return r.facade=e,La(e,U,r),r},J=function(e){return Fe(e,U)?e[U]:{}},ye=function(e){return Fe(e,U)}}var Ga={set:be,get:J,has:ye,enforce:Ca,getterFor:Da},ka=me,qt=Function.prototype,Dr=qt.apply,Gr=qt.call,Ua=typeof Reflect=="object"&&Reflect.apply||(ka?Gr.bind(Dr):function(){return Gr.apply(Dr,arguments)}),Ba=tr,Va=D,Kt=function(e){if(Ba(e)==="Function")return Va(e)},Yt={},zt={},Wt={}.propertyIsEnumerable,Qt=Object.getOwnPropertyDescriptor,qa=Qt&&!Wt.call({1:2},1);zt.f=qa?function(r){var t=Qt(this,r);return!!t&&t.enumerable}:Wt;var Ka=G,Ya=k,za=zt,Wa=Oe,Qa=Z,Ha=cr,Xa=N,Ja=At,kr=Object.getOwnPropertyDescriptor;Yt.f=Ka?kr:function(r,t){if(r=Qa(r),t=Ha(t),Ja)try{return kr(r,t)}catch(n){}if(Xa(r,t))return Wa(!Ya(za.f,r,t),r[t])};var Za=L,ei=_,ri=/#|\.prototype\./,re=function(e,r){var t=ni[ti(e)];return t==ai?!0:t==oi?!1:ei(r)?Za(r):!!r},ti=re.normalize=function(e){return String(e).replace(ri,".").toLowerCase()},ni=re.data={},oi=re.NATIVE="N",ai=re.POLYFILL="P",ii=re,Ur=Kt,si=ir,ci=me,li=Ur(Ur.bind),Ht=function(e,r){return si(e),r===void 0?e:ci?li(e,r):function(){return e.apply(r,arguments)}},se=P,ui=Ua,fi=Kt,vi=_,di=Yt.f,hi=ii,B=or,pi=Ht,V=ee,Br=N,bi=function(e){var r=function(t,n,o){if(this instanceof r){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,o)}return ui(e,this,arguments)};return r.prototype=e.prototype,r},Xt=function(e,r){var t=e.target,n=e.global,o=e.stat,a=e.proto,s=n?se:o?se[t]:(se[t]||{}).prototype,i=n?B:B[t]||V(B,t,{})[t],l=i.prototype,c,u,v,f,d,b,y,w,g;for(f in r)c=hi(n?f:t+(o?".":"#")+f,e.forced),u=!c&&s&&Br(s,f),b=i[f],u&&(e.dontCallGetSet?(g=di(s,f),y=g&&g.value):y=s[f]),d=u&&y?y:r[f],!(u&&typeof b==typeof d)&&(e.bind&&u?w=pi(d,se):e.wrap&&u?w=bi(d):a&&vi(d)?w=fi(d):w=d,(e.sham||d&&d.sham||b&&b.sham)&&V(w,"sham",!0),V(i,f,w),a&&(v=t+"Prototype",Br(B,v)||V(B,v,{}),V(B[v],f,d),e.real&&l&&(c||!l[f])&&V(l,f,d)))},He=G,yi=N,Jt=Function.prototype,gi=He&&Object.getOwnPropertyDescriptor,fr=yi(Jt,"name"),mi=fr&&function(){}.name==="something",Oi=fr&&(!He||He&&gi(Jt,"name").configurable),wi={EXISTS:fr,PROPER:mi,CONFIGURABLE:Oi},Zt={},$i=Math.ceil,Si=Math.floor,Ei=Math.trunc||function(r){var t=+r;return(t>0?Si:$i)(t)},Ti=Ei,en=function(e){var r=+e;return r!==r||r===0?0:Ti(r)},Ii=en,Ri=Math.max,Pi=Math.min,_i=function(e,r){var t=Ii(e);return t<0?Ri(t+r,0):Pi(t,r)},Ai=en,xi=Math.min,ji=function(e){return e>0?xi(Ai(e),9007199254740991):0},Li=ji,rn=function(e){return Li(e.length)},Mi=Z,Ni=_i,Fi=rn,Vr=function(e){return function(r,t,n){var o=Mi(r),a=Fi(o),s=Ni(n,a),i;if(e&&t!=t){for(;a>s;)if(i=o[s++],i!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===t)return e||s||0;return!e&&-1}},Ci={includes:Vr(!0),indexOf:Vr(!1)},Di=D,De=N,Gi=Z,ki=Ci.indexOf,Ui=ur,qr=Di([].push),Bi=function(e,r){var t=Gi(e),n=0,o=[],a;for(a in t)!De(Ui,a)&&De(t,a)&&qr(o,a);for(;r.length>n;)De(t,a=r[n++])&&(~ki(o,a)||qr(o,a));return o},tn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Vi=Bi,qi=tn,Ki=Object.keys||function(r){return Vi(r,qi)},Yi=G,zi=xt,Wi=Q,Qi=H,Hi=Z,Xi=Ki;Zt.f=Yi&&!zi?Object.defineProperties:function(r,t){Qi(r);for(var n=Hi(t),o=Xi(t),a=o.length,s=0,i;a>s;)Wi.f(r,i=o[s++],n[i]);return r};var Ji=jt,Zi=Ji("document","documentElement"),es=H,rs=Zt,Kr=tn,ts=ur,ns=Zi,os=_t,as=lr,Yr=">",zr="<",Xe="prototype",Je="script",nn=as("IE_PROTO"),Ge=function(){},on=function(e){return zr+Je+Yr+e+zr+"/"+Je+Yr},Wr=function(e){e.write(on("")),e.close();var r=e.parentWindow.Object;return e=null,r},is=function(){var e=os("iframe"),r="java"+Je+":",t;return e.style.display="none",ns.appendChild(e),e.src=String(r),t=e.contentWindow.document,t.open(),t.write(on("document.F=Object")),t.close(),t.F},ce,ve=function(){try{ce=new ActiveXObject("htmlfile")}catch(r){}ve=typeof document!="undefined"?document.domain&&ce?Wr(ce):is():Wr(ce);for(var e=Kr.length;e--;)delete ve[Xe][Kr[e]];return ve()};ts[nn]=!0;var an=Object.create||function(r,t){var n;return r!==null?(Ge[Xe]=es(r),n=new Ge,Ge[Xe]=null,n[nn]=r):n=ve(),t===void 0?n:rs.f(n,t)},ss=L,cs=!ss(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),ls=N,us=_,fs=Ut,vs=lr,ds=cs,Qr=vs("IE_PROTO"),Ze=Object,hs=Ze.prototype,sn=ds?Ze.getPrototypeOf:function(e){var r=fs(e);if(ls(r,Qr))return r[Qr];var t=r.constructor;return us(t)&&r instanceof t?t.prototype:r instanceof Ze?hs:null},ps=ee,cn=function(e,r,t,n){return n&&n.enumerable?e[r]=t:ps(e,r,t),e},bs=L,ys=_,gs=W,ms=an,Hr=sn,Os=cn,ws=M,er=ws("iterator"),ln=!1,j,ke,Ue;[].keys&&(Ue=[].keys(),"next"in Ue?(ke=Hr(Hr(Ue)),ke!==Object.prototype&&(j=ke)):ln=!0);var $s=!gs(j)||bs(function(){var e={};return j[er].call(e)!==e});$s?j={}:j=ms(j);ys(j[er])||Os(j,er,function(){return this});var un={IteratorPrototype:j,BUGGY_SAFARI_ITERATORS:ln},Ss=M,Es=Ss("toStringTag"),fn={};fn[Es]="z";var vr=String(fn)==="[object z]",Ts=vr,Is=_,de=tr,Rs=M,Ps=Rs("toStringTag"),_s=Object,As=de(function(){return arguments}())=="Arguments",xs=function(e,r){try{return e[r]}catch(t){}},dr=Ts?de:function(e){var r,t,n;return e===void 0?"Undefined":e===null?"Null":typeof(t=xs(r=_s(e),Ps))=="string"?t:As?de(r):(n=de(r))=="Object"&&Is(r.callee)?"Arguments":n},js=vr,Ls=dr,Ms=js?{}.toString:function(){return"[object "+Ls(this)+"]"},Ns=vr,Fs=Q.f,Cs=ee,Ds=N,Gs=Ms,ks=M,Xr=ks("toStringTag"),vn=function(e,r,t,n){if(e){var o=t?e:e.prototype;Ds(o,Xr)||Fs(o,Xr,{configurable:!0,value:r}),n&&!Ns&&Cs(o,"toString",Gs)}},Us=un.IteratorPrototype,Bs=an,Vs=Oe,qs=vn,Ks=z,Ys=function(){return this},zs=function(e,r,t,n){var o=r+" Iterator";return e.prototype=Bs(Us,{next:Vs(+!n,t)}),qs(e,o,!1,!0),Ks[o]=Ys,e},Ws=Xt,Qs=k,dn=wi,Hs=zs,Xs=sn,Js=vn,Jr=cn,Zs=M,Zr=z,hn=un,ec=dn.PROPER;dn.CONFIGURABLE;hn.IteratorPrototype;var le=hn.BUGGY_SAFARI_ITERATORS,Be=Zs("iterator"),et="keys",ue="values",rt="entries",rc=function(){return this},tc=function(e,r,t,n,o,a,s){Hs(t,r,n);var i=function(g){if(g===o&&f)return f;if(!le&&g in u)return u[g];switch(g){case et:return function(){return new t(this,g)};case ue:return function(){return new t(this,g)};case rt:return function(){return new t(this,g)}}return function(){return new t(this)}},l=r+" Iterator",c=!1,u=e.prototype,v=u[Be]||u["@@iterator"]||o&&u[o],f=!le&&v||i(o),d=r=="Array"&&u.entries||v,b,y,w;if(d&&(b=Xs(d.call(new e)),b!==Object.prototype&&b.next&&(Js(b,l,!0,!0),Zr[l]=rc)),ec&&o==ue&&v&&v.name!==ue&&(c=!0,f=function(){return Qs(v,this)}),o)if(y={values:i(ue),keys:a?f:i(et),entries:i(rt)},s)for(w in y)(le||c||!(w in u))&&Jr(u,w,y[w]);else Ws({target:r,proto:!0,forced:le||c},y);return s&&u[Be]!==f&&Jr(u,Be,f,{name:o}),Zr[r]=f,y},nc=function(e,r){return{value:e,done:r}},oc=Z,tt=z,pn=Ga;Q.f;var ac=tc,fe=nc,bn="Array Iterator",ic=pn.set,sc=pn.getterFor(bn);ac(Array,"Array",function(e,r){ic(this,{type:bn,target:oc(e),index:0,kind:r})},function(){var e=sc(this),r=e.target,t=e.kind,n=e.index++;return!r||n>=r.length?(e.target=void 0,fe(void 0,!0)):t=="keys"?fe(n,!1):t=="values"?fe(r[n],!1):fe([n,r[n]],!1)},"values");tt.Arguments=tt.Array;var cc=M,lc=z,uc=cc("iterator"),fc=Array.prototype,vc=function(e){return e!==void 0&&(lc.Array===e||fc[uc]===e)},dc=dr,nt=sr,hc=nr,pc=z,bc=M,yc=bc("iterator"),yn=function(e){if(!hc(e))return nt(e,yc)||nt(e,"@@iterator")||pc[dc(e)]},gc=k,mc=ir,Oc=H,wc=ar,$c=yn,Sc=TypeError,Ec=function(e,r){var t=arguments.length<2?$c(e):r;if(mc(t))return Oc(gc(t,e));throw Sc(wc(e)+" is not iterable")},Tc=k,ot=H,Ic=sr,Rc=function(e,r,t){var n,o;ot(e);try{if(n=Ic(e,"return"),!n){if(r==="throw")throw t;return t}n=Tc(n,e)}catch(a){o=!0,n=a}if(r==="throw")throw t;if(o)throw n;return ot(n),t},Pc=Ht,_c=k,Ac=H,xc=ar,jc=vc,Lc=rn,at=Lt,Mc=Ec,Nc=yn,it=Rc,Fc=TypeError,he=function(e,r){this.stopped=e,this.result=r},st=he.prototype,Cc=function(e,r,t){var n=t&&t.that,o=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_RECORD),s=!!(t&&t.IS_ITERATOR),i=!!(t&&t.INTERRUPTED),l=Pc(r,n),c,u,v,f,d,b,y,w=function(m){return c&&it(c,"normal",m),new he(!0,m)},g=function(m){return o?(Ac(m),i?l(m[0],m[1],w):l(m[0],m[1])):i?l(m,w):l(m)};if(a)c=e.iterator;else if(s)c=e;else{if(u=Nc(e),!u)throw Fc(xc(e)+" is not iterable");if(jc(u)){for(v=0,f=Lc(e);f>v;v++)if(d=g(e[v]),d&&at(st,d))return d;return new he(!1)}c=Mc(e,u)}for(b=a?e.next:c.next;!(y=_c(b,c)).done;){try{d=g(y.value)}catch(m){it(c,"throw",m)}if(typeof d=="object"&&d&&at(st,d))return d}return new he(!1)},Dc=cr,Gc=Q,kc=Oe,Uc=function(e,r,t){var n=Dc(r);n in e?Gc.f(e,n,kc(0,t)):e[n]=t},Bc=Xt,Vc=Cc,qc=Uc;Bc({target:"Object",stat:!0},{fromEntries:function(r){var t={};return Vc(r,function(n,o){qc(t,n,o)},{AS_ENTRIES:!0}),t}});var Kc=or,Yc=Kc.Object.fromEntries,zc={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Wc=zc,Qc=P,Hc=dr,Xc=ee,ct=z,Jc=M,lt=Jc("toStringTag");for(var Ve in Wc){var ut=Qc[Ve],qe=ut&&ut.prototype;qe&&Hc(qe)!==lt&&Xc(qe,lt,Ve),ct[Ve]=ct.Array}var Zc=Yc,el=Zc,rl=el,tl=rl,nl=Yn(tl),ft;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(ft||(ft={}));const ol="vk.com",Zl=async(e,r,t)=>{const n=new URL(`https://${ol}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",r),e!==void 0&&n.searchParams.set("lang",e);const a=await(await Kn(n.toString())).json();return al(a,t)},al=(e,r)=>nl(Object.entries(e.keys).map(([t,n])=>[t.substring(`${r}_`.length),il(n)])),il=e=>Array.isArray(e)?e[0]:e;var vt;(function(e){e.RU="ru",e.EN="en"})(vt||(vt={}));export{x as CurrentClientBrowser,$ as CurrentClientDevice,gr as ErrorCategory,vt as InterfaceLanguage,ll as Logger,O as Observable,dt as Subject,ge as Subscription,sl as VERSION,ft as VKNumericLanguage,Fl as ValueSubject,E as VideoQuality,bl as abortable,hl as addScript,xl as areQualitiesExact,dl as assertEmptyArray,K as assertNever,ul as assertNonNullable,vl as assertNotEmptyArray,fl as assertNullable,jl as assertQualityIsExact,Vl as buffer,cl as checkNever,Ml as cloneDeep,gt as cloneDeepWith,Cl as combine,ql as debounce,_n as debounceFn,Sl as detectEmbed,Pn as fillWithDefault,Yl as filter,zl as filterChanged,Bl as fromEvent,ht as getCurrentBrowser,wl as getExponentialDelay,Rl as getHighestQuality,gl as getIOSVersion,kl as interval,El as isHigher,Tl as isHigherOrEqual,yl as isIOS,yt as isInvariantQuality,pt as isLower,Il as isLowerOrEqual,ml as isMacLike,Ol as isMobile,Ke as isNonNullable,wn as isNullable,Zl as loadVKLangPack,Gn as map,Ql as mapTo,Dl as merge,X as noop,pl as now,Ul as observableFrom,Nl as observeElementSize,Hl as once,Xl as pairwise,$l as safeStorage,Jl as tap,Kl as throttle,An as throttleFn,Ll as timeCodeToString,Gl as timeout,Pl as videoHeightToQuality,Al as videoQualityToHeight,_l as videoSizeToQuality};
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.37-dev.7467b46e.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};
package/esnext.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.36
3
- * Tue, 18 Jun 2024 13:17:03 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-36/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.37-dev.7467b46e.0
3
+ * Fri, 05 Jul 2024 10:31:04 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-37/doc/
5
5
  */
6
- "use strict";const ie="1.0.36";class R{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(n=>typeof n=="function"?n():n.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const y=e=>{throw new Error(`${e} is value of unexpected type`)},se=e=>{},S=()=>{};class f{constructor(t){t&&(this._subscribe=t)}subscribe(t,n){let r;n?typeof n=="function"?r={next:n,error:S}:r={next:o=>n.next(o),error:o=>n.error?.(o)}:r={next:S,error:S};const s=typeof t=="function"?{next:o=>{try{t(o)}catch(a){r.next(a)}},error:o=>r.next(o)}:{next:o=>t.next(o),error:o=>t.error?t.error(o):r.next(o)};let i;try{i=this._subscribe(s)}catch(o){s.error?.(o)}return new R().add(()=>{switch(s.next=S,s.error=S,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return y(i)}})}pipe(...t){return t.reduce((n,r)=>r(n),this)}_subscribe(t){}}class I extends f{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>n.error?.(t))}_subscribe(t){const n=this.keyCounter++;return this.subscribers.set(n,t),new R().add(()=>this.subscribers.delete(n))}}class oe{log$=new I;logs=[];log=t=>{const n={...t,timestamp:Date.now()};this.logs.push(n),this.log$.next(n)};createCustomLog(t){return(...n)=>{let r;try{r=t(...n)}catch{r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog(n=>({component:t,...n}))}getAllLogs=()=>this.logs}function ae(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function ce(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function _(e){return typeof e<"u"&&e!==null}function z(e){return e==null}function le(e,t){if(!e?.length)throw new Error(t)}function ue(e,t){if(e?.length)throw new Error(t)}const de=(e,t,n)=>new Promise((r,s)=>{t.addEventListener("abort",()=>{a(),c.remove()});const i=()=>{a(),s()},o=()=>{a(),r()},a=()=>{l&&clearTimeout(l),c.removeEventListener("load",o),c.removeEventListener("error",i)};let l;n&&(l=window.setTimeout(i,n));const c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",i),c.src=e,document.head.appendChild(c)}),fe=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),he=(e,t)=>async(...n)=>{const r=t(...n);let s=e.aborted,i;for(;!s&&!e.aborted;)try{const o=await r.next(i);s=o.done??!1,i=o.value}catch(o){await r.throw(o)}return i};exports.CurrentClientBrowser=void 0;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(exports.CurrentClientBrowser||(exports.CurrentClientBrowser={}));exports.CurrentClientDevice=void 0;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(exports.CurrentClientDevice||(exports.CurrentClientDevice={}));const N=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?exports.CurrentClientBrowser.Yandex:void 0,n=/chrome|crios/i.test(e)?exports.CurrentClientBrowser.Chrome:void 0,r=/chromium/i.test(e)?exports.CurrentClientBrowser.Chromium:void 0,s=/firefox|fxios/i.test(e)?exports.CurrentClientBrowser.Firefox:void 0,i=/webkit|safari|khtml/i.test(e)?exports.CurrentClientBrowser.Safari:void 0,o=/opr\//i.test(e)?exports.CurrentClientBrowser.Opera:void 0,a=/edg/i.test(e)?exports.CurrentClientBrowser.Edge:void 0,l=/android/i.test(e)?exports.CurrentClientDevice.Android:void 0,c=/iphone/i.test(e)?exports.CurrentClientDevice.iPhone:void 0,b=/ipad/i.test(e)?exports.CurrentClientDevice.iPad:void 0,h=/ipod/i.test(e)?exports.CurrentClientDevice.iPod:void 0,m=/mac/i.test(e)?exports.CurrentClientDevice.Mac:void 0,v=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?exports.CurrentClientDevice.RestMobile:void 0;return{browser:t||s||o||a||n||r||i||exports.CurrentClientBrowser.Rest,device:l||c||b||h||v||m||exports.CurrentClientDevice.Desktop}},be=(e=!1)=>{const n=[exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(N().device);if(!e)return n;const{userAgent:r,maxTouchPoints:s}=window.navigator;return!!(n||/macintosh/i.test(r)&&s>0)},ge=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const n=t[1],r=parseFloat(n);return isNaN(r)?null:r},we=()=>[exports.CurrentClientDevice.Mac,exports.CurrentClientDevice.iPhone,exports.CurrentClientDevice.iPad,exports.CurrentClientDevice.iPod].includes(N().device),me=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile,pe=(e,{start:t=0,factor:n=2,max:r=1/0,min:s=t,random:i=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*i*2-i),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,s),o};var d;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(d||(d={}));let O,E;const P=`vk-videoplayer-dummy-key-${Math.random()}`,A=()=>{if(E!==void 0)return E;try{localStorage.setItem(P,"test"),localStorage.removeItem(P),E=d.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(P),E=d.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)E=d.RUNTIME;else throw t}else throw e}return E===d.RUNTIME&&(O=new Map),E},Ee=()=>A()===d.LOCAL_STORAGE,ye=e=>{const t=A();switch(t){case d.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case d.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case d.RUNTIME:return O?.get(e);default:y(t)}},ve=(e,t)=>{const n=A();switch(n){case d.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case d.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case d.RUNTIME:return void O?.set(e,t);default:y(n)}},Se=e=>{const t=A();switch(t){case d.LOCAL_STORAGE:return e in localStorage;case d.SESSION_STORAGE:return e in sessionStorage;case d.RUNTIME:return O?.has(e)??!1;default:return y(t),!1}},Oe=e=>{const t=A();switch(t){case d.LOCAL_STORAGE:return localStorage.removeItem(e);case d.SESSION_STORAGE:return sessionStorage.removeItem(e);case d.RUNTIME:return void O?.delete(e);default:y(t)}},Ae=()=>{const e=A();switch(e){case d.LOCAL_STORAGE:return localStorage.clear();case d.SESSION_STORAGE:return sessionStorage.clear();case d.RUNTIME:return O?.clear();default:y(e)}};var xe=Object.freeze({__proto__:null,clear:Ae,get:ye,has:Se,isPersistent:Ee,remove:Oe,set:ve});const Re=()=>{let e,t;try{e=window.self!==window.top}catch(r){r instanceof DOMException&&r.name==="SecurityError"?e=!0:(e=!1,console.error(r))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(r){console.error(r)}try{!t&&document.referrer&&(t=document.referrer)}catch(r){console.error(r)}const n=t?new URL(t).hostname:void 0;return{isEmbed:e,host:n}};exports.VideoQuality=void 0;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(exports.VideoQuality||(exports.VideoQuality={}));const g={[exports.VideoQuality.Q_144P]:{width:256,height:144},[exports.VideoQuality.Q_240P]:{width:428,height:240},[exports.VideoQuality.Q_360P]:{width:640,height:360},[exports.VideoQuality.Q_480P]:{width:856,height:480},[exports.VideoQuality.Q_720P]:{width:1280,height:720},[exports.VideoQuality.Q_1080P]:{width:1920,height:1080},[exports.VideoQuality.Q_1440P]:{width:2560,height:1440},[exports.VideoQuality.Q_2160P]:{width:3840,height:2160},[exports.VideoQuality.Q_4320P]:{width:7680,height:4320}},Le=(e,t)=>g[e].height>g[t].height,Ce=(e,t)=>g[e].height>=g[t].height,M=(e,t)=>g[e].height<g[t].height,Te=(e,t)=>g[e].height<=g[t].height,_e=e=>e.sort((t,n)=>t===n?0:t===exports.VideoQuality.INVARIANT?1:n===exports.VideoQuality.INVARIANT?-1:M(t,n)?1:-1)[0],B=Object.keys(g).sort((e,t)=>M(e,t)?-1:1),Pe=(e,t=.02)=>[...B].find(r=>g[r].height*(1+t)>=e),Ie=({width:e,height:t})=>{const n=Math.min(e,t),r=Math.max(e,t);return B.find(s=>{const i=g[s];return i.width>=r&&i.height>=n})},Ne=e=>g[e].height,D=e=>e===exports.VideoQuality.INVARIANT,Me=e=>e.every(t=>!D(t));function De(e){if(D(e))throw new Error("Expected exact quality")}const G=(e,t)=>{const n={};for(const r of Object.keys(t)){const s=t[r],i=e[r];Array.isArray(s)&&Array.isArray(i)?n[r]=i:typeof s=="object"&&typeof i=="object"?n[r]=G(i,s):n[r]=r in e?i:s}return n},Qe=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};function W(e,t=0,n){let r,s,i,o,a,l,c=0,b=!1,h=!1,m=!0;const v=!t&&t!==0&&typeof window.requestAnimationFrame=="function";n&&(b=!!n.leading,h="maxWait"in n,i=n?.maxWait?Math.max(+n?.maxWait||0,t):i,m="trailing"in n?!!n.trailing:m);function x(u){const w=r,p=s;return r=s=void 0,c=u,o=e.apply(p,w),o}function L(u,w){return v?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,w)}function J(u){if(v){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Z(u){return c=u,a=L(C,t),b?x(u):o}function ee(u){const w=u-l,p=u-c,q=t-w;return h?Math.min(q,i-p):q}function k(u){const w=u-l,p=u-c;return l===void 0||w>=t||w<0||h&&p>=i}function C(){const u=Date.now();if(k(u))return F(u);a=L(C,ee(u))}function F(u){return a=void 0,m&&r?x(u):(r=s=void 0,o)}function te(){a!==void 0&&J(a),c=0,r=l=s=a=void 0}function ne(){return a===void 0?o:F(Date.now())}function re(){return a!==void 0}function T(...u){const w=Date.now(),p=k(w);if(r=u,s=this,l=w,p){if(a===void 0)return Z(l);if(h)return a=L(C,t),x(l)}return a===void 0&&(a=L(C,t)),o}return T.cancel=te,T.flush=ne,T.pending=re,T}const H=(e,t=0,n)=>W(e,t,{...{leading:!0,trailing:!0},...n,maxWait:t}),Q=(e,t)=>{if(e===null||typeof e!="object")return e;const n=Array.isArray(e)?[]:{};for(const r in e){if(typeof t=="function"){const s=t(e[r],r,e,n);if(s!==void 0){n[r]=s;continue}}typeof e[r]=="object"?n[r]=Q(e[r],t):n[r]=e[r]}return n},Ve=e=>Q(e),ke=300,Fe=(e,t=ke)=>new f(n=>{const{width:r,height:s}=e.getBoundingClientRect();if(n.next({width:r,height:s}),!window.ResizeObserver)return;const i=new ResizeObserver(H(o=>{const a=o[0];if(!a)return;let l,c;a.contentBoxSize&&a.contentBoxSize[0]?(c=a.contentBoxSize[0].blockSize,l=a.contentBoxSize[0].inlineSize):a.contentRect&&(l=a.contentRect.width,c=a.contentRect.height),_(l)&&_(c)&&n.next({width:l,height:c})},t));return i.observe(e),()=>i.disconnect()});class qe extends I{value;constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const n=super._subscribe(t);return t.next(this.value),n}}function je(e){return new f(t=>{const n={};let r=Object.keys(e).length;const s=i=>o=>{i in n||r--,n[i]=o,r===0&&t.next(n)};return Object.entries(e).reduce((i,[o,a])=>i.add(a.subscribe(s(o))),new R)})}function Ue(...e){return new f(t=>e.reduce((n,r)=>n.add(r.subscribe(t)),new R))}var ze=e=>new f(t=>{const n=window.setTimeout(()=>{try{t.next()}catch(r){if(t.error)t.error(r);else throw r}},e);return()=>window.clearTimeout(n)}),Be=e=>new f(t=>{let n=window.setInterval(()=>t.next(),e);return()=>{n&&(window.clearInterval(n),n=void 0)}}),Ge=e=>new f(t=>{e.forEach(n=>t.next(n))}),We=(e,t)=>new f(n=>{const r=s=>n.next(s);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});function He(e){return t=>new f(n=>t.subscribe(new $e(n,e)))}class $e{destination;size;lastValues=[];constructor(t,n){this.destination=t,this.size=n}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const Ye={leading:!1,trailing:!0};function Ke(e,t=Ye){return n=>new f(r=>n.subscribe(new Xe(r,e,t)))}class Xe{destination;time;config;lastValue;timeout;constructor(t,n,r){this.destination=t,this.time=n,this.config=r}next(t){this.lastValue=t,_(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(n){if(this.destination.error)this.destination.error(n);else throw n}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const Je={leading:!0,trailing:!1};function Ze(e,t=Je){return n=>new f(r=>n.subscribe(new et(r,e,t)))}class et{destination;time;config;lastValue;timeout;constructor(t,n,r){this.destination=t,this.time=n,this.config=r}next(t){this.lastValue=t,z(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){this.destination.error?.(t)}}function tt(e){return t=>new f(n=>t.subscribe(new nt(n,e)))}class nt{destination;predicate;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.predicate(t)}catch(r){throw this.error(r),r}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function rt(e=(t,n)=>t===n){return t=>new f(n=>t.subscribe(new it(n,e)))}const j={};class it{destination;predicate;lastValue=j;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.lastValue===j||!this.predicate(this.lastValue,t),this.lastValue=t}catch(r){throw this.error(r),r}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function $(e){return t=>new f(n=>t.subscribe(new st(n,e)))}let st=class{destination;mapper;constructor(t,n){this.destination=t,this.mapper=n}next(t){let n;try{n=this.mapper(t)}catch(r){throw this.error(r),r}this.destination.next(n)}error(t){this.destination.error?.(t)}};function ot(e){return $(()=>e)}function at(){return e=>new f(t=>{let n=!1,r=!1;const s=e.subscribe(i=>{n||(n=!0,t.next(i)),r&&s.unsubscribe()},i=>{n=!0,t.error?.(i),r&&s.unsubscribe()});return r=!0,n&&s.unsubscribe(),s})}function ct(){return e=>new f(t=>e.subscribe(new lt(t)))}class lt{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const n=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([n,t])}error(t){this.destination.error?.(t)}}function ut(e){return t=>new f(n=>t.subscribe(new dt(n,e)))}class dt{destination;effect;constructor(t,n){this.destination=t,this.effect=n}next(t){try{this.effect(t)}catch(n){throw this.error(n),n}this.destination.next(t)}error(t){this.destination.error?.(t)}}exports.ErrorCategory=void 0;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf",e.FATAL="fatal"})(exports.ErrorCategory||(exports.ErrorCategory={}));class U{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,n,r){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:n,options:r})}removeEventListener(t,n){if(!(t in this.listeners))return;const r=this.listeners[t];for(let s=0,i=r.length;s<i;s++)if(r[s].callback===n){r.splice(s,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const r=this.listeners[t.type].slice();for(let s=0,i=r.length;s<i;s++){const o=r[s];try{o.callback.call(this,t)}catch(a){Promise.resolve().then(()=>{throw a})}o.options&&o.options.once&&this.removeEventListener(t.type,o.callback)}return!t.defaultPrevented}}class Y extends U{constructor(){super(),this.listeners||U.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class ft{constructor(){Object.defineProperty(this,"signal",{value:new Y,writable:!0,configurable:!0})}abort(t){let n;try{n=new Event("abort")}catch{typeof document<"u"?document.createEvent?(n=document.createEvent("Event"),n.initEvent("abort",!1,!1)):(n=document.createEventObject(),n.type="abort"):n={type:"abort",bubbles:!1,cancelable:!1}}let r=t;if(r===void 0)if(typeof document>"u")r=new Error("This operation was aborted"),r.name="AbortError";else try{r=new DOMException("signal is aborted without reason")}catch{r=new Error("This operation was aborted"),r.name="AbortError"}this.signal.reason=r,this.signal.dispatchEvent(n)}toString(){return"[object AbortController]"}}typeof Symbol<"u"&&Symbol.toStringTag&&(ft.prototype[Symbol.toStringTag]="AbortController",Y.prototype[Symbol.toStringTag]="AbortSignal");function K(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function ht(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s=!1}=e;if(!K({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:t,Request:i};let i=n;(i&&!i.prototype.hasOwnProperty("signal")||s)&&(i=function(c,b){let h;b&&b.signal&&(h=b.signal,delete b.signal);const m=new n(c,b);return h&&Object.defineProperty(m,"signal",{writable:!1,enumerable:!1,configurable:!0,value:h}),m},i.prototype=n.prototype);const o=t;return{fetch:(l,c)=>{const b=i&&i.prototype.isPrototypeOf(l)?l.signal:c?c.signal:void 0;if(b){let h;try{h=new DOMException("Aborted","AbortError")}catch{h=new Error("Aborted"),h.name="AbortError"}if(b.aborted)return Promise.reject(h);const m=new Promise((v,x)=>{b.addEventListener("abort",()=>x(h),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([m,o(l,c)])}return o(l,c)},Request:i}}const V=K({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),X=V?ht({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,bt=V?X.fetch:window.fetch;V?X.Request:window.Request;exports.VKNumericLanguage=void 0;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(exports.VKNumericLanguage||(exports.VKNumericLanguage={}));const gt="vk.com",wt=async(e,t,n)=>{const r=new URL(`https://${gt}/js/lang-pack.js`);r.searchParams.set("format","json"),r.searchParams.set("name",t),e!==void 0&&r.searchParams.set("lang",e);const i=await(await bt(r.toString())).json();return mt(i,n)},mt=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([n,r])=>[n.substring(`${t}_`.length),pt(r)])),pt=e=>Array.isArray(e)?e[0]:e;exports.InterfaceLanguage=void 0;(function(e){e.RU="ru",e.EN="en"})(exports.InterfaceLanguage||(exports.InterfaceLanguage={}));exports.Logger=oe;exports.Observable=f;exports.Subject=I;exports.Subscription=R;exports.VERSION=ie;exports.ValueSubject=qe;exports.abortable=he;exports.addScript=de;exports.areQualitiesExact=Me;exports.assertEmptyArray=ue;exports.assertNever=y;exports.assertNonNullable=ae;exports.assertNotEmptyArray=le;exports.assertNullable=ce;exports.assertQualityIsExact=De;exports.buffer=He;exports.checkNever=se;exports.cloneDeep=Ve;exports.cloneDeepWith=Q;exports.combine=je;exports.debounce=Ke;exports.debounceFn=W;exports.detectEmbed=Re;exports.fillWithDefault=G;exports.filter=tt;exports.filterChanged=rt;exports.fromEvent=We;exports.getCurrentBrowser=N;exports.getExponentialDelay=pe;exports.getHighestQuality=_e;exports.getIOSVersion=ge;exports.interval=Be;exports.isHigher=Le;exports.isHigherOrEqual=Ce;exports.isIOS=be;exports.isInvariantQuality=D;exports.isLower=M;exports.isLowerOrEqual=Te;exports.isMacLike=we;exports.isMobile=me;exports.isNonNullable=_;exports.isNullable=z;exports.loadVKLangPack=wt;exports.map=$;exports.mapTo=ot;exports.merge=Ue;exports.noop=S;exports.now=fe;exports.observableFrom=Ge;exports.observeElementSize=Fe;exports.once=at;exports.pairwise=ct;exports.safeStorage=xe;exports.tap=ut;exports.throttle=Ze;exports.throttleFn=H;exports.timeCodeToString=Qe;exports.timeout=ze;exports.videoHeightToQuality=Pe;exports.videoQualityToHeight=Ne;exports.videoSizeToQuality=Ie;
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.37-dev.7467b46e.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||{});
package/esnext.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.36
3
- * Tue, 18 Jun 2024 13:17:03 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-36/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.37-dev.7467b46e.0
3
+ * Fri, 05 Jul 2024 10:31:04 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-37/doc/
5
5
  */
6
- const Ne="1.0.36";class M{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(n=>typeof n=="function"?n():n.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const x=e=>{throw new Error(`${e} is value of unexpected type`)},ke=e=>{},L=()=>{};class f{constructor(t){t&&(this._subscribe=t)}subscribe(t,n){let r;n?typeof n=="function"?r={next:n,error:L}:r={next:o=>n.next(o),error:o=>n.error?.(o)}:r={next:L,error:L};const s=typeof t=="function"?{next:o=>{try{t(o)}catch(a){r.next(a)}},error:o=>r.next(o)}:{next:o=>t.next(o),error:o=>t.error?t.error(o):r.next(o)};let i;try{i=this._subscribe(s)}catch(o){s.error?.(o)}return new M().add(()=>{switch(s.next=L,s.error=L,typeof i){case"function":i();return;case"object":i.unsubscribe();return;case"undefined":return;default:return x(i)}})}pipe(...t){return t.reduce((n,r)=>r(n),this)}_subscribe(t){}}class G extends f{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>n.error?.(t))}_subscribe(t){const n=this.keyCounter++;return this.subscribers.set(n,t),new M().add(()=>this.subscribers.delete(n))}}class Fe{log$=new G;logs=[];log=t=>{const n={...t,timestamp:Date.now()};this.logs.push(n),this.log$.next(n)};createCustomLog(t){return(...n)=>{let r;try{r=t(...n)}catch{r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog(n=>({component:t,...n}))}getAllLogs=()=>this.logs}function qe(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function Ce(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function k(e){return typeof e<"u"&&e!==null}function se(e){return e==null}function De(e,t){if(!e?.length)throw new Error(t)}function je(e,t){if(e?.length)throw new Error(t)}const Ue=(e,t,n)=>new Promise((r,s)=>{t.addEventListener("abort",()=>{a(),c.remove()});const i=()=>{a(),s()},o=()=>{a(),r()},a=()=>{l&&clearTimeout(l),c.removeEventListener("load",o),c.removeEventListener("error",i)};let l;n&&(l=window.setTimeout(i,n));const c=document.createElement("script");c.addEventListener("load",o),c.addEventListener("error",i),c.src=e,document.head.appendChild(c)}),Qe=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),Ve=(e,t)=>async(...n)=>{const r=t(...n);let s=e.aborted,i;for(;!s&&!e.aborted;)try{const o=await r.next(i);s=o.done??!1,i=o.value}catch(o){await r.throw(o)}return i};var S;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(S||(S={}));var b;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(b||(b={}));const W=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?S.Yandex:void 0,n=/chrome|crios/i.test(e)?S.Chrome:void 0,r=/chromium/i.test(e)?S.Chromium:void 0,s=/firefox|fxios/i.test(e)?S.Firefox:void 0,i=/webkit|safari|khtml/i.test(e)?S.Safari:void 0,o=/opr\//i.test(e)?S.Opera:void 0,a=/edg/i.test(e)?S.Edge:void 0,l=/android/i.test(e)?b.Android:void 0,c=/iphone/i.test(e)?b.iPhone:void 0,w=/ipad/i.test(e)?b.iPad:void 0,h=/ipod/i.test(e)?b.iPod:void 0,E=/mac/i.test(e)?b.Mac:void 0,y=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?b.RestMobile:void 0;return{browser:t||s||o||a||n||r||i||S.Rest,device:l||c||w||h||y||E||b.Desktop}},ze=(e=!1)=>{const n=[b.iPhone,b.iPad,b.iPod].includes(W().device);if(!e)return n;const{userAgent:r,maxTouchPoints:s}=window.navigator;return!!(n||/macintosh/i.test(r)&&s>0)},Ge=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const n=t[1],r=parseFloat(n);return isNaN(r)?null:r},We=()=>[b.Mac,b.iPhone,b.iPad,b.iPod].includes(W().device),$e=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile,Be=(e,{start:t=0,factor:n=2,max:r=1/0,min:s=t,random:i=0}={})=>{let o=t;return o*=n**e,o*=1+(Math.random()*i*2-i),o=Math.round(o),o=Math.min(o,r),o=Math.max(o,s),o};var d;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(d||(d={}));let v,O;const N=`vk-videoplayer-dummy-key-${Math.random()}`,R=()=>{if(O!==void 0)return O;try{localStorage.setItem(N,"test"),localStorage.removeItem(N),O=d.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(N),O=d.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)O=d.RUNTIME;else throw t}else throw e}return O===d.RUNTIME&&(v=new Map),O},oe=()=>R()===d.LOCAL_STORAGE,ae=e=>{const t=R();switch(t){case d.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case d.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case d.RUNTIME:return v?.get(e);default:x(t)}},ce=(e,t)=>{const n=R();switch(n){case d.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case d.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(r){if(r instanceof DOMException)console.error(r);else throw r}break;case d.RUNTIME:return void v?.set(e,t);default:x(n)}},le=e=>{const t=R();switch(t){case d.LOCAL_STORAGE:return e in localStorage;case d.SESSION_STORAGE:return e in sessionStorage;case d.RUNTIME:return v?.has(e)??!1;default:return x(t),!1}},ue=e=>{const t=R();switch(t){case d.LOCAL_STORAGE:return localStorage.removeItem(e);case d.SESSION_STORAGE:return sessionStorage.removeItem(e);case d.RUNTIME:return void v?.delete(e);default:x(t)}},de=()=>{const e=R();switch(e){case d.LOCAL_STORAGE:return localStorage.clear();case d.SESSION_STORAGE:return sessionStorage.clear();case d.RUNTIME:return v?.clear();default:x(e)}};var Ye=Object.freeze({__proto__:null,clear:de,get:ae,has:le,isPersistent:oe,remove:ue,set:ce});const He=()=>{let e,t;try{e=window.self!==window.top}catch(r){r instanceof DOMException&&r.name==="SecurityError"?e=!0:(e=!1,console.error(r))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(r){console.error(r)}try{!t&&document.referrer&&(t=document.referrer)}catch(r){console.error(r)}const n=t?new URL(t).hostname:void 0;return{isEmbed:e,host:n}};var m;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(m||(m={}));const g={[m.Q_144P]:{width:256,height:144},[m.Q_240P]:{width:428,height:240},[m.Q_360P]:{width:640,height:360},[m.Q_480P]:{width:856,height:480},[m.Q_720P]:{width:1280,height:720},[m.Q_1080P]:{width:1920,height:1080},[m.Q_1440P]:{width:2560,height:1440},[m.Q_2160P]:{width:3840,height:2160},[m.Q_4320P]:{width:7680,height:4320}},Xe=(e,t)=>g[e].height>g[t].height,Je=(e,t)=>g[e].height>=g[t].height,$=(e,t)=>g[e].height<g[t].height,Ze=(e,t)=>g[e].height<=g[t].height,Ke=e=>e.sort((t,n)=>t===n?0:t===m.INVARIANT?1:n===m.INVARIANT?-1:$(t,n)?1:-1)[0],B=Object.keys(g).sort((e,t)=>$(e,t)?-1:1),et=(e,t=.02)=>[...B].find(r=>g[r].height*(1+t)>=e),tt=({width:e,height:t})=>{const n=Math.min(e,t),r=Math.max(e,t);return B.find(s=>{const i=g[s];return i.width>=r&&i.height>=n})},nt=e=>g[e].height,Y=e=>e===m.INVARIANT,rt=e=>e.every(t=>!Y(t));function it(e){if(Y(e))throw new Error("Expected exact quality")}const fe=(e,t)=>{const n={};for(const r of Object.keys(t)){const s=t[r],i=e[r];Array.isArray(s)&&Array.isArray(i)?n[r]=i:typeof s=="object"&&typeof i=="object"?n[r]=fe(i,s):n[r]=r in e?i:s}return n},st=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};function he(e,t=0,n){let r,s,i,o,a,l,c=0,w=!1,h=!1,E=!0;const y=!t&&t!==0&&typeof window.requestAnimationFrame=="function";n&&(w=!!n.leading,h="maxWait"in n,i=n?.maxWait?Math.max(+n?.maxWait||0,t):i,E="trailing"in n?!!n.trailing:E);function T(u){const p=r,A=s;return r=s=void 0,c=u,o=e.apply(A,p),o}function _(u,p){return y?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,p)}function K(u){if(y){window.cancelAnimationFrame(u);return}clearTimeout(u)}function ee(u){return c=u,a=_(P,t),w?T(u):o}function te(u){const p=u-l,A=u-c,D=t-p;return h?Math.min(D,i-A):D}function q(u){const p=u-l,A=u-c;return l===void 0||p>=t||p<0||h&&A>=i}function P(){const u=Date.now();if(q(u))return C(u);a=_(P,te(u))}function C(u){return a=void 0,E&&r?T(u):(r=s=void 0,o)}function ne(){a!==void 0&&K(a),c=0,r=l=s=a=void 0}function re(){return a===void 0?o:C(Date.now())}function ie(){return a!==void 0}function I(...u){const p=Date.now(),A=q(p);if(r=u,s=this,l=p,A){if(a===void 0)return ee(l);if(h)return a=_(P,t),T(l)}return a===void 0&&(a=_(P,t)),o}return I.cancel=ne,I.flush=re,I.pending=ie,I}const be=(e,t=0,n)=>he(e,t,{...{leading:!0,trailing:!0},...n,maxWait:t}),H=(e,t)=>{if(e===null||typeof e!="object")return e;const n=Array.isArray(e)?[]:{};for(const r in e){if(typeof t=="function"){const s=t(e[r],r,e,n);if(s!==void 0){n[r]=s;continue}}typeof e[r]=="object"?n[r]=H(e[r],t):n[r]=e[r]}return n},ot=e=>H(e),we=300,at=(e,t=we)=>new f(n=>{const{width:r,height:s}=e.getBoundingClientRect();if(n.next({width:r,height:s}),!window.ResizeObserver)return;const i=new ResizeObserver(be(o=>{const a=o[0];if(!a)return;let l,c;a.contentBoxSize&&a.contentBoxSize[0]?(c=a.contentBoxSize[0].blockSize,l=a.contentBoxSize[0].inlineSize):a.contentRect&&(l=a.contentRect.width,c=a.contentRect.height),k(l)&&k(c)&&n.next({width:l,height:c})},t));return i.observe(e),()=>i.disconnect()});class ct extends G{value;constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const n=super._subscribe(t);return t.next(this.value),n}}function lt(e){return new f(t=>{const n={};let r=Object.keys(e).length;const s=i=>o=>{i in n||r--,n[i]=o,r===0&&t.next(n)};return Object.entries(e).reduce((i,[o,a])=>i.add(a.subscribe(s(o))),new M)})}function ut(...e){return new f(t=>e.reduce((n,r)=>n.add(r.subscribe(t)),new M))}var dt=e=>new f(t=>{const n=window.setTimeout(()=>{try{t.next()}catch(r){if(t.error)t.error(r);else throw r}},e);return()=>window.clearTimeout(n)}),ft=e=>new f(t=>{let n=window.setInterval(()=>t.next(),e);return()=>{n&&(window.clearInterval(n),n=void 0)}}),ht=e=>new f(t=>{e.forEach(n=>t.next(n))}),bt=(e,t)=>new f(n=>{const r=s=>n.next(s);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)});function wt(e){return t=>new f(n=>t.subscribe(new me(n,e)))}class me{destination;size;lastValues=[];constructor(t,n){this.destination=t,this.size=n}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const ge={leading:!1,trailing:!0};function mt(e,t=ge){return n=>new f(r=>n.subscribe(new pe(r,e,t)))}class pe{destination;time;config;lastValue;timeout;constructor(t,n,r){this.destination=t,this.time=n,this.config=r}next(t){this.lastValue=t,k(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(n){if(this.destination.error)this.destination.error(n);else throw n}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const Ee={leading:!0,trailing:!1};function gt(e,t=Ee){return n=>new f(r=>n.subscribe(new Se(r,e,t)))}class Se{destination;time;config;lastValue;timeout;constructor(t,n,r){this.destination=t,this.time=n,this.config=r}next(t){this.lastValue=t,se(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){this.destination.error?.(t)}}function pt(e){return t=>new f(n=>t.subscribe(new Ae(n,e)))}class Ae{destination;predicate;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.predicate(t)}catch(r){throw this.error(r),r}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function Et(e=(t,n)=>t===n){return t=>new f(n=>t.subscribe(new Oe(n,e)))}const j={};class Oe{destination;predicate;lastValue=j;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.lastValue===j||!this.predicate(this.lastValue,t),this.lastValue=t}catch(r){throw this.error(r),r}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function ye(e){return t=>new f(n=>t.subscribe(new xe(n,e)))}let xe=class{destination;mapper;constructor(t,n){this.destination=t,this.mapper=n}next(t){let n;try{n=this.mapper(t)}catch(r){throw this.error(r),r}this.destination.next(n)}error(t){this.destination.error?.(t)}};function At(e){return ye(()=>e)}function Ot(){return e=>new f(t=>{let n=!1,r=!1;const s=e.subscribe(i=>{n||(n=!0,t.next(i)),r&&s.unsubscribe()},i=>{n=!0,t.error?.(i),r&&s.unsubscribe()});return r=!0,n&&s.unsubscribe(),s})}function yt(){return e=>new f(t=>e.subscribe(new ve(t)))}class ve{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const n=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([n,t])}error(t){this.destination.error?.(t)}}function xt(e){return t=>new f(n=>t.subscribe(new Re(n,e)))}class Re{destination;effect;constructor(t,n){this.destination=t,this.effect=n}next(t){try{this.effect(t)}catch(n){throw this.error(n),n}this.destination.next(t)}error(t){this.destination.error?.(t)}}var U;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf",e.FATAL="fatal"})(U||(U={}));class Q{constructor(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}addEventListener(t,n,r){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:n,options:r})}removeEventListener(t,n){if(!(t in this.listeners))return;const r=this.listeners[t];for(let s=0,i=r.length;s<i;s++)if(r[s].callback===n){r.splice(s,1);return}}dispatchEvent(t){if(!(t.type in this.listeners))return;const r=this.listeners[t.type].slice();for(let s=0,i=r.length;s<i;s++){const o=r[s];try{o.callback.call(this,t)}catch(a){Promise.resolve().then(()=>{throw a})}o.options&&o.options.once&&this.removeEventListener(t.type,o.callback)}return!t.defaultPrevented}}class X extends Q{constructor(){super(),this.listeners||Q.call(this),Object.defineProperty(this,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(this,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"reason",{value:void 0,writable:!0,configurable:!0})}toString(){return"[object AbortSignal]"}dispatchEvent(t){t.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,t)),super.dispatchEvent(t)}}class Te{constructor(){Object.defineProperty(this,"signal",{value:new X,writable:!0,configurable:!0})}abort(t){let n;try{n=new Event("abort")}catch{typeof document<"u"?document.createEvent?(n=document.createEvent("Event"),n.initEvent("abort",!1,!1)):(n=document.createEventObject(),n.type="abort"):n={type:"abort",bubbles:!1,cancelable:!1}}let r=t;if(r===void 0)if(typeof document>"u")r=new Error("This operation was aborted"),r.name="AbortError";else try{r=new DOMException("signal is aborted without reason")}catch{r=new Error("This operation was aborted"),r.name="AbortError"}this.signal.reason=r,this.signal.dispatchEvent(n)}toString(){return"[object AbortController]"}}typeof Symbol<"u"&&Symbol.toStringTag&&(Te.prototype[Symbol.toStringTag]="AbortController",X.prototype[Symbol.toStringTag]="AbortSignal");function J(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Le(e){typeof e=="function"&&(e={fetch:e});const{fetch:t,Request:n=t.Request,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s=!1}=e;if(!J({fetch:t,Request:n,AbortController:r,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:t,Request:i};let i=n;(i&&!i.prototype.hasOwnProperty("signal")||s)&&(i=function(c,w){let h;w&&w.signal&&(h=w.signal,delete w.signal);const E=new n(c,w);return h&&Object.defineProperty(E,"signal",{writable:!1,enumerable:!1,configurable:!0,value:h}),E},i.prototype=n.prototype);const o=t;return{fetch:(l,c)=>{const w=i&&i.prototype.isPrototypeOf(l)?l.signal:c?c.signal:void 0;if(w){let h;try{h=new DOMException("Aborted","AbortError")}catch{h=new Error("Aborted"),h.name="AbortError"}if(w.aborted)return Promise.reject(h);const E=new Promise((y,T)=>{w.addEventListener("abort",()=>T(h),{once:!0})});return c&&c.signal&&delete c.signal,Promise.race([E,o(l,c)])}return o(l,c)},Request:i}}const F=J({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}),Z=F?Le({fetch:window.fetch,Request:window.Request,AbortController:window.AbortController}):void 0,_e=F?Z.fetch:window.fetch;F?Z.Request:window.Request;var V;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(V||(V={}));const Pe="vk.com",vt=async(e,t,n)=>{const r=new URL(`https://${Pe}/js/lang-pack.js`);r.searchParams.set("format","json"),r.searchParams.set("name",t),e!==void 0&&r.searchParams.set("lang",e);const i=await(await _e(r.toString())).json();return Ie(i,n)},Ie=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([n,r])=>[n.substring(`${t}_`.length),Me(r)])),Me=e=>Array.isArray(e)?e[0]:e;var z;(function(e){e.RU="ru",e.EN="en"})(z||(z={}));export{S as CurrentClientBrowser,b as CurrentClientDevice,U as ErrorCategory,z as InterfaceLanguage,Fe as Logger,f as Observable,G as Subject,M as Subscription,Ne as VERSION,V as VKNumericLanguage,ct as ValueSubject,m as VideoQuality,Ve as abortable,Ue as addScript,rt as areQualitiesExact,je as assertEmptyArray,x as assertNever,qe as assertNonNullable,De as assertNotEmptyArray,Ce as assertNullable,it as assertQualityIsExact,wt as buffer,ke as checkNever,ot as cloneDeep,H as cloneDeepWith,lt as combine,mt as debounce,he as debounceFn,He as detectEmbed,fe as fillWithDefault,pt as filter,Et as filterChanged,bt as fromEvent,W as getCurrentBrowser,Be as getExponentialDelay,Ke as getHighestQuality,Ge as getIOSVersion,ft as interval,Xe as isHigher,Je as isHigherOrEqual,ze as isIOS,Y as isInvariantQuality,$ as isLower,Ze as isLowerOrEqual,We as isMacLike,$e as isMobile,k as isNonNullable,se as isNullable,vt as loadVKLangPack,ye as map,At as mapTo,ut as merge,L as noop,Qe as now,ht as observableFrom,at as observeElementSize,Ot as once,yt as pairwise,Ye as safeStorage,xt as tap,gt as throttle,be as throttleFn,st as timeCodeToString,dt as timeout,et as videoHeightToQuality,nt as videoQualityToHeight,tt as videoSizeToQuality};
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.37-dev.7467b46e.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};
package/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.36
3
- * Tue, 18 Jun 2024 13:17:03 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-36/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.37-dev.7467b46e.0
3
+ * Fri, 05 Jul 2024 10:31:04 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-37/doc/
5
5
  */
6
- const Te="1.0.36";class M{subscriptions=[];unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach(n=>typeof n=="function"?n():n.unsubscribe())}add(t){return this.subscriptions.push(t),this}}const x=e=>{throw new Error(`${e} is value of unexpected type`)},ye=e=>{},T=()=>{};class h{constructor(t){t&&(this._subscribe=t)}subscribe(t,n){let i;n?typeof n=="function"?i={next:n,error:T}:i={next:s=>n.next(s),error:s=>n.error?.(s)}:i={next:T,error:T};const o=typeof t=="function"?{next:s=>{try{t(s)}catch(a){i.next(a)}},error:s=>i.next(s)}:{next:s=>t.next(s),error:s=>t.error?t.error(s):i.next(s)};let r;try{r=this._subscribe(o)}catch(s){o.error?.(s)}return new M().add(()=>{switch(o.next=T,o.error=T,typeof r){case"function":r();return;case"object":r.unsubscribe();return;case"undefined":return;default:return x(r)}})}pipe(...t){return t.reduce((n,i)=>i(n),this)}_subscribe(t){}}class W extends h{keyCounter=0;subscribers=new Map;constructor(){super()}next(t){this.subscribers.forEach(n=>n.next(t))}error(t){this.subscribers.forEach(n=>n.error?.(t))}_subscribe(t){const n=this.keyCounter++;return this.subscribers.set(n,t),new M().add(()=>this.subscribers.delete(n))}}class Re{log$=new W;logs=[];log=t=>{const n={...t,timestamp:Date.now()};this.logs.push(n),this.log$.next(n)};createCustomLog(t){return(...n)=>{let i;try{i=t(...n)}catch{i={message:"error in `createCustomLog`",component:"Logger"}}this.log(i)}}createComponentLog(t){return this.createCustomLog(n=>({component:t,...n}))}getAllLogs=()=>this.logs}function Ie(e,t='Assertion "value is not nullable" failed'){if(e==null)throw new Error(t)}function _e(e,t='Assertion "value is nullable" failed'){if(e!=null)throw new Error(t)}function k(e){return typeof e<"u"&&e!==null}function ee(e){return e==null}function Pe(e,t){if(!e?.length)throw new Error(t)}function Me(e,t){if(e?.length)throw new Error(t)}const Le=(e,t,n)=>new Promise((i,o)=>{t.addEventListener("abort",()=>{a(),l.remove()});const r=()=>{a(),o()},s=()=>{a(),i()},a=()=>{d&&clearTimeout(d),l.removeEventListener("load",s),l.removeEventListener("error",r)};let d;n&&(d=window.setTimeout(r,n));const l=document.createElement("script");l.addEventListener("load",s),l.addEventListener("error",r),l.src=e,document.head.appendChild(l)}),Ne=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now(),ke=(e,t)=>async(...n)=>{const i=t(...n);let o=e.aborted,r;for(;!o&&!e.aborted;)try{const s=await i.next(r);o=s.done??!1,r=s.value}catch(s){await i.throw(s)}return r};var p;(function(e){e.Unknown="Unknown",e.Yandex="Yandex",e.Chrome="Chrome",e.Chromium="Chromium",e.Firefox="Firefox",e.Safari="Safari",e.Opera="Opera",e.Edge="Edge",e.Rest="Rest"})(p||(p={}));var f;(function(e){e.Unknown="Unknown",e.Android="Android",e.iPhone="iPhone",e.iPad="iPad",e.iPod="iPod",e.RestMobile="RestMobile",e.Mac="Mac",e.Desktop="Desktop"})(f||(f={}));const j=()=>{const{userAgent:e}=window.navigator,t=/yabrowser/i.test(e)?p.Yandex:void 0,n=/chrome|crios/i.test(e)?p.Chrome:void 0,i=/chromium/i.test(e)?p.Chromium:void 0,o=/firefox|fxios/i.test(e)?p.Firefox:void 0,r=/webkit|safari|khtml/i.test(e)?p.Safari:void 0,s=/opr\//i.test(e)?p.Opera:void 0,a=/edg/i.test(e)?p.Edge:void 0,d=/android/i.test(e)?f.Android:void 0,l=/iphone/i.test(e)?f.iPhone:void 0,y=/ipad/i.test(e)?f.iPad:void 0,S=/ipod/i.test(e)?f.iPod:void 0,v=/mac/i.test(e)?f.Mac:void 0,R=/webOS|BlackBerry|IEMobile|Opera Mini/i.test(e)?f.RestMobile:void 0;return{browser:t||o||s||a||n||i||r||p.Rest,device:d||l||y||S||R||v||f.Desktop}},Fe=(e=!1)=>{const n=[f.iPhone,f.iPad,f.iPod].includes(j().device);if(!e)return n;const{userAgent:i,maxTouchPoints:o}=window.navigator;return!!(n||/macintosh/i.test(i)&&o>0)},Ue=()=>{const{userAgent:e}=window.navigator,t=e.match(/Version\/(\d+(\.\d+)?)/i);if(!t)return null;const n=t[1],i=parseFloat(n);return isNaN(i)?null:i},De=()=>[f.Mac,f.iPhone,f.iPad,f.iPod].includes(j().device),Qe=()=>/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion??navigator.userAgent)||navigator?.userAgentData?.mobile,Ve=(e,{start:t=0,factor:n=2,max:i=1/0,min:o=t,random:r=0}={})=>{let s=t;return s*=n**e,s*=1+(Math.random()*r*2-r),s=Math.round(s),s=Math.min(s,i),s=Math.max(s,o),s};var u;(function(e){e[e.LOCAL_STORAGE=0]="LOCAL_STORAGE",e[e.SESSION_STORAGE=1]="SESSION_STORAGE",e[e.RUNTIME=2]="RUNTIME"})(u||(u={}));let A,E;const N=`vk-videoplayer-dummy-key-${Math.random()}`,O=()=>{if(E!==void 0)return E;try{localStorage.setItem(N,"test"),localStorage.removeItem(N),E=u.LOCAL_STORAGE}catch(e){if(e instanceof DOMException||e instanceof TypeError)try{sessionStorage.getItem(N),E=u.SESSION_STORAGE}catch(t){if(t instanceof DOMException||t instanceof TypeError)E=u.RUNTIME;else throw t}else throw e}return E===u.RUNTIME&&(A=new Map),E},te=()=>O()===u.LOCAL_STORAGE,ne=e=>{const t=O();switch(t){case u.LOCAL_STORAGE:return localStorage.getItem(e)??void 0;case u.SESSION_STORAGE:return sessionStorage.getItem(e)??void 0;case u.RUNTIME:return A?.get(e);default:x(t)}},ie=(e,t)=>{const n=O();switch(n){case u.LOCAL_STORAGE:try{localStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case u.SESSION_STORAGE:try{sessionStorage.setItem(e,t)}catch(i){if(i instanceof DOMException)console.error(i);else throw i}break;case u.RUNTIME:return void A?.set(e,t);default:x(n)}},se=e=>{const t=O();switch(t){case u.LOCAL_STORAGE:return e in localStorage;case u.SESSION_STORAGE:return e in sessionStorage;case u.RUNTIME:return A?.has(e)??!1;default:return x(t),!1}},re=e=>{const t=O();switch(t){case u.LOCAL_STORAGE:return localStorage.removeItem(e);case u.SESSION_STORAGE:return sessionStorage.removeItem(e);case u.RUNTIME:return void A?.delete(e);default:x(t)}},oe=()=>{const e=O();switch(e){case u.LOCAL_STORAGE:return localStorage.clear();case u.SESSION_STORAGE:return sessionStorage.clear();case u.RUNTIME:return A?.clear();default:x(e)}};var ze=Object.freeze({__proto__:null,clear:oe,get:ne,has:se,isPersistent:te,remove:re,set:ie});const Ge=()=>{let e,t;try{e=window.self!==window.top}catch(i){i instanceof DOMException&&i.name==="SecurityError"?e=!0:(e=!1,console.error(i))}try{window.location.ancestorOrigins&&(t=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1])}catch(i){console.error(i)}try{!t&&document.referrer&&(t=document.referrer)}catch(i){console.error(i)}const n=t?new URL(t).hostname:void 0;return{isEmbed:e,host:n}};var m;(function(e){e.INVARIANT="Invariant quality",e.Q_144P="144p",e.Q_240P="240p",e.Q_360P="360p",e.Q_480P="480p",e.Q_720P="720p",e.Q_1080P="1080p",e.Q_1440P="1440p",e.Q_2160P="2160p",e.Q_4320P="4320p"})(m||(m={}));const w={[m.Q_144P]:{width:256,height:144},[m.Q_240P]:{width:428,height:240},[m.Q_360P]:{width:640,height:360},[m.Q_480P]:{width:856,height:480},[m.Q_720P]:{width:1280,height:720},[m.Q_1080P]:{width:1920,height:1080},[m.Q_1440P]:{width:2560,height:1440},[m.Q_2160P]:{width:3840,height:2160},[m.Q_4320P]:{width:7680,height:4320}},We=(e,t)=>w[e].height>w[t].height,je=(e,t)=>w[e].height>=w[t].height,q=(e,t)=>w[e].height<w[t].height,qe=(e,t)=>w[e].height<=w[t].height,$e=e=>e.sort((t,n)=>t===n?0:t===m.INVARIANT?1:n===m.INVARIANT?-1:q(t,n)?1:-1)[0],$=Object.keys(w).sort((e,t)=>q(e,t)?-1:1),He=(e,t=.02)=>[...$].find(i=>w[i].height*(1+t)>=e),Be=({width:e,height:t})=>{const n=Math.min(e,t),i=Math.max(e,t);return $.find(o=>{const r=w[o];return r.width>=i&&r.height>=n})},Ce=e=>w[e].height,H=e=>e===m.INVARIANT,Ye=e=>e.every(t=>!H(t));function Xe(e){if(H(e))throw new Error("Expected exact quality")}const ae=(e,t)=>{const n={};for(const i of Object.keys(t)){const o=t[i],r=e[i];Array.isArray(o)&&Array.isArray(r)?n[i]=r:typeof o=="object"&&typeof r=="object"?n[i]=ae(r,o):n[i]=i in e?r:o}return n},Je=e=>{let t="";return e>=3600&&(t+=Math.floor(e/3600)+"h",e=e%3600),e>=60&&(t+=Math.floor(e/60)+"m",e=e%60),e>0&&(t+=Math.floor(e)+"s"),t};function ce(e,t=0,n){let i,o,r,s,a,d,l=0,y=!1,S=!1,v=!0;const R=!t&&t!==0&&typeof window.requestAnimationFrame=="function";n&&(y=!!n.leading,S="maxWait"in n,r=n?.maxWait?Math.max(+n?.maxWait||0,t):r,v="trailing"in n?!!n.trailing:v);function L(c){const g=i,b=o;return i=o=void 0,l=c,s=e.apply(b,g),s}function I(c,g){return R?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(c)):setTimeout(c,g)}function C(c){if(R){window.cancelAnimationFrame(c);return}clearTimeout(c)}function Y(c){return l=c,a=I(_,t),y?L(c):s}function X(c){const g=c-d,b=c-l,D=t-g;return S?Math.min(D,r-b):D}function F(c){const g=c-d,b=c-l;return d===void 0||g>=t||g<0||S&&b>=r}function _(){const c=Date.now();if(F(c))return U(c);a=I(_,X(c))}function U(c){return a=void 0,v&&i?L(c):(i=o=void 0,s)}function J(){a!==void 0&&C(a),l=0,i=d=o=a=void 0}function Z(){return a===void 0?s:U(Date.now())}function K(){return a!==void 0}function P(...c){const g=Date.now(),b=F(g);if(i=c,o=this,d=g,b){if(a===void 0)return Y(d);if(S)return a=I(_,t),L(d)}return a===void 0&&(a=I(_,t)),s}return P.cancel=J,P.flush=Z,P.pending=K,P}const ue=(e,t=0,n)=>ce(e,t,{...{leading:!0,trailing:!0},...n,maxWait:t}),B=(e,t)=>{if(e===null||typeof e!="object")return e;const n=Array.isArray(e)?[]:{};for(const i in e){if(typeof t=="function"){const o=t(e[i],i,e,n);if(o!==void 0){n[i]=o;continue}}typeof e[i]=="object"?n[i]=B(e[i],t):n[i]=e[i]}return n},Ze=e=>B(e),le=300,Ke=(e,t=le)=>new h(n=>{const{width:i,height:o}=e.getBoundingClientRect();if(n.next({width:i,height:o}),!window.ResizeObserver)return;const r=new ResizeObserver(ue(s=>{const a=s[0];if(!a)return;let d,l;a.contentBoxSize&&a.contentBoxSize[0]?(l=a.contentBoxSize[0].blockSize,d=a.contentBoxSize[0].inlineSize):a.contentRect&&(d=a.contentRect.width,l=a.contentRect.height),k(d)&&k(l)&&n.next({width:d,height:l})},t));return r.observe(e),()=>r.disconnect()});class et extends W{value;constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const n=super._subscribe(t);return t.next(this.value),n}}function tt(e){return new h(t=>{const n={};let i=Object.keys(e).length;const o=r=>s=>{r in n||i--,n[r]=s,i===0&&t.next(n)};return Object.entries(e).reduce((r,[s,a])=>r.add(a.subscribe(o(s))),new M)})}function nt(...e){return new h(t=>e.reduce((n,i)=>n.add(i.subscribe(t)),new M))}var it=e=>new h(t=>{const n=window.setTimeout(()=>{try{t.next()}catch(i){if(t.error)t.error(i);else throw i}},e);return()=>window.clearTimeout(n)}),st=e=>new h(t=>{let n=window.setInterval(()=>t.next(),e);return()=>{n&&(window.clearInterval(n),n=void 0)}}),rt=e=>new h(t=>{e.forEach(n=>t.next(n))}),ot=(e,t)=>new h(n=>{const i=o=>n.next(o);return e.addEventListener(t,i),()=>e.removeEventListener(t,i)});function at(e){return t=>new h(n=>t.subscribe(new de(n,e)))}class de{destination;size;lastValues=[];constructor(t,n){this.destination=t,this.size=n}next(t){this.lastValues.length===this.size&&this.lastValues.shift(),this.lastValues.push(t),this.destination.next(this.lastValues)}error(t){this.destination.error?.(t)}}const he={leading:!1,trailing:!0};function ct(e,t=he){return n=>new h(i=>n.subscribe(new fe(i,e,t)))}class fe{destination;time;config;lastValue;timeout;constructor(t,n,i){this.destination=t,this.time=n,this.config=i}next(t){this.lastValue=t,k(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(n){if(this.destination.error)this.destination.error(n);else throw n}this.timeout=void 0},this.time)}error(t){this.destination.error?.(t)}}const me={leading:!0,trailing:!1};function ut(e,t=me){return n=>new h(i=>n.subscribe(new we(i,e,t)))}class we{destination;time;config;lastValue;timeout;constructor(t,n,i){this.destination=t,this.time=n,this.config=i}next(t){this.lastValue=t,ee(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(t){this.destination.error?.(t)}}function lt(e){return t=>new h(n=>t.subscribe(new ge(n,e)))}class ge{destination;predicate;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.predicate(t)}catch(i){throw this.error(i),i}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function dt(e=(t,n)=>t===n){return t=>new h(n=>t.subscribe(new pe(n,e)))}const Q={};class pe{destination;predicate;lastValue=Q;constructor(t,n){this.destination=t,this.predicate=n}next(t){let n;try{n=this.lastValue===Q||!this.predicate(this.lastValue,t),this.lastValue=t}catch(i){throw this.error(i),i}n&&this.destination.next(t)}error(t){this.destination.error?.(t)}}function be(e){return t=>new h(n=>t.subscribe(new Ee(n,e)))}let Ee=class{destination;mapper;constructor(t,n){this.destination=t,this.mapper=n}next(t){let n;try{n=this.mapper(t)}catch(i){throw this.error(i),i}this.destination.next(n)}error(t){this.destination.error?.(t)}};function ft(e){return be(()=>e)}function mt(){return e=>new h(t=>{let n=!1,i=!1;const o=e.subscribe(r=>{n||(n=!0,t.next(r)),i&&o.unsubscribe()},r=>{n=!0,t.error?.(r),i&&o.unsubscribe()});return i=!0,n&&o.unsubscribe(),o})}function wt(){return e=>new h(t=>e.subscribe(new Se(t)))}class Se{destination;last;hasLast=!1;constructor(t){this.destination=t}next(t){const n=this.last;if(this.last=t,!this.hasLast){this.hasLast=!0;return}this.destination.next([n,t])}error(t){this.destination.error?.(t)}}function gt(e){return t=>new h(n=>t.subscribe(new xe(n,e)))}class xe{destination;effect;constructor(t,n){this.destination=t,this.effect=n}next(t){try{this.effect(t)}catch(n){throw this.error(n),n}this.destination.next(t)}error(t){this.destination.error?.(t)}}var V;(function(e){e.NETWORK="network",e.VIDEO_PIPELINE="video_pipeline",e.EXTERNAL_API="external_api",e.PARSER="parser",e.DOM="dom",e.WTF="wtf",e.FATAL="fatal"})(V||(V={}));var z;(function(e){e.Armenian="58",e.Azerbaijani="57",e.Belarusian="114",e.English="3",e.Kazakh="97",e.Portuguese="73",e.Russian="0",e.Spanish="4",e.Ukrainian="1",e.Uzbek="65",e.Vietnamese="75"})(z||(z={}));const Ae="vk.com",pt=async(e,t,n)=>{const i=new URL(`https://${Ae}/js/lang-pack.js`);i.searchParams.set("format","json"),i.searchParams.set("name",t),e!==void 0&&i.searchParams.set("lang",e);const r=await(await fetch(i.toString())).json();return Oe(r,n)},Oe=(e,t)=>Object.fromEntries(Object.entries(e.keys).map(([n,i])=>[n.substring(`${t}_`.length),ve(i)])),ve=e=>Array.isArray(e)?e[0]:e;var G;(function(e){e.RU="ru",e.EN="en"})(G||(G={}));export{p as CurrentClientBrowser,f as CurrentClientDevice,V as ErrorCategory,G as InterfaceLanguage,Re as Logger,h as Observable,W as Subject,M as Subscription,Te as VERSION,z as VKNumericLanguage,et as ValueSubject,m as VideoQuality,ke as abortable,Le as addScript,Ye as areQualitiesExact,Me as assertEmptyArray,x as assertNever,Ie as assertNonNullable,Pe as assertNotEmptyArray,_e as assertNullable,Xe as assertQualityIsExact,at as buffer,ye as checkNever,Ze as cloneDeep,B as cloneDeepWith,tt as combine,ct as debounce,ce as debounceFn,Ge as detectEmbed,ae as fillWithDefault,lt as filter,dt as filterChanged,ot as fromEvent,j as getCurrentBrowser,Ve as getExponentialDelay,$e as getHighestQuality,Ue as getIOSVersion,st as interval,We as isHigher,je as isHigherOrEqual,Fe as isIOS,H as isInvariantQuality,q as isLower,qe as isLowerOrEqual,De as isMacLike,Qe as isMobile,k as isNonNullable,ee as isNullable,pt as loadVKLangPack,be as map,ft as mapTo,nt as merge,T as noop,Ne as now,rt as observableFrom,Ke as observeElementSize,mt as once,wt as pairwise,ze as safeStorage,gt as tap,ut as throttle,ue as throttleFn,Je as timeCodeToString,it as timeout,He as videoHeightToQuality,Ce as videoQualityToHeight,Be as videoSizeToQuality};
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.37-dev.7467b46e.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};
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.36",
3
+ "version": "1.0.37-dev.7467b46e.0",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",
7
7
  "license": "GPL-3.0",
8
8
  "main": "./esnext.cjs.js",
9
9
  "module": "./esnext.esm.js",
10
- "types": "./index.d.ts",
10
+ "types": "./types/index.d.ts",
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": {
14
14
  "import": "./esnext.esm.js",
15
15
  "require": "./esnext.cjs.js",
16
- "types": "./index.d.ts"
16
+ "types": "./types/index.d.ts"
17
17
  },
18
18
  "./evergreen": {
19
19
  "import": "./evergreen.esm.js",
20
20
  "require": "./evergreen.cjs.js",
21
- "types": "./index.d.ts"
21
+ "types": "./types/index.d.ts"
22
22
  },
23
23
  "./esnext": {
24
24
  "import": "./esnext.esm.js",
25
25
  "require": "./esnext.cjs.js",
26
- "types": "./index.d.ts"
26
+ "types": "./types/index.d.ts"
27
27
  },
28
28
  "./es2018": {
29
29
  "import": "./es2018.esm.js",
30
30
  "require": "./es2018.cjs.js",
31
- "types": "./index.d.ts"
31
+ "types": "./types/index.d.ts"
32
32
  },
33
33
  "./es2015": {
34
34
  "import": "./es2015.esm.js",
35
35
  "require": "./es2015.cjs.js",
36
- "types": "./index.d.ts"
36
+ "types": "./types/index.d.ts"
37
37
  },
38
38
  "./evergreen.esm.js": "./evergeen.esm.js",
39
39
  "./esnext.esm.js": "./esnext.esm.js",
@@ -0,0 +1,10 @@
1
+ import Subject from '../reactive/Subject';
2
+ import type { ILogger, ILogInputEntry, IComponentLogger, ILogEntry } from './types';
3
+ export declare class Logger implements ILogger {
4
+ log$: Subject<ILogEntry>;
5
+ private logs;
6
+ log: (inputEntry: ILogInputEntry) => void;
7
+ createCustomLog<TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry): (...args: TArgs) => void;
8
+ createComponentLog(component: string): IComponentLogger;
9
+ getAllLogs: () => ILogEntry[];
10
+ }
@@ -0,0 +1,2 @@
1
+ export { Logger } from './Logger';
2
+ export type { ILogger, ILogInputEntry, IComponentLogEntry, IComponentLogger, ILogEntry } from './types';
@@ -0,0 +1,30 @@
1
+ import type { IObservable } from '../reactive/types';
2
+ export interface ILogger {
3
+ log: (entry: ILogInputEntry) => void;
4
+ createCustomLog: <TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry) => (...args: TArgs) => void;
5
+ createComponentLog: (component: string) => IComponentLogger;
6
+ getAllLogs: () => ILogEntry[];
7
+ log$: IObservable<ILogEntry>;
8
+ }
9
+ export interface ILogEntry {
10
+ /**
11
+ * Сообщение.
12
+ */
13
+ message: string;
14
+ /**
15
+ * Компонент, в котором залогировано событие. (модуль, класс или функция)
16
+ */
17
+ component: string;
18
+ /**
19
+ * Время, в которое случилось логируемое событие
20
+ */
21
+ timestamp: number;
22
+ }
23
+ export type IComponentLogger = (entry: IComponentLogEntry) => void;
24
+ export type ILogInputEntry = Omit<ILogEntry, 'timestamp'>;
25
+ export interface IComponentLogEntry extends Omit<ILogInputEntry, 'component'>, IOptionalComponent {
26
+ }
27
+ interface IOptionalComponent {
28
+ component?: ILogInputEntry['component'];
29
+ }
30
+ export {};
package/types/env.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const VERSION: string;
@@ -0,0 +1,6 @@
1
+ export { VERSION } from './env';
2
+ export * from './Logger';
3
+ export * from './utils';
4
+ export * from './reactive';
5
+ export * from './types';
6
+ export * from './translation';
@@ -0,0 +1,7 @@
1
+ import type { IEmitter, IListener, IObservable, IOperator, ISubscription, IUnsubscriber } from './types';
2
+ export default class Observable<T> implements IObservable<T> {
3
+ constructor(subscribe?: (emitter: IEmitter<T>) => IUnsubscriber | ISubscription | void);
4
+ subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
5
+ pipe(...operators: IOperator<unknown, unknown>[]): IObservable<unknown>;
6
+ protected _subscribe(_emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
7
+ }
@@ -0,0 +1,10 @@
1
+ import type { IEmitter, ISubject, ISubscription, IUnsubscriber } from './types';
2
+ import Observable from './Observable';
3
+ export default class Subject<T> extends Observable<T> implements ISubject<T> {
4
+ private keyCounter;
5
+ private subscribers;
6
+ constructor();
7
+ next(value: T): void;
8
+ error(value: T): void;
9
+ protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
10
+ }
@@ -0,0 +1,6 @@
1
+ import type { ISubscription, IUnsubscriber } from './types';
2
+ export default class Subscription implements ISubscription {
3
+ private subscriptions;
4
+ unsubscribe(): void;
5
+ add(item: ISubscription | IUnsubscriber): ISubscription;
6
+ }
@@ -0,0 +1,10 @@
1
+ import type { IEmitter, ISubscription, IUnsubscriber, IValueSubject } from './types';
2
+ import Subject from './Subject';
3
+ export default class ValueSubject<T> extends Subject<T> implements IValueSubject<T> {
4
+ private value;
5
+ constructor(initialValue: T);
6
+ next(value: T): void;
7
+ error(value: T): void;
8
+ getValue(): T;
9
+ protected _subscribe(emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
10
+ }
@@ -0,0 +1,10 @@
1
+ import type { IObservable, TypeOfObservable } from './types';
2
+ /**
3
+ * Создаёт Observable, который состоит из объектов, ключами которых являются последние значения исходных Observable.
4
+ * Первое событие возникает тогда, когда каждый исходный Observable выдал хотя бы одно значение.
5
+ */
6
+ type CombineObservables<T extends Record<string, IObservable<unknown>>> = {
7
+ [key in keyof T]: TypeOfObservable<T[key]>;
8
+ };
9
+ export default function combine<T extends Record<string, IObservable<unknown>>>(observables: T): IObservable<CombineObservables<T>>;
10
+ export {};