@vkontakte/videoplayer-shared 1.0.69 → 1.0.70-dev.048743c0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015.cjs.js +4 -4
- package/es2015.esm.js +4 -4
- package/es2018.cjs.js +4 -4
- package/es2018.esm.js +4 -4
- package/es2024.cjs.js +4 -4
- package/es2024.esm.js +4 -4
- package/esnext.cjs.js +4 -4
- package/esnext.esm.js +4 -4
- package/evergreen.esm.js +4 -4
- package/package.json +1 -1
- package/types/utils/getRangeAroundIndex.d.ts +7 -0
- package/types/utils/index.d.ts +2 -0
- package/types/utils/interpolate.d.ts +15 -0
package/evergreen.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
4
|
-
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.70-dev.048743c0.0
|
|
3
|
+
* Thu, 09 Oct 2025 17:19:58 GMT
|
|
4
|
+
* https://st.mycdn.me/static/vkontakte-videoplayer/1-0-70/doc/
|
|
5
5
|
*/
|
|
6
|
-
var Ve=Object.defineProperty;var pe=(t,e)=>{for(var r in e)Ve(t,r,{get:e[r],enumerable:!0})};var _e="1.0.69";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 I=t=>{throw new Error(`${t} is value of unexpected type`)},Qe=t=>{};var x=()=>{};var De=t=>{throw console.error(t),t},Ue=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?Ue:De,o;r?typeof r=="function"?o={next:r,error:x}:o={next:s=>r.next(s),error:s=>r.error?.(s)}:o={next:n,error:x};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=x,i.error=x,typeof a){case"function":a();return;case"object":a.unsubscribe();return;case"undefined":return;default:return I(a)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var y=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 F=class{constructor(){this.log$=new y;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 je(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function ze(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function O(t){return typeof t<"u"&&t!==null}function A(t){return t==null}function Fe(t,e){if(!t?.length)throw new Error(e)}function We(t,e){if(t?.length)throw new Error(e)}var Ge=(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 Ke=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Be=(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 qe=(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 ue={};pe(ue,{clear:()=>Ze,get:()=>$e,has:()=>Ye,isPersistent:()=>He,remove:()=>Je,set:()=>Xe});var w,h,W=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(h!==void 0)return h;try{localStorage.setItem(W,"test"),localStorage.removeItem(W),h=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(W),h=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)h=2;else throw e}else throw t}return h===2&&(w=new Map),h},He=()=>E()===0,$e=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 w?.get(t);default:I(e)}},Xe=(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:w?.set(t,e);return;default:I(r)}},Ye=t=>{let e=E();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return w?.has(t)??!1;default:return I(e),!1}},Je=t=>{let e=E();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:w?.delete(t);return;default:I(e)}},Ze=()=>{let t=E();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return w?.clear();default:I(t)}};var et=()=>{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 G=(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))(G||{});var f={"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}},tt=(t,e)=>f[t].height>f[e].height,rt=(t,e)=>f[t].height>=f[e].height,K=(t,e)=>f[t].height<f[e].height,nt=(t,e)=>f[t].height<=f[e].height,ot=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:K(e,r)?1:-1)[0],me=Object.keys(f).sort((t,e)=>K(t,e)?-1:1),it=(t,e=.02)=>[...me].find(n=>f[n].height*(1+e)>=t),st=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return me.find(o=>{let i=f[o];return i.width>=n&&i.height>=r})},at=t=>f[t].height,B=t=>t==="Invariant quality",ct=t=>t.every(e=>!B(e));function lt(t){if(B(t))throw new Error("Expected exact quality")}var pt=(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]=pt(i,o):r[n]=n in t?i:o}return r};var mr=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 q(t,e=0,r){let n,o,i,a,s,u,m=0,ie=!1,l=!1,j=!0,se=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(ie=!!r.leading,l="maxWait"in r,i=r?.maxWait?Math.max(+r?.maxWait||0,e):i,j="trailing"in r?!!r.trailing:j);function z(p){let T=n,g=o;return n=o=void 0,m=p,a=t.apply(g,T),a}function k(p,T){return se?(s&&window.cancelAnimationFrame(s),window.requestAnimationFrame(p)):setTimeout(p,T)}function ke(p){if(se){window.cancelAnimationFrame(p);return}clearTimeout(p)}function Pe(p){return m=p,s=k(P,e),ie?z(p):a}function Le(p){let T=p-u,g=p-m,le=e-T;return l?Math.min(le,i-g):le}function ae(p){let T=p-u,g=p-m;return u===void 0||T>=e||T<0||l&&g>=i}function P(){let p=Date.now();if(ae(p))return ce(p);s=k(P,Le(p))}function ce(p){return s=void 0,j&&n?z(p):(n=o=void 0,a)}function Ne(){s!==void 0&&ke(s),m=0,n=u=o=s=void 0}function Ce(){return s===void 0?a:ce(Date.now())}function Me(){return s!==void 0}function L(...p){let T=Date.now(),g=ae(T);if(n=p,o=this,u=T,g){if(s===void 0)return Pe(u);if(l)return s=k(P,e),z(u)}return s===void 0&&(s=k(P,e)),a}return L.cancel=Ne,L.flush=Ce,L.pending=Me,L}var H=(t,e=0,r)=>q(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var N=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let o=e(t[n],n,t,r);if(o!==void 0){r[n]=o;continue}}typeof t[n]=="object"?r[n]=N(t[n],e):r[n]=t[n]}return r};var ut=t=>N(t);var mt=300,bt=(t,e=mt)=>new c(r=>{let{width:n,height:o}=t.getBoundingClientRect();if(r.next({width:n,height:o}),!window.ResizeObserver)return;let i=new ResizeObserver(H(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),O(u)&&O(m)&&r.next({width:u,height:m})},e));return i.observe(t),()=>i.disconnect()});var C=(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=C(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 dt=t=>{t.removeAttribute("src"),t.load()};var Er=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var ft=(t,e)=>!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom);var Tt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),yt=t=>t!==void 0&&t!==""?t:Tt().toString();var It=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?C(r):{value:r})},M=(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 v=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 A(this.span)||t.dynamicImportStatus==="failed"}log(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"log"},n)})}error(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"error"},n)})}critical(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(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 V=class extends v{constructor(){super({name:"Root"})}init({name:e,getParentContext:r},n){let i=v.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),a=new v.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=a,i.addSpanProcessor(new v.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:a})),v.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 _=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 $=class{static createRootTracer(e=!1){return e?new V:new _}};var S=class extends y{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 Q=class extends y{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 be(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 de(...t){return new c(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var vt=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 gt=t=>new c(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var ht=t=>new c(e=>{t.forEach(r=>e.next(r))});var xt=(t,e)=>new c(r=>{let n=o=>r.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});var D=class extends b{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function fe(t){return e=>new c(r=>e.subscribe(new X(r,t)))}var X=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 Ot={leading:!1,trailing:!0};function Te(t,e=Ot){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,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){this.destination.error?.(e)}};var wt={leading:!0,trailing:!1};function ye(t,e=wt){return r=>new c(n=>r.subscribe(new J(n,t,e)))}var J=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,A(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 Ie(t){return e=>new c(r=>e.subscribe(new Z(r,t)))}var Z=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 Et=(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)},St=(t,e)=>t instanceof Object&&e instanceof Object?Et(t,e):t===e;function ge(t=St){return e=>new c(r=>e.subscribe(new ee(r,t)))}var ve={},ee=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=ve}next(e){let r;try{r=this.lastValue===ve||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function U(t){return e=>new c(r=>e.subscribe(new te(r,t)))}var te=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 U(()=>t)}function xe(){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 Oe(){return t=>new c(e=>t.subscribe(new re(e)))}var re=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 we(t){return e=>new c(r=>e.subscribe(new ne(r,t)))}var ne=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 oe(r,t)))}var oe=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 Se(t=0){return e=>{let r=0,n=new S(t),o=e.subscribe(n),i=a=>()=>{a.unsubscribe(),r--,r===0&&o.unsubscribe()};return new c(a=>(r++,i(n.subscribe(a))))}}var At=(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))(At||{});var Rt=(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))(Rt||{}),kt="vk.com",ri=async(t,e,r)=>{let n=new URL(`https://${kt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let i=await(await fetch(n.toString())).json();return Pt(i,r)},Pt=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Lt(n)])),Lt=t=>Array.isArray(t)?t[0]:t;var Nt=(r=>(r.RU="ru",r.EN="en",r))(Nt||{});var d="__vk_vp_internals_exposure",Ae=class{constructor(e,r){this.playerId=r,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>"u")return{};let e=this.playerId,r=this.type;return window[d]?.[e]?.[r]??{}}initWindowObjects(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[d]||(window[d]={}),window[d][e]||(window[d][e]={}),window[d][e][r]||(window[d][e][r]={})}expose(e){typeof window>"u"||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[d]&&window[d][e]&&window[d][e][r]&&(delete window[d][e][r],Object.keys(window[d][e]).length||delete window[d][e],Object.keys(window[d]).length||delete window[d])}};var Re={};pe(Re,{create:()=>Ct,destroy:()=>Mt,push:()=>Vt,subscribe:()=>_t});var R=new Map,Ct=(t,e)=>R.set(t,e??[]),Mt=t=>R.delete(t),Vt=(t,e)=>{let r=R.get(t);r&&(typeof r=="function"?r(e):r.push(e))},_t=(t,e)=>{let r=R.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);R.set(t,e)}};export{At as ErrorCategory,d as INTERNAL_EXPOSE_GLOBAL_KEY,Nt as InterfaceLanguage,Ae as InternalsExposure,F as Logger,c as Observable,S as ReplaySubject,y as Subject,b as Subscription,D as SubscriptionRemovable,$ as TracerFactory,_e as VERSION,Rt as VKNumericLanguage,Q as ValueSubject,G as VideoQuality,Be as abortable,Ge as addScript,ct as areQualitiesExact,We as assertEmptyArray,I as assertNever,je as assertNonNullable,Fe as assertNotEmptyArray,ze as assertNullable,lt as assertQualityIsExact,fe as buffer,Qe as checkNever,dt as clearVideoElement,ut as cloneDeep,N as cloneDeepWith,be as combine,Te as debounce,q as debounceFn,et as detectEmbed,Re as devNull,pt as fillWithDefault,Ie as filter,ge as filterChanged,C as flattenObject,xt as fromEvent,qe as getExponentialDelay,ot as getHighestQuality,yt as getPlayerId,It as getTraceSubscriptionMethod,gt as interval,tt as isHigher,rt as isHigherOrEqual,ft as isIntersecting,B as isInvariantQuality,K as isLower,nt as isLowerOrEqual,O as isNonNullable,A as isNullable,Er as isValidURL,ri as loadVKLangPack,U as map,he as mapTo,de as merge,x as noop,Ke as now,ht as observableFrom,bt as observeElementSize,xe as once,Oe as pairwise,ue as safeStorage,Se as shareReplay,Ee as skip,we as tap,ye as throttle,H as throttleFn,mr as timeCodeToString,vt as timeout,it as videoHeightToQuality,at as videoQualityToHeight,st as videoSizeToQuality};
|
|
6
|
+
var Ve=Object.defineProperty;var pe=(t,e)=>{for(var r in e)Ve(t,r,{get:e[r],enumerable:!0})};var _e="1.0.70-dev.048743c0.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 I=t=>{throw new Error(`${t} is value of unexpected type`)},Qe=t=>{};var x=()=>{};var De=t=>{throw console.error(t),t},Ue=t=>{console.error(t)},l=class{constructor(e){this.suppressErrors=!1;e&&(this._subscribe=e)}setSuppressErrors(e){this.suppressErrors=e}subscribe(e,r){let n=this.suppressErrors?Ue:De,o;r?typeof r=="function"?o={next:r,error:x}:o={next:i=>r.next(i),error:i=>r.error?.(i)}:o={next:n,error:x};let a=typeof e=="function"?{next:i=>{try{let c=e(i);c instanceof Promise&&c.catch(m=>o.next(m))}catch(c){o.next(c)}},error:i=>o.next(i)}:{next:i=>e.next(i),error:i=>e.error?e.error(i):o.next(i)},s;try{s=this._subscribe(a)}catch(i){a.error?.(i)}return new b().add(()=>{switch(a.next=x,a.error=x,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 y=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 b().add(()=>this.subscribers.delete(n))}};var F=class{constructor(){this.log$=new y;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 je(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function ze(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function O(t){return typeof t<"u"&&t!==null}function A(t){return t==null}function Fe(t,e){if(!t?.length)throw new Error(e)}function We(t,e){if(t?.length)throw new Error(e)}var Ge=(t,e,r)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{i(),m.remove()});let a=()=>{i(),o("error")},s=()=>{i(),n()},i=()=>{c&&clearTimeout(c),m.removeEventListener("load",s),m.removeEventListener("error",a)},c;r&&(c=window.setTimeout(()=>{i(),o("timeout")},r));let m=document.createElement("script");m.addEventListener("load",s),m.addEventListener("error",a),m.src=t,document.head.appendChild(m)});var Ke=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var Be=(t,e)=>async(...r)=>{let n=e(...r),o=t.aborted,a;for(;!o&&!t.aborted;)try{let s=await n.next(a);o=s.done??!1,a=s.value}catch(s){await n.throw(s)}return a};var qe=(t,{start:e=0,factor:r=2,max:n=1/0,min:o=e,random:a=0}={})=>{let s=e;return s*=r**t,s*=1+(Math.random()*a*2-a),s=Math.round(s),s=Math.min(s,n),s=Math.max(s,o),s};var ue={};pe(ue,{clear:()=>Ze,get:()=>$e,has:()=>Ye,isPersistent:()=>He,remove:()=>Je,set:()=>Xe});var w,v,W=`vk-videoplayer-dummy-key-${Math.random()}`,E=()=>{if(v!==void 0)return v;try{localStorage.setItem(W,"test"),localStorage.removeItem(W),v=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(W),v=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)v=2;else throw e}else throw t}return v===2&&(w=new Map),v},He=()=>E()===0,$e=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 w?.get(t);default:I(e)}},Xe=(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:w?.set(t,e);return;default:I(r)}},Ye=t=>{let e=E();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return w?.has(t)??!1;default:return I(e),!1}},Je=t=>{let e=E();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:w?.delete(t);return;default:I(e)}},Ze=()=>{let t=E();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return w?.clear();default:I(t)}};var et=()=>{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 G=(p=>(p.INVARIANT="Invariant quality",p.Q_144P="144p",p.Q_240P="240p",p.Q_360P="360p",p.Q_480P="480p",p.Q_576P="576p",p.Q_720P="720p",p.Q_1080P="1080p",p.Q_1440P="1440p",p.Q_2160P="2160p",p.Q_4320P="4320p",p))(G||{});var f={"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}},tt=(t,e)=>f[t].height>f[e].height,rt=(t,e)=>f[t].height>=f[e].height,K=(t,e)=>f[t].height<f[e].height,nt=(t,e)=>f[t].height<=f[e].height,ot=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:K(e,r)?1:-1)[0],me=Object.keys(f).sort((t,e)=>K(t,e)?-1:1),it=(t,e=.02)=>[...me].find(n=>f[n].height*(1+e)>=t),st=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return me.find(o=>{let a=f[o];return a.width>=n&&a.height>=r})},at=t=>f[t].height,B=t=>t==="Invariant quality",lt=t=>t.every(e=>!B(e));function ct(t){if(B(t))throw new Error("Expected exact quality")}var pt=(t,e)=>{let r={};for(let n of Object.keys(e)){let o=e[n],a=t[n];Array.isArray(o)&&Array.isArray(a)?r[n]=a:typeof o=="object"&&typeof a=="object"?r[n]=pt(a,o):r[n]=n in t?a:o}return r};var dr=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 q(t,e=0,r){let n,o,a,s,i,c,m=0,ie=!1,p=!1,j=!0,se=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(ie=!!r.leading,p="maxWait"in r,a=r?.maxWait?Math.max(+r?.maxWait||0,e):a,j="trailing"in r?!!r.trailing:j);function z(u){let T=n,g=o;return n=o=void 0,m=u,s=t.apply(g,T),s}function P(u,T){return se?(i&&window.cancelAnimationFrame(i),window.requestAnimationFrame(u)):setTimeout(u,T)}function Pe(u){if(se){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Re(u){return m=u,i=P(R,e),ie?z(u):s}function Le(u){let T=u-c,g=u-m,ce=e-T;return p?Math.min(ce,a-g):ce}function ae(u){let T=u-c,g=u-m;return c===void 0||T>=e||T<0||p&&g>=a}function R(){let u=Date.now();if(ae(u))return le(u);i=P(R,Le(u))}function le(u){return i=void 0,j&&n?z(u):(n=o=void 0,s)}function Ne(){i!==void 0&&Pe(i),m=0,n=c=o=i=void 0}function Ce(){return i===void 0?s:le(Date.now())}function Me(){return i!==void 0}function L(...u){let T=Date.now(),g=ae(T);if(n=u,o=this,c=T,g){if(i===void 0)return Re(c);if(p)return i=P(R,e),z(c)}return i===void 0&&(i=P(R,e)),s}return L.cancel=Ne,L.flush=Ce,L.pending=Me,L}var H=(t,e=0,r)=>q(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var N=(t,e)=>{if(t===null||typeof t!="object")return t;let r=Array.isArray(t)?[]:{};for(let n in t){if(typeof e=="function"){let o=e(t[n],n,t,r);if(o!==void 0){r[n]=o;continue}}typeof t[n]=="object"?r[n]=N(t[n],e):r[n]=t[n]}return r};var ut=t=>N(t);var mt=300,bt=(t,e=mt)=>new l(r=>{let{width:n,height:o}=t.getBoundingClientRect();if(r.next({width:n,height:o}),!window.ResizeObserver)return;let a=new ResizeObserver(H(s=>{let i=s[0];if(!i)return;let c,m;i.contentBoxSize&&i.contentBoxSize[0]?(m=i.contentBoxSize[0].blockSize,c=i.contentBoxSize[0].inlineSize):i.contentRect&&(c=i.contentRect.width,m=i.contentRect.height),O(c)&&O(m)&&r.next({width:c,height:m})},e));return a.observe(t),()=>a.disconnect()});var C=(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 a=C(t[o],e-1);for(let s in a)a.hasOwnProperty(s)&&(n[o+r+s]=a[s])}else n[o]=t[o];return n};var dt=t=>{t.removeAttribute("src"),t.load()};var Ar=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var ft=(t,e)=>!(t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom);var Tt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),yt=t=>t!==void 0&&t!==""?t:Tt().toString();function It(t,e,r,n="clamp"){if(e.length!==r.length)throw new Error("inputRange \u0438 outputRange \u0434\u043E\u043B\u0436\u043D\u044B \u0431\u044B\u0442\u044C \u043E\u0434\u0438\u043D\u0430\u043A\u043E\u0432\u043E\u0439 \u0434\u043B\u0438\u043D\u044B");if(e.length<2)throw new Error("inputRange \u0434\u043E\u043B\u0436\u0435\u043D \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C \u043A\u0430\u043A \u043C\u0438\u043D\u0438\u043C\u0443\u043C 2 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F");if(n==="identity")return t;if(n==="clamp"){if(t<=e[0])return r[0];if(t>=e[e.length-1])return r[r.length-1]}let o=1;if(t<=e[0]&&n==="extend")o=1;else if(t>=e[e.length-1]&&n==="extend")o=e.length-1;else{for(;o<e.length&&e[o]<t;)o++;o>=e.length&&(o=e.length-1)}let a=e[o-1],s=e[o],i=r[o-1],c=r[o];if(t===a)return i;if(t===s)return c;let m=(t-a)/(s-a);return i+m*(c-i)}function ht(t,e,r){if(t<=0||r<0)return[];let n=[],o=Math.floor((t-1)/2),a=Math.floor(t/2),s=e-o,i=e+a;s<0&&(i+=Math.abs(s),s=0),i>r&&(s-=i-r,i=r),s=Math.max(0,s),i=Math.min(r,i);for(let c=s;c<=i;c++)n.push(c);return n}var gt=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?C(r):{value:r})},M=(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 h=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((s,i)=>setTimeout(i,this.dynamicImportTimeout)),r=Promise.all([import("@opentelemetry/api"),import("@opentelemetry/sdk-trace-web"),import("@tracer/opentelemetry")]),[n,o,a]=await Promise.race([r,e]);t.dynamicImports={opentelemetryApi:n,opentelemetrySdk:o,tracer:a},t.dynamicImportStatus="completed"}catch{t.dynamicImportStatus="failed"}}}isComponentTracerNotInitialized(){return A(this.span)||t.dynamicImportStatus==="failed"}log(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"log"},n)})}error(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(r),type:"error"},n)})}critical(e,r){let n=Date.now();this.initPromise.then(o=>{this.isComponentTracerNotInitialized()||this.span.addEvent(e,{...M(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 V=class extends h{constructor(){super({name:"Root"})}init({name:e,getParentContext:r},n){let a=h.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),s=new h.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=s,a.addSpanProcessor(new h.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:s})),h.rootTracer=a.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 _=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 $=class{static createRootTracer(e=!1){return e?new V:new _}};var S=class extends y{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 Q=class extends y{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 be(t){return new l(e=>{let r={},n=Object.keys(t).length,o=a=>s=>{a in r||n--,r[a]=s,n===0&&e.next(r)};return Object.entries(t).reduce((a,[s,i])=>a.add(i.subscribe(o(s))),new b)})}function de(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new b))}var vt=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 xt=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var Ot=t=>new l(e=>{t.forEach(r=>e.next(r))});var wt=(t,e)=>new l(r=>{let n=o=>r.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});var D=class extends b{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function fe(t){return e=>new l(r=>e.subscribe(new X(r,t)))}var X=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 Et={leading:!1,trailing:!0};function Te(t,e=Et){return r=>new l(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,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){this.destination.error?.(e)}};var St={leading:!0,trailing:!1};function ye(t,e=St){return r=>new l(n=>r.subscribe(new J(n,t,e)))}var J=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,A(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 Ie(t){return e=>new l(r=>e.subscribe(new Z(r,t)))}var Z=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 At=(t,e)=>{let r=(n,o)=>{let a=Object.keys(n);for(let s in o)if(!a.includes(s)||o[s]!==n[s])return!1;return!0};return r(t,e)&&r(e,t)},kt=(t,e)=>t instanceof Object&&e instanceof Object?At(t,e):t===e;function ge(t=kt){return e=>new l(r=>e.subscribe(new ee(r,t)))}var he={},ee=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=he}next(e){let r;try{r=this.lastValue===he||!this.predicate(this.lastValue,e),this.lastValue=e instanceof Object&&!Array.isArray(e)?{...e}:e}catch(n){throw this.error(n),n}r&&this.destination.next(e)}error(e){this.destination.error?.(e)}};function U(t){return e=>new l(r=>e.subscribe(new te(r,t)))}var te=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 ve(t){return U(()=>t)}function xe(){return t=>new l(e=>{let r=!1,n=!1,o=t.subscribe(a=>{r||(r=!0,e.next(a)),n&&o.unsubscribe()},a=>{r=!0,e.error?.(a),n&&o.unsubscribe()});return n=!0,r&&o.unsubscribe(),o})}function Oe(){return t=>new l(e=>t.subscribe(new re(e)))}var re=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 we(t){return e=>new l(r=>e.subscribe(new ne(r,t)))}var ne=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 l(r=>e.subscribe(new oe(r,t)))}var oe=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 Se(t=0){return e=>{let r=0,n=new S(t),o=e.subscribe(n),a=s=>()=>{s.unsubscribe(),r--,r===0&&o.unsubscribe()};return new l(s=>(r++,a(n.subscribe(s))))}}var Pt=(i=>(i.NETWORK="network",i.VIDEO_PIPELINE="video_pipeline",i.EXTERNAL_API="external_api",i.PARSER="parser",i.DOM="dom",i.WTF="wtf",i.FATAL="fatal",i))(Pt||{});var Rt=(p=>(p.Armenian="58",p.Azerbaijani="57",p.Belarusian="114",p.English="3",p.Kazakh="97",p.Portuguese="73",p.Russian="0",p.Spanish="4",p.Ukrainian="1",p.Uzbek="65",p.Vietnamese="75",p))(Rt||{}),Lt="vk.com",li=async(t,e,r)=>{let n=new URL(`https://${Lt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let a=await(await fetch(n.toString())).json();return Nt(a,r)},Nt=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Ct(n)])),Ct=t=>Array.isArray(t)?t[0]:t;var Mt=(r=>(r.RU="ru",r.EN="en",r))(Mt||{});var d="__vk_vp_internals_exposure",Ae=class{constructor(e,r){this.playerId=r,this.type=e,this.initWindowObjects()}getWindowObject(){if(typeof window>"u")return{};let e=this.playerId,r=this.type;return window[d]?.[e]?.[r]??{}}initWindowObjects(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[d]||(window[d]={}),window[d][e]||(window[d][e]={}),window[d][e][r]||(window[d][e][r]={})}expose(e){typeof window>"u"||Object.assign(this.getWindowObject(),e)}destroy(){if(typeof window>"u")return;let e=this.playerId,r=this.type;window[d]&&window[d][e]&&window[d][e][r]&&(delete window[d][e][r],Object.keys(window[d][e]).length||delete window[d][e],Object.keys(window[d]).length||delete window[d])}};var ke={};pe(ke,{create:()=>Vt,destroy:()=>_t,push:()=>Qt,subscribe:()=>Dt});var k=new Map,Vt=(t,e)=>k.set(t,e??[]),_t=t=>k.delete(t),Qt=(t,e)=>{let r=k.get(t);r&&(typeof r=="function"?r(e):r.push(e))},Dt=(t,e)=>{let r=k.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);k.set(t,e)}};export{Pt as ErrorCategory,d as INTERNAL_EXPOSE_GLOBAL_KEY,Mt as InterfaceLanguage,Ae as InternalsExposure,F as Logger,l as Observable,S as ReplaySubject,y as Subject,b as Subscription,D as SubscriptionRemovable,$ as TracerFactory,_e as VERSION,Rt as VKNumericLanguage,Q as ValueSubject,G as VideoQuality,Be as abortable,Ge as addScript,lt as areQualitiesExact,We as assertEmptyArray,I as assertNever,je as assertNonNullable,Fe as assertNotEmptyArray,ze as assertNullable,ct as assertQualityIsExact,fe as buffer,Qe as checkNever,dt as clearVideoElement,ut as cloneDeep,N as cloneDeepWith,be as combine,Te as debounce,q as debounceFn,et as detectEmbed,ke as devNull,pt as fillWithDefault,Ie as filter,ge as filterChanged,C as flattenObject,wt as fromEvent,qe as getExponentialDelay,ot as getHighestQuality,yt as getPlayerId,ht as getRangeAroundIndex,gt as getTraceSubscriptionMethod,It as interpolate,xt as interval,tt as isHigher,rt as isHigherOrEqual,ft as isIntersecting,B as isInvariantQuality,K as isLower,nt as isLowerOrEqual,O as isNonNullable,A as isNullable,Ar as isValidURL,li as loadVKLangPack,U as map,ve as mapTo,de as merge,x as noop,Ke as now,Ot as observableFrom,bt as observeElementSize,xe as once,Oe as pairwise,ue as safeStorage,Se as shareReplay,Ee as skip,we as tap,ye as throttle,H as throttleFn,dr as timeCodeToString,vt as timeout,it as videoHeightToQuality,at as videoQualityToHeight,st as videoSizeToQuality};
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Возвращает диапозон индексов вокруг определнного индекса.
|
|
3
|
+
* @param totalItems Размер массива.
|
|
4
|
+
* @param currentIndex Индекс вокруг которого нужно собрать массив.
|
|
5
|
+
* @param max Максимальный размер индекса.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getRangeAroundIndex(totalItems: number, currentIndex: number, max: number): number[];
|
package/types/utils/index.d.ts
CHANGED
|
@@ -23,3 +23,5 @@ export { clearVideoElement } from './clearVideoElement';
|
|
|
23
23
|
export * from './isValidURL';
|
|
24
24
|
export { isIntersecting } from './isIntersecting';
|
|
25
25
|
export { getPlayerId } from './getPlayerId';
|
|
26
|
+
export { interpolate } from './interpolate';
|
|
27
|
+
export { getRangeAroundIndex } from './getRangeAroundIndex';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* extend - предсказывает значение, когда выходим за outputRange.
|
|
3
|
+
* clamp - значение не выходит за outputRange, прибиваем его к краям диапозона.
|
|
4
|
+
* identity - значение возвращается как есть, когда выходит из outputRange.
|
|
5
|
+
*/
|
|
6
|
+
export type Extrapolate = 'extend' | 'clamp' | 'identity';
|
|
7
|
+
/**
|
|
8
|
+
* Линейно интерполирует значение из inputRange в outputRange.
|
|
9
|
+
* @param {number} value - Входное значение (например, прогресс анимации)
|
|
10
|
+
* @param {number[]} inputRange - Диапазон входных значений (должен быть отсортирован)
|
|
11
|
+
* @param {number[]} outputRange - Диапазон выходных значений
|
|
12
|
+
* @param {"extend" | "clamp" | "identity"} extrapolate - Поведение при выходе за границы диапазона
|
|
13
|
+
* @returns {number} - Интерполированное значение
|
|
14
|
+
*/
|
|
15
|
+
export declare function interpolate(value: number, inputRange: number[], outputRange: number[], extrapolate?: Extrapolate): number;
|