@vkontakte/videoplayer-shared 1.0.59-dev.f7cc031b.0 → 1.0.60-beta.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/evergreen.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @vkontakte/videoplayer-shared v1.0.59-dev.f7cc031b.0
3
- * Thu, 17 Apr 2025 15:33:50 GMT
4
- * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-59/doc/
2
+ * @vkontakte/videoplayer-shared v1.0.60-beta.0
3
+ * Mon, 19 May 2025 12:12:37 GMT
4
+ * https://st.mycdn.me/static/vkontakte-videoplayer/1-0-60/doc/
5
5
  */
6
- var Ae=Object.defineProperty;var oe=(t,e)=>{for(var r in e)Ae(t,r,{get:e[r],enumerable:!0})};var Le="1.0.59-dev.f7cc031b.0";var d=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 T=t=>{throw new Error(`${t} is value of unexpected type`)},Pe=t=>{};var I=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:I}:n={next:i=>r.next(i),error:i=>r.error?.(i)}:n={next:I,error:I};let o=typeof e=="function"?{next:i=>{try{let a=e(i);a instanceof Promise&&a.catch(p=>n.next(p))}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 d().add(()=>{switch(o.next=I,o.error=I,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return T(s)}})}pipe(...e){return e.reduce((r,n)=>n(r),this)}_subscribe(e){}};var v=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 d().add(()=>this.subscribers.delete(n))}};var V=class{constructor(){this.log$=new v;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}))}};import{trace as Ne,context as Ce}from"@opentelemetry/api";import{TracerAllSpansProcessor as Ve,TracerMemorySpanExporter as ie,initTracerOpenTelemetry as _e}from"@tracer/opentelemetry";var _=class t{constructor({name:e}){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}},M=class t{constructor({name:e,parentContext:r,tracer:n}){this.childTracers=[];let o=!n;if(o){let i=_e({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),a=new ie,p=new ie;this.spanExporter=a,i.addSpanProcessor(new Ve({startedSpansExporter:a,endedSpansExporter:p})),this.tracer=i.getTracer("sdk-videoplayer-tracer")}else this.tracer=n;this.span=this.tracer.startSpan(e,{root:o},r),this.context=Ne.setSpan(Ce.active(),this.span)}log(e,r){this.span.addEvent(e,{...r,type:"log"})}error(e,r){this.span.addEvent(e,{...r,type:"error"})}critical(e,r){this.span.addEvent(e,{...r,type:"critical"})}static createRootTracer(e=!1){return e?new t({name:"Root"}):new _({name:"Root"})}createComponentTracer(e){let r=new t({name:e,parentContext:this.context,tracer:this.tracer});return this.childTracers.push(r),r}end(){this.childTracers.forEach(e=>e.end()),this.span.end()}getFinishedSpans(){return this.spanExporter?.getJsonData()}getTraceId(){return this.span.spanContext().traceId}};function Me(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Qe(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function h(t){return typeof t<"u"&&t!==null}function Q(t){return t==null}function Ue(t,e){if(!t?.length)throw new Error(e)}function De(t,e){if(t?.length)throw new Error(e)}var je=(t,e,r)=>new Promise((n,o)=>{e.addEventListener("abort",()=>{a(),b.remove()});let s=()=>{a(),o("error")},i=()=>{a(),n()},a=()=>{p&&clearTimeout(p),b.removeEventListener("load",i),b.removeEventListener("error",s)},p;r&&(p=window.setTimeout(()=>{a(),o("timeout")},r));let b=document.createElement("script");b.addEventListener("load",i),b.addEventListener("error",s),b.src=t,document.head.appendChild(b)});var We=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var ze=(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 Ge=(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 se={};oe(se,{clear:()=>$e,get:()=>Ke,has:()=>He,isPersistent:()=>Fe,remove:()=>Be,set:()=>qe});var y,x,U=`vk-videoplayer-dummy-key-${Math.random()}`,O=()=>{if(x!==void 0)return x;try{localStorage.setItem(U,"test"),localStorage.removeItem(U),x=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(U),x=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)x=2;else throw e}else throw t}return x===2&&(y=new Map),x},Fe=()=>O()===0,Ke=t=>{let e=O();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return y?.get(t);default:T(e)}},qe=(t,e)=>{let r=O();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:y?.set(t,e);return;default:T(r)}},He=t=>{let e=O();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return y?.has(t)??!1;default:return T(e),!1}},Be=t=>{let e=O();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:y?.delete(t);return;default:T(e)}},$e=()=>{let t=O();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return y?.clear();default:T(t)}};var Ye=()=>{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{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var D=(c=>(c.INVARIANT="Invariant quality",c.Q_144P="144p",c.Q_240P="240p",c.Q_360P="360p",c.Q_480P="480p",c.Q_576P="576p",c.Q_720P="720p",c.Q_1080P="1080p",c.Q_1440P="1440p",c.Q_2160P="2160p",c.Q_4320P="4320p",c))(D||{});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}},Xe=(t,e)=>f[t].height>f[e].height,Je=(t,e)=>f[t].height>=f[e].height,j=(t,e)=>f[t].height<f[e].height,Ze=(t,e)=>f[t].height<=f[e].height,et=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:j(e,r)?1:-1)[0],ae=Object.keys(f).sort((t,e)=>j(t,e)?-1:1),tt=(t,e=.02)=>[...ae].find(n=>f[n].height*(1+e)>=t),rt=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return ae.find(o=>{let s=f[o];return s.width>=n&&s.height>=r})},nt=t=>f[t].height,W=t=>t==="Invariant quality",ot=t=>t.every(e=>!W(e));function it(t){if(W(t))throw new Error("Expected exact quality")}var st=(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]=st(s,o):r[n]=n in t?s:o}return r};var vr=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,o,s,i,a,p,b=0,Z=!1,c=!1,N=!0,ee=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(Z=!!r.leading,c="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,N="trailing"in r?!!r.trailing:N);function C(u){let m=n,g=o;return n=o=void 0,b=u,i=t.apply(g,m),i}function w(u,m){return ee?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(u)):setTimeout(u,m)}function Oe(u){if(ee){window.cancelAnimationFrame(u);return}clearTimeout(u)}function Ee(u){return b=u,a=w(S,e),Z?C(u):i}function we(u){let m=u-p,g=u-b,ne=e-m;return c?Math.min(ne,s-g):ne}function te(u){let m=u-p,g=u-b;return p===void 0||m>=e||m<0||c&&g>=s}function S(){let u=Date.now();if(te(u))return re(u);a=w(S,we(u))}function re(u){return a=void 0,N&&n?C(u):(n=o=void 0,i)}function Se(){a!==void 0&&Oe(a),b=0,n=p=o=a=void 0}function Re(){return a===void 0?i:re(Date.now())}function ke(){return a!==void 0}function R(...u){let m=Date.now(),g=te(m);if(n=u,o=this,p=m,g){if(a===void 0)return Ee(p);if(c)return a=w(S,e),C(p)}return a===void 0&&(a=w(S,e)),i}return R.cancel=Se,R.flush=Re,R.pending=ke,R}var G=(t,e=0,r)=>z(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var k=(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]=k(t[n],e):r[n]=t[n]}return r};var at=t=>k(t);var lt=300,ct=(t,e=lt)=>new l(r=>{let{width:n,height:o}=t.getBoundingClientRect();if(r.next({width:n,height:o}),!window.ResizeObserver)return;let s=new ResizeObserver(G(i=>{let a=i[0];if(!a)return;let p,b;a.contentBoxSize&&a.contentBoxSize[0]?(b=a.contentBoxSize[0].blockSize,p=a.contentBoxSize[0].inlineSize):a.contentRect&&(p=a.contentRect.width,b=a.contentRect.height),h(p)&&h(b)&&r.next({width:p,height:b})},e));return s.observe(t),()=>s.disconnect()});var A=(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=A(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 ut=t=>{t.removeAttribute("src"),t.load()};var Lr=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var Nr=t=>{try{return new URL(t)}catch{return null}};var pt=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?A(r):{value:r})};var L=class extends v{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 le(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 d)})}function ce(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new d))}var bt=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 dt=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var ft=t=>new l(e=>{t.forEach(r=>e.next(r))});var mt=(t,e)=>new l(r=>{let n=o=>r.next(o);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});function ue(t){return e=>new l(r=>e.subscribe(new F(r,t)))}var F=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 Tt={leading:!1,trailing:!0};function pe(t,e=Tt){return r=>new l(n=>r.subscribe(new K(n,t,e)))}var K=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,h(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 vt={leading:!0,trailing:!1};function be(t,e=vt){return r=>new l(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){this.destination.error?.(e)}};function de(t){return e=>new l(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){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)},It=(t,e)=>t instanceof Object&&e instanceof Object?gt(t,e):t===e;function me(t=It){return e=>new l(r=>e.subscribe(new B(r,t)))}var fe={},B=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=fe}next(e){let r;try{r=this.lastValue===fe||!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 P(t){return e=>new l(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){this.destination.error?.(e)}};function Te(t){return P(()=>t)}function ve(){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 ge(){return t=>new l(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){this.destination.error?.(e)}};function Ie(t){return e=>new l(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){this.destination.error?.(e)}};function xe(t){return e=>new l(r=>e.subscribe(new J(r,t)))}var J=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)}};var xt=(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))(xt||{});var ht=(c=>(c.Armenian="58",c.Azerbaijani="57",c.Belarusian="114",c.English="3",c.Kazakh="97",c.Portuguese="73",c.Russian="0",c.Spanish="4",c.Ukrainian="1",c.Uzbek="65",c.Vietnamese="75",c))(ht||{}),yt="vk.com",Ro=async(t,e,r)=>{let n=new URL(`https://${yt}/js/lang-pack.js`);n.searchParams.set("format","json"),n.searchParams.set("name",e),t!==void 0&&n.searchParams.set("lang",t);let s=await(await fetch(n.toString())).json();return Ot(s,r)},Ot=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),Et(n)])),Et=t=>Array.isArray(t)?t[0]:t;var wt=(r=>(r.RU="ru",r.EN="en",r))(wt||{});var St={UI:"__vkVideoPlayer",CORE:"__vkVideoCore"},Rt=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),he=class{constructor(e){this.id=Rt();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 St[e]}};var ye={};oe(ye,{create:()=>kt,destroy:()=>At,push:()=>Lt,subscribe:()=>Pt});var E=new Map,kt=(t,e)=>E.set(t,e??[]),At=t=>E.delete(t),Lt=(t,e)=>{let r=E.get(t);r&&(typeof r=="function"?r(e):r.push(e))},Pt=(t,e)=>{let r=E.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);E.set(t,e)}};export{xt as ErrorCategory,wt as InterfaceLanguage,he as InternalsExposure,V as Logger,l as Observable,v as Subject,d as Subscription,M as Tracer,Le as VERSION,ht as VKNumericLanguage,L as ValueSubject,D as VideoQuality,ze as abortable,je as addScript,ot as areQualitiesExact,De as assertEmptyArray,T as assertNever,Me as assertNonNullable,Ue as assertNotEmptyArray,Qe as assertNullable,it as assertQualityIsExact,ue as buffer,Pe as checkNever,ut as clearVideoElement,at as cloneDeep,k as cloneDeepWith,le as combine,Nr as createURL,pe as debounce,z as debounceFn,Ye as detectEmbed,ye as devNull,st as fillWithDefault,de as filter,me as filterChanged,A as flattenObject,mt as fromEvent,Ge as getExponentialDelay,et as getHighestQuality,pt as getTraceSubscriptionMethod,dt as interval,Xe as isHigher,Je as isHigherOrEqual,W as isInvariantQuality,j as isLower,Ze as isLowerOrEqual,h as isNonNullable,Q as isNullable,Lr as isValidURL,Ro as loadVKLangPack,P as map,Te as mapTo,ce as merge,I as noop,We as now,ft as observableFrom,ct as observeElementSize,ve as once,ge as pairwise,se as safeStorage,xe as skip,Ie as tap,be as throttle,G as throttleFn,vr as timeCodeToString,bt as timeout,tt as videoHeightToQuality,nt as videoQualityToHeight,rt as videoSizeToQuality};
6
+ var Re=Object.defineProperty;var oe=(t,e)=>{for(var r in e)Re(t,r,{get:e[r],enumerable:!0})};var Le="1.0.60-beta.0";var d=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 T=t=>{throw new Error(`${t} is value of unexpected type`)},Pe=t=>{};var I=()=>{};var l=class{constructor(e){e&&(this._subscribe=e)}subscribe(e,r){let n;r?typeof r=="function"?n={next:r,error:I}:n={next:o=>r.next(o),error:o=>r.error?.(o)}:n={next:I,error:I};let i=typeof e=="function"?{next:o=>{try{let a=e(o);a instanceof Promise&&a.catch(u=>n.next(u))}catch(a){n.next(a)}},error:o=>n.next(o)}:{next:o=>e.next(o),error:o=>e.error?e.error(o):n.next(o)},s;try{s=this._subscribe(i)}catch(o){i.error?.(o)}return new d().add(()=>{switch(i.next=I,i.error=I,typeof s){case"function":s();return;case"object":s.unsubscribe();return;case"undefined":return;default:return T(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 d().add(()=>this.subscribers.delete(n))}};var M=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}))}};var Q=class t{constructor({name:e}){}log(e,r){}error(e,r){}critical(e,r){}createComponentTracer(e){return new t({name:e})}end(){}getFinishedSpans(){}getTraceId(){return this.fakeTraceId}},U=class t{constructor({name:e,parentContext:r,tracer:n}){this.dynamicImportTimeout=5e3;this.childTracers=[];if(t.dynamicImportStatus==="failed")return this;t.dynamicImportStatus==="not_started"&&(t.dynamicImportPromise=this.loadOpentelemetry()),t.dynamicImportPromise.then(()=>this.init({name:e,parentContext:r,tracer:n}))}static{this.dynamicImportStatus="not_started"}init({name:e,parentContext:r,tracer:n}){let i=!n;if(i){let o=t.dynamicImports.tracer.initTracerOpenTelemetry({serviceName:"videoplayer-sdk-web",appToken:"L9SBoka6ZWk4xPjaK7tmfSfYvMhcge7nvGDjpdMmscb",spanLimits:{attributeCountLimit:1/0,eventCountLimit:1/0,attributePerEventCountLimit:1/0}}).getProvider(),a=new t.dynamicImports.tracer.TracerMemorySpanExporter,u=new t.dynamicImports.tracer.TracerMemorySpanExporter;this.spanExporter=a,o.addSpanProcessor(new t.dynamicImports.tracer.TracerAllSpansProcessor({startedSpansExporter:a,endedSpansExporter:u})),this.tracer=o.getTracer("sdk-videoplayer-tracer")}else this.tracer=n;this.span=this.tracer.startSpan(e,{root:i},r),this.context=t.dynamicImports.opentelemetryApi.trace.setSpan(t.dynamicImports.opentelemetryApi.context.active(),this.span),t.dynamicImportStatus="initialized"}async loadOpentelemetry(){if(t.dynamicImportStatus==="not_started"){t.dynamicImportStatus="in_progress";try{let e=new Promise((o,a)=>setTimeout(a,this.dynamicImportTimeout)),r=Promise.all([import("@opentelemetry/api"),import("@opentelemetry/sdk-trace-web"),import("@tracer/opentelemetry")]),[n,i,s]=await Promise.race([r,e]);t.dynamicImports={opentelemetryApi:n,opentelemetrySdk:i,tracer:s},t.dynamicImportStatus="completed"}catch{t.dynamicImportStatus="failed"}}}log(e,r){t.dynamicImportStatus==="initialized"&&this.span.addEvent(e,{...r,type:"log"})}error(e,r){t.dynamicImportStatus==="initialized"&&this.span.addEvent(e,{...r,type:"error"})}critical(e,r){t.dynamicImportStatus==="initialized"&&this.span.addEvent(e,{...r,type:"critical"})}static createRootTracer(e=!1){return e?new t({name:"Root"}):new Q({name:"Root"})}createComponentTracer(e){let r=new t({name:e,parentContext:this.context,tracer:this.tracer});return this.childTracers.push(r),r}end(){t.dynamicImportStatus==="initialized"&&(this.childTracers.forEach(e=>e.end()),this.span.end())}getFinishedSpans(){if(t.dynamicImportStatus==="initialized")return this.spanExporter?.getJsonData()}getTraceId(){return t.dynamicImportStatus!=="initialized"?"":this.span.spanContext().traceId}};function Ne(t,e='Assertion "value is not nullable" failed'){if(t==null)throw new Error(e)}function Ce(t,e='Assertion "value is nullable" failed'){if(t!=null)throw new Error(e)}function x(t){return typeof t<"u"&&t!==null}function _(t){return t==null}function Ve(t,e){if(!t?.length)throw new Error(e)}function Me(t,e){if(t?.length)throw new Error(e)}var Qe=(t,e,r)=>new Promise((n,i)=>{e.addEventListener("abort",()=>{a(),m.remove()});let s=()=>{a(),i("error")},o=()=>{a(),n()},a=()=>{u&&clearTimeout(u),m.removeEventListener("load",o),m.removeEventListener("error",s)},u;r&&(u=window.setTimeout(()=>{a(),i("timeout")},r));let m=document.createElement("script");m.addEventListener("load",o),m.addEventListener("error",s),m.src=t,document.head.appendChild(m)});var Ue=typeof window.performance?.now=="function"?()=>window.performance.now():()=>Date.now();var _e=(t,e)=>async(...r)=>{let n=e(...r),i=t.aborted,s;for(;!i&&!t.aborted;)try{let o=await n.next(s);i=o.done??!1,s=o.value}catch(o){await n.throw(o)}return s};var De=(t,{start:e=0,factor:r=2,max:n=1/0,min:i=e,random:s=0}={})=>{let o=e;return o*=r**t,o*=1+(Math.random()*s*2-s),o=Math.round(o),o=Math.min(o,n),o=Math.max(o,i),o};var se={};oe(se,{clear:()=>Ke,get:()=>ze,has:()=>Fe,isPersistent:()=>je,remove:()=>Ge,set:()=>We});var h,g,D=`vk-videoplayer-dummy-key-${Math.random()}`,O=()=>{if(g!==void 0)return g;try{localStorage.setItem(D,"test"),localStorage.removeItem(D),g=0}catch(t){if(t instanceof DOMException||t instanceof TypeError)try{sessionStorage.getItem(D),g=1}catch(e){if(e instanceof DOMException||e instanceof TypeError)g=2;else throw e}else throw t}return g===2&&(h=new Map),g},je=()=>O()===0,ze=t=>{let e=O();switch(e){case 0:return localStorage.getItem(t)??void 0;case 1:return sessionStorage.getItem(t)??void 0;case 2:return h?.get(t);default:T(e)}},We=(t,e)=>{let r=O();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:h?.set(t,e);return;default:T(r)}},Fe=t=>{let e=O();switch(e){case 0:return t in localStorage;case 1:return t in sessionStorage;case 2:return h?.has(t)??!1;default:return T(e),!1}},Ge=t=>{let e=O();switch(e){case 0:return localStorage.removeItem(t);case 1:return sessionStorage.removeItem(t);case 2:h?.delete(t);return;default:T(e)}},Ke=()=>{let t=O();switch(t){case 0:return localStorage.clear();case 1:return sessionStorage.clear();case 2:return h?.clear();default:T(t)}};var qe=()=>{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{isEmbed:t,origins:e,topOrigin:e.at(-1),immediateOrigin:e.at(0)}};var j=(c=>(c.INVARIANT="Invariant quality",c.Q_144P="144p",c.Q_240P="240p",c.Q_360P="360p",c.Q_480P="480p",c.Q_576P="576p",c.Q_720P="720p",c.Q_1080P="1080p",c.Q_1440P="1440p",c.Q_2160P="2160p",c.Q_4320P="4320p",c))(j||{});var b={"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}},Be=(t,e)=>b[t].height>b[e].height,He=(t,e)=>b[t].height>=b[e].height,z=(t,e)=>b[t].height<b[e].height,$e=(t,e)=>b[t].height<=b[e].height,Ye=t=>t.sort((e,r)=>e===r?0:e==="Invariant quality"?1:r==="Invariant quality"?-1:z(e,r)?1:-1)[0],ae=Object.keys(b).sort((t,e)=>z(t,e)?-1:1),Xe=(t,e=.02)=>[...ae].find(n=>b[n].height*(1+e)>=t),Je=({width:t,height:e})=>{let r=Math.min(t,e),n=Math.max(t,e);return ae.find(i=>{let s=b[i];return s.width>=n&&s.height>=r})},Ze=t=>b[t].height,W=t=>t==="Invariant quality",et=t=>t.every(e=>!W(e));function tt(t){if(W(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 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 F(t,e=0,r){let n,i,s,o,a,u,m=0,ee=!1,c=!1,C=!0,te=!e&&e!==0&&typeof window.requestAnimationFrame=="function";r&&(ee=!!r.leading,c="maxWait"in r,s=r?.maxWait?Math.max(+r?.maxWait||0,e):s,C="trailing"in r?!!r.trailing:C);function V(p){let f=n,v=i;return n=i=void 0,m=p,o=t.apply(v,f),o}function w(p,f){return te?(a&&window.cancelAnimationFrame(a),window.requestAnimationFrame(p)):setTimeout(p,f)}function Oe(p){if(te){window.cancelAnimationFrame(p);return}clearTimeout(p)}function Ee(p){return m=p,a=w(S,e),ee?V(p):o}function we(p){let f=p-u,v=p-m,ie=e-f;return c?Math.min(ie,s-v):ie}function re(p){let f=p-u,v=p-m;return u===void 0||f>=e||f<0||c&&v>=s}function S(){let p=Date.now();if(re(p))return ne(p);a=w(S,we(p))}function ne(p){return a=void 0,C&&n?V(p):(n=i=void 0,o)}function Se(){a!==void 0&&Oe(a),m=0,n=u=i=a=void 0}function Ae(){return a===void 0?o:ne(Date.now())}function ke(){return a!==void 0}function A(...p){let f=Date.now(),v=re(f);if(n=p,i=this,u=f,v){if(a===void 0)return Ee(u);if(c)return a=w(S,e),V(u)}return a===void 0&&(a=w(S,e)),o}return A.cancel=Se,A.flush=Ae,A.pending=ke,A}var G=(t,e=0,r)=>F(t,e,{...{leading:!0,trailing:!0},...r,maxWait:e});var k=(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]=k(t[n],e):r[n]=t[n]}return r};var nt=t=>k(t);var it=300,ot=(t,e=it)=>new l(r=>{let{width:n,height:i}=t.getBoundingClientRect();if(r.next({width:n,height:i}),!window.ResizeObserver)return;let s=new ResizeObserver(G(o=>{let a=o[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 R=(t,e=6,r=".")=>{let n={};for(let i in t)if(!(!t.hasOwnProperty(i)||t[i]instanceof HTMLElement||!e))if(typeof t[i]=="object"&&t[i]!==null){let s=R(t[i],e-1);for(let o in s)s.hasOwnProperty(o)&&(n[i+r+o]=s[o])}else n[i]=t[i];return n};var st=t=>{t.removeAttribute("src"),t.load()};var Sr=t=>{let e;try{e=new URL(t)}catch{return!1}return e.protocol==="https:"};var kr=t=>{try{return new URL(t)}catch{return null}};var at=t=>e=>r=>{let n=typeof r=="object";r==null||n&&!Object.keys(r).length||t(e,n?R(r):{value:r})};var L=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 le(t){return new l(e=>{let r={},n=Object.keys(t).length,i=s=>o=>{s in r||n--,r[s]=o,n===0&&e.next(r)};return Object.entries(t).reduce((s,[o,a])=>s.add(a.subscribe(i(o))),new d)})}function ce(...t){return new l(e=>t.reduce((r,n)=>r.add(n.subscribe(e)),new d))}var lt=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 ct=t=>new l(e=>{let r=window.setInterval(()=>e.next(),t);return()=>{r&&(window.clearInterval(r),r=void 0)}});var pt=t=>new l(e=>{t.forEach(r=>e.next(r))});var ut=(t,e)=>new l(r=>{let n=i=>r.next(i);return t.addEventListener(e,n),()=>t.removeEventListener(e,n)});var P=class extends d{remove(e){this.subscriptions=this.subscriptions.filter(r=>r!==e)}};function pe(t){return e=>new l(r=>e.subscribe(new K(r,t)))}var K=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 mt={leading:!1,trailing:!0};function ue(t,e=mt){return r=>new l(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,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 dt={leading:!0,trailing:!1};function me(t,e=dt){return r=>new l(n=>r.subscribe(new B(n,t,e)))}var B=class{constructor(e,r,n){this.destination=e;this.time=r;this.config=n}next(e){this.lastValue=e,_(this.timeout)&&(this.config.leading&&this.destination.next(e),this.timeout=window.setTimeout(()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0},this.time))}error(e){this.destination.error?.(e)}};function de(t){return e=>new l(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){this.destination.error?.(e)}};var bt=(t,e)=>{let r=(n,i)=>{let s=Object.keys(n);for(let o in i)if(!s.includes(o)||i[o]!==n[o])return!1;return!0};return r(t,e)&&r(e,t)},ft=(t,e)=>t instanceof Object&&e instanceof Object?bt(t,e):t===e;function fe(t=ft){return e=>new l(r=>e.subscribe(new $(r,t)))}var be={},$=class{constructor(e,r){this.destination=e;this.predicate=r;this.lastValue=be}next(e){let r;try{r=this.lastValue===be||!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 N(t){return e=>new l(r=>e.subscribe(new Y(r,t)))}var Y=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 Te(t){return N(()=>t)}function ye(){return t=>new l(e=>{let r=!1,n=!1,i=t.subscribe(s=>{r||(r=!0,e.next(s)),n&&i.unsubscribe()},s=>{r=!0,e.error?.(s),n&&i.unsubscribe()});return n=!0,r&&i.unsubscribe(),i})}function ve(){return t=>new l(e=>t.subscribe(new X(e)))}var X=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 Ie(t){return e=>new l(r=>e.subscribe(new J(r,t)))}var J=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 ge(t){return e=>new l(r=>e.subscribe(new Z(r,t)))}var Z=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)}};var Tt=(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))(Tt||{});var yt=(c=>(c.Armenian="58",c.Azerbaijani="57",c.Belarusian="114",c.English="3",c.Kazakh="97",c.Portuguese="73",c.Russian="0",c.Spanish="4",c.Ukrainian="1",c.Uzbek="65",c.Vietnamese="75",c))(yt||{}),vt="vk.com",wi=async(t,e,r)=>{let n=new URL(`https://${vt}/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 It(s,r)},It=(t,e)=>Object.fromEntries(Object.entries(t.keys).map(([r,n])=>[r.substring(`${e}_`.length),gt(n)])),gt=t=>Array.isArray(t)?t[0]:t;var xt=(r=>(r.RU="ru",r.EN="en",r))(xt||{});var ht={UI:"__vkVideoPlayer",CORE:"__vkVideoCore"},Ot=(()=>{let t=0;return()=>{let e=t;return t=(t+1)%Number.MAX_SAFE_INTEGER,e}})(),xe=class{constructor(e){this.id=Ot();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 ht[e]}};var he={};oe(he,{create:()=>Et,destroy:()=>wt,push:()=>St,subscribe:()=>At});var E=new Map,Et=(t,e)=>E.set(t,e??[]),wt=t=>E.delete(t),St=(t,e)=>{let r=E.get(t);r&&(typeof r=="function"?r(e):r.push(e))},At=(t,e)=>{let r=E.get(t);if(r){if(r&&Array.isArray(r))for(let n of r)e(n);E.set(t,e)}};export{Tt as ErrorCategory,xt as InterfaceLanguage,xe as InternalsExposure,M as Logger,l as Observable,y as Subject,d as Subscription,P as SubscriptionRemovable,U as Tracer,Le as VERSION,yt as VKNumericLanguage,L as ValueSubject,j as VideoQuality,_e as abortable,Qe as addScript,et as areQualitiesExact,Me as assertEmptyArray,T as assertNever,Ne as assertNonNullable,Ve as assertNotEmptyArray,Ce as assertNullable,tt as assertQualityIsExact,pe as buffer,Pe as checkNever,st as clearVideoElement,nt as cloneDeep,k as cloneDeepWith,le as combine,kr as createURL,ue as debounce,F as debounceFn,qe as detectEmbed,he as devNull,rt as fillWithDefault,de as filter,fe as filterChanged,R as flattenObject,ut as fromEvent,De as getExponentialDelay,Ye as getHighestQuality,at as getTraceSubscriptionMethod,ct as interval,Be as isHigher,He as isHigherOrEqual,W as isInvariantQuality,z as isLower,$e as isLowerOrEqual,x as isNonNullable,_ as isNullable,Sr as isValidURL,wi as loadVKLangPack,N as map,Te as mapTo,ce as merge,I as noop,Ue as now,pt as observableFrom,ot as observeElementSize,ye as once,ve as pairwise,se as safeStorage,ge as skip,Ie as tap,me as throttle,G as throttleFn,dr as timeCodeToString,lt as timeout,Xe as videoHeightToQuality,Ze as videoQualityToHeight,Je as videoSizeToQuality};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-shared",
3
- "version": "1.0.59-dev.f7cc031b.0",
3
+ "version": "1.0.60-beta.0",
4
4
  "author": "vk.com",
5
5
  "description": "Shared code for vk.com videoplayer",
6
6
  "homepage": "https://vk.com",
@@ -55,8 +55,6 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@opentelemetry/api": "^1.8.0",
58
- "@opentelemetry/core": "^1.25.0",
59
- "@opentelemetry/instrumentation": "^0.52.0",
60
58
  "@opentelemetry/sdk-trace-web": "^1.24.1",
61
59
  "@tracer/opentelemetry": "https://artifactory-external.vkpartner.ru/artifactory/api/npm/npm-odkl-nexus/@tracer/opentelemetry/-/opentelemetry-1.1.7.tgz"
62
60
  }
@@ -1,12 +1,18 @@
1
- import { Attributes } from '@opentelemetry/api';
1
+ import type { Attributes } from '@opentelemetry/api';
2
2
  import { ITracer } from './types';
3
3
  export declare class Tracer implements ITracer {
4
- private readonly tracer;
5
- private readonly span;
6
- private readonly context;
7
- private readonly childTracers;
8
- private readonly spanExporter;
4
+ private readonly dynamicImportTimeout;
5
+ private span;
6
+ private context;
7
+ private childTracers;
8
+ private tracer;
9
+ private spanExporter;
10
+ private static dynamicImportStatus;
11
+ private static dynamicImports;
12
+ private static dynamicImportPromise;
9
13
  private constructor();
14
+ private init;
15
+ private loadOpentelemetry;
10
16
  log(name: string, attributes?: Attributes): void;
11
17
  error(name: string, attributes?: Attributes): void;
12
18
  critical(name: string, attributes?: Attributes): void;
@@ -1,6 +1,19 @@
1
- import { Attributes, Context } from '@opentelemetry/api';
2
- import { ReadableSpan } from '@opentelemetry/sdk-trace-web';
3
- import { Tracer as OtlpTracer } from '@opentelemetry/sdk-trace-base/build/src/Tracer';
1
+ import type { Attributes, Context } from '@opentelemetry/api';
2
+ import type { ReadableSpan } from '@opentelemetry/sdk-trace-web';
3
+ import type { Tracer as OtlpTracer } from '@opentelemetry/sdk-trace-web';
4
+ import type * as TracerOpentelemetry from '@tracer/opentelemetry';
5
+ import type * as OpentelemetryApi from '@opentelemetry/api';
6
+ import type * as OpentelemetrySdk from '@opentelemetry/sdk-trace-web';
7
+ export type { TracerOpentelemetry };
8
+ export type { OpentelemetryApi };
9
+ export type { OpentelemetrySdk };
10
+ export declare enum TracerDynamicImportStatus {
11
+ NotStarted = "not_started",
12
+ InProgress = "in_progress",
13
+ Failed = "failed",
14
+ Completed = "completed",
15
+ Initialized = "initialized"
16
+ }
4
17
  export declare enum TraceEventType {
5
18
  Log = "log",
6
19
  Error = "error",
@@ -11,6 +24,11 @@ export interface ITracerParams {
11
24
  parentContext?: Context;
12
25
  tracer?: OtlpTracer;
13
26
  }
27
+ export interface ITracerDynamicImports {
28
+ opentelemetryApi: typeof OpentelemetryApi;
29
+ opentelemetrySdk: typeof OpentelemetrySdk;
30
+ tracer: typeof TracerOpentelemetry;
31
+ }
14
32
  export interface ITracer {
15
33
  log: (name: string, attributes?: Attributes) => void;
16
34
  error: (name: string, attributes?: Attributes) => void;
@@ -1,6 +1,6 @@
1
1
  import type { ISubscription, IUnsubscriber } from './types';
2
2
  export default class Subscription implements ISubscription {
3
- private subscriptions;
3
+ protected subscriptions: Array<(() => void) | ISubscription>;
4
4
  unsubscribe(): void;
5
5
  add(item: ISubscription | IUnsubscriber): ISubscription;
6
6
  }
@@ -0,0 +1,5 @@
1
+ import Subscription from './Subscription';
2
+ import { ISubscription, IUnsubscriber } from './types';
3
+ export default class SubscriptionRemovable extends Subscription {
4
+ remove(item: ISubscription | IUnsubscriber): void;
5
+ }
@@ -8,6 +8,7 @@ export { default as timeout } from './timeout';
8
8
  export { default as interval } from './interval';
9
9
  export { default as observableFrom } from './observableFrom';
10
10
  export { default as fromEvent } from './fromEvent';
11
+ export { default as SubscriptionRemovable } from './SubscriptionRemovable';
11
12
  export { default as buffer } from './operators/buffer';
12
13
  export { default as debounce } from './operators/debounce';
13
14
  export { default as throttle } from './operators/throttle';
@@ -16,6 +16,10 @@ export interface IError {
16
16
  * Возникшее исключение
17
17
  */
18
18
  thrown?: Error | unknown;
19
+ /**
20
+ * Отправлять в трейс не как error а как log
21
+ */
22
+ traceAsLog?: boolean;
19
23
  }
20
24
  export interface IWarning {
21
25
  /**