@vkontakte/videoplayer-shared 1.0.66-dev.84662296.0 → 1.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015.cjs.js +3 -3
- package/es2015.esm.js +3 -3
- package/es2018.cjs.js +3 -3
- package/es2018.esm.js +3 -3
- package/es2024.cjs.js +3 -3
- package/es2024.esm.js +3 -3
- package/esnext.cjs.js +3 -3
- package/esnext.esm.js +3 -3
- package/evergreen.esm.js +3 -3
- package/package.json +1 -1
- package/types/reactive/Observable.d.ts +7 -0
package/evergreen.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.66
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.66
|
|
3
|
+
* Wed, 20 Aug 2025 08:27:41 GMT
|
|
4
4
|
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-66/doc/
|
|
5
5
|
*/
|
|
6
|
-
var Me=Object.defineProperty;var le=(t,e)=>{for(var r in e)Me(t,r,{get:e[r],enumerable:!0})};var Ve="1.0.66-dev.84662296.0";var b=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 y=t=>{throw new Error(`${t} is value of unexpected type`)},_e=t=>{};var g=()=>{};var Qe=t=>{throw console.error(t),t},c=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:g}:n={next:i=>r.next(i),error:i=>r.error?.(i)}:n={next:Qe,error:g};let o=typeof e=="function"?{next:i=>{try{let a=e(i);a instanceof Promise&&a.catch(u=>n.next(u))}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 b().add(()=>{switch(o.next=g,o.error=g,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return y(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var T=class extends c{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 b().add(()=>this.subscribers.delete(n))}};var z=class{constructor(){this.log$=new T;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 De(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ue(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function x(t){return typeof t<"u"&&t!==null}function S(t){return t==null}function je(t,e){if(!t?.length)throw new Error(e)}function ze(t,e){if(t?.length)throw new Error(e)}var Fe=(t,e,r)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),m.remove()});let s=()=>{a(),o("error")},i=()=>{a(),n()},a=()=>{u&&clearTimeout(u),m.removeEventListener("load",i),m.removeEventListener("error",s)},u;r&&(u=window.setTimeout(()=>{a(),o("timeout")},r));let m=document.createElement("script");m.addEventListener("load",i),m.addEventListener("error",s),m.src=t,document.head.appendChild(m)});var We=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Ge=(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 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 pe={};le(pe,{clear:()=>Xe,get:()=>qe,has:()=>$e,isPersistent:()=>Be,remove:()=>Ye,set:()=>He});var O,h,F=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(h!==void 0)return h;try{localStorage.setItem(F,"test"),localStorage.removeItem(F),h=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(F),h=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)h=2;else throw e}else throw t}return h===2&&(O=new Map),h},Be=()=>E()===0,qe=t=>{let e=E();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:y(e)}},He=(t,e)=>{let r=E();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:O?.set(t,e);return;default:y(r)}},$e=t=>{let e=E();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return y(e),!1}},Ye=t=>{let e=E();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:O?.delete(t);return;default:y(e)}},Xe=()=>{let t=E();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:y(t)}};var Je=()=>{let t,e=[];try{t=window.self!==window.top}catch(r){r instanceof DOMException&&r.name==="SecurityError"?t=!0:(t=!1,console.error(r))}try{window.location.ancestorOrigins&&(e=[...window.location.ancestorOrigins])}catch(r){console.error(r)}try{!e.length&&document.referrer&&(e=[new URL(document.referrer).origin])}catch(r){console.error(r)}return e=e.filter(r=>URL.canParse(r)),{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var W=(l=>(l.INVARIANT="Invariant quality",l.Q_144P="144p",l.Q_240P="240p",l.Q_360P="360p",l.Q_480P="480p",l.Q_576P="576p",l.Q_720P="720p",l.Q_1080P="1080p",l.Q_1440P="1440p",l.Q_2160P="2160p",l.Q_4320P="4320p",l))(W||{});var d={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"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}},Ze=(t,e)=>d[t].height>d[e].height,et=(t,e)=>d[t].height>=d[e].height,G=(t,e)=>d[t].height<d[e].height,tt=(t,e)=>d[t].height<=d[e].height,rt=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:G(e,r)?1:-1)[0],ue=Object.keys(d).sort((t,e)=>G(t,e)?-1:1),nt=(t,e=.02)=>[...ue].find(n=>d[n].height*(1+e)>=t),ot=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return ue.find(o=>{let s=d[o];return s.width>=n&&s.height>=r})},it=t=>d[t].height,K=t=>t==="Invariant quality",st=t=>t.every(e=>!K(e));function at(t){if(K(t))throw new Error("Expected exact quality")}var ct=(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]=ct(s,o):r[n]=n in t?s:o}return r};var pr=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function B(t,e=0,r){let n,o,s,i,a,u,m=0,oe=!1,l=!1,U=!0,ie=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(oe=!!r.leading,l="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,U="trailing"in r?!!r.trailing:U);function j(p){let f=n,v=o;return n=o=void 0,m=p,i=t.apply(v,f),i}function R(p,f){return ie?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(p)):setTimeout(p,f)}function Re(p){if(ie){window.cancelAnimationFrame(p);return}clearTimeout(p)}function ke(p){return m=p,a=R(k,e),oe?j(p):i}function Pe(p){let f=p-u,v=p-m,ce=e-f;return l?Math.min(ce,s-v):ce}function se(p){let f=p-u,v=p-m;return u===void 0||f>=e||f<0||l&&v>=s}function k(){let p=Date.now();if(se(p))return ae(p);a=R(k,Pe(p))}function ae(p){return a=void 0,U&&n?j(p):(n=o=void 0,i)}function Le(){a!==void 0&&Re(a),m=0,n=u=o=a=void 0}function Ne(){return a===void 0?i:ae(Date.now())}function Ce(){return a!==void 0}function P(...p){let f=Date.now(),v=se(f);if(n=p,o=this,u=f,v){if(a===void 0)return ke(u);if(l)return a=R(k,e),j(u)}return a===void 0&&(a=R(k,e)),i}return P.cancel=Le,P.flush=Ne,P.pending=Ce,P}var q=(t,e=0,r)=>B(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 o=e(t[n],n,t,r);if(o!==void 0){r[n]=o;continue}}typeof t[n]=="object"?r[n]=L(t[n],e):r[n]=t[n]}return r};var lt=t=>L(t);var pt=300,ut=(t,e=pt)=>new c(r=>{let{width:n,height:o}=t.getBoundingClientRect();if(r.next({width:n,height:o}),!window.ResizeObserver)return;let s=new ResizeObserver(q(i=>{let a=i[0];if(!a)return;let u,m;a.contentBoxSize&&a.contentBoxSize[0]?(m=a.contentBoxSize[0].blockSize,u=a.contentBoxSize[0].inlineSize):a.contentRect&&(u=a.contentRect.width,m=a.contentRect.height),x(u)&&x(m)&&r.next({width:u,height:m})},e));return s.observe(t),()=>s.disconnect()});var N=(t,e=6,r=".")=>{let n={};for(let o in t)if(!(!t.hasOwnProperty(o)||t[o]instanceof HTMLElement||!e))if(typeof t[o]=="object"&&t[o]!==null){let s=N(t[o],e-1);for(let i in s)s.hasOwnProperty(i)&&(n[o+r+i]=s[i])}else n[o]=t[o];return n};var mt=t=>{t.removeAttribute("src"),t.load()};var Or=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var bt=(t,e)=>!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom);var dt=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?N(r):{value:r})},C=(t={})=>{let e=n=>{let o=n;return n===void 0?o="undefined":n===null?o="null":(typeof n=="number"||typeof n=="boolean")&&(o=n.toString()),o},r={};for(let n in t)Array.isArray(t[n])?r[n]=t[n].map(e):r[n]=e(t[n]);return r};var I=class t{constructor({name:e,getParentContext:r}){this.dynamicImportTimeout=5e3;this.childTracers=[];t.dynamicImportStatus==="not_started"&&(t.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=t.dynamicImportPromise.then(o=>{t.dynamicImportStatus==="completed"&&this.init({name:e,getParentContext:r},n)})}static{this.dynamicImportStatus="not_started"}init({name:e,getParentContext:r},n){this.span=t.rootTracer.startSpan(e,{startTime:n},r?.()),this.context=t.dynamicImports.opentelemetryApi.trace.setSpan(t.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(t.dynamicImportStatus==="not_started"){t.dynamicImportStatus="in_progress";try{let e=new Promise((i,a)=>setTimeout(a,this.dynamicImportTimeout)),r=Promise.all([import("@opentelemetry/api"),import("@opentelemetry/sdk-trace-web"),import("@tracer/opentelemetry")]),[n,o,s]=await Promise.race([r,e]);t.dynamicImports={opentelemetryApi:n,opentelemetrySdk:o,tracer:s},t.dynamicImportStatus="completed"}catch{t.dynamicImportStatus="failed"}}}isComponentTracerNotInitialized(){return S(this.span)||t.dynamicImportStatus==="failed"}log(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...C(r),type:"log"},n)})}error(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...C(r),type:"error"},n)})}critical(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...C(r),type:"critical"},n)})}createComponentTracer(e){let r=new t({name:e,getParentContext:()=>this.context});return this.childTracers.push(r),r}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(r=>r.end()),this.span.end())})}};var M=class extends I{constructor(){super({name:"Root"})}init({name:e,getParentContext:r},n){let s=I.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),i=new I.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=i,s.addSpanProcessor(new I.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:i})),I.rootTracer=s.getTracer("sdk-videoplayer-tracer"),super.init({name:e,getParentContext:r},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?"":this.span.spanContext().traceId}};var V=class t{constructor(e){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}};var H=class{static createRootTracer(e=!1){return e?new M:new V}};var w=class extends T{constructor(r){super();this.buffer=[];this.cursorEnd=-1;this.cursorStart=0;this.bufferSize=r,this.buffer=Array(r)}next(r){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=r,this.subscribers.forEach(n=>n.next(r))}_subscribe(r){for(let o=this.cursorStart;o<=this.cursorEnd;o++)r.next(this.buffer[o%this.bufferSize]);let n=this.keyCounter++;return this.subscribers.set(n,r),new b().add(()=>this.subscribers.delete(n))}};var _=class extends T{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let r=super._subscribe(e);return e.next(this.value),r}};function me(t){return new c(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 b)})}function be(...t){return new c(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var ft=t=>new c(e=>{let r=window.setTimeout(()=>{try{e.next()}catch(n){if(e.error)e.error(n);else throw n}},t);return()=>window.clearTimeout(r)});var Tt=t=>new c(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var yt=t=>new c(e=>{t.forEach(r=>e.next(r))});var It=(t,e)=>new c(r=>{let n=o=>r.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});var Q=class extends b{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function de(t){return e=>new c(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 vt={leading:!1,trailing:!0};function fe(t,e=vt){return r=>new c(n=>r.subscribe(new Y(n,t,e)))}var Y=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,x(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var ht={leading:!0,trailing:!1};function Te(t,e=ht){return r=>new c(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,S(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 ye(t){return e=>new c(r=>e.subscribe(new J(r,t)))}var J=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};var gt=(t,e)=>{let r=(n,o)=>{let s=Object.keys(n);for(let i in o)if(!s.includes(i)||o[i]!==n[i])return!1;return!0};return r(t,e)&&r(e,t)},xt=(t,e)=>t instanceof Object&&e instanceof Object?gt(t,e):t===e;function ve(t=xt){return e=>new c(r=>e.subscribe(new Z(r,t)))}var Ie={},Z=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=Ie}next(e){let r;try{r=this.lastValue===Ie||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object?{...e}:e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function D(t){return e=>new c(r=>e.subscribe(new ee(r,t)))}var ee=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 he(t){return D(()=>t)}function ge(){return t=>new c(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 xe(){return t=>new c(e=>t.subscribe(new te(e)))}var te=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 Oe(t){return e=>new c(r=>e.subscribe(new re(r,t)))}var re=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)}};function Ee(t){return e=>new c(r=>e.subscribe(new ne(r,t)))}var ne=class{constructor(e,r){this.destination=e;this.count=r;r<0&&this.destination.error?.(new Error("Count can not be less than zero"))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}};function we(t=0){return e=>{let r=0,n=new w(t),o=e.subscribe(n),s=i=>()=>{i.unsubscribe(),r--,r===0&&o.unsubscribe()};return new c(i=>(r++,s(n.subscribe(i))))}}var Ot=(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))(Ot||{});var Et=(l=>(l.Armenian="58",l.Azerbaijani="57",l.Belarusian="114",l.English="3",l.Kazakh="97",l.Portuguese="73",l.Russian="0",l.Spanish="4",l.Ukrainian="1",l.Uzbek="65",l.Vietnamese="75",l))(Et||{}),wt="vk.com",Jo=async(t,e,r)=>{let n=new URL(`https://${wt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return St(s,r)},St=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),At(n)])),At=t=>Array.isArray(t)?t[0]:t;var Rt=(r=>(r.RU="ru",r.EN="en",r))(Rt||{});var kt={UI:"__vkVideoPlayer",CORE:"__vkVideoCore"},Pt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),Se=class{constructor(e){this.id=Pt();this.type=e,this.initWindowObjects()}getWindowObject(){let e=this.key();return window[e]?.[this.id]??{}}initWindowObjects(){let e=this.key();window[e]||(window[e]={}),window[e][this.id]={}}expose(e){Object.assign(this.getWindowObject(),e)}destroy(){let e=this.key();window&&window[e]&&window[e][this.id]&&(delete window[e][this.id],Object.keys(window[e]).length||delete window[e])}key(){let{type:e}=this;return kt[e]}};var Ae={};le(Ae,{create:()=>Lt,destroy:()=>Nt,push:()=>Ct,subscribe:()=>Mt});var A=new Map,Lt=(t,e)=>A.set(t,e??[]),Nt=t=>A.delete(t),Ct=(t,e)=>{let r=A.get(t);r&&(typeof r=="function"?r(e):r.push(e))},Mt=(t,e)=>{let r=A.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);A.set(t,e)}};export{Ot as ErrorCategory,Rt as InterfaceLanguage,Se as InternalsExposure,z as Logger,c as Observable,w as ReplaySubject,T as Subject,b as Subscription,Q as SubscriptionRemovable,H as TracerFactory,Ve as VERSION,Et as VKNumericLanguage,_ as ValueSubject,W as VideoQuality,Ge as abortable,Fe as addScript,st as areQualitiesExact,ze as assertEmptyArray,y as assertNever,De as assertNonNullable,je as assertNotEmptyArray,Ue as assertNullable,at as assertQualityIsExact,de as buffer,_e as checkNever,mt as clearVideoElement,lt as cloneDeep,L as cloneDeepWith,me as combine,fe as debounce,B as debounceFn,Je as detectEmbed,Ae as devNull,ct as fillWithDefault,ye as filter,ve as filterChanged,N as flattenObject,It as fromEvent,Ke as getExponentialDelay,rt as getHighestQuality,dt as getTraceSubscriptionMethod,Tt as interval,Ze as isHigher,et as isHigherOrEqual,bt as isIntersecting,K as isInvariantQuality,G as isLower,tt as isLowerOrEqual,x as isNonNullable,S as isNullable,Or as isValidURL,Jo as loadVKLangPack,D as map,he as mapTo,be as merge,g as noop,We as now,yt as observableFrom,ut as observeElementSize,ge as once,xe as pairwise,pe as safeStorage,we as shareReplay,Ee as skip,Oe as tap,Te as throttle,q as throttleFn,pr as timeCodeToString,ft as timeout,nt as videoHeightToQuality,it as videoQualityToHeight,ot as videoSizeToQuality};
|
|
6
|
+
var Me=Object.defineProperty;var le=(t,e)=>{for(var r in e)Me(t,r,{get:e[r],enumerable:!0})};var Ve="1.0.66";var b=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 y=t=>{throw new Error(`${t} is value of unexpected type`)},_e=t=>{};var g=()=>{};var Qe=t=>{throw console.error(t),t},De=t=>{console.error(t)},c=class{constructor(e){this.suppressErrors=!1;e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,r){let n=this.suppressErrors?De:Qe,o;r?typeof r=="function"?o={next:r,error:g}:o={next:s=>r.next(s),error:s=>r.error?.(s)}:o={next:n,error:g};let i=typeof e=="function"?{next:s=>{try{let u=e(s);u instanceof Promise&&u.catch(m=>o.next(m))}catch(u){o.next(u)}},error:s=>o.next(s)}:{next:s=>e.next(s),error:s=>e.error?e.error(s):o.next(s)},a;try{a=this._subscribe(i)}catch(s){i.error?.(s)}return new b().add(()=>{switch(i.next=g,i.error=g,typeof a){case"function":a();return;case"object":a.unsubscribe();return;case"undefined":return;default:return y(a)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var T=class extends c{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 b().add(()=>this.subscribers.delete(n))}};var z=class{constructor(){this.log$=new T;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 Ue(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function je(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function x(t){return typeof t<"u"&&t!==null}function S(t){return t==null}function ze(t,e){if(!t?.length)throw new Error(e)}function Fe(t,e){if(t?.length)throw new Error(e)}var We=(t,e,r)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{s(),m.remove()});let i=()=>{s(),o("error")},a=()=>{s(),n()},s=()=>{u&&clearTimeout(u),m.removeEventListener("load",a),m.removeEventListener("error",i)},u;r&&(u=window.setTimeout(()=>{s(),o("timeout")},r));let m=document.createElement("script");m.addEventListener("load",a),m.addEventListener("error",i),m.src=t,document.head.appendChild(m)});var Ge=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Ke=(t,e)=>async(...r)=>{let n=e(...r),o=t.aborted,i;for(;!o&&!t.aborted;)try{let a=await n.next(i);o=a.done??!1,i=a.value}catch(a){await n.throw(a)}return i};var Be=(t,{start:e=0,factor:r=2,max:n=1/0,min:o=e,random:i=0}={})=>{let a=e;return a*=r**t,a*=1+(Math.random()*i*2-i),a=Math.round(a),a=Math.min(a,n),a=Math.max(a,o),a};var pe={};le(pe,{clear:()=>Je,get:()=>He,has:()=>Ye,isPersistent:()=>qe,remove:()=>Xe,set:()=>$e});var O,h,F=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(h!==void 0)return h;try{localStorage.setItem(F,"test"),localStorage.removeItem(F),h=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(F),h=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)h=2;else throw e}else throw t}return h===2&&(O=new Map),h},qe=()=>E()===0,He=t=>{let e=E();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:y(e)}},$e=(t,e)=>{let r=E();switch(r){case 0:try{localStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 1:try{sessionStorage.setItem(t,e)}catch(n){if(n instanceof DOMException)console.error(n);else throw n}break;case 2:O?.set(t,e);return;default:y(r)}},Ye=t=>{let e=E();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return O?.has(t)??!1;default:return y(e),!1}},Xe=t=>{let e=E();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:O?.delete(t);return;default:y(e)}},Je=()=>{let t=E();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return O?.clear();default:y(t)}};var Ze=()=>{let t,e=[];try{t=window.self!==window.top}catch(r){r instanceof DOMException&&r.name==="SecurityError"?t=!0:(t=!1,console.error(r))}try{window.location.ancestorOrigins&&(e=[...window.location.ancestorOrigins])}catch(r){console.error(r)}try{!e.length&&document.referrer&&(e=[new URL(document.referrer).origin])}catch(r){console.error(r)}return e=e.filter(r=>URL.canParse(r)),{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var W=(l=>(l.INVARIANT="Invariant quality",l.Q_144P="144p",l.Q_240P="240p",l.Q_360P="360p",l.Q_480P="480p",l.Q_576P="576p",l.Q_720P="720p",l.Q_1080P="1080p",l.Q_1440P="1440p",l.Q_2160P="2160p",l.Q_4320P="4320p",l))(W||{});var d={"144p":{width:256,height:144},"240p":{width:428,height:240},"360p":{width:640,height:360},"480p":{width:856,height:480},"576p":{width:1024,height:576},"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}},et=(t,e)=>d[t].height>d[e].height,tt=(t,e)=>d[t].height>=d[e].height,G=(t,e)=>d[t].height<d[e].height,rt=(t,e)=>d[t].height<=d[e].height,nt=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:G(e,r)?1:-1)[0],ue=Object.keys(d).sort((t,e)=>G(t,e)?-1:1),ot=(t,e=.02)=>[...ue].find(n=>d[n].height*(1+e)>=t),it=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return ue.find(o=>{let i=d[o];return i.width>=n&&i.height>=r})},st=t=>d[t].height,K=t=>t==="Invariant quality",at=t=>t.every(e=>!K(e));function ct(t){if(K(t))throw new Error("Expected exact quality")}var lt=(t,e)=>{let r={};for(let n of Object.keys(e)){let o=e[n],i=t[n];Array.isArray(o)&&Array.isArray(i)?r[n]=i:typeof o=="object"&&typeof i=="object"?r[n]=lt(i,o):r[n]=n in t?i:o}return r};var ur=t=>{let e="";return t>=3600&&(e+=Math.floor(t/3600)+"h",t=t%3600),t>=60&&(e+=Math.floor(t/60)+"m",t=t%60),t>0&&(e+=Math.floor(t)+"s"),e};function B(t,e=0,r){let n,o,i,a,s,u,m=0,oe=!1,l=!1,U=!0,ie=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(oe=!!r.leading,l="maxWait"in r,i=r?.maxWait?Math.max(+r?.maxWait||0,e):i,U="trailing"in r?!!r.trailing:U);function j(p){let f=n,v=o;return n=o=void 0,m=p,a=t.apply(v,f),a}function R(p,f){return ie?(s&&window.cancelAnimationFrame(s),window.requestAnimationFrame(p)):setTimeout(p,f)}function Re(p){if(ie){window.cancelAnimationFrame(p);return}clearTimeout(p)}function ke(p){return m=p,s=R(k,e),oe?j(p):a}function Pe(p){let f=p-u,v=p-m,ce=e-f;return l?Math.min(ce,i-v):ce}function se(p){let f=p-u,v=p-m;return u===void 0||f>=e||f<0||l&&v>=i}function k(){let p=Date.now();if(se(p))return ae(p);s=R(k,Pe(p))}function ae(p){return s=void 0,U&&n?j(p):(n=o=void 0,a)}function Le(){s!==void 0&&Re(s),m=0,n=u=o=s=void 0}function Ne(){return s===void 0?a:ae(Date.now())}function Ce(){return s!==void 0}function P(...p){let f=Date.now(),v=se(f);if(n=p,o=this,u=f,v){if(s===void 0)return ke(u);if(l)return s=R(k,e),j(u)}return s===void 0&&(s=R(k,e)),a}return P.cancel=Le,P.flush=Ne,P.pending=Ce,P}var q=(t,e=0,r)=>B(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 o=e(t[n],n,t,r);if(o!==void 0){r[n]=o;continue}}typeof t[n]=="object"?r[n]=L(t[n],e):r[n]=t[n]}return r};var pt=t=>L(t);var ut=300,mt=(t,e=ut)=>new c(r=>{let{width:n,height:o}=t.getBoundingClientRect();if(r.next({width:n,height:o}),!window.ResizeObserver)return;let i=new ResizeObserver(q(a=>{let s=a[0];if(!s)return;let u,m;s.contentBoxSize&&s.contentBoxSize[0]?(m=s.contentBoxSize[0].blockSize,u=s.contentBoxSize[0].inlineSize):s.contentRect&&(u=s.contentRect.width,m=s.contentRect.height),x(u)&&x(m)&&r.next({width:u,height:m})},e));return i.observe(t),()=>i.disconnect()});var N=(t,e=6,r=".")=>{let n={};for(let o in t)if(!(!t.hasOwnProperty(o)||t[o]instanceof HTMLElement||!e))if(typeof t[o]=="object"&&t[o]!==null){let i=N(t[o],e-1);for(let a in i)i.hasOwnProperty(a)&&(n[o+r+a]=i[a])}else n[o]=t[o];return n};var bt=t=>{t.removeAttribute("src"),t.load()};var Er=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var dt=(t,e)=>!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom);var ft=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?N(r):{value:r})},C=(t={})=>{let e=n=>{let o=n;return n===void 0?o="undefined":n===null?o="null":(typeof n=="number"||typeof n=="boolean")&&(o=n.toString()),o},r={};for(let n in t)Array.isArray(t[n])?r[n]=t[n].map(e):r[n]=e(t[n]);return r};var I=class t{constructor({name:e,getParentContext:r}){this.dynamicImportTimeout=5e3;this.childTracers=[];t.dynamicImportStatus==="not_started"&&(t.dynamicImportPromise=this.loadOpentelemetry());let n=Date.now();this.initPromise=t.dynamicImportPromise.then(o=>{t.dynamicImportStatus==="completed"&&this.init({name:e,getParentContext:r},n)})}static{this.dynamicImportStatus="not_started"}init({name:e,getParentContext:r},n){this.span=t.rootTracer.startSpan(e,{startTime:n},r?.()),this.context=t.dynamicImports.opentelemetryApi.trace.setSpan(t.dynamicImports.opentelemetryApi.context.active(),this.span)}async loadOpentelemetry(){if(t.dynamicImportStatus==="not_started"){t.dynamicImportStatus="in_progress";try{let e=new Promise((a,s)=>setTimeout(s,this.dynamicImportTimeout)),r=Promise.all([import("@opentelemetry/api"),import("@opentelemetry/sdk-trace-web"),import("@tracer/opentelemetry")]),[n,o,i]=await Promise.race([r,e]);t.dynamicImports={opentelemetryApi:n,opentelemetrySdk:o,tracer:i},t.dynamicImportStatus="completed"}catch{t.dynamicImportStatus="failed"}}}isComponentTracerNotInitialized(){return S(this.span)||t.dynamicImportStatus==="failed"}log(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...C(r),type:"log"},n)})}error(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...C(r),type:"error"},n)})}critical(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...C(r),type:"critical"},n)})}createComponentTracer(e){let r=new t({name:e,getParentContext:()=>this.context});return this.childTracers.push(r),r}end(){this.initPromise.then(e=>{this.isComponentTracerNotInitialized()||(this.childTracers.forEach(r=>r.end()),this.span.end())})}};var M=class extends I{constructor(){super({name:"Root"})}init({name:e,getParentContext:r},n){let i=I.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),a=new I.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=a,i.addSpanProcessor(new I.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:a})),I.rootTracer=i.getTracer("sdk-videoplayer-tracer"),super.init({name:e,getParentContext:r},n)}getFinishedSpans(){if(!this.isComponentTracerNotInitialized())return this.spanExporter?.getJsonData()}getTraceId(){return this.isComponentTracerNotInitialized()?"":this.span.spanContext().traceId}};var V=class t{constructor(e){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}};var H=class{static createRootTracer(e=!1){return e?new M:new V}};var w=class extends T{constructor(r){super();this.buffer=[];this.cursorEnd=-1;this.cursorStart=0;this.bufferSize=r,this.buffer=Array(r)}next(r){this.cursorEnd+=1,this.cursorStart=this.cursorEnd>=this.bufferSize?this.cursorStart+1:0,this.buffer[this.cursorEnd%this.bufferSize]=r,this.subscribers.forEach(n=>n.next(r))}_subscribe(r){for(let o=this.cursorStart;o<=this.cursorEnd;o++)r.next(this.buffer[o%this.bufferSize]);let n=this.keyCounter++;return this.subscribers.set(n,r),new b().add(()=>this.subscribers.delete(n))}};var _=class extends T{constructor(e){super(),this.value=e}next(e){super.next(this.value=e)}error(e){super.error(this.value=e)}getValue(){return this.value}_subscribe(e){let r=super._subscribe(e);return e.next(this.value),r}};function me(t){return new c(e=>{let r={},n=Object.keys(t).length,o=i=>a=>{i in r||n--,r[i]=a,n===0&&e.next(r)};return Object.entries(t).reduce((i,[a,s])=>i.add(s.subscribe(o(a))),new b)})}function be(...t){return new c(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var Tt=t=>new c(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 yt=t=>new c(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var It=t=>new c(e=>{t.forEach(r=>e.next(r))});var vt=(t,e)=>new c(r=>{let n=o=>r.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});var Q=class extends b{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function de(t){return e=>new c(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 ht={leading:!1,trailing:!0};function fe(t,e=ht){return r=>new c(n=>r.subscribe(new Y(n,t,e)))}var Y=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,x(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{if(this.config.trailing)try{this.destination.next(this.lastValue)}catch(r){if(this.destination.error)this.destination.error(r);else throw r}this.timeout=void 0},this.time)}error(e){this.destination.error?.(e)}};var gt={leading:!0,trailing:!1};function Te(t,e=gt){return r=>new c(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,S(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 ye(t){return e=>new c(r=>e.subscribe(new J(r,t)))}var J=class{constructor(e,r){this.destination=e;this.predicate=r}next(e){let r;try{r=this.predicate(e)}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};var xt=(t,e)=>{let r=(n,o)=>{let i=Object.keys(n);for(let a in o)if(!i.includes(a)||o[a]!==n[a])return!1;return!0};return r(t,e)&&r(e,t)},Ot=(t,e)=>t instanceof Object&&e instanceof Object?xt(t,e):t===e;function ve(t=Ot){return e=>new c(r=>e.subscribe(new Z(r,t)))}var Ie={},Z=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=Ie}next(e){let r;try{r=this.lastValue===Ie||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object?{...e}:e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function D(t){return e=>new c(r=>e.subscribe(new ee(r,t)))}var ee=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 he(t){return D(()=>t)}function ge(){return t=>new c(e=>{let r=!1,n=!1,o=t.subscribe(i=>{r||(r=!0,e.next(i)),n&&o.unsubscribe()},i=>{r=!0,e.error?.(i),n&&o.unsubscribe()});return n=!0,r&&o.unsubscribe(),o})}function xe(){return t=>new c(e=>t.subscribe(new te(e)))}var te=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 Oe(t){return e=>new c(r=>e.subscribe(new re(r,t)))}var re=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)}};function Ee(t){return e=>new c(r=>e.subscribe(new ne(r,t)))}var ne=class{constructor(e,r){this.destination=e;this.count=r;r<0&&this.destination.error?.(new Error("Count can not be less than zero"))}next(e){this.count===0?this.destination.next(e):this.count--}error(e){this.destination.error?.(e)}};function we(t=0){return e=>{let r=0,n=new w(t),o=e.subscribe(n),i=a=>()=>{a.unsubscribe(),r--,r===0&&o.unsubscribe()};return new c(a=>(r++,i(n.subscribe(a))))}}var Et=(s=>(s.NETWORK="network",s.VIDEO_PIPELINE="video_pipeline",s.EXTERNAL_API="external_api",s.PARSER="parser",s.DOM="dom",s.WTF="wtf",s.FATAL="fatal",s))(Et||{});var wt=(l=>(l.Armenian="58",l.Azerbaijani="57",l.Belarusian="114",l.English="3",l.Kazakh="97",l.Portuguese="73",l.Russian="0",l.Spanish="4",l.Ukrainian="1",l.Uzbek="65",l.Vietnamese="75",l))(wt||{}),St="vk.com",Zo=async(t,e,r)=>{let n=new URL(`https://${St}/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 At(i,r)},At=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Rt(n)])),Rt=t=>Array.isArray(t)?t[0]:t;var kt=(r=>(r.RU="ru",r.EN="en",r))(kt||{});var Pt={UI:"__vkVideoPlayer",CORE:"__vkVideoCore"},Lt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),Se=class{constructor(e){this.id=Lt();this.type=e,this.initWindowObjects()}getWindowObject(){let e=this.key();return window[e]?.[this.id]??{}}initWindowObjects(){let e=this.key();window[e]||(window[e]={}),window[e][this.id]={}}expose(e){Object.assign(this.getWindowObject(),e)}destroy(){let e=this.key();window&&window[e]&&window[e][this.id]&&(delete window[e][this.id],Object.keys(window[e]).length||delete window[e])}key(){let{type:e}=this;return Pt[e]}};var Ae={};le(Ae,{create:()=>Nt,destroy:()=>Ct,push:()=>Mt,subscribe:()=>Vt});var A=new Map,Nt=(t,e)=>A.set(t,e??[]),Ct=t=>A.delete(t),Mt=(t,e)=>{let r=A.get(t);r&&(typeof r=="function"?r(e):r.push(e))},Vt=(t,e)=>{let r=A.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);A.set(t,e)}};export{Et as ErrorCategory,kt as InterfaceLanguage,Se as InternalsExposure,z as Logger,c as Observable,w as ReplaySubject,T as Subject,b as Subscription,Q as SubscriptionRemovable,H as TracerFactory,Ve as VERSION,wt as VKNumericLanguage,_ as ValueSubject,W as VideoQuality,Ke as abortable,We as addScript,at as areQualitiesExact,Fe as assertEmptyArray,y as assertNever,Ue as assertNonNullable,ze as assertNotEmptyArray,je as assertNullable,ct as assertQualityIsExact,de as buffer,_e as checkNever,bt as clearVideoElement,pt as cloneDeep,L as cloneDeepWith,me as combine,fe as debounce,B as debounceFn,Ze as detectEmbed,Ae as devNull,lt as fillWithDefault,ye as filter,ve as filterChanged,N as flattenObject,vt as fromEvent,Be as getExponentialDelay,nt as getHighestQuality,ft as getTraceSubscriptionMethod,yt as interval,et as isHigher,tt as isHigherOrEqual,dt as isIntersecting,K as isInvariantQuality,G as isLower,rt as isLowerOrEqual,x as isNonNullable,S as isNullable,Er as isValidURL,Zo as loadVKLangPack,D as map,he as mapTo,be as merge,g as noop,Ge as now,It as observableFrom,mt as observeElementSize,ge as once,xe as pairwise,pe as safeStorage,we as shareReplay,Ee as skip,Oe as tap,Te as throttle,q as throttleFn,ur as timeCodeToString,Tt as timeout,ot as videoHeightToQuality,st as videoQualityToHeight,it as videoSizeToQuality};
|
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { IEmitter, IListener, IObservable, IOperator, ISubscription, IUnsubscriber } from './types';
|
|
2
2
|
export default class Observable<T> implements IObservable<T> {
|
|
3
|
+
private suppressErrors;
|
|
3
4
|
constructor(subscribe?: (emitter: IEmitter<T>) => IUnsubscriber | ISubscription | void);
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Глушить ошибки не стоит.
|
|
7
|
+
* Раньше у нас они по-умолчанию ошибочно глушились что маскировало многие исключения, в том числе грубые ошибки
|
|
8
|
+
* Этот метод нужен чтобы временно поддержать старрое поведение пока маскиуремые ошибки не исправятся
|
|
9
|
+
*/
|
|
10
|
+
setSuppressErrors(suppress: boolean): void;
|
|
4
11
|
subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
|
|
5
12
|
pipe<K = unknown>(...operators: IOperator<unknown, unknown>[]): IObservable<K>;
|
|
6
13
|
protected _subscribe(_emitter: IEmitter<T>): IUnsubscriber | ISubscription | void;
|