@brandbrigade/ott-bb-player 1.1.3 → 1.1.4
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/dist/OTTPlayer.js +10 -9
- package/package.json +1 -1
package/dist/OTTPlayer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(ce,ge){typeof exports=="object"&&typeof module<"u"?module.exports=ge():typeof define=="function"&&define.amd?define(ge):(ce=typeof globalThis<"u"?globalThis:ce||self,ce.OTTPlayer=ge())})(this,function(){"use strict";const ce=r=>Math.abs(r-59.94005994005994)<20?59.94:Math.abs(r-29.97002997002997)<10?29.97:Math.abs(r-14.985014985014985)<8?14.98:0,ge=r=>r>30&&r<70?59.94005994005994:r>15?29.97002997002997:r>7?14.985014985014985:0;class it{constructor(e){this.frameDurations=[],this.frameDurationsCapacity=e,this.lastTimestamp=null}addFrameDuration(e){return this.frameDurations.push(e),this.frameDurations.length>this.frameDurationsCapacity&&this.frameDurations.shift(),this.calculateAverage()}addTimestamp(e){if(this.lastTimestamp===null)return this.lastTimestamp=e,null;const t=e-this.lastTimestamp;return this.lastTimestamp=e,this.addFrameDuration(t)}calculateAverage(){if(this.frameDurations.length===0)return 0;const t=this.frameDurations.reduce((o,a)=>o+a,0)/this.frameDurations.length,s=this.frameDurations.filter(o=>Math.abs(o-t)<=t*.2);return s.reduce((o,a)=>o+a,0)/s.length||t}getFPS(){const e=this.calculateAverage();if(e===0)return 0;const t=1/e;return ge(t)}getPerciseFPS(){const e=this.calculateAverage();return e===0?0:1/e}}const U=class U{constructor(e,t,s,i,n){this.copy=()=>new U(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const o=":";let a=("0"+this.h).slice(-2)+o+("0"+this.m).slice(-2)+o+("0"+this.s).slice(-2)+o+("0"+this.f).slice(-2);return a+="."+(this.field?"1":"2"),a},this.toZipTimeCodeString=()=>{const o=this.copy();return o.f=0,o.s=o.s%2===0?o.s:o.s-1,o.field=0,U.toStr(o)},this.toFrames=o=>{let a=60,c=0;Math.floor(o)==60?(a=60,c=0):Math.floor(o)==59?(a=60,c=4):Math.floor(o)==30?(a=30,c=0):Math.floor(o)==29&&(a=30,c=2);let d=this.h,l=this.m,u=this.s,f=this.f,p=this.field;const h=d*60+l,g=(h-Math.floor(h/10))*c;return d*(a*3600)+l*(a*60)+u*a+(f*2+p)-g},this.addSeconds=o=>{let a=this.copy();if(a.s+=o,a.s>=60){const c=Math.floor(a.s/60);if(a.s=a.s%60,a.m+=c,a.m>=60){const d=Math.floor(a.m/60);a.m=a.m%60,a.h+=d}}return a},this.addFrames=(o,a)=>{let c=this.toFrames(a);return c+=o,U.fromFrames(c,a)},this.subtractFrames=(o,a)=>this.addFrames(-o,a),this.h=e||0,this.m=t||0,this.s=s||0,this.f=i||0,this.field=n||0}static compare(e,t){return e.h!==t.h?e.h<t.h?-1:1:e.m!==t.m?e.m<t.m?-1:1:e.s!==t.s?e.s<t.s?-1:1:e.f!==t.f?e.f<t.f?-1:1:e.field!==t.field?e.field<t.field?-1:1:0}static generateTimecodeRange(e,t,s){const i=[];let n=e;for(;U.compare(n,t)<=0;)i.push(n),n=n.addSeconds(s);return i}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(e){return this.toFrames(e)*1e3/e}};U.calculateCurrentTimeCode=e=>{var u;if(!e.video||!e.clocker||!e.gameParams)throw new Error("OTTPlayer is not initialized");const t=e.video,s=e.clocker,i=s.videoFPScalculator.getFPS(),a=(t.currentTime-s.syncPoint.playerTime)%(60*60*24)*i+s.syncPoint.frame;if(a===0||i===0)throw new Error("Current frame is 0 or fps is 0");const c=U.calculateCurrentOffset(a,(u=e.gameParams)==null?void 0:u.offsets);if(c===void 0)throw new Error("Offset is undefined");let d=Math.floor(a-c);return d<0&&(d+=5178816),d>=5178816&&(d-=5178816),U.fromFrames(d,i)},U.calculateCurrentOffset=(e,t)=>{for(let s=1;s<t.length;s++)if(e<t[s].frame)return t[s-1].offset;return Math.abs(t[t.length-1].offset)},U.fromFrames=(e,t)=>{let s=60,i=0;Math.floor(t)==60?(s=60,i=0):Math.floor(t)==59?(s=60,i=4):Math.floor(t)==30?(s=30,i=0):Math.floor(t)==29&&(s=30,i=2);let n=Math.floor(t*60),o=Math.floor(t*60*10),a=o*6,c=e,d=Math.floor(c/a);c-=d*a;let l=Math.floor(c/o);c-=l*o,c>=s*60&&(c+=i*(Math.floor((c-s*60)/n)+1));let u=Math.floor(c/(s*60));c-=u*(s*60);let f=Math.floor(c/s);c-=f*s;let p=c;u+=l*10;let h=0;return h=p%2,p=Math.floor(p/2),new U(d,u,f,p,h)},U.toStr=e=>{const t="_";let s=("0"+e.h).slice(-2)+t+("0"+e.m).slice(-2)+t+("0"+e.s).slice(-2)+t+("0"+e.f).slice(-2);return e.field&&(s+="_1"),s},U.fromStr=e=>{const s=e.split("_").map(Number);if(s.length==4){const[i,n,o,a]=s;return new U(i,n,o,a,0)}else if(s.length==5){const[i,n,o,a,c]=s;return new U(i,n,o,a,c)}else throw new Error("Invalid timecode format: "+e)},U.fromMetadata=e=>{const t=/^(\d{2}):(\d{2}):(\d{2}):(\d{2})(?:\.(\d))?$/,s=e.timecode.match(t);if(!s)throw new Error("Invalid timecode format: "+e.timecode);const[,i,n,o,a,c]=s,d=Number(i),l=Number(n),u=Number(o),f=Number(a),p=c?Number(c):0;return new U(d,l,u,f,p)};let L=U;const ss=async(r,e)=>{e&&Object.assign(r,e);let t;typeof document>"u"?t=new URL(self.location.href):t=new URL(document.location.href);const s=t.searchParams.get("config");if(s){let i;if(is(s))i=await(await fetch(s)).json();else try{i=JSON.parse(decodeURIComponent(s))}catch(n){console.error("Failed to parse config parameter as JSON:",n);return}Object.assign(r,i)}},is=r=>{try{return new URL(r),!0}catch{return!1}},y=(r,e)=>e==="Errors"?!0:!r.debug||!r.debug.on?!1:r.debug[`log${e}`];class ns{constructor(e){this.last10=[],this.errorsInProgress=[],this.lastFrameTC=null,this.fps=e}setFPS(e){this.fps=e}timecodeRecieved(e){if(!e)return;const t=L.fromStr(e);if(this.last10.push(t),this.last10.length>10&&this.last10.shift(),this.lastFrameTC){const s=this.incrementInterlaced(this.lastFrameTC);L.compare(t,s)!==0&&(console.warn("Timecode sequence is invalid! Detected at:",e),this.errorsInProgress.push({preTCs:[...this.last10],postTCs:[],framesAfter:0,printed:!1}))}for(const s of this.errorsInProgress)s.printed||(s.postTCs.push(t),s.framesAfter++);for(const s of this.errorsInProgress)if(!s.printed&&s.framesAfter>=10){console.error("Full 20-frame sequence around error:");const i=[...s.preTCs,...s.postTCs];console.error(i.map(n=>L.toStr(n))),s.printed=!0}this.lastFrameTC=t}incrementInterlaced(e){const t=e.copy();return t.field===0?(t.field=1,t):(t.field=0,t.f++,t.f>=30&&(t.f=0,t.s++,t.s>=60&&(t.s=0,t.m++,t.m>=60&&(t.m=0,t.h++))),t)}}class os{constructor(e,t){this.click=async s=>{const i=this.video.getBoundingClientRect(),n=(s.clientX-i.left)/i.width,o=(s.clientY-i.top)/i.height,a={x:n,y:o};this.renderer.postMessage({type:"VIDEO_CLICK",clickData:a})},this.video=e.video,this.logger=e.logger,this.renderer=t,this.renderer.onmessage=s=>{if(s.data.type==="OPEN_URL"){const i=s.data.url;i&&(window.open(i,"_blank"),this.logger.info("didClickAd",{url:i}))}}}}const Gt='(function(){"use strict";const T=(e,t)=>t==="Errors"?!0:!e.debug||!e.debug.on?!1:e.debug[`log${t}`],_={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},x=console,z={};Object.keys(_).forEach(e=>{z[e]=x[e]});const pe="Datadog Browser SDK:",w={debug:z.debug.bind(x,pe),log:z.log.bind(x,pe),info:z.info.bind(x,pe),warn:z.warn.bind(x,pe),error:z.error.bind(x,pe)},Xe="https://docs.datadoghq.com",Lt=`${Xe}/real_user_monitoring/browser/troubleshooting`,Ce="More details:";function At(e,t){return(...n)=>{try{return e(...n)}catch(r){w.error(t,r)}}}function ve(e){return e!==0&&Math.random()*100<=e}function Un(e){return Bn(e)&&e>=0&&e<=100}function Bn(e){return typeof e=="number"}const he=1e3,K=60*he,It=60*K,Gn=365*(24*It);function ge(){return new Date().getTime()}function F(){return ge()}function Le(){return performance.now()}function U(){return{relative:Le(),timeStamp:F()}}function jn(){return{relative:0,timeStamp:kt()}}function Hn(e,t){return t-e}function zn(e,t){return e+t}function Kn(e){return e-kt()}let Qe;function kt(){return Qe===void 0&&(Qe=performance.timing.navigationStart),Qe}const D=1024,xt=1024*D,Wn=/[^\\u0000-\\u007F]/;function et(e){return Wn.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function Jn(e){return{...e}}function Dt(e,t){return Object.keys(e).some(n=>e[n]===t)}function me(e){return Object.keys(e).length===0}function B(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let e=_dd_temp_;return delete Object.prototype._dd_temp_,typeof e!="object"&&(typeof self=="object"?e=self:typeof window=="object"?e=window:e={}),e}function re(e,t){const n=B();let r;return n.Zone&&typeof n.Zone.__symbol__=="function"&&(r=e[n.Zone.__symbol__(t)]),r||(r=e[t]),r}let Ae,Mt=!1;function Yn(e){Ae=e}function qn(e){Mt=e}function Zn(e,t,n){const r=n.value;n.value=function(...o){return(Ae?y(r):r).apply(this,o)}}function y(e){return function(){return Se(e,this,arguments)}}function Se(e,t,n){try{return e.apply(t,n)}catch(r){Vn(r)}}function Vn(e){if(tt(e),Ae)try{Ae(e)}catch(t){tt(t)}}function tt(...e){Mt&&w.error("[MONITOR]",...e)}function ye(e,t){return re(B(),"setTimeout")(y(e),t)}function Nt(e){re(B(),"clearTimeout")(e)}function nt(e,t){return re(B(),"setInterval")(y(e),t)}function $t(e){re(B(),"clearInterval")(e)}class O{constructor(t){this.onFirstSubscribe=t,this.observers=[]}subscribe(t){return this.observers.push(t),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(n=>t!==n),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(t){this.observers.forEach(n=>n(t))}}function Pt(...e){return new O(t=>{const n=e.map(r=>r.subscribe(o=>t.notify(o)));return()=>n.forEach(r=>r.unsubscribe())})}function Ft(e,t,n){let r=!1,o,s;return{throttled:(...i)=>{if(r){o=i;return}e(...i),r=!0,s=ye(()=>{o&&e(...o),r=!1,o=void 0},t)},cancel:()=>{Nt(s),r=!1,o=void 0}}}function G(){}function j(e){return e?(parseInt(e,10)^Math.random()*16>>parseInt(e,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,j)}const Ie=/([\\w-]+)\\s*=\\s*([^;]+)/g;function Xn(e,t){for(Ie.lastIndex=0;;){const n=Ie.exec(e);if(n){if(n[1]===t)return n[2]}else break}}function Qn(e){const t=new Map;for(Ie.lastIndex=0;;){const n=Ie.exec(e);if(n)t.set(n[1],n[2]);else break}return t}function er(e,t,n=""){const r=e.charCodeAt(t-1),s=r>=55296&&r<=56319?t+1:t;return e.length<=s?e:`${e.slice(0,s)}${n}`}function tr(){return nr()===0}let ke;function nr(){return ke??(ke=rr())}function rr(e=window){var t;const n=e.navigator.userAgent;return e.chrome||/HeadlessChrome/.test(n)?0:((t=e.navigator.vendor)===null||t===void 0?void 0:t.indexOf("Apple"))===0||/safari/i.test(n)&&!/chrome|android/i.test(n)?1:2}function be(e,t,n=0,r){const o=new Date;o.setTime(o.getTime()+n);const s=`expires=${o.toUTCString()}`,i=r&&r.crossSite?"none":"strict",a=r&&r.domain?`;domain=${r.domain}`:"",c=r&&r.secure?";secure":"",l=r&&r.partitioned?";partitioned":"";document.cookie=`${e}=${t};${s};path=/;samesite=${i}${a}${c}${l}`}function rt(e){return Xn(document.cookie,e)}let ot;function W(e){return ot||(ot=Qn(document.cookie)),ot.get(e)}function Ut(e,t){be(e,"",0,t)}function or(e){if(document.cookie===void 0||document.cookie===null)return!1;try{const t=`dd_cookie_test_${j()}`,n="test";be(t,n,K,e);const r=rt(t)===n;return Ut(t,e),r}catch(t){return w.error(t),!1}}let st;function sr(){if(st===void 0){const e=`dd_site_test_${j()}`,t="test",n=window.location.hostname.split(".");let r=n.pop();for(;n.length&&!rt(e);)r=`${n.pop()}.${r}`,be(e,t,he,{domain:r});Ut(e,{domain:r}),st=r}return st}const oe="_dd_s";function xe(e){return Object.values(e)}function ir(e){return Object.entries(e)}const it=4*It,Bt=15*K,ar=Gn,Ee={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},Gt=/^([a-zA-Z]+)=([a-z0-9-]+)$/,at="&";function cr(e){return!!e&&(e.indexOf(at)!==-1||Gt.test(e))}const ur="1";function J(e,t){const n={isExpired:ur};return t.trackAnonymousUser&&(e!=null&&e.anonymousId?n.anonymousId=e==null?void 0:e.anonymousId:n.anonymousId=j()),n}function De(e){return me(e)}function jt(e){return!De(e)}function Me(e){return e.isExpired!==void 0||!lr(e)}function lr(e){return(e.created===void 0||ge()-Number(e.created)<it)&&(e.expire===void 0||ge()<Number(e.expire))}function Ht(e){e.expire=String(ge()+Bt)}function ct(e){return ir(e).map(([t,n])=>t==="anonymousId"?`aid=${n}`:`${t}=${n}`).join(at)}function zt(e){const t={};return cr(e)&&e.split(at).forEach(n=>{const r=Gt.exec(n);if(r!==null){const[,o,s]=r;o==="aid"?t.anonymousId=s:t[o]=s}}),t}const dr="_dd",fr="_dd_r",pr="_dd_l",hr="rum",gr="logs";function mr(e){if(!W(oe)){const n=W(dr),r=W(fr),o=W(pr),s={};n&&(s.id=n),o&&/^[01]$/.test(o)&&(s[gr]=o),r&&/^[012]$/.test(r)&&(s[hr]=r),jt(s)&&(Ht(s),e.persistSession(s))}}function Kt(e){const t=Tr(e);return or(t)?{type:Ee.COOKIE,cookieOptions:t}:void 0}function Sr(e,t){const n={isLockEnabled:tr(),persistSession:yr(t),retrieveSession:Er,expireSession:r=>br(t,r,e)};return mr(n),n}function yr(e){return t=>{be(oe,ct(t),Bt,e)}}function br(e,t,n){const r=J(t,n);be(oe,ct(r),n.trackAnonymousUser?ar:it,e)}function Er(){const e=rt(oe);return zt(e)}function Tr(e){const t={};return t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=sr()),t}const _r="_dd_test_";function Wt(){try{const e=j(),t=`${_r}${e}`;localStorage.setItem(t,e);const n=localStorage.getItem(t);return localStorage.removeItem(t),e===n?{type:Ee.LOCAL_STORAGE}:void 0}catch{return}}function wr(e){return{isLockEnabled:!1,persistSession:Jt,retrieveSession:Or,expireSession:t=>Rr(t,e)}}function Jt(e){localStorage.setItem(oe,ct(e))}function Or(){const e=localStorage.getItem(oe);return zt(e)}function Rr(e,t){Jt(J(e,t))}const Cr=10,vr=100,Yt=[];let Ne;function Y(e,t,n=0){var r;const{isLockEnabled:o,persistSession:s,expireSession:i}=t,a=f=>s({...f,lock:l}),c=()=>{const f=t.retrieveSession(),h=f.lock;return f.lock&&delete f.lock,{session:f,lock:h}};if(Ne||(Ne=e),e!==Ne){Yt.push(e);return}if(o&&n>=vr){qt(t);return}let l,u=c();if(o){if(u.lock){$e(e,t,n);return}if(l=j(),a(u.session),u=c(),u.lock!==l){$e(e,t,n);return}}let d=e.process(u.session);if(o&&(u=c(),u.lock!==l)){$e(e,t,n);return}if(d&&(Me(d)?i(d):(Ht(d),o?a(d):s(d))),o&&!(d&&Me(d))){if(u=c(),u.lock!==l){$e(e,t,n);return}s(u.session),d=u.session}(r=e.after)===null||r===void 0||r.call(e,d||u.session),qt(t)}function $e(e,t,n){ye(()=>{Y(e,t,n+1)},Cr)}function qt(e){Ne=void 0;const t=Yt.shift();t&&Y(t,e)}const Zt=he;function Lr(e){switch(e.sessionPersistence){case Ee.COOKIE:return Kt(e);case Ee.LOCAL_STORAGE:return Wt();case void 0:{let t=Kt(e);return!t&&e.allowFallbackToLocalStorage&&(t=Wt()),t}default:w.error(`Invalid session persistence \'${String(e.sessionPersistence)}\'`)}}function Ar(e,t,n,r){const o=new O,s=new O,i=new O,a=e.type===Ee.COOKIE?Sr(t,e.cookieOptions):wr(t),{expireSession:c}=a,l=nt(g,Zt);let u;E();const{throttled:d,cancel:f}=Ft(()=>{Y({process:S=>{if(De(S))return;const fe=b(S);return de(fe),fe},after:S=>{jt(S)&&!k()&&Mi(S),u=S}},a)},Zt);function h(){Y({process:S=>k()?b(S):void 0},a)}function g(){Y({process:S=>Me(S)?J(S,t):void 0,after:b},a)}function b(S){return Me(S)&&(S=J(S,t)),k()&&(te(S)?ne():(i.notify({previousState:u,newState:S}),u=S)),S}function E(){Y({process:S=>{if(De(S))return J(S,t)},after:S=>{u=S}},a)}function de(S){if(De(S))return!1;const{trackingType:fe,isTracked:$i}=r(S[n]);S[n]=fe,delete S.isExpired,$i&&!S.id&&(S.id=j(),S.created=String(ge()))}function k(){return u[n]!==void 0}function te(S){return u.id!==S.id||u[n]!==S[n]}function ne(){u=J(u,t),s.notify()}function Mi(S){u=S,o.notify()}function Ni(S){Y({process:fe=>({...fe,...S}),after:b},a)}return{expandOrRenewSession:d,expandSession:h,getSession:()=>u,renewObservable:o,expireObservable:s,sessionStateUpdateObservable:i,restartSession:E,expire:()=>{f(),c(u),b(J(u,t))},stop:()=>{$t(l)},updateSessionState:Ni}}const ut={GRANTED:"granted",NOT_GRANTED:"not-granted"};function Ir(e){const t=new O;return{tryToInit(n){e||(e=n)},update(n){e=n,t.notify()},isGranted(){return e===ut.GRANTED},observable:t}}function q(e,t,n){if(typeof e!="object"||e===null)return JSON.stringify(e);const r=se(Object.prototype),o=se(Array.prototype),s=se(Object.getPrototypeOf(e)),i=se(e);try{return JSON.stringify(e,t,n)}catch{return"<error: unable to serialize object>"}finally{r(),o(),s(),i()}}function se(e){const t=e,n=t.toJSON;return n?(delete t.toJSON,()=>{t.toJSON=n}):G}function lt(e){return kr(e,location.href).href}function kr(e,t){const n=xr();if(n)try{return t!==void 0?new n(e,t):new n(e)}catch(s){throw new Error(`Failed to construct URL: ${String(s)} ${q({url:e,base:t})}`)}if(t===void 0&&!/:/.test(e))throw new Error(`Invalid URL: \'${e}\'`);let r=document;const o=r.createElement("a");if(t!==void 0){r=document.implementation.createHTMLDocument("");const s=r.createElement("base");s.href=t,r.head.appendChild(s),r.body.appendChild(o)}return o.href=e,o}const Vt=URL;let Pe;function xr(){if(Pe===void 0)try{Pe=new Vt("http://test/path").href==="http://test/path"}catch{Pe=!1}return Pe?Vt:void 0}const Dr="datad0g.com",Mr="dd0g-gov.com",ie="datadoghq.com",Nr="ddog-gov.com",$r="pci.browser-intake-datadoghq.com",Pr=["ddsource","ddtags"];function Te(e,t,n){const r=Fr(e,t);return{build(o,s){const i=Br(e,t,n,o,s);return r(i)},urlPrefix:r(""),trackType:t}}function Fr(e,t){const n=`/api/v2/${t}`,r=e.proxy;if(typeof r=="string"){const s=lt(r);return i=>`${s}?ddforward=${encodeURIComponent(`${n}?${i}`)}`}if(typeof r=="function")return s=>r({path:n,parameters:s});const o=Ur(t,e);return s=>`https://${o}${n}?${s}`}function Ur(e,t){const{site:n=ie,internalAnalyticsSubdomain:r}=t;if(e==="logs"&&t.usePciIntake&&n===ie)return $r;if(r&&n===ie)return`${r}.${ie}`;if(n===Mr)return`http-intake.logs.${n}`;const o=n.split("."),s=o.pop();return`browser-intake-${o.join("-")}.${s}`}function Br({clientToken:e,internalAnalyticsSubdomain:t},n,r,o,{retry:s,encoding:i}){const a=["sdk_version:6.5.0",`api:${o}`].concat(r);s&&a.push(`retry_count:${s.count}`,`retry_after:${s.lastFailureStatus}`);const c=["ddsource=browser",`ddtags=${encodeURIComponent(a.join(","))}`,`dd-api-key=${e}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${j()}`];return i&&c.push(`dd-evp-encoding=${i}`),n==="rum"&&c.push(`batch_time=${F()}`),t&&c.reverse(),c.join("&")}const Gr=200;function jr(e){const{env:t,service:n,version:r,datacenter:o}=e,s=[];return t&&s.push(Fe("env",t)),n&&s.push(Fe("service",n)),r&&s.push(Fe("version",r)),o&&s.push(Fe("datacenter",o)),s}function Fe(e,t){const n=Gr-e.length-1;(t.length>n||Hr(t))&&w.warn(`${e} value doesn\'t meet tag requirements and will be sanitized. ${Ce} ${Xe}/getting_started/tagging/#defining-tags`);const r=t.replace(/,/g,"_");return`${e}:${r}`}function Hr(e){return zr()?new RegExp("[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]","u").test(e):!1}function zr(){try{return new RegExp("[\\\\p{Ll}]","u"),!0}catch{return!1}}function Kr(e){const t=e.site||ie,n=jr(e),r=Wr(e,n);return{replica:Jr(e,n),site:t,...r}}function Wr(e,t){return{logsEndpointBuilder:Te(e,"logs",t),rumEndpointBuilder:Te(e,"rum",t),sessionReplayEndpointBuilder:Te(e,"replay",t)}}function Jr(e,t){if(!e.replica)return;const n={...e,site:ie,clientToken:e.replica.clientToken},r={logsEndpointBuilder:Te(n,"logs",t),rumEndpointBuilder:Te(n,"rum",t)};return{applicationId:e.replica.applicationId,...r}}function Yr(e){return Pr.every(t=>e.includes(t))}function dt(e,t){return e!=null&&typeof e!="string"?(w.error(`${t} must be defined as a string`),!1):!0}function qr(e){return e&&typeof e=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(e)?(w.error(`Site should be a valid Datadog site. ${Ce} ${Xe}/getting_started/site/.`),!1):!0}function Ue(e,t){return e!==void 0&&!Un(e)?(w.error(`${t} Sample Rate should be a number between 0 and 100`),!1):!0}function Zr(e){var t,n,r,o,s,i;if(!e||!e.clientToken){w.error("Client Token is not configured, we will not send any data.");return}if(!(!qr(e.site)||!Ue(e.sessionSampleRate,"Session")||!Ue(e.telemetrySampleRate,"Telemetry")||!Ue(e.telemetryConfigurationSampleRate,"Telemetry Configuration")||!Ue(e.telemetryUsageSampleRate,"Telemetry Usage")||!dt(e.version,"Version")||!dt(e.env,"Env")||!dt(e.service,"Service"))){if(e.trackingConsent!==void 0&&!Dt(ut,e.trackingConsent)){w.error(\'Tracking Consent should be either "granted" or "not-granted"\');return}return{beforeSend:e.beforeSend&&At(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:Lr(e),sessionSampleRate:(t=e.sessionSampleRate)!==null&&t!==void 0?t:100,telemetrySampleRate:(n=e.telemetrySampleRate)!==null&&n!==void 0?n:20,telemetryConfigurationSampleRate:(r=e.telemetryConfigurationSampleRate)!==null&&r!==void 0?r:5,telemetryUsageSampleRate:(o=e.telemetryUsageSampleRate)!==null&&o!==void 0?o:5,service:e.service||void 0,silentMultipleInit:!!e.silentMultipleInit,allowUntrustedEvents:!!e.allowUntrustedEvents,trackingConsent:(s=e.trackingConsent)!==null&&s!==void 0?s:ut.GRANTED,trackAnonymousUser:(i=e.trackAnonymousUser)!==null&&i!==void 0?i:!0,storeContextsAcrossPages:!!e.storeContextsAcrossPages,batchBytesLimit:16*D,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*he,batchMessagesLimit:50,messageBytesLimit:256*D,...Kr(e)}}}function Vr(e){return{session_sample_rate:e.sessionSampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:e.telemetryUsageSampleRate,use_before_send:!!e.beforeSend,use_partitioned_cross_site_session_cookie:e.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:!!e.proxy,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_anonymous_user:e.trackAnonymousUser,session_persistence:e.sessionPersistence,allow_fallback_to_local_storage:!!e.allowFallbackToLocalStorage,store_contexts_across_pages:!!e.storeContextsAcrossPages,allow_untrusted_events:!!e.allowUntrustedEvents,tracking_consent:e.trackingConsent}}var ft;(function(e){e.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",e.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(ft||(ft={}));const Xt=new Set;function Xr(e){Array.isArray(e)&&Qr(e.filter(t=>Dt(ft,t)))}function Qr(e){e.forEach(t=>{Xt.add(t)})}function eo(){return Xt}const _e="?";function M(e){const t=[];let n=pt(e,"stack");const r=String(e);return n&&n.startsWith(r)&&(n=n.slice(r.length)),n&&n.split(`\n`).forEach(o=>{const s=ro(o)||so(o)||ao(o)||lo(o);s&&(!s.func&&s.line&&(s.func=_e),t.push(s))}),{message:pt(e,"message"),name:pt(e,"name"),stack:t}}const Qt="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\\\w+\\\\.|\\\\/).*?)",ae="(?::(\\\\d+))",to=new RegExp(`^\\\\s*at (.*?) ?\\\\(${Qt}${ae}?${ae}?\\\\)?\\\\s*$`,"i"),no=new RegExp(`\\\\((\\\\S*)${ae}${ae}\\\\)`);function ro(e){const t=to.exec(e);if(!t)return;const n=t[2]&&t[2].indexOf("native")===0,r=t[2]&&t[2].indexOf("eval")===0,o=no.exec(t[2]);return r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]),{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||_e,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}const oo=new RegExp(`^\\\\s*at ?${Qt}${ae}?${ae}??\\\\s*$`,"i");function so(e){const t=oo.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:_e,line:t[2]?+t[2]:void 0,url:t[1]}}const io=/^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;function ao(e){const t=io.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||_e,line:+t[3],url:t[2]}}const co=/^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,uo=/(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;function lo(e){const t=co.exec(e);if(!t)return;const n=t[3]&&t[3].indexOf(" > eval")>-1,r=uo.exec(t[3]);return n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0),{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||_e,line:t[4]?+t[4]:void 0,url:t[3]}}function pt(e,t){if(typeof e!="object"||!e||!(t in e))return;const n=e[t];return typeof n=="string"?n:void 0}function fo(e,t,n,r){const o=[{url:t,column:r,line:n}],{name:s,message:i}=ho(e);return{name:s,message:i,stack:o}}const po=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;function ho(e){let t,n;return{}.toString.call(e)==="[object String]"&&([,t,n]=po.exec(e)),{name:t,message:n}}function Be(e){const n=new Error(e);n.name="HandlingStack";let r;return Se(()=>{const o=M(n);o.stack=o.stack.slice(2),r=Z(o)}),r}function Z(e){let t=en(e);return e.stack.forEach(n=>{const r=n.func==="?"?"<anonymous>":n.func,o=n.args&&n.args.length>0?`(${n.args.join(", ")})`:"",s=n.line?`:${n.line}`:"",i=n.line&&n.column?`:${n.column}`:"";t+=`\n at ${r}${o} @ ${n.url}${s}${i}`}),t}function en(e){return`${e.name||"Error"}: ${e.message}`}function V(e,t,n,{computeHandlingStack:r}={}){let o=e[t];if(typeof o!="function")if(t in e&&t.startsWith("on"))o=G;else return{stop:G};let s=!1;const i=function(){if(s)return o.apply(this,arguments);const a=Array.from(arguments);let c;Se(n,null,[{target:this,parameters:a,onPostCall:u=>{c=u},handlingStack:r?Be("instrumented method"):void 0}]);const l=o.apply(this,a);return c&&Se(c,null,[l]),l};return e[t]=i,{stop:()=>{s=!0,e[t]===i&&(e[t]=o)}}}const go=220*D,mo="$",So=3;function N(e,t=go){const n=se(Object.prototype),r=se(Array.prototype),o=[],s=new WeakMap,i=ht(e,mo,void 0,o,s),a=JSON.stringify(i);let c=a?a.length:0;if(c>t){mt(t,"discarded",e);return}for(;o.length>0&&c<t;){const l=o.shift();let u=0;if(Array.isArray(l.source))for(let d=0;d<l.source.length;d++){const f=ht(l.source[d],l.path,d,o,s);if(f!==void 0?c+=JSON.stringify(f).length:c+=4,c+=u,u=1,c>t){mt(t,"truncated",e);break}l.target[d]=f}else for(const d in l.source)if(Object.prototype.hasOwnProperty.call(l.source,d)){const f=ht(l.source[d],l.path,d,o,s);if(f!==void 0&&(c+=JSON.stringify(f).length+u+d.length+So,u=1),c>t){mt(t,"truncated",e);break}l.target[d]=f}}return n(),r(),i}function ht(e,t,n,r,o){const s=Eo(e);if(!s||typeof s!="object")return yo(s);const i=gt(s);if(i!=="[Object]"&&i!=="[Array]"&&i!=="[Error]")return i;const a=e;if(o.has(a))return`[Reference seen at ${o.get(a)}]`;const c=n!==void 0?`${t}.${n}`:t,l=Array.isArray(s)?[]:{};return o.set(a,c),r.push({source:s,target:l,path:c}),l}function yo(e){return typeof e=="bigint"?`[BigInt] ${e.toString()}`:typeof e=="function"?`[Function] ${e.name||"unknown"}`:typeof e=="symbol"?`[Symbol] ${e.description||e.toString()}`:e}function gt(e){try{if(e instanceof Event)return bo(e);if(e instanceof RegExp)return`[RegExp] ${e.toString()}`;const n=Object.prototype.toString.call(e).match(/\\[object (.*)\\]/);if(n&&n[1])return`[${n[1]}]`}catch{}return"[Unserializable]"}function bo(e){return{type:e.type,isTrusted:e.isTrusted,currentTarget:e.currentTarget?gt(e.currentTarget):null,target:e.target?gt(e.target):null}}function Eo(e){const t=e;if(t&&typeof t.toJSON=="function")try{return t.toJSON()}catch{}return e}function mt(e,t,n){w.warn(`The data provided has been ${t} as it is over the limit of ${e} characters:`,n)}const tn="No stack, consider using an instance of Error";function nn({stackTrace:e,originalError:t,handlingStack:n,componentStack:r,startClocks:o,nonErrorPrefix:s,source:i,handling:a}){const c=H(t),l=To(e,c,s,t),u=_o(c,e)?Z(e):tn,d=c?sn(t,i):void 0,f=e?e.name:void 0,h=rn(t),g=on(t);return{startClocks:o,source:i,handling:a,handlingStack:n,componentStack:r,originalError:t,type:f,message:l,stack:u,causes:d,fingerprint:h,context:g}}function To(e,t,n,r){return e!=null&&e.message&&(e!=null&&e.name)?e.message:t?"Empty message":`${n} ${q(N(r))}`}function _o(e,t){return t===void 0?!1:e?!0:t.stack.length>0&&(t.stack.length>1||t.stack[0].url!==void 0)}function rn(e){return H(e)&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function on(e){if(e!==null&&typeof e=="object"&&"dd_context"in e)return e.dd_context}function wo(e){var t;return(t=/@ (.+)/.exec(e))===null||t===void 0?void 0:t[1]}function H(e){return e instanceof Error||Object.prototype.toString.call(e)==="[object Error]"}function sn(e,t){let n=e;const r=[];for(;H(n==null?void 0:n.cause)&&r.length<10;){const o=M(n.cause);r.push({message:n.cause.message,source:t,type:o==null?void 0:o.name,stack:Z(o)}),n=n.cause}return r.length?r:void 0}const v={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function Oo(e){const t=(o,s)=>{const i=nn({stackTrace:o,originalError:s,startClocks:U(),nonErrorPrefix:"Uncaught",source:v.SOURCE,handling:"unhandled"});e.notify(i)},{stop:n}=Ro(t),{stop:r}=Co(t);return{stop:()=>{n(),r()}}}function Ro(e){return V(window,"onerror",({parameters:[t,n,r,o,s]})=>{let i;H(s)?i=M(s):i=fo(t,n,r,o),e(i,s??t)})}function Co(e){return V(window,"onunhandledrejection",({parameters:[t]})=>{const n=t.reason||"Empty reason",r=M(n);e(r,n)})}function vo(e){const t={version:"6.5.0",onReady(n){n()},...e};return Object.defineProperty(t,"_setDebug",{get(){return qn},enumerable:!1}),t}function Lo(e,t,n){const r=e[t];r&&!r.q&&r.version&&w.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),e[t]=n,r&&r.q&&r.q.forEach(o=>At(o,"onReady callback threw an error:")())}function an(e,t){t.silentMultipleInit||w.error(`${e} is already initialized.`)}function X(e,t,n,r,o){return St(e,t,[n],r,o)}function St(e,t,n,r,{once:o,capture:s,passive:i}={}){const a=y(f=>{!f.isTrusted&&!f.__ddIsTrusted&&!e.allowUntrustedEvents||(o&&d(),r(f))}),c=i?{capture:s,passive:i}:s,l=window.EventTarget&&t instanceof EventTarget?window.EventTarget.prototype:t,u=re(l,"addEventListener");n.forEach(f=>u.call(t,f,a,c));function d(){const f=re(l,"removeEventListener");n.forEach(h=>f.call(t,h,a,c))}return{stop:d}}const Ge={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function Ao(e,t){const n=[];t.includes(Ge.cspViolation)&&n.push(ko(e));const r=t.filter(o=>o!==Ge.cspViolation);return r.length&&n.push(Io(r)),Pt(...n)}function Io(e){return new O(t=>{if(!window.ReportingObserver)return;const n=y((o,s)=>o.forEach(i=>t.notify(xo(i)))),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),()=>{r.disconnect()}})}function ko(e){return new O(t=>{const{stop:n}=X(e,document,"securitypolicyviolation",r=>{t.notify(Do(r))});return n})}function xo(e){const{type:t,body:n}=e;return cn({type:n.id,message:`${t}: ${n.message}`,originalError:e,stack:un(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)})}function Do(e){const t=`\'${e.blockedURI}\' blocked by \'${e.effectiveDirective}\' directive`;return cn({type:e.effectiveDirective,message:`${Ge.cspViolation}: ${t}`,originalError:e,csp:{disposition:e.disposition},stack:un(e.effectiveDirective,e.originalPolicy?`${t} of the policy "${er(e.originalPolicy,100,"...")}"`:"no policy",e.sourceFile,e.lineNumber,e.columnNumber)})}function cn(e){return{startClocks:U(),source:v.REPORT,handling:"unhandled",...e}}function un(e,t,n,r,o){return n?Z({name:e,message:t,stack:[{func:"?",url:n,line:r??void 0,column:o??void 0}]}):void 0}function ln(e,t){const n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}function dn(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function je(e,t,n=Mo()){if(t===void 0)return e;if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,o)}if(n.hasAlreadyBeenSeen(t))return;if(Array.isArray(t)){const o=Array.isArray(e)?e:[];for(let s=0;s<t.length;++s)o[s]=je(o[s],t[s],n);return o}const r=dn(e)==="object"?e:{};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=je(r[o],t[o],n));return r}function fn(e){return je(void 0,e)}function ce(...e){let t;for(const n of e)n!=null&&(t=je(t,n));return t}function Mo(){if(typeof WeakSet<"u"){const t=new WeakSet;return{hasAlreadyBeenSeen(n){const r=t.has(n);return r||t.add(n),r}}}const e=[];return{hasAlreadyBeenSeen(t){const n=e.indexOf(t)>=0;return n||e.push(t),n}}}function No(){var e;const t=window.navigator;return{status:t.onLine?"connected":"not_connected",interfaces:t.connection&&t.connection.type?[t.connection.type]:void 0,effective_type:(e=t.connection)===null||e===void 0?void 0:e.effectiveType}}function $o(e){const t=new Set;return e.forEach(n=>t.add(n)),Array.from(t)}function pn(e,t){const n=e.indexOf(t);n>=0&&e.splice(n,1)}const Po=500;function hn(){const e=[];return{add:o=>{e.push(o)>Po&&e.splice(0,1)},remove:o=>{pn(e,o)},drain:o=>{e.forEach(s=>s(o)),e.length=0}}}const Q={log:"log",configuration:"configuration",usage:"usage"},Fo=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],Uo=[Nr];let gn=hn(),ue=e=>{gn.add(()=>ue(e))};function Bo(e,t){let n;const r=new O,o=new Set,s=!Uo.includes(t.site)&&ve(t.telemetrySampleRate),i={[Q.log]:s,[Q.configuration]:s&&ve(t.telemetryConfigurationSampleRate),[Q.usage]:s&&ve(t.telemetryUsageSampleRate)},a=Go();ue=l=>{const u=q(l);if(i[l.type]&&o.size<t.maxTelemetryEventsPerPage&&!o.has(u)){const d=c(e,l,a);r.notify(d),ln("telemetry",d),o.add(u)}},Yn(Sn);function c(l,u,d){return ce({type:"telemetry",date:F(),service:l,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:ce(u,{runtime_env:d,connectivity:No(),sdk_setup:"npm"}),experimental_features:Array.from(eo())},n!==void 0?n():{})}return{setContextProvider:l=>{n=l},observable:r,enabled:s}}function Go(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function jo(){gn.drain()}function Ho(e){return e.site===Dr}function mn(e,t){tt(_.debug,e,t),ue({type:Q.log,message:e,status:"debug",...t})}function Sn(e,t){ue({type:Q.log,status:"error",...Wo(e),...t})}function zo(e){ue({type:Q.configuration,configuration:e})}function Ko(e){ue({type:Q.usage,usage:e})}function Wo(e){if(H(e)){const t=M(e);return{error:{kind:t.name,stack:Z(Jo(t))},message:t.message}}return{error:{stack:tn},message:`Uncaught ${q(e)}`}}function Jo(e){return e.stack=e.stack.filter(t=>!t.url||Fo.some(n=>t.url.startsWith(n))),e}const we=1/0,Yo=K;let Oe=null;const He=new Set;function qo(){He.forEach(e=>e())}function Zo({expireDelay:e,maxEntries:t}){let n=[];const r=[];Oe||(Oe=nt(()=>qo(),Yo));const o=()=>{const h=Le()-e;for(;n.length>0&&n[n.length-1].endTime<h;){const g=n.pop();g&&r.push(g.startTime)}};He.add(o);function s(h,g){const b={value:h,startTime:g,endTime:we,remove:()=>{pn(n,b)},close:E=>{b.endTime=E}};return t&&n.length>=t&&n.pop(),n.unshift(b),b}function i(h=we,g={returnInactive:!1}){for(const b of n)if(b.startTime<=h){if(g.returnInactive||h<=b.endTime)return b.value;break}}function a(h){const g=n[0];g&&g.endTime===we&&g.close(h)}function c(h=we,g=0){const b=zn(h,g);return n.filter(E=>E.startTime<=b&&h<=E.endTime).map(E=>E.value)}function l(){return n.map(({startTime:h,endTime:g,value:b})=>({startTime:h,endTime:g===we?"Infinity":g,value:b}))}function u(){return r}function d(){n=[]}function f(){He.delete(o),He.size===0&&Oe&&($t(Oe),Oe=null)}return{add:s,find:i,closeActive:a,findAll:c,reset:d,stop:f,getAllEntries:l,getDeletedEntries:u}}const Vo=K,Xo=it;function Qo(e,t,n,r){const o=new O,s=new O,i=Ar(e.sessionStoreStrategyType,e,t,n),a=Zo({expireDelay:Xo});i.renewObservable.subscribe(()=>{a.add(c(),Le()),o.notify()}),i.expireObservable.subscribe(()=>{s.notify(),a.closeActive(Le())}),i.expandOrRenewSession(),a.add(c(),jn().relative),r.observable.subscribe(()=>{r.isGranted()?i.expandOrRenewSession():i.expire()}),es(e,()=>{r.isGranted()&&i.expandOrRenewSession()}),ts(e,()=>i.expandSession()),ns(e,()=>i.restartSession());function c(){return{id:i.getSession().id,trackingType:i.getSession()[t],isReplayForced:!!i.getSession().forcedReplay,anonymousId:i.getSession().anonymousId}}return{findSession:(l,u)=>a.find(l,u),renewObservable:o,expireObservable:s,sessionStateUpdateObservable:i.sessionStateUpdateObservable,expire:i.expire,updateSessionState:i.updateSessionState}}function es(e,t){St(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function ts(e,t){const n=()=>{document.visibilityState==="visible"&&t()};X(e,document,"visibilitychange",n),nt(n,Vo)}function ns(e,t){X(e,window,"resume",t,{capture:!0})}function yn(e){return e>=500}function rs(e){try{return e.clone()}catch{return}}const os=80*D,ss=32,bn=3*xt,is=K,En=he;function Tn(e,t,n,r,o){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?wn(e,t,n,{onSuccess:()=>On(0,t,n,r,o),onFailure:()=>{t.queuedPayloads.enqueue(e),_n(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function _n(e,t,n,r){e.transportStatus===2&&ye(()=>{const o=e.queuedPayloads.first();wn(o,e,t,{onSuccess:()=>{e.queuedPayloads.dequeue(),e.currentBackoffTime=En,On(1,e,t,n,r)},onFailure:()=>{e.currentBackoffTime=Math.min(is,e.currentBackoffTime*2),_n(e,t,n,r)}})},e.currentBackoffTime)}function wn(e,t,n,{onSuccess:r,onFailure:o}){t.bandwidthMonitor.add(e),n(e,s=>{t.bandwidthMonitor.remove(e),as(s)?(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:s.status},o()):(t.transportStatus=0,r())})}function On(e,t,n,r,o){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:`Reached max ${r} events size queued for upload: ${bn/xt}MiB`,source:v.AGENT,startClocks:U()}),t.queueFullReported=!0);const s=t.queuedPayloads;for(t.queuedPayloads=Rn();s.size()>0;)Tn(s.dequeue(),t,n,r,o)}function as(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||yn(e.status))}function cs(){return{transportStatus:0,currentBackoffTime:En,bandwidthMonitor:us(),queuedPayloads:Rn(),queueFullReported:!1}}function Rn(){const e=[];return{bytesCount:0,enqueue(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first(){return e[0]},dequeue(){const t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size(){return e.length},isFull(){return this.bytesCount>=bn}}}function us(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=os&&this.ongoingRequestCount<ss},add(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}}}function ls(e,t,n){const r=cs(),o=(s,i)=>ps(e,t,s,i);return{send:s=>{Tn(s,r,o,e.trackType,n)},sendOnExit:s=>{ds(e,t,s)}}}function ds(e,t,n){if(!!navigator.sendBeacon&&n.bytesCount<t)try{const s=e.build("beacon",n);if(navigator.sendBeacon(s,n.data))return}catch(s){fs(s)}const o=e.build("xhr",n);yt(o,n.data)}let Cn=!1;function fs(e){Cn||(Cn=!0,Sn(e))}function ps(e,t,n,r){if(hs()&&n.bytesCount<t){const s=e.build("fetch",n);fetch(s,{method:"POST",body:n.data,keepalive:!0,mode:"cors"}).then(y(i=>r==null?void 0:r({status:i.status,type:i.type})),y(()=>{const i=e.build("xhr",n);yt(i,n.data,r)}))}else{const s=e.build("xhr",n);yt(s,n.data,r)}}function hs(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function yt(e,t,n){const r=new XMLHttpRequest;r.open("POST",e,!0),t instanceof Blob&&r.setRequestHeader("Content-Type",t.type),X({allowUntrustedEvents:!0},r,"loadend",()=>{n==null||n({status:r.status})},{once:!0}),r.send(t)}function bt(){const e=gs();if(e)return{getCapabilities(){var t;return JSON.parse(((t=e.getCapabilities)===null||t===void 0?void 0:t.call(e))||"[]")},getPrivacyLevel(){var t;return(t=e.getPrivacyLevel)===null||t===void 0?void 0:t.call(e)},getAllowedWebViewHosts(){return JSON.parse(e.getAllowedWebViewHosts())},send(t,n,r){const o=r?{id:r}:void 0;e.send(JSON.stringify({eventType:t,event:n,view:o}))}}}function ze(e){var t;e===void 0&&(e=(t=B().location)===null||t===void 0?void 0:t.hostname);const n=bt();return!!n&&n.getAllowedWebViewHosts().some(r=>e===r||e.endsWith(`.${r}`))}function gs(){return B().DatadogEventBridge}const Ke={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function ms(e){return new O(t=>{const{stop:n}=St(e,window,["visibilitychange","freeze"],o=>{o.type==="visibilitychange"&&document.visibilityState==="hidden"?t.notify({reason:Ke.HIDDEN}):o.type==="freeze"&&t.notify({reason:Ke.FROZEN})},{capture:!0}),r=X(e,window,"beforeunload",()=>{t.notify({reason:Ke.UNLOADING})}).stop;return()=>{n(),r()}})}function Ss(e){return xe(Ke).includes(e)}function ys({encoder:e,request:t,flushController:n,messageBytesLimit:r}){let o={};const s=n.flushObservable.subscribe(d=>u(d));function i(d,f,h){n.notifyBeforeAddMessage(f),h!==void 0?(o[h]=d,n.notifyAfterAddMessage()):e.write(e.isEmpty?d:`\n${d}`,g=>{n.notifyAfterAddMessage(g-f)})}function a(d){return d!==void 0&&o[d]!==void 0}function c(d){const f=o[d];delete o[d];const h=e.estimateEncodedBytesCount(f);n.notifyAfterRemoveMessage(h)}function l(d,f){const h=q(d),g=e.estimateEncodedBytesCount(h);if(g>=r){w.warn(`Discarded a message whose size was bigger than the maximum allowed size ${r}KB. ${Ce} ${Lt}/#technical-limitations`);return}a(f)&&c(f),i(h,g,f)}function u(d){const f=xe(o).join(`\n`);o={};const h=Ss(d.reason),g=h?t.sendOnExit:t.send;if(h&&e.isAsync){const b=e.finishSync();b.outputBytesCount&&g(vn(b));const E=[b.pendingData,f].filter(Boolean).join(`\n`);E&&g({data:E,bytesCount:et(E)})}else f&&e.write(e.isEmpty?f:`\n${f}`),e.finish(b=>{g(vn(b))})}return{flushController:n,add:l,upsert:l,stop:s.unsubscribe}}function vn(e){let t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}function bs({messagesLimit:e,bytesLimit:t,durationLimit:n,pageExitObservable:r,sessionExpireObservable:o}){const s=r.subscribe(g=>u(g.reason)),i=o.subscribe(()=>u("session_expire")),a=new O(()=>()=>{s.unsubscribe(),i.unsubscribe()});let c=0,l=0;function u(g){if(l===0)return;const b=l,E=c;l=0,c=0,h(),a.notify({reason:g,messagesCount:b,bytesCount:E})}let d;function f(){d===void 0&&(d=ye(()=>{u("duration_limit")},n))}function h(){Nt(d),d=void 0}return{flushObservable:a,get messagesCount(){return l},notifyBeforeAddMessage(g){c+g>=t&&u("bytes_limit"),l+=1,c+=g,f()},notifyAfterAddMessage(g=0){c+=g,l>=e?u("messages_limit"):c>=t&&u("bytes_limit")},notifyAfterRemoveMessage(g){c-=g,l-=1,l===0&&h()}}}function Ln(e,t,n,r,o,s,i=ys){const a=l(e,t),c=n&&l(e,n);function l(u,{endpoint:d,encoder:f}){return i({encoder:f,request:ls(d,u.batchBytesLimit,r),flushController:bs({messagesLimit:u.batchMessagesLimit,bytesLimit:u.batchBytesLimit,durationLimit:u.flushTimeout,pageExitObservable:o,sessionExpireObservable:s}),messageBytesLimit:u.messageBytesLimit})}return{flushObservable:a.flushController.flushObservable,add(u,d=!0){a.add(u),c&&d&&c.add(n.transformMessage?n.transformMessage(u):u)},upsert:(u,d)=>{a.upsert(u,d),c&&c.upsert(n.transformMessage?n.transformMessage(u):u,d)},stop:()=>{a.stop(),c&&c.stop()}}}function We(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(n,r){const o=et(n);t+=o,e+=n,r&&r(o)},finish(n){n(this.finishSync())},finishSync(){const n={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,n},estimateEncodedBytesCount(n){return n.length}}}class Es{constructor(){this.callbacks={}}notify(t,n){const r=this.callbacks[t];r&&r.forEach(o=>o(n))}subscribe(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),{unsubscribe:()=>{this.callbacks[t]=this.callbacks[t].filter(r=>n!==r)}}}}function Ts(e,t,n){let r=0,o=!1;return{isLimitReached(){if(r===0&&ye(()=>{r=0},K),r+=1,r<=t||o)return o=!1,!1;if(r===t+1){o=!0;try{n({message:`Reached max number of ${e}s by minute: ${t}`,source:v.AGENT,startClocks:U()})}finally{o=!1}}return!0}}}let Et;const Tt=new WeakMap;function _s(e){return Et||(Et=ws(e)),Et}function ws(e){return new O(t=>{const{stop:n}=V(XMLHttpRequest.prototype,"open",Os),{stop:r}=V(XMLHttpRequest.prototype,"send",s=>{Rs(s,e,t)},{computeHandlingStack:!0}),{stop:o}=V(XMLHttpRequest.prototype,"abort",Cs);return()=>{n(),r(),o()}})}function Os({target:e,parameters:[t,n]}){Tt.set(e,{state:"open",method:String(t).toUpperCase(),url:lt(String(n))})}function Rs({target:e,handlingStack:t},n,r){const o=Tt.get(e);if(!o)return;const s=o;s.state="start",s.startClocks=U(),s.isAborted=!1,s.xhr=e,s.handlingStack=t;let i=!1;const{stop:a}=V(e,"onreadystatechange",()=>{e.readyState===XMLHttpRequest.DONE&&c()}),c=()=>{if(l(),a(),i)return;i=!0;const u=o;u.state="complete",u.duration=Hn(s.startClocks.timeStamp,F()),u.status=e.status,r.notify(Jn(u))},{stop:l}=X(n,e,"loadend",c);r.notify(s)}function Cs({target:e}){const t=Tt.get(e);t&&(t.isAborted=!0)}let _t;function An(){return _t||(_t=vs()),_t}function vs(){return new O(e=>{if(!window.fetch)return;const{stop:t}=V(window,"fetch",n=>Ls(n,e),{computeHandlingStack:!0});return t})}function Ls({parameters:e,onPostCall:t,handlingStack:n},r){const[o,s]=e;let i=s&&s.method;i===void 0&&o instanceof Request&&(i=o.method);const a=i!==void 0?String(i).toUpperCase():"GET",c=o instanceof Request?o.url:lt(String(o)),l=U(),u={state:"start",init:s,input:o,method:a,startClocks:l,url:c,handlingStack:n};r.notify(u),e[0]=u.input,e[1]=u.init,t(d=>As(r,d,u))}function As(e,t,n){const r=n;function o(s){r.state="resolve",Object.assign(r,s),e.notify(r)}t.then(y(s=>{o({response:s,responseType:s.type,status:s.status,isAborted:!1})}),y(s=>{var i,a;o({status:0,isAborted:((a=(i=r.init)===null||i===void 0?void 0:i.signal)===null||a===void 0?void 0:a.aborted)||s instanceof DOMException&&s.code===DOMException.ABORT_ERR,error:s})}))}let wt={};function Is(e){const t=e.map(n=>(wt[n]||(wt[n]=ks(n)),wt[n]));return Pt(...t)}function ks(e){return new O(t=>{const n=x[e];return x[e]=(...r)=>{n.apply(console,r);const o=Be("console error");Se(()=>{t.notify(xs(r,e,o))})},()=>{x[e]=n}})}function xs(e,t,n){const r=e.map(s=>Ds(s)).join(" ");let o;if(t===_.error){const s=e.find(H);o={stack:s?Z(M(s)):void 0,fingerprint:rn(s),causes:s?sn(s,"console"):void 0,startClocks:U(),message:r,source:v.CONSOLE,handling:"handled",handlingStack:n,context:on(s)}}return{api:t,message:r,error:o,handlingStack:n}}function Ds(e){return typeof e=="string"?N(e):H(e)?en(M(e)):q(N(e),void 0,2)}function Ms(e){const t=dn(e)==="object";return t||w.error("Unsupported context:",e),t}function Ot(e,t,n){const r={...e};for(const[o,{required:s,type:i}]of Object.entries(t))i==="string"&&o in r&&(r[o]=String(r[o])),s&&!(o in e)&&w.warn(`The property ${o} of ${n} is required; context will not be sent to the intake.`);return r}function Je(e="",{customerDataTracker:t,propertiesConfig:n={}}={}){let r={};const o=new O,s={getContext:()=>fn(r),setContext:i=>{Ms(i)?(r=N(Ot(i,n,e)),t==null||t.updateCustomerData(r)):s.clearContext(),o.notify()},setContextProperty:(i,a)=>{r=N(Ot({...r,[i]:a},n,e)),t==null||t.updateCustomerData(r),o.notify()},removeContextProperty:i=>{delete r[i],t==null||t.updateCustomerData(r),Ot(r,n,e),o.notify()},clearContext:()=>{r={},t==null||t.resetCustomerData(),o.notify()},changeObservable:o};return s}const Ns="_dd_c",$s=[];function Rt(e,t,n,r){const o=Ps(n,r);$s.push(X(e,window,"storage",({key:l})=>{o===l&&i()})),t.changeObservable.subscribe(a);const s=ce(c(),t.getContext());me(s)||t.setContext(s);function i(){t.setContext(c())}function a(){localStorage.setItem(o,JSON.stringify(t.getContext()))}function c(){const l=localStorage.getItem(o);return l?JSON.parse(l):{}}}function Ps(e,t){return`${Ns}_${e}_${t}`}const Fs=3*D,Us=16*D,Bs=200;function Gs(e=2){const t=new Map;let n=!1;function r(o=0){if(n||e===0)return;const s=e===2?Fs:Us;let i=o;t.forEach(a=>{i+=a.getBytesCount()}),i>s&&(js(s),n=!0)}return{createDetachedTracker:()=>{const o=In(()=>r(o.getBytesCount()));return o},getOrCreateTracker:o=>(t.has(o)||t.set(o,In(r)),t.get(o)),setCompressionStatus:o=>{e===0&&(e=o,r())},getCompressionStatus:()=>e,stop:()=>{t.forEach(o=>o.stop()),t.clear()}}}function In(e){let t=0;const{throttled:n,cancel:r}=Ft(s=>{t=et(q(s)),e()},Bs),o=()=>{r(),t=0};return{updateCustomerData:s=>{me(s)?o():n(s)},resetCustomerData:o,getBytesCount:()=>t,stop:()=>{r()}}}function js(e){w.warn(`Customer data exceeds the recommended ${e/D}KiB threshold. ${Ce} ${Lt}/#customer-data-exceeds-the-recommended-threshold-warning`)}function Hs(e,t,n){const r=e.getReader(),o=[];let s=0;i();function i(){r.read().then(y(c=>{if(c.done){a();return}o.push(c.value),s+=c.value.length,s>n.bytesLimit?a():i()}),y(c=>t(c)))}function a(){r.cancel().catch(G);let c,l;{let u;if(o.length===1)u=o[0];else{u=new Uint8Array(s);let d=0;o.forEach(f=>{u.set(f,d),d+=f.length})}c=u.slice(0,n.bytesLimit),l=u.length>n.bytesLimit}t(void 0,c,l)}}const zs="datadog-synthetics-public-id",Ks="datadog-synthetics-result-id",Ws="datadog-synthetics-injects-rum";function kn(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||W(Ws))}function Js(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||W(zs);return typeof e=="string"?e:void 0}function Ys(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||W(Ks);return typeof e=="string"?e:void 0}function Ye(e,t,n){const r=n.getHandler(),o=Array.isArray(r)?r:[r];return xn[e]>=xn[n.getLevel()]&&o.includes(t)}const m={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},xn={[m.ok]:0,[m.debug]:1,[m.info]:2,[m.notice]:4,[m.warn]:5,[m.error]:6,[m.critical]:7,[m.alert]:8,[m.emerg]:9};function qe(e,{includeMessage:t=!1}={}){return{stack:e.stack,kind:e.type,message:t?e.message:void 0,causes:e.causes,fingerprint:e.fingerprint,handling:e.handling}}var qs=function(e,t,n,r){var o=arguments.length,s=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};const Re={console:"console",http:"http",silent:"silent"},Zs=Object.keys(m);let A=class{constructor(t,n,r,o=Re.http,s=m.debug,i={}){this.handleLogStrategy=t,this.handlerType=o,this.level=s,this.contextManager=Je("logger",{customerDataTracker:n}),this.contextManager.setContext(i),r&&this.contextManager.setContextProperty("logger",{name:r})}logImplementation(t,n,r=m.info,o,s){const i=N(n);let a;if(o!=null){const c=nn({stackTrace:H(o)?M(o):void 0,originalError:o,nonErrorPrefix:"Provided",source:v.LOGGER,handling:"handled",startClocks:U()});a=ce({error:qe(c,{includeMessage:!0})},i)}else a=i;this.handleLogStrategy({message:N(t),context:a,status:r},this,s)}log(t,n,r=m.info,o){let s;Ye(r,Re.http,this)&&(s=Be("log")),this.logImplementation(t,n,r,o,s)}setContext(t){this.contextManager.setContext(t)}getContext(){return this.contextManager.getContext()}setContextProperty(t,n){this.contextManager.setContextProperty(t,n)}removeContextProperty(t){this.contextManager.removeContextProperty(t)}clearContext(){this.contextManager.clearContext()}setHandler(t){this.handlerType=t}getHandler(){return this.handlerType}setLevel(t){this.level=t}getLevel(){return this.level}};qs([Zn],A.prototype,"logImplementation",null),A.prototype.ok=$(m.ok),A.prototype.debug=$(m.debug),A.prototype.info=$(m.info),A.prototype.notice=$(m.notice),A.prototype.warn=$(m.warn),A.prototype.error=$(m.error),A.prototype.critical=$(m.critical),A.prototype.alert=$(m.alert),A.prototype.emerg=$(m.emerg);function $(e){return function(t,n,r){let o;Ye(e,Re.http,this)&&(o=Be("log")),this.logImplementation(t,n,e,r,o)}}function Vs(e,t,n){return{view:{referrer:document.referrer,url:window.location.href},context:e.getContext(),user:t.getContext(),account:n.getContext()}}const Xs=32*D;function Qs(e){e.usePciIntake===!0&&e.site&&e.site!=="datadoghq.com"&&w.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const t=Zr(e),n=Dn(e.forwardConsoleLogs,xe(_),"Forward Console Logs"),r=Dn(e.forwardReports,xe(Ge),"Forward Reports");if(!(!t||!n||!r))return e.forwardErrorsToLogs&&!n.includes(_.error)&&n.push(_.error),{forwardErrorsToLogs:e.forwardErrorsToLogs!==!1,forwardConsoleLogs:n,forwardReports:r,requestErrorResponseLengthLimit:Xs,...t}}function Dn(e,t,n){if(e===void 0)return[];if(!(e==="all"||Array.isArray(e)&&e.every(r=>t.includes(r)))){w.error(`${n} should be "all" or an array with allowed values "${t.join(\'", "\')}"`);return}return e==="all"?t:$o(e)}function ei(e){const t=Vr(e);return{forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports,use_pci_intake:e.usePciIntake,...t}}function ti(e,t,n){const r=hn();let o,s;const i=t.observable.subscribe(a);function a(){if(!s||!o||!t.isGranted())return;i.unsubscribe();const c=n(o,s);r.drain(c)}return{init(c){if(!c){w.error("Missing configuration");return}if(Xr(c.enableExperimentalFeatures),ze()&&(c=ni(c)),o=c,s){an("DD_LOGS",c);return}const l=Qs(c);l&&(s=l,An().subscribe(G),t.tryToInit(l.trackingConsent),a())},get initConfiguration(){return o},getInternalContext:G,handleLog(c,l,u,d=e(),f=F()){r.add(h=>h.handleLog(c,l,u,d,f))}}}function ni(e){return{...e,clientToken:"empty"}}const Ct="logs";function ri(e){const t=Gs(),n=Je("global context",{customerDataTracker:t.getOrCreateTracker(2)}),r=Je("user",{customerDataTracker:t.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),o=Je("account",{customerDataTracker:t.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),s=Ir();function i(){return Vs(n,r,o)}let a=ti(i,s,(u,d)=>{u.storeContextsAcrossPages&&(Rt(d,n,Ct,2),Rt(d,r,Ct,1),Rt(d,o,Ct,4));const f=e(u,d,i,s);return a=oi(u,f),f});const c={},l=new A((...u)=>a.handleLog(...u),t.createDetachedTracker());return vo({logger:l,init:y(u=>a.init(u)),setTrackingConsent:y(u=>{s.update(u),Ko({feature:"set-tracking-consent",tracking_consent:u})}),getGlobalContext:y(()=>n.getContext()),setGlobalContext:y(u=>n.setContext(u)),setGlobalContextProperty:y((u,d)=>n.setContextProperty(u,d)),removeGlobalContextProperty:y(u=>n.removeContextProperty(u)),clearGlobalContext:y(()=>n.clearContext()),createLogger:y((u,d={})=>(c[u]=new A((...f)=>a.handleLog(...f),t.createDetachedTracker(),N(u),d.handler,d.level,N(d.context)),c[u])),getLogger:y(u=>c[u]),getInitConfiguration:y(()=>fn(a.initConfiguration)),getInternalContext:y(u=>a.getInternalContext(u)),setUser:y(r.setContext),getUser:y(r.getContext),setUserProperty:y(r.setContextProperty),removeUserProperty:y(r.removeContextProperty),clearUser:y(r.clearContext),setAccount:y(o.setContext),getAccount:y(o.getContext),setAccountProperty:y(o.setContextProperty),removeAccountProperty:y(o.removeContextProperty),clearAccount:y(o.clearContext)})}function oi(e,t){return{init:n=>{an("DD_LOGS",n)},initConfiguration:e,...t}}const si="logs";function ii(e,t){const n=Qo(e,si,r=>ci(e,r),t);return{findTrackedSession:(r,o={returnInactive:!1})=>{const s=n.findSession(r,o);return s&&s.trackingType==="1"?{id:s.id,anonymousId:s.anonymousId}:void 0},expireObservable:n.expireObservable}}function ai(e){const n=Mn(e)==="1"?{}:void 0;return{findTrackedSession:()=>n,expireObservable:new O}}function Mn(e){return ve(e.sessionSampleRate)?"1":"0"}function ci(e,t){const n=ui(t)?t:Mn(e);return{trackingType:n,isTracked:n==="1"}}function ui(e){return e==="0"||e==="1"}let Nn=!1;function Ze(e){const t=window;if(kn()){const r=n(t.DD_RUM_SYNTHETICS);return!r&&!Nn&&(Nn=!0,mn("Logs sent before RUM is injected by the synthetics worker",{testId:Js(),resultId:Ys()})),r}return n(t.DD_RUM);function n(r){if(r&&r.getInternalContext)return r.getInternalContext(e)}}function li(e,t,n,r,o){const s=Zs.concat(["custom"]),i={};s.forEach(a=>{i[a]=Ts(a,t.eventRateLimiterThreshold,o)}),n.subscribe(0,({rawLogsEvent:a,messageContext:c=void 0,savedCommonContext:l=void 0,domainContext:u})=>{var d,f;const h=Kn(a.date),g=e.findTrackedSession(h);if(!e.findTrackedSession(h,{returnInactive:!0}))return;const E=l||r();let de;!me(E.account)&&E.account.id&&(de=E.account),g&&g.anonymousId&&!E.user.anonymous_id&&(E.user.anonymous_id=g.anonymousId);const k=ce({service:t.service,session_id:g?g.id:void 0,session:g?{id:g.id}:void 0,usr:me(E.user)?void 0:E.user,account:de,view:E.view},E.context,Ze(h),a,c);((d=t.beforeSend)===null||d===void 0?void 0:d.call(t,k,u))===!1||k.origin!==v.AGENT&&((f=i[k.status])!==null&&f!==void 0?f:i.custom).isLimitReached()||n.notify(1,k)})}const di={[_.log]:m.info,[_.debug]:m.debug,[_.info]:m.info,[_.warn]:m.warn,[_.error]:m.error};function fi(e,t){const n=Is(e.forwardConsoleLogs).subscribe(r=>{var o;const s={rawLogsEvent:{date:F(),message:r.message,origin:v.CONSOLE,error:r.error&&qe(r.error),status:di[r.api]},messageContext:(o=r.error)===null||o===void 0?void 0:o.context,domainContext:{handlingStack:r.handlingStack}};t.notify(0,s)});return{stop:()=>{n.unsubscribe()}}}function pi(e,t){const n=Ao(e,e.forwardReports).subscribe(r=>{let o=r.message,s;const i=r.originalError.type==="deprecation"?m.warn:m.error;i===m.error?s=qe(r):r.stack&&(o+=` Found in ${wo(r.stack)}`),t.notify(0,{rawLogsEvent:{date:F(),message:o,origin:v.REPORT,error:s,status:i}})});return{stop:()=>{n.unsubscribe()}}}function hi(e,t){if(!e.forwardErrorsToLogs)return{stop:G};const n=_s(e).subscribe(s=>{s.state==="complete"&&o("xhr",s)}),r=An().subscribe(s=>{s.state==="resolve"&&o("fetch",s)});function o(s,i){!Yr(i.url)&&(yi(i)||yn(i.status))&&("xhr"in i?gi(i.xhr,e,a):i.response?Si(i.response,e,a):i.error&&mi(i.error,e,a));function a(c){const l={isAborted:i.isAborted,handlingStack:i.handlingStack};t.notify(0,{rawLogsEvent:{message:`${bi(s)} error ${i.method} ${i.url}`,date:i.startClocks.timeStamp,error:{stack:c||"Failed to load",handling:void 0},http:{method:i.method,status_code:i.status,url:i.url},status:m.error,origin:v.NETWORK},domainContext:l})}}return{stop:()=>{n.unsubscribe(),r.unsubscribe()}}}function gi(e,t,n){typeof e.response=="string"?n(vt(e.response,t)):n(e.response)}function mi(e,t,n){n(vt(Z(M(e)),t))}function Si(e,t,n){const r=rs(e);!r||!r.body?n():window.TextDecoder?Ei(r.body,t.requestErrorResponseLengthLimit,(o,s)=>{n(o?`Unable to retrieve response: ${o}`:s)}):r.text().then(y(o=>n(vt(o,t))),y(o=>n(`Unable to retrieve response: ${o}`)))}function yi(e){return e.status===0&&e.responseType!=="opaque"}function vt(e,t){return e.length>t.requestErrorResponseLengthLimit?`${e.substring(0,t.requestErrorResponseLengthLimit)}...`:e}function bi(e){return e==="xhr"?"XHR":"Fetch"}function Ei(e,t,n){Hs(e,(r,o,s)=>{if(r)n(r);else{let i=new TextDecoder().decode(o);s&&(i+="..."),n(void 0,i)}},{bytesLimit:t,collectStreamBody:!0})}function Ti(e,t){if(!e.forwardErrorsToLogs)return{stop:G};const n=new O,{stop:r}=Oo(n),o=n.subscribe(s=>{t.notify(0,{rawLogsEvent:{message:s.message,date:s.startClocks.timeStamp,error:qe(s),origin:v.SOURCE,status:m.error},messageContext:s.context})});return{stop:()=>{r(),o.unsubscribe()}}}const _i=Es;function wi(e){function t(n,r,o,s,i){const a=ce(r.getContext(),n.context);if(Ye(n.status,Re.console,r)&&Ri(n,a),Ye(n.status,Re.http,r)){const c={rawLogsEvent:{date:i||F(),message:n.message,status:n.status,origin:v.LOGGER},messageContext:a,savedCommonContext:s};o&&(c.domainContext={handlingStack:o}),e.notify(0,c)}}return{handleLog:t}}const Oi={[m.ok]:_.debug,[m.debug]:_.debug,[m.info]:_.info,[m.notice]:_.info,[m.warn]:_.warn,[m.error]:_.error,[m.critical]:_.error,[m.alert]:_.error,[m.emerg]:_.error};function Ri({status:e,message:t},n){z[Oi[e]].call(x,t,n)}function Ci(e,t,n,r,o){const s=Ln(e,{endpoint:e.logsEndpointBuilder,encoder:We()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:We()},n,r,o.expireObservable);return t.subscribe(1,i=>{s.add(i)}),s}function vi(e){const t=bt();e.subscribe(1,n=>{t.send("log",n)})}function Li(e){return{get:t=>{const n=e.findTrackedSession(t);if(n)return{session_id:n.id}}}}function Ai(e){return t=>{e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:v.AGENT,status:m.error}}),mn("Error reported to customer",{"error.message":t.message})}}function Ii(e,t,n,r,o){const s=Bo("browser-logs-sdk",t);s.setContextProvider(()=>{var a,c,l,u,d,f;return{application:{id:(a=Ze())===null||a===void 0?void 0:a.application_id},session:{id:(c=o.findTrackedSession())===null||c===void 0?void 0:c.id},view:{id:(u=(l=Ze())===null||l===void 0?void 0:l.view)===null||u===void 0?void 0:u.id},action:{id:(f=(d=Ze())===null||d===void 0?void 0:d.user_action)===null||f===void 0?void 0:f.id}}});const i=[];if(ze()){const a=bt(),c=s.observable.subscribe(l=>a.send("internal_telemetry",l));i.push(()=>c.unsubscribe())}else{const a=Ln(t,{endpoint:t.rumEndpointBuilder,encoder:We()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:We()},n,r,o.expireObservable);i.push(()=>a.stop());const c=s.observable.subscribe(l=>a.add(l,Ho(t)));i.push(()=>c.unsubscribe())}return jo(),zo(ei(e)),{telemetry:s,stop:()=>{i.forEach(a=>a())}}}function ki(e,t,n,r){const o=new _i,s=[];o.subscribe(1,f=>ln("logs",f));const i=Ai(o),a=ms(t),c=t.sessionStoreStrategyType&&!ze()&&!kn()?ii(t,r):ai(t),{stop:l}=Ii(e,t,i,a,c);s.push(()=>l()),hi(t,o),Ti(t,o),fi(t,o),pi(t,o);const{handleLog:u}=wi(o);if(li(c,t,o,n,i),ze())vi(o);else{const{stop:f}=Ci(t,o,i,a,c);s.push(()=>f())}const d=Li(c);return{handleLog:u,getInternalContext:d.get,stop:()=>{s.forEach(f=>f())}}}const ee=ri(ki);Lo(B(),"DD_LOGS",ee);const R=class R{constructor(t,n,r,o,s){this.copy=()=>new R(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const i=":";let a=("0"+this.h).slice(-2)+i+("0"+this.m).slice(-2)+i+("0"+this.s).slice(-2)+i+("0"+this.f).slice(-2);return a+="."+(this.field?"1":"2"),a},this.toZipTimeCodeString=()=>{const i=this.copy();return i.f=0,i.s=i.s%2===0?i.s:i.s-1,i.field=0,R.toStr(i)},this.toFrames=i=>{let a=60,c=0;Math.floor(i)==60?(a=60,c=0):Math.floor(i)==59?(a=60,c=4):Math.floor(i)==30?(a=30,c=0):Math.floor(i)==29&&(a=30,c=2);let l=this.h,u=this.m,d=this.s,f=this.f,h=this.field;const g=l*60+u,E=(g-Math.floor(g/10))*c;return l*(a*3600)+u*(a*60)+d*a+(f*2+h)-E},this.addSeconds=i=>{let a=this.copy();if(a.s+=i,a.s>=60){const c=Math.floor(a.s/60);if(a.s=a.s%60,a.m+=c,a.m>=60){const l=Math.floor(a.m/60);a.m=a.m%60,a.h+=l}}return a},this.addFrames=(i,a)=>{let c=this.toFrames(a);return c+=i,R.fromFrames(c,a)},this.subtractFrames=(i,a)=>this.addFrames(-i,a),this.h=t||0,this.m=n||0,this.s=r||0,this.f=o||0,this.field=s||0}static compare(t,n){return t.h!==n.h?t.h<n.h?-1:1:t.m!==n.m?t.m<n.m?-1:1:t.s!==n.s?t.s<n.s?-1:1:t.f!==n.f?t.f<n.f?-1:1:t.field!==n.field?t.field<n.field?-1:1:0}static generateTimecodeRange(t,n,r){const o=[];let s=t;for(;R.compare(s,n)<=0;)o.push(s),s=s.addSeconds(r);return o}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(t){return this.toFrames(t)*1e3/t}};R.calculateCurrentTimeCode=t=>{var d;if(!t.video||!t.clocker||!t.gameParams)throw new Error("OTTPlayer is not initialized");const n=t.video,r=t.clocker,o=r.videoFPScalculator.getFPS(),a=(n.currentTime-r.syncPoint.playerTime)%(60*60*24)*o+r.syncPoint.frame;if(a===0||o===0)throw new Error("Current frame is 0 or fps is 0");const c=R.calculateCurrentOffset(a,(d=t.gameParams)==null?void 0:d.offsets);if(c===void 0)throw new Error("Offset is undefined");let l=Math.floor(a-c);return l<0&&(l+=5178816),l>=5178816&&(l-=5178816),R.fromFrames(l,o)},R.calculateCurrentOffset=(t,n)=>{for(let r=1;r<n.length;r++)if(t<n[r].frame)return n[r-1].offset;return Math.abs(n[n.length-1].offset)},R.fromFrames=(t,n)=>{let r=60,o=0;Math.floor(n)==60?(r=60,o=0):Math.floor(n)==59?(r=60,o=4):Math.floor(n)==30?(r=30,o=0):Math.floor(n)==29&&(r=30,o=2);let s=Math.floor(n*60),i=Math.floor(n*60*10),a=i*6,c=t,l=Math.floor(c/a);c-=l*a;let u=Math.floor(c/i);c-=u*i,c>=r*60&&(c+=o*(Math.floor((c-r*60)/s)+1));let d=Math.floor(c/(r*60));c-=d*(r*60);let f=Math.floor(c/r);c-=f*r;let h=c;d+=u*10;let g=0;return g=h%2,h=Math.floor(h/2),new R(l,d,f,h,g)},R.toStr=t=>{const n="_";let r=("0"+t.h).slice(-2)+n+("0"+t.m).slice(-2)+n+("0"+t.s).slice(-2)+n+("0"+t.f).slice(-2);return t.field&&(r+="_1"),r},R.fromStr=t=>{const r=t.split("_").map(Number);if(r.length==4){const[o,s,i,a]=r;return new R(o,s,i,a,0)}else if(r.length==5){const[o,s,i,a,c]=r;return new R(o,s,i,a,c)}else throw new Error("Invalid timecode format: "+t)},R.fromMetadata=t=>{const n=/^(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d))?$/,r=t.timecode.match(n);if(!r)throw new Error("Invalid timecode format: "+t.timecode);const[,o,s,i,a,c]=r,l=Number(o),u=Number(s),d=Number(i),f=Number(a),h=c?Number(c):0;return new R(l,u,d,f,h)};let C=R;const p=class p{constructor(t){this.listenerMap=new Map,p.options=t,this.isLoggingOn=t.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&ee.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const n="bb_logger_mac_uuid";let r=localStorage.getItem(n);r||(r=crypto.randomUUID(),localStorage.setItem(n,r)),p.tracking.mac=r,p.tracking.dev=`${t.platform}_${t.browserName}`,p.beatHandle||(p.options&&T(p.options,"Logger")&&console.log("[Logger] Starting tracking beat"),p.beatHandle=window.setInterval(p.flushTracking,15e3))}static setMessagePort(t){this.messagePort=t}static getMessagePort(){return this.messagePort}setLoggingOn(t){this.isLoggingOn=t}addEventListener(t,n){const r=o=>n(o);this.listenerMap.set(n,{eventName:t,wrappedListener:r}),this.eventTarget.addEventListener(t,r)}removeEventListener(t,n){const r=this.listenerMap.get(n);r&&r.eventName===t&&(this.eventTarget.removeEventListener(t,r.wrappedListener),this.listenerMap.delete(n))}removeAllEventListeners(){for(const[t,{eventName:n,wrappedListener:r}]of this.listenerMap)this.eventTarget.removeEventListener(n,r);this.listenerMap.clear()}setAttributes(t){p.processAttributes(t);for(const n in t)ee.logger.setContextProperty(n,t[n])}info(t,n){t==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(n==null?void 0:n.url)||""}),t==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(n==null?void 0:n.isEnabled)??!0}),t==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",n),t==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",n),t==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",n),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.info(t,n),p.options&&T(p.options,"Logger")&&console.log("[Logger] Sending info: ",t))}error(t,n){this.emit("mediaSessionDidError",{message:t,...n||{}}),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.error(t,n),p.tracking.err_time=Date.now().toFixed(0),p.tracking.err_desc=t+(n?` - ${JSON.stringify(n)}`:""),p.options&&T(p.options,"Logger")&&console.log("[Logger] Sending error: ",t))}criticalError(t,n){this.emit("mediaSessionDidFailOnError",{message:t,...n||{}}),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.error(t,n),p.tracking.err_time=Date.now().toFixed(0),p.tracking.err_desc=t+(n?` - ${JSON.stringify(n)}`:""),p.options&&T(p.options,"Logger")&&console.log("[Logger] Sending critical error: ",t))}warn(t,n){n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.warn(t,n),p.options&&T(p.options,"Logger")&&console.log("[Logger] Sending warn: ",t))}handleMessageFromWorker(t){t.actionType==="INFO"?this.info(t.message,t.attributes):t.actionType==="ERROR"?this.error(t.message,t.attributes):t.actionType==="CRITICAL_ERROR"?this.criticalError(t.message,t.attributes):t.actionType==="WARN"?this.warn(t.message,t.attributes):t.actionType==="SET_ATTRIBUTES"&&t.attributes&&this.setAttributes(t.attributes)}static setAttributes(t){if(!p.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{p.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:t})}catch(n){console.error("[Logger] Error posting message:",n)}}static info(t,n){p.messagePort.postMessage({type:"LOG",actionType:"INFO",message:t,attributes:n})}static error(t,n){p.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:t,attributes:n})}static warn(t,n){p.messagePort.postMessage({type:"LOG",actionType:"WARN",message:t,attributes:n})}static criticalError(t,n){p.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:t,attributes:n})}static processAttributes(t){if(t.player_version&&(p.tracking.sdk=t.player_version),t.media_id&&(p.tracking.gid=t.media_id),t.game_id&&(p.tracking.buc=t.game_id),t.bb_session_id&&(p.tracking.sid=t.bb_session_id,p.options&&T(p.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",p.tracking.sid)),t.last_timecode){const r=C.fromStr(t.last_timecode);p.tracking.tc=r.print(),p.lastTimecodeMillis=r.totalMilliseconds(59.94),p.lastTimecodeMillis&&p.lastZipMillis&&(p.tracking.cache=(p.lastZipMillis-p.lastTimecodeMillis).toFixed(0))}t.last_offset&&(p.tracking.off=t.last_offset),t.last_loading_zip&&(p.tracking.zip=t.last_loading_zip+".zip",p.lastZipMillis=C.fromStr(t.last_loading_zip).totalMilliseconds(59.94),p.lastTimecodeMillis&&p.lastZipMillis&&(p.tracking.cache=(p.lastZipMillis-p.lastTimecodeMillis).toFixed(0))),t.last_rendered_frame&&(p.tracking.aug_time=Date.now().toFixed(0)),t.asset&&(p.tracking.asset=t.asset)}static objectToQuery(t){return Object.entries(t).filter(([n,r])=>r!==0&&r!=="").map(([n,r])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`).join("&")}emit(t,n){const r=new CustomEvent(t,{detail:n});this.eventTarget.dispatchEvent(r)}};p.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},p.lastTimecodeMillis=0,p.lastZipMillis=0,p.flushTracking=()=>{const t=Date.now().toFixed(0);p.tracking.now=t;const r=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${p.objectToQuery(p.tracking)}&platform=Web`;p.options&&T(p.options,"Logger")&&console.log("[Logger] Flushing tracking data:",r),fetch(r,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),p.tracking.err_desc="",p.tracking.err_time=""};let L=p;class $n{constructor(t,n,r){this.jobsQueue=[],this.processedTimecodes=[],this.retryingTimecodes=new Set,this.permanentlyFailedTimecodes=new Set,this.activeDownloads=new Set,this.pendingRetryTimeouts=new Map,this.downloaderStopped=!1,this.firstDownload=!0,this.updateStreamData=o=>{this.downloaderStopped||(this.streamData=o,this.initiateJobs(this.options.DOWNLOADER_ZIP_START_OFFSET,this.options.DOWNLOADER_ZIP_END_OFFSET,this.options.DOWNLOADER_ZIP_LENGTH_SECONDS),this.clearOldJobs(1),this.notifyZipBufferStatus(),this.startNextJob())},this.initiateJobs=(o,s,i)=>{if(!this.streamData){L.error("[Downloader] Stream data is not available"),this.options&&T(this.options,"Errors")&&console.error("[Downloader] Stream data is not available");return}const a=C.fromStr(this.streamData.timeCode),c=a.addSeconds(o),l=a.addSeconds(s),u=C.generateTimecodeRange(c,l,i);for(const d of u){const f=d.toZipTimeCodeString();this.processedTimecodes.includes(f)||this.addJob(f)}},this.clearOldJobs=o=>{if(!this.streamData){L.error("[Downloader] Stream data is not available"),this.options&&T(this.options,"Errors")&&console.error("[Downloader] Stream data is not available");return}const i=C.fromStr(this.streamData.timeCode).totalSeconds()-o;this.processedTimecodes=this.processedTimecodes.filter(l=>C.fromStr(l).totalSeconds()>i),Array.from(this.retryingTimecodes).filter(l=>C.fromStr(l).totalSeconds()<=i).forEach(l=>this.retryingTimecodes.delete(l)),Array.from(this.permanentlyFailedTimecodes).filter(l=>C.fromStr(l).totalSeconds()<=i).forEach(l=>this.permanentlyFailedTimecodes.delete(l))},this.clearAllJobs=()=>{this.jobsQueue=[],this.processedTimecodes=[],this.retryingTimecodes.clear(),this.permanentlyFailedTimecodes.clear(),this.activeDownloads.clear(),this.pendingRetryTimeouts.forEach(o=>clearTimeout(o)),this.pendingRetryTimeouts.clear()},this.addJob=o=>{if(!this.downloaderStopped){if(this.jobsQueue.some(s=>s===o)){this.options&&T(this.options,"Downloader")&&console.log(`[Downloader] Job already in queue for timeCode=${o}`);return}if(this.activeDownloads.has(o)){this.options&&T(this.options,"Downloader")&&console.log(`[Downloader] Job already downloading for timeCode=${o}`);return}this.jobsQueue.push(o),this.startNextJob()}},this.startNextJob=()=>{if(!this.downloaderStopped&&this.jobsQueue.length>0){const o=this.jobsQueue.shift();this.options&&T(this.options,"Downloader")&&console.log(`[Downloader] Starting job timeCode=${o}`),this.downloadZip(o)}},this.downloadZip=async o=>{if(!this.streamData){L.error("[Downloader] Stream data is not available"),this.options&&T(this.options,"Errors")&&console.error("[Downloader] Stream data is not available");return}this.activeDownloads.add(o),this.firstDownload&&(this.firstDownload=!1,L.info("didStartAugmentationDownload",{timestamp:o}));const{fps:s,zipBaseURL:i,bucketName:a}=this.streamData,c=async(l=0)=>{const u=this.shouldBeFinalRetry(o,60);try{if(this.options&&T(this.options,"Downloader")){const h=l>0?` (retry ${l}${u?", final":""})`:"";console.log(`[Downloader] Fetching zip for timeCode=${o}${h}`)}const d=await this.fetchMetadata(i,a,s,o,u);if(this.downloaderStopped)return;this.retryingTimecodes.delete(o),this.activeDownloads.delete(o);const f=this.pendingRetryTimeouts.get(o);f!==void 0&&(clearTimeout(f),this.pendingRetryTimeouts.delete(o)),this.processedTimecodes.includes(o)||this.processedTimecodes.push(o),this.postArrayBufferToDecoder(o,d),L.setAttributes({last_loading_zip:o}),this.notifyZipBufferStatus(),this.startNextJob()}catch(d){if(l===0&&this.retryingTimecodes.add(o),this.downloaderStopped){this.options&&T(this.options,"Downloader")&&console.log("[Downloader] Stopping retry - downloader has been stopped"),this.startNextJob();return}if(u){L.error("[Downloader] Error fetching zip",{error:d.message||d}),this.options&&T(this.options,"Errors")&&console.error("[Downloader] Error fetching zip:",d),this.retryingTimecodes.delete(o),this.permanentlyFailedTimecodes.add(o),this.activeDownloads.delete(o);const h=this.pendingRetryTimeouts.get(o);h!==void 0&&(clearTimeout(h),this.pendingRetryTimeouts.delete(o)),this.notifyZipBufferStatus(),this.startNextJob();return}const f=setTimeout(()=>{this.pendingRetryTimeouts.delete(o),c(l+1)},1e3);this.pendingRetryTimeouts.set(o,f)}};await c()},this.shouldBeFinalRetry=(o,s)=>{var d;if(!((d=this.streamData)!=null&&d.timeCode))return!1;const i=C.fromStr(o),a=C.fromStr(this.streamData.timeCode),c=i.toFrames(s),l=a.toFrames(s);return c-l<=60},this.fetchMetadata=async(o,s,i,a,c=!1)=>{const l=`${o}/${s}`,u=this.options.MASK_TYPE==="mp4"?this.options.BUCKET_SUBFOLDER_PATH:"",d=`${l}/${u}${a}.zip`,f=performance.now();let h;const g={},b=!!(this.options.authNbaToken||this.options.authEmail&&this.options.authPassword);if(this.options.SEND_METRICS){let te="?platform=Web";if(this.streamData&&this.streamData.timeCode){const ne=this.streamData.timeCode;ne.match(/^\\d{2}_\\d{2}_\\d{2}_\\d{2}$/)?te+=`&tc=${ne}_1`:ne.match(/^\\d{2}_\\d{2}_\\d{2}_\\d{2}_1$/)&&(te+=`&tc=${ne.replace(/_1$/,"_2")}`)}c&&(te+=`${te?"&":"?"}fr=true`),h=await fetch(d+te,{headers:g,cache:"no-store",credentials:b?"include":"omit"})}else h=await fetch(d,{headers:g,cache:"no-store",credentials:b?"include":"omit"});const E=await h.arrayBuffer(),k=(performance.now()-f)/1e3;if(!h.ok)throw new Error(`HTTP error! Status: ${h.status} (MASK_TYPE: ${this.options.MASK_TYPE})`);return k>1&&L.warn("didFetchZip",{downloadTaskURL:d,downloadTime:k}),E},this.stop=()=>{this.downloaderStopped=!0,this.clearAllJobs()},this.postArrayBufferToDecoder=t,this.onZipBufferStatusChange=r,this.options=n}isStopped(){return this.downloaderStopped}roundToZipBoundary(t,n){const r=t.totalSeconds(),o=Math.floor(r/n)*n,s=Math.floor(o/3600),i=Math.floor(o%3600/60),a=o%60;return new C(s,i,a,0,0)}calculateContinuousZipBuffer(){if(!this.streamData)return 0;const t=C.fromStr(this.streamData.timeCode),n=this.options.DOWNLOADER_ZIP_LENGTH_SECONDS;let r=t.addSeconds(this.options.DOWNLOADER_ZIP_START_OFFSET);r=this.roundToZipBoundary(r,n);let o=0;const s=Math.ceil(this.options.DOWNLOADER_ZIP_END_OFFSET/n);for(let i=0;i<s;i++){const a=r.toZipTimeCodeString();if(this.permanentlyFailedTimecodes.has(a)||!this.processedTimecodes.includes(a))break;o+=n,r=r.addSeconds(n)}return o}notifyZipBufferStatus(){if(!this.onZipBufferStatusChange)return;const t=this.calculateContinuousZipBuffer();this.onZipBufferStatusChange({continuousSeconds:t,isReady:t>=this.options.ZIP_BUFFER_READY_THRESHOLD,needsFadeout:t<=this.options.ZIP_BUFFER_FADEOUT_THRESHOLD,retryingTimecodes:Array.from(this.retryingTimecodes),failedTimecodes:Array.from(this.permanentlyFailedTimecodes)})}}let Ve=null,le=null,P,I;function Pn(e){Ve&&Ve.postMessage({type:"ZIP_BUFFER_STATUS",status:e})}self.onmessage=async e=>{const{data:t}=e;if(t.type==="SET_LOGGER_PORT"&&L.setMessagePort(t.port),t.type==="SET_RENDERER_PORT"&&(Ve=t.port,Ve.onmessage=xi),t.type==="SET_DECODER_PORT"&&(le=t.port,le.onmessage=Di),t.type==="SET_OPTIONS"&&(I=t.options,L.setMessagePort(self),P=new $n(Fn,I,Pn)),t.type==="STOP_WORKER"){P&&P.stop();return}if(t.type==="RESTART_WORKER"){if(!I)return;P&&P.stop(),P=new $n(Fn,I,Pn);return}};async function xi(e){const{data:t}=e;if(self.postMessage(t),t.type==="DOWNLOADER_INPUT"){if(!P||P.isStopped())return;P.updateStreamData(t.streamData)}}function Fn(e,t){if(!le)return;I&&T(I,"Downloader")&&console.log(`[DownloaderWorker] Posting an ArrayBuffer to Decoder, timeCode=${e}`);const n={type:"DECODER_INPUT",timeCode:e,arrayBuffer:t};le==null||le.postMessage(n,{transfer:[t]})}function Di(e){I&&T(I,"Downloader")&&console.log("[DownloaderWorker] Received message from Decoder:",e.data)}self.onunhandledrejection=e=>{L.error("[DownloaderWorker] Unhandled rejection",{error:e.reason}),I&&(T(I,"Errors")&&console.error("[DownloaderWorker] Unhandled rejection:",e.reason),e.preventDefault())},self.onerror=e=>{L.error("[DownloaderWorker] Unhandled error",{error:e}),I&&(T(I,"Errors")&&console.error("[DownloaderWorker] Unhandled error:",e),e instanceof Event&&e.preventDefault())}})();\n',zt=typeof self<"u"&&self.Blob&&new Blob([Gt],{type:"text/javascript;charset=utf-8"});function as(r){let e;try{if(e=zt&&(self.URL||self.webkitURL).createObjectURL(zt),!e)throw"";const t=new Worker(e,{name:r==null?void 0:r.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Gt),{name:r==null?void 0:r.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const Vt='(function(){"use strict";const k=(a,n)=>n==="Errors"?!0:!a.debug||!a.debug.on?!1:a.debug[`log${n}`];function Zt(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var mt={},Qt;function fn(){return Qt||(Qt=1,function(a){var n=function(){var e=new Date,t=4,s=3,l=2,h=1,m=t,y={setLogLevel:function(b){b==this.debug?m=h:b==this.info?m=l:b==this.warn?m=s:(b==this.error,m=t)},debug:function(b,x){console.debug===void 0&&(console.debug=console.log),h>=m&&console.debug("["+n.getDurationString(new Date-e,1e3)+"]","["+b+"]",x)},log:function(b,x){this.debug(b.msg)},info:function(b,x){l>=m&&console.info("["+n.getDurationString(new Date-e,1e3)+"]","["+b+"]",x)},warn:function(b,x){s>=m&&console.warn("["+n.getDurationString(new Date-e,1e3)+"]","["+b+"]",x)},error:function(b,x){t>=m&&console.error("["+n.getDurationString(new Date-e,1e3)+"]","["+b+"]",x)}};return y}();n.getDurationString=function(e,t){var s;function l(w,T){for(var C=""+w,F=C.split(".");F[0].length<T;)F[0]="0"+F[0];return F.join(".")}e<0?(s=!0,e=-e):s=!1;var h=t||1,m=e/h,y=Math.floor(m/3600);m-=y*3600;var b=Math.floor(m/60);m-=b*60;var x=m*1e3;return m=Math.floor(m),x-=m*1e3,x=Math.floor(x),(s?"-":"")+y+":"+l(b,2)+":"+l(m,2)+"."+l(x,3)},n.printRanges=function(e){var t=e.length;if(t>0){for(var s="",l=0;l<t;l++)l>0&&(s+=","),s+="["+n.getDurationString(e.start(l))+","+n.getDurationString(e.end(l))+"]";return s}else return"(empty)"},a.Log=n;var o=function(e){if(e instanceof ArrayBuffer)this.buffer=e,this.dataview=new DataView(e);else throw"Needs an array buffer";this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var s=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:t?s=this.dataview.getInt8(this.position):s=this.dataview.getUint8(this.position);break;case 2:t?s=this.dataview.getInt16(this.position):s=this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";s=this.dataview.getUint8(this.position)<<16,s|=this.dataview.getUint8(this.position+1)<<8,s|=this.dataview.getUint8(this.position+2);break;case 4:t?s=this.dataview.getInt32(this.position):s=this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";s=this.dataview.getUint32(this.position)<<32,s|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,s}else throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",s=0;s<e;s++)t+=String.fromCharCode(this.readUint8());return t}else throw"Not enough bytes in buffer"},o.prototype.readCString=function(){for(var e=[];;){var t=this.readUint8();if(t!==0)e.push(t);else break}return String.fromCharCode.apply(null,e)},o.prototype.readInt8=function(){return this.readAnyInt(1,!0)},o.prototype.readInt16=function(){return this.readAnyInt(2,!0)},o.prototype.readInt32=function(){return this.readAnyInt(4,!0)},o.prototype.readInt64=function(){return this.readAnyInt(8,!1)},o.prototype.readUint8Array=function(e){for(var t=new Uint8Array(e),s=0;s<e;s++)t[s]=this.readUint8();return t},o.prototype.readInt16Array=function(e){for(var t=new Int16Array(e),s=0;s<e;s++)t[s]=this.readInt16();return t},o.prototype.readUint16Array=function(e){for(var t=new Int16Array(e),s=0;s<e;s++)t[s]=this.readUint16();return t},o.prototype.readUint32Array=function(e){for(var t=new Uint32Array(e),s=0;s<e;s++)t[s]=this.readUint32();return t},o.prototype.readInt32Array=function(e){for(var t=new Int32Array(e),s=0;s<e;s++)t[s]=this.readInt32();return t},a.MP4BoxStream=o;var d=function(e,t,s){this._byteOffset=t||0,e instanceof ArrayBuffer?this.buffer=e:typeof e=="object"?(this.dataView=e,t&&(this._byteOffset+=t)):this.buffer=new ArrayBuffer(e||0),this.position=0,this.endianness=s??d.LITTLE_ENDIAN};d.prototype={},d.prototype.getPosition=function(){return this.position},d.prototype._realloc=function(e){if(this._dynamicSize){var t=this._byteOffset+this.position+e,s=this._buffer.byteLength;if(t<=s){t>this._byteLength&&(this._byteLength=t);return}for(s<1&&(s=1);t>s;)s*=2;var l=new ArrayBuffer(s),h=new Uint8Array(this._buffer),m=new Uint8Array(l,0,h.length);m.set(h),this.buffer=l,this._byteLength=t}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),s=new Uint8Array(this._buffer,0,t.length);t.set(s),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(e*1);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=e*1,t},d.prototype.readInt32Array=function(e,t){e=e??this.byteLength-this.position/4;var s=new Int32Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readInt16Array=function(e,t){e=e??this.byteLength-this.position/2;var s=new Int16Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readInt8Array=function(e){e=e??this.byteLength-this.position;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=e??this.byteLength-this.position/4;var s=new Uint32Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readUint16Array=function(e,t){e=e??this.byteLength-this.position/2;var s=new Uint16Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readUint8Array=function(e){e=e??this.byteLength-this.position;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=e??this.byteLength-this.position/8;var s=new Float64Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readFloat32Array=function(e,t){e=e??this.byteLength-this.position/4;var s=new Float32Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,e??this.endianness);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,e??this.endianness);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,e??this.endianness);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,e??this.endianness);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,e??this.endianness);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,e??this.endianness);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,s,l,h){var m=new Uint8Array(e,t,h),y=new Uint8Array(s,l,h);m.set(y)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=0;s<e.byteLength;s+=e.BYTES_PER_ELEMENT)for(var l=s+e.BYTES_PER_ELEMENT-1,h=s;l>h;l--,h++){var m=t[h];t[h]=t[l],t[l]=m}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],s=0;s<e.length;s++)t[s]=e[s];return String.fromCharCode.apply(null,t)},d.prototype.readString=function(e,t){return t==null||t=="ASCII"?String.fromCharCodeUint8.apply(null,[this.mapUint8Array(e??this.byteLength-this.position)]):new TextDecoder(t).decode(this.mapUint8Array(e))},d.prototype.readCString=function(e){var t=this.byteLength-this.position,s=new Uint8Array(this._buffer,this._byteOffset+this.position),l=t;e!=null&&(l=Math.min(e,t));for(var h=0;h<l&&s[h]!==0;h++);var m=String.fromCharCodeUint8.apply(null,[this.mapUint8Array(h)]);return e!=null?this.position+=l-h:h!=t&&(this.position+=1),m};var c=Math.pow(2,32);d.prototype.readInt64=function(){return this.readInt32()*c+this.readUint32()},d.prototype.readUint64=function(){return this.readUint32()*c+this.readUint32()},d.prototype.readInt64=function(){return this.readUint32()*c+this.readUint32()},d.prototype.readUint24=function(){return(this.readUint8()<<16)+(this.readUint8()<<8)+this.readUint8()},a.DataStream=d,d.prototype.save=function(e){var t=new Blob([this.buffer]);if(window.URL&&URL.createObjectURL){var s=window.URL.createObjectURL(t),l=document.createElement("a");document.body.appendChild(l),l.setAttribute("href",s),l.setAttribute("download",e),l.setAttribute("target","_self"),l.click(),window.URL.revokeObjectURL(s)}else throw"DataStream.save: Can\'t create object URL."},d.prototype._dynamicSize=!0,Object.defineProperty(d.prototype,"dynamicSize",{get:function(){return this._dynamicSize},set:function(e){e||this._trimAlloc(),this._dynamicSize=e}}),d.prototype.shift=function(e){var t=new ArrayBuffer(this._byteLength-e),s=new Uint8Array(t),l=new Uint8Array(this._buffer,e,s.length);s.set(l),this.buffer=t,this.position-=e},d.prototype.writeInt32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Int32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt32Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeInt32(e[s],t)},d.prototype.writeInt16Array=function(e,t){if(this._realloc(e.length*2),e instanceof Int16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt16Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeInt16(e[s],t)},d.prototype.writeInt8Array=function(e){if(this._realloc(e.length*1),e instanceof Int8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt8Array(e.length);else for(var t=0;t<e.length;t++)this.writeInt8(e[t])},d.prototype.writeUint32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Uint32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint32Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeUint32(e[s],t)},d.prototype.writeUint16Array=function(e,t){if(this._realloc(e.length*2),e instanceof Uint16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint16Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeUint16(e[s],t)},d.prototype.writeUint8Array=function(e){if(this._realloc(e.length*1),e instanceof Uint8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint8Array(e.length);else for(var t=0;t<e.length;t++)this.writeUint8(e[t])},d.prototype.writeFloat64Array=function(e,t){if(this._realloc(e.length*8),e instanceof Float64Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat64Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeFloat64(e[s],t)},d.prototype.writeFloat32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Float32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat32Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeFloat32(e[s],t)},d.prototype.writeInt32=function(e,t){this._realloc(4),this._dataView.setInt32(this.position,e,t??this.endianness),this.position+=4},d.prototype.writeInt16=function(e,t){this._realloc(2),this._dataView.setInt16(this.position,e,t??this.endianness),this.position+=2},d.prototype.writeInt8=function(e){this._realloc(1),this._dataView.setInt8(this.position,e),this.position+=1},d.prototype.writeUint32=function(e,t){this._realloc(4),this._dataView.setUint32(this.position,e,t??this.endianness),this.position+=4},d.prototype.writeUint16=function(e,t){this._realloc(2),this._dataView.setUint16(this.position,e,t??this.endianness),this.position+=2},d.prototype.writeUint8=function(e){this._realloc(1),this._dataView.setUint8(this.position,e),this.position+=1},d.prototype.writeFloat32=function(e,t){this._realloc(4),this._dataView.setFloat32(this.position,e,t??this.endianness),this.position+=4},d.prototype.writeFloat64=function(e,t){this._realloc(8),this._dataView.setFloat64(this.position,e,t??this.endianness),this.position+=8},d.prototype.writeUCS2String=function(e,t,s){s==null&&(s=e.length);for(var l=0;l<e.length&&l<s;l++)this.writeUint16(e.charCodeAt(l),t);for(;l<s;l++)this.writeUint16(0)},d.prototype.writeString=function(e,t,s){var l=0;if(t==null||t=="ASCII")if(s!=null){var h=Math.min(e.length,s);for(l=0;l<h;l++)this.writeUint8(e.charCodeAt(l));for(;l<s;l++)this.writeUint8(0)}else for(l=0;l<e.length;l++)this.writeUint8(e.charCodeAt(l));else this.writeUint8Array(new TextEncoder(t).encode(e.substring(0,s)))},d.prototype.writeCString=function(e,t){var s=0;if(t!=null){var l=Math.min(e.length,t);for(s=0;s<l;s++)this.writeUint8(e.charCodeAt(s));for(;s<t;s++)this.writeUint8(0)}else{for(s=0;s<e.length;s++)this.writeUint8(e.charCodeAt(s));this.writeUint8(0)}},d.prototype.writeStruct=function(e,t){for(var s=0;s<e.length;s+=2){var l=e[s+1];this.writeType(l,t[e[s]],t)}},d.prototype.writeType=function(e,t,s){var l;if(typeof e=="function")return e(this,t);if(typeof e=="object"&&!(e instanceof Array))return e.set(this,t,s);var h=null,m="ASCII",y=this.position;switch(typeof e=="string"&&/:/.test(e)&&(l=e.split(":"),e=l[0],h=parseInt(l[1])),typeof e=="string"&&/,/.test(e)&&(l=e.split(","),e=l[0],m=parseInt(l[1])),e){case"uint8":this.writeUint8(t);break;case"int8":this.writeInt8(t);break;case"uint16":this.writeUint16(t,this.endianness);break;case"int16":this.writeInt16(t,this.endianness);break;case"uint32":this.writeUint32(t,this.endianness);break;case"int32":this.writeInt32(t,this.endianness);break;case"float32":this.writeFloat32(t,this.endianness);break;case"float64":this.writeFloat64(t,this.endianness);break;case"uint16be":this.writeUint16(t,d.BIG_ENDIAN);break;case"int16be":this.writeInt16(t,d.BIG_ENDIAN);break;case"uint32be":this.writeUint32(t,d.BIG_ENDIAN);break;case"int32be":this.writeInt32(t,d.BIG_ENDIAN);break;case"float32be":this.writeFloat32(t,d.BIG_ENDIAN);break;case"float64be":this.writeFloat64(t,d.BIG_ENDIAN);break;case"uint16le":this.writeUint16(t,d.LITTLE_ENDIAN);break;case"int16le":this.writeInt16(t,d.LITTLE_ENDIAN);break;case"uint32le":this.writeUint32(t,d.LITTLE_ENDIAN);break;case"int32le":this.writeInt32(t,d.LITTLE_ENDIAN);break;case"float32le":this.writeFloat32(t,d.LITTLE_ENDIAN);break;case"float64le":this.writeFloat64(t,d.LITTLE_ENDIAN);break;case"cstring":this.writeCString(t,h);break;case"string":this.writeString(t,m,h);break;case"u16string":this.writeUCS2String(t,this.endianness,h);break;case"u16stringle":this.writeUCS2String(t,d.LITTLE_ENDIAN,h);break;case"u16stringbe":this.writeUCS2String(t,d.BIG_ENDIAN,h);break;default:if(e.length==3){for(var b=e[1],x=0;x<t.length;x++)this.writeType(b,t[x]);break}else{this.writeStruct(e,t);break}}h!=null&&(this.position=y,this._realloc(h),this.position=y+h)},d.prototype.writeUint64=function(e){var t=Math.floor(e/c);this.writeUint32(t),this.writeUint32(e&4294967295)},d.prototype.writeUint24=function(e){this.writeUint8((e&16711680)>>16),this.writeUint8((e&65280)>>8),this.writeUint8(e&255)},d.prototype.adjustUint32=function(e,t){var s=this.position;this.seek(e),this.writeUint32(t),this.seek(s)},d.prototype.mapInt32Array=function(e,t){this._realloc(e*4);var s=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*4,s},d.prototype.mapInt16Array=function(e,t){this._realloc(e*2);var s=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*2,s},d.prototype.mapInt8Array=function(e){this._realloc(e*1);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=e*1,t},d.prototype.mapUint32Array=function(e,t){this._realloc(e*4);var s=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*4,s},d.prototype.mapUint16Array=function(e,t){this._realloc(e*2);var s=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*2,s},d.prototype.mapFloat64Array=function(e,t){this._realloc(e*8);var s=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*8,s},d.prototype.mapFloat32Array=function(e,t){this._realloc(e*4);var s=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*4,s};var f=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};f.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN),f.prototype.initialized=function(){var e;return this.bufferIndex>-1?!0:this.buffers.length>0?(e=this.buffers[0],e.fileStart===0?(this.buffer=e,this.bufferIndex=0,n.debug("MultiBufferStream","Stream ready for parsing"),!0):(n.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1)):(n.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1)},ArrayBuffer.concat=function(e,t){n.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var s=new Uint8Array(e.byteLength+t.byteLength);return s.set(new Uint8Array(e),0),s.set(new Uint8Array(t),e.byteLength),s.buffer},f.prototype.reduceBuffer=function(e,t,s){var l;return l=new Uint8Array(s),l.set(new Uint8Array(e,t,s)),l.buffer.fileStart=e.fileStart+t,l.buffer.usedBytes=0,l.buffer},f.prototype.insertBuffer=function(e){for(var t=!0,s=0;s<this.buffers.length;s++){var l=this.buffers[s];if(e.fileStart<=l.fileStart){if(e.fileStart===l.fileStart)if(e.byteLength>l.byteLength){this.buffers.splice(s,1),s--;continue}else n.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring");else e.fileStart+e.byteLength<=l.fileStart||(e=this.reduceBuffer(e,0,l.fileStart-e.fileStart)),n.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(s,0,e),s===0&&(this.buffer=e);t=!1;break}else if(e.fileStart<l.fileStart+l.byteLength){var h=l.fileStart+l.byteLength-e.fileStart,m=e.byteLength-h;if(m>0)e=this.reduceBuffer(e,h,m);else{t=!1;break}}}t&&(n.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),s===0&&(this.buffer=e))},f.prototype.logBufferLevel=function(e){var t,s,l,h,m=[],y,b="";for(l=0,h=0,t=0;t<this.buffers.length;t++)s=this.buffers[t],t===0?(y={},m.push(y),y.start=s.fileStart,y.end=s.fileStart+s.byteLength,b+="["+y.start+"-"):y.end===s.fileStart?y.end=s.fileStart+s.byteLength:(y={},y.start=s.fileStart,b+=m[m.length-1].end-1+"], ["+y.start+"-",y.end=s.fileStart+s.byteLength,m.push(y)),l+=s.usedBytes,h+=s.byteLength;m.length>0&&(b+=y.end-1+"]");var x=e?n.info:n.debug;this.buffers.length===0?x("MultiBufferStream","No more buffer in memory"):x("MultiBufferStream",""+this.buffers.length+" stored buffer(s) ("+l+"/"+h+" bytes), continuous ranges: "+b)},f.prototype.cleanBuffers=function(){var e,t;for(e=0;e<this.buffers.length;e++)t=this.buffers[e],t.usedBytes===t.byteLength&&(n.debug("MultiBufferStream","Removing buffer #"+e),this.buffers.splice(e,1),e--)},f.prototype.mergeNextBuffer=function(){var e;if(this.bufferIndex+1<this.buffers.length)if(e=this.buffers[this.bufferIndex+1],e.fileStart===this.buffer.fileStart+this.buffer.byteLength){var t=this.buffer.byteLength,s=this.buffer.usedBytes,l=this.buffer.fileStart;return this.buffers[this.bufferIndex]=ArrayBuffer.concat(this.buffer,e),this.buffer=this.buffers[this.bufferIndex],this.buffers.splice(this.bufferIndex+1,1),this.buffer.usedBytes=s,this.buffer.fileStart=l,n.debug("ISOFile","Concatenating buffer for box parsing (length: "+t+"->"+this.buffer.byteLength+")"),!0}else return!1;else return!1},f.prototype.findPosition=function(e,t,s){var l,h=null,m=-1;for(e===!0?l=0:l=this.bufferIndex;l<this.buffers.length&&(h=this.buffers[l],h.fileStart<=t);){m=l,s&&(h.fileStart+h.byteLength<=t?h.usedBytes=h.byteLength:h.usedBytes=t-h.fileStart,this.logBufferLevel());l++}return m!==-1?(h=this.buffers[m],h.fileStart+h.byteLength>=t?(n.debug("MultiBufferStream","Found position in existing buffer #"+m),m):-1):-1},f.prototype.findEndContiguousBuf=function(e){var t,s,l,h=e!==void 0?e:this.bufferIndex;if(s=this.buffers[h],this.buffers.length>h+1)for(t=h+1;t<this.buffers.length&&(l=this.buffers[t],l.fileStart===s.fileStart+s.byteLength);t++)s=l;return s.fileStart+s.byteLength},f.prototype.getEndFilePositionAfter=function(e){var t=this.findPosition(!0,e,!1);return t!==-1?this.findEndContiguousBuf(t):e},f.prototype.addUsedBytes=function(e){this.buffer.usedBytes+=e,this.logBufferLevel()},f.prototype.setAllUsedBytes=function(){this.buffer.usedBytes=this.buffer.byteLength,this.logBufferLevel()},f.prototype.seek=function(e,t,s){var l;return l=this.findPosition(t,e,s),l!==-1?(this.buffer=this.buffers[l],this.bufferIndex=l,this.position=e-this.buffer.fileStart,n.debug("MultiBufferStream","Repositioning parser at buffer position: "+this.position),!0):(n.debug("MultiBufferStream","Position "+e+" not found in buffered data"),!1)},f.prototype.getPosition=function(){if(this.bufferIndex===-1||this.buffers[this.bufferIndex]===null)throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.position},f.prototype.getLength=function(){return this.byteLength},f.prototype.getEndPosition=function(){if(this.bufferIndex===-1||this.buffers[this.bufferIndex]===null)throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.byteLength},a.MultiBufferStream=f;var u=function(){var e=3,t=4,s=5,l=6,h=[];h[e]="ES_Descriptor",h[t]="DecoderConfigDescriptor",h[s]="DecoderSpecificInfo",h[l]="SLConfigDescriptor",this.getDescriptorName=function(b){return h[b]};var m=this,y={};return this.parseOneDescriptor=function(b){var x=0,w,T,C;for(w=b.readUint8(),C=b.readUint8();C&128;)x=(x<<7)+(C&127),C=b.readUint8();return x=(x<<7)+(C&127),n.debug("MPEG4DescriptorParser","Found "+(h[w]||"Descriptor "+w)+", size "+x+" at position "+b.getPosition()),h[w]?T=new y[h[w]](x):T=new y.Descriptor(x),T.parse(b),T},y.Descriptor=function(b,x){this.tag=b,this.size=x,this.descs=[]},y.Descriptor.prototype.parse=function(b){this.data=b.readUint8Array(this.size)},y.Descriptor.prototype.findDescriptor=function(b){for(var x=0;x<this.descs.length;x++)if(this.descs[x].tag==b)return this.descs[x];return null},y.Descriptor.prototype.parseRemainingDescriptors=function(b){for(var x=b.position;b.position<x+this.size;){var w=m.parseOneDescriptor(b);this.descs.push(w)}},y.ES_Descriptor=function(b){y.Descriptor.call(this,e,b)},y.ES_Descriptor.prototype=new y.Descriptor,y.ES_Descriptor.prototype.parse=function(b){if(this.ES_ID=b.readUint16(),this.flags=b.readUint8(),this.size-=3,this.flags&128?(this.dependsOn_ES_ID=b.readUint16(),this.size-=2):this.dependsOn_ES_ID=0,this.flags&64){var x=b.readUint8();this.URL=b.readString(x),this.size-=x+1}else this.URL="";this.flags&32?(this.OCR_ES_ID=b.readUint16(),this.size-=2):this.OCR_ES_ID=0,this.parseRemainingDescriptors(b)},y.ES_Descriptor.prototype.getOTI=function(b){var x=this.findDescriptor(t);return x?x.oti:0},y.ES_Descriptor.prototype.getAudioConfig=function(b){var x=this.findDescriptor(t);if(!x)return null;var w=x.findDescriptor(s);if(w&&w.data){var T=(w.data[0]&248)>>3;return T===31&&w.data.length>=2&&(T=32+((w.data[0]&7)<<3)+((w.data[1]&224)>>5)),T}else return null},y.DecoderConfigDescriptor=function(b){y.Descriptor.call(this,t,b)},y.DecoderConfigDescriptor.prototype=new y.Descriptor,y.DecoderConfigDescriptor.prototype.parse=function(b){this.oti=b.readUint8(),this.streamType=b.readUint8(),this.upStream=(this.streamType>>1&1)!==0,this.streamType=this.streamType>>>2,this.bufferSize=b.readUint24(),this.maxBitrate=b.readUint32(),this.avgBitrate=b.readUint32(),this.size-=13,this.parseRemainingDescriptors(b)},y.DecoderSpecificInfo=function(b){y.Descriptor.call(this,s,b)},y.DecoderSpecificInfo.prototype=new y.Descriptor,y.SLConfigDescriptor=function(b){y.Descriptor.call(this,l,b)},y.SLConfigDescriptor.prototype=new y.Descriptor,this};a.MPEG4DescriptorParser=u;var r={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){r.FullBox.prototype=new r.Box,r.ContainerBox.prototype=new r.Box,r.SampleEntry.prototype=new r.Box,r.TrackGroupTypeBox.prototype=new r.FullBox,r.BASIC_BOXES.forEach(function(e){r.createBoxCtor(e)}),r.FULL_BOXES.forEach(function(e){r.createFullBoxCtor(e)}),r.CONTAINER_BOXES.forEach(function(e){r.createContainerBoxCtor(e[0],null,e[1])})},Box:function(e,t,s){this.type=e,this.size=t,this.uuid=s},FullBox:function(e,t,s){r.Box.call(this,e,t,s),this.flags=0,this.version=0},ContainerBox:function(e,t,s){r.Box.call(this,e,t,s),this.boxes=[]},SampleEntry:function(e,t,s,l){r.ContainerBox.call(this,e,t),this.hdr_size=s,this.start=l},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){r.FullBox.call(this,e,t)},createBoxCtor:function(e,t){r.boxCodes.push(e),r[e+"Box"]=function(s){r.Box.call(this,e,s)},r[e+"Box"].prototype=new r.Box,t&&(r[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){r[e+"Box"]=function(s){r.FullBox.call(this,e,s)},r[e+"Box"].prototype=new r.FullBox,r[e+"Box"].prototype.parse=function(s){this.parseFullHeader(s),t&&t.call(this,s)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,s=0;s<t;s++)this[e[s]+"s"]=[]}},createContainerBoxCtor:function(e,t,s){r[e+"Box"]=function(l){r.ContainerBox.call(this,e,l),r.addSubBoxArrays.call(this,s)},r[e+"Box"].prototype=new r.ContainerBox,t&&(r[e+"Box"].prototype.parse=t)},createMediaSampleEntryCtor:function(e,t,s){r.sampleEntryCodes[e]=[],r[e+"SampleEntry"]=function(l,h){r.SampleEntry.call(this,l,h),r.addSubBoxArrays.call(this,s)},r[e+"SampleEntry"].prototype=new r.SampleEntry,t&&(r[e+"SampleEntry"].prototype.parse=t)},createSampleEntryCtor:function(e,t,s,l){r.sampleEntryCodes[e].push(t),r[t+"SampleEntry"]=function(h){r[e+"SampleEntry"].call(this,t,h),r.addSubBoxArrays.call(this,l)},r[t+"SampleEntry"].prototype=new r[e+"SampleEntry"],s&&(r[t+"SampleEntry"].prototype.parse=s)},createEncryptedSampleEntryCtor:function(e,t,s){r.createSampleEntryCtor.call(this,e,t,s,["sinf"])},createSampleGroupCtor:function(e,t){r[e+"SampleGroupEntry"]=function(s){r.SampleGroupEntry.call(this,e,s)},r[e+"SampleGroupEntry"].prototype=new r.SampleGroupEntry,t&&(r[e+"SampleGroupEntry"].prototype.parse=t)},createTrackGroupCtor:function(e,t){r[e+"TrackGroupTypeBox"]=function(s){r.TrackGroupTypeBox.call(this,e,s)},r[e+"TrackGroupTypeBox"].prototype=new r.TrackGroupTypeBox,t&&(r[e+"TrackGroupTypeBox"].prototype.parse=t)},createUUIDBox:function(e,t,s,l){r.UUIDs.push(e),r.UUIDBoxes[e]=function(h){t?r.FullBox.call(this,"uuid",h,e):s?r.ContainerBox.call(this,"uuid",h,e):r.Box.call(this,"uuid",h,e)},r.UUIDBoxes[e].prototype=t?new r.FullBox:s?new r.ContainerBox:new r.Box,l&&(t?r.UUIDBoxes[e].prototype.parse=function(h){this.parseFullHeader(h),l&&l.call(this,h)}:r.UUIDBoxes[e].prototype.parse=l)}};r.initialize(),r.TKHD_FLAG_ENABLED=1,r.TKHD_FLAG_IN_MOVIE=2,r.TKHD_FLAG_IN_PREVIEW=4,r.TFHD_FLAG_BASE_DATA_OFFSET=1,r.TFHD_FLAG_SAMPLE_DESC=2,r.TFHD_FLAG_SAMPLE_DUR=8,r.TFHD_FLAG_SAMPLE_SIZE=16,r.TFHD_FLAG_SAMPLE_FLAGS=32,r.TFHD_FLAG_DUR_EMPTY=65536,r.TFHD_FLAG_DEFAULT_BASE_IS_MOOF=131072,r.TRUN_FLAGS_DATA_OFFSET=1,r.TRUN_FLAGS_FIRST_FLAG=4,r.TRUN_FLAGS_DURATION=256,r.TRUN_FLAGS_SIZE=512,r.TRUN_FLAGS_FLAGS=1024,r.TRUN_FLAGS_CTS_OFFSET=2048,r.Box.prototype.add=function(e){return this.addBox(new r[e+"Box"])},r.Box.prototype.addBox=function(e){return this.boxes.push(e),this[e.type+"s"]?this[e.type+"s"].push(e):this[e.type]=e,e},r.Box.prototype.set=function(e,t){return this[e]=t,this},r.Box.prototype.addEntry=function(e,t){var s=t||"entries";return this[s]||(this[s]=[]),this[s].push(e),this},a.BoxParser=r,r.parseUUID=function(e){return r.parseHex16(e)},r.parseHex16=function(e){for(var t="",s=0;s<16;s++){var l=e.readUint8().toString(16);t+=l.length===1?"0"+l:l}return t},r.parseOneBox=function(e,t,s){var l,h=e.getPosition(),m=0,y,b;if(e.getEndPosition()-h<8)return n.debug("BoxParser","Not enough data in stream to parse the type and size of the box"),{code:r.ERR_NOT_ENOUGH_DATA};if(s&&s<8)return n.debug("BoxParser","Not enough bytes left in the parent box to parse a new box"),{code:r.ERR_NOT_ENOUGH_DATA};var x=e.readUint32(),w=e.readString(4),T=w;if(n.debug("BoxParser","Found box of type \'"+w+"\' and size "+x+" at position "+h),m=8,w=="uuid"){if(e.getEndPosition()-e.getPosition()<16||s-m<16)return e.seek(h),n.debug("BoxParser","Not enough bytes left in the parent box to parse a UUID box"),{code:r.ERR_NOT_ENOUGH_DATA};b=r.parseUUID(e),m+=16,T=b}if(x==1){if(e.getEndPosition()-e.getPosition()<8||s&&s-m<8)return e.seek(h),n.warn("BoxParser",\'Not enough data in stream to parse the extended size of the "\'+w+\'" box\'),{code:r.ERR_NOT_ENOUGH_DATA};x=e.readUint64(),m+=8}else if(x===0){if(s)x=s;else if(w!=="mdat")return n.error("BoxParser","Unlimited box size not supported for type: \'"+w+"\'"),l=new r.Box(w,x),{code:r.OK,box:l,size:l.size}}return x!==0&&x<m?(n.error("BoxParser","Box of type "+w+" has an invalid size "+x+" (too small to be a box)"),{code:r.ERR_NOT_ENOUGH_DATA,type:w,size:x,hdr_size:m,start:h}):x!==0&&s&&x>s?(n.error("BoxParser","Box of type \'"+w+"\' has a size "+x+" greater than its container size "+s),{code:r.ERR_NOT_ENOUGH_DATA,type:w,size:x,hdr_size:m,start:h}):x!==0&&h+x>e.getEndPosition()?(e.seek(h),n.info("BoxParser","Not enough data in stream to parse the entire \'"+w+"\' box"),{code:r.ERR_NOT_ENOUGH_DATA,type:w,size:x,hdr_size:m,start:h}):t?{code:r.OK,type:w,size:x,hdr_size:m,start:h}:(r[w+"Box"]?l=new r[w+"Box"](x):w!=="uuid"?(n.warn("BoxParser","Unknown box type: \'"+w+"\'"),l=new r.Box(w,x),l.has_unparsed_data=!0):r.UUIDBoxes[b]?l=new r.UUIDBoxes[b](x):(n.warn("BoxParser","Unknown uuid type: \'"+b+"\'"),l=new r.Box(w,x),l.uuid=b,l.has_unparsed_data=!0),l.hdr_size=m,l.start=h,l.write===r.Box.prototype.write&&l.type!=="mdat"&&(n.info("BoxParser","\'"+T+"\' box writing not yet implemented, keeping unparsed data in memory for later write"),l.parseDataAndRewind(e)),l.parse(e),y=e.getPosition()-(l.start+l.size),y<0?(n.warn("BoxParser","Parsing of box \'"+T+"\' did not read the entire indicated box data size (missing "+-y+" bytes), seeking forward"),e.seek(l.start+l.size)):y>0&&(n.error("BoxParser","Parsing of box \'"+T+"\' read "+y+" more bytes than the indicated box data size, seeking backwards"),l.size!==0&&e.seek(l.start+l.size)),{code:r.OK,box:l,size:l.size})},r.Box.prototype.parse=function(e){this.type!="mdat"?this.data=e.readUint8Array(this.size-this.hdr_size):this.size===0?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},r.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},r.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},r.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},r.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},r.ContainerBox.prototype.parse=function(e){for(var t,s;e.getPosition()<this.start+this.size;)if(t=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),t.code===r.OK)if(s=t.box,this.boxes.push(s),this.subBoxNames&&this.subBoxNames.indexOf(s.type)!=-1)this[this.subBoxNames[this.subBoxNames.indexOf(s.type)]+"s"].push(s);else{var l=s.type!=="uuid"?s.type:s.uuid;this[l]?n.warn("Box of type "+l+" already stored in field of this type"):this[l]=s}else return},r.Box.prototype.parseLanguage=function(e){this.language=e.readUint16();var t=[];t[0]=this.language>>10&31,t[1]=this.language>>5&31,t[2]=this.language&31,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},r.SAMPLE_ENTRY_TYPE_VISUAL="Visual",r.SAMPLE_ENTRY_TYPE_AUDIO="Audio",r.SAMPLE_ENTRY_TYPE_HINT="Hint",r.SAMPLE_ENTRY_TYPE_METADATA="Metadata",r.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",r.SAMPLE_ENTRY_TYPE_SYSTEM="System",r.SAMPLE_ENTRY_TYPE_TEXT="Text",r.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},r.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},r.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},r.SampleEntry.prototype.parseFooter=function(e){r.ContainerBox.prototype.parse.call(this,e)},r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_HINT),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SYSTEM),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_TEXT),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)}),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"fLaC"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_TEXT,"enct"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA,"encm"),r.createBoxCtor("a1lx",function(e){var t=e.readUint8()&1,s=((t&1)+1)*16;this.layer_size=[];for(var l=0;l<3;l++)s==16?this.layer_size[l]=e.readUint16():this.layer_size[l]=e.readUint32()}),r.createBoxCtor("a1op",function(e){this.op_index=e.readUint8()}),r.createFullBoxCtor("auxC",function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)}),r.createBoxCtor("av1C",function(e){var t=e.readUint8();if(t>>7&!1){n.error("av1C marker problem");return}if(this.version=t&127,this.version!==1){n.error("av1C version "+this.version+" not supported");return}if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=t&31,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=t&3,t=e.readUint8(),this.reserved_1=t>>5&7,this.reserved_1!==0){n.error("av1C reserved_1 parsing problem");return}if(this.initial_presentation_delay_present=t>>4&1,this.initial_presentation_delay_present===1)this.initial_presentation_delay_minus_one=t&15;else if(this.reserved_2=t&15,this.reserved_2!==0){n.error("av1C reserved_2 parsing problem");return}var s=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(s)}),r.createBoxCtor("avcC",function(e){var t,s;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=e.readUint8()&3,this.nb_SPS_nalus=e.readUint8()&31,s=this.size-this.hdr_size-6,this.SPS=[],t=0;t<this.nb_SPS_nalus;t++)this.SPS[t]={},this.SPS[t].length=e.readUint16(),this.SPS[t].nalu=e.readUint8Array(this.SPS[t].length),s-=2+this.SPS[t].length;for(this.nb_PPS_nalus=e.readUint8(),s--,this.PPS=[],t=0;t<this.nb_PPS_nalus;t++)this.PPS[t]={},this.PPS[t].length=e.readUint16(),this.PPS[t].nalu=e.readUint8Array(this.PPS[t].length),s-=2+this.PPS[t].length;s>0&&(this.ext=e.readUint8Array(s))}),r.createBoxCtor("btrt",function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()}),r.createFullBoxCtor("ccst",function(e){var t=e.readUint8();this.all_ref_pics_intra=(t&128)==128,this.intra_pred_used=(t&64)==64,this.max_ref_per_pic=(t&63)>>2,e.readUint24()}),r.createBoxCtor("cdef",function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t<this.channel_count;t++)this.channel_indexes.push(e.readUint16()),this.channel_types.push(e.readUint16()),this.channel_associations.push(e.readUint16())}),r.createBoxCtor("clap",function(e){this.cleanApertureWidthN=e.readUint32(),this.cleanApertureWidthD=e.readUint32(),this.cleanApertureHeightN=e.readUint32(),this.cleanApertureHeightD=e.readUint32(),this.horizOffN=e.readUint32(),this.horizOffD=e.readUint32(),this.vertOffN=e.readUint32(),this.vertOffD=e.readUint32()}),r.createBoxCtor("clli",function(e){this.max_content_light_level=e.readUint16(),this.max_pic_average_light_level=e.readUint16()}),r.createFullBoxCtor("cmex",function(e){this.flags&1&&(this.pos_x=e.readInt32()),this.flags&2&&(this.pos_y=e.readInt32()),this.flags&4&&(this.pos_z=e.readInt32()),this.flags&8&&(this.version==0?this.flags&16?(this.quat_x=e.readInt32(),this.quat_y=e.readInt32(),this.quat_z=e.readInt32()):(this.quat_x=e.readInt16(),this.quat_y=e.readInt16(),this.quat_z=e.readInt16()):this.version==1),this.flags&32&&(this.id=e.readUint32())}),r.createFullBoxCtor("cmin",function(e){this.focal_length_x=e.readInt32(),this.principal_point_x=e.readInt32(),this.principal_point_y=e.readInt32(),this.flags&1&&(this.focal_length_y=e.readInt32(),this.skew_factor=e.readInt32())}),r.createBoxCtor("cmpd",function(e){for(this.component_count=e.readUint32(),this.component_types=[],this.component_type_urls=[],i=0;i<this.component_count;i++){var t=e.readUint16();this.component_types.push(t),t>=32768&&this.component_type_urls.push(e.readCString())}}),r.createFullBoxCtor("co64",function(e){var t,s;if(t=e.readUint32(),this.chunk_offsets=[],this.version===0)for(s=0;s<t;s++)this.chunk_offsets.push(e.readUint64())}),r.createFullBoxCtor("CoLL",function(e){this.maxCLL=e.readUint16(),this.maxFALL=e.readUint16()}),r.createBoxCtor("colr",function(e){if(this.colour_type=e.readString(4),this.colour_type==="nclx"){this.colour_primaries=e.readUint16(),this.transfer_characteristics=e.readUint16(),this.matrix_coefficients=e.readUint16();var t=e.readUint8();this.full_range_flag=t>>7}else this.colour_type==="rICC"?this.ICC_profile=e.readUint8Array(this.size-4):this.colour_type==="prof"&&(this.ICC_profile=e.readUint8Array(this.size-4))}),r.createFullBoxCtor("cprt",function(e){this.parseLanguage(e),this.notice=e.readCString()}),r.createFullBoxCtor("cslg",function(e){this.version===0&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())}),r.createFullBoxCtor("ctts",function(e){var t,s;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],this.version===0)for(s=0;s<t;s++){this.sample_counts.push(e.readUint32());var l=e.readInt32();l<0&&n.warn("BoxParser","ctts box uses negative values without using version 1"),this.sample_offsets.push(l)}else if(this.version==1)for(s=0;s<t;s++)this.sample_counts.push(e.readUint32()),this.sample_offsets.push(e.readInt32())}),r.createBoxCtor("dac3",function(e){var t=e.readUint8(),s=e.readUint8(),l=e.readUint8();this.fscod=t>>6,this.bsid=t>>1&31,this.bsmod=(t&1)<<2|s>>6&3,this.acmod=s>>3&7,this.lfeon=s>>2&1,this.bit_rate_code=s&3|l>>5&7}),r.createBoxCtor("dec3",function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=t&7,this.ind_subs=[];for(var s=0;s<this.num_ind_sub+1;s++){var l={};this.ind_subs.push(l);var h=e.readUint8(),m=e.readUint8(),y=e.readUint8();l.fscod=h>>6,l.bsid=h>>1&31,l.bsmod=(h&1)<<4|m>>4&15,l.acmod=m>>1&7,l.lfeon=m&1,l.num_dep_sub=y>>1&15,l.num_dep_sub>0&&(l.chan_loc=(y&1)<<8|e.readUint8())}}),r.createFullBoxCtor("dfLa",function(e){var t=127,s=128,l=[],h=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];do{var m=e.readUint8(),y=Math.min(m&t,h.length-1);if(y?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),l.push(h[y]),m&s)break}while(!0);this.numMetadataBlocks=l.length+" ("+l.join(", ")+")"}),r.createBoxCtor("dimm",function(e){this.bytessent=e.readUint64()}),r.createBoxCtor("dmax",function(e){this.time=e.readUint32()}),r.createBoxCtor("dmed",function(e){this.bytessent=e.readUint64()}),r.createBoxCtor("dOps",function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),this.ChannelMappingFamily!==0){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t<this.OutputChannelCount;t++)this.ChannelMapping[t]=e.readUint8()}}),r.createFullBoxCtor("dref",function(e){var t,s;this.entries=[];for(var l=e.readUint32(),h=0;h<l;h++)if(t=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),t.code===r.OK)s=t.box,this.entries.push(s);else return}),r.createBoxCtor("drep",function(e){this.bytessent=e.readUint64()}),r.createFullBoxCtor("elng",function(e){this.extended_language=e.readString(this.size-this.hdr_size)}),r.createFullBoxCtor("elst",function(e){this.entries=[];for(var t=e.readUint32(),s=0;s<t;s++){var l={};this.entries.push(l),this.version===1?(l.segment_duration=e.readUint64(),l.media_time=e.readInt64()):(l.segment_duration=e.readUint32(),l.media_time=e.readInt32()),l.media_rate_integer=e.readInt16(),l.media_rate_fraction=e.readInt16()}}),r.createFullBoxCtor("emsg",function(e){this.version==1?(this.timescale=e.readUint32(),this.presentation_time=e.readUint64(),this.event_duration=e.readUint32(),this.id=e.readUint32(),this.scheme_id_uri=e.readCString(),this.value=e.readCString()):(this.scheme_id_uri=e.readCString(),this.value=e.readCString(),this.timescale=e.readUint32(),this.presentation_time_delta=e.readUint32(),this.event_duration=e.readUint32(),this.id=e.readUint32());var t=this.size-this.hdr_size-(4*4+(this.scheme_id_uri.length+1)+(this.value.length+1));this.version==1&&(t-=4),this.message_data=e.readUint8Array(t)}),r.createEntityToGroupCtor=function(e,t){r[e+"Box"]=function(s){r.FullBox.call(this,e,s)},r[e+"Box"].prototype=new r.FullBox,r[e+"Box"].prototype.parse=function(s){if(this.parseFullHeader(s),t)t.call(this,s);else for(this.group_id=s.readUint32(),this.num_entities_in_group=s.readUint32(),this.entity_ids=[],i=0;i<this.num_entities_in_group;i++){var l=s.readUint32();this.entity_ids.push(l)}}},r.createEntityToGroupCtor("aebr"),r.createEntityToGroupCtor("afbr"),r.createEntityToGroupCtor("albc"),r.createEntityToGroupCtor("altr"),r.createEntityToGroupCtor("brst"),r.createEntityToGroupCtor("dobr"),r.createEntityToGroupCtor("eqiv"),r.createEntityToGroupCtor("favc"),r.createEntityToGroupCtor("fobr"),r.createEntityToGroupCtor("iaug"),r.createEntityToGroupCtor("pano"),r.createEntityToGroupCtor("slid"),r.createEntityToGroupCtor("ster"),r.createEntityToGroupCtor("tsyn"),r.createEntityToGroupCtor("wbbr"),r.createEntityToGroupCtor("prgr"),r.createEntityToGroupCtor("pymd",function(e){this.group_id=e.readUint32(),this.num_entities_in_group=e.readUint32(),this.entity_ids=[];for(var t=0;t<this.num_entities_in_group;t++){var s=e.readUint32();this.entity_ids.push(s)}for(this.tile_size_x=e.readUint16(),this.tile_size_y=e.readUint16(),this.layer_binning=[],this.tiles_in_layer_column_minus1=[],this.tiles_in_layer_row_minus1=[],t=0;t<this.num_entities_in_group;t++)this.layer_binning[t]=e.readUint16(),this.tiles_in_layer_row_minus1[t]=e.readUint16(),this.tiles_in_layer_column_minus1[t]=e.readUint16()}),r.createFullBoxCtor("esds",function(e){var t=e.readUint8Array(this.size-this.hdr_size);if(typeof u<"u"){var s=new u;this.esd=s.parseOneDescriptor(new d(t.buffer,0,d.BIG_ENDIAN))}}),r.createBoxCtor("fiel",function(e){this.fieldCount=e.readUint8(),this.fieldOrdering=e.readUint8()}),r.createBoxCtor("frma",function(e){this.data_format=e.readString(4)}),r.createBoxCtor("ftyp",function(e){var t=this.size-this.hdr_size;this.major_brand=e.readString(4),this.minor_version=e.readUint32(),t-=8,this.compatible_brands=[];for(var s=0;t>=4;)this.compatible_brands[s]=e.readString(4),t-=4,s++}),r.createFullBoxCtor("hdlr",function(e){this.version===0&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),this.name[this.name.length-1]==="\\0"&&(this.name=this.name.slice(0,-1)))}),r.createBoxCtor("hvcC",function(e){var t,s,l,h;this.configurationVersion=e.readUint8(),h=e.readUint8(),this.general_profile_space=h>>6,this.general_tier_flag=(h&32)>>5,this.general_profile_idc=h&31,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=e.readUint16()&4095,this.parallelismType=e.readUint8()&3,this.chroma_format_idc=e.readUint8()&3,this.bit_depth_luma_minus8=e.readUint8()&7,this.bit_depth_chroma_minus8=e.readUint8()&7,this.avgFrameRate=e.readUint16(),h=e.readUint8(),this.constantFrameRate=h>>6,this.numTemporalLayers=(h&13)>>3,this.temporalIdNested=(h&4)>>2,this.lengthSizeMinusOne=h&3,this.nalu_arrays=[];var m=e.readUint8();for(t=0;t<m;t++){var y=[];this.nalu_arrays.push(y),h=e.readUint8(),y.completeness=(h&128)>>7,y.nalu_type=h&63;var b=e.readUint16();for(s=0;s<b;s++){var x={};y.push(x),l=e.readUint16(),x.data=e.readUint8Array(l)}}}),r.createFullBoxCtor("iinf",function(e){var t;this.version===0?this.entry_count=e.readUint16():this.entry_count=e.readUint32(),this.item_infos=[];for(var s=0;s<this.entry_count;s++)if(t=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),t.code===r.OK)t.box.type!=="infe"&&n.error("BoxParser","Expected \'infe\' box, got "+t.box.type),this.item_infos[s]=t.box;else return}),r.createFullBoxCtor("iloc",function(e){var t;t=e.readUint8(),this.offset_size=t>>4&15,this.length_size=t&15,t=e.readUint8(),this.base_offset_size=t>>4&15,this.version===1||this.version===2?this.index_size=t&15:this.index_size=0,this.items=[];var s=0;if(this.version<2)s=e.readUint16();else if(this.version===2)s=e.readUint32();else throw"version of iloc box not supported";for(var l=0;l<s;l++){var h={};if(this.items.push(h),this.version<2)h.item_ID=e.readUint16();else if(this.version===2)h.item_ID=e.readUint32();else throw"version of iloc box not supported";switch(this.version===1||this.version===2?h.construction_method=e.readUint16()&15:h.construction_method=0,h.data_reference_index=e.readUint16(),this.base_offset_size){case 0:h.base_offset=0;break;case 4:h.base_offset=e.readUint32();break;case 8:h.base_offset=e.readUint64();break;default:throw"Error reading base offset size"}var m=e.readUint16();h.extents=[];for(var y=0;y<m;y++){var b={};if(h.extents.push(b),this.version===1||this.version===2)switch(this.index_size){case 0:b.extent_index=0;break;case 4:b.extent_index=e.readUint32();break;case 8:b.extent_index=e.readUint64();break;default:throw"Error reading extent index"}switch(this.offset_size){case 0:b.extent_offset=0;break;case 4:b.extent_offset=e.readUint32();break;case 8:b.extent_offset=e.readUint64();break;default:throw"Error reading extent index"}switch(this.length_size){case 0:b.extent_length=0;break;case 4:b.extent_length=e.readUint32();break;case 8:b.extent_length=e.readUint64();break;default:throw"Error reading extent index"}}}}),r.createBoxCtor("imir",function(e){var t=e.readUint8();this.reserved=t>>7,this.axis=t&1}),r.createFullBoxCtor("infe",function(e){if((this.version===0||this.version===1)&&(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),this.version===1){this.extension_type=e.readString(4),n.warn("BoxParser","Cannot parse extension type"),e.seek(this.start+this.size);return}this.version>=2&&(this.version===2?this.item_ID=e.readUint16():this.version===3&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),this.item_type==="mime"?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):this.item_type==="uri "&&(this.item_uri_type=e.readCString()))}),r.createFullBoxCtor("ipma",function(e){var t,s;for(entry_count=e.readUint32(),this.associations=[],t=0;t<entry_count;t++){var l={};this.associations.push(l),this.version<1?l.id=e.readUint16():l.id=e.readUint32();var h=e.readUint8();for(l.props=[],s=0;s<h;s++){var m=e.readUint8(),y={};l.props.push(y),y.essential=(m&128)>>7===1,this.flags&1?y.property_index=(m&127)<<8|e.readUint8():y.property_index=m&127}}}),r.createFullBoxCtor("iref",function(e){var t,s;for(this.references=[];e.getPosition()<this.start+this.size;)if(t=r.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),t.code===r.OK)this.version===0?s=new r.SingleItemTypeReferenceBox(t.type,t.size,t.hdr_size,t.start):s=new r.SingleItemTypeReferenceBoxLarge(t.type,t.size,t.hdr_size,t.start),s.write===r.Box.prototype.write&&s.type!=="mdat"&&(n.warn("BoxParser",s.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),this.references.push(s);else return}),r.createBoxCtor("irot",function(e){this.angle=e.readUint8()&3}),r.createFullBoxCtor("ispe",function(e){this.image_width=e.readUint32(),this.image_height=e.readUint32()}),r.createFullBoxCtor("kind",function(e){this.schemeURI=e.readCString(),this.value=e.readCString()}),r.createFullBoxCtor("leva",function(e){var t=e.readUint8();this.levels=[];for(var s=0;s<t;s++){var l={};this.levels[s]=l,l.track_ID=e.readUint32();var h=e.readUint8();switch(l.padding_flag=h>>7,l.assignment_type=h&127,l.assignment_type){case 0:l.grouping_type=e.readString(4);break;case 1:l.grouping_type=e.readString(4),l.grouping_type_parameter=e.readUint32();break;case 2:break;case 3:break;case 4:l.sub_track_id=e.readUint32();break;default:n.warn("BoxParser","Unknown leva assignement type")}}}),r.createBoxCtor("lhvC",function(e){var t,s,l;this.configurationVersion=e.readUint8(),this.min_spatial_segmentation_idc=e.readUint16()&4095,this.parallelismType=e.readUint8()&3,l=e.readUint8(),this.numTemporalLayers=(l&13)>>3,this.temporalIdNested=(l&4)>>2,this.lengthSizeMinusOne=l&3,this.nalu_arrays=[];var h=e.readUint8();for(t=0;t<h;t++){var m=[];this.nalu_arrays.push(m),l=e.readUint8(),m.completeness=(l&128)>>7,m.nalu_type=l&63;var y=e.readUint16();for(s=0;s<y;s++){var b={};m.push(b);var x=e.readUint16();b.data=e.readUint8Array(x)}}}),r.createBoxCtor("lsel",function(e){this.layer_id=e.readUint16()}),r.createBoxCtor("maxr",function(e){this.period=e.readUint32(),this.bytes=e.readUint32()});function p(e,t){this.x=e,this.y=t}p.prototype.toString=function(){return"("+this.x+","+this.y+")"},r.createBoxCtor("mdcv",function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()}),r.createFullBoxCtor("mdhd",function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()}),r.createFullBoxCtor("mehd",function(e){this.flags&1&&(n.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),this.version==1?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()}),r.createFullBoxCtor("meta",function(e){this.boxes=[],r.ContainerBox.prototype.parse.call(this,e)}),r.createFullBoxCtor("mfhd",function(e){this.sequence_number=e.readUint32()}),r.createFullBoxCtor("mfro",function(e){this._size=e.readUint32()}),r.createFullBoxCtor("mskC",function(e){this.bits_per_pixel=e.readUint8()}),r.createFullBoxCtor("mvhd",function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()}),r.createBoxCtor("npck",function(e){this.packetssent=e.readUint32()}),r.createBoxCtor("nump",function(e){this.packetssent=e.readUint64()}),r.createFullBoxCtor("padb",function(e){var t=e.readUint32();this.padbits=[];for(var s=0;s<Math.floor((t+1)/2);s++)this.padbits=e.readUint8()}),r.createBoxCtor("pasp",function(e){this.hSpacing=e.readUint32(),this.vSpacing=e.readUint32()}),r.createBoxCtor("payl",function(e){this.text=e.readString(this.size-this.hdr_size)}),r.createBoxCtor("payt",function(e){this.payloadID=e.readUint32();var t=e.readUint8();this.rtpmap_string=e.readString(t)}),r.createFullBoxCtor("pdin",function(e){var t=(this.size-this.hdr_size)/8;this.rate=[],this.initial_delay=[];for(var s=0;s<t;s++)this.rate[s]=e.readUint32(),this.initial_delay[s]=e.readUint32()}),r.createFullBoxCtor("pitm",function(e){this.version===0?this.item_id=e.readUint16():this.item_id=e.readUint32()}),r.createFullBoxCtor("pixi",function(e){var t;for(this.num_channels=e.readUint8(),this.bits_per_channels=[],t=0;t<this.num_channels;t++)this.bits_per_channels[t]=e.readUint8()}),r.createBoxCtor("pmax",function(e){this.bytes=e.readUint32()}),r.createFullBoxCtor("prdi",function(e){if(this.step_count=e.readUint16(),this.item_count=[],this.flags&2)for(var t=0;t<this.step_count;t++)this.item_count[t]=e.readUint16()}),r.createFullBoxCtor("prft",function(e){this.ref_track_id=e.readUint32(),this.ntp_timestamp=e.readUint64(),this.version===0?this.media_time=e.readUint32():this.media_time=e.readUint64()}),r.createFullBoxCtor("pssh",function(e){if(this.system_id=r.parseHex16(e),this.version>0){var t=e.readUint32();this.kid=[];for(var s=0;s<t;s++)this.kid[s]=r.parseHex16(e)}var l=e.readUint32();l>0&&(this.data=e.readUint8Array(l))}),r.createFullBoxCtor("clef",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),r.createFullBoxCtor("enof",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),r.createFullBoxCtor("prof",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),r.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),r.createBoxCtor("rtp ",function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)}),r.createFullBoxCtor("saio",function(e){this.flags&1&&(this.aux_info_type=e.readString(4),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var s=0;s<t;s++)this.version===0?this.offset[s]=e.readUint32():this.offset[s]=e.readUint64()}),r.createFullBoxCtor("saiz",function(e){if(this.flags&1&&(this.aux_info_type=e.readString(4),this.aux_info_type_parameter=e.readUint32()),this.default_sample_info_size=e.readUint8(),this.sample_count=e.readUint32(),this.sample_info_size=[],this.default_sample_info_size===0)for(var t=0;t<this.sample_count;t++)this.sample_info_size[t]=e.readUint8()}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA,"mett",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA,"metx",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"sbtt",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"stpp",function(e){this.parseHeader(e),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.auxiliary_mime_types=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"stxt",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"tx3g",function(e){this.parseHeader(e),this.displayFlags=e.readUint32(),this.horizontal_justification=e.readInt8(),this.vertical_justification=e.readInt8(),this.bg_color_rgba=e.readUint8Array(4),this.box_record=e.readInt16Array(4),this.style_record=e.readUint8Array(12),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA,"wvtt",function(e){this.parseHeader(e),this.parseFooter(e)}),r.createSampleGroupCtor("alst",function(e){var t,s=e.readUint16();for(this.first_output_sample=e.readUint16(),this.sample_offset=[],t=0;t<s;t++)this.sample_offset[t]=e.readUint32();var l=this.description_length-4-4*s;for(this.num_output_samples=[],this.num_total_samples=[],t=0;t<l/4;t++)this.num_output_samples[t]=e.readUint16(),this.num_total_samples[t]=e.readUint16()}),r.createSampleGroupCtor("avll",function(e){this.layerNumber=e.readUint8(),this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()}),r.createSampleGroupCtor("avss",function(e){this.subSequenceIdentifier=e.readUint16(),this.layerNumber=e.readUint8();var t=e.readUint8();this.durationFlag=t>>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var s=e.readUint8(),l=0;l<s;l++){var h={};this.dependency.push(h),h.subSeqDirectionFlag=e.readUint8(),h.layerNumber=e.readUint8(),h.subSequenceIdentifier=e.readUint16()}}),r.createSampleGroupCtor("dtrt",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("mvif",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("prol",function(e){this.roll_distance=e.readInt16()}),r.createSampleGroupCtor("rap ",function(e){var t=e.readUint8();this.num_leading_samples_known=t>>7,this.num_leading_samples=t&127}),r.createSampleGroupCtor("rash",function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(this.operation_point_count===1?2:this.operation_point_count*6)+9)n.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(this.operation_point_count===1)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t<this.operation_point_count;t++)this.available_bitrate[t]=e.readUint32(),this.target_rate_share[t]=e.readUint16()}this.maximum_bitrate=e.readUint32(),this.minimum_bitrate=e.readUint32(),this.discard_priority=e.readUint8()}}),r.createSampleGroupCtor("roll",function(e){this.roll_distance=e.readInt16()}),r.SampleGroupEntry.prototype.parse=function(e){n.warn("BoxParser","Unknown Sample Group type: "+this.grouping_type),this.data=e.readUint8Array(this.description_length)},r.createSampleGroupCtor("scif",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("scnm",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("seig",function(e){this.reserved=e.readUint8();var t=e.readUint8();this.crypt_byte_block=t>>4,this.skip_byte_block=t&15,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=r.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,this.isProtected===1&&this.Per_Sample_IV_Size===0&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))}),r.createSampleGroupCtor("stsa",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("sync",function(e){var t=e.readUint8();this.NAL_unit_type=t&63}),r.createSampleGroupCtor("tele",function(e){var t=e.readUint8();this.level_independently_decodable=t>>7}),r.createSampleGroupCtor("tsas",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("tscl",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("vipr",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createFullBoxCtor("sbgp",function(e){this.grouping_type=e.readString(4),this.version===1?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),s=0;s<t;s++){var l={};this.entries.push(l),l.sample_count=e.readInt32(),l.group_description_index=e.readInt32()}});function _(e,t){this.bad_pixel_row=e,this.bad_pixel_column=t}_.prototype.toString=function(){return"[row: "+this.bad_pixel_row+", column: "+this.bad_pixel_column+"]"},r.createFullBoxCtor("sbpm",function(e){var t;for(this.component_count=e.readUint16(),this.component_index=[],t=0;t<this.component_count;t++)this.component_index.push(e.readUint16());var s=e.readUint8();for(this.correction_applied=(s&128)==128,this.num_bad_rows=e.readUint32(),this.num_bad_cols=e.readUint32(),this.num_bad_pixels=e.readUint32(),this.bad_rows=[],this.bad_columns=[],this.bad_pixels=[],t=0;t<this.num_bad_rows;t++)this.bad_rows.push(e.readUint32());for(t=0;t<this.num_bad_cols;t++)this.bad_columns.push(e.readUint32());for(t=0;t<this.num_bad_pixels;t++){var l=e.readUint32(),h=e.readUint32();this.bad_pixels.push(new _(l,h))}}),r.createFullBoxCtor("schm",function(e){this.scheme_type=e.readString(4),this.scheme_version=e.readUint32(),this.flags&1&&(this.scheme_uri=e.readString(this.size-this.hdr_size-8))}),r.createBoxCtor("sdp ",function(e){this.sdptext=e.readString(this.size-this.hdr_size)}),r.createFullBoxCtor("sdtp",function(e){var t,s=this.size-this.hdr_size;this.is_leading=[],this.sample_depends_on=[],this.sample_is_depended_on=[],this.sample_has_redundancy=[];for(var l=0;l<s;l++)t=e.readUint8(),this.is_leading[l]=t>>6,this.sample_depends_on[l]=t>>4&3,this.sample_is_depended_on[l]=t>>2&3,this.sample_has_redundancy[l]=t&3}),r.createFullBoxCtor("senc"),r.createFullBoxCtor("sgpd",function(e){this.grouping_type=e.readString(4),n.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),this.version===1?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),s=0;s<t;s++){var l;r[this.grouping_type+"SampleGroupEntry"]?l=new r[this.grouping_type+"SampleGroupEntry"](this.grouping_type):l=new r.SampleGroupEntry(this.grouping_type),this.entries.push(l),this.version===1?this.default_length===0?l.description_length=e.readUint32():l.description_length=this.default_length:l.description_length=this.default_length,l.write===r.SampleGroupEntry.prototype.write&&(n.info("BoxParser","SampleGroup for type "+this.grouping_type+" writing not yet implemented, keeping unparsed data in memory for later write"),l.data=e.readUint8Array(l.description_length),e.position-=l.description_length),l.parse(e)}}),r.createFullBoxCtor("sidx",function(e){this.reference_ID=e.readUint32(),this.timescale=e.readUint32(),this.version===0?(this.earliest_presentation_time=e.readUint32(),this.first_offset=e.readUint32()):(this.earliest_presentation_time=e.readUint64(),this.first_offset=e.readUint64()),e.readUint16(),this.references=[];for(var t=e.readUint16(),s=0;s<t;s++){var l={};this.references.push(l);var h=e.readUint32();l.reference_type=h>>31&1,l.referenced_size=h&2147483647,l.subsegment_duration=e.readUint32(),h=e.readUint32(),l.starts_with_SAP=h>>31&1,l.SAP_type=h>>28&7,l.SAP_delta_time=h&268435455}}),r.SingleItemTypeReferenceBox=function(e,t,s,l){r.Box.call(this,e,t),this.hdr_size=s,this.start=l},r.SingleItemTypeReferenceBox.prototype=new r.Box,r.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var s=0;s<t;s++)this.references[s]={},this.references[s].to_item_ID=e.readUint16()},r.SingleItemTypeReferenceBoxLarge=function(e,t,s,l){r.Box.call(this,e,t),this.hdr_size=s,this.start=l},r.SingleItemTypeReferenceBoxLarge.prototype=new r.Box,r.SingleItemTypeReferenceBoxLarge.prototype.parse=function(e){this.from_item_ID=e.readUint32();var t=e.readUint16();this.references=[];for(var s=0;s<t;s++)this.references[s]={},this.references[s].to_item_ID=e.readUint32()},r.createFullBoxCtor("SmDm",function(e){this.primaryRChromaticity_x=e.readUint16(),this.primaryRChromaticity_y=e.readUint16(),this.primaryGChromaticity_x=e.readUint16(),this.primaryGChromaticity_y=e.readUint16(),this.primaryBChromaticity_x=e.readUint16(),this.primaryBChromaticity_y=e.readUint16(),this.whitePointChromaticity_x=e.readUint16(),this.whitePointChromaticity_y=e.readUint16(),this.luminanceMax=e.readUint32(),this.luminanceMin=e.readUint32()}),r.createFullBoxCtor("smhd",function(e){this.balance=e.readUint16(),e.readUint16()}),r.createFullBoxCtor("ssix",function(e){this.subsegments=[];for(var t=e.readUint32(),s=0;s<t;s++){var l={};this.subsegments.push(l),l.ranges=[];for(var h=e.readUint32(),m=0;m<h;m++){var y={};l.ranges.push(y),y.level=e.readUint8(),y.range_size=e.readUint24()}}}),r.createFullBoxCtor("stco",function(e){var t;if(t=e.readUint32(),this.chunk_offsets=[],this.version===0)for(var s=0;s<t;s++)this.chunk_offsets.push(e.readUint32())}),r.createFullBoxCtor("stdp",function(e){var t=(this.size-this.hdr_size)/2;this.priority=[];for(var s=0;s<t;s++)this.priority[s]=e.readUint16()}),r.createFullBoxCtor("sthd"),r.createFullBoxCtor("stri",function(e){this.switch_group=e.readUint16(),this.alternate_group=e.readUint16(),this.sub_track_id=e.readUint32();var t=(this.size-this.hdr_size-8)/4;this.attribute_list=[];for(var s=0;s<t;s++)this.attribute_list[s]=e.readUint32()}),r.createFullBoxCtor("stsc",function(e){var t,s;if(t=e.readUint32(),this.first_chunk=[],this.samples_per_chunk=[],this.sample_description_index=[],this.version===0)for(s=0;s<t;s++)this.first_chunk.push(e.readUint32()),this.samples_per_chunk.push(e.readUint32()),this.sample_description_index.push(e.readUint32())}),r.createFullBoxCtor("stsd",function(e){var t,s,l,h;for(this.entries=[],l=e.readUint32(),t=1;t<=l;t++)if(s=r.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),s.code===r.OK)r[s.type+"SampleEntry"]?(h=new r[s.type+"SampleEntry"](s.size),h.hdr_size=s.hdr_size,h.start=s.start):(n.warn("BoxParser","Unknown sample entry type: "+s.type),h=new r.SampleEntry(s.type,s.size,s.hdr_size,s.start)),h.write===r.SampleEntry.prototype.write&&(n.info("BoxParser","SampleEntry "+h.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),h.parseDataAndRewind(e)),h.parse(e),this.entries.push(h);else return}),r.createFullBoxCtor("stsg",function(e){this.grouping_type=e.readUint32();var t=e.readUint16();this.group_description_index=[];for(var s=0;s<t;s++)this.group_description_index[s]=e.readUint32()}),r.createFullBoxCtor("stsh",function(e){var t,s;if(t=e.readUint32(),this.shadowed_sample_numbers=[],this.sync_sample_numbers=[],this.version===0)for(s=0;s<t;s++)this.shadowed_sample_numbers.push(e.readUint32()),this.sync_sample_numbers.push(e.readUint32())}),r.createFullBoxCtor("stss",function(e){var t,s;if(s=e.readUint32(),this.version===0)for(this.sample_numbers=[],t=0;t<s;t++)this.sample_numbers.push(e.readUint32())}),r.createFullBoxCtor("stsz",function(e){var t;if(this.sample_sizes=[],this.version===0)for(this.sample_size=e.readUint32(),this.sample_count=e.readUint32(),t=0;t<this.sample_count;t++)this.sample_size===0?this.sample_sizes.push(e.readUint32()):this.sample_sizes[t]=this.sample_size}),r.createFullBoxCtor("stts",function(e){var t,s,l;if(t=e.readUint32(),this.sample_counts=[],this.sample_deltas=[],this.version===0)for(s=0;s<t;s++)this.sample_counts.push(e.readUint32()),l=e.readInt32(),l<0&&(n.warn("BoxParser","File uses negative stts sample delta, using value 1 instead, sync may be lost!"),l=1),this.sample_deltas.push(l)}),r.createFullBoxCtor("stvi",function(e){var t=e.readUint32();this.single_view_allowed=t&3,this.stereo_scheme=e.readUint32();var s=e.readUint32();this.stereo_indication_type=e.readString(s);var l,h;for(this.boxes=[];e.getPosition()<this.start+this.size;)if(l=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),l.code===r.OK)h=l.box,this.boxes.push(h),this[h.type]=h;else return}),r.createBoxCtor("styp",function(e){r.ftypBox.prototype.parse.call(this,e)}),r.createFullBoxCtor("stz2",function(e){var t,s;if(this.sample_sizes=[],this.version===0)if(this.reserved=e.readUint24(),this.field_size=e.readUint8(),s=e.readUint32(),this.field_size===4)for(t=0;t<s;t+=2){var l=e.readUint8();this.sample_sizes[t]=l>>4&15,this.sample_sizes[t+1]=l&15}else if(this.field_size===8)for(t=0;t<s;t++)this.sample_sizes[t]=e.readUint8();else if(this.field_size===16)for(t=0;t<s;t++)this.sample_sizes[t]=e.readUint16();else n.error("BoxParser","Error in length field in stz2 box")}),r.createFullBoxCtor("subs",function(e){var t,s,l,h;for(l=e.readUint32(),this.entries=[],t=0;t<l;t++){var m={};if(this.entries[t]=m,m.sample_delta=e.readUint32(),m.subsamples=[],h=e.readUint16(),h>0)for(s=0;s<h;s++){var y={};m.subsamples.push(y),this.version==1?y.size=e.readUint32():y.size=e.readUint16(),y.priority=e.readUint8(),y.discardable=e.readUint8(),y.codec_specific_parameters=e.readUint32()}}}),r.createFullBoxCtor("tenc",function(e){if(e.readUint8(),this.version===0)e.readUint8();else{var t=e.readUint8();this.default_crypt_byte_block=t>>4&15,this.default_skip_byte_block=t&15}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=r.parseHex16(e),this.default_isProtected===1&&this.default_Per_Sample_IV_Size===0&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))}),r.createFullBoxCtor("tfdt",function(e){this.version==1?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()}),r.createFullBoxCtor("tfhd",function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0}),r.createFullBoxCtor("tfra",function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=t&3,this.entries=[];for(var s=e.readUint32(),l=0;l<s;l++)this.version===1?(this.time=e.readUint64(),this.moof_offset=e.readUint64()):(this.time=e.readUint32(),this.moof_offset=e.readUint32()),this.traf_number=e["readUint"+8*(this.length_size_of_traf_num+1)](),this.trun_number=e["readUint"+8*(this.length_size_of_trun_num+1)](),this.sample_number=e["readUint"+8*(this.length_size_of_sample_num+1)]()}),r.createFullBoxCtor("tkhd",function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint32()),e.readUint32Array(2),this.layer=e.readInt16(),this.alternate_group=e.readInt16(),this.volume=e.readInt16()>>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()}),r.createBoxCtor("tmax",function(e){this.time=e.readUint32()}),r.createBoxCtor("tmin",function(e){this.time=e.readUint32()}),r.createBoxCtor("totl",function(e){this.bytessent=e.readUint32()}),r.createBoxCtor("tpay",function(e){this.bytessent=e.readUint32()}),r.createBoxCtor("tpyl",function(e){this.bytessent=e.readUint64()}),r.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},r.createTrackGroupCtor("msrc"),r.TrackReferenceTypeBox=function(e,t,s,l){r.Box.call(this,e,t),this.hdr_size=s,this.start=l},r.TrackReferenceTypeBox.prototype=new r.Box,r.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},r.trefBox.prototype.parse=function(e){for(var t,s;e.getPosition()<this.start+this.size;)if(t=r.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),t.code===r.OK)s=new r.TrackReferenceTypeBox(t.type,t.size,t.hdr_size,t.start),s.write===r.Box.prototype.write&&s.type!=="mdat"&&(n.info("BoxParser","TrackReference "+s.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),this.boxes.push(s);else return},r.createFullBoxCtor("trep",function(e){for(this.track_ID=e.readUint32(),this.boxes=[];e.getPosition()<this.start+this.size;)if(ret=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),ret.code===r.OK)box=ret.box,this.boxes.push(box);else return}),r.createFullBoxCtor("trex",function(e){this.track_id=e.readUint32(),this.default_sample_description_index=e.readUint32(),this.default_sample_duration=e.readUint32(),this.default_sample_size=e.readUint32(),this.default_sample_flags=e.readUint32()}),r.createBoxCtor("trpy",function(e){this.bytessent=e.readUint64()}),r.createFullBoxCtor("trun",function(e){var t=0;if(this.sample_count=e.readUint32(),t+=4,this.size-this.hdr_size>t&&this.flags&r.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&r.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var s=0;s<this.sample_count;s++)this.flags&r.TRUN_FLAGS_DURATION&&(this.sample_duration[s]=e.readUint32()),this.flags&r.TRUN_FLAGS_SIZE&&(this.sample_size[s]=e.readUint32()),this.flags&r.TRUN_FLAGS_FLAGS&&(this.sample_flags[s]=e.readUint32()),this.flags&r.TRUN_FLAGS_CTS_OFFSET&&(this.version===0?this.sample_composition_time_offset[s]=e.readUint32():this.sample_composition_time_offset[s]=e.readInt32())}),r.createFullBoxCtor("tsel",function(e){this.switch_group=e.readUint32();var t=(this.size-this.hdr_size-4)/4;this.attribute_list=[];for(var s=0;s<t;s++)this.attribute_list[s]=e.readUint32()}),r.createFullBoxCtor("txtC",function(e){this.config=e.readCString()}),r.createBoxCtor("tyco",function(e){var t=(this.size-this.hdr_size)/4;this.compatible_brands=[];for(var s=0;s<t;s++)this.compatible_brands[s]=e.readString(4)}),r.createFullBoxCtor("udes",function(e){this.lang=e.readCString(),this.name=e.readCString(),this.description=e.readCString(),this.tags=e.readCString()}),r.createFullBoxCtor("uncC",function(e){var t;if(this.profile=e.readUint32(),this.version!=1){if(this.version==0){for(this.component_count=e.readUint32(),this.component_index=[],this.component_bit_depth_minus_one=[],this.component_format=[],this.component_align_size=[],t=0;t<this.component_count;t++)this.component_index.push(e.readUint16()),this.component_bit_depth_minus_one.push(e.readUint8()),this.component_format.push(e.readUint8()),this.component_align_size.push(e.readUint8());this.sampling_type=e.readUint8(),this.interleave_type=e.readUint8(),this.block_size=e.readUint8();var s=e.readUint8();this.component_little_endian=s>>7&1,this.block_pad_lsb=s>>6&1,this.block_little_endian=s>>5&1,this.block_reversed=s>>4&1,this.pad_unknown=s>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}}}),r.createFullBoxCtor("url ",function(e){this.flags!==1&&(this.location=e.readCString())}),r.createFullBoxCtor("urn ",function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())}),r.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/\'/g,"'")}),r.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,function(e){this.system_id=r.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))}),r.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),r.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=r.parseHex16(e)}),r.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t<this.fragment_count;t++){var s={},l=0,h=0;this.version===1?(l=e.readUint64(),h=e.readUint64()):(l=e.readUint32(),h=e.readUint32()),s.absolute_time=l,s.absolute_duration=h,this.entries.push(s)}}),r.createUUIDBox("6d1d9b0542d544e680e2141daff757b2",!0,!1,function(e){this.version===1?(this.absolute_time=e.readUint64(),this.duration=e.readUint64()):(this.absolute_time=e.readUint32(),this.duration=e.readUint32())}),r.createFullBoxCtor("vmhd",function(e){this.graphicsmode=e.readUint16(),this.opcolor=e.readUint16Array(3)}),r.createFullBoxCtor("vpcC",function(e){var t;this.version===1?(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=t&1,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=t&15,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=t&1,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))}),r.createBoxCtor("vttC",function(e){this.text=e.readString(this.size-this.hdr_size)}),r.createFullBoxCtor("vvcC",function(e){var t,s,l={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(A){this.held_bits=A.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(A){this.held_bits=A.readUint16(),this.num_held_bits=16},extract_bits:function(A){var R=this.held_bits>>this.num_held_bits-A&(1<<A)-1;return this.num_held_bits-=A,R}};if(l.stream_read_1_bytes(e),l.extract_bits(5),this.lengthSizeMinusOne=l.extract_bits(2),this.ptl_present_flag=l.extract_bits(1),this.ptl_present_flag){l.stream_read_2_bytes(e),this.ols_idx=l.extract_bits(9),this.num_sublayers=l.extract_bits(3),this.constant_frame_rate=l.extract_bits(2),this.chroma_format_idc=l.extract_bits(2),l.stream_read_1_bytes(e),this.bit_depth_minus8=l.extract_bits(3),l.extract_bits(5);{if(l.stream_read_2_bytes(e),l.extract_bits(2),this.num_bytes_constraint_info=l.extract_bits(6),this.general_profile_idc=l.extract_bits(7),this.general_tier_flag=l.extract_bits(1),this.general_level_idc=e.readUint8(),l.stream_read_1_bytes(e),this.ptl_frame_only_constraint_flag=l.extract_bits(1),this.ptl_multilayer_enabled_flag=l.extract_bits(1),this.general_constraint_info=new Uint8Array(this.num_bytes_constraint_info),this.num_bytes_constraint_info){for(t=0;t<this.num_bytes_constraint_info-1;t++){var h=l.extract_bits(6);l.stream_read_1_bytes(e);var m=l.extract_bits(2);this.general_constraint_info[t]=h<<2|m}this.general_constraint_info[this.num_bytes_constraint_info-1]=l.extract_bits(6)}else l.extract_bits(6);if(this.num_sublayers>1){for(l.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,s=this.num_sublayers-2;s>=0;--s){var y=l.extract_bits(1);this.ptl_sublayer_present_mask|=y<<s}for(s=this.num_sublayers;s<=8&&this.num_sublayers>1;++s)l.extract_bits(1);for(this.sublayer_level_idc=[],s=this.num_sublayers-2;s>=0;--s)this.ptl_sublayer_present_mask&1<<s&&(this.sublayer_level_idc[s]=e.readUint8())}if(this.ptl_num_sub_profiles=e.readUint8(),this.general_sub_profile_idc=[],this.ptl_num_sub_profiles)for(t=0;t<this.ptl_num_sub_profiles;t++)this.general_sub_profile_idc.push(e.readUint32())}this.max_picture_width=e.readUint16(),this.max_picture_height=e.readUint16(),this.avg_frame_rate=e.readUint16()}var b=12,x=13;this.nalu_arrays=[];var w=e.readUint8();for(t=0;t<w;t++){var T=[];this.nalu_arrays.push(T),l.stream_read_1_bytes(e),T.completeness=l.extract_bits(1),l.extract_bits(2),T.nalu_type=l.extract_bits(5);var C=1;for(T.nalu_type!=x&&T.nalu_type!=b&&(C=e.readUint16()),s=0;s<C;s++){var F=e.readUint16();T.push({data:e.readUint8Array(F),length:F})}}}),r.createFullBoxCtor("vvnC",function(e){var t=strm.readUint8();this.lengthSizeMinusOne=t&3}),r.SampleEntry.prototype.isVideo=function(){return!1},r.SampleEntry.prototype.isAudio=function(){return!1},r.SampleEntry.prototype.isSubtitle=function(){return!1},r.SampleEntry.prototype.isMetadata=function(){return!1},r.SampleEntry.prototype.isHint=function(){return!1},r.SampleEntry.prototype.getCodec=function(){return this.type.replace(".","")},r.SampleEntry.prototype.getWidth=function(){return""},r.SampleEntry.prototype.getHeight=function(){return""},r.SampleEntry.prototype.getChannelCount=function(){return""},r.SampleEntry.prototype.getSampleRate=function(){return""},r.SampleEntry.prototype.getSampleSize=function(){return""},r.VisualSampleEntry.prototype.isVideo=function(){return!0},r.VisualSampleEntry.prototype.getWidth=function(){return this.width},r.VisualSampleEntry.prototype.getHeight=function(){return this.height},r.AudioSampleEntry.prototype.isAudio=function(){return!0},r.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},r.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},r.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},r.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},r.MetadataSampleEntry.prototype.isMetadata=function(){return!0},r.decimalToHex=function(e,t){var s=Number(e).toString(16);for(t=typeof t>"u"||t===null?t=2:t;s.length<t;)s="0"+s;return s},r.avc1SampleEntry.prototype.getCodec=r.avc2SampleEntry.prototype.getCodec=r.avc3SampleEntry.prototype.getCodec=r.avc4SampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this);return this.avcC?e+"."+r.decimalToHex(this.avcC.AVCProfileIndication)+r.decimalToHex(this.avcC.profile_compatibility)+r.decimalToHex(this.avcC.AVCLevelIndication):e},r.hev1SampleEntry.prototype.getCodec=r.hvc1SampleEntry.prototype.getCodec=function(){var e,t=r.SampleEntry.prototype.getCodec.call(this);if(this.hvcC){switch(t+=".",this.hvcC.general_profile_space){case 0:t+="";break;case 1:t+="A";break;case 2:t+="B";break;case 3:t+="C";break}t+=this.hvcC.general_profile_idc,t+=".";var s=this.hvcC.general_profile_compatibility,l=0;for(e=0;e<32&&(l|=s&1,e!=31);e++)l<<=1,s>>=1;t+=r.decimalToHex(l,0),t+=".",this.hvcC.general_tier_flag===0?t+="L":t+="H",t+=this.hvcC.general_level_idc;var h=!1,m="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||h)&&(m="."+r.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+m,h=!0);t+=m}return t},r.vvc1SampleEntry.prototype.getCodec=r.vvi1SampleEntry.prototype.getCodec=function(){var e,t=r.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var s="";if(this.vvcC.general_constraint_info){var l=[],h=0;h|=this.vvcC.ptl_frame_only_constraint<<7,h|=this.vvcC.ptl_multilayer_enabled<<6;var m;for(e=0;e<this.vvcC.general_constraint_info.length;++e)h|=this.vvcC.general_constraint_info[e]>>2&63,l.push(h),h&&(m=e),h=this.vvcC.general_constraint_info[e]>>2&3;if(m===void 0)s=".CA";else{s=".C";var y="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",b=0,x=0;for(e=0;e<=m;++e)for(b=b<<8|l[e],x+=8;x>=5;){var w=b>>x-5&31;s+=y[w],x-=5,b&=(1<<x)-1}x&&(b<<=5-x,s+=y[b&31])}}t+=s}return t},r.mp4aSampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),s=this.esds.esd.getAudioConfig();return e+"."+r.decimalToHex(t)+(s?"."+s:"")}else return e},r.stxtSampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},r.vp08SampleEntry.prototype.getCodec=r.vp09SampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;t==0&&(t="00");var s=this.vpcC.bitDepth;return s==8&&(s="08"),e+".0"+this.vpcC.profile+"."+t+"."+s},r.av01SampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this),t=this.av1C.seq_level_idx_0;t<10&&(t="0"+t);var s;return this.av1C.seq_profile===2&&this.av1C.high_bitdepth===1?s=this.av1C.twelve_bit===1?"12":"10":this.av1C.seq_profile<=2&&(s=this.av1C.high_bitdepth===1?"10":"08"),e+"."+this.av1C.seq_profile+"."+t+(this.av1C.seq_tier_0?"H":"M")+"."+s},r.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>c&&(this.size+=8),this.type==="uuid"&&(this.size+=16),n.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>c?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),this.type==="uuid"&&e.writeUint8Array(this.uuid),this.size>c&&e.writeUint64(this.size)},r.FullBox.prototype.writeHeader=function(e){this.size+=4,r.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},r.Box.prototype.write=function(e){this.type==="mdat"?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},r.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&(this.boxes[t].write(e),this.size+=this.boxes[t].size);n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.TrackReferenceTypeBox.prototype.write=function(e){this.size=this.track_ids.length*4,this.writeHeader(e),e.writeUint32Array(this.track_ids)},r.avcCBox.prototype.write=function(e){var t;for(this.size=7,t=0;t<this.SPS.length;t++)this.size+=2+this.SPS[t].length;for(t=0;t<this.PPS.length;t++)this.size+=2+this.PPS[t].length;for(this.ext&&(this.size+=this.ext.length),this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8(this.AVCProfileIndication),e.writeUint8(this.profile_compatibility),e.writeUint8(this.AVCLevelIndication),e.writeUint8(this.lengthSizeMinusOne+252),e.writeUint8(this.SPS.length+224),t=0;t<this.SPS.length;t++)e.writeUint16(this.SPS[t].length),e.writeUint8Array(this.SPS[t].nalu);for(e.writeUint8(this.PPS.length),t=0;t<this.PPS.length;t++)e.writeUint16(this.PPS[t].length),e.writeUint8Array(this.PPS[t].nalu);this.ext&&e.writeUint8Array(this.ext)},r.co64Box.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),t=0;t<this.chunk_offsets.length;t++)e.writeUint64(this.chunk_offsets[t])},r.cslgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4*5,this.writeHeader(e),e.writeInt32(this.compositionToDTSShift),e.writeInt32(this.leastDecodeToDisplayDelta),e.writeInt32(this.greatestDecodeToDisplayDelta),e.writeInt32(this.compositionStartTime),e.writeInt32(this.compositionEndTime)},r.cttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),this.version===1?e.writeInt32(this.sample_offsets[t]):e.writeUint32(this.sample_offsets[t])},r.drefBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++)this.entries[t].write(e),this.size+=this.entries[t].size;n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.elngBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.extended_language.length,this.writeHeader(e),e.writeString(this.extended_language)},r.elstBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+12*this.entries.length,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var s=this.entries[t];e.writeUint32(s.segment_duration),e.writeInt32(s.media_time),e.writeInt16(s.media_rate_integer),e.writeInt16(s.media_rate_fraction)}},r.emsgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4*4+this.message_data.length+(this.scheme_id_uri.length+1)+(this.value.length+1),this.writeHeader(e),e.writeCString(this.scheme_id_uri),e.writeCString(this.value),e.writeUint32(this.timescale),e.writeUint32(this.presentation_time_delta),e.writeUint32(this.event_duration),e.writeUint32(this.id),e.writeUint8Array(this.message_data)},r.ftypBox.prototype.write=function(e){this.size=8+4*this.compatible_brands.length,this.writeHeader(e),e.writeString(this.major_brand,null,4),e.writeUint32(this.minor_version);for(var t=0;t<this.compatible_brands.length;t++)e.writeString(this.compatible_brands[t],null,4)},r.hdlrBox.prototype.write=function(e){this.size=5*4+this.name.length+1,this.version=0,this.flags=0,this.writeHeader(e),e.writeUint32(0),e.writeString(this.handler,null,4),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeCString(this.name)},r.hvcCBox.prototype.write=function(e){var t,s;for(this.size=23,t=0;t<this.nalu_arrays.length;t++)for(this.size+=3,s=0;s<this.nalu_arrays[t].length;s++)this.size+=2+this.nalu_arrays[t][s].data.length;for(this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8((this.general_profile_space<<6)+(this.general_tier_flag<<5)+this.general_profile_idc),e.writeUint32(this.general_profile_compatibility),e.writeUint8Array(this.general_constraint_indicator),e.writeUint8(this.general_level_idc),e.writeUint16(this.min_spatial_segmentation_idc+(15<<24)),e.writeUint8(this.parallelismType+252),e.writeUint8(this.chroma_format_idc+252),e.writeUint8(this.bit_depth_luma_minus8+248),e.writeUint8(this.bit_depth_chroma_minus8+248),e.writeUint16(this.avgFrameRate),e.writeUint8((this.constantFrameRate<<6)+(this.numTemporalLayers<<3)+(this.temporalIdNested<<2)+this.lengthSizeMinusOne),e.writeUint8(this.nalu_arrays.length),t=0;t<this.nalu_arrays.length;t++)for(e.writeUint8((this.nalu_arrays[t].completeness<<7)+this.nalu_arrays[t].nalu_type),e.writeUint16(this.nalu_arrays[t].length),s=0;s<this.nalu_arrays[t].length;s++)e.writeUint16(this.nalu_arrays[t][s].data.length),e.writeUint8Array(this.nalu_arrays[t][s].data)},r.kindBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.schemeURI.length+1+(this.value.length+1),this.writeHeader(e),e.writeCString(this.schemeURI),e.writeCString(this.value)},r.mdhdBox.prototype.write=function(e){this.size=4*4+2*2,this.flags=0,this.version=0,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint16(this.language),e.writeUint16(0)},r.mehdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.fragment_duration)},r.mfhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.sequence_number)},r.mvhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=23*4+2*2,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint32(this.rate),e.writeUint16(this.volume<<8),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32Array(this.matrix),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(this.next_track_id)},r.SampleEntry.prototype.writeHeader=function(e){this.size=8,r.Box.prototype.writeHeader.call(this,e),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint16(this.data_reference_index)},r.SampleEntry.prototype.writeFooter=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e),this.size+=this.boxes[t].size;n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.SampleEntry.prototype.write=function(e){this.writeHeader(e),e.writeUint8Array(this.data),this.size+=this.data.length,n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.VisualSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=2*7+6*4+32,e.writeUint16(0),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.width),e.writeUint16(this.height),e.writeUint32(this.horizresolution),e.writeUint32(this.vertresolution),e.writeUint32(0),e.writeUint16(this.frame_count),e.writeUint8(Math.min(31,this.compressorname.length)),e.writeString(this.compressorname,null,31),e.writeUint16(this.depth),e.writeInt16(-1),this.writeFooter(e)},r.AudioSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=2*4+3*4,e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.channel_count),e.writeUint16(this.samplesize),e.writeUint16(0),e.writeUint16(0),e.writeUint32(this.samplerate<<16),this.writeFooter(e)},r.stppSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=this.namespace.length+1+this.schema_location.length+1+this.auxiliary_mime_types.length+1,e.writeCString(this.namespace),e.writeCString(this.schema_location),e.writeCString(this.auxiliary_mime_types),this.writeFooter(e)},r.SampleGroupEntry.prototype.write=function(e){e.writeUint8Array(this.data)},r.sbgpBox.prototype.write=function(e){this.version=1,this.flags=0,this.size=12+8*this.entries.length,this.writeHeader(e),e.writeString(this.grouping_type,null,4),e.writeUint32(this.grouping_type_parameter),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var s=this.entries[t];e.writeInt32(s.sample_count),e.writeInt32(s.group_description_index)}},r.sgpdBox.prototype.write=function(e){var t,s;for(this.flags=0,this.size=12,t=0;t<this.entries.length;t++)s=this.entries[t],this.version===1&&(this.default_length===0&&(this.size+=4),this.size+=s.data.length);for(this.writeHeader(e),e.writeString(this.grouping_type,null,4),this.version===1&&e.writeUint32(this.default_length),this.version>=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t<this.entries.length;t++)s=this.entries[t],this.version===1&&this.default_length===0&&e.writeUint32(s.description_length),s.write(e)},r.sidxBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4*4+2+2+12*this.references.length,this.writeHeader(e),e.writeUint32(this.reference_ID),e.writeUint32(this.timescale),e.writeUint32(this.earliest_presentation_time),e.writeUint32(this.first_offset),e.writeUint16(0),e.writeUint16(this.references.length);for(var t=0;t<this.references.length;t++){var s=this.references[t];e.writeUint32(s.reference_type<<31|s.referenced_size),e.writeUint32(s.subsegment_duration),e.writeUint32(s.starts_with_SAP<<31|s.SAP_type<<28|s.SAP_delta_time)}},r.smhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=4,this.writeHeader(e),e.writeUint16(this.balance),e.writeUint16(0)},r.stcoBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),e.writeUint32Array(this.chunk_offsets)},r.stscBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+12*this.first_chunk.length,this.writeHeader(e),e.writeUint32(this.first_chunk.length),t=0;t<this.first_chunk.length;t++)e.writeUint32(this.first_chunk[t]),e.writeUint32(this.samples_per_chunk[t]),e.writeUint32(this.sample_description_index[t])},r.stsdBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=0,this.writeHeader(e),e.writeUint32(this.entries.length),this.size+=4,t=0;t<this.entries.length;t++)this.entries[t].write(e),this.size+=this.entries[t].size;n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.stshBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.shadowed_sample_numbers.length,this.writeHeader(e),e.writeUint32(this.shadowed_sample_numbers.length),t=0;t<this.shadowed_sample_numbers.length;t++)e.writeUint32(this.shadowed_sample_numbers[t]),e.writeUint32(this.sync_sample_numbers[t])},r.stssBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.sample_numbers.length,this.writeHeader(e),e.writeUint32(this.sample_numbers.length),e.writeUint32Array(this.sample_numbers)},r.stszBox.prototype.write=function(e){var t,s=!0;if(this.version=0,this.flags=0,this.sample_sizes.length>0)for(t=0;t+1<this.sample_sizes.length;)if(this.sample_sizes[t+1]!==this.sample_sizes[0]){s=!1;break}else t++;else s=!1;this.size=8,s||(this.size+=4*this.sample_sizes.length),this.writeHeader(e),s?e.writeUint32(this.sample_sizes[0]):e.writeUint32(0),e.writeUint32(this.sample_sizes.length),s||e.writeUint32Array(this.sample_sizes)},r.sttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),e.writeUint32(this.sample_deltas[t])},r.tfdtBox.prototype.write=function(e){var t=Math.pow(2,32)-1;this.version=this.baseMediaDecodeTime>t?1:0,this.flags=0,this.size=4,this.version===1&&(this.size+=4),this.writeHeader(e),this.version===1?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},r.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&r.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&r.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&r.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&r.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&r.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&r.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&r.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&r.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&r.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&r.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},r.tkhdBox.prototype.write=function(e){this.version=0,this.size=4*18+2*4,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},r.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4*5,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},r.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&r.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&r.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&r.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&r.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&r.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&r.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&r.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&r.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t<this.sample_count;t++)this.flags&r.TRUN_FLAGS_DURATION&&e.writeUint32(this.sample_duration[t]),this.flags&r.TRUN_FLAGS_SIZE&&e.writeUint32(this.sample_size[t]),this.flags&r.TRUN_FLAGS_FLAGS&&e.writeUint32(this.sample_flags[t]),this.flags&r.TRUN_FLAGS_CTS_OFFSET&&(this.version===0?e.writeUint32(this.sample_composition_time_offset[t]):e.writeInt32(this.sample_composition_time_offset[t]))},r["url Box"].prototype.write=function(e){this.version=0,this.location?(this.flags=0,this.size=this.location.length+1):(this.flags=1,this.size=0),this.writeHeader(e),this.location&&e.writeCString(this.location)},r["urn Box"].prototype.write=function(e){this.version=0,this.flags=0,this.size=this.name.length+1+(this.location?this.location.length+1:0),this.writeHeader(e),e.writeCString(this.name),this.location&&e.writeCString(this.location)},r.vmhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=8,this.writeHeader(e),e.writeUint16(this.graphicsmode),e.writeUint16Array(this.opcolor)},r.cttsBox.prototype.unpack=function(e){var t,s,l;for(l=0,t=0;t<this.sample_counts.length;t++)for(s=0;s<this.sample_counts[t];s++)e[l].pts=e[l].dts+this.sample_offsets[t],l++},r.sttsBox.prototype.unpack=function(e){var t,s,l;for(l=0,t=0;t<this.sample_counts.length;t++)for(s=0;s<this.sample_counts[t];s++)l===0?e[l].dts=0:e[l].dts=e[l-1].dts+this.sample_deltas[t],l++},r.stcoBox.prototype.unpack=function(e){var t;for(t=0;t<this.chunk_offsets.length;t++)e[t].offset=this.chunk_offsets[t]},r.stscBox.prototype.unpack=function(e){var t,s,l,h,m;for(h=0,m=0,t=0;t<this.first_chunk.length;t++)for(s=0;s<(t+1<this.first_chunk.length?this.first_chunk[t+1]:1/0);s++)for(m++,l=0;l<this.samples_per_chunk[t];l++){if(e[h])e[h].description_index=this.sample_description_index[t],e[h].chunk_index=m;else return;h++}},r.stszBox.prototype.unpack=function(e){var t;for(t=0;t<this.sample_sizes.length;t++)e[t].size=this.sample_sizes[t]},r.DIFF_BOXES_PROP_NAMES=["boxes","entries","references","subsamples","items","item_infos","extents","associations","subsegments","ranges","seekLists","seekPoints","esd","levels"],r.DIFF_PRIMITIVE_ARRAY_PROP_NAMES=["compatible_brands","matrix","opcolor","sample_counts","sample_counts","sample_deltas","first_chunk","samples_per_chunk","sample_sizes","chunk_offsets","sample_offsets","sample_description_index","sample_duration"],r.boxEqualFields=function(e,t){if(e&&!t)return!1;var s;for(s in e)if(!(r.DIFF_BOXES_PROP_NAMES.indexOf(s)>-1)){if(e[s]instanceof r.Box||t[s]instanceof r.Box)continue;if(typeof e[s]>"u"||typeof t[s]>"u")continue;if(typeof e[s]=="function"||typeof t[s]=="function")continue;if(e.subBoxNames&&e.subBoxNames.indexOf(s.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(s.slice(0,4))>-1)continue;if(s==="data"||s==="start"||s==="size"||s==="creation_time"||s==="modification_time")continue;if(r.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(s)>-1)continue;if(e[s]!==t[s])return!1}return!0},r.boxEqual=function(e,t){if(!r.boxEqualFields(e,t))return!1;for(var s=0;s<r.DIFF_BOXES_PROP_NAMES.length;s++){var l=r.DIFF_BOXES_PROP_NAMES[s];if(e[l]&&t[l]&&!r.boxEqual(e[l],t[l]))return!1}return!0};var g=function(){};g.prototype.parseSample=function(e){var t,s,l=new o(e.buffer);for(t=[];!l.isEos();)s=r.parseOneBox(l,!1),s.code===r.OK&&s.box.type==="vttc"&&t.push(s.box);return t},g.prototype.getText=function(e,t,s){function l(w,T,C){return C=C||"0",w=w+"",w.length>=T?w:new Array(T-w.length+1).join(C)+w}function h(w){var T=Math.floor(w/3600),C=Math.floor((w-T*3600)/60),F=Math.floor(w-T*3600-C*60),A=Math.floor((w-T*3600-C*60-F)*1e3);return""+l(T,2)+":"+l(C,2)+":"+l(F,2)+"."+l(A,3)}for(var m=this.parseSample(s),y="",b=0;b<m.length;b++){var x=m[b];y+=h(e)+" --> "+h(t)+`\\r\n`,y+=x.payl.text}return y};var v=function(){};v.prototype.parseSample=function(e){var t={},s;t.resources=[];var l=new o(e.data.buffer);if(!e.subsamples||e.subsamples.length===0)t.documentString=l.readString(e.data.length);else if(t.documentString=l.readString(e.subsamples[0].size),e.subsamples.length>1)for(s=1;s<e.subsamples.length;s++)t.resources[s]=l.readUint8Array(e.subsamples[s].size);return typeof DOMParser<"u"&&(t.document=new DOMParser().parseFromString(t.documentString,"application/xml")),t};var E=function(){};E.prototype.parseSample=function(e){var t,s=new o(e.data.buffer);return t=s.readString(e.data.length),t},E.prototype.parseConfig=function(e){var t,s=new o(e.buffer);return s.readUint32(),t=s.readCString(),t},a.VTTin4Parser=g,a.XMLSubtitlein4Parser=v,a.Textin4Parser=E;var S=function(e){this.stream=e||new f,this.boxes=[],this.mdats=[],this.moofs=[],this.isProgressive=!1,this.moovStartFound=!1,this.onMoovStart=null,this.moovStartSent=!1,this.onReady=null,this.readySent=!1,this.onSegment=null,this.onSamples=null,this.onError=null,this.sampleListBuilt=!1,this.fragmentedTracks=[],this.extractedTracks=[],this.isFragmentationInitialized=!1,this.sampleProcessingStarted=!1,this.nextMoofNumber=0,this.itemListBuilt=!1,this.items=[],this.entity_groups=[],this.onSidx=null,this.sidxSent=!1};S.prototype.setSegmentOptions=function(e,t,s){var l=this.getTrackById(e);if(l){var h={};this.fragmentedTracks.push(h),h.id=e,h.user=t,h.trak=l,l.nextSample=0,h.segmentStream=null,h.nb_samples=1e3,h.rapAlignement=!0,s&&(s.nbSamples&&(h.nb_samples=s.nbSamples),s.rapAlignement&&(h.rapAlignement=s.rapAlignement))}},S.prototype.unsetSegmentOptions=function(e){for(var t=-1,s=0;s<this.fragmentedTracks.length;s++){var l=this.fragmentedTracks[s];l.id==e&&(t=s)}t>-1&&this.fragmentedTracks.splice(t,1)},S.prototype.setExtractionOptions=function(e,t,s){var l=this.getTrackById(e);if(l){var h={};this.extractedTracks.push(h),h.id=e,h.user=t,h.trak=l,l.nextSample=0,h.nb_samples=1e3,h.samples=[],s&&s.nbSamples&&(h.nb_samples=s.nbSamples)}},S.prototype.unsetExtractionOptions=function(e){for(var t=-1,s=0;s<this.extractedTracks.length;s++){var l=this.extractedTracks[s];l.id==e&&(t=s)}t>-1&&this.extractedTracks.splice(t,1)},S.prototype.parse=function(){var e,t,s=!1;if(!(this.restoreParsePosition&&!this.restoreParsePosition()))for(;;)if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}else if(this.saveParsePosition&&this.saveParsePosition(),e=r.parseOneBox(this.stream,s),e.code===r.ERR_NOT_ENOUGH_DATA)if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}else return;else{var l;switch(t=e.box,l=t.type!=="uuid"?t.type:t.uuid,this.boxes.push(t),l){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,this.mdats.length===0&&(this.isProgressive=!0);default:this[l]!==void 0&&n.warn("ISOFile","Duplicate Box of type: "+l+", overriding previous occurrence"),this[l]=t;break}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},S.prototype.checkBuffer=function(e){if(e==null)throw"Buffer must be defined and non empty";if(e.fileStart===void 0)throw"Buffer must have a fileStart property";return e.byteLength===0?(n.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(n.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),this.stream.initialized()?!0:(n.warn("ISOFile","Not ready to start parsing"),!1))},S.prototype.appendBuffer=function(e,t){var s;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(s=this.nextSeekPosition,this.nextSeekPosition=void 0):s=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(s=this.stream.getEndFilePositionAfter(s))):this.nextParsePosition?s=this.nextParsePosition:s=0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(n.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+s),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),s},S.prototype.getInfo=function(){var e,t,s={},l,h,m,y,b=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(s.hasMoov=!0,s.duration=this.moov.mvhd.duration,s.timescale=this.moov.mvhd.timescale,s.isFragmented=this.moov.mvex!=null,s.isFragmented&&this.moov.mvex.mehd&&(s.fragment_duration=this.moov.mvex.mehd.fragment_duration),s.isProgressive=this.isProgressive,s.hasIOD=this.moov.iods!=null,s.brands=[],s.brands.push(this.ftyp.major_brand),s.brands=s.brands.concat(this.ftyp.compatible_brands),s.created=new Date(b+this.moov.mvhd.creation_time*1e3),s.modified=new Date(b+this.moov.mvhd.modification_time*1e3),s.tracks=[],s.audioTracks=[],s.videoTracks=[],s.subtitleTracks=[],s.metadataTracks=[],s.hintTracks=[],s.otherTracks=[],e=0;e<this.moov.traks.length;e++){if(l=this.moov.traks[e],y=l.mdia.minf.stbl.stsd.entries[0],h={},s.tracks.push(h),h.id=l.tkhd.track_id,h.name=l.mdia.hdlr.name,h.references=[],l.tref)for(t=0;t<l.tref.boxes.length;t++)m={},h.references.push(m),m.type=l.tref.boxes[t].type,m.track_ids=l.tref.boxes[t].track_ids;l.edts&&(h.edits=l.edts.elst.entries),h.created=new Date(b+l.tkhd.creation_time*1e3),h.modified=new Date(b+l.tkhd.modification_time*1e3),h.movie_duration=l.tkhd.duration,h.movie_timescale=s.timescale,h.layer=l.tkhd.layer,h.alternate_group=l.tkhd.alternate_group,h.volume=l.tkhd.volume,h.matrix=l.tkhd.matrix,h.track_width=l.tkhd.width/65536,h.track_height=l.tkhd.height/65536,h.timescale=l.mdia.mdhd.timescale,h.cts_shift=l.mdia.minf.stbl.cslg,h.duration=l.mdia.mdhd.duration,h.samples_duration=l.samples_duration,h.codec=y.getCodec(),h.kind=l.udta&&l.udta.kinds.length?l.udta.kinds[0]:{schemeURI:"",value:""},h.language=l.mdia.elng?l.mdia.elng.extended_language:l.mdia.mdhd.languageString,h.nb_samples=l.samples.length,h.size=l.samples_size,h.bitrate=h.size*8*h.timescale/h.samples_duration,y.isAudio()?(h.type="audio",s.audioTracks.push(h),h.audio={},h.audio.sample_rate=y.getSampleRate(),h.audio.channel_count=y.getChannelCount(),h.audio.sample_size=y.getSampleSize()):y.isVideo()?(h.type="video",s.videoTracks.push(h),h.video={},h.video.width=y.getWidth(),h.video.height=y.getHeight()):y.isSubtitle()?(h.type="subtitles",s.subtitleTracks.push(h)):y.isHint()?(h.type="metadata",s.hintTracks.push(h)):y.isMetadata()?(h.type="metadata",s.metadataTracks.push(h)):(h.type="metadata",s.otherTracks.push(h))}else s.hasMoov=!1;if(s.mime="",s.hasMoov&&s.tracks){for(s.videoTracks&&s.videoTracks.length>0?s.mime+=\'video/mp4; codecs="\':s.audioTracks&&s.audioTracks.length>0?s.mime+=\'audio/mp4; codecs="\':s.mime+=\'application/mp4; codecs="\',e=0;e<s.tracks.length;e++)e!==0&&(s.mime+=","),s.mime+=s.tracks[e].codec;s.mime+=\'"; profiles="\',s.mime+=this.ftyp.compatible_brands.join(),s.mime+=\'"\'}return s},S.prototype.setNextSeekPositionFromSample=function(e){e&&(this.nextSeekPosition?this.nextSeekPosition=Math.min(e.offset+e.alreadyRead,this.nextSeekPosition):this.nextSeekPosition=e.offset+e.alreadyRead)},S.prototype.processSamples=function(e){var t,s;if(this.sampleProcessingStarted){if(this.isFragmentationInitialized&&this.onSegment!==null)for(t=0;t<this.fragmentedTracks.length;t++){var l=this.fragmentedTracks[t];for(s=l.trak;s.nextSample<s.samples.length&&this.sampleProcessingStarted;){n.debug("ISOFile","Creating media fragment on track #"+l.id+" for sample "+s.nextSample);var h=this.createFragment(l.id,s.nextSample,l.segmentStream);if(h)l.segmentStream=h,s.nextSample++;else break;if((s.nextSample%l.nb_samples===0||e||s.nextSample>=s.samples.length)&&(n.info("ISOFile","Sending fragmented data on track #"+l.id+" for samples ["+Math.max(0,s.nextSample-l.nb_samples)+","+(s.nextSample-1)+"]"),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(l.id,l.user,l.segmentStream.buffer,s.nextSample,e||s.nextSample>=s.samples.length),l.segmentStream=null,l!==this.fragmentedTracks[t]))break}}if(this.onSamples!==null)for(t=0;t<this.extractedTracks.length;t++){var m=this.extractedTracks[t];for(s=m.trak;s.nextSample<s.samples.length&&this.sampleProcessingStarted;){n.debug("ISOFile","Exporting on track #"+m.id+" sample #"+s.nextSample);var y=this.getSample(s,s.nextSample);if(y)s.nextSample++,m.samples.push(y);else{this.setNextSeekPositionFromSample(s.samples[s.nextSample]);break}if((s.nextSample%m.nb_samples===0||s.nextSample>=s.samples.length)&&(n.debug("ISOFile","Sending samples on track #"+m.id+" for sample "+s.nextSample),this.onSamples&&this.onSamples(m.id,m.user,m.samples),m.samples=[],m!==this.extractedTracks[t]))break}}}},S.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},S.prototype.getBoxes=function(e,t){var s=[];return S._sweep.call(this,e,s,t),s},S._sweep=function(e,t,s){this.type&&this.type==e&&t.push(this);for(var l in this.boxes){if(t.length&&s)return;S._sweep.call(this.boxes[l],e,t,s)}},S.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);if(t)return t.samples},S.prototype.getTrackSample=function(e,t){var s=this.getTrackById(e),l=this.getSample(s,t);return l},S.prototype.releaseUsedSamples=function(e,t){var s=0,l=this.getTrackById(e);l.lastValidSample||(l.lastValidSample=0);for(var h=l.lastValidSample;h<t;h++)s+=this.releaseSample(l,h);n.info("ISOFile","Track #"+e+" released samples up to "+t+" (released size: "+s+", remaining: "+this.samplesDataSize+")"),l.lastValidSample=t},S.prototype.start=function(){this.sampleProcessingStarted=!0,this.processSamples(!1)},S.prototype.stop=function(){this.sampleProcessingStarted=!1},S.prototype.flush=function(){n.info("ISOFile","Flushing remaining samples"),this.updateSampleLists(),this.processSamples(!0),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0)},S.prototype.seekTrack=function(e,t,s){var l,h,m=1/0,y=0,b=0,x;if(s.samples.length===0)return n.info("ISOFile","No sample in track, cannot seek! Using time "+n.getDurationString(0,1)+" and offset: 0"),{offset:0,time:0};for(l=0;l<s.samples.length;l++){if(h=s.samples[l],l===0)b=0,x=h.timescale;else if(h.cts>e*h.timescale){b=l-1;break}t&&h.is_sync&&(y=l)}for(t&&(b=y),e=s.samples[b].cts,s.nextSample=b;s.samples[b].alreadyRead===s.samples[b].size&&s.samples[b+1];)b++;return m=s.samples[b].offset+s.samples[b].alreadyRead,n.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+s.nextSample+" on track "+s.tkhd.track_id+", time "+n.getDurationString(e,x)+" and offset: "+m),{offset:m,time:e/x}},S.prototype.getTrackDuration=function(e){var t;return e.samples?(t=e.samples[e.samples.length-1],(t.cts+t.duration)/t.timescale):1/0},S.prototype.seek=function(e,t){var s=this.moov,l,h,m,y={offset:1/0,time:1/0};if(this.moov){for(m=0;m<s.traks.length;m++)l=s.traks[m],!(e>this.getTrackDuration(l))&&(h=this.seekTrack(e,t,l),h.offset<y.offset&&(y.offset=h.offset),h.time<y.time&&(y.time=h.time));return n.info("ISOFile","Seeking at time "+n.getDurationString(y.time,1)+" needs a buffer with a fileStart position of "+y.offset),y.offset===1/0?y={offset:this.nextParsePosition,time:0}:y.offset=this.stream.getEndFilePositionAfter(y.offset),n.info("ISOFile","Adjusted seek position (after checking data already in buffer): "+y.offset),y}else throw"Cannot seek: moov not received!"},S.prototype.equal=function(e){for(var t=0;t<this.boxes.length&&t<e.boxes.length;){var s=this.boxes[t],l=e.boxes[t];if(!r.boxEqual(s,l))return!1;t++}return!0},a.ISOFile=S,S.prototype.lastBoxStartPosition=0,S.prototype.parsingMdat=null,S.prototype.nextParsePosition=0,S.prototype.discardMdatData=!1,S.prototype.processIncompleteBox=function(e){var t,s,l;return e.type==="mdat"?(t=new r[e.type+"Box"](e.size),this.parsingMdat=t,this.boxes.push(t),this.mdats.push(t),t.start=e.start,t.hdr_size=e.hdr_size,this.stream.addUsedBytes(t.hdr_size),this.lastBoxStartPosition=t.start+t.size,l=this.stream.seek(t.start+t.size,!1,this.discardMdatData),l?(this.parsingMdat=null,!0):(this.moovStartFound?this.nextParsePosition=this.stream.findEndContiguousBuf():this.nextParsePosition=t.start+t.size,!1)):(e.type==="moov"&&(this.moovStartFound=!0,this.mdats.length===0&&(this.isProgressive=!0)),s=this.stream.mergeNextBuffer?this.stream.mergeNextBuffer():!1,s?(this.nextParsePosition=this.stream.getEndPosition(),!0):(e.type?this.moovStartFound?this.nextParsePosition=this.stream.getEndPosition():this.nextParsePosition=this.stream.getPosition()+e.size:this.nextParsePosition=this.stream.getEndPosition(),!1))},S.prototype.hasIncompleteMdat=function(){return this.parsingMdat!==null},S.prototype.processIncompleteMdat=function(){var e,t;return e=this.parsingMdat,t=this.stream.seek(e.start+e.size,!1,this.discardMdatData),t?(n.debug("ISOFile","Found \'mdat\' end in buffered data"),this.parsingMdat=null,!0):(this.nextParsePosition=this.stream.findEndContiguousBuf(),!1)},S.prototype.restoreParsePosition=function(){return this.stream.seek(this.lastBoxStartPosition,!0,this.discardMdatData)},S.prototype.saveParsePosition=function(){this.lastBoxStartPosition=this.stream.getPosition()},S.prototype.updateUsedBytes=function(e,t){this.stream.addUsedBytes&&(e.type==="mdat"?(this.stream.addUsedBytes(e.hdr_size),this.discardMdatData&&this.stream.addUsedBytes(e.size-e.hdr_size)):this.stream.addUsedBytes(e.size))},S.prototype.add=r.Box.prototype.add,S.prototype.addBox=r.Box.prototype.addBox,S.prototype.init=function(e){var t=e||{};this.add("ftyp").set("major_brand",t.brands&&t.brands[0]||"iso4").set("minor_version",0).set("compatible_brands",t.brands||["iso4"]);var s=this.add("moov");return s.add("mvhd").set("timescale",t.timescale||600).set("rate",t.rate||65536).set("creation_time",0).set("modification_time",0).set("duration",t.duration||0).set("volume",t.width?0:256).set("matrix",[65536,0,0,0,65536,0,0,0,1073741824]).set("next_track_id",1),s.add("mvex"),this},S.prototype.addTrack=function(e){this.moov||this.init(e);var t=e||{};t.width=t.width||320,t.height=t.height||320,t.id=t.id||this.moov.mvhd.next_track_id,t.type=t.type||"avc1";var s=this.moov.add("trak");this.moov.mvhd.next_track_id=t.id+1,s.add("tkhd").set("flags",r.TKHD_FLAG_ENABLED|r.TKHD_FLAG_IN_MOVIE|r.TKHD_FLAG_IN_PREVIEW).set("creation_time",0).set("modification_time",0).set("track_id",t.id).set("duration",t.duration||0).set("layer",t.layer||0).set("alternate_group",0).set("volume",1).set("matrix",[0,0,0,0,0,0,0,0,0]).set("width",t.width<<16).set("height",t.height<<16);var l=s.add("mdia");l.add("mdhd").set("creation_time",0).set("modification_time",0).set("timescale",t.timescale||1).set("duration",t.media_duration||0).set("language",t.language||"und"),l.add("hdlr").set("handler",t.hdlr||"vide").set("name",t.name||"Track created with MP4Box.js"),l.add("elng").set("extended_language",t.language||"fr-FR");var h=l.add("minf");if(r[t.type+"SampleEntry"]!==void 0){var m=new r[t.type+"SampleEntry"];m.data_reference_index=1;var y="";for(var b in r.sampleEntryCodes)for(var x=r.sampleEntryCodes[b],w=0;w<x.length;w++)if(x.indexOf(t.type)>-1){y=b;break}switch(y){case"Visual":if(h.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),m.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var T=new r.avcCBox;T.parse(new o(t.avcDecoderConfigRecord)),m.addBox(T)}else if(t.hevcDecoderConfigRecord){var C=new r.hvcCBox;C.parse(new o(t.hevcDecoderConfigRecord)),m.addBox(C)}break;case"Audio":h.add("smhd").set("balance",t.balance||0),m.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":h.add("hmhd");break;case"Subtitle":switch(h.add("sthd"),t.type){case"stpp":m.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break}break;case"Metadata":h.add("nmhd");break;case"System":h.add("nmhd");break;default:h.add("nmhd");break}t.description&&m.addBox(t.description),t.description_boxes&&t.description_boxes.forEach(function(A){m.addBox(A)}),h.add("dinf").add("dref").addEntry(new r["url Box"]().set("flags",1));var F=h.add("stbl");return F.add("stsd").addEntry(m),F.add("stts").set("sample_counts",[]).set("sample_deltas",[]),F.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),F.add("stco").set("chunk_offsets",[]),F.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(s),t.id}},r.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},S.prototype.addSample=function(e,t,s){var l=s||{},h={},m=this.getTrackById(e);if(m!==null){h.number=m.samples.length,h.track_id=m.tkhd.track_id,h.timescale=m.mdia.mdhd.timescale,h.description_index=l.sample_description_index?l.sample_description_index-1:0,h.description=m.mdia.minf.stbl.stsd.entries[h.description_index],h.data=t,h.size=t.byteLength,h.alreadyRead=h.size,h.duration=l.duration||1,h.cts=l.cts||0,h.dts=l.dts||0,h.is_sync=l.is_sync||!1,h.is_leading=l.is_leading||0,h.depends_on=l.depends_on||0,h.is_depended_on=l.is_depended_on||0,h.has_redundancy=l.has_redundancy||0,h.degradation_priority=l.degradation_priority||0,h.offset=0,h.subsamples=l.subsamples,m.samples.push(h),m.samples_size+=h.size,m.samples_duration+=h.duration,m.first_dts===void 0&&(m.first_dts=l.dts),this.processSamples();var y=this.createSingleSampleMoof(h);return this.addBox(y),y.computeSize(),y.trafs[0].truns[0].data_offset=y.size+8,this.add("mdat").data=new Uint8Array(t),h}},S.prototype.createSingleSampleMoof=function(e){var t=0;e.is_sync?t=1<<25:t=65536;var s=new r.moofBox;s.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var l=s.add("traf"),h=this.getTrackById(e.track_id);return l.add("tfhd").set("track_id",e.track_id).set("flags",r.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),l.add("tfdt").set("baseMediaDecodeTime",e.dts-(h.first_dts||0)),l.add("trun").set("flags",r.TRUN_FLAGS_DATA_OFFSET|r.TRUN_FLAGS_DURATION|r.TRUN_FLAGS_SIZE|r.TRUN_FLAGS_FLAGS|r.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),s},S.prototype.lastMoofIndex=0,S.prototype.samplesDataSize=0,S.prototype.resetTables=function(){var e,t,s,l,h,m,y,b;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e<this.moov.traks.length;e++){t=this.moov.traks[e],t.tkhd.duration=0,t.mdia.mdhd.duration=0,s=t.mdia.minf.stbl.stco||t.mdia.minf.stbl.co64,s.chunk_offsets=[],l=t.mdia.minf.stbl.stsc,l.first_chunk=[],l.samples_per_chunk=[],l.sample_description_index=[],h=t.mdia.minf.stbl.stsz||t.mdia.minf.stbl.stz2,h.sample_sizes=[],m=t.mdia.minf.stbl.stts,m.sample_counts=[],m.sample_deltas=[],y=t.mdia.minf.stbl.ctts,y&&(y.sample_counts=[],y.sample_offsets=[]),b=t.mdia.minf.stbl.stss;var x=t.mdia.minf.stbl.boxes.indexOf(b);x!=-1&&(t.mdia.minf.stbl.boxes[x]=null)}},S.initSampleGroups=function(e,t,s,l,h){var m,y,b,x;function w(T,C,F){this.grouping_type=T,this.grouping_type_parameter=C,this.sbgp=F,this.last_sample_in_run=-1,this.entry_index=-1}for(t&&(t.sample_groups_info=[]),e.sample_groups_info||(e.sample_groups_info=[]),y=0;y<s.length;y++){for(x=s[y].grouping_type+"/"+s[y].grouping_type_parameter,b=new w(s[y].grouping_type,s[y].grouping_type_parameter,s[y]),t&&(t.sample_groups_info[x]=b),e.sample_groups_info[x]||(e.sample_groups_info[x]=b),m=0;m<l.length;m++)l[m].grouping_type===s[y].grouping_type&&(b.description=l[m],b.description.used=!0);if(h)for(m=0;m<h.length;m++)h[m].grouping_type===s[y].grouping_type&&(b.fragment_description=h[m],b.fragment_description.used=!0,b.is_fragment=!0)}if(t){if(h)for(y=0;y<h.length;y++)!h[y].used&&h[y].version>=2&&(x=h[y].grouping_type+"/0",b=new w(h[y].grouping_type,0),b.is_fragment=!0,t.sample_groups_info[x]||(t.sample_groups_info[x]=b))}else for(y=0;y<l.length;y++)!l[y].used&&l[y].version>=2&&(x=l[y].grouping_type+"/0",b=new w(l[y].grouping_type,0),e.sample_groups_info[x]||(e.sample_groups_info[x]=b))},S.setSampleGroupProperties=function(e,t,s,l){var h,m;t.sample_groups=[];for(h in l)if(t.sample_groups[h]={},t.sample_groups[h].grouping_type=l[h].grouping_type,t.sample_groups[h].grouping_type_parameter=l[h].grouping_type_parameter,s>=l[h].last_sample_in_run&&(l[h].last_sample_in_run<0&&(l[h].last_sample_in_run=0),l[h].entry_index++,l[h].entry_index<=l[h].sbgp.entries.length-1&&(l[h].last_sample_in_run+=l[h].sbgp.entries[l[h].entry_index].sample_count)),l[h].entry_index<=l[h].sbgp.entries.length-1?t.sample_groups[h].group_description_index=l[h].sbgp.entries[l[h].entry_index].group_description_index:t.sample_groups[h].group_description_index=-1,t.sample_groups[h].group_description_index!==0){var y;l[h].fragment_description?y=l[h].fragment_description:y=l[h].description,t.sample_groups[h].group_description_index>0?(t.sample_groups[h].group_description_index>65535?m=(t.sample_groups[h].group_description_index>>16)-1:m=t.sample_groups[h].group_description_index-1,y&&m>=0&&(t.sample_groups[h].description=y.entries[m])):y&&y.version>=2&&y.default_group_description_index>0&&(t.sample_groups[h].description=y.entries[y.default_group_description_index-1])}},S.process_sdtp=function(e,t,s){t&&(e?(t.is_leading=e.is_leading[s],t.depends_on=e.sample_depends_on[s],t.is_depended_on=e.sample_is_depended_on[s],t.has_redundancy=e.sample_has_redundancy[s]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},S.prototype.buildSampleLists=function(){var e,t;for(e=0;e<this.moov.traks.length;e++)t=this.moov.traks[e],this.buildTrakSampleLists(t)},S.prototype.buildTrakSampleLists=function(e){var t,s,l,h,m,y,b,x,w,T,C,F,A,R,P,K,Z,$,G,q,ee,Ee,j,W;if(e.samples=[],e.samples_duration=0,e.samples_size=0,s=e.mdia.minf.stbl.stco||e.mdia.minf.stbl.co64,l=e.mdia.minf.stbl.stsc,h=e.mdia.minf.stbl.stsz||e.mdia.minf.stbl.stz2,m=e.mdia.minf.stbl.stts,y=e.mdia.minf.stbl.ctts,b=e.mdia.minf.stbl.stss,x=e.mdia.minf.stbl.stsd,w=e.mdia.minf.stbl.subs,F=e.mdia.minf.stbl.stdp,T=e.mdia.minf.stbl.sbgps,C=e.mdia.minf.stbl.sgpds,$=-1,G=-1,q=-1,ee=-1,Ee=0,j=0,W=0,S.initSampleGroups(e,null,T,C),!(typeof h>"u")){for(t=0;t<h.sample_sizes.length;t++){var L={};L.number=t,L.track_id=e.tkhd.track_id,L.timescale=e.mdia.mdhd.timescale,L.alreadyRead=0,e.samples[t]=L,L.size=h.sample_sizes[t],e.samples_size+=L.size,t===0?(R=1,A=0,L.chunk_index=R,L.chunk_run_index=A,Z=l.samples_per_chunk[A],K=0,A+1<l.first_chunk.length?P=l.first_chunk[A+1]-1:P=1/0):t<Z?(L.chunk_index=R,L.chunk_run_index=A):(R++,L.chunk_index=R,K=0,R<=P||(A++,A+1<l.first_chunk.length?P=l.first_chunk[A+1]-1:P=1/0),L.chunk_run_index=A,Z+=l.samples_per_chunk[A]),L.description_index=l.sample_description_index[L.chunk_run_index]-1,L.description=x.entries[L.description_index],L.offset=s.chunk_offsets[L.chunk_index-1]+K,K+=L.size,t>$&&(G++,$<0&&($=0),$+=m.sample_counts[G]),t>0?(e.samples[t-1].duration=m.sample_deltas[G],e.samples_duration+=e.samples[t-1].duration,L.dts=e.samples[t-1].dts+e.samples[t-1].duration):L.dts=0,y?(t>=q&&(ee++,q<0&&(q=0),q+=y.sample_counts[ee]),L.cts=e.samples[t].dts+y.sample_offsets[ee]):L.cts=L.dts,b?(t==b.sample_numbers[Ee]-1?(L.is_sync=!0,Ee++):(L.is_sync=!1,L.degradation_priority=0),w&&w.entries[j].sample_delta+W==t+1&&(L.subsamples=w.entries[j].subsamples,W+=w.entries[j].sample_delta,j++)):L.is_sync=!0,S.process_sdtp(e.mdia.minf.stbl.sdtp,L,L.number),F?L.degradation_priority=F.priority[t]:L.degradation_priority=0,w&&w.entries[j].sample_delta+W==t&&(L.subsamples=w.entries[j].subsamples,W+=w.entries[j].sample_delta),(T.length>0||C.length>0)&&S.setSampleGroupProperties(e,L,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},S.prototype.updateSampleLists=function(){var e,t,s,l,h,m,y,b,x,w,T,C,F,A,R;if(this.moov!==void 0){for(;this.lastMoofIndex<this.moofs.length;)if(x=this.moofs[this.lastMoofIndex],this.lastMoofIndex++,x.type=="moof")for(w=x,e=0;e<w.trafs.length;e++){for(T=w.trafs[e],C=this.getTrackById(T.tfhd.track_id),F=this.getTrexById(T.tfhd.track_id),T.tfhd.flags&r.TFHD_FLAG_SAMPLE_DESC?l=T.tfhd.default_sample_description_index:l=F?F.default_sample_description_index:1,T.tfhd.flags&r.TFHD_FLAG_SAMPLE_DUR?h=T.tfhd.default_sample_duration:h=F?F.default_sample_duration:0,T.tfhd.flags&r.TFHD_FLAG_SAMPLE_SIZE?m=T.tfhd.default_sample_size:m=F?F.default_sample_size:0,T.tfhd.flags&r.TFHD_FLAG_SAMPLE_FLAGS?y=T.tfhd.default_sample_flags:y=F?F.default_sample_flags:0,T.sample_number=0,T.sbgps.length>0&&S.initSampleGroups(C,T,T.sbgps,C.mdia.minf.stbl.sgpds,T.sgpds),t=0;t<T.truns.length;t++){var P=T.truns[t];for(s=0;s<P.sample_count;s++){A={},A.moof_number=this.lastMoofIndex,A.number_in_traf=T.sample_number,T.sample_number++,A.number=C.samples.length,T.first_sample_index=C.samples.length,C.samples.push(A),A.track_id=C.tkhd.track_id,A.timescale=C.mdia.mdhd.timescale,A.description_index=l-1,A.description=C.mdia.minf.stbl.stsd.entries[A.description_index],A.size=m,P.flags&r.TRUN_FLAGS_SIZE&&(A.size=P.sample_size[s]),C.samples_size+=A.size,A.duration=h,P.flags&r.TRUN_FLAGS_DURATION&&(A.duration=P.sample_duration[s]),C.samples_duration+=A.duration,C.first_traf_merged||s>0?A.dts=C.samples[C.samples.length-2].dts+C.samples[C.samples.length-2].duration:(T.tfdt?A.dts=T.tfdt.baseMediaDecodeTime:A.dts=0,C.first_traf_merged=!0),A.cts=A.dts,P.flags&r.TRUN_FLAGS_CTS_OFFSET&&(A.cts=A.dts+P.sample_composition_time_offset[s]),R=y,P.flags&r.TRUN_FLAGS_FLAGS?R=P.sample_flags[s]:s===0&&P.flags&r.TRUN_FLAGS_FIRST_FLAG&&(R=P.first_sample_flags),A.is_sync=!(R>>16&1),A.is_leading=R>>26&3,A.depends_on=R>>24&3,A.is_depended_on=R>>22&3,A.has_redundancy=R>>20&3,A.degradation_priority=R&65535;var K=!!(T.tfhd.flags&r.TFHD_FLAG_BASE_DATA_OFFSET),Z=!!(T.tfhd.flags&r.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),$=!!(P.flags&r.TRUN_FLAGS_DATA_OFFSET),G=0;K?G=T.tfhd.base_data_offset:Z||t===0?G=w.start:G=b,t===0&&s===0?$?A.offset=G+P.data_offset:A.offset=G:A.offset=b,b=A.offset+A.size,(T.sbgps.length>0||T.sgpds.length>0||C.mdia.minf.stbl.sbgps.length>0||C.mdia.minf.stbl.sgpds.length>0)&&S.setSampleGroupProperties(C,A,A.number_in_traf,T.sample_groups_info)}}if(T.subs){C.has_fragment_subsamples=!0;var q=T.first_sample_index;for(t=0;t<T.subs.entries.length;t++)q+=T.subs.entries[t].sample_delta,A=C.samples[q-1],A.subsamples=T.subs.entries[t].subsamples}}}},S.prototype.getSample=function(e,t){var s,l=e.samples[t];if(!this.moov)return null;if(!l.data)l.data=new Uint8Array(l.size),l.alreadyRead=0,this.samplesDataSize+=l.size,n.debug("ISOFile","Allocating sample #"+t+" on track #"+e.tkhd.track_id+" of size "+l.size+" (total: "+this.samplesDataSize+")");else if(l.alreadyRead==l.size)return l;for(;;){var h=this.stream.findPosition(!0,l.offset+l.alreadyRead,!1);if(h>-1){s=this.stream.buffers[h];var m=s.byteLength-(l.offset+l.alreadyRead-s.fileStart);if(l.size-l.alreadyRead<=m)return n.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+l.alreadyRead+" offset: "+(l.offset+l.alreadyRead-s.fileStart)+" read size: "+(l.size-l.alreadyRead)+" full size: "+l.size+")"),d.memcpy(l.data.buffer,l.alreadyRead,s,l.offset+l.alreadyRead-s.fileStart,l.size-l.alreadyRead),s.usedBytes+=l.size-l.alreadyRead,this.stream.logBufferLevel(),l.alreadyRead=l.size,l;if(m===0)return null;n.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+l.alreadyRead+" offset: "+(l.offset+l.alreadyRead-s.fileStart)+" read size: "+m+" full size: "+l.size+")"),d.memcpy(l.data.buffer,l.alreadyRead,s,l.offset+l.alreadyRead-s.fileStart,m),l.alreadyRead+=m,s.usedBytes+=m,this.stream.logBufferLevel()}else return null}},S.prototype.releaseSample=function(e,t){var s=e.samples[t];return s.data?(this.samplesDataSize-=s.size,s.data=null,s.alreadyRead=0,s.size):0},S.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},S.prototype.getCodecs=function(){var e,t="";for(e=0;e<this.moov.traks.length;e++){var s=this.moov.traks[e];e>0&&(t+=","),t+=s.mdia.minf.stbl.stsd.entries[0].getCodec()}return t},S.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t<this.moov.mvex.trexs.length;t++){var s=this.moov.mvex.trexs[t];if(s.track_id==e)return s}return null},S.prototype.getTrackById=function(e){if(this.moov===void 0)return null;for(var t=0;t<this.moov.traks.length;t++){var s=this.moov.traks[t];if(s.tkhd.track_id==e)return s}return null},S.prototype.itemsDataSize=0,S.prototype.flattenItemInfo=function(){var e=this.items,t=this.entity_groups,s,l,h,m=this.meta;if(m!=null&&m.hdlr!==void 0&&m.iinf!==void 0){for(s=0;s<m.iinf.item_infos.length;s++)h={},h.id=m.iinf.item_infos[s].item_ID,e[h.id]=h,h.ref_to=[],h.name=m.iinf.item_infos[s].item_name,m.iinf.item_infos[s].protection_index>0&&(h.protection=m.ipro.protections[m.iinf.item_infos[s].protection_index-1]),m.iinf.item_infos[s].item_type?h.type=m.iinf.item_infos[s].item_type:h.type="mime",h.content_type=m.iinf.item_infos[s].content_type,h.content_encoding=m.iinf.item_infos[s].content_encoding;if(m.grpl)for(s=0;s<m.grpl.boxes.length;s++)entity_group={},entity_group.id=m.grpl.boxes[s].group_id,entity_group.entity_ids=m.grpl.boxes[s].entity_ids,entity_group.type=m.grpl.boxes[s].type,t[entity_group.id]=entity_group;if(m.iloc)for(s=0;s<m.iloc.items.length;s++){var y=m.iloc.items[s];switch(h=e[y.item_ID],y.data_reference_index!==0&&(n.warn("Item storage with reference to other files: not supported"),h.source=m.dinf.boxes[y.data_reference_index-1]),y.construction_method){case 0:break;case 1:break;case 2:n.warn("Item storage with construction_method : not supported");break}for(h.extents=[],h.size=0,l=0;l<y.extents.length;l++)h.extents[l]={},h.extents[l].offset=y.extents[l].extent_offset+y.base_offset,y.construction_method==1&&(h.extents[l].offset+=m.idat.start+m.idat.hdr_size),h.extents[l].length=y.extents[l].extent_length,h.extents[l].alreadyRead=0,h.size+=h.extents[l].length}if(m.pitm&&(e[m.pitm.item_id].primary=!0),m.iref)for(s=0;s<m.iref.references.length;s++){var b=m.iref.references[s];for(l=0;l<b.references.length;l++)e[b.from_item_ID].ref_to.push({type:b.type,id:b.references[l]})}if(m.iprp)for(var x=0;x<m.iprp.ipmas.length;x++){var w=m.iprp.ipmas[x];for(s=0;s<w.associations.length;s++){var T=w.associations[s];if(h=e[T.id],h||(h=t[T.id]),h)for(h.properties===void 0&&(h.properties={},h.properties.boxes=[]),l=0;l<T.props.length;l++){var C=T.props[l];if(C.property_index>0&&C.property_index-1<m.iprp.ipco.boxes.length){var F=m.iprp.ipco.boxes[C.property_index-1];h.properties[F.type]=F,h.properties.boxes.push(F)}}}}}},S.prototype.getItem=function(e){var t,s;if(!this.meta)return null;if(s=this.items[e],!s.data&&s.size)s.data=new Uint8Array(s.size),s.alreadyRead=0,this.itemsDataSize+=s.size,n.debug("ISOFile","Allocating item #"+e+" of size "+s.size+" (total: "+this.itemsDataSize+")");else if(s.alreadyRead===s.size)return s;for(var l=0;l<s.extents.length;l++){var h=s.extents[l];if(h.alreadyRead!==h.length){var m=this.stream.findPosition(!0,h.offset+h.alreadyRead,!1);if(m>-1){t=this.stream.buffers[m];var y=t.byteLength-(h.offset+h.alreadyRead-t.fileStart);if(h.length-h.alreadyRead<=y)n.debug("ISOFile","Getting item #"+e+" extent #"+l+" data (alreadyRead: "+h.alreadyRead+" offset: "+(h.offset+h.alreadyRead-t.fileStart)+" read size: "+(h.length-h.alreadyRead)+" full extent size: "+h.length+" full item size: "+s.size+")"),d.memcpy(s.data.buffer,s.alreadyRead,t,h.offset+h.alreadyRead-t.fileStart,h.length-h.alreadyRead),t.usedBytes+=h.length-h.alreadyRead,this.stream.logBufferLevel(),s.alreadyRead+=h.length-h.alreadyRead,h.alreadyRead=h.length;else return n.debug("ISOFile","Getting item #"+e+" extent #"+l+" partial data (alreadyRead: "+h.alreadyRead+" offset: "+(h.offset+h.alreadyRead-t.fileStart)+" read size: "+y+" full extent size: "+h.length+" full item size: "+s.size+")"),d.memcpy(s.data.buffer,s.alreadyRead,t,h.offset+h.alreadyRead-t.fileStart,y),h.alreadyRead+=y,s.alreadyRead+=y,t.usedBytes+=y,this.stream.logBufferLevel(),null}else return null}}return s.alreadyRead===s.size?s:null},S.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var s=0;s<t.extents.length;s++){var l=t.extents[s];l.alreadyRead=0}return t.size}else return 0},S.prototype.processItems=function(e){for(var t in this.items){var s=this.items[t];this.getItem(s.id),e&&!s.sent&&(e(s),s.sent=!0,s.data=null)}},S.prototype.hasItem=function(e){for(var t in this.items){var s=this.items[t];if(s.name===e)return s.id}return-1},S.prototype.getMetaHandler=function(){return this.meta?this.meta.hdlr.handler:null},S.prototype.getPrimaryItem=function(){return!this.meta||!this.meta.pitm?null:this.getItem(this.meta.pitm.item_id)},S.prototype.itemToFragmentedTrackFile=function(e){var t=e||{},s=null;if(t.itemId?s=this.getItem(t.itemId):s=this.getPrimaryItem(),s==null)return null;var l=new S;l.discardMdatData=!1;var h={type:s.type,description_boxes:s.properties.boxes};s.properties.ispe&&(h.width=s.properties.ispe.image_width,h.height=s.properties.ispe.image_height);var m=l.addTrack(h);return m?(l.addSample(m,s.data),l):null},S.prototype.write=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e)},S.prototype.createFragment=function(e,t,s){var l=this.getTrackById(e),h=this.getSample(l,t);if(h==null)return this.setNextSeekPositionFromSample(l.samples[t]),null;var m=s||new d;m.endianness=d.BIG_ENDIAN;var y=this.createSingleSampleMoof(h);y.write(m),y.trafs[0].truns[0].data_offset=y.size+8,n.debug("MP4Box","Adjusting data_offset with new value "+y.trafs[0].truns[0].data_offset),m.adjustUint32(y.trafs[0].truns[0].data_offset_position,y.trafs[0].truns[0].data_offset);var b=new r.mdatBox;return b.data=h.data,b.write(m),m},S.writeInitializationSegment=function(e,t,s,l){var h;n.debug("ISOFile","Generating initialization segment");var m=new d;m.endianness=d.BIG_ENDIAN,e.write(m);var y=t.add("mvex");for(s&&y.add("mehd").set("fragment_duration",s),h=0;h<t.traks.length;h++)y.add("trex").set("track_id",t.traks[h].tkhd.track_id).set("default_sample_description_index",1).set("default_sample_duration",l).set("default_sample_size",0).set("default_sample_flags",65536);return t.write(m),m.buffer},S.prototype.save=function(e){var t=new d;t.endianness=d.BIG_ENDIAN,this.write(t),t.save(e)},S.prototype.getBuffer=function(){var e=new d;return e.endianness=d.BIG_ENDIAN,this.write(e),e.buffer},S.prototype.initializeSegmentation=function(){var e,t,s,l;for(this.onSegment===null&&n.warn("MP4Box","No segmentation callback set!"),this.isFragmentationInitialized||(this.isFragmentationInitialized=!0,this.nextMoofNumber=0,this.resetTables()),t=[],e=0;e<this.fragmentedTracks.length;e++){var h=new r.moovBox;h.mvhd=this.moov.mvhd,h.boxes.push(h.mvhd),s=this.getTrackById(this.fragmentedTracks[e].id),h.boxes.push(s),h.traks.push(s),l={},l.id=s.tkhd.track_id,l.user=this.fragmentedTracks[e].user,l.buffer=S.writeInitializationSegment(this.ftyp,h,this.moov.mvex&&this.moov.mvex.mehd?this.moov.mvex.mehd.fragment_duration:void 0,this.moov.traks[e].samples.length>0?this.moov.traks[e].samples[0].duration:0),t.push(l)}return t},r.Box.prototype.printHeader=function(e){this.size+=8,this.size>c&&(this.size+=8),this.type==="uuid"&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},r.FullBox.prototype.printHeader=function(e){this.size+=4,r.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},r.Box.prototype.print=function(e){this.printHeader(e)},r.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t<this.boxes.length;t++)if(this.boxes[t]){var s=e.indent;e.indent+=" ",this.boxes[t].print(e),e.indent=s}},S.prototype.print=function(e){e.indent="";for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&this.boxes[t].print(e)},r.mvhdBox.prototype.print=function(e){r.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"timescale: "+this.timescale),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"rate: "+this.rate),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},r.tkhdBox.prototype.print=function(e){r.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var U={};U.createFile=function(e,t){var s=e!==void 0?e:!0,l=new S(t);return l.discardMdatData=!s,l},a.createFile=U.createFile}(mt)),mt}var yt=fn(),hn=Zt(yt),vt={exports:{}},ei;function un(){return ei||(ei=1,function(a){var n={};a.exports=n,n.parse=function(o,d){for(var c=n.bin.readUshort,f=n.bin.readUint,_=0,u={},r=new Uint8Array(o),p=r.length-4;f(r,p)!=101010256;)p--;var _=p;_+=4,_+=4;var g=c(r,_);_+=2,c(r,_),_+=2;var v=f(r,_);_+=4;var E=f(r,_);_+=4,_=E;for(var S=0;S<g;S++){f(r,_),_+=4,_+=4,_+=4,_+=4,f(r,_),_+=4;var v=f(r,_);_+=4;var U=f(r,_);_+=4;var e=c(r,_),t=c(r,_+2),s=c(r,_+4);_+=6,_+=8;var l=f(r,_);_+=4,_+=e+t+s,n._readLocal(r,l,u,v,U,d)}return u},n._readLocal=function(o,d,c,f,u,r){var p=n.bin.readUshort,_=n.bin.readUint;_(o,d),d+=4,p(o,d),d+=2,p(o,d),d+=2;var g=p(o,d);d+=2,_(o,d),d+=4,_(o,d),d+=4,d+=8;var v=p(o,d);d+=2;var E=p(o,d);d+=2;var S=n.bin.readUTF8(o,d,v);if(d+=v,d+=E,r){c[S]={size:u,csize:f};return}var U=new Uint8Array(o.buffer,d);if(g==0)c[S]=new Uint8Array(U.buffer.slice(d,d+f));else if(g==8){var e=new Uint8Array(u);n.inflateRaw(U,e),c[S]=e}else throw"unknown compression method: "+g},n.inflateRaw=function(o,d){return n.F.inflate(o,d)},n.inflate=function(o,d){return o[0],o[1],n.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),d)},n.deflate=function(o,d){d==null&&(d={level:6});var c=0,f=new Uint8Array(50+Math.floor(o.length*1.1));f[c]=120,f[c+1]=156,c+=2,c=n.F.deflateRaw(o,f,c,d.level);var u=n.adler(o,0,o.length);return f[c+0]=u>>>24&255,f[c+1]=u>>>16&255,f[c+2]=u>>>8&255,f[c+3]=u>>>0&255,new Uint8Array(f.buffer,0,c+4)},n.deflateRaw=function(o,d){d==null&&(d={level:6});var c=new Uint8Array(50+Math.floor(o.length*1.1)),f=n.F.deflateRaw(o,c,f,d.level);return new Uint8Array(c.buffer,0,f)},n.encode=function(o,d){d==null&&(d=!1);var c=0,f=n.bin.writeUint,u=n.bin.writeUshort,r={};for(var p in o){var _=!n._noNeed(p)&&!d,g=o[p],v=n.crc.crc(g,0,g.length);r[p]={cpr:_,usize:g.length,crc:v,file:_?n.deflateRaw(g):g}}for(var p in r)c+=r[p].file.length+30+46+2*n.bin.sizeUTF8(p);c+=22;var E=new Uint8Array(c),S=0,U=[];for(var p in r){var e=r[p];U.push(S),S=n._writeHeader(E,S,p,e,0)}var t=0,s=S;for(var p in r){var e=r[p];U.push(S),S=n._writeHeader(E,S,p,e,1,U[t++])}var l=S-s;return f(E,S,101010256),S+=4,S+=4,u(E,S,t),S+=2,u(E,S,t),S+=2,f(E,S,l),S+=4,f(E,S,s),S+=4,S+=2,E.buffer},n._noNeed=function(o){var d=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(d)!=-1},n._writeHeader=function(o,d,c,f,u,r){var p=n.bin.writeUint,_=n.bin.writeUshort,g=f.file;p(o,d,u==0?67324752:33639248),d+=4,u==1&&(d+=2),_(o,d,20),d+=2,_(o,d,0),d+=2,_(o,d,f.cpr?8:0),d+=2,p(o,d,0),d+=4,p(o,d,f.crc),d+=4,p(o,d,g.length),d+=4,p(o,d,f.usize),d+=4,_(o,d,n.bin.sizeUTF8(c)),d+=2,_(o,d,0),d+=2,u==1&&(d+=2,d+=2,d+=6,p(o,d,r),d+=4);var v=n.bin.writeUTF8(o,d,c);return d+=v,u==0&&(o.set(g,d),d+=g.length),d},n.crc={table:function(){for(var o=new Uint32Array(256),d=0;d<256;d++){for(var c=d,f=0;f<8;f++)c&1?c=3988292384^c>>>1:c=c>>>1;o[d]=c}return o}(),update:function(o,d,c,f){for(var u=0;u<f;u++)o=n.crc.table[(o^d[c+u])&255]^o>>>8;return o},crc:function(o,d,c){return n.crc.update(4294967295,o,d,c)^4294967295}},n.adler=function(o,d,c){for(var f=1,u=0,r=d,p=d+c;r<p;){for(var _=Math.min(r+5552,p);r<_;)f+=o[r++],u+=f;f=f%65521,u=u%65521}return u<<16|f},n.bin={readUshort:function(o,d){return o[d]|o[d+1]<<8},writeUshort:function(o,d,c){o[d]=c&255,o[d+1]=c>>8&255},readUint:function(o,d){return o[d+3]*(256*256*256)+(o[d+2]<<16|o[d+1]<<8|o[d])},writeUint:function(o,d,c){o[d]=c&255,o[d+1]=c>>8&255,o[d+2]=c>>16&255,o[d+3]=c>>24&255},readASCII:function(o,d,c){for(var f="",u=0;u<c;u++)f+=String.fromCharCode(o[d+u]);return f},writeASCII:function(o,d,c){for(var f=0;f<c.length;f++)o[d+f]=c.charCodeAt(f)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,d,c){for(var f="",u,r=0;r<c;r++)f+="%"+n.bin.pad(o[d+r].toString(16));try{u=decodeURIComponent(f)}catch{return n.bin.readASCII(o,d,c)}return u},writeUTF8:function(o,d,c){for(var f=c.length,u=0,r=0;r<f;r++){var p=c.charCodeAt(r);if(!(p&4294967168))o[d+u]=p,u++;else if(!(p&4294965248))o[d+u]=192|p>>6,o[d+u+1]=128|p>>0&63,u+=2;else if(!(p&4294901760))o[d+u]=224|p>>12,o[d+u+1]=128|p>>6&63,o[d+u+2]=128|p>>0&63,u+=3;else if(!(p&4294967295-(1<<21)+1))o[d+u]=240|p>>18,o[d+u+1]=128|p>>12&63,o[d+u+2]=128|p>>6&63,o[d+u+3]=128|p>>0&63,u+=4;else throw"e"}return u},sizeUTF8:function(o){for(var d=o.length,c=0,f=0;f<d;f++){var u=o.charCodeAt(f);if(!(u&4294967168))c++;else if(!(u&4294965248))c+=2;else if(!(u&4294901760))c+=3;else if(!(u&4294967295-(1<<21)+1))c+=4;else throw"e"}return c}},n.F={},n.F.deflateRaw=function(o,d,c,f){var u=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]],r=u[f],p=n.F.U,_=n.F._goodIndex;n.F._hash;var g=n.F._putsE,v=0,E=c<<3,S=0,U=o.length;if(f==0){for(;v<U;){var e=Math.min(65535,U-v);g(d,E,v+e==U?1:0),E=n.F._copyExact(o,v,e,d,E+8),v+=e}return E>>>3}var t=p.lits,s=p.strt,l=p.prev,h=0,m=0,y=0,b=0,x=0,w=0;for(U>2&&(w=n.F._hash(o,0),s[w]=0),v=0;v<U;v++){if(x=w,v+1<U-2){w=n.F._hash(o,v+1);var T=v+1&32767;l[T]=s[w],s[w]=T}if(S<=v){(h>14e3||m>26697)&&U-v>100&&(S<v&&(t[h]=v-S,h+=2,S=v),E=n.F._writeBlock(v==U-1||S==U?1:0,t,h,b,o,y,v-y,d,E),h=m=b=0,y=v);var C=0;v<U-2&&(C=n.F._bestMatch(o,v,l,x,Math.min(r[2],U-v),r[3]));var e=C>>>16,F=C&65535;if(C!=0){var e=C>>>16,F=C&65535,A=_(e,p.of0);p.lhst[257+A]++;var R=_(F,p.df0);p.dhst[R]++,b+=p.exb[A]+p.dxb[R],t[h]=e<<23|v-S,t[h+1]=F<<16|A<<8|R,h+=2,S=v+e}else p.lhst[o[v]]++;m++}}for((y!=v||o.length==0)&&(S<v&&(t[h]=v-S,h+=2,S=v),E=n.F._writeBlock(1,t,h,b,o,y,v-y,d,E),h=0,m=0,h=m=b=0,y=v);E&7;)E++;return E>>>3},n.F._bestMatch=function(o,d,c,f,u,r){var p=d&32767,_=c[p],g=p-_+32768&32767;if(_==p||f!=n.F._hash(o,d-g))return 0;for(var v=0,E=0,S=Math.min(32767,d);g<=S&&--r!=0&&_!=p;){if(v==0||o[d+v]==o[d+v-g]){var U=n.F._howLong(o,d,g);if(U>v){if(v=U,E=g,v>=u)break;g+2<U&&(U=g+2);for(var e=0,t=0;t<U-2;t++){var s=d-g+t+32768&32767,l=c[s],h=s-l+32768&32767;h>e&&(e=h,_=s)}}}p=_,_=c[p],g+=p-_+32768&32767}return v<<16|E},n.F._howLong=function(o,d,c){if(o[d]!=o[d-c]||o[d+1]!=o[d+1-c]||o[d+2]!=o[d+2-c])return 0;var f=d,u=Math.min(o.length,d+258);for(d+=3;d<u&&o[d]==o[d-c];)d++;return d-f},n.F._hash=function(o,d){return(o[d]<<8|o[d+1])+(o[d+2]<<4)&65535},n.saved=0,n.F._writeBlock=function(o,d,c,f,u,r,p,_,g){var v=n.F.U,E=n.F._putsF,S=n.F._putsE,U,e,t,s,l,h,m,y,b;v.lhst[256]++,U=n.F.getTrees(),e=U[0],t=U[1],s=U[2],l=U[3],h=U[4],m=U[5],y=U[6],b=U[7];var x=(g+3&7?8-(g+3&7):0)+32+(p<<3),w=f+n.F.contSize(v.fltree,v.lhst)+n.F.contSize(v.fdtree,v.dhst),T=f+n.F.contSize(v.ltree,v.lhst)+n.F.contSize(v.dtree,v.dhst);T+=14+3*m+n.F.contSize(v.itree,v.ihst)+(v.ihst[16]*2+v.ihst[17]*3+v.ihst[18]*7);for(var C=0;C<286;C++)v.lhst[C]=0;for(var C=0;C<30;C++)v.dhst[C]=0;for(var C=0;C<19;C++)v.ihst[C]=0;var F=x<w&&x<T?0:w<T?1:2;if(E(_,g,o),E(_,g+1,F),g+=3,F==0){for(;g&7;)g++;g=n.F._copyExact(u,r,p,_,g)}else{var A,R;if(F==1&&(A=v.fltree,R=v.fdtree),F==2){n.F.makeCodes(v.ltree,e),n.F.revCodes(v.ltree,e),n.F.makeCodes(v.dtree,t),n.F.revCodes(v.dtree,t),n.F.makeCodes(v.itree,s),n.F.revCodes(v.itree,s),A=v.ltree,R=v.dtree,S(_,g,l-257),g+=5,S(_,g,h-1),g+=5,S(_,g,m-4),g+=4;for(var P=0;P<m;P++)S(_,g+P*3,v.itree[(v.ordr[P]<<1)+1]);g+=3*m,g=n.F._codeTiny(y,v.itree,_,g),g=n.F._codeTiny(b,v.itree,_,g)}for(var K=r,Z=0;Z<c;Z+=2){for(var $=d[Z],G=$>>>23,q=K+($&(1<<23)-1);K<q;)g=n.F._writeLit(u[K++],A,_,g);if(G!=0){var ee=d[Z+1],Ee=ee>>16,j=ee>>8&255,W=ee&255;g=n.F._writeLit(257+j,A,_,g),S(_,g,G-v.of0[j]),g+=v.exb[j],g=n.F._writeLit(W,R,_,g),E(_,g,Ee-v.df0[W]),g+=v.dxb[W],K+=G}}g=n.F._writeLit(256,A,_,g)}return g},n.F._copyExact=function(o,d,c,f,u){var r=u>>>3;return f[r]=c,f[r+1]=c>>>8,f[r+2]=255-f[r],f[r+3]=255-f[r+1],r+=4,f.set(new Uint8Array(o.buffer,d,c),r),u+(c+4<<3)},n.F.getTrees=function(){for(var o=n.F.U,d=n.F._hufTree(o.lhst,o.ltree,15),c=n.F._hufTree(o.dhst,o.dtree,15),f=[],u=n.F._lenCodes(o.ltree,f),r=[],p=n.F._lenCodes(o.dtree,r),_=0;_<f.length;_+=2)o.ihst[f[_]]++;for(var _=0;_<r.length;_+=2)o.ihst[r[_]]++;for(var g=n.F._hufTree(o.ihst,o.itree,7),v=19;v>4&&o.itree[(o.ordr[v-1]<<1)+1]==0;)v--;return[d,c,g,u,p,v,f,r]},n.F.getSecond=function(o){for(var d=[],c=0;c<o.length;c+=2)d.push(o[c+1]);return d},n.F.nonZero=function(o){for(var d="",c=0;c<o.length;c+=2)o[c+1]!=0&&(d+=(c>>1)+",");return d},n.F.contSize=function(o,d){for(var c=0,f=0;f<d.length;f++)c+=d[f]*o[(f<<1)+1];return c},n.F._codeTiny=function(o,d,c,f){for(var u=0;u<o.length;u+=2){var r=o[u],p=o[u+1];f=n.F._writeLit(r,d,c,f);var _=r==16?2:r==17?3:7;r>15&&(n.F._putsE(c,f,p,_),f+=_)}return f},n.F._lenCodes=function(o,d){for(var c=o.length;c!=2&&o[c-1]==0;)c-=2;for(var f=0;f<c;f+=2){var u=o[f+1],r=f+3<c?o[f+3]:-1,p=f+5<c?o[f+5]:-1,_=f==0?-1:o[f-1];if(u==0&&r==u&&p==u){for(var g=f+5;g+2<c&&o[g+2]==u;)g+=2;var v=Math.min(g+1-f>>>1,138);v<11?d.push(17,v-3):d.push(18,v-11),f+=v*2-2}else if(u==_&&r==u&&p==u){for(var g=f+5;g+2<c&&o[g+2]==u;)g+=2;var v=Math.min(g+1-f>>>1,6);d.push(16,v-3),f+=v*2-2}else d.push(u,0)}return c>>>1},n.F._hufTree=function(o,d,c){var f=[],u=o.length,r=d.length,p=0;for(p=0;p<r;p+=2)d[p]=0,d[p+1]=0;for(p=0;p<u;p++)o[p]!=0&&f.push({lit:p,f:o[p]});var _=f.length,g=f.slice(0);if(_==0)return 0;if(_==1){var v=f[0].lit,g=v==0?1:0;return d[(v<<1)+1]=1,d[(g<<1)+1]=1,1}f.sort(function(l,h){return l.f-h.f});var E=f[0],S=f[1],U=0,e=1,t=2;for(f[0]={lit:-1,f:E.f+S.f,l:E,r:S,d:0};e!=_-1;)U!=e&&(t==_||f[U].f<f[t].f)?E=f[U++]:E=f[t++],U!=e&&(t==_||f[U].f<f[t].f)?S=f[U++]:S=f[t++],f[e++]={lit:-1,f:E.f+S.f,l:E,r:S};var s=n.F.setDepth(f[e-1],0);for(s>c&&(n.F.restrictDepth(g,c,s),s=c),p=0;p<_;p++)d[(g[p].lit<<1)+1]=g[p].d;return s},n.F.setDepth=function(o,d){return o.lit!=-1?(o.d=d,d):Math.max(n.F.setDepth(o.l,d+1),n.F.setDepth(o.r,d+1))},n.F.restrictDepth=function(o,d,c){var f=0,u=1<<c-d,r=0;for(o.sort(function(_,g){return g.d==_.d?_.f-g.f:g.d-_.d}),f=0;f<o.length&&o[f].d>d;f++){var p=o[f].d;o[f].d=d,r+=u-(1<<c-p)}for(r=r>>>c-d;r>0;){var p=o[f].d;p<d?(o[f].d++,r-=1<<d-p-1):f++}for(;f>=0;f--)o[f].d==d&&r<0&&(o[f].d--,r++);r!=0&&console.log("debt left")},n.F._goodIndex=function(o,d){var c=0;return d[c|16]<=o&&(c|=16),d[c|8]<=o&&(c|=8),d[c|4]<=o&&(c|=4),d[c|2]<=o&&(c|=2),d[c|1]<=o&&(c|=1),c},n.F._writeLit=function(o,d,c,f){return n.F._putsF(c,f,d[o<<1]),f+d[(o<<1)+1]},n.F.inflate=function(o,d){var c=Uint8Array;if(o[0]==3&&o[1]==0)return d||new c(0);var f=n.F,u=f._bitsF,r=f._bitsE,p=f._decodeTiny,_=f.makeCodes,g=f.codes2map,v=f._get17,E=f.U,S=d==null;S&&(d=new c(o.length>>>2<<3));for(var U=0,e=0,t=0,s=0,l=0,h=0,m=0,y=0,b=0,x,w;U==0;){if(U=u(o,b,1),e=u(o,b+1,2),b+=3,e==0){b&7&&(b+=8-(b&7));var T=(b>>>3)+4,C=o[T-4]|o[T-3]<<8;S&&(d=n.F._check(d,y+C)),d.set(new c(o.buffer,o.byteOffset+T,C),y),b=T+C<<3,y+=C;continue}if(S&&(d=n.F._check(d,y+(1<<17))),e==1&&(x=E.flmap,w=E.fdmap,h=511,m=31),e==2){t=r(o,b,5)+257,s=r(o,b+5,5)+1,l=r(o,b+10,4)+4,b+=14;for(var F=0;F<38;F+=2)E.itree[F]=0,E.itree[F+1]=0;for(var A=1,F=0;F<l;F++){var R=r(o,b+F*3,3);E.itree[(E.ordr[F]<<1)+1]=R,R>A&&(A=R)}b+=3*l,_(E.itree,A),g(E.itree,A,E.imap),x=E.lmap,w=E.dmap,b=p(E.imap,(1<<A)-1,t+s,o,b,E.ttree);var P=f._copyOut(E.ttree,0,t,E.ltree);h=(1<<P)-1;var K=f._copyOut(E.ttree,t,s,E.dtree);m=(1<<K)-1,_(E.ltree,P),g(E.ltree,P,x),_(E.dtree,K),g(E.dtree,K,w)}for(;;){var Z=x[v(o,b)&h];b+=Z&15;var $=Z>>>4;if(!($>>>8))d[y++]=$;else{if($==256)break;var G=y+$-254;if($>264){var q=E.ldef[$-257];G=y+(q>>>3)+r(o,b,q&7),b+=q&7}var ee=w[v(o,b)&m];b+=ee&15;var Ee=ee>>>4,j=E.ddef[Ee],W=(j>>>4)+u(o,b,j&15);for(b+=j&15,S&&(d=n.F._check(d,y+(1<<17)));y<G;)d[y]=d[y++-W],d[y]=d[y++-W],d[y]=d[y++-W],d[y]=d[y++-W];y=G}}}return d.length==y?d:d.slice(0,y)},n.F._check=function(o,d){var c=o.length;if(d<=c)return o;var f=new Uint8Array(Math.max(c<<1,d));return f.set(o,0),f},n.F._decodeTiny=function(o,d,c,f,u,r){for(var p=n.F._bitsE,_=n.F._get17,g=0;g<c;){var v=o[_(f,u)&d];u+=v&15;var E=v>>>4;if(E<=15)r[g]=E,g++;else{var S=0,U=0;E==16?(U=3+p(f,u,2),u+=2,S=r[g-1]):E==17?(U=3+p(f,u,3),u+=3):E==18&&(U=11+p(f,u,7),u+=7);for(var e=g+U;g<e;)r[g]=S,g++}}return u},n.F._copyOut=function(o,d,c,f){for(var u=0,r=0,p=f.length>>>1;r<c;){var _=o[r+d];f[r<<1]=0,f[(r<<1)+1]=_,_>u&&(u=_),r++}for(;r<p;)f[r<<1]=0,f[(r<<1)+1]=0,r++;return u},n.F.makeCodes=function(o,d){for(var c=n.F.U,f=o.length,u,r,p,_,g,v=c.bl_count,_=0;_<=d;_++)v[_]=0;for(_=1;_<f;_+=2)v[o[_]]++;var E=c.next_code;for(u=0,v[0]=0,r=1;r<=d;r++)u=u+v[r-1]<<1,E[r]=u;for(p=0;p<f;p+=2)g=o[p+1],g!=0&&(o[p]=E[g],E[g]++)},n.F.codes2map=function(o,d,c){for(var f=o.length,u=n.F.U,r=u.rev15,p=0;p<f;p+=2)if(o[p+1]!=0)for(var _=p>>1,g=o[p+1],v=_<<4|g,E=d-g,S=o[p]<<E,U=S+(1<<E);S!=U;){var e=r[S]>>>15-d;c[e]=v,S++}},n.F.revCodes=function(o,d){for(var c=n.F.U.rev15,f=15-d,u=0;u<o.length;u+=2){var r=o[u]<<d-o[u+1];o[u]=c[r]>>>f}},n.F._putsE=function(o,d,c){c=c<<(d&7);var f=d>>>3;o[f]|=c,o[f+1]|=c>>>8},n.F._putsF=function(o,d,c){c=c<<(d&7);var f=d>>>3;o[f]|=c,o[f+1]|=c>>>8,o[f+2]|=c>>>16},n.F._bitsE=function(o,d,c){return(o[d>>>3]|o[(d>>>3)+1]<<8)>>>(d&7)&(1<<c)-1},n.F._bitsF=function(o,d,c){return(o[d>>>3]|o[(d>>>3)+1]<<8|o[(d>>>3)+2]<<16)>>>(d&7)&(1<<c)-1},n.F._get17=function(o,d){return(o[d>>>3]|o[(d>>>3)+1]<<8|o[(d>>>3)+2]<<16)>>>(d&7)},n.F._get25=function(o,d){return(o[d>>>3]|o[(d>>>3)+1]<<8|o[(d>>>3)+2]<<16|o[(d>>>3)+3]<<24)>>>(d&7)},n.F.U=function(){var o=Uint16Array,d=Uint32Array;return{next_code:new o(16),bl_count:new o(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new o(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new d(32),flmap:new o(512),fltree:[],fdmap:new o(32),fdtree:[],lmap:new o(32768),ltree:[],ttree:[],dmap:new o(32768),dtree:[],imap:new o(512),itree:[],rev15:new o(32768),lhst:new d(286),dhst:new d(30),ihst:new d(19),lits:new d(15e3),strt:new o(65536),prev:new o(32768)}}(),function(){for(var o=n.F.U,d=32768,c=0;c<d;c++){var f=c;f=(f&2863311530)>>>1|(f&1431655765)<<1,f=(f&3435973836)>>>2|(f&858993459)<<2,f=(f&4042322160)>>>4|(f&252645135)<<4,f=(f&4278255360)>>>8|(f&16711935)<<8,o.rev15[c]=(f>>>16|f<<16)>>>17}function u(r,p,_){for(;p--!=0;)r.push(0,_)}for(var c=0;c<32;c++)o.ldef[c]=o.of0[c]<<3|o.exb[c],o.ddef[c]=o.df0[c]<<4|o.dxb[c];u(o.fltree,144,8),u(o.fltree,112,9),u(o.fltree,24,7),u(o.fltree,8,8),n.F.makeCodes(o.fltree,9),n.F.codes2map(o.fltree,9,o.flmap),n.F.revCodes(o.fltree,9),u(o.fdtree,32,5),n.F.makeCodes(o.fdtree,5),n.F.codes2map(o.fdtree,5,o.fdmap),n.F.revCodes(o.fdtree,5),u(o.itree,19,0),u(o.ltree,286,0),u(o.dtree,30,0),u(o.ttree,320,0)}()}(vt)),vt.exports}var pn=un(),ti=Zt(pn);const V=class V{constructor(n,o,d,c,f){this.copy=()=>new V(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const u=":";let r=("0"+this.h).slice(-2)+u+("0"+this.m).slice(-2)+u+("0"+this.s).slice(-2)+u+("0"+this.f).slice(-2);return r+="."+(this.field?"1":"2"),r},this.toZipTimeCodeString=()=>{const u=this.copy();return u.f=0,u.s=u.s%2===0?u.s:u.s-1,u.field=0,V.toStr(u)},this.toFrames=u=>{let r=60,p=0;Math.floor(u)==60?(r=60,p=0):Math.floor(u)==59?(r=60,p=4):Math.floor(u)==30?(r=30,p=0):Math.floor(u)==29&&(r=30,p=2);let _=this.h,g=this.m,v=this.s,E=this.f,S=this.field;const U=_*60+g,t=(U-Math.floor(U/10))*p;return _*(r*3600)+g*(r*60)+v*r+(E*2+S)-t},this.addSeconds=u=>{let r=this.copy();if(r.s+=u,r.s>=60){const p=Math.floor(r.s/60);if(r.s=r.s%60,r.m+=p,r.m>=60){const _=Math.floor(r.m/60);r.m=r.m%60,r.h+=_}}return r},this.addFrames=(u,r)=>{let p=this.toFrames(r);return p+=u,V.fromFrames(p,r)},this.subtractFrames=(u,r)=>this.addFrames(-u,r),this.h=n||0,this.m=o||0,this.s=d||0,this.f=c||0,this.field=f||0}static compare(n,o){return n.h!==o.h?n.h<o.h?-1:1:n.m!==o.m?n.m<o.m?-1:1:n.s!==o.s?n.s<o.s?-1:1:n.f!==o.f?n.f<o.f?-1:1:n.field!==o.field?n.field<o.field?-1:1:0}static generateTimecodeRange(n,o,d){const c=[];let f=n;for(;V.compare(f,o)<=0;)c.push(f),f=f.addSeconds(d);return c}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(n){return this.toFrames(n)*1e3/n}};V.calculateCurrentTimeCode=n=>{var v;if(!n.video||!n.clocker||!n.gameParams)throw new Error("OTTPlayer is not initialized");const o=n.video,d=n.clocker,c=d.videoFPScalculator.getFPS(),r=(o.currentTime-d.syncPoint.playerTime)%(60*60*24)*c+d.syncPoint.frame;if(r===0||c===0)throw new Error("Current frame is 0 or fps is 0");const p=V.calculateCurrentOffset(r,(v=n.gameParams)==null?void 0:v.offsets);if(p===void 0)throw new Error("Offset is undefined");let _=Math.floor(r-p);return _<0&&(_+=5178816),_>=5178816&&(_-=5178816),V.fromFrames(_,c)},V.calculateCurrentOffset=(n,o)=>{for(let d=1;d<o.length;d++)if(n<o[d].frame)return o[d-1].offset;return Math.abs(o[o.length-1].offset)},V.fromFrames=(n,o)=>{let d=60,c=0;Math.floor(o)==60?(d=60,c=0):Math.floor(o)==59?(d=60,c=4):Math.floor(o)==30?(d=30,c=0):Math.floor(o)==29&&(d=30,c=2);let f=Math.floor(o*60),u=Math.floor(o*60*10),r=u*6,p=n,_=Math.floor(p/r);p-=_*r;let g=Math.floor(p/u);p-=g*u,p>=d*60&&(p+=c*(Math.floor((p-d*60)/f)+1));let v=Math.floor(p/(d*60));p-=v*(d*60);let E=Math.floor(p/d);p-=E*d;let S=p;v+=g*10;let U=0;return U=S%2,S=Math.floor(S/2),new V(_,v,E,S,U)},V.toStr=n=>{const o="_";let d=("0"+n.h).slice(-2)+o+("0"+n.m).slice(-2)+o+("0"+n.s).slice(-2)+o+("0"+n.f).slice(-2);return n.field&&(d+="_1"),d},V.fromStr=n=>{const d=n.split("_").map(Number);if(d.length==4){const[c,f,u,r]=d;return new V(c,f,u,r,0)}else if(d.length==5){const[c,f,u,r,p]=d;return new V(c,f,u,r,p)}else throw new Error("Invalid timecode format: "+n)},V.fromMetadata=n=>{const o=/^(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d))?$/,d=n.timecode.match(o);if(!d)throw new Error("Invalid timecode format: "+n.timecode);const[,c,f,u,r,p]=d,_=Number(c),g=Number(f),v=Number(u),E=Number(r),S=p?Number(p):0;return new V(_,g,v,E,S)};let O=V;const M={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},te=console,he={};Object.keys(M).forEach(a=>{he[a]=te[a]});const ke="Datadog Browser SDK:",N={debug:he.debug.bind(te,ke),log:he.log.bind(te,ke),info:he.info.bind(te,ke),warn:he.warn.bind(te,ke),error:he.error.bind(te,ke)},St="https://docs.datadoghq.com",ii=`${St}/real_user_monitoring/browser/troubleshooting`,Ve="More details:";function ni(a,n){return(...o)=>{try{return a(...o)}catch(d){N.error(n,d)}}}function $e(a){return a!==0&&Math.random()*100<=a}function _n(a){return gn(a)&&a>=0&&a<=100}function gn(a){return typeof a=="number"}const Be=1e3,ue=60*Be,ri=60*ue,mn=365*(24*ri);function Le(){return new Date().getTime()}function oe(){return Le()}function je(){return performance.now()}function ae(){return{relative:je(),timeStamp:oe()}}function yn(){return{relative:0,timeStamp:si()}}function vn(a,n){return n-a}function Sn(a,n){return a+n}function bn(a){return a-si()}let bt;function si(){return bt===void 0&&(bt=performance.timing.navigationStart),bt}const ie=1024,oi=1024*ie,xn=/[^\\u0000-\\u007F]/;function xt(a){return xn.test(a)?window.TextEncoder!==void 0?new TextEncoder().encode(a).length:new Blob([a]).size:a.length}function En(a){return{...a}}function ai(a,n){return Object.keys(a).some(o=>a[o]===n)}function De(a){return Object.keys(a).length===0}function de(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let a=_dd_temp_;return delete Object.prototype._dd_temp_,typeof a!="object"&&(typeof self=="object"?a=self:typeof window=="object"?a=window:a={}),a}function Ue(a,n){const o=de();let d;return o.Zone&&typeof o.Zone.__symbol__=="function"&&(d=a[o.Zone.__symbol__(n)]),d||(d=a[n]),d}let Ke,di=!1;function Un(a){Ke=a}function wn(a){di=a}function Tn(a,n,o){const d=o.value;o.value=function(...c){return(Ke?D(d):d).apply(this,c)}}function D(a){return function(){return Re(a,this,arguments)}}function Re(a,n,o){try{return a.apply(n,o)}catch(d){Cn(d)}}function Cn(a){if(Et(a),Ke)try{Ke(a)}catch(n){Et(n)}}function Et(...a){di&&N.error("[MONITOR]",...a)}function Pe(a,n){return Ue(de(),"setTimeout")(D(a),n)}function li(a){Ue(de(),"clearTimeout")(a)}function Ut(a,n){return Ue(de(),"setInterval")(D(a),n)}function ci(a){Ue(de(),"clearInterval")(a)}class H{constructor(n){this.onFirstSubscribe=n,this.observers=[]}subscribe(n){return this.observers.push(n),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(o=>n!==o),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(n){this.observers.forEach(o=>o(n))}}function fi(...a){return new H(n=>{const o=a.map(d=>d.subscribe(c=>n.notify(c)));return()=>o.forEach(d=>d.unsubscribe())})}function hi(a,n,o){let d=!1,c,f;return{throttled:(...u)=>{if(d){c=u;return}a(...u),d=!0,f=Pe(()=>{c&&a(...c),d=!1,c=void 0},n)},cancel:()=>{li(f),d=!1,c=void 0}}}function le(){}function ce(a){return a?(parseInt(a,10)^Math.random()*16>>parseInt(a,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,ce)}const qe=/([\\w-]+)\\s*=\\s*([^;]+)/g;function An(a,n){for(qe.lastIndex=0;;){const o=qe.exec(a);if(o){if(o[1]===n)return o[2]}else break}}function In(a){const n=new Map;for(qe.lastIndex=0;;){const o=qe.exec(a);if(o)n.set(o[1],o[2]);else break}return n}function Fn(a,n,o=""){const d=a.charCodeAt(n-1),f=d>=55296&&d<=56319?n+1:n;return a.length<=f?a:`${a.slice(0,f)}${o}`}function kn(){return Bn()===0}let We;function Bn(){return We??(We=Ln())}function Ln(a=window){var n;const o=a.navigator.userAgent;return a.chrome||/HeadlessChrome/.test(o)?0:((n=a.navigator.vendor)===null||n===void 0?void 0:n.indexOf("Apple"))===0||/safari/i.test(o)&&!/chrome|android/i.test(o)?1:2}function Oe(a,n,o=0,d){const c=new Date;c.setTime(c.getTime()+o);const f=`expires=${c.toUTCString()}`,u=d&&d.crossSite?"none":"strict",r=d&&d.domain?`;domain=${d.domain}`:"",p=d&&d.secure?";secure":"",_=d&&d.partitioned?";partitioned":"";document.cookie=`${a}=${n};${f};path=/;samesite=${u}${r}${p}${_}`}function wt(a){return An(document.cookie,a)}let Tt;function pe(a){return Tt||(Tt=In(document.cookie)),Tt.get(a)}function ui(a,n){Oe(a,"",0,n)}function Dn(a){if(document.cookie===void 0||document.cookie===null)return!1;try{const n=`dd_cookie_test_${ce()}`,o="test";Oe(n,o,ue,a);const d=wt(n)===o;return ui(n,a),d}catch(n){return N.error(n),!1}}let Ct;function Rn(){if(Ct===void 0){const a=`dd_site_test_${ce()}`,n="test",o=window.location.hostname.split(".");let d=o.pop();for(;o.length&&!wt(a);)d=`${o.pop()}.${d}`,Oe(a,n,Be,{domain:d});ui(a,{domain:d}),Ct=d}return Ct}const we="_dd_s";function Je(a){return Object.values(a)}function Pn(a){return Object.entries(a)}const At=4*ri,pi=15*ue,On=mn,ze={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},_i=/^([a-zA-Z]+)=([a-z0-9-]+)$/,It="&";function zn(a){return!!a&&(a.indexOf(It)!==-1||_i.test(a))}const Mn="1";function _e(a,n){const o={isExpired:Mn};return n.trackAnonymousUser&&(a!=null&&a.anonymousId?o.anonymousId=a==null?void 0:a.anonymousId:o.anonymousId=ce()),o}function Xe(a){return De(a)}function gi(a){return!Xe(a)}function Ze(a){return a.isExpired!==void 0||!Nn(a)}function Nn(a){return(a.created===void 0||Le()-Number(a.created)<At)&&(a.expire===void 0||Le()<Number(a.expire))}function mi(a){a.expire=String(Le()+pi)}function Ft(a){return Pn(a).map(([n,o])=>n==="anonymousId"?`aid=${o}`:`${n}=${o}`).join(It)}function yi(a){const n={};return zn(a)&&a.split(It).forEach(o=>{const d=_i.exec(o);if(d!==null){const[,c,f]=d;c==="aid"?n.anonymousId=f:n[c]=f}}),n}const Gn="_dd",Hn="_dd_r",Yn="_dd_l",Vn="rum",$n="logs";function jn(a){if(!pe(we)){const o=pe(Gn),d=pe(Hn),c=pe(Yn),f={};o&&(f.id=o),c&&/^[01]$/.test(c)&&(f[$n]=c),d&&/^[012]$/.test(d)&&(f[Vn]=d),gi(f)&&(mi(f),a.persistSession(f))}}function vi(a){const n=Xn(a);return Dn(n)?{type:ze.COOKIE,cookieOptions:n}:void 0}function Kn(a,n){const o={isLockEnabled:kn(),persistSession:qn(n),retrieveSession:Jn,expireSession:d=>Wn(n,d,a)};return jn(o),o}function qn(a){return n=>{Oe(we,Ft(n),pi,a)}}function Wn(a,n,o){const d=_e(n,o);Oe(we,Ft(d),o.trackAnonymousUser?On:At,a)}function Jn(){const a=wt(we);return yi(a)}function Xn(a){const n={};return n.secure=!!a.useSecureSessionCookie||!!a.usePartitionedCrossSiteSessionCookie,n.crossSite=!!a.usePartitionedCrossSiteSessionCookie,n.partitioned=!!a.usePartitionedCrossSiteSessionCookie,a.trackSessionAcrossSubdomains&&(n.domain=Rn()),n}const Zn="_dd_test_";function Si(){try{const a=ce(),n=`${Zn}${a}`;localStorage.setItem(n,a);const o=localStorage.getItem(n);return localStorage.removeItem(n),a===o?{type:ze.LOCAL_STORAGE}:void 0}catch{return}}function Qn(a){return{isLockEnabled:!1,persistSession:bi,retrieveSession:er,expireSession:n=>tr(n,a)}}function bi(a){localStorage.setItem(we,Ft(a))}function er(){const a=localStorage.getItem(we);return yi(a)}function tr(a,n){bi(_e(a,n))}const ir=10,nr=100,xi=[];let Qe;function ge(a,n,o=0){var d;const{isLockEnabled:c,persistSession:f,expireSession:u}=n,r=E=>f({...E,lock:_}),p=()=>{const E=n.retrieveSession(),S=E.lock;return E.lock&&delete E.lock,{session:E,lock:S}};if(Qe||(Qe=a),a!==Qe){xi.push(a);return}if(c&&o>=nr){Ei(n);return}let _,g=p();if(c){if(g.lock){et(a,n,o);return}if(_=ce(),r(g.session),g=p(),g.lock!==_){et(a,n,o);return}}let v=a.process(g.session);if(c&&(g=p(),g.lock!==_)){et(a,n,o);return}if(v&&(Ze(v)?u(v):(mi(v),c?r(v):f(v))),c&&!(v&&Ze(v))){if(g=p(),g.lock!==_){et(a,n,o);return}f(g.session),v=g.session}(d=a.after)===null||d===void 0||d.call(a,v||g.session),Ei(n)}function et(a,n,o){Pe(()=>{ge(a,n,o+1)},ir)}function Ei(a){Qe=void 0;const n=xi.shift();n&&ge(n,a)}const Ui=Be;function rr(a){switch(a.sessionPersistence){case ze.COOKIE:return vi(a);case ze.LOCAL_STORAGE:return Si();case void 0:{let n=vi(a);return!n&&a.allowFallbackToLocalStorage&&(n=Si()),n}default:N.error(`Invalid session persistence \'${String(a.sessionPersistence)}\'`)}}function sr(a,n,o,d){const c=new H,f=new H,u=new H,r=a.type===ze.COOKIE?Kn(n,a.cookieOptions):Qn(n),{expireSession:p}=r,_=Ut(U,Ui);let g;t();const{throttled:v,cancel:E}=hi(()=>{ge({process:x=>{if(Xe(x))return;const w=e(x);return s(w),w},after:x=>{gi(x)&&!l()&&y(x),g=x}},r)},Ui);function S(){ge({process:x=>l()?e(x):void 0},r)}function U(){ge({process:x=>Ze(x)?_e(x,n):void 0,after:e},r)}function e(x){return Ze(x)&&(x=_e(x,n)),l()&&(h(x)?m():(u.notify({previousState:g,newState:x}),g=x)),x}function t(){ge({process:x=>{if(Xe(x))return _e(x,n)},after:x=>{g=x}},r)}function s(x){if(Xe(x))return!1;const{trackingType:w,isTracked:T}=d(x[o]);x[o]=w,delete x.isExpired,T&&!x.id&&(x.id=ce(),x.created=String(Le()))}function l(){return g[o]!==void 0}function h(x){return g.id!==x.id||g[o]!==x[o]}function m(){g=_e(g,n),f.notify()}function y(x){g=x,c.notify()}function b(x){ge({process:w=>({...w,...x}),after:e},r)}return{expandOrRenewSession:v,expandSession:S,getSession:()=>g,renewObservable:c,expireObservable:f,sessionStateUpdateObservable:u,restartSession:t,expire:()=>{E(),p(g),e(_e(g,n))},stop:()=>{ci(_)},updateSessionState:b}}const kt={GRANTED:"granted",NOT_GRANTED:"not-granted"};function or(a){const n=new H;return{tryToInit(o){a||(a=o)},update(o){a=o,n.notify()},isGranted(){return a===kt.GRANTED},observable:n}}function me(a,n,o){if(typeof a!="object"||a===null)return JSON.stringify(a);const d=Te(Object.prototype),c=Te(Array.prototype),f=Te(Object.getPrototypeOf(a)),u=Te(a);try{return JSON.stringify(a,n,o)}catch{return"<error: unable to serialize object>"}finally{d(),c(),f(),u()}}function Te(a){const n=a,o=n.toJSON;return o?(delete n.toJSON,()=>{n.toJSON=o}):le}function Bt(a){return ar(a,location.href).href}function ar(a,n){const o=dr();if(o)try{return n!==void 0?new o(a,n):new o(a)}catch(f){throw new Error(`Failed to construct URL: ${String(f)} ${me({url:a,base:n})}`)}if(n===void 0&&!/:/.test(a))throw new Error(`Invalid URL: \'${a}\'`);let d=document;const c=d.createElement("a");if(n!==void 0){d=document.implementation.createHTMLDocument("");const f=d.createElement("base");f.href=n,d.head.appendChild(f),d.body.appendChild(c)}return c.href=a,c}const wi=URL;let tt;function dr(){if(tt===void 0)try{tt=new wi("http://test/path").href==="http://test/path"}catch{tt=!1}return tt?wi:void 0}const lr="datad0g.com",cr="dd0g-gov.com",Ce="datadoghq.com",fr="ddog-gov.com",hr="pci.browser-intake-datadoghq.com",ur=["ddsource","ddtags"];function Me(a,n,o){const d=pr(a,n);return{build(c,f){const u=gr(a,n,o,c,f);return d(u)},urlPrefix:d(""),trackType:n}}function pr(a,n){const o=`/api/v2/${n}`,d=a.proxy;if(typeof d=="string"){const f=Bt(d);return u=>`${f}?ddforward=${encodeURIComponent(`${o}?${u}`)}`}if(typeof d=="function")return f=>d({path:o,parameters:f});const c=_r(n,a);return f=>`https://${c}${o}?${f}`}function _r(a,n){const{site:o=Ce,internalAnalyticsSubdomain:d}=n;if(a==="logs"&&n.usePciIntake&&o===Ce)return hr;if(d&&o===Ce)return`${d}.${Ce}`;if(o===cr)return`http-intake.logs.${o}`;const c=o.split("."),f=c.pop();return`browser-intake-${c.join("-")}.${f}`}function gr({clientToken:a,internalAnalyticsSubdomain:n},o,d,c,{retry:f,encoding:u}){const r=["sdk_version:6.5.0",`api:${c}`].concat(d);f&&r.push(`retry_count:${f.count}`,`retry_after:${f.lastFailureStatus}`);const p=["ddsource=browser",`ddtags=${encodeURIComponent(r.join(","))}`,`dd-api-key=${a}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${ce()}`];return u&&p.push(`dd-evp-encoding=${u}`),o==="rum"&&p.push(`batch_time=${oe()}`),n&&p.reverse(),p.join("&")}const mr=200;function yr(a){const{env:n,service:o,version:d,datacenter:c}=a,f=[];return n&&f.push(it("env",n)),o&&f.push(it("service",o)),d&&f.push(it("version",d)),c&&f.push(it("datacenter",c)),f}function it(a,n){const o=mr-a.length-1;(n.length>o||vr(n))&&N.warn(`${a} value doesn\'t meet tag requirements and will be sanitized. ${Ve} ${St}/getting_started/tagging/#defining-tags`);const d=n.replace(/,/g,"_");return`${a}:${d}`}function vr(a){return Sr()?new RegExp("[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]","u").test(a):!1}function Sr(){try{return new RegExp("[\\\\p{Ll}]","u"),!0}catch{return!1}}function br(a){const n=a.site||Ce,o=yr(a),d=xr(a,o);return{replica:Er(a,o),site:n,...d}}function xr(a,n){return{logsEndpointBuilder:Me(a,"logs",n),rumEndpointBuilder:Me(a,"rum",n),sessionReplayEndpointBuilder:Me(a,"replay",n)}}function Er(a,n){if(!a.replica)return;const o={...a,site:Ce,clientToken:a.replica.clientToken},d={logsEndpointBuilder:Me(o,"logs",n),rumEndpointBuilder:Me(o,"rum",n)};return{applicationId:a.replica.applicationId,...d}}function Ur(a){return ur.every(n=>a.includes(n))}function Lt(a,n){return a!=null&&typeof a!="string"?(N.error(`${n} must be defined as a string`),!1):!0}function wr(a){return a&&typeof a=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(a)?(N.error(`Site should be a valid Datadog site. ${Ve} ${St}/getting_started/site/.`),!1):!0}function nt(a,n){return a!==void 0&&!_n(a)?(N.error(`${n} Sample Rate should be a number between 0 and 100`),!1):!0}function Tr(a){var n,o,d,c,f,u;if(!a||!a.clientToken){N.error("Client Token is not configured, we will not send any data.");return}if(!(!wr(a.site)||!nt(a.sessionSampleRate,"Session")||!nt(a.telemetrySampleRate,"Telemetry")||!nt(a.telemetryConfigurationSampleRate,"Telemetry Configuration")||!nt(a.telemetryUsageSampleRate,"Telemetry Usage")||!Lt(a.version,"Version")||!Lt(a.env,"Env")||!Lt(a.service,"Service"))){if(a.trackingConsent!==void 0&&!ai(kt,a.trackingConsent)){N.error(\'Tracking Consent should be either "granted" or "not-granted"\');return}return{beforeSend:a.beforeSend&&ni(a.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:rr(a),sessionSampleRate:(n=a.sessionSampleRate)!==null&&n!==void 0?n:100,telemetrySampleRate:(o=a.telemetrySampleRate)!==null&&o!==void 0?o:20,telemetryConfigurationSampleRate:(d=a.telemetryConfigurationSampleRate)!==null&&d!==void 0?d:5,telemetryUsageSampleRate:(c=a.telemetryUsageSampleRate)!==null&&c!==void 0?c:5,service:a.service||void 0,silentMultipleInit:!!a.silentMultipleInit,allowUntrustedEvents:!!a.allowUntrustedEvents,trackingConsent:(f=a.trackingConsent)!==null&&f!==void 0?f:kt.GRANTED,trackAnonymousUser:(u=a.trackAnonymousUser)!==null&&u!==void 0?u:!0,storeContextsAcrossPages:!!a.storeContextsAcrossPages,batchBytesLimit:16*ie,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*Be,batchMessagesLimit:50,messageBytesLimit:256*ie,...br(a)}}}function Cr(a){return{session_sample_rate:a.sessionSampleRate,telemetry_sample_rate:a.telemetrySampleRate,telemetry_configuration_sample_rate:a.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:a.telemetryUsageSampleRate,use_before_send:!!a.beforeSend,use_partitioned_cross_site_session_cookie:a.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:a.useSecureSessionCookie,use_proxy:!!a.proxy,silent_multiple_init:a.silentMultipleInit,track_session_across_subdomains:a.trackSessionAcrossSubdomains,track_anonymous_user:a.trackAnonymousUser,session_persistence:a.sessionPersistence,allow_fallback_to_local_storage:!!a.allowFallbackToLocalStorage,store_contexts_across_pages:!!a.storeContextsAcrossPages,allow_untrusted_events:!!a.allowUntrustedEvents,tracking_consent:a.trackingConsent}}var Dt;(function(a){a.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",a.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(Dt||(Dt={}));const Ti=new Set;function Ar(a){Array.isArray(a)&&Ir(a.filter(n=>ai(Dt,n)))}function Ir(a){a.forEach(n=>{Ti.add(n)})}function Fr(){return Ti}const Ne="?";function ne(a){const n=[];let o=Rt(a,"stack");const d=String(a);return o&&o.startsWith(d)&&(o=o.slice(d.length)),o&&o.split(`\n`).forEach(c=>{const f=Lr(c)||Rr(c)||Or(c)||Nr(c);f&&(!f.func&&f.line&&(f.func=Ne),n.push(f))}),{message:Rt(a,"message"),name:Rt(a,"name"),stack:n}}const Ci="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\\\w+\\\\.|\\\\/).*?)",Ae="(?::(\\\\d+))",kr=new RegExp(`^\\\\s*at (.*?) ?\\\\(${Ci}${Ae}?${Ae}?\\\\)?\\\\s*$`,"i"),Br=new RegExp(`\\\\((\\\\S*)${Ae}${Ae}\\\\)`);function Lr(a){const n=kr.exec(a);if(!n)return;const o=n[2]&&n[2].indexOf("native")===0,d=n[2]&&n[2].indexOf("eval")===0,c=Br.exec(n[2]);return d&&c&&(n[2]=c[1],n[3]=c[2],n[4]=c[3]),{args:o?[n[2]]:[],column:n[4]?+n[4]:void 0,func:n[1]||Ne,line:n[3]?+n[3]:void 0,url:o?void 0:n[2]}}const Dr=new RegExp(`^\\\\s*at ?${Ci}${Ae}?${Ae}??\\\\s*$`,"i");function Rr(a){const n=Dr.exec(a);if(n)return{args:[],column:n[3]?+n[3]:void 0,func:Ne,line:n[2]?+n[2]:void 0,url:n[1]}}const Pr=/^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;function Or(a){const n=Pr.exec(a);if(n)return{args:[],column:n[4]?+n[4]:void 0,func:n[1]||Ne,line:+n[3],url:n[2]}}const zr=/^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,Mr=/(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;function Nr(a){const n=zr.exec(a);if(!n)return;const o=n[3]&&n[3].indexOf(" > eval")>-1,d=Mr.exec(n[3]);return o&&d&&(n[3]=d[1],n[4]=d[2],n[5]=void 0),{args:n[2]?n[2].split(","):[],column:n[5]?+n[5]:void 0,func:n[1]||Ne,line:n[4]?+n[4]:void 0,url:n[3]}}function Rt(a,n){if(typeof a!="object"||!a||!(n in a))return;const o=a[n];return typeof o=="string"?o:void 0}function Gr(a,n,o,d){const c=[{url:n,column:d,line:o}],{name:f,message:u}=Yr(a);return{name:f,message:u,stack:c}}const Hr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;function Yr(a){let n,o;return{}.toString.call(a)==="[object String]"&&([,n,o]=Hr.exec(a)),{name:n,message:o}}function rt(a){const o=new Error(a);o.name="HandlingStack";let d;return Re(()=>{const c=ne(o);c.stack=c.stack.slice(2),d=ye(c)}),d}function ye(a){let n=Ai(a);return a.stack.forEach(o=>{const d=o.func==="?"?"<anonymous>":o.func,c=o.args&&o.args.length>0?`(${o.args.join(", ")})`:"",f=o.line?`:${o.line}`:"",u=o.line&&o.column?`:${o.column}`:"";n+=`\n at ${d}${c} @ ${o.url}${f}${u}`}),n}function Ai(a){return`${a.name||"Error"}: ${a.message}`}function ve(a,n,o,{computeHandlingStack:d}={}){let c=a[n];if(typeof c!="function")if(n in a&&n.startsWith("on"))c=le;else return{stop:le};let f=!1;const u=function(){if(f)return c.apply(this,arguments);const r=Array.from(arguments);let p;Re(o,null,[{target:this,parameters:r,onPostCall:g=>{p=g},handlingStack:d?rt("instrumented method"):void 0}]);const _=c.apply(this,r);return p&&Re(p,null,[_]),_};return a[n]=u,{stop:()=>{f=!0,a[n]===u&&(a[n]=c)}}}const Vr=220*ie,$r="$",jr=3;function re(a,n=Vr){const o=Te(Object.prototype),d=Te(Array.prototype),c=[],f=new WeakMap,u=Pt(a,$r,void 0,c,f),r=JSON.stringify(u);let p=r?r.length:0;if(p>n){zt(n,"discarded",a);return}for(;c.length>0&&p<n;){const _=c.shift();let g=0;if(Array.isArray(_.source))for(let v=0;v<_.source.length;v++){const E=Pt(_.source[v],_.path,v,c,f);if(E!==void 0?p+=JSON.stringify(E).length:p+=4,p+=g,g=1,p>n){zt(n,"truncated",a);break}_.target[v]=E}else for(const v in _.source)if(Object.prototype.hasOwnProperty.call(_.source,v)){const E=Pt(_.source[v],_.path,v,c,f);if(E!==void 0&&(p+=JSON.stringify(E).length+g+v.length+jr,g=1),p>n){zt(n,"truncated",a);break}_.target[v]=E}}return o(),d(),u}function Pt(a,n,o,d,c){const f=Wr(a);if(!f||typeof f!="object")return Kr(f);const u=Ot(f);if(u!=="[Object]"&&u!=="[Array]"&&u!=="[Error]")return u;const r=a;if(c.has(r))return`[Reference seen at ${c.get(r)}]`;const p=o!==void 0?`${n}.${o}`:n,_=Array.isArray(f)?[]:{};return c.set(r,p),d.push({source:f,target:_,path:p}),_}function Kr(a){return typeof a=="bigint"?`[BigInt] ${a.toString()}`:typeof a=="function"?`[Function] ${a.name||"unknown"}`:typeof a=="symbol"?`[Symbol] ${a.description||a.toString()}`:a}function Ot(a){try{if(a instanceof Event)return qr(a);if(a instanceof RegExp)return`[RegExp] ${a.toString()}`;const o=Object.prototype.toString.call(a).match(/\\[object (.*)\\]/);if(o&&o[1])return`[${o[1]}]`}catch{}return"[Unserializable]"}function qr(a){return{type:a.type,isTrusted:a.isTrusted,currentTarget:a.currentTarget?Ot(a.currentTarget):null,target:a.target?Ot(a.target):null}}function Wr(a){const n=a;if(n&&typeof n.toJSON=="function")try{return n.toJSON()}catch{}return a}function zt(a,n,o){N.warn(`The data provided has been ${n} as it is over the limit of ${a} characters:`,o)}const Ii="No stack, consider using an instance of Error";function Fi({stackTrace:a,originalError:n,handlingStack:o,componentStack:d,startClocks:c,nonErrorPrefix:f,source:u,handling:r}){const p=fe(n),_=Jr(a,p,f,n),g=Xr(p,a)?ye(a):Ii,v=p?Li(n,u):void 0,E=a?a.name:void 0,S=ki(n),U=Bi(n);return{startClocks:c,source:u,handling:r,handlingStack:o,componentStack:d,originalError:n,type:E,message:_,stack:g,causes:v,fingerprint:S,context:U}}function Jr(a,n,o,d){return a!=null&&a.message&&(a!=null&&a.name)?a.message:n?"Empty message":`${o} ${me(re(d))}`}function Xr(a,n){return n===void 0?!1:a?!0:n.stack.length>0&&(n.stack.length>1||n.stack[0].url!==void 0)}function ki(a){return fe(a)&&"dd_fingerprint"in a?String(a.dd_fingerprint):void 0}function Bi(a){if(a!==null&&typeof a=="object"&&"dd_context"in a)return a.dd_context}function Zr(a){var n;return(n=/@ (.+)/.exec(a))===null||n===void 0?void 0:n[1]}function fe(a){return a instanceof Error||Object.prototype.toString.call(a)==="[object Error]"}function Li(a,n){let o=a;const d=[];for(;fe(o==null?void 0:o.cause)&&d.length<10;){const c=ne(o.cause);d.push({message:o.cause.message,source:n,type:c==null?void 0:c.name,stack:ye(c)}),o=o.cause}return d.length?d:void 0}const J={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function Qr(a){const n=(c,f)=>{const u=Fi({stackTrace:c,originalError:f,startClocks:ae(),nonErrorPrefix:"Uncaught",source:J.SOURCE,handling:"unhandled"});a.notify(u)},{stop:o}=es(n),{stop:d}=ts(n);return{stop:()=>{o(),d()}}}function es(a){return ve(window,"onerror",({parameters:[n,o,d,c,f]})=>{let u;fe(f)?u=ne(f):u=Gr(n,o,d,c),a(u,f??n)})}function ts(a){return ve(window,"onunhandledrejection",({parameters:[n]})=>{const o=n.reason||"Empty reason",d=ne(o);a(d,o)})}function is(a){const n={version:"6.5.0",onReady(o){o()},...a};return Object.defineProperty(n,"_setDebug",{get(){return wn},enumerable:!1}),n}function ns(a,n,o){const d=a[n];d&&!d.q&&d.version&&N.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),a[n]=o,d&&d.q&&d.q.forEach(c=>ni(c,"onReady callback threw an error:")())}function Di(a,n){n.silentMultipleInit||N.error(`${a} is already initialized.`)}function Se(a,n,o,d,c){return Mt(a,n,[o],d,c)}function Mt(a,n,o,d,{once:c,capture:f,passive:u}={}){const r=D(E=>{!E.isTrusted&&!E.__ddIsTrusted&&!a.allowUntrustedEvents||(c&&v(),d(E))}),p=u?{capture:f,passive:u}:f,_=window.EventTarget&&n instanceof EventTarget?window.EventTarget.prototype:n,g=Ue(_,"addEventListener");o.forEach(E=>g.call(n,E,r,p));function v(){const E=Ue(_,"removeEventListener");o.forEach(S=>E.call(n,S,r,p))}return{stop:v}}const st={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function rs(a,n){const o=[];n.includes(st.cspViolation)&&o.push(os(a));const d=n.filter(c=>c!==st.cspViolation);return d.length&&o.push(ss(d)),fi(...o)}function ss(a){return new H(n=>{if(!window.ReportingObserver)return;const o=D((c,f)=>c.forEach(u=>n.notify(as(u)))),d=new window.ReportingObserver(o,{types:a,buffered:!0});return d.observe(),()=>{d.disconnect()}})}function os(a){return new H(n=>{const{stop:o}=Se(a,document,"securitypolicyviolation",d=>{n.notify(ds(d))});return o})}function as(a){const{type:n,body:o}=a;return Ri({type:o.id,message:`${n}: ${o.message}`,originalError:a,stack:Pi(o.id,o.message,o.sourceFile,o.lineNumber,o.columnNumber)})}function ds(a){const n=`\'${a.blockedURI}\' blocked by \'${a.effectiveDirective}\' directive`;return Ri({type:a.effectiveDirective,message:`${st.cspViolation}: ${n}`,originalError:a,csp:{disposition:a.disposition},stack:Pi(a.effectiveDirective,a.originalPolicy?`${n} of the policy "${Fn(a.originalPolicy,100,"...")}"`:"no policy",a.sourceFile,a.lineNumber,a.columnNumber)})}function Ri(a){return{startClocks:ae(),source:J.REPORT,handling:"unhandled",...a}}function Pi(a,n,o,d,c){return o?ye({name:a,message:n,stack:[{func:"?",url:o,line:d??void 0,column:c??void 0}]}):void 0}function Oi(a,n){const o=window.__ddBrowserSdkExtensionCallback;o&&o({type:a,payload:n})}function zi(a){return a===null?"null":Array.isArray(a)?"array":typeof a}function ot(a,n,o=ls()){if(n===void 0)return a;if(typeof n!="object"||n===null)return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp){const c=n.flags||[n.global?"g":"",n.ignoreCase?"i":"",n.multiline?"m":"",n.sticky?"y":"",n.unicode?"u":""].join("");return new RegExp(n.source,c)}if(o.hasAlreadyBeenSeen(n))return;if(Array.isArray(n)){const c=Array.isArray(a)?a:[];for(let f=0;f<n.length;++f)c[f]=ot(c[f],n[f],o);return c}const d=zi(a)==="object"?a:{};for(const c in n)Object.prototype.hasOwnProperty.call(n,c)&&(d[c]=ot(d[c],n[c],o));return d}function Mi(a){return ot(void 0,a)}function Ie(...a){let n;for(const o of a)o!=null&&(n=ot(n,o));return n}function ls(){if(typeof WeakSet<"u"){const n=new WeakSet;return{hasAlreadyBeenSeen(o){const d=n.has(o);return d||n.add(o),d}}}const a=[];return{hasAlreadyBeenSeen(n){const o=a.indexOf(n)>=0;return o||a.push(n),o}}}function cs(){var a;const n=window.navigator;return{status:n.onLine?"connected":"not_connected",interfaces:n.connection&&n.connection.type?[n.connection.type]:void 0,effective_type:(a=n.connection)===null||a===void 0?void 0:a.effectiveType}}function fs(a){const n=new Set;return a.forEach(o=>n.add(o)),Array.from(n)}function Ni(a,n){const o=a.indexOf(n);o>=0&&a.splice(o,1)}const hs=500;function Gi(){const a=[];return{add:c=>{a.push(c)>hs&&a.splice(0,1)},remove:c=>{Ni(a,c)},drain:c=>{a.forEach(f=>f(c)),a.length=0}}}const be={log:"log",configuration:"configuration",usage:"usage"},us=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],ps=[fr];let Hi=Gi(),Fe=a=>{Hi.add(()=>Fe(a))};function _s(a,n){let o;const d=new H,c=new Set,f=!ps.includes(n.site)&&$e(n.telemetrySampleRate),u={[be.log]:f,[be.configuration]:f&&$e(n.telemetryConfigurationSampleRate),[be.usage]:f&&$e(n.telemetryUsageSampleRate)},r=gs();Fe=_=>{const g=me(_);if(u[_.type]&&c.size<n.maxTelemetryEventsPerPage&&!c.has(g)){const v=p(a,_,r);d.notify(v),Oi("telemetry",v),c.add(g)}},Un(Vi);function p(_,g,v){return Ie({type:"telemetry",date:oe(),service:_,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:Ie(g,{runtime_env:v,connectivity:cs(),sdk_setup:"npm"}),experimental_features:Array.from(Fr())},o!==void 0?o():{})}return{setContextProvider:_=>{o=_},observable:d,enabled:f}}function gs(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function ms(){Hi.drain()}function ys(a){return a.site===lr}function Yi(a,n){Et(M.debug,a,n),Fe({type:be.log,message:a,status:"debug",...n})}function Vi(a,n){Fe({type:be.log,status:"error",...bs(a),...n})}function vs(a){Fe({type:be.configuration,configuration:a})}function Ss(a){Fe({type:be.usage,usage:a})}function bs(a){if(fe(a)){const n=ne(a);return{error:{kind:n.name,stack:ye(xs(n))},message:n.message}}return{error:{stack:Ii},message:`Uncaught ${me(a)}`}}function xs(a){return a.stack=a.stack.filter(n=>!n.url||us.some(o=>n.url.startsWith(o))),a}const Ge=1/0,Es=ue;let He=null;const at=new Set;function Us(){at.forEach(a=>a())}function ws({expireDelay:a,maxEntries:n}){let o=[];const d=[];He||(He=Ut(()=>Us(),Es));const c=()=>{const S=je()-a;for(;o.length>0&&o[o.length-1].endTime<S;){const U=o.pop();U&&d.push(U.startTime)}};at.add(c);function f(S,U){const e={value:S,startTime:U,endTime:Ge,remove:()=>{Ni(o,e)},close:t=>{e.endTime=t}};return n&&o.length>=n&&o.pop(),o.unshift(e),e}function u(S=Ge,U={returnInactive:!1}){for(const e of o)if(e.startTime<=S){if(U.returnInactive||S<=e.endTime)return e.value;break}}function r(S){const U=o[0];U&&U.endTime===Ge&&U.close(S)}function p(S=Ge,U=0){const e=Sn(S,U);return o.filter(t=>t.startTime<=e&&S<=t.endTime).map(t=>t.value)}function _(){return o.map(({startTime:S,endTime:U,value:e})=>({startTime:S,endTime:U===Ge?"Infinity":U,value:e}))}function g(){return d}function v(){o=[]}function E(){at.delete(c),at.size===0&&He&&(ci(He),He=null)}return{add:f,find:u,closeActive:r,findAll:p,reset:v,stop:E,getAllEntries:_,getDeletedEntries:g}}const Ts=ue,Cs=At;function As(a,n,o,d){const c=new H,f=new H,u=sr(a.sessionStoreStrategyType,a,n,o),r=ws({expireDelay:Cs});u.renewObservable.subscribe(()=>{r.add(p(),je()),c.notify()}),u.expireObservable.subscribe(()=>{f.notify(),r.closeActive(je())}),u.expandOrRenewSession(),r.add(p(),yn().relative),d.observable.subscribe(()=>{d.isGranted()?u.expandOrRenewSession():u.expire()}),Is(a,()=>{d.isGranted()&&u.expandOrRenewSession()}),Fs(a,()=>u.expandSession()),ks(a,()=>u.restartSession());function p(){return{id:u.getSession().id,trackingType:u.getSession()[n],isReplayForced:!!u.getSession().forcedReplay,anonymousId:u.getSession().anonymousId}}return{findSession:(_,g)=>r.find(_,g),renewObservable:c,expireObservable:f,sessionStateUpdateObservable:u.sessionStateUpdateObservable,expire:u.expire,updateSessionState:u.updateSessionState}}function Is(a,n){Mt(a,window,["click","touchstart","keydown","scroll"],n,{capture:!0,passive:!0})}function Fs(a,n){const o=()=>{document.visibilityState==="visible"&&n()};Se(a,document,"visibilitychange",o),Ut(o,Ts)}function ks(a,n){Se(a,window,"resume",n,{capture:!0})}function $i(a){return a>=500}function Bs(a){try{return a.clone()}catch{return}}const Ls=80*ie,Ds=32,ji=3*oi,Rs=ue,Ki=Be;function qi(a,n,o,d,c){n.transportStatus===0&&n.queuedPayloads.size()===0&&n.bandwidthMonitor.canHandle(a)?Ji(a,n,o,{onSuccess:()=>Xi(0,n,o,d,c),onFailure:()=>{n.queuedPayloads.enqueue(a),Wi(n,o,d,c)}}):n.queuedPayloads.enqueue(a)}function Wi(a,n,o,d){a.transportStatus===2&&Pe(()=>{const c=a.queuedPayloads.first();Ji(c,a,n,{onSuccess:()=>{a.queuedPayloads.dequeue(),a.currentBackoffTime=Ki,Xi(1,a,n,o,d)},onFailure:()=>{a.currentBackoffTime=Math.min(Rs,a.currentBackoffTime*2),Wi(a,n,o,d)}})},a.currentBackoffTime)}function Ji(a,n,o,{onSuccess:d,onFailure:c}){n.bandwidthMonitor.add(a),o(a,f=>{n.bandwidthMonitor.remove(a),Ps(f)?(n.transportStatus=n.bandwidthMonitor.ongoingRequestCount>0?1:2,a.retry={count:a.retry?a.retry.count+1:1,lastFailureStatus:f.status},c()):(n.transportStatus=0,d())})}function Xi(a,n,o,d,c){a===0&&n.queuedPayloads.isFull()&&!n.queueFullReported&&(c({message:`Reached max ${d} events size queued for upload: ${ji/oi}MiB`,source:J.AGENT,startClocks:ae()}),n.queueFullReported=!0);const f=n.queuedPayloads;for(n.queuedPayloads=Zi();f.size()>0;)qi(f.dequeue(),n,o,d,c)}function Ps(a){return a.type!=="opaque"&&(a.status===0&&!navigator.onLine||a.status===408||a.status===429||$i(a.status))}function Os(){return{transportStatus:0,currentBackoffTime:Ki,bandwidthMonitor:zs(),queuedPayloads:Zi(),queueFullReported:!1}}function Zi(){const a=[];return{bytesCount:0,enqueue(n){this.isFull()||(a.push(n),this.bytesCount+=n.bytesCount)},first(){return a[0]},dequeue(){const n=a.shift();return n&&(this.bytesCount-=n.bytesCount),n},size(){return a.length},isFull(){return this.bytesCount>=ji}}}function zs(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(a){return this.ongoingRequestCount===0||this.ongoingByteCount+a.bytesCount<=Ls&&this.ongoingRequestCount<Ds},add(a){this.ongoingRequestCount+=1,this.ongoingByteCount+=a.bytesCount},remove(a){this.ongoingRequestCount-=1,this.ongoingByteCount-=a.bytesCount}}}function Ms(a,n,o){const d=Os(),c=(f,u)=>Hs(a,n,f,u);return{send:f=>{qi(f,d,c,a.trackType,o)},sendOnExit:f=>{Ns(a,n,f)}}}function Ns(a,n,o){if(!!navigator.sendBeacon&&o.bytesCount<n)try{const f=a.build("beacon",o);if(navigator.sendBeacon(f,o.data))return}catch(f){Gs(f)}const c=a.build("xhr",o);Nt(c,o.data)}let Qi=!1;function Gs(a){Qi||(Qi=!0,Vi(a))}function Hs(a,n,o,d){if(Ys()&&o.bytesCount<n){const f=a.build("fetch",o);fetch(f,{method:"POST",body:o.data,keepalive:!0,mode:"cors"}).then(D(u=>d==null?void 0:d({status:u.status,type:u.type})),D(()=>{const u=a.build("xhr",o);Nt(u,o.data,d)}))}else{const f=a.build("xhr",o);Nt(f,o.data,d)}}function Ys(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function Nt(a,n,o){const d=new XMLHttpRequest;d.open("POST",a,!0),n instanceof Blob&&d.setRequestHeader("Content-Type",n.type),Se({allowUntrustedEvents:!0},d,"loadend",()=>{o==null||o({status:d.status})},{once:!0}),d.send(n)}function Gt(){const a=Vs();if(a)return{getCapabilities(){var n;return JSON.parse(((n=a.getCapabilities)===null||n===void 0?void 0:n.call(a))||"[]")},getPrivacyLevel(){var n;return(n=a.getPrivacyLevel)===null||n===void 0?void 0:n.call(a)},getAllowedWebViewHosts(){return JSON.parse(a.getAllowedWebViewHosts())},send(n,o,d){const c=d?{id:d}:void 0;a.send(JSON.stringify({eventType:n,event:o,view:c}))}}}function dt(a){var n;a===void 0&&(a=(n=de().location)===null||n===void 0?void 0:n.hostname);const o=Gt();return!!o&&o.getAllowedWebViewHosts().some(d=>a===d||a.endsWith(`.${d}`))}function Vs(){return de().DatadogEventBridge}const lt={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function $s(a){return new H(n=>{const{stop:o}=Mt(a,window,["visibilitychange","freeze"],c=>{c.type==="visibilitychange"&&document.visibilityState==="hidden"?n.notify({reason:lt.HIDDEN}):c.type==="freeze"&&n.notify({reason:lt.FROZEN})},{capture:!0}),d=Se(a,window,"beforeunload",()=>{n.notify({reason:lt.UNLOADING})}).stop;return()=>{o(),d()}})}function js(a){return Je(lt).includes(a)}function Ks({encoder:a,request:n,flushController:o,messageBytesLimit:d}){let c={};const f=o.flushObservable.subscribe(v=>g(v));function u(v,E,S){o.notifyBeforeAddMessage(E),S!==void 0?(c[S]=v,o.notifyAfterAddMessage()):a.write(a.isEmpty?v:`\n${v}`,U=>{o.notifyAfterAddMessage(U-E)})}function r(v){return v!==void 0&&c[v]!==void 0}function p(v){const E=c[v];delete c[v];const S=a.estimateEncodedBytesCount(E);o.notifyAfterRemoveMessage(S)}function _(v,E){const S=me(v),U=a.estimateEncodedBytesCount(S);if(U>=d){N.warn(`Discarded a message whose size was bigger than the maximum allowed size ${d}KB. ${Ve} ${ii}/#technical-limitations`);return}r(E)&&p(E),u(S,U,E)}function g(v){const E=Je(c).join(`\n`);c={};const S=js(v.reason),U=S?n.sendOnExit:n.send;if(S&&a.isAsync){const e=a.finishSync();e.outputBytesCount&&U(en(e));const t=[e.pendingData,E].filter(Boolean).join(`\n`);t&&U({data:t,bytesCount:xt(t)})}else E&&a.write(a.isEmpty?E:`\n${E}`),a.finish(e=>{U(en(e))})}return{flushController:o,add:_,upsert:_,stop:f.unsubscribe}}function en(a){let n;return typeof a.output=="string"?n=a.output:n=new Blob([a.output],{type:"text/plain"}),{data:n,bytesCount:a.outputBytesCount,encoding:a.encoding}}function qs({messagesLimit:a,bytesLimit:n,durationLimit:o,pageExitObservable:d,sessionExpireObservable:c}){const f=d.subscribe(U=>g(U.reason)),u=c.subscribe(()=>g("session_expire")),r=new H(()=>()=>{f.unsubscribe(),u.unsubscribe()});let p=0,_=0;function g(U){if(_===0)return;const e=_,t=p;_=0,p=0,S(),r.notify({reason:U,messagesCount:e,bytesCount:t})}let v;function E(){v===void 0&&(v=Pe(()=>{g("duration_limit")},o))}function S(){li(v),v=void 0}return{flushObservable:r,get messagesCount(){return _},notifyBeforeAddMessage(U){p+U>=n&&g("bytes_limit"),_+=1,p+=U,E()},notifyAfterAddMessage(U=0){p+=U,_>=a?g("messages_limit"):p>=n&&g("bytes_limit")},notifyAfterRemoveMessage(U){p-=U,_-=1,_===0&&S()}}}function tn(a,n,o,d,c,f,u=Ks){const r=_(a,n),p=o&&_(a,o);function _(g,{endpoint:v,encoder:E}){return u({encoder:E,request:Ms(v,g.batchBytesLimit,d),flushController:qs({messagesLimit:g.batchMessagesLimit,bytesLimit:g.batchBytesLimit,durationLimit:g.flushTimeout,pageExitObservable:c,sessionExpireObservable:f}),messageBytesLimit:g.messageBytesLimit})}return{flushObservable:r.flushController.flushObservable,add(g,v=!0){r.add(g),p&&v&&p.add(o.transformMessage?o.transformMessage(g):g)},upsert:(g,v)=>{r.upsert(g,v),p&&p.upsert(o.transformMessage?o.transformMessage(g):g,v)},stop:()=>{r.stop(),p&&p.stop()}}}function ct(){let a="",n=0;return{isAsync:!1,get isEmpty(){return!a},write(o,d){const c=xt(o);n+=c,a+=o,d&&d(c)},finish(o){o(this.finishSync())},finishSync(){const o={output:a,outputBytesCount:n,rawBytesCount:n,pendingData:""};return a="",n=0,o},estimateEncodedBytesCount(o){return o.length}}}class Ws{constructor(){this.callbacks={}}notify(n,o){const d=this.callbacks[n];d&&d.forEach(c=>c(o))}subscribe(n,o){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(o),{unsubscribe:()=>{this.callbacks[n]=this.callbacks[n].filter(d=>o!==d)}}}}function Js(a,n,o){let d=0,c=!1;return{isLimitReached(){if(d===0&&Pe(()=>{d=0},ue),d+=1,d<=n||c)return c=!1,!1;if(d===n+1){c=!0;try{o({message:`Reached max number of ${a}s by minute: ${n}`,source:J.AGENT,startClocks:ae()})}finally{c=!1}}return!0}}}let Ht;const Yt=new WeakMap;function Xs(a){return Ht||(Ht=Zs(a)),Ht}function Zs(a){return new H(n=>{const{stop:o}=ve(XMLHttpRequest.prototype,"open",Qs),{stop:d}=ve(XMLHttpRequest.prototype,"send",f=>{eo(f,a,n)},{computeHandlingStack:!0}),{stop:c}=ve(XMLHttpRequest.prototype,"abort",to);return()=>{o(),d(),c()}})}function Qs({target:a,parameters:[n,o]}){Yt.set(a,{state:"open",method:String(n).toUpperCase(),url:Bt(String(o))})}function eo({target:a,handlingStack:n},o,d){const c=Yt.get(a);if(!c)return;const f=c;f.state="start",f.startClocks=ae(),f.isAborted=!1,f.xhr=a,f.handlingStack=n;let u=!1;const{stop:r}=ve(a,"onreadystatechange",()=>{a.readyState===XMLHttpRequest.DONE&&p()}),p=()=>{if(_(),r(),u)return;u=!0;const g=c;g.state="complete",g.duration=vn(f.startClocks.timeStamp,oe()),g.status=a.status,d.notify(En(g))},{stop:_}=Se(o,a,"loadend",p);d.notify(f)}function to({target:a}){const n=Yt.get(a);n&&(n.isAborted=!0)}let Vt;function nn(){return Vt||(Vt=io()),Vt}function io(){return new H(a=>{if(!window.fetch)return;const{stop:n}=ve(window,"fetch",o=>no(o,a),{computeHandlingStack:!0});return n})}function no({parameters:a,onPostCall:n,handlingStack:o},d){const[c,f]=a;let u=f&&f.method;u===void 0&&c instanceof Request&&(u=c.method);const r=u!==void 0?String(u).toUpperCase():"GET",p=c instanceof Request?c.url:Bt(String(c)),_=ae(),g={state:"start",init:f,input:c,method:r,startClocks:_,url:p,handlingStack:o};d.notify(g),a[0]=g.input,a[1]=g.init,n(v=>ro(d,v,g))}function ro(a,n,o){const d=o;function c(f){d.state="resolve",Object.assign(d,f),a.notify(d)}n.then(D(f=>{c({response:f,responseType:f.type,status:f.status,isAborted:!1})}),D(f=>{var u,r;c({status:0,isAborted:((r=(u=d.init)===null||u===void 0?void 0:u.signal)===null||r===void 0?void 0:r.aborted)||f instanceof DOMException&&f.code===DOMException.ABORT_ERR,error:f})}))}let $t={};function so(a){const n=a.map(o=>($t[o]||($t[o]=oo(o)),$t[o]));return fi(...n)}function oo(a){return new H(n=>{const o=te[a];return te[a]=(...d)=>{o.apply(console,d);const c=rt("console error");Re(()=>{n.notify(ao(d,a,c))})},()=>{te[a]=o}})}function ao(a,n,o){const d=a.map(f=>lo(f)).join(" ");let c;if(n===M.error){const f=a.find(fe);c={stack:f?ye(ne(f)):void 0,fingerprint:ki(f),causes:f?Li(f,"console"):void 0,startClocks:ae(),message:d,source:J.CONSOLE,handling:"handled",handlingStack:o,context:Bi(f)}}return{api:n,message:d,error:c,handlingStack:o}}function lo(a){return typeof a=="string"?re(a):fe(a)?Ai(ne(a)):me(re(a),void 0,2)}function co(a){const n=zi(a)==="object";return n||N.error("Unsupported context:",a),n}function jt(a,n,o){const d={...a};for(const[c,{required:f,type:u}]of Object.entries(n))u==="string"&&c in d&&(d[c]=String(d[c])),f&&!(c in a)&&N.warn(`The property ${c} of ${o} is required; context will not be sent to the intake.`);return d}function ft(a="",{customerDataTracker:n,propertiesConfig:o={}}={}){let d={};const c=new H,f={getContext:()=>Mi(d),setContext:u=>{co(u)?(d=re(jt(u,o,a)),n==null||n.updateCustomerData(d)):f.clearContext(),c.notify()},setContextProperty:(u,r)=>{d=re(jt({...d,[u]:r},o,a)),n==null||n.updateCustomerData(d),c.notify()},removeContextProperty:u=>{delete d[u],n==null||n.updateCustomerData(d),jt(d,o,a),c.notify()},clearContext:()=>{d={},n==null||n.resetCustomerData(),c.notify()},changeObservable:c};return f}const fo="_dd_c",ho=[];function Kt(a,n,o,d){const c=uo(o,d);ho.push(Se(a,window,"storage",({key:_})=>{c===_&&u()})),n.changeObservable.subscribe(r);const f=Ie(p(),n.getContext());De(f)||n.setContext(f);function u(){n.setContext(p())}function r(){localStorage.setItem(c,JSON.stringify(n.getContext()))}function p(){const _=localStorage.getItem(c);return _?JSON.parse(_):{}}}function uo(a,n){return`${fo}_${a}_${n}`}const po=3*ie,_o=16*ie,go=200;function mo(a=2){const n=new Map;let o=!1;function d(c=0){if(o||a===0)return;const f=a===2?po:_o;let u=c;n.forEach(r=>{u+=r.getBytesCount()}),u>f&&(yo(f),o=!0)}return{createDetachedTracker:()=>{const c=rn(()=>d(c.getBytesCount()));return c},getOrCreateTracker:c=>(n.has(c)||n.set(c,rn(d)),n.get(c)),setCompressionStatus:c=>{a===0&&(a=c,d())},getCompressionStatus:()=>a,stop:()=>{n.forEach(c=>c.stop()),n.clear()}}}function rn(a){let n=0;const{throttled:o,cancel:d}=hi(f=>{n=xt(me(f)),a()},go),c=()=>{d(),n=0};return{updateCustomerData:f=>{De(f)?c():o(f)},resetCustomerData:c,getBytesCount:()=>n,stop:()=>{d()}}}function yo(a){N.warn(`Customer data exceeds the recommended ${a/ie}KiB threshold. ${Ve} ${ii}/#customer-data-exceeds-the-recommended-threshold-warning`)}function vo(a,n,o){const d=a.getReader(),c=[];let f=0;u();function u(){d.read().then(D(p=>{if(p.done){r();return}c.push(p.value),f+=p.value.length,f>o.bytesLimit?r():u()}),D(p=>n(p)))}function r(){d.cancel().catch(le);let p,_;{let g;if(c.length===1)g=c[0];else{g=new Uint8Array(f);let v=0;c.forEach(E=>{g.set(E,v),v+=E.length})}p=g.slice(0,o.bytesLimit),_=g.length>o.bytesLimit}n(void 0,p,_)}}const So="datadog-synthetics-public-id",bo="datadog-synthetics-result-id",xo="datadog-synthetics-injects-rum";function sn(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||pe(xo))}function Eo(){const a=window._DATADOG_SYNTHETICS_PUBLIC_ID||pe(So);return typeof a=="string"?a:void 0}function Uo(){const a=window._DATADOG_SYNTHETICS_RESULT_ID||pe(bo);return typeof a=="string"?a:void 0}function ht(a,n,o){const d=o.getHandler(),c=Array.isArray(d)?d:[d];return on[a]>=on[o.getLevel()]&&c.includes(n)}const B={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},on={[B.ok]:0,[B.debug]:1,[B.info]:2,[B.notice]:4,[B.warn]:5,[B.error]:6,[B.critical]:7,[B.alert]:8,[B.emerg]:9};function ut(a,{includeMessage:n=!1}={}){return{stack:a.stack,kind:a.type,message:n?a.message:void 0,causes:a.causes,fingerprint:a.fingerprint,handling:a.handling}}var wo=function(a,n,o,d){var c=arguments.length,f=c<3?n:d===null?d=Object.getOwnPropertyDescriptor(n,o):d,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(a,n,o,d);else for(var r=a.length-1;r>=0;r--)(u=a[r])&&(f=(c<3?u(f):c>3?u(n,o,f):u(n,o))||f);return c>3&&f&&Object.defineProperty(n,o,f),f};const Ye={console:"console",http:"http",silent:"silent"},To=Object.keys(B);let Q=class{constructor(n,o,d,c=Ye.http,f=B.debug,u={}){this.handleLogStrategy=n,this.handlerType=c,this.level=f,this.contextManager=ft("logger",{customerDataTracker:o}),this.contextManager.setContext(u),d&&this.contextManager.setContextProperty("logger",{name:d})}logImplementation(n,o,d=B.info,c,f){const u=re(o);let r;if(c!=null){const p=Fi({stackTrace:fe(c)?ne(c):void 0,originalError:c,nonErrorPrefix:"Provided",source:J.LOGGER,handling:"handled",startClocks:ae()});r=Ie({error:ut(p,{includeMessage:!0})},u)}else r=u;this.handleLogStrategy({message:re(n),context:r,status:d},this,f)}log(n,o,d=B.info,c){let f;ht(d,Ye.http,this)&&(f=rt("log")),this.logImplementation(n,o,d,c,f)}setContext(n){this.contextManager.setContext(n)}getContext(){return this.contextManager.getContext()}setContextProperty(n,o){this.contextManager.setContextProperty(n,o)}removeContextProperty(n){this.contextManager.removeContextProperty(n)}clearContext(){this.contextManager.clearContext()}setHandler(n){this.handlerType=n}getHandler(){return this.handlerType}setLevel(n){this.level=n}getLevel(){return this.level}};wo([Tn],Q.prototype,"logImplementation",null),Q.prototype.ok=se(B.ok),Q.prototype.debug=se(B.debug),Q.prototype.info=se(B.info),Q.prototype.notice=se(B.notice),Q.prototype.warn=se(B.warn),Q.prototype.error=se(B.error),Q.prototype.critical=se(B.critical),Q.prototype.alert=se(B.alert),Q.prototype.emerg=se(B.emerg);function se(a){return function(n,o,d){let c;ht(a,Ye.http,this)&&(c=rt("log")),this.logImplementation(n,o,a,d,c)}}function Co(a,n,o){return{view:{referrer:document.referrer,url:window.location.href},context:a.getContext(),user:n.getContext(),account:o.getContext()}}const Ao=32*ie;function Io(a){a.usePciIntake===!0&&a.site&&a.site!=="datadoghq.com"&&N.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const n=Tr(a),o=an(a.forwardConsoleLogs,Je(M),"Forward Console Logs"),d=an(a.forwardReports,Je(st),"Forward Reports");if(!(!n||!o||!d))return a.forwardErrorsToLogs&&!o.includes(M.error)&&o.push(M.error),{forwardErrorsToLogs:a.forwardErrorsToLogs!==!1,forwardConsoleLogs:o,forwardReports:d,requestErrorResponseLengthLimit:Ao,...n}}function an(a,n,o){if(a===void 0)return[];if(!(a==="all"||Array.isArray(a)&&a.every(d=>n.includes(d)))){N.error(`${o} should be "all" or an array with allowed values "${n.join(\'", "\')}"`);return}return a==="all"?n:fs(a)}function Fo(a){const n=Cr(a);return{forward_errors_to_logs:a.forwardErrorsToLogs,forward_console_logs:a.forwardConsoleLogs,forward_reports:a.forwardReports,use_pci_intake:a.usePciIntake,...n}}function ko(a,n,o){const d=Gi();let c,f;const u=n.observable.subscribe(r);function r(){if(!f||!c||!n.isGranted())return;u.unsubscribe();const p=o(c,f);d.drain(p)}return{init(p){if(!p){N.error("Missing configuration");return}if(Ar(p.enableExperimentalFeatures),dt()&&(p=Bo(p)),c=p,f){Di("DD_LOGS",p);return}const _=Io(p);_&&(f=_,nn().subscribe(le),n.tryToInit(_.trackingConsent),r())},get initConfiguration(){return c},getInternalContext:le,handleLog(p,_,g,v=a(),E=oe()){d.add(S=>S.handleLog(p,_,g,v,E))}}}function Bo(a){return{...a,clientToken:"empty"}}const qt="logs";function Lo(a){const n=mo(),o=ft("global context",{customerDataTracker:n.getOrCreateTracker(2)}),d=ft("user",{customerDataTracker:n.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),c=ft("account",{customerDataTracker:n.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),f=or();function u(){return Co(o,d,c)}let r=ko(u,f,(g,v)=>{g.storeContextsAcrossPages&&(Kt(v,o,qt,2),Kt(v,d,qt,1),Kt(v,c,qt,4));const E=a(g,v,u,f);return r=Do(g,E),E});const p={},_=new Q((...g)=>r.handleLog(...g),n.createDetachedTracker());return is({logger:_,init:D(g=>r.init(g)),setTrackingConsent:D(g=>{f.update(g),Ss({feature:"set-tracking-consent",tracking_consent:g})}),getGlobalContext:D(()=>o.getContext()),setGlobalContext:D(g=>o.setContext(g)),setGlobalContextProperty:D((g,v)=>o.setContextProperty(g,v)),removeGlobalContextProperty:D(g=>o.removeContextProperty(g)),clearGlobalContext:D(()=>o.clearContext()),createLogger:D((g,v={})=>(p[g]=new Q((...E)=>r.handleLog(...E),n.createDetachedTracker(),re(g),v.handler,v.level,re(v.context)),p[g])),getLogger:D(g=>p[g]),getInitConfiguration:D(()=>Mi(r.initConfiguration)),getInternalContext:D(g=>r.getInternalContext(g)),setUser:D(d.setContext),getUser:D(d.getContext),setUserProperty:D(d.setContextProperty),removeUserProperty:D(d.removeContextProperty),clearUser:D(d.clearContext),setAccount:D(c.setContext),getAccount:D(c.getContext),setAccountProperty:D(c.setContextProperty),removeAccountProperty:D(c.removeContextProperty),clearAccount:D(c.clearContext)})}function Do(a,n){return{init:o=>{Di("DD_LOGS",o)},initConfiguration:a,...n}}const Ro="logs";function Po(a,n){const o=As(a,Ro,d=>zo(a,d),n);return{findTrackedSession:(d,c={returnInactive:!1})=>{const f=o.findSession(d,c);return f&&f.trackingType==="1"?{id:f.id,anonymousId:f.anonymousId}:void 0},expireObservable:o.expireObservable}}function Oo(a){const o=dn(a)==="1"?{}:void 0;return{findTrackedSession:()=>o,expireObservable:new H}}function dn(a){return $e(a.sessionSampleRate)?"1":"0"}function zo(a,n){const o=Mo(n)?n:dn(a);return{trackingType:o,isTracked:o==="1"}}function Mo(a){return a==="0"||a==="1"}let ln=!1;function pt(a){const n=window;if(sn()){const d=o(n.DD_RUM_SYNTHETICS);return!d&&!ln&&(ln=!0,Yi("Logs sent before RUM is injected by the synthetics worker",{testId:Eo(),resultId:Uo()})),d}return o(n.DD_RUM);function o(d){if(d&&d.getInternalContext)return d.getInternalContext(a)}}function No(a,n,o,d,c){const f=To.concat(["custom"]),u={};f.forEach(r=>{u[r]=Js(r,n.eventRateLimiterThreshold,c)}),o.subscribe(0,({rawLogsEvent:r,messageContext:p=void 0,savedCommonContext:_=void 0,domainContext:g})=>{var v,E;const S=bn(r.date),U=a.findTrackedSession(S);if(!a.findTrackedSession(S,{returnInactive:!0}))return;const t=_||d();let s;!De(t.account)&&t.account.id&&(s=t.account),U&&U.anonymousId&&!t.user.anonymous_id&&(t.user.anonymous_id=U.anonymousId);const l=Ie({service:n.service,session_id:U?U.id:void 0,session:U?{id:U.id}:void 0,usr:De(t.user)?void 0:t.user,account:s,view:t.view},t.context,pt(S),r,p);((v=n.beforeSend)===null||v===void 0?void 0:v.call(n,l,g))===!1||l.origin!==J.AGENT&&((E=u[l.status])!==null&&E!==void 0?E:u.custom).isLimitReached()||o.notify(1,l)})}const Go={[M.log]:B.info,[M.debug]:B.debug,[M.info]:B.info,[M.warn]:B.warn,[M.error]:B.error};function Ho(a,n){const o=so(a.forwardConsoleLogs).subscribe(d=>{var c;const f={rawLogsEvent:{date:oe(),message:d.message,origin:J.CONSOLE,error:d.error&&ut(d.error),status:Go[d.api]},messageContext:(c=d.error)===null||c===void 0?void 0:c.context,domainContext:{handlingStack:d.handlingStack}};n.notify(0,f)});return{stop:()=>{o.unsubscribe()}}}function Yo(a,n){const o=rs(a,a.forwardReports).subscribe(d=>{let c=d.message,f;const u=d.originalError.type==="deprecation"?B.warn:B.error;u===B.error?f=ut(d):d.stack&&(c+=` Found in ${Zr(d.stack)}`),n.notify(0,{rawLogsEvent:{date:oe(),message:c,origin:J.REPORT,error:f,status:u}})});return{stop:()=>{o.unsubscribe()}}}function Vo(a,n){if(!a.forwardErrorsToLogs)return{stop:le};const o=Xs(a).subscribe(f=>{f.state==="complete"&&c("xhr",f)}),d=nn().subscribe(f=>{f.state==="resolve"&&c("fetch",f)});function c(f,u){!Ur(u.url)&&(qo(u)||$i(u.status))&&("xhr"in u?$o(u.xhr,a,r):u.response?Ko(u.response,a,r):u.error&&jo(u.error,a,r));function r(p){const _={isAborted:u.isAborted,handlingStack:u.handlingStack};n.notify(0,{rawLogsEvent:{message:`${Wo(f)} error ${u.method} ${u.url}`,date:u.startClocks.timeStamp,error:{stack:p||"Failed to load",handling:void 0},http:{method:u.method,status_code:u.status,url:u.url},status:B.error,origin:J.NETWORK},domainContext:_})}}return{stop:()=>{o.unsubscribe(),d.unsubscribe()}}}function $o(a,n,o){typeof a.response=="string"?o(Wt(a.response,n)):o(a.response)}function jo(a,n,o){o(Wt(ye(ne(a)),n))}function Ko(a,n,o){const d=Bs(a);!d||!d.body?o():window.TextDecoder?Jo(d.body,n.requestErrorResponseLengthLimit,(c,f)=>{o(c?`Unable to retrieve response: ${c}`:f)}):d.text().then(D(c=>o(Wt(c,n))),D(c=>o(`Unable to retrieve response: ${c}`)))}function qo(a){return a.status===0&&a.responseType!=="opaque"}function Wt(a,n){return a.length>n.requestErrorResponseLengthLimit?`${a.substring(0,n.requestErrorResponseLengthLimit)}...`:a}function Wo(a){return a==="xhr"?"XHR":"Fetch"}function Jo(a,n,o){vo(a,(d,c,f)=>{if(d)o(d);else{let u=new TextDecoder().decode(c);f&&(u+="..."),o(void 0,u)}},{bytesLimit:n,collectStreamBody:!0})}function Xo(a,n){if(!a.forwardErrorsToLogs)return{stop:le};const o=new H,{stop:d}=Qr(o),c=o.subscribe(f=>{n.notify(0,{rawLogsEvent:{message:f.message,date:f.startClocks.timeStamp,error:ut(f),origin:J.SOURCE,status:B.error},messageContext:f.context})});return{stop:()=>{d(),c.unsubscribe()}}}const Zo=Ws;function Qo(a){function n(o,d,c,f,u){const r=Ie(d.getContext(),o.context);if(ht(o.status,Ye.console,d)&&ta(o,r),ht(o.status,Ye.http,d)){const p={rawLogsEvent:{date:u||oe(),message:o.message,status:o.status,origin:J.LOGGER},messageContext:r,savedCommonContext:f};c&&(p.domainContext={handlingStack:c}),a.notify(0,p)}}return{handleLog:n}}const ea={[B.ok]:M.debug,[B.debug]:M.debug,[B.info]:M.info,[B.notice]:M.info,[B.warn]:M.warn,[B.error]:M.error,[B.critical]:M.error,[B.alert]:M.error,[B.emerg]:M.error};function ta({status:a,message:n},o){he[ea[a]].call(te,n,o)}function ia(a,n,o,d,c){const f=tn(a,{endpoint:a.logsEndpointBuilder,encoder:ct()},a.replica&&{endpoint:a.replica.logsEndpointBuilder,encoder:ct()},o,d,c.expireObservable);return n.subscribe(1,u=>{f.add(u)}),f}function na(a){const n=Gt();a.subscribe(1,o=>{n.send("log",o)})}function ra(a){return{get:n=>{const o=a.findTrackedSession(n);if(o)return{session_id:o.id}}}}function sa(a){return n=>{a.notify(0,{rawLogsEvent:{message:n.message,date:n.startClocks.timeStamp,origin:J.AGENT,status:B.error}}),Yi("Error reported to customer",{"error.message":n.message})}}function oa(a,n,o,d,c){const f=_s("browser-logs-sdk",n);f.setContextProvider(()=>{var r,p,_,g,v,E;return{application:{id:(r=pt())===null||r===void 0?void 0:r.application_id},session:{id:(p=c.findTrackedSession())===null||p===void 0?void 0:p.id},view:{id:(g=(_=pt())===null||_===void 0?void 0:_.view)===null||g===void 0?void 0:g.id},action:{id:(E=(v=pt())===null||v===void 0?void 0:v.user_action)===null||E===void 0?void 0:E.id}}});const u=[];if(dt()){const r=Gt(),p=f.observable.subscribe(_=>r.send("internal_telemetry",_));u.push(()=>p.unsubscribe())}else{const r=tn(n,{endpoint:n.rumEndpointBuilder,encoder:ct()},n.replica&&{endpoint:n.replica.rumEndpointBuilder,encoder:ct()},o,d,c.expireObservable);u.push(()=>r.stop());const p=f.observable.subscribe(_=>r.add(_,ys(n)));u.push(()=>p.unsubscribe())}return ms(),vs(Fo(a)),{telemetry:f,stop:()=>{u.forEach(r=>r())}}}function aa(a,n,o,d){const c=new Zo,f=[];c.subscribe(1,E=>Oi("logs",E));const u=sa(c),r=$s(n),p=n.sessionStoreStrategyType&&!dt()&&!sn()?Po(n,d):Oo(n),{stop:_}=oa(a,n,u,r,p);f.push(()=>_()),Vo(n,c),Xo(n,c),Ho(n,c),Yo(n,c);const{handleLog:g}=Qo(c);if(No(p,n,c,o,u),dt())na(c);else{const{stop:E}=ia(n,c,u,r,p);f.push(()=>E())}const v=ra(p);return{handleLog:g,getInternalContext:v.get,stop:()=>{f.forEach(E=>E())}}}const xe=Lo(aa);ns(de(),"DD_LOGS",xe);const I=class I{constructor(n){this.listenerMap=new Map,I.options=n,this.isLoggingOn=n.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&xe.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const o="bb_logger_mac_uuid";let d=localStorage.getItem(o);d||(d=crypto.randomUUID(),localStorage.setItem(o,d)),I.tracking.mac=d,I.tracking.dev=`${n.platform}_${n.browserName}`,I.beatHandle||(I.options&&k(I.options,"Logger")&&console.log("[Logger] Starting tracking beat"),I.beatHandle=window.setInterval(I.flushTracking,15e3))}static setMessagePort(n){this.messagePort=n}static getMessagePort(){return this.messagePort}setLoggingOn(n){this.isLoggingOn=n}addEventListener(n,o){const d=c=>o(c);this.listenerMap.set(o,{eventName:n,wrappedListener:d}),this.eventTarget.addEventListener(n,d)}removeEventListener(n,o){const d=this.listenerMap.get(o);d&&d.eventName===n&&(this.eventTarget.removeEventListener(n,d.wrappedListener),this.listenerMap.delete(o))}removeAllEventListeners(){for(const[n,{eventName:o,wrappedListener:d}]of this.listenerMap)this.eventTarget.removeEventListener(o,d);this.listenerMap.clear()}setAttributes(n){I.processAttributes(n);for(const o in n)xe.logger.setContextProperty(o,n[o])}info(n,o){n==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(o==null?void 0:o.url)||""}),n==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(o==null?void 0:o.isEnabled)??!0}),n==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",o),n==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",o),n==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",o),o&&I.processAttributes(o),this.isLoggingOn&&(xe.logger.info(n,o),I.options&&k(I.options,"Logger")&&console.log("[Logger] Sending info: ",n))}error(n,o){this.emit("mediaSessionDidError",{message:n,...o||{}}),o&&I.processAttributes(o),this.isLoggingOn&&(xe.logger.error(n,o),I.tracking.err_time=Date.now().toFixed(0),I.tracking.err_desc=n+(o?` - ${JSON.stringify(o)}`:""),I.options&&k(I.options,"Logger")&&console.log("[Logger] Sending error: ",n))}criticalError(n,o){this.emit("mediaSessionDidFailOnError",{message:n,...o||{}}),o&&I.processAttributes(o),this.isLoggingOn&&(xe.logger.error(n,o),I.tracking.err_time=Date.now().toFixed(0),I.tracking.err_desc=n+(o?` - ${JSON.stringify(o)}`:""),I.options&&k(I.options,"Logger")&&console.log("[Logger] Sending critical error: ",n))}warn(n,o){o&&I.processAttributes(o),this.isLoggingOn&&(xe.logger.warn(n,o),I.options&&k(I.options,"Logger")&&console.log("[Logger] Sending warn: ",n))}handleMessageFromWorker(n){n.actionType==="INFO"?this.info(n.message,n.attributes):n.actionType==="ERROR"?this.error(n.message,n.attributes):n.actionType==="CRITICAL_ERROR"?this.criticalError(n.message,n.attributes):n.actionType==="WARN"?this.warn(n.message,n.attributes):n.actionType==="SET_ATTRIBUTES"&&n.attributes&&this.setAttributes(n.attributes)}static setAttributes(n){if(!I.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{I.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:n})}catch(o){console.error("[Logger] Error posting message:",o)}}static info(n,o){I.messagePort.postMessage({type:"LOG",actionType:"INFO",message:n,attributes:o})}static error(n,o){I.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:n,attributes:o})}static warn(n,o){I.messagePort.postMessage({type:"LOG",actionType:"WARN",message:n,attributes:o})}static criticalError(n,o){I.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:n,attributes:o})}static processAttributes(n){if(n.player_version&&(I.tracking.sdk=n.player_version),n.media_id&&(I.tracking.gid=n.media_id),n.game_id&&(I.tracking.buc=n.game_id),n.bb_session_id&&(I.tracking.sid=n.bb_session_id,I.options&&k(I.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",I.tracking.sid)),n.last_timecode){const d=O.fromStr(n.last_timecode);I.tracking.tc=d.print(),I.lastTimecodeMillis=d.totalMilliseconds(59.94),I.lastTimecodeMillis&&I.lastZipMillis&&(I.tracking.cache=(I.lastZipMillis-I.lastTimecodeMillis).toFixed(0))}n.last_offset&&(I.tracking.off=n.last_offset),n.last_loading_zip&&(I.tracking.zip=n.last_loading_zip+".zip",I.lastZipMillis=O.fromStr(n.last_loading_zip).totalMilliseconds(59.94),I.lastTimecodeMillis&&I.lastZipMillis&&(I.tracking.cache=(I.lastZipMillis-I.lastTimecodeMillis).toFixed(0))),n.last_rendered_frame&&(I.tracking.aug_time=Date.now().toFixed(0)),n.asset&&(I.tracking.asset=n.asset)}static objectToQuery(n){return Object.entries(n).filter(([o,d])=>d!==0&&d!=="").map(([o,d])=>`${encodeURIComponent(o)}=${encodeURIComponent(String(d))}`).join("&")}emit(n,o){const d=new CustomEvent(n,{detail:o});this.eventTarget.dispatchEvent(d)}};I.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},I.lastTimecodeMillis=0,I.lastZipMillis=0,I.flushTracking=()=>{const n=Date.now().toFixed(0);I.tracking.now=n;const d=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${I.objectToQuery(I.tracking)}&platform=Web`;I.options&&k(I.options,"Logger")&&console.log("[Logger] Flushing tracking data:",d),fetch(d,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),I.tracking.err_desc="",I.tracking.err_time=""};let z=I;class Jt{constructor(n,o,d){this.videoDecoder=null,this.reservedVideoDecoder=null,this.videoDecoderNeedsKeyFrame=!1,this.reservedVideoDecoderNeedsKeyFrame=!1,this.currentTimecode="",this.fps=0,this.unchunkedJobs=[],this.jobChunking=null,this.jobsQueue=[],this.chunksQueue=[],this.chunksForDecodingFrames=[],this.processedMetadata=[],this.alphaFramesQueue=[],this.lastJobEndTimecode=0,this.lastProcessedFrameTimecode=0,this.storedFrames=[],this.videoDecoderConfigured=!1,this.reservedVideoDecoderConfigured=!1,this.timecodeErrorCount=0,this.decoderStopped=!1,this.chunkCount=0,this.chunkingTimeSum=0,this.avgChunkingTime=0,this.decodingFrameCount=0,this.decodingTimeSum=0,this.avgDecodingTime=0,this.lastPerformanceCheck=performance.now(),this.loggerTimeoutStart=0,this.loggerTimeout=1e4,this.lastStatusUpdate=0,this.STATUS_UPDATE_INTERVAL=200,this.lastDecoderStatus={healthy:!0,issue:""},this.lastTimecodeStatus={consistent:!0,errorCount:0},this.addJob=(c,f)=>{if(this.decoderStopped)return;if(this.options.MASK_TYPE==="alpha"){this.queueAlphaJob(c,f);return}const{alphaMp4:u,metadataList:r}=this.parseZipAndMetadata(f,c);if(!u){this.options&&k(this.options,"Decoder")&&console.log("[Decoder] No alpha.mp4 found, no decoding needed.");return}const p={timeCode:c,alphaMp4:u,metadata:r,chunks:[],totalFrameCount:r.length,framesProcessed:0,framesSentToDecoder:0,useReserveDecoder:r.length<3,chunkingTime:0};this.jobChunking?this.unchunkedJobs.push(p):(this.jobChunking=p,this.chunkJob(p)),this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Added job:",p)},this.queueAlphaJob=(c,f)=>{const{metadataList:u,alphaFiles:r}=this.parseAlphaZip(f,c);for(const p of u)this.alphaFramesQueue.push({timeCode:p.timecode,metadata:p,alphaFiles:r,composited:!1});this.options&&k(this.options,"Decoder")&&console.log(`[Decoder] Queued ${u.length} alpha frames for ${c}`)},this.compositeUpcomingAlphaFrames=async()=>{if(!this.currentTimecode)return;const c=O.fromStr(this.currentTimecode).totalMilliseconds(this.fps),f=c+this.options.DECODER_LEAD_TIME_MILLIS,u=this.alphaFramesQueue.filter(r=>{const p=O.fromStr(r.timeCode).totalMilliseconds(this.fps);return p>=c&&p<=f&&!r.composited}).sort((r,p)=>{const _=O.fromStr(r.timeCode).totalMilliseconds(this.fps),g=O.fromStr(p.timeCode).totalMilliseconds(this.fps);return _-g}).slice(0,this.options.DECODER_FRAME_BATCH_SIZE);for(const r of u){if(this.decoderStopped)break;try{const p=await this.compositeAlphaMasks(r.metadata,r.alphaFiles);p&&(r.metadata.alphaMask=p),this.processedMetadata.push(r.metadata),z.setAttributes({last_decoded_frame:r.metadata.timecode})}catch(p){this.options&&k(this.options,"Errors")&&console.error("[Decoder] Alpha composite failed:",r.timeCode,p)}finally{r.composited=!0}}this.processedMetadata.length>0&&(this.postBatchToRenderer(this.processedMetadata),this.processedMetadata.forEach(r=>{if(r.alphaMask)try{r.alphaMask.close()}catch{}}),this.processedMetadata=[])},this.parseAlphaZip=(c,f)=>{const u=ti.parse(c),r=Object.keys(u).filter(_=>_.endsWith(".json")).sort(this.numericFileComparator).map(_=>{const g=JSON.parse(new TextDecoder().decode(u[_]));return g.timecode=O.toStr(O.fromMetadata(g)),g}),p=new Map;return Object.keys(u).filter(_=>_.endsWith(".alpha")).forEach(_=>{p.set(_,u[_])}),this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Alpha ZIP",f,"metadata=",r.length,"alphaFiles=",p.size),{metadataList:r,alphaFiles:p}},this.compositeAlphaMasks=async(c,f)=>{const{processingWidth:u,processingHeight:r,placeholders:p,timecode:_}=c;if(!p||Object.keys(p).length===0)return null;const g=new Uint8ClampedArray(u*r*4);let v=_.replace(/:/g,"_");v=v.replace(/_([01])$/,".$1");for(const[S,U]of Object.entries(p)){const e=`${v}_${S}.alpha`;let t;for(const[y,b]of f)if(y===e){t=b;break}if(!t){this.options&&k(this.options,"Decoder")&&console.log(`[Decoder] No alpha file found for placeholder ${S} (expected: ${e})`);continue}const{maskX:s,maskY:l,width:h,height:m}=U;if(t.length!==h*m){this.options&&k(this.options,"Errors")&&console.error(`[Decoder] Alpha data size mismatch for ${S}: expected ${h*m}, got ${t.length}`);continue}for(let y=0;y<m;y++)for(let b=0;b<h;b++){const x=y*h+b,w=s+b,T=l+y;if(w>=u||T>=r||w<0||T<0)continue;const C=(T*u+w)*4,F=t[x];g[C]=F,g[C+1]=F,g[C+2]=F,g[C+3]=F}}const E=new ImageData(g,u,r);return createImageBitmap(E)},this.clearOldJobsAndChunks=c=>{const u=O.fromStr(this.currentTimecode).totalMilliseconds(this.fps)-c;this.unchunkedJobs=this.unchunkedJobs.filter(r=>O.fromStr(r.timeCode).totalMilliseconds(this.fps)>u),this.jobsQueue=this.jobsQueue.filter(r=>O.fromStr(r.timeCode).totalMilliseconds(this.fps)>u),this.chunksQueue=this.chunksQueue.filter(r=>O.fromStr(r.timeCode).totalMilliseconds(this.fps)>u),this.alphaFramesQueue=this.alphaFramesQueue.filter(r=>O.fromStr(r.timeCode).totalMilliseconds(this.fps)>u)},this.clearAllJobsAndChunks=()=>{this.unchunkedJobs=[],this.jobsQueue=[],this.chunksQueue=[],this.alphaFramesQueue=[]},this.updateCurrentTimecode=(c,f)=>{if(!this.decoderStopped&&this.options){if(this.fps=59.94,this.currentTimecode){const u=O.fromStr(c).totalMilliseconds(this.fps),r=O.fromStr(this.currentTimecode).totalMilliseconds(this.fps);if(u<r||u>r+this.options.DECODER_LEAD_TIME_MILLIS){this.timecodeErrorCount++,this.updateStatus();const p=performance.now();if(u<r&&(p-this.loggerTimeoutStart>this.loggerTimeout&&(this.loggerTimeoutStart=p,z.error("[Decoder] Timecode is going backwards")),this.options&&k(this.options,"Errors")&&console.error("[Decoder] Timecode is going backwards")),u>r+this.options.DECODER_LEAD_TIME_MILLIS&&(p-this.loggerTimeoutStart>this.loggerTimeout&&(this.loggerTimeoutStart=p,z.error("[Decoder] Timecode is too far ahead")),this.options&&k(this.options,"Errors")&&console.error("[Decoder] Timecode is too far ahead")),this.timecodeErrorCount>5&&!this.options.BURNED_TIMECODES_MODE&&this.restartDecoder(),!this.options.BURNED_TIMECODES_MODE)return}}this.timecodeErrorCount=0,this.currentTimecode=c,this.clearOldJobsAndChunks(2100),this.options.MASK_TYPE==="alpha"?this.compositeUpcomingAlphaFrames():this.decodeUpcomingChunks(),this.updateStatus()}},this.setupMP4Box=(c=!1)=>{const f=hn.createFile();return f.onError=u=>{z.error("[Decoder] MP4 parsing error",u),this.options&&k(this.options,"Errors")&&console.error("[Decoder] MP4 parsing error:",u)},f.onReady=u=>{const r=u.tracks.find(p=>p.type==="video");if(r){if(!(c?this.reservedVideoDecoderConfigured:this.videoDecoderConfigured)){this.options&&k(this.options,"Decoder")&&console.error("[Decoder] Starting a new VideoDecoder");let _;c?(this.reservedVideoDecoder=new VideoDecoder({output:this.onFrameDecoded,error:this.onDecoderError}),_=this.reservedVideoDecoder):(this.videoDecoder=new VideoDecoder({output:this.onFrameDecoded,error:this.onDecoderError}),_=this.videoDecoder),_.configure({codec:r.codec,codedWidth:r.video.width,codedHeight:r.video.height,description:this.getDescription(f.getTrackById(r.id)),hardwareAcceleration:"prefer-hardware",optimizeForLatency:!0}),c?(this.reservedVideoDecoderConfigured=!0,this.reservedVideoDecoderNeedsKeyFrame=!0):(this.videoDecoderConfigured=!0,this.videoDecoderNeedsKeyFrame=!0,this.updateStatus())}f.setExtractionOptions(r.id),f.start()}},f.onSamples=async(u,r,p)=>{var E;const _=[];let g=0,v=0;if(this.options&&k(this.options,"Decoder")&&console.log("[Decoder] onSamples for job",(E=this.jobChunking)==null?void 0:E.timeCode,"samples=",p.length),this.options.browserName==="Firefox"){const S=p.map(e=>e.cts).sort((e,t)=>e-t);g=200-S[0],v=S[S.length-1]+g}for(const S of p){const U=this.options.browserName==="Firefox"?S.cts+this.lastJobEndTimecode+g:S.cts,e=new EncodedVideoChunk({type:S.is_sync?"key":"delta",timestamp:U,data:new Uint8Array(S.data)});_.push(e)}this.storeChunks(_),this.options.browserName==="Firefox"&&(this.lastJobEndTimecode+=v)},f},this.chunkJob=async c=>{c.chunkingTime=performance.now(),this.mp4boxfile=this.setupMP4Box(c.useReserveDecoder);const u=await new Blob([c.alphaMp4],{type:"video/mp4"}).arrayBuffer();u.fileStart=0,this.mp4boxfile.appendBuffer(u)},this.storeChunks=c=>{var r;this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Storing chunks:",c);const f=this.jobChunking;if(c.length!==f.metadata.length){const p=f.metadata.filter(_=>_.placeholders||_.LED&&_.LED.cubePlaceholders);p.length==c.length&&(f.metadata=p)}if(this.options&&k(this.options,"Errors")&&c.length!==f.metadata.length){const p=f.metadata.findIndex((_,g)=>!c[g]);console.error("[Decoder] MISMATCH: first undefined chunk at index",p)}if((r=this.options.debug)!=null&&r.trackPerformance&&(f.chunkingTime=performance.now()-f.chunkingTime,this.chunkCount++,this.chunkingTimeSum+=f.chunkingTime,this.avgChunkingTime=this.chunkingTimeSum/this.chunkCount),this.unchunkedJobs.length>0){const p=this.unchunkedJobs.shift();this.jobChunking=p,this.chunkJob(p)}else this.jobChunking=null;const u=f==null?void 0:f.metadata.map((p,_)=>({timeCode:p.timecode,chunk:c[_],metadata:p,job:f,cancelled:!1,decodingTime:0}));f.chunks=u,this.chunksQueue.push(...u),this.jobsQueue.push(f),this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Jobs Queue:",this.jobsQueue),this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Chunks Queue:",this.chunksQueue)},this.onFrameDecoded=c=>{var p;let f=0;if(this.options.browserName==="Firefox"){f=this.lastProcessedFrameTimecode+200;const _=c.timestamp;if(_!==f){if(this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Frame out of order, storing frame:",_),this.storedFrames.push(c),this.storedFrames.sort((g,v)=>g.timestamp-v.timestamp),this.storedFrames[0].timestamp===f){const g=this.storedFrames.shift();g&&this.onFrameDecoded(g)}this.storedFrames.sort((g,v)=>g.timestamp-v.timestamp);return}this.lastProcessedFrameTimecode=_}this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Frame decoded:",c);const u=this.chunksForDecodingFrames.shift();if(!u){z.error("[Decoder] No current chunk for a processed frame"),this.options&&k(this.options,"Errors")&&console.error("[Decoder] No current chunk for a processed frame");return}if(u.cancelled||this.decoderStopped){this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Skipping cancelled chunk:",u.timeCode),c.close();return}const r=u.metadata;if((p=this.options.debug)!=null&&p.trackPerformance){const _=performance.now();u.decodingTime=_-u.decodingTime,this.decodingFrameCount++,this.decodingTimeSum+=u.decodingTime,this.avgDecodingTime=this.decodingTimeSum/this.decodingFrameCount,_-this.lastPerformanceCheck>=this.options.PERFORMANCE_TRACKING_INTERVAL&&(this.trackPerformance(),this.lastPerformanceCheck=_)}if(u.job.framesProcessed++,r.alphaMask=c,this.processedMetadata.push(r),z.setAttributes({last_decoded_frame:r.timecode}),(this.processedMetadata.length>=this.options.DECODER_FRAME_BATCH_SIZE||u.job.framesProcessed>=u.job.totalFrameCount)&&(this.postBatchToRenderer(this.processedMetadata),this.processedMetadata.forEach(_=>_.alphaMask.close()),this.processedMetadata=[]),this.options.browserName==="Firefox"&&this.storedFrames.length>0){const _=(f+200)%24200||400;if(this.storedFrames[0].timestamp===_){const g=this.storedFrames.shift();g&&this.onFrameDecoded(g)}}},this.onDecoderError=c=>{var r,p;z.error("[Decoder] VideoDecoder error",c),this.options&&k(this.options,"Errors")&&console.error("[Decoder] VideoDecoder error:",c),this.videoDecoderConfigured=!1,this.reservedVideoDecoderConfigured=!1,this.videoDecoderNeedsKeyFrame=!0,this.reservedVideoDecoderNeedsKeyFrame=!0,this.updateStatus();const f=this.chunksForDecodingFrames.shift();if(!f){z.error("[Decoder] No broken chunk for an error"),this.options&&k(this.options,"Errors")&&console.error("[Decoder] No broken chunk for an error");return}const u=f.job;u&&u.chunks.forEach(_=>_.cancelled=!0),(r=this.reservedVideoDecoder)==null||r.close(),(p=this.videoDecoder)==null||p.close()},this.parseZipAndMetadata=(c,f)=>{var e;const u=ti.parse(c),r=((e=u["alpha.mp4"])==null?void 0:e.buffer)||null,p=Object.keys(u).filter(t=>t.endsWith(".json")).sort(this.numericFileComparator).map(t=>{const s=JSON.parse(new TextDecoder().decode(u[t]));return s.timecode=O.toStr(O.fromMetadata(s)),s}),_=p.length;let g=120;const[v,E,S]=f.split("_").map(Number);E%10===0&&S===0?g=120:S===0&&(g=116),_!==g&&(z.error("[Decoder] Metadata count mismatch",{expected:g,actual:_,timecode:f}),this.options&&k(this.options,"Errors")&&console.error("[Decoder] Metadata count mismatch:",{expected:g,actual:_,timecode:f}));const U=p;return this.options&&k(this.options,"Decoder")&&console.log("[Decoder] ZIP",f,"metadataFull=",p.length,"metadataFiltered=",U.length),{alphaMp4:r,metadataList:U}},this.numericFileComparator=(c,f)=>{const u=/^(\\d{2})_(\\d{2})_(\\d{2})_(\\d{2})(?:\\.(\\d+))?\\.(.+)$/,r=c.match(u),p=f.match(u);if(!r||!p)return 0;const[,_,g,v,E,S="0",U]=r,[,e,t,s,l,h="0",m]=p;return parseInt(_,10)-parseInt(e,10)||parseInt(g,10)-parseInt(t,10)||parseInt(v,10)-parseInt(s,10)||parseInt(E,10)-parseInt(l,10)||parseInt(S,10)-parseInt(h,10)||U.localeCompare(m)},this.getDescription=c=>{for(const f of c.mdia.minf.stbl.stsd.entries){const u=f.avcC||f.hvcC||f.vpcC||f.av1C;if(u){const r=new yt.DataStream(void 0,0,yt.DataStream.BIG_ENDIAN);return u.write(r),new Uint8Array(r.buffer,8)}}return null},this.trackPerformance=()=>{const c=this.getAvgChunkingTime(),f=this.getAvgDecodingTime();ca([{metric:"Chunking time",value:c},{metric:"Decoding time",value:f}])},this.postBatchToRenderer=n,this.restartDecoder=o,this.options=d,this.mp4boxfile=this.setupMP4Box()}isStopped(){return this.decoderStopped}updateStatus(){const n=performance.now();if(n-this.lastStatusUpdate<this.STATUS_UPDATE_INTERVAL)return;const o={healthy:this.videoDecoderConfigured&&!this.decoderStopped,issue:this.videoDecoderConfigured?this.decoderStopped?"Stopped":"":"Not configured"},d={consistent:this.timecodeErrorCount<=3,errorCount:this.timecodeErrorCount};(JSON.stringify(o)!==JSON.stringify(this.lastDecoderStatus)||JSON.stringify(d)!==JSON.stringify(this.lastTimecodeStatus))&&(z.setAttributes({decoder_status:o,timecode_status:d}),this.lastDecoderStatus=o,this.lastTimecodeStatus=d,this.lastStatusUpdate=n)}decodeUpcomingChunks(){const n=O.fromStr(this.currentTimecode).totalMilliseconds(this.fps),o=n+this.options.DECODER_LEAD_TIME_MILLIS,d=this.chunksQueue.filter(f=>{const u=O.fromStr(f.timeCode).totalMilliseconds(this.fps);return u>=n&&u<=o&&!f.decoded});d.sort((f,u)=>{const r=O.fromStr(f.timeCode).totalMilliseconds(this.fps),p=O.fromStr(u.timeCode).totalMilliseconds(this.fps);return r-p});const c=d.slice(0,this.options.DECODER_FRAME_BATCH_SIZE);for(const f of c){if(f.cancelled){this.options&&k(this.options,"Decoder")&&console.log("[Decoder] Skipping cancelled chunk:",f.timeCode);continue}const u=f.job.useReserveDecoder?this.reservedVideoDecoder:this.videoDecoder;if(!u||u.state==="closed"){z.error("[Decoder] No VideoDecoder available"),this.options&&k(this.options,"Errors")&&console.error("[Decoder] No VideoDecoder available");continue}if((f.job.useReserveDecoder?this.reservedVideoDecoderNeedsKeyFrame:this.videoDecoderNeedsKeyFrame)&&f.chunk.type==="delta"){z.error("[Decoder] Decoder needs a key frame, skipping delta chunk",{chunkTimeCode:f.timeCode}),this.options&&k(this.options,"Errors")&&console.error("[Decoder] Decoder needs a key frame, skipping delta chunk:",f.timeCode),f.decoded=!0;continue}try{this.chunksForDecodingFrames.push(f),f.chunk.type==="key"&&(f.job.useReserveDecoder?this.reservedVideoDecoderNeedsKeyFrame=!1:this.videoDecoderNeedsKeyFrame=!1),f.decodingTime=performance.now(),u.decode(f.chunk)}catch(p){z.error("[Decoder] Error decoding chunk",p),this.options&&k(this.options,"Errors")&&console.error("[Decoder] Error decoding chunk:",p),this.videoDecoderConfigured=!1,this.reservedVideoDecoderConfigured=!1,this.videoDecoderNeedsKeyFrame=!0,this.updateStatus(),this.reservedVideoDecoderNeedsKeyFrame=!0,f.job.chunks.forEach(g=>g.cancelled=!0),u.close()}finally{if(f.decoded=!0,f.job.framesSentToDecoder++,f.job.framesSentToDecoder>=f.job.totalFrameCount){u.flush(),f.job.useReserveDecoder;continue}}}}getAvgChunkingTime(){var n;if((n=this.options.debug)!=null&&n.trackPerformance){const o=this.avgChunkingTime;return this.chunkCount=0,this.chunkingTimeSum=0,this.avgChunkingTime=0,o}return 0}getAvgDecodingTime(){var n;if((n=this.options.debug)!=null&&n.trackPerformance){const o=this.avgDecodingTime;return this.decodingFrameCount=0,this.decodingTimeSum=0,this.avgDecodingTime=0,o}return 0}stop(){var n,o;this.decoderStopped=!0,this.updateStatus(),this.clearAllJobsAndChunks();try{(n=this.videoDecoder)==null||n.close()}catch(d){z.error("[Decoder] Error closing main VideoDecoder",d),this.options&&k(this.options,"Errors")&&console.error("[Decoder] Error closing main VideoDecoder:",d)}try{(o=this.reservedVideoDecoder)==null||o.close()}catch(d){z.error("[Decoder] Error closing reserved VideoDecoder",d),this.options&&k(this.options,"Errors")&&console.error("[Decoder] Error closing reserved VideoDecoder:",d)}}}let cn=null,_t=null,X,Y;self.onmessage=async a=>{const{data:n}=a;if(n.type==="SET_LOGGER_PORT"&&z.setMessagePort(n.port),n.type==="SET_DOWNLOADER_PORT"&&(cn=n.port,cn.onmessage=da),n.type==="SET_RENDERER_PORT"&&(_t=n.port,_t.onmessage=la),n.type==="SET_OPTIONS"&&(Y=n.options,z.setMessagePort(self),X=new Jt(Xt,gt,Y)),n.type==="STOP_WORKER"){X&&X.stop();return}if(n.type==="RESTART_WORKER"){if(!Y)return;gt();return}};function da(a){const{data:n}=a;if(n.type==="DECODER_INPUT"){if(!X||X.isStopped())return;const{timeCode:o,arrayBuffer:d}=n;Y&&k(Y,"Decoder")&&console.log("[DecoderWorker] Received ArrayBuffer from Downloader, timeCode =",o),X.addJob(o,d)}}function la(a){const{data:n}=a;if(n.type==="DECODER_REQUEST"){if(!X||X.isStopped())return;const{timeCode:o,fps:d}=n;Y&&k(Y,"Decoder")&&console.log("[DecoderWorker] Received TimeCode request from Renderer, timeCode =",o),X.updateCurrentTimecode(o,d)}}function gt(){Y&&(X.stop(),X=new Jt(Xt,gt,Y))}function Xt(a){if(!_t)return;Y&&k(Y,"Decoder")&&console.log(`[DecoderWorker] Posting a batch of ${a.length} frames to Renderer`);const n=a.map(o=>o.alphaMask).filter(o=>o!==void 0);try{const o=new Set(n);_t.postMessage({type:"RENDERER_INPUT",batch:a},[...o]),n.forEach(d=>d.close())}catch(o){z.error("[DecoderWorker] Error posting batch to Renderer",{error:o}),Y&&k(Y,"Errors")&&console.error("[DecoderWorker] Error posting batch to Renderer:",o),n.forEach(d=>d.close());return}}function ca(a){const n={type:"TRACK_PERFORMANCE",data:a};self.postMessage(n)}self.onunhandledrejection=a=>{z.error("[DecoderWorker] Unhandled rejection",{error:a.reason}),Y&&(k(Y,"Errors")&&console.error("[DecoderWorker] Unhandled rejection:",a.reason),X.stop(),X=new Jt(Xt,gt,Y),a.preventDefault())},self.onerror=a=>{z.error("[DecoderWorker] Unhandled error",{error:a}),Y&&(k(Y,"Errors")&&console.error("[DecoderWorker] Unhandled error:",a),a instanceof Event&&a.preventDefault())}})();\n',Wt=typeof self<"u"&&self.Blob&&new Blob([Vt],{type:"text/javascript;charset=utf-8"});function cs(r){let e;try{if(e=Wt&&(self.URL||self.webkitURL).createObjectURL(Wt),!e)throw"";const t=new Worker(e,{name:r==null?void 0:r.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Vt),{name:r==null?void 0:r.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const Ht='(function(){"use strict";const h=(r,e)=>e==="Errors"?!0:!r.debug||!r.debug.on?!1:r.debug[`log${e}`],N={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},H=console,ne={};Object.keys(N).forEach(r=>{ne[r]=H[r]});const Ce="Datadog Browser SDK:",M={debug:ne.debug.bind(H,Ce),log:ne.log.bind(H,Ce),info:ne.info.bind(H,Ce),warn:ne.warn.bind(H,Ce),error:ne.error.bind(H,Ce)},bt="https://docs.datadoghq.com",$t=`${bt}/real_user_monitoring/browser/troubleshooting`,We="More details:";function er(r,e){return(...s)=>{try{return r(...s)}catch(t){M.error(e,t)}}}function Ve(r){return r!==0&&Math.random()*100<=r}function gs(r){return ms(r)&&r>=0&&r<=100}function ms(r){return typeof r=="number"}const Le=1e3,ae=60*Le,tr=60*ae,ps=365*(24*tr);function xe(){return new Date().getTime()}function J(){return xe()}function Xe(){return performance.now()}function $(){return{relative:Xe(),timeStamp:J()}}function Es(){return{relative:0,timeStamp:rr()}}function Ts(r,e){return e-r}function bs(r,e){return r+e}function Rs(r){return r-rr()}let Rt;function rr(){return Rt===void 0&&(Rt=performance.timing.navigationStart),Rt}const _=1024,sr=1024*_,vs=/[^\\u0000-\\u007F]/;function vt(r){return vs.test(r)?window.TextEncoder!==void 0?new TextEncoder().encode(r).length:new Blob([r]).size:r.length}function ys(r){return{...r}}function ir(r,e){return Object.keys(r).some(s=>r[s]===e)}function Be(r){return Object.keys(r).length===0}function ee(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let r=_dd_temp_;return delete Object.prototype._dd_temp_,typeof r!="object"&&(typeof self=="object"?r=self:typeof window=="object"?r=window:r={}),r}function Ee(r,e){const s=ee();let t;return s.Zone&&typeof s.Zone.__symbol__=="function"&&(t=r[s.Zone.__symbol__(e)]),t||(t=r[e]),t}let Ye,or=!1;function Ds(r){Ye=r}function Is(r){or=r}function Ss(r,e,s){const t=s.value;s.value=function(...i){return(Ye?I(t):t).apply(this,i)}}function I(r){return function(){return we(r,this,arguments)}}function we(r,e,s){try{return r.apply(e,s)}catch(t){Cs(t)}}function Cs(r){if(yt(r),Ye)try{Ye(r)}catch(e){yt(e)}}function yt(...r){or&&M.error("[MONITOR]",...r)}function Pe(r,e){return Ee(ee(),"setTimeout")(I(r),e)}function nr(r){Ee(ee(),"clearTimeout")(r)}function Dt(r,e){return Ee(ee(),"setInterval")(I(r),e)}function ar(r){Ee(ee(),"clearInterval")(r)}class k{constructor(e){this.onFirstSubscribe=e,this.observers=[]}subscribe(e){return this.observers.push(e),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(s=>e!==s),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(e){this.observers.forEach(s=>s(e))}}function Ar(...r){return new k(e=>{const s=r.map(t=>t.subscribe(i=>e.notify(i)));return()=>s.forEach(t=>t.unsubscribe())})}function cr(r,e,s){let t=!1,i,o;return{throttled:(...n)=>{if(t){i=n;return}r(...n),t=!0,o=Pe(()=>{i&&r(...i),t=!1,i=void 0},e)},cancel:()=>{nr(o),t=!1,i=void 0}}}function te(){}function re(r){return r?(parseInt(r,10)^Math.random()*16>>parseInt(r,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,re)}const He=/([\\w-]+)\\s*=\\s*([^;]+)/g;function Ls(r,e){for(He.lastIndex=0;;){const s=He.exec(r);if(s){if(s[1]===e)return s[2]}else break}}function xs(r){const e=new Map;for(He.lastIndex=0;;){const s=He.exec(r);if(s)e.set(s[1],s[2]);else break}return e}function Bs(r,e,s=""){const t=r.charCodeAt(e-1),o=t>=55296&&t<=56319?e+1:e;return r.length<=o?r:`${r.slice(0,o)}${s}`}function ws(){return Ps()===0}let ze;function Ps(){return ze??(ze=Os())}function Os(r=window){var e;const s=r.navigator.userAgent;return r.chrome||/HeadlessChrome/.test(s)?0:((e=r.navigator.vendor)===null||e===void 0?void 0:e.indexOf("Apple"))===0||/safari/i.test(s)&&!/chrome|android/i.test(s)?1:2}function Oe(r,e,s=0,t){const i=new Date;i.setTime(i.getTime()+s);const o=`expires=${i.toUTCString()}`,n=t&&t.crossSite?"none":"strict",a=t&&t.domain?`;domain=${t.domain}`:"",A=t&&t.secure?";secure":"",l=t&&t.partitioned?";partitioned":"";document.cookie=`${r}=${e};${o};path=/;samesite=${n}${a}${A}${l}`}function It(r){return Ls(document.cookie,r)}let St;function Ae(r){return St||(St=xs(document.cookie)),St.get(r)}function lr(r,e){Oe(r,"",0,e)}function Us(r){if(document.cookie===void 0||document.cookie===null)return!1;try{const e=`dd_cookie_test_${re()}`,s="test";Oe(e,s,ae,r);const t=It(e)===s;return lr(e,r),t}catch(e){return M.error(e),!1}}let Ct;function Ns(){if(Ct===void 0){const r=`dd_site_test_${re()}`,e="test",s=window.location.hostname.split(".");let t=s.pop();for(;s.length&&!It(r);)t=`${s.pop()}.${t}`,Oe(r,e,Le,{domain:t});lr(r,{domain:t}),Ct=t}return Ct}const Te="_dd_s";function Ze(r){return Object.values(r)}function Ms(r){return Object.entries(r)}const Lt=4*tr,dr=15*ae,Fs=ps,Ue={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},ur=/^([a-zA-Z]+)=([a-z0-9-]+)$/,xt="&";function ks(r){return!!r&&(r.indexOf(xt)!==-1||ur.test(r))}const Qs="1";function ce(r,e){const s={isExpired:Qs};return e.trackAnonymousUser&&(r!=null&&r.anonymousId?s.anonymousId=r==null?void 0:r.anonymousId:s.anonymousId=re()),s}function _e(r){return Be(r)}function fr(r){return!_e(r)}function Ke(r){return r.isExpired!==void 0||!Gs(r)}function Gs(r){return(r.created===void 0||xe()-Number(r.created)<Lt)&&(r.expire===void 0||xe()<Number(r.expire))}function hr(r){r.expire=String(xe()+dr)}function Bt(r){return Ms(r).map(([e,s])=>e==="anonymousId"?`aid=${s}`:`${e}=${s}`).join(xt)}function gr(r){const e={};return ks(r)&&r.split(xt).forEach(s=>{const t=ur.exec(s);if(t!==null){const[,i,o]=t;i==="aid"?e.anonymousId=o:e[i]=o}}),e}const Ws="_dd",Vs="_dd_r",Xs="_dd_l",Ys="rum",Hs="logs";function zs(r){if(!Ae(Te)){const s=Ae(Ws),t=Ae(Vs),i=Ae(Xs),o={};s&&(o.id=s),i&&/^[01]$/.test(i)&&(o[Hs]=i),t&&/^[012]$/.test(t)&&(o[Ys]=t),fr(o)&&(hr(o),r.persistSession(o))}}function mr(r){const e=qs(r);return Us(e)?{type:Ue.COOKIE,cookieOptions:e}:void 0}function Zs(r,e){const s={isLockEnabled:ws(),persistSession:_s(e),retrieveSession:js,expireSession:t=>Ks(e,t,r)};return zs(s),s}function _s(r){return e=>{Oe(Te,Bt(e),dr,r)}}function Ks(r,e,s){const t=ce(e,s);Oe(Te,Bt(t),s.trackAnonymousUser?Fs:Lt,r)}function js(){const r=It(Te);return gr(r)}function qs(r){const e={};return e.secure=!!r.useSecureSessionCookie||!!r.usePartitionedCrossSiteSessionCookie,e.crossSite=!!r.usePartitionedCrossSiteSessionCookie,e.partitioned=!!r.usePartitionedCrossSiteSessionCookie,r.trackSessionAcrossSubdomains&&(e.domain=Ns()),e}const Js="_dd_test_";function pr(){try{const r=re(),e=`${Js}${r}`;localStorage.setItem(e,r);const s=localStorage.getItem(e);return localStorage.removeItem(e),r===s?{type:Ue.LOCAL_STORAGE}:void 0}catch{return}}function $s(r){return{isLockEnabled:!1,persistSession:Er,retrieveSession:ei,expireSession:e=>ti(e,r)}}function Er(r){localStorage.setItem(Te,Bt(r))}function ei(){const r=localStorage.getItem(Te);return gr(r)}function ti(r,e){Er(ce(r,e))}const ri=10,si=100,Tr=[];let je;function le(r,e,s=0){var t;const{isLockEnabled:i,persistSession:o,expireSession:n}=e,a=u=>o({...u,lock:l}),A=()=>{const u=e.retrieveSession(),g=u.lock;return u.lock&&delete u.lock,{session:u,lock:g}};if(je||(je=r),r!==je){Tr.push(r);return}if(i&&s>=si){br(e);return}let l,c=A();if(i){if(c.lock){qe(r,e,s);return}if(l=re(),a(c.session),c=A(),c.lock!==l){qe(r,e,s);return}}let d=r.process(c.session);if(i&&(c=A(),c.lock!==l)){qe(r,e,s);return}if(d&&(Ke(d)?n(d):(hr(d),i?a(d):o(d))),i&&!(d&&Ke(d))){if(c=A(),c.lock!==l){qe(r,e,s);return}o(c.session),d=c.session}(t=r.after)===null||t===void 0||t.call(r,d||c.session),br(e)}function qe(r,e,s){Pe(()=>{le(r,e,s+1)},ri)}function br(r){je=void 0;const e=Tr.shift();e&&le(e,r)}const Rr=Le;function ii(r){switch(r.sessionPersistence){case Ue.COOKIE:return mr(r);case Ue.LOCAL_STORAGE:return pr();case void 0:{let e=mr(r);return!e&&r.allowFallbackToLocalStorage&&(e=pr()),e}default:M.error(`Invalid session persistence \'${String(r.sessionPersistence)}\'`)}}function oi(r,e,s,t){const i=new k,o=new k,n=new k,a=r.type===Ue.COOKIE?Zs(e,r.cookieOptions):$s(e),{expireSession:A}=a,l=Dt(m,Rr);let c;f();const{throttled:d,cancel:u}=cr(()=>{le({process:E=>{if(_e(E))return;const w=p(E);return y(w),w},after:E=>{fr(E)&&!S()&&L(E),c=E}},a)},Rr);function g(){le({process:E=>S()?p(E):void 0},a)}function m(){le({process:E=>Ke(E)?ce(E,e):void 0,after:p},a)}function p(E){return Ke(E)&&(E=ce(E,e)),S()&&(P(E)?v():(n.notify({previousState:c,newState:E}),c=E)),E}function f(){le({process:E=>{if(_e(E))return ce(E,e)},after:E=>{c=E}},a)}function y(E){if(_e(E))return!1;const{trackingType:w,isTracked:x}=t(E[s]);E[s]=w,delete E.isExpired,x&&!E.id&&(E.id=re(),E.created=String(xe()))}function S(){return c[s]!==void 0}function P(E){return c.id!==E.id||c[s]!==E[s]}function v(){c=ce(c,e),o.notify()}function L(E){c=E,i.notify()}function G(E){le({process:w=>({...w,...E}),after:p},a)}return{expandOrRenewSession:d,expandSession:g,getSession:()=>c,renewObservable:i,expireObservable:o,sessionStateUpdateObservable:n,restartSession:f,expire:()=>{u(),A(c),p(ce(c,e))},stop:()=>{ar(l)},updateSessionState:G}}const wt={GRANTED:"granted",NOT_GRANTED:"not-granted"};function ni(r){const e=new k;return{tryToInit(s){r||(r=s)},update(s){r=s,e.notify()},isGranted(){return r===wt.GRANTED},observable:e}}function de(r,e,s){if(typeof r!="object"||r===null)return JSON.stringify(r);const t=be(Object.prototype),i=be(Array.prototype),o=be(Object.getPrototypeOf(r)),n=be(r);try{return JSON.stringify(r,e,s)}catch{return"<error: unable to serialize object>"}finally{t(),i(),o(),n()}}function be(r){const e=r,s=e.toJSON;return s?(delete e.toJSON,()=>{e.toJSON=s}):te}function Pt(r){return ai(r,location.href).href}function ai(r,e){const s=Ai();if(s)try{return e!==void 0?new s(r,e):new s(r)}catch(o){throw new Error(`Failed to construct URL: ${String(o)} ${de({url:r,base:e})}`)}if(e===void 0&&!/:/.test(r))throw new Error(`Invalid URL: \'${r}\'`);let t=document;const i=t.createElement("a");if(e!==void 0){t=document.implementation.createHTMLDocument("");const o=t.createElement("base");o.href=e,t.head.appendChild(o),t.body.appendChild(i)}return i.href=r,i}const vr=URL;let Je;function Ai(){if(Je===void 0)try{Je=new vr("http://test/path").href==="http://test/path"}catch{Je=!1}return Je?vr:void 0}const ci="datad0g.com",li="dd0g-gov.com",Re="datadoghq.com",di="ddog-gov.com",ui="pci.browser-intake-datadoghq.com",fi=["ddsource","ddtags"];function Ne(r,e,s){const t=hi(r,e);return{build(i,o){const n=mi(r,e,s,i,o);return t(n)},urlPrefix:t(""),trackType:e}}function hi(r,e){const s=`/api/v2/${e}`,t=r.proxy;if(typeof t=="string"){const o=Pt(t);return n=>`${o}?ddforward=${encodeURIComponent(`${s}?${n}`)}`}if(typeof t=="function")return o=>t({path:s,parameters:o});const i=gi(e,r);return o=>`https://${i}${s}?${o}`}function gi(r,e){const{site:s=Re,internalAnalyticsSubdomain:t}=e;if(r==="logs"&&e.usePciIntake&&s===Re)return ui;if(t&&s===Re)return`${t}.${Re}`;if(s===li)return`http-intake.logs.${s}`;const i=s.split("."),o=i.pop();return`browser-intake-${i.join("-")}.${o}`}function mi({clientToken:r,internalAnalyticsSubdomain:e},s,t,i,{retry:o,encoding:n}){const a=["sdk_version:6.5.0",`api:${i}`].concat(t);o&&a.push(`retry_count:${o.count}`,`retry_after:${o.lastFailureStatus}`);const A=["ddsource=browser",`ddtags=${encodeURIComponent(a.join(","))}`,`dd-api-key=${r}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${re()}`];return n&&A.push(`dd-evp-encoding=${n}`),s==="rum"&&A.push(`batch_time=${J()}`),e&&A.reverse(),A.join("&")}const pi=200;function Ei(r){const{env:e,service:s,version:t,datacenter:i}=r,o=[];return e&&o.push($e("env",e)),s&&o.push($e("service",s)),t&&o.push($e("version",t)),i&&o.push($e("datacenter",i)),o}function $e(r,e){const s=pi-r.length-1;(e.length>s||Ti(e))&&M.warn(`${r} value doesn\'t meet tag requirements and will be sanitized. ${We} ${bt}/getting_started/tagging/#defining-tags`);const t=e.replace(/,/g,"_");return`${r}:${t}`}function Ti(r){return bi()?new RegExp("[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]","u").test(r):!1}function bi(){try{return new RegExp("[\\\\p{Ll}]","u"),!0}catch{return!1}}function Ri(r){const e=r.site||Re,s=Ei(r),t=vi(r,s);return{replica:yi(r,s),site:e,...t}}function vi(r,e){return{logsEndpointBuilder:Ne(r,"logs",e),rumEndpointBuilder:Ne(r,"rum",e),sessionReplayEndpointBuilder:Ne(r,"replay",e)}}function yi(r,e){if(!r.replica)return;const s={...r,site:Re,clientToken:r.replica.clientToken},t={logsEndpointBuilder:Ne(s,"logs",e),rumEndpointBuilder:Ne(s,"rum",e)};return{applicationId:r.replica.applicationId,...t}}function Di(r){return fi.every(e=>r.includes(e))}function Ot(r,e){return r!=null&&typeof r!="string"?(M.error(`${e} must be defined as a string`),!1):!0}function Ii(r){return r&&typeof r=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(r)?(M.error(`Site should be a valid Datadog site. ${We} ${bt}/getting_started/site/.`),!1):!0}function et(r,e){return r!==void 0&&!gs(r)?(M.error(`${e} Sample Rate should be a number between 0 and 100`),!1):!0}function Si(r){var e,s,t,i,o,n;if(!r||!r.clientToken){M.error("Client Token is not configured, we will not send any data.");return}if(!(!Ii(r.site)||!et(r.sessionSampleRate,"Session")||!et(r.telemetrySampleRate,"Telemetry")||!et(r.telemetryConfigurationSampleRate,"Telemetry Configuration")||!et(r.telemetryUsageSampleRate,"Telemetry Usage")||!Ot(r.version,"Version")||!Ot(r.env,"Env")||!Ot(r.service,"Service"))){if(r.trackingConsent!==void 0&&!ir(wt,r.trackingConsent)){M.error(\'Tracking Consent should be either "granted" or "not-granted"\');return}return{beforeSend:r.beforeSend&&er(r.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:ii(r),sessionSampleRate:(e=r.sessionSampleRate)!==null&&e!==void 0?e:100,telemetrySampleRate:(s=r.telemetrySampleRate)!==null&&s!==void 0?s:20,telemetryConfigurationSampleRate:(t=r.telemetryConfigurationSampleRate)!==null&&t!==void 0?t:5,telemetryUsageSampleRate:(i=r.telemetryUsageSampleRate)!==null&&i!==void 0?i:5,service:r.service||void 0,silentMultipleInit:!!r.silentMultipleInit,allowUntrustedEvents:!!r.allowUntrustedEvents,trackingConsent:(o=r.trackingConsent)!==null&&o!==void 0?o:wt.GRANTED,trackAnonymousUser:(n=r.trackAnonymousUser)!==null&&n!==void 0?n:!0,storeContextsAcrossPages:!!r.storeContextsAcrossPages,batchBytesLimit:16*_,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*Le,batchMessagesLimit:50,messageBytesLimit:256*_,...Ri(r)}}}function Ci(r){return{session_sample_rate:r.sessionSampleRate,telemetry_sample_rate:r.telemetrySampleRate,telemetry_configuration_sample_rate:r.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:r.telemetryUsageSampleRate,use_before_send:!!r.beforeSend,use_partitioned_cross_site_session_cookie:r.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:r.useSecureSessionCookie,use_proxy:!!r.proxy,silent_multiple_init:r.silentMultipleInit,track_session_across_subdomains:r.trackSessionAcrossSubdomains,track_anonymous_user:r.trackAnonymousUser,session_persistence:r.sessionPersistence,allow_fallback_to_local_storage:!!r.allowFallbackToLocalStorage,store_contexts_across_pages:!!r.storeContextsAcrossPages,allow_untrusted_events:!!r.allowUntrustedEvents,tracking_consent:r.trackingConsent}}var Ut;(function(r){r.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",r.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(Ut||(Ut={}));const yr=new Set;function Li(r){Array.isArray(r)&&xi(r.filter(e=>ir(Ut,e)))}function xi(r){r.forEach(e=>{yr.add(e)})}function Bi(){return yr}const Me="?";function K(r){const e=[];let s=Nt(r,"stack");const t=String(r);return s&&s.startsWith(t)&&(s=s.slice(t.length)),s&&s.split(`\n`).forEach(i=>{const o=Oi(i)||Ni(i)||Fi(i)||Gi(i);o&&(!o.func&&o.line&&(o.func=Me),e.push(o))}),{message:Nt(r,"message"),name:Nt(r,"name"),stack:e}}const Dr="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\\\w+\\\\.|\\\\/).*?)",ve="(?::(\\\\d+))",wi=new RegExp(`^\\\\s*at (.*?) ?\\\\(${Dr}${ve}?${ve}?\\\\)?\\\\s*$`,"i"),Pi=new RegExp(`\\\\((\\\\S*)${ve}${ve}\\\\)`);function Oi(r){const e=wi.exec(r);if(!e)return;const s=e[2]&&e[2].indexOf("native")===0,t=e[2]&&e[2].indexOf("eval")===0,i=Pi.exec(e[2]);return t&&i&&(e[2]=i[1],e[3]=i[2],e[4]=i[3]),{args:s?[e[2]]:[],column:e[4]?+e[4]:void 0,func:e[1]||Me,line:e[3]?+e[3]:void 0,url:s?void 0:e[2]}}const Ui=new RegExp(`^\\\\s*at ?${Dr}${ve}?${ve}??\\\\s*$`,"i");function Ni(r){const e=Ui.exec(r);if(e)return{args:[],column:e[3]?+e[3]:void 0,func:Me,line:e[2]?+e[2]:void 0,url:e[1]}}const Mi=/^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;function Fi(r){const e=Mi.exec(r);if(e)return{args:[],column:e[4]?+e[4]:void 0,func:e[1]||Me,line:+e[3],url:e[2]}}const ki=/^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,Qi=/(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;function Gi(r){const e=ki.exec(r);if(!e)return;const s=e[3]&&e[3].indexOf(" > eval")>-1,t=Qi.exec(e[3]);return s&&t&&(e[3]=t[1],e[4]=t[2],e[5]=void 0),{args:e[2]?e[2].split(","):[],column:e[5]?+e[5]:void 0,func:e[1]||Me,line:e[4]?+e[4]:void 0,url:e[3]}}function Nt(r,e){if(typeof r!="object"||!r||!(e in r))return;const s=r[e];return typeof s=="string"?s:void 0}function Wi(r,e,s,t){const i=[{url:e,column:t,line:s}],{name:o,message:n}=Xi(r);return{name:o,message:n,stack:i}}const Vi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;function Xi(r){let e,s;return{}.toString.call(r)==="[object String]"&&([,e,s]=Vi.exec(r)),{name:e,message:s}}function tt(r){const s=new Error(r);s.name="HandlingStack";let t;return we(()=>{const i=K(s);i.stack=i.stack.slice(2),t=ue(i)}),t}function ue(r){let e=Ir(r);return r.stack.forEach(s=>{const t=s.func==="?"?"<anonymous>":s.func,i=s.args&&s.args.length>0?`(${s.args.join(", ")})`:"",o=s.line?`:${s.line}`:"",n=s.line&&s.column?`:${s.column}`:"";e+=`\n at ${t}${i} @ ${s.url}${o}${n}`}),e}function Ir(r){return`${r.name||"Error"}: ${r.message}`}function fe(r,e,s,{computeHandlingStack:t}={}){let i=r[e];if(typeof i!="function")if(e in r&&e.startsWith("on"))i=te;else return{stop:te};let o=!1;const n=function(){if(o)return i.apply(this,arguments);const a=Array.from(arguments);let A;we(s,null,[{target:this,parameters:a,onPostCall:c=>{A=c},handlingStack:t?tt("instrumented method"):void 0}]);const l=i.apply(this,a);return A&&we(A,null,[l]),l};return r[e]=n,{stop:()=>{o=!0,r[e]===n&&(r[e]=i)}}}const Yi=220*_,Hi="$",zi=3;function j(r,e=Yi){const s=be(Object.prototype),t=be(Array.prototype),i=[],o=new WeakMap,n=Mt(r,Hi,void 0,i,o),a=JSON.stringify(n);let A=a?a.length:0;if(A>e){kt(e,"discarded",r);return}for(;i.length>0&&A<e;){const l=i.shift();let c=0;if(Array.isArray(l.source))for(let d=0;d<l.source.length;d++){const u=Mt(l.source[d],l.path,d,i,o);if(u!==void 0?A+=JSON.stringify(u).length:A+=4,A+=c,c=1,A>e){kt(e,"truncated",r);break}l.target[d]=u}else for(const d in l.source)if(Object.prototype.hasOwnProperty.call(l.source,d)){const u=Mt(l.source[d],l.path,d,i,o);if(u!==void 0&&(A+=JSON.stringify(u).length+c+d.length+zi,c=1),A>e){kt(e,"truncated",r);break}l.target[d]=u}}return s(),t(),n}function Mt(r,e,s,t,i){const o=Ki(r);if(!o||typeof o!="object")return Zi(o);const n=Ft(o);if(n!=="[Object]"&&n!=="[Array]"&&n!=="[Error]")return n;const a=r;if(i.has(a))return`[Reference seen at ${i.get(a)}]`;const A=s!==void 0?`${e}.${s}`:e,l=Array.isArray(o)?[]:{};return i.set(a,A),t.push({source:o,target:l,path:A}),l}function Zi(r){return typeof r=="bigint"?`[BigInt] ${r.toString()}`:typeof r=="function"?`[Function] ${r.name||"unknown"}`:typeof r=="symbol"?`[Symbol] ${r.description||r.toString()}`:r}function Ft(r){try{if(r instanceof Event)return _i(r);if(r instanceof RegExp)return`[RegExp] ${r.toString()}`;const s=Object.prototype.toString.call(r).match(/\\[object (.*)\\]/);if(s&&s[1])return`[${s[1]}]`}catch{}return"[Unserializable]"}function _i(r){return{type:r.type,isTrusted:r.isTrusted,currentTarget:r.currentTarget?Ft(r.currentTarget):null,target:r.target?Ft(r.target):null}}function Ki(r){const e=r;if(e&&typeof e.toJSON=="function")try{return e.toJSON()}catch{}return r}function kt(r,e,s){M.warn(`The data provided has been ${e} as it is over the limit of ${r} characters:`,s)}const Sr="No stack, consider using an instance of Error";function Cr({stackTrace:r,originalError:e,handlingStack:s,componentStack:t,startClocks:i,nonErrorPrefix:o,source:n,handling:a}){const A=se(e),l=ji(r,A,o,e),c=qi(A,r)?ue(r):Sr,d=A?Br(e,n):void 0,u=r?r.name:void 0,g=Lr(e),m=xr(e);return{startClocks:i,source:n,handling:a,handlingStack:s,componentStack:t,originalError:e,type:u,message:l,stack:c,causes:d,fingerprint:g,context:m}}function ji(r,e,s,t){return r!=null&&r.message&&(r!=null&&r.name)?r.message:e?"Empty message":`${s} ${de(j(t))}`}function qi(r,e){return e===void 0?!1:r?!0:e.stack.length>0&&(e.stack.length>1||e.stack[0].url!==void 0)}function Lr(r){return se(r)&&"dd_fingerprint"in r?String(r.dd_fingerprint):void 0}function xr(r){if(r!==null&&typeof r=="object"&&"dd_context"in r)return r.dd_context}function Ji(r){var e;return(e=/@ (.+)/.exec(r))===null||e===void 0?void 0:e[1]}function se(r){return r instanceof Error||Object.prototype.toString.call(r)==="[object Error]"}function Br(r,e){let s=r;const t=[];for(;se(s==null?void 0:s.cause)&&t.length<10;){const i=K(s.cause);t.push({message:s.cause.message,source:e,type:i==null?void 0:i.name,stack:ue(i)}),s=s.cause}return t.length?t:void 0}const X={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function $i(r){const e=(i,o)=>{const n=Cr({stackTrace:i,originalError:o,startClocks:$(),nonErrorPrefix:"Uncaught",source:X.SOURCE,handling:"unhandled"});r.notify(n)},{stop:s}=eo(e),{stop:t}=to(e);return{stop:()=>{s(),t()}}}function eo(r){return fe(window,"onerror",({parameters:[e,s,t,i,o]})=>{let n;se(o)?n=K(o):n=Wi(e,s,t,i),r(n,o??e)})}function to(r){return fe(window,"onunhandledrejection",({parameters:[e]})=>{const s=e.reason||"Empty reason",t=K(s);r(t,s)})}function ro(r){const e={version:"6.5.0",onReady(s){s()},...r};return Object.defineProperty(e,"_setDebug",{get(){return Is},enumerable:!1}),e}function so(r,e,s){const t=r[e];t&&!t.q&&t.version&&M.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),r[e]=s,t&&t.q&&t.q.forEach(i=>er(i,"onReady callback threw an error:")())}function wr(r,e){e.silentMultipleInit||M.error(`${r} is already initialized.`)}function he(r,e,s,t,i){return Qt(r,e,[s],t,i)}function Qt(r,e,s,t,{once:i,capture:o,passive:n}={}){const a=I(u=>{!u.isTrusted&&!u.__ddIsTrusted&&!r.allowUntrustedEvents||(i&&d(),t(u))}),A=n?{capture:o,passive:n}:o,l=window.EventTarget&&e instanceof EventTarget?window.EventTarget.prototype:e,c=Ee(l,"addEventListener");s.forEach(u=>c.call(e,u,a,A));function d(){const u=Ee(l,"removeEventListener");s.forEach(g=>u.call(e,g,a,A))}return{stop:d}}const rt={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function io(r,e){const s=[];e.includes(rt.cspViolation)&&s.push(no(r));const t=e.filter(i=>i!==rt.cspViolation);return t.length&&s.push(oo(t)),Ar(...s)}function oo(r){return new k(e=>{if(!window.ReportingObserver)return;const s=I((i,o)=>i.forEach(n=>e.notify(ao(n)))),t=new window.ReportingObserver(s,{types:r,buffered:!0});return t.observe(),()=>{t.disconnect()}})}function no(r){return new k(e=>{const{stop:s}=he(r,document,"securitypolicyviolation",t=>{e.notify(Ao(t))});return s})}function ao(r){const{type:e,body:s}=r;return Pr({type:s.id,message:`${e}: ${s.message}`,originalError:r,stack:Or(s.id,s.message,s.sourceFile,s.lineNumber,s.columnNumber)})}function Ao(r){const e=`\'${r.blockedURI}\' blocked by \'${r.effectiveDirective}\' directive`;return Pr({type:r.effectiveDirective,message:`${rt.cspViolation}: ${e}`,originalError:r,csp:{disposition:r.disposition},stack:Or(r.effectiveDirective,r.originalPolicy?`${e} of the policy "${Bs(r.originalPolicy,100,"...")}"`:"no policy",r.sourceFile,r.lineNumber,r.columnNumber)})}function Pr(r){return{startClocks:$(),source:X.REPORT,handling:"unhandled",...r}}function Or(r,e,s,t,i){return s?ue({name:r,message:e,stack:[{func:"?",url:s,line:t??void 0,column:i??void 0}]}):void 0}function Ur(r,e){const s=window.__ddBrowserSdkExtensionCallback;s&&s({type:r,payload:e})}function Nr(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function st(r,e,s=co()){if(e===void 0)return r;if(typeof e!="object"||e===null)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const i=e.flags||[e.global?"g":"",e.ignoreCase?"i":"",e.multiline?"m":"",e.sticky?"y":"",e.unicode?"u":""].join("");return new RegExp(e.source,i)}if(s.hasAlreadyBeenSeen(e))return;if(Array.isArray(e)){const i=Array.isArray(r)?r:[];for(let o=0;o<e.length;++o)i[o]=st(i[o],e[o],s);return i}const t=Nr(r)==="object"?r:{};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=st(t[i],e[i],s));return t}function Mr(r){return st(void 0,r)}function ye(...r){let e;for(const s of r)s!=null&&(e=st(e,s));return e}function co(){if(typeof WeakSet<"u"){const e=new WeakSet;return{hasAlreadyBeenSeen(s){const t=e.has(s);return t||e.add(s),t}}}const r=[];return{hasAlreadyBeenSeen(e){const s=r.indexOf(e)>=0;return s||r.push(e),s}}}function lo(){var r;const e=window.navigator;return{status:e.onLine?"connected":"not_connected",interfaces:e.connection&&e.connection.type?[e.connection.type]:void 0,effective_type:(r=e.connection)===null||r===void 0?void 0:r.effectiveType}}function uo(r){const e=new Set;return r.forEach(s=>e.add(s)),Array.from(e)}function Fr(r,e){const s=r.indexOf(e);s>=0&&r.splice(s,1)}const fo=500;function kr(){const r=[];return{add:i=>{r.push(i)>fo&&r.splice(0,1)},remove:i=>{Fr(r,i)},drain:i=>{r.forEach(o=>o(i)),r.length=0}}}const ge={log:"log",configuration:"configuration",usage:"usage"},ho=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],go=[di];let Qr=kr(),De=r=>{Qr.add(()=>De(r))};function mo(r,e){let s;const t=new k,i=new Set,o=!go.includes(e.site)&&Ve(e.telemetrySampleRate),n={[ge.log]:o,[ge.configuration]:o&&Ve(e.telemetryConfigurationSampleRate),[ge.usage]:o&&Ve(e.telemetryUsageSampleRate)},a=po();De=l=>{const c=de(l);if(n[l.type]&&i.size<e.maxTelemetryEventsPerPage&&!i.has(c)){const d=A(r,l,a);t.notify(d),Ur("telemetry",d),i.add(c)}},Ds(Wr);function A(l,c,d){return ye({type:"telemetry",date:J(),service:l,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:ye(c,{runtime_env:d,connectivity:lo(),sdk_setup:"npm"}),experimental_features:Array.from(Bi())},s!==void 0?s():{})}return{setContextProvider:l=>{s=l},observable:t,enabled:o}}function po(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function Eo(){Qr.drain()}function To(r){return r.site===ci}function Gr(r,e){yt(N.debug,r,e),De({type:ge.log,message:r,status:"debug",...e})}function Wr(r,e){De({type:ge.log,status:"error",...vo(r),...e})}function bo(r){De({type:ge.configuration,configuration:r})}function Ro(r){De({type:ge.usage,usage:r})}function vo(r){if(se(r)){const e=K(r);return{error:{kind:e.name,stack:ue(yo(e))},message:e.message}}return{error:{stack:Sr},message:`Uncaught ${de(r)}`}}function yo(r){return r.stack=r.stack.filter(e=>!e.url||ho.some(s=>e.url.startsWith(s))),r}const Fe=1/0,Do=ae;let ke=null;const it=new Set;function Io(){it.forEach(r=>r())}function So({expireDelay:r,maxEntries:e}){let s=[];const t=[];ke||(ke=Dt(()=>Io(),Do));const i=()=>{const g=Xe()-r;for(;s.length>0&&s[s.length-1].endTime<g;){const m=s.pop();m&&t.push(m.startTime)}};it.add(i);function o(g,m){const p={value:g,startTime:m,endTime:Fe,remove:()=>{Fr(s,p)},close:f=>{p.endTime=f}};return e&&s.length>=e&&s.pop(),s.unshift(p),p}function n(g=Fe,m={returnInactive:!1}){for(const p of s)if(p.startTime<=g){if(m.returnInactive||g<=p.endTime)return p.value;break}}function a(g){const m=s[0];m&&m.endTime===Fe&&m.close(g)}function A(g=Fe,m=0){const p=bs(g,m);return s.filter(f=>f.startTime<=p&&g<=f.endTime).map(f=>f.value)}function l(){return s.map(({startTime:g,endTime:m,value:p})=>({startTime:g,endTime:m===Fe?"Infinity":m,value:p}))}function c(){return t}function d(){s=[]}function u(){it.delete(i),it.size===0&&ke&&(ar(ke),ke=null)}return{add:o,find:n,closeActive:a,findAll:A,reset:d,stop:u,getAllEntries:l,getDeletedEntries:c}}const Co=ae,Lo=Lt;function xo(r,e,s,t){const i=new k,o=new k,n=oi(r.sessionStoreStrategyType,r,e,s),a=So({expireDelay:Lo});n.renewObservable.subscribe(()=>{a.add(A(),Xe()),i.notify()}),n.expireObservable.subscribe(()=>{o.notify(),a.closeActive(Xe())}),n.expandOrRenewSession(),a.add(A(),Es().relative),t.observable.subscribe(()=>{t.isGranted()?n.expandOrRenewSession():n.expire()}),Bo(r,()=>{t.isGranted()&&n.expandOrRenewSession()}),wo(r,()=>n.expandSession()),Po(r,()=>n.restartSession());function A(){return{id:n.getSession().id,trackingType:n.getSession()[e],isReplayForced:!!n.getSession().forcedReplay,anonymousId:n.getSession().anonymousId}}return{findSession:(l,c)=>a.find(l,c),renewObservable:i,expireObservable:o,sessionStateUpdateObservable:n.sessionStateUpdateObservable,expire:n.expire,updateSessionState:n.updateSessionState}}function Bo(r,e){Qt(r,window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0})}function wo(r,e){const s=()=>{document.visibilityState==="visible"&&e()};he(r,document,"visibilitychange",s),Dt(s,Co)}function Po(r,e){he(r,window,"resume",e,{capture:!0})}function Vr(r){return r>=500}function Oo(r){try{return r.clone()}catch{return}}const Uo=80*_,No=32,Xr=3*sr,Mo=ae,Yr=Le;function Hr(r,e,s,t,i){e.transportStatus===0&&e.queuedPayloads.size()===0&&e.bandwidthMonitor.canHandle(r)?Zr(r,e,s,{onSuccess:()=>_r(0,e,s,t,i),onFailure:()=>{e.queuedPayloads.enqueue(r),zr(e,s,t,i)}}):e.queuedPayloads.enqueue(r)}function zr(r,e,s,t){r.transportStatus===2&&Pe(()=>{const i=r.queuedPayloads.first();Zr(i,r,e,{onSuccess:()=>{r.queuedPayloads.dequeue(),r.currentBackoffTime=Yr,_r(1,r,e,s,t)},onFailure:()=>{r.currentBackoffTime=Math.min(Mo,r.currentBackoffTime*2),zr(r,e,s,t)}})},r.currentBackoffTime)}function Zr(r,e,s,{onSuccess:t,onFailure:i}){e.bandwidthMonitor.add(r),s(r,o=>{e.bandwidthMonitor.remove(r),Fo(o)?(e.transportStatus=e.bandwidthMonitor.ongoingRequestCount>0?1:2,r.retry={count:r.retry?r.retry.count+1:1,lastFailureStatus:o.status},i()):(e.transportStatus=0,t())})}function _r(r,e,s,t,i){r===0&&e.queuedPayloads.isFull()&&!e.queueFullReported&&(i({message:`Reached max ${t} events size queued for upload: ${Xr/sr}MiB`,source:X.AGENT,startClocks:$()}),e.queueFullReported=!0);const o=e.queuedPayloads;for(e.queuedPayloads=Kr();o.size()>0;)Hr(o.dequeue(),e,s,t,i)}function Fo(r){return r.type!=="opaque"&&(r.status===0&&!navigator.onLine||r.status===408||r.status===429||Vr(r.status))}function ko(){return{transportStatus:0,currentBackoffTime:Yr,bandwidthMonitor:Qo(),queuedPayloads:Kr(),queueFullReported:!1}}function Kr(){const r=[];return{bytesCount:0,enqueue(e){this.isFull()||(r.push(e),this.bytesCount+=e.bytesCount)},first(){return r[0]},dequeue(){const e=r.shift();return e&&(this.bytesCount-=e.bytesCount),e},size(){return r.length},isFull(){return this.bytesCount>=Xr}}}function Qo(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(r){return this.ongoingRequestCount===0||this.ongoingByteCount+r.bytesCount<=Uo&&this.ongoingRequestCount<No},add(r){this.ongoingRequestCount+=1,this.ongoingByteCount+=r.bytesCount},remove(r){this.ongoingRequestCount-=1,this.ongoingByteCount-=r.bytesCount}}}function Go(r,e,s){const t=ko(),i=(o,n)=>Xo(r,e,o,n);return{send:o=>{Hr(o,t,i,r.trackType,s)},sendOnExit:o=>{Wo(r,e,o)}}}function Wo(r,e,s){if(!!navigator.sendBeacon&&s.bytesCount<e)try{const o=r.build("beacon",s);if(navigator.sendBeacon(o,s.data))return}catch(o){Vo(o)}const i=r.build("xhr",s);Gt(i,s.data)}let jr=!1;function Vo(r){jr||(jr=!0,Wr(r))}function Xo(r,e,s,t){if(Yo()&&s.bytesCount<e){const o=r.build("fetch",s);fetch(o,{method:"POST",body:s.data,keepalive:!0,mode:"cors"}).then(I(n=>t==null?void 0:t({status:n.status,type:n.type})),I(()=>{const n=r.build("xhr",s);Gt(n,s.data,t)}))}else{const o=r.build("xhr",s);Gt(o,s.data,t)}}function Yo(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function Gt(r,e,s){const t=new XMLHttpRequest;t.open("POST",r,!0),e instanceof Blob&&t.setRequestHeader("Content-Type",e.type),he({allowUntrustedEvents:!0},t,"loadend",()=>{s==null||s({status:t.status})},{once:!0}),t.send(e)}function Wt(){const r=Ho();if(r)return{getCapabilities(){var e;return JSON.parse(((e=r.getCapabilities)===null||e===void 0?void 0:e.call(r))||"[]")},getPrivacyLevel(){var e;return(e=r.getPrivacyLevel)===null||e===void 0?void 0:e.call(r)},getAllowedWebViewHosts(){return JSON.parse(r.getAllowedWebViewHosts())},send(e,s,t){const i=t?{id:t}:void 0;r.send(JSON.stringify({eventType:e,event:s,view:i}))}}}function ot(r){var e;r===void 0&&(r=(e=ee().location)===null||e===void 0?void 0:e.hostname);const s=Wt();return!!s&&s.getAllowedWebViewHosts().some(t=>r===t||r.endsWith(`.${t}`))}function Ho(){return ee().DatadogEventBridge}const nt={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function zo(r){return new k(e=>{const{stop:s}=Qt(r,window,["visibilitychange","freeze"],i=>{i.type==="visibilitychange"&&document.visibilityState==="hidden"?e.notify({reason:nt.HIDDEN}):i.type==="freeze"&&e.notify({reason:nt.FROZEN})},{capture:!0}),t=he(r,window,"beforeunload",()=>{e.notify({reason:nt.UNLOADING})}).stop;return()=>{s(),t()}})}function Zo(r){return Ze(nt).includes(r)}function _o({encoder:r,request:e,flushController:s,messageBytesLimit:t}){let i={};const o=s.flushObservable.subscribe(d=>c(d));function n(d,u,g){s.notifyBeforeAddMessage(u),g!==void 0?(i[g]=d,s.notifyAfterAddMessage()):r.write(r.isEmpty?d:`\n${d}`,m=>{s.notifyAfterAddMessage(m-u)})}function a(d){return d!==void 0&&i[d]!==void 0}function A(d){const u=i[d];delete i[d];const g=r.estimateEncodedBytesCount(u);s.notifyAfterRemoveMessage(g)}function l(d,u){const g=de(d),m=r.estimateEncodedBytesCount(g);if(m>=t){M.warn(`Discarded a message whose size was bigger than the maximum allowed size ${t}KB. ${We} ${$t}/#technical-limitations`);return}a(u)&&A(u),n(g,m,u)}function c(d){const u=Ze(i).join(`\n`);i={};const g=Zo(d.reason),m=g?e.sendOnExit:e.send;if(g&&r.isAsync){const p=r.finishSync();p.outputBytesCount&&m(qr(p));const f=[p.pendingData,u].filter(Boolean).join(`\n`);f&&m({data:f,bytesCount:vt(f)})}else u&&r.write(r.isEmpty?u:`\n${u}`),r.finish(p=>{m(qr(p))})}return{flushController:s,add:l,upsert:l,stop:o.unsubscribe}}function qr(r){let e;return typeof r.output=="string"?e=r.output:e=new Blob([r.output],{type:"text/plain"}),{data:e,bytesCount:r.outputBytesCount,encoding:r.encoding}}function Ko({messagesLimit:r,bytesLimit:e,durationLimit:s,pageExitObservable:t,sessionExpireObservable:i}){const o=t.subscribe(m=>c(m.reason)),n=i.subscribe(()=>c("session_expire")),a=new k(()=>()=>{o.unsubscribe(),n.unsubscribe()});let A=0,l=0;function c(m){if(l===0)return;const p=l,f=A;l=0,A=0,g(),a.notify({reason:m,messagesCount:p,bytesCount:f})}let d;function u(){d===void 0&&(d=Pe(()=>{c("duration_limit")},s))}function g(){nr(d),d=void 0}return{flushObservable:a,get messagesCount(){return l},notifyBeforeAddMessage(m){A+m>=e&&c("bytes_limit"),l+=1,A+=m,u()},notifyAfterAddMessage(m=0){A+=m,l>=r?c("messages_limit"):A>=e&&c("bytes_limit")},notifyAfterRemoveMessage(m){A-=m,l-=1,l===0&&g()}}}function Jr(r,e,s,t,i,o,n=_o){const a=l(r,e),A=s&&l(r,s);function l(c,{endpoint:d,encoder:u}){return n({encoder:u,request:Go(d,c.batchBytesLimit,t),flushController:Ko({messagesLimit:c.batchMessagesLimit,bytesLimit:c.batchBytesLimit,durationLimit:c.flushTimeout,pageExitObservable:i,sessionExpireObservable:o}),messageBytesLimit:c.messageBytesLimit})}return{flushObservable:a.flushController.flushObservable,add(c,d=!0){a.add(c),A&&d&&A.add(s.transformMessage?s.transformMessage(c):c)},upsert:(c,d)=>{a.upsert(c,d),A&&A.upsert(s.transformMessage?s.transformMessage(c):c,d)},stop:()=>{a.stop(),A&&A.stop()}}}function at(){let r="",e=0;return{isAsync:!1,get isEmpty(){return!r},write(s,t){const i=vt(s);e+=i,r+=s,t&&t(i)},finish(s){s(this.finishSync())},finishSync(){const s={output:r,outputBytesCount:e,rawBytesCount:e,pendingData:""};return r="",e=0,s},estimateEncodedBytesCount(s){return s.length}}}class jo{constructor(){this.callbacks={}}notify(e,s){const t=this.callbacks[e];t&&t.forEach(i=>i(s))}subscribe(e,s){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(s),{unsubscribe:()=>{this.callbacks[e]=this.callbacks[e].filter(t=>s!==t)}}}}function qo(r,e,s){let t=0,i=!1;return{isLimitReached(){if(t===0&&Pe(()=>{t=0},ae),t+=1,t<=e||i)return i=!1,!1;if(t===e+1){i=!0;try{s({message:`Reached max number of ${r}s by minute: ${e}`,source:X.AGENT,startClocks:$()})}finally{i=!1}}return!0}}}let Vt;const Xt=new WeakMap;function Jo(r){return Vt||(Vt=$o(r)),Vt}function $o(r){return new k(e=>{const{stop:s}=fe(XMLHttpRequest.prototype,"open",en),{stop:t}=fe(XMLHttpRequest.prototype,"send",o=>{tn(o,r,e)},{computeHandlingStack:!0}),{stop:i}=fe(XMLHttpRequest.prototype,"abort",rn);return()=>{s(),t(),i()}})}function en({target:r,parameters:[e,s]}){Xt.set(r,{state:"open",method:String(e).toUpperCase(),url:Pt(String(s))})}function tn({target:r,handlingStack:e},s,t){const i=Xt.get(r);if(!i)return;const o=i;o.state="start",o.startClocks=$(),o.isAborted=!1,o.xhr=r,o.handlingStack=e;let n=!1;const{stop:a}=fe(r,"onreadystatechange",()=>{r.readyState===XMLHttpRequest.DONE&&A()}),A=()=>{if(l(),a(),n)return;n=!0;const c=i;c.state="complete",c.duration=Ts(o.startClocks.timeStamp,J()),c.status=r.status,t.notify(ys(c))},{stop:l}=he(s,r,"loadend",A);t.notify(o)}function rn({target:r}){const e=Xt.get(r);e&&(e.isAborted=!0)}let Yt;function $r(){return Yt||(Yt=sn()),Yt}function sn(){return new k(r=>{if(!window.fetch)return;const{stop:e}=fe(window,"fetch",s=>on(s,r),{computeHandlingStack:!0});return e})}function on({parameters:r,onPostCall:e,handlingStack:s},t){const[i,o]=r;let n=o&&o.method;n===void 0&&i instanceof Request&&(n=i.method);const a=n!==void 0?String(n).toUpperCase():"GET",A=i instanceof Request?i.url:Pt(String(i)),l=$(),c={state:"start",init:o,input:i,method:a,startClocks:l,url:A,handlingStack:s};t.notify(c),r[0]=c.input,r[1]=c.init,e(d=>nn(t,d,c))}function nn(r,e,s){const t=s;function i(o){t.state="resolve",Object.assign(t,o),r.notify(t)}e.then(I(o=>{i({response:o,responseType:o.type,status:o.status,isAborted:!1})}),I(o=>{var n,a;i({status:0,isAborted:((a=(n=t.init)===null||n===void 0?void 0:n.signal)===null||a===void 0?void 0:a.aborted)||o instanceof DOMException&&o.code===DOMException.ABORT_ERR,error:o})}))}let Ht={};function an(r){const e=r.map(s=>(Ht[s]||(Ht[s]=An(s)),Ht[s]));return Ar(...e)}function An(r){return new k(e=>{const s=H[r];return H[r]=(...t)=>{s.apply(console,t);const i=tt("console error");we(()=>{e.notify(cn(t,r,i))})},()=>{H[r]=s}})}function cn(r,e,s){const t=r.map(o=>ln(o)).join(" ");let i;if(e===N.error){const o=r.find(se);i={stack:o?ue(K(o)):void 0,fingerprint:Lr(o),causes:o?Br(o,"console"):void 0,startClocks:$(),message:t,source:X.CONSOLE,handling:"handled",handlingStack:s,context:xr(o)}}return{api:e,message:t,error:i,handlingStack:s}}function ln(r){return typeof r=="string"?j(r):se(r)?Ir(K(r)):de(j(r),void 0,2)}function dn(r){const e=Nr(r)==="object";return e||M.error("Unsupported context:",r),e}function zt(r,e,s){const t={...r};for(const[i,{required:o,type:n}]of Object.entries(e))n==="string"&&i in t&&(t[i]=String(t[i])),o&&!(i in r)&&M.warn(`The property ${i} of ${s} is required; context will not be sent to the intake.`);return t}function At(r="",{customerDataTracker:e,propertiesConfig:s={}}={}){let t={};const i=new k,o={getContext:()=>Mr(t),setContext:n=>{dn(n)?(t=j(zt(n,s,r)),e==null||e.updateCustomerData(t)):o.clearContext(),i.notify()},setContextProperty:(n,a)=>{t=j(zt({...t,[n]:a},s,r)),e==null||e.updateCustomerData(t),i.notify()},removeContextProperty:n=>{delete t[n],e==null||e.updateCustomerData(t),zt(t,s,r),i.notify()},clearContext:()=>{t={},e==null||e.resetCustomerData(),i.notify()},changeObservable:i};return o}const un="_dd_c",fn=[];function Zt(r,e,s,t){const i=hn(s,t);fn.push(he(r,window,"storage",({key:l})=>{i===l&&n()})),e.changeObservable.subscribe(a);const o=ye(A(),e.getContext());Be(o)||e.setContext(o);function n(){e.setContext(A())}function a(){localStorage.setItem(i,JSON.stringify(e.getContext()))}function A(){const l=localStorage.getItem(i);return l?JSON.parse(l):{}}}function hn(r,e){return`${un}_${r}_${e}`}const gn=3*_,mn=16*_,pn=200;function En(r=2){const e=new Map;let s=!1;function t(i=0){if(s||r===0)return;const o=r===2?gn:mn;let n=i;e.forEach(a=>{n+=a.getBytesCount()}),n>o&&(Tn(o),s=!0)}return{createDetachedTracker:()=>{const i=es(()=>t(i.getBytesCount()));return i},getOrCreateTracker:i=>(e.has(i)||e.set(i,es(t)),e.get(i)),setCompressionStatus:i=>{r===0&&(r=i,t())},getCompressionStatus:()=>r,stop:()=>{e.forEach(i=>i.stop()),e.clear()}}}function es(r){let e=0;const{throttled:s,cancel:t}=cr(o=>{e=vt(de(o)),r()},pn),i=()=>{t(),e=0};return{updateCustomerData:o=>{Be(o)?i():s(o)},resetCustomerData:i,getBytesCount:()=>e,stop:()=>{t()}}}function Tn(r){M.warn(`Customer data exceeds the recommended ${r/_}KiB threshold. ${We} ${$t}/#customer-data-exceeds-the-recommended-threshold-warning`)}function bn(r,e,s){const t=r.getReader(),i=[];let o=0;n();function n(){t.read().then(I(A=>{if(A.done){a();return}i.push(A.value),o+=A.value.length,o>s.bytesLimit?a():n()}),I(A=>e(A)))}function a(){t.cancel().catch(te);let A,l;{let c;if(i.length===1)c=i[0];else{c=new Uint8Array(o);let d=0;i.forEach(u=>{c.set(u,d),d+=u.length})}A=c.slice(0,s.bytesLimit),l=c.length>s.bytesLimit}e(void 0,A,l)}}const Rn="datadog-synthetics-public-id",vn="datadog-synthetics-result-id",yn="datadog-synthetics-injects-rum";function ts(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||Ae(yn))}function Dn(){const r=window._DATADOG_SYNTHETICS_PUBLIC_ID||Ae(Rn);return typeof r=="string"?r:void 0}function In(){const r=window._DATADOG_SYNTHETICS_RESULT_ID||Ae(vn);return typeof r=="string"?r:void 0}function ct(r,e,s){const t=s.getHandler(),i=Array.isArray(t)?t:[t];return rs[r]>=rs[s.getLevel()]&&i.includes(e)}const D={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},rs={[D.ok]:0,[D.debug]:1,[D.info]:2,[D.notice]:4,[D.warn]:5,[D.error]:6,[D.critical]:7,[D.alert]:8,[D.emerg]:9};function lt(r,{includeMessage:e=!1}={}){return{stack:r.stack,kind:r.type,message:e?r.message:void 0,causes:r.causes,fingerprint:r.fingerprint,handling:r.handling}}var Sn=function(r,e,s,t){var i=arguments.length,o=i<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,s):t,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,s,t);else for(var a=r.length-1;a>=0;a--)(n=r[a])&&(o=(i<3?n(o):i>3?n(e,s,o):n(e,s))||o);return i>3&&o&&Object.defineProperty(e,s,o),o};const Qe={console:"console",http:"http",silent:"silent"},Cn=Object.keys(D);let Y=class{constructor(e,s,t,i=Qe.http,o=D.debug,n={}){this.handleLogStrategy=e,this.handlerType=i,this.level=o,this.contextManager=At("logger",{customerDataTracker:s}),this.contextManager.setContext(n),t&&this.contextManager.setContextProperty("logger",{name:t})}logImplementation(e,s,t=D.info,i,o){const n=j(s);let a;if(i!=null){const A=Cr({stackTrace:se(i)?K(i):void 0,originalError:i,nonErrorPrefix:"Provided",source:X.LOGGER,handling:"handled",startClocks:$()});a=ye({error:lt(A,{includeMessage:!0})},n)}else a=n;this.handleLogStrategy({message:j(e),context:a,status:t},this,o)}log(e,s,t=D.info,i){let o;ct(t,Qe.http,this)&&(o=tt("log")),this.logImplementation(e,s,t,i,o)}setContext(e){this.contextManager.setContext(e)}getContext(){return this.contextManager.getContext()}setContextProperty(e,s){this.contextManager.setContextProperty(e,s)}removeContextProperty(e){this.contextManager.removeContextProperty(e)}clearContext(){this.contextManager.clearContext()}setHandler(e){this.handlerType=e}getHandler(){return this.handlerType}setLevel(e){this.level=e}getLevel(){return this.level}};Sn([Ss],Y.prototype,"logImplementation",null),Y.prototype.ok=q(D.ok),Y.prototype.debug=q(D.debug),Y.prototype.info=q(D.info),Y.prototype.notice=q(D.notice),Y.prototype.warn=q(D.warn),Y.prototype.error=q(D.error),Y.prototype.critical=q(D.critical),Y.prototype.alert=q(D.alert),Y.prototype.emerg=q(D.emerg);function q(r){return function(e,s,t){let i;ct(r,Qe.http,this)&&(i=tt("log")),this.logImplementation(e,s,r,t,i)}}function Ln(r,e,s){return{view:{referrer:document.referrer,url:window.location.href},context:r.getContext(),user:e.getContext(),account:s.getContext()}}const xn=32*_;function Bn(r){r.usePciIntake===!0&&r.site&&r.site!=="datadoghq.com"&&M.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const e=Si(r),s=ss(r.forwardConsoleLogs,Ze(N),"Forward Console Logs"),t=ss(r.forwardReports,Ze(rt),"Forward Reports");if(!(!e||!s||!t))return r.forwardErrorsToLogs&&!s.includes(N.error)&&s.push(N.error),{forwardErrorsToLogs:r.forwardErrorsToLogs!==!1,forwardConsoleLogs:s,forwardReports:t,requestErrorResponseLengthLimit:xn,...e}}function ss(r,e,s){if(r===void 0)return[];if(!(r==="all"||Array.isArray(r)&&r.every(t=>e.includes(t)))){M.error(`${s} should be "all" or an array with allowed values "${e.join(\'", "\')}"`);return}return r==="all"?e:uo(r)}function wn(r){const e=Ci(r);return{forward_errors_to_logs:r.forwardErrorsToLogs,forward_console_logs:r.forwardConsoleLogs,forward_reports:r.forwardReports,use_pci_intake:r.usePciIntake,...e}}function Pn(r,e,s){const t=kr();let i,o;const n=e.observable.subscribe(a);function a(){if(!o||!i||!e.isGranted())return;n.unsubscribe();const A=s(i,o);t.drain(A)}return{init(A){if(!A){M.error("Missing configuration");return}if(Li(A.enableExperimentalFeatures),ot()&&(A=On(A)),i=A,o){wr("DD_LOGS",A);return}const l=Bn(A);l&&(o=l,$r().subscribe(te),e.tryToInit(l.trackingConsent),a())},get initConfiguration(){return i},getInternalContext:te,handleLog(A,l,c,d=r(),u=J()){t.add(g=>g.handleLog(A,l,c,d,u))}}}function On(r){return{...r,clientToken:"empty"}}const _t="logs";function Un(r){const e=En(),s=At("global context",{customerDataTracker:e.getOrCreateTracker(2)}),t=At("user",{customerDataTracker:e.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),i=At("account",{customerDataTracker:e.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),o=ni();function n(){return Ln(s,t,i)}let a=Pn(n,o,(c,d)=>{c.storeContextsAcrossPages&&(Zt(d,s,_t,2),Zt(d,t,_t,1),Zt(d,i,_t,4));const u=r(c,d,n,o);return a=Nn(c,u),u});const A={},l=new Y((...c)=>a.handleLog(...c),e.createDetachedTracker());return ro({logger:l,init:I(c=>a.init(c)),setTrackingConsent:I(c=>{o.update(c),Ro({feature:"set-tracking-consent",tracking_consent:c})}),getGlobalContext:I(()=>s.getContext()),setGlobalContext:I(c=>s.setContext(c)),setGlobalContextProperty:I((c,d)=>s.setContextProperty(c,d)),removeGlobalContextProperty:I(c=>s.removeContextProperty(c)),clearGlobalContext:I(()=>s.clearContext()),createLogger:I((c,d={})=>(A[c]=new Y((...u)=>a.handleLog(...u),e.createDetachedTracker(),j(c),d.handler,d.level,j(d.context)),A[c])),getLogger:I(c=>A[c]),getInitConfiguration:I(()=>Mr(a.initConfiguration)),getInternalContext:I(c=>a.getInternalContext(c)),setUser:I(t.setContext),getUser:I(t.getContext),setUserProperty:I(t.setContextProperty),removeUserProperty:I(t.removeContextProperty),clearUser:I(t.clearContext),setAccount:I(i.setContext),getAccount:I(i.getContext),setAccountProperty:I(i.setContextProperty),removeAccountProperty:I(i.removeContextProperty),clearAccount:I(i.clearContext)})}function Nn(r,e){return{init:s=>{wr("DD_LOGS",s)},initConfiguration:r,...e}}const Mn="logs";function Fn(r,e){const s=xo(r,Mn,t=>Qn(r,t),e);return{findTrackedSession:(t,i={returnInactive:!1})=>{const o=s.findSession(t,i);return o&&o.trackingType==="1"?{id:o.id,anonymousId:o.anonymousId}:void 0},expireObservable:s.expireObservable}}function kn(r){const s=is(r)==="1"?{}:void 0;return{findTrackedSession:()=>s,expireObservable:new k}}function is(r){return Ve(r.sessionSampleRate)?"1":"0"}function Qn(r,e){const s=Gn(e)?e:is(r);return{trackingType:s,isTracked:s==="1"}}function Gn(r){return r==="0"||r==="1"}let os=!1;function dt(r){const e=window;if(ts()){const t=s(e.DD_RUM_SYNTHETICS);return!t&&!os&&(os=!0,Gr("Logs sent before RUM is injected by the synthetics worker",{testId:Dn(),resultId:In()})),t}return s(e.DD_RUM);function s(t){if(t&&t.getInternalContext)return t.getInternalContext(r)}}function Wn(r,e,s,t,i){const o=Cn.concat(["custom"]),n={};o.forEach(a=>{n[a]=qo(a,e.eventRateLimiterThreshold,i)}),s.subscribe(0,({rawLogsEvent:a,messageContext:A=void 0,savedCommonContext:l=void 0,domainContext:c})=>{var d,u;const g=Rs(a.date),m=r.findTrackedSession(g);if(!r.findTrackedSession(g,{returnInactive:!0}))return;const f=l||t();let y;!Be(f.account)&&f.account.id&&(y=f.account),m&&m.anonymousId&&!f.user.anonymous_id&&(f.user.anonymous_id=m.anonymousId);const S=ye({service:e.service,session_id:m?m.id:void 0,session:m?{id:m.id}:void 0,usr:Be(f.user)?void 0:f.user,account:y,view:f.view},f.context,dt(g),a,A);((d=e.beforeSend)===null||d===void 0?void 0:d.call(e,S,c))===!1||S.origin!==X.AGENT&&((u=n[S.status])!==null&&u!==void 0?u:n.custom).isLimitReached()||s.notify(1,S)})}const Vn={[N.log]:D.info,[N.debug]:D.debug,[N.info]:D.info,[N.warn]:D.warn,[N.error]:D.error};function Xn(r,e){const s=an(r.forwardConsoleLogs).subscribe(t=>{var i;const o={rawLogsEvent:{date:J(),message:t.message,origin:X.CONSOLE,error:t.error&<(t.error),status:Vn[t.api]},messageContext:(i=t.error)===null||i===void 0?void 0:i.context,domainContext:{handlingStack:t.handlingStack}};e.notify(0,o)});return{stop:()=>{s.unsubscribe()}}}function Yn(r,e){const s=io(r,r.forwardReports).subscribe(t=>{let i=t.message,o;const n=t.originalError.type==="deprecation"?D.warn:D.error;n===D.error?o=lt(t):t.stack&&(i+=` Found in ${Ji(t.stack)}`),e.notify(0,{rawLogsEvent:{date:J(),message:i,origin:X.REPORT,error:o,status:n}})});return{stop:()=>{s.unsubscribe()}}}function Hn(r,e){if(!r.forwardErrorsToLogs)return{stop:te};const s=Jo(r).subscribe(o=>{o.state==="complete"&&i("xhr",o)}),t=$r().subscribe(o=>{o.state==="resolve"&&i("fetch",o)});function i(o,n){!Di(n.url)&&(Kn(n)||Vr(n.status))&&("xhr"in n?zn(n.xhr,r,a):n.response?_n(n.response,r,a):n.error&&Zn(n.error,r,a));function a(A){const l={isAborted:n.isAborted,handlingStack:n.handlingStack};e.notify(0,{rawLogsEvent:{message:`${jn(o)} error ${n.method} ${n.url}`,date:n.startClocks.timeStamp,error:{stack:A||"Failed to load",handling:void 0},http:{method:n.method,status_code:n.status,url:n.url},status:D.error,origin:X.NETWORK},domainContext:l})}}return{stop:()=>{s.unsubscribe(),t.unsubscribe()}}}function zn(r,e,s){typeof r.response=="string"?s(Kt(r.response,e)):s(r.response)}function Zn(r,e,s){s(Kt(ue(K(r)),e))}function _n(r,e,s){const t=Oo(r);!t||!t.body?s():window.TextDecoder?qn(t.body,e.requestErrorResponseLengthLimit,(i,o)=>{s(i?`Unable to retrieve response: ${i}`:o)}):t.text().then(I(i=>s(Kt(i,e))),I(i=>s(`Unable to retrieve response: ${i}`)))}function Kn(r){return r.status===0&&r.responseType!=="opaque"}function Kt(r,e){return r.length>e.requestErrorResponseLengthLimit?`${r.substring(0,e.requestErrorResponseLengthLimit)}...`:r}function jn(r){return r==="xhr"?"XHR":"Fetch"}function qn(r,e,s){bn(r,(t,i,o)=>{if(t)s(t);else{let n=new TextDecoder().decode(i);o&&(n+="..."),s(void 0,n)}},{bytesLimit:e,collectStreamBody:!0})}function Jn(r,e){if(!r.forwardErrorsToLogs)return{stop:te};const s=new k,{stop:t}=$i(s),i=s.subscribe(o=>{e.notify(0,{rawLogsEvent:{message:o.message,date:o.startClocks.timeStamp,error:lt(o),origin:X.SOURCE,status:D.error},messageContext:o.context})});return{stop:()=>{t(),i.unsubscribe()}}}const $n=jo;function ea(r){function e(s,t,i,o,n){const a=ye(t.getContext(),s.context);if(ct(s.status,Qe.console,t)&&ra(s,a),ct(s.status,Qe.http,t)){const A={rawLogsEvent:{date:n||J(),message:s.message,status:s.status,origin:X.LOGGER},messageContext:a,savedCommonContext:o};i&&(A.domainContext={handlingStack:i}),r.notify(0,A)}}return{handleLog:e}}const ta={[D.ok]:N.debug,[D.debug]:N.debug,[D.info]:N.info,[D.notice]:N.info,[D.warn]:N.warn,[D.error]:N.error,[D.critical]:N.error,[D.alert]:N.error,[D.emerg]:N.error};function ra({status:r,message:e},s){ne[ta[r]].call(H,e,s)}function sa(r,e,s,t,i){const o=Jr(r,{endpoint:r.logsEndpointBuilder,encoder:at()},r.replica&&{endpoint:r.replica.logsEndpointBuilder,encoder:at()},s,t,i.expireObservable);return e.subscribe(1,n=>{o.add(n)}),o}function ia(r){const e=Wt();r.subscribe(1,s=>{e.send("log",s)})}function oa(r){return{get:e=>{const s=r.findTrackedSession(e);if(s)return{session_id:s.id}}}}function na(r){return e=>{r.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,origin:X.AGENT,status:D.error}}),Gr("Error reported to customer",{"error.message":e.message})}}function aa(r,e,s,t,i){const o=mo("browser-logs-sdk",e);o.setContextProvider(()=>{var a,A,l,c,d,u;return{application:{id:(a=dt())===null||a===void 0?void 0:a.application_id},session:{id:(A=i.findTrackedSession())===null||A===void 0?void 0:A.id},view:{id:(c=(l=dt())===null||l===void 0?void 0:l.view)===null||c===void 0?void 0:c.id},action:{id:(u=(d=dt())===null||d===void 0?void 0:d.user_action)===null||u===void 0?void 0:u.id}}});const n=[];if(ot()){const a=Wt(),A=o.observable.subscribe(l=>a.send("internal_telemetry",l));n.push(()=>A.unsubscribe())}else{const a=Jr(e,{endpoint:e.rumEndpointBuilder,encoder:at()},e.replica&&{endpoint:e.replica.rumEndpointBuilder,encoder:at()},s,t,i.expireObservable);n.push(()=>a.stop());const A=o.observable.subscribe(l=>a.add(l,To(e)));n.push(()=>A.unsubscribe())}return Eo(),bo(wn(r)),{telemetry:o,stop:()=>{n.forEach(a=>a())}}}function Aa(r,e,s,t){const i=new $n,o=[];i.subscribe(1,u=>Ur("logs",u));const n=na(i),a=zo(e),A=e.sessionStoreStrategyType&&!ot()&&!ts()?Fn(e,t):kn(e),{stop:l}=aa(r,e,n,a,A);o.push(()=>l()),Hn(e,i),Jn(e,i),Xn(e,i),Yn(e,i);const{handleLog:c}=ea(i);if(Wn(A,e,i,s,n),ot())ia(i);else{const{stop:u}=sa(e,i,n,a,A);o.push(()=>u())}const d=oa(A);return{handleLog:c,getInternalContext:d.get,stop:()=>{o.forEach(u=>u())}}}const me=Un(Aa);so(ee(),"DD_LOGS",me);const Q=class Q{constructor(e,s,t,i,o){this.copy=()=>new Q(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const n=":";let a=("0"+this.h).slice(-2)+n+("0"+this.m).slice(-2)+n+("0"+this.s).slice(-2)+n+("0"+this.f).slice(-2);return a+="."+(this.field?"1":"2"),a},this.toZipTimeCodeString=()=>{const n=this.copy();return n.f=0,n.s=n.s%2===0?n.s:n.s-1,n.field=0,Q.toStr(n)},this.toFrames=n=>{let a=60,A=0;Math.floor(n)==60?(a=60,A=0):Math.floor(n)==59?(a=60,A=4):Math.floor(n)==30?(a=30,A=0):Math.floor(n)==29&&(a=30,A=2);let l=this.h,c=this.m,d=this.s,u=this.f,g=this.field;const m=l*60+c,f=(m-Math.floor(m/10))*A;return l*(a*3600)+c*(a*60)+d*a+(u*2+g)-f},this.addSeconds=n=>{let a=this.copy();if(a.s+=n,a.s>=60){const A=Math.floor(a.s/60);if(a.s=a.s%60,a.m+=A,a.m>=60){const l=Math.floor(a.m/60);a.m=a.m%60,a.h+=l}}return a},this.addFrames=(n,a)=>{let A=this.toFrames(a);return A+=n,Q.fromFrames(A,a)},this.subtractFrames=(n,a)=>this.addFrames(-n,a),this.h=e||0,this.m=s||0,this.s=t||0,this.f=i||0,this.field=o||0}static compare(e,s){return e.h!==s.h?e.h<s.h?-1:1:e.m!==s.m?e.m<s.m?-1:1:e.s!==s.s?e.s<s.s?-1:1:e.f!==s.f?e.f<s.f?-1:1:e.field!==s.field?e.field<s.field?-1:1:0}static generateTimecodeRange(e,s,t){const i=[];let o=e;for(;Q.compare(o,s)<=0;)i.push(o),o=o.addSeconds(t);return i}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(e){return this.toFrames(e)*1e3/e}};Q.calculateCurrentTimeCode=e=>{var d;if(!e.video||!e.clocker||!e.gameParams)throw new Error("OTTPlayer is not initialized");const s=e.video,t=e.clocker,i=t.videoFPScalculator.getFPS(),a=(s.currentTime-t.syncPoint.playerTime)%(60*60*24)*i+t.syncPoint.frame;if(a===0||i===0)throw new Error("Current frame is 0 or fps is 0");const A=Q.calculateCurrentOffset(a,(d=e.gameParams)==null?void 0:d.offsets);if(A===void 0)throw new Error("Offset is undefined");let l=Math.floor(a-A);return l<0&&(l+=5178816),l>=5178816&&(l-=5178816),Q.fromFrames(l,i)},Q.calculateCurrentOffset=(e,s)=>{for(let t=1;t<s.length;t++)if(e<s[t].frame)return s[t-1].offset;return Math.abs(s[s.length-1].offset)},Q.fromFrames=(e,s)=>{let t=60,i=0;Math.floor(s)==60?(t=60,i=0):Math.floor(s)==59?(t=60,i=4):Math.floor(s)==30?(t=30,i=0):Math.floor(s)==29&&(t=30,i=2);let o=Math.floor(s*60),n=Math.floor(s*60*10),a=n*6,A=e,l=Math.floor(A/a);A-=l*a;let c=Math.floor(A/n);A-=c*n,A>=t*60&&(A+=i*(Math.floor((A-t*60)/o)+1));let d=Math.floor(A/(t*60));A-=d*(t*60);let u=Math.floor(A/t);A-=u*t;let g=A;d+=c*10;let m=0;return m=g%2,g=Math.floor(g/2),new Q(l,d,u,g,m)},Q.toStr=e=>{const s="_";let t=("0"+e.h).slice(-2)+s+("0"+e.m).slice(-2)+s+("0"+e.s).slice(-2)+s+("0"+e.f).slice(-2);return e.field&&(t+="_1"),t},Q.fromStr=e=>{const t=e.split("_").map(Number);if(t.length==4){const[i,o,n,a]=t;return new Q(i,o,n,a,0)}else if(t.length==5){const[i,o,n,a,A]=t;return new Q(i,o,n,a,A)}else throw new Error("Invalid timecode format: "+e)},Q.fromMetadata=e=>{const s=/^(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d))?$/,t=e.timecode.match(s);if(!t)throw new Error("Invalid timecode format: "+e.timecode);const[,i,o,n,a,A]=t,l=Number(i),c=Number(o),d=Number(n),u=Number(a),g=A?Number(A):0;return new Q(l,c,d,u,g)};let z=Q;const T=class T{constructor(e){this.listenerMap=new Map,T.options=e,this.isLoggingOn=e.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&me.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const s="bb_logger_mac_uuid";let t=localStorage.getItem(s);t||(t=crypto.randomUUID(),localStorage.setItem(s,t)),T.tracking.mac=t,T.tracking.dev=`${e.platform}_${e.browserName}`,T.beatHandle||(T.options&&h(T.options,"Logger")&&console.log("[Logger] Starting tracking beat"),T.beatHandle=window.setInterval(T.flushTracking,15e3))}static setMessagePort(e){this.messagePort=e}static getMessagePort(){return this.messagePort}setLoggingOn(e){this.isLoggingOn=e}addEventListener(e,s){const t=i=>s(i);this.listenerMap.set(s,{eventName:e,wrappedListener:t}),this.eventTarget.addEventListener(e,t)}removeEventListener(e,s){const t=this.listenerMap.get(s);t&&t.eventName===e&&(this.eventTarget.removeEventListener(e,t.wrappedListener),this.listenerMap.delete(s))}removeAllEventListeners(){for(const[e,{eventName:s,wrappedListener:t}]of this.listenerMap)this.eventTarget.removeEventListener(s,t);this.listenerMap.clear()}setAttributes(e){T.processAttributes(e);for(const s in e)me.logger.setContextProperty(s,e[s])}info(e,s){e==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(s==null?void 0:s.url)||""}),e==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(s==null?void 0:s.isEnabled)??!0}),e==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",s),e==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",s),e==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",s),s&&T.processAttributes(s),this.isLoggingOn&&(me.logger.info(e,s),T.options&&h(T.options,"Logger")&&console.log("[Logger] Sending info: ",e))}error(e,s){this.emit("mediaSessionDidError",{message:e,...s||{}}),s&&T.processAttributes(s),this.isLoggingOn&&(me.logger.error(e,s),T.tracking.err_time=Date.now().toFixed(0),T.tracking.err_desc=e+(s?` - ${JSON.stringify(s)}`:""),T.options&&h(T.options,"Logger")&&console.log("[Logger] Sending error: ",e))}criticalError(e,s){this.emit("mediaSessionDidFailOnError",{message:e,...s||{}}),s&&T.processAttributes(s),this.isLoggingOn&&(me.logger.error(e,s),T.tracking.err_time=Date.now().toFixed(0),T.tracking.err_desc=e+(s?` - ${JSON.stringify(s)}`:""),T.options&&h(T.options,"Logger")&&console.log("[Logger] Sending critical error: ",e))}warn(e,s){s&&T.processAttributes(s),this.isLoggingOn&&(me.logger.warn(e,s),T.options&&h(T.options,"Logger")&&console.log("[Logger] Sending warn: ",e))}handleMessageFromWorker(e){e.actionType==="INFO"?this.info(e.message,e.attributes):e.actionType==="ERROR"?this.error(e.message,e.attributes):e.actionType==="CRITICAL_ERROR"?this.criticalError(e.message,e.attributes):e.actionType==="WARN"?this.warn(e.message,e.attributes):e.actionType==="SET_ATTRIBUTES"&&e.attributes&&this.setAttributes(e.attributes)}static setAttributes(e){if(!T.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{T.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:e})}catch(s){console.error("[Logger] Error posting message:",s)}}static info(e,s){T.messagePort.postMessage({type:"LOG",actionType:"INFO",message:e,attributes:s})}static error(e,s){T.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:e,attributes:s})}static warn(e,s){T.messagePort.postMessage({type:"LOG",actionType:"WARN",message:e,attributes:s})}static criticalError(e,s){T.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:e,attributes:s})}static processAttributes(e){if(e.player_version&&(T.tracking.sdk=e.player_version),e.media_id&&(T.tracking.gid=e.media_id),e.game_id&&(T.tracking.buc=e.game_id),e.bb_session_id&&(T.tracking.sid=e.bb_session_id,T.options&&h(T.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",T.tracking.sid)),e.last_timecode){const t=z.fromStr(e.last_timecode);T.tracking.tc=t.print(),T.lastTimecodeMillis=t.totalMilliseconds(59.94),T.lastTimecodeMillis&&T.lastZipMillis&&(T.tracking.cache=(T.lastZipMillis-T.lastTimecodeMillis).toFixed(0))}e.last_offset&&(T.tracking.off=e.last_offset),e.last_loading_zip&&(T.tracking.zip=e.last_loading_zip+".zip",T.lastZipMillis=z.fromStr(e.last_loading_zip).totalMilliseconds(59.94),T.lastTimecodeMillis&&T.lastZipMillis&&(T.tracking.cache=(T.lastZipMillis-T.lastTimecodeMillis).toFixed(0))),e.last_rendered_frame&&(T.tracking.aug_time=Date.now().toFixed(0)),e.asset&&(T.tracking.asset=e.asset)}static objectToQuery(e){return Object.entries(e).filter(([s,t])=>t!==0&&t!=="").map(([s,t])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(t))}`).join("&")}emit(e,s){const t=new CustomEvent(e,{detail:s});this.eventTarget.dispatchEvent(t)}};T.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},T.lastTimecodeMillis=0,T.lastZipMillis=0,T.flushTracking=()=>{const e=Date.now().toFixed(0);T.tracking.now=e;const t=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${T.objectToQuery(T.tracking)}&platform=Web`;T.options&&h(T.options,"Logger")&&console.log("[Logger] Flushing tracking data:",t),fetch(t,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),T.tracking.err_desc="",T.tracking.err_time=""};let B=T;const ca=`\nattribute vec2 a_position;\nattribute vec2 a_uv;\n\nvarying vec2 v_uv;\n\nvoid main() {\n // Flip Y coordinate to correct upside-down rendering\n v_uv = vec2(a_uv.x, 1.0 - a_uv.y);\n gl_Position = vec4(a_position * 2.0 - 1.0, 0.0, 1.0);\n}\n`,la=`\nprecision mediump float;\n\nuniform sampler2D u_videoTexture;\nvarying vec2 v_uv;\n\nvoid main() {\n gl_FragColor = texture2D(u_videoTexture, v_uv);\n}\n`,da=`\nprecision highp float;\n\nattribute vec2 a_position; // pixel coords, 6 verts / quad\nattribute vec4 a_uv; // atlas UV (min_u, min_v, max_u, max_v)\nattribute mat3 a_transform; // transformation matrix for this vertex\n\nuniform vec2 u_resolution; // full frame size\n\nvarying vec2 v_maskUV; // for alpha mask\nvarying vec4 v_adUV; // atlas UV bounds\nvarying mat3 v_transform; // pass transform to fragment shader\n\nvoid main () {\n vec2 clipSpace = 2.0 * (a_position / u_resolution) - 1.0;\n gl_Position = vec4(clipSpace * vec2(1.0,-1.0), 0.0, 1.0);\n\n v_adUV = a_uv; // Pass through all 4 UV coordinates\n v_maskUV = a_position / u_resolution;\n v_transform = a_transform;\n}\n`,ua=`\nprecision highp float;\n\nuniform sampler2D u_atlas; // packed logos\nuniform sampler2D u_alphaMask; // full-frame mask (changes every video frame)\nuniform float u_opacity;\nuniform float u_aaStrength; // AA strength multiplier (1.0 = auto, >1.0 = softer, <1.0 = sharper)\nuniform float u_useAlphaMask; // 1.0 = apply alpha mask, 0.0 = bypass (e.g. player circles)\nuniform vec4 u_tintColor; // rgb = tint, a = mix factor (0.0 = use texture, 1.0 = use tint)\nuniform vec2 u_resolution; // processing size (placeholders space)\nuniform vec2 u_canvasResolution; // actual canvas size (gl_FragCoord space)\n\nvarying vec4 v_adUV; // min_u, min_v, max_u, max_v\nvarying vec2 v_maskUV;\nvarying mat3 v_transform; // transformation matrix for this fragment\n\nvec2 transformPoint(vec2 point) {\n float x = (v_transform[0][0] * point.x + v_transform[0][1] * point.y + v_transform[0][2]) / \n (v_transform[2][0] * point.x + v_transform[2][1] * point.y + 1.0);\n float y = (v_transform[1][0] * point.x + v_transform[1][1] * point.y + v_transform[1][2]) / \n (v_transform[2][0] * point.x + v_transform[2][1] * point.y + 1.0);\n return vec2(x, y) / u_resolution;\n}\n\nvoid main () {\n // Convert current fragment coord (canvas space) to processing space\n vec2 curCanvas = vec2(gl_FragCoord.x, u_canvasResolution.y - gl_FragCoord.y);\n vec2 scale = vec2(u_resolution.x / u_canvasResolution.x, u_resolution.y / u_canvasResolution.y);\n vec2 curProcessing = curCanvas * scale;\n \n // Transform the current position using the transformation matrix\n vec2 transformedUV = transformPoint(curProcessing);\n \n // Logo bounds in normalized space (texel-center coordinates)\n float left = -0.5 / u_resolution.x;\n float right = 1.0 + 0.5 / u_resolution.x;\n float top = -0.5 / u_resolution.y;\n float bottom = 1.0 + 0.5 / u_resolution.y;\n \n // Hard discard well outside bounds to avoid artifacts\n if(transformedUV.x < left - 0.01 || transformedUV.x > right + 0.01 || \n transformedUV.y < top - 0.01 || transformedUV.y > bottom + 0.01) {\n discard;\n }\n \n // --- Analytic antialiasing: calculate screen-space derivatives ---\n // Extract transform components\n float M00 = v_transform[0][0], M01 = v_transform[0][1], M02 = v_transform[0][2];\n float M10 = v_transform[1][0], M11 = v_transform[1][1], M12 = v_transform[1][2];\n float M20 = v_transform[2][0], M21 = v_transform[2][1];\n \n float w = M20 * curProcessing.x + M21 * curProcessing.y + 1.0;\n float invw = 1.0 / max(abs(w), 1e-6);\n float invw2 = invw * invw;\n \n float nx = M00 * curProcessing.x + M01 * curProcessing.y + M02;\n float ny = M10 * curProcessing.x + M11 * curProcessing.y + M12;\n \n // Derivatives of transformed coordinates w.r.t. screen space\n float dtx_dx = (M00 * w - nx * M20) * invw2 / u_resolution.x;\n float dtx_dy = (M01 * w - nx * M21) * invw2 / u_resolution.y;\n float dty_dx = (M10 * w - ny * M20) * invw2 / u_resolution.x;\n float dty_dy = (M11 * w - ny * M21) * invw2 / u_resolution.y;\n \n // Approximate fwidth (how much logo-space coords change per screen pixel)\n float dxAA = abs(dtx_dx) + abs(dtx_dy);\n float dyAA = abs(dty_dx) + abs(dty_dy);\n \n // Apply AA strength multiplier\n float aaStrength = max(u_aaStrength, 0.1);\n dxAA *= aaStrength;\n dyAA *= aaStrength;\n \n // Distance to each edge in logo-normalized space\n float distLeft = transformedUV.x - 0.0;\n float distRight = 1.0 - transformedUV.x;\n float distTop = transformedUV.y - 0.0;\n float distBottom = 1.0 - transformedUV.y;\n \n // Coverage based on distance to edges (antialiasing on all 4 edges)\n float covX = min(smoothstep(0.0, dxAA, distLeft), smoothstep(0.0, dxAA, distRight));\n float covY = min(smoothstep(0.0, dyAA, distTop), smoothstep(0.0, dyAA, distBottom));\n float coverage = min(covX, covY);\n \n // Clamp UV to valid range for sampling\n vec2 clampedUV = clamp(transformedUV, 0.0, 1.0);\n \n // Map the clamped coordinate to the atlas region\n vec2 atlasUV = mix(vec2(v_adUV.x, v_adUV.y), // min_u, min_v\n vec2(v_adUV.z, v_adUV.w), // max_u, max_v\n clampedUV); // interpolation factor\n \n float rawMask = texture2D(u_alphaMask, v_maskUV).r;\n float mask = mix(1.0, rawMask, u_useAlphaMask);\n vec4 ad = texture2D(u_atlas, atlasUV);\n vec3 finalRGB = mix(ad.rgb, u_tintColor.rgb, u_tintColor.a);\n\n // Apply coverage-based antialiasing to alpha\n float a = ad.a * mask * u_opacity * coverage;\n gl_FragColor = vec4(finalRGB * a, a);\n}\n`,fa=`\nattribute vec2 a_position; // 0..1 full-screen quad\nattribute vec2 a_uv; // 0..1\n\nvarying vec2 v_uv;\n\nvoid main() {\n v_uv = a_uv;\n gl_Position = vec4(a_position * 2.0 - 1.0, 0.0, 1.0);\n}\n`,ha=`\nprecision mediump float;\n\nuniform sampler2D u_overlay; // LED overlay texture (padded FBO)\nuniform sampler2D u_alphaMask; // same alpha mask as legacy augmentation\nuniform vec4 u_uvRect; // crop rect in overlay UVs (u0,v0,u1,v1)\nuniform vec2 u_resolution; // main canvas size (processing size)\n\nvarying vec2 v_uv; // 0..1 across main canvas\n\nvoid main() {\n // Sample overlay with cropped UVs\n vec2 uv = mix(u_uvRect.xy, u_uvRect.zw, v_uv);\n vec4 overlay = texture2D(u_overlay, uv);\n\n // Sample alpha mask using main-canvas coords (flip Y to match augmentation)\n vec2 maskUV = vec2(gl_FragCoord.x / u_resolution.x, 1.0 - (gl_FragCoord.y / u_resolution.y));\n float mask = texture2D(u_alphaMask, maskUV).r;\n\n // Simple composite with mask\n gl_FragColor = vec4(overlay.rgb, overlay.a * mask);\n}\n`,ga=`\nattribute vec2 aPos;\nvarying vec2 vUV;\nuniform vec4 uUVRect; // (u0,v0,u1,v1)\nvoid main(){\n vUV = mix(uUVRect.xy, uUVRect.zw, (aPos*0.5)+0.5);\n gl_Position = vec4(aPos,0.0,1.0);\n}`,ma=`\nprecision highp float;\nuniform sampler2D uTex;\nvarying vec2 vUV;\nvoid main(){ gl_FragColor = texture2D(uTex, vUV); }`,pa=`\nprecision highp float;\nattribute float aCornerIndex; // 0=TL,1=TR,2=BR,3=BL\nattribute vec2 aDstTL;\nattribute vec2 aDstTR;\nattribute vec2 aDstBR;\nattribute vec2 aDstBL;\nattribute vec3 aH0; // Hinv rows (screen -> slice)\nattribute vec3 aH1;\nattribute vec3 aH2;\nattribute float aU0; // normalized u0\nattribute float aSliceW; // slice width in pixels\n\nuniform vec2 uResolution; // target surface size in pixels\nuniform vec2 uShift; // pixel shift BEFORE normalization (see Pass A note)\nuniform bool uFlipY; // true for top-left pixel coords\n\nvarying vec3 vH0; varying vec3 vH1; varying vec3 vH2;\nvarying float vU0; varying float vSliceW;\n\nvec2 pick2(vec2 tl, vec2 tr, vec2 br, vec2 bl, float i){\n if (i < 0.5) return tl;\n if (i < 1.5) return tr;\n if (i < 2.5) return br;\n return bl;\n}\nvec2 toNDC(vec2 p){\n float xN = (p.x + uShift.x) / uResolution.x;\n float yN = (p.y + uShift.y) / uResolution.y;\n if (uFlipY) yN = 1.0 - yN;\n return vec2(xN, yN) * 2.0 - 1.0;\n}\nvoid main(){\n vec2 dst = pick2(aDstTL, aDstTR, aDstBR, aDstBL, aCornerIndex);\n gl_Position = vec4(toNDC(dst), 0.0, 1.0);\n vH0=aH0; vH1=aH1; vH2=aH2; vU0=aU0; vSliceW=aSliceW;\n}`,Ea=`\nprecision highp float;\nuniform sampler2D uArt;\nuniform vec2 uResolution; // same as VS\nuniform vec2 uArtSize; // (artW, artH)\nuniform float uEdgeFeatherPx; // AA strength multiplier (1.0 = auto, >1.0 = softer, <1.0 = sharper)\nvarying vec3 vH0; varying vec3 vH1; varying vec3 vH2;\nvarying float vU0; varying float vSliceW;\nvoid main(){\n // gl_FragCoord is bottom-left; convert to top-left pixels with uResolution.y - y\n vec2 scr = vec2(gl_FragCoord.x, uResolution.y - gl_FragCoord.y);\n float wx = dot(vH0, vec3(scr, 1.0));\n float wy = dot(vH1, vec3(scr, 1.0));\n float w = dot(vH2, vec3(scr, 1.0));\n if (abs(w) < 1e-6) discard;\n float invw = 1.0 / w;\n float sx = wx * invw;\n float sy = wy * invw;\n\n // slice window in texel-center space\n float left = -0.5;\n float right = vSliceW - 0.5;\n float top = -0.5;\n float bottom = uArtSize.y - 0.5;\n\n // --- analytic "fwidth" approximation (per 1 screen pixel) ---\n float dsx_dx = (vH0.x * w - wx * vH2.x) * (invw * invw);\n float dsx_dy = (vH0.y * w - wx * vH2.y) * (invw * invw);\n float dsy_dx = (vH1.x * w - wy * vH2.x) * (invw * invw);\n float dsy_dy = (vH1.y * w - wy * vH2.y) * (invw * invw);\n\n // like fwidth: |d/dx| + |d/dy|\n float dxAA = abs(dsx_dx) + abs(dsx_dy);\n float dyAA = abs(dsy_dx) + abs(dsy_dy);\n\n // Apply AA strength multiplier\n float aaStrength = max(uEdgeFeatherPx, 0.1);\n dyAA *= aaStrength;\n dxAA *= aaStrength;\n\n // distance to nearest border in slice-space\n float distX = min(sx - left, right - sx);\n float distY = min(sy - top, bottom - sy);\n\n // coverage over ~1 screen pixel\n //float covX = clamp(distX / max(dxAA, 1e-6), 0.0, 1.0);\n //float covY = clamp(distY / max(dyAA, 1e-6), 0.0, 1.0);\n // softer rolloff, use smoothstep instead:\n float covY = smoothstep(0.0, dyAA, distY);\n //float coverage = min(covX, covY);\n float coverage = covY;\n\n // sample inside the slice (center-sample + clamp to avoid holes)\n float sxc = clamp(sx, left, right);\n float syc = clamp(sy, top, bottom);\n float u = vU0 + (sxc + 0.5) / uArtSize.x;\n float v = (syc + 0.5) / uArtSize.y;\n\n vec2 texel = 1.0 / uArtSize;\n float sigX = 0.0;//max(uBlurPxX, 0.0);\n float sigY = 0.0;//max(uBlurPxY, 0.0);\n vec4 tex;\n\n if (sigX == 0.0 && sigY == 0.0) {\n // no blur\n tex = texture2D(uArt, vec2(fract(u), clamp(v, 0.0, 1.0)));\n }\n else if (sigY == 0.0) {\n // ---- horizontal Gaussian blur (fast) ----\n const int MAX_R = 8; // up to 17 taps\n int r = int(min(floor(3.0 * sigX + 0.5), float(MAX_R)));\n\n vec3 accumRGBp = vec3(0.0); // premultiplied RGB\n float accumA = 0.0;\n float wsum = 0.0;\n\n for (int k = -MAX_R; k <= MAX_R; ++k) {\n float fk = float(k);\n // mask: 1.0 when |k| <= r (no abs(int)!)\n float m = step(abs(fk), float(r) + 0.5);\n\n // Gaussian weight (guard sigma)\n float wG = exp(-0.5 * (fk*fk) / max(sigX*sigX, 1e-6));\n\n float uTap = fract(u + fk * texel.x); // wrap X\n vec4 s = texture2D(uArt, vec2(uTap, clamp(v, 0.0, 1.0)));\n\n float wM = wG * m;\n accumRGBp += wM * (s.rgb * s.a);\n accumA += wM * s.a;\n wsum += wM;\n }\n vec3 rgb = (accumA > 1e-6) ? (accumRGBp / accumA) : vec3(0.0);\n float a = accumA / max(wsum, 1e-6);\n tex = vec4(rgb, a);\n }\n else if (sigX == 0.0) {\n // ---- vertical-only blur ----\n const int MAX_RY = 8;\n int ry = int(min(floor(3.0 * sigY + 0.5), float(MAX_RY)));\n\n vec3 accumRGBp = vec3(0.0);\n float accumA = 0.0;\n float wsum = 0.0;\n\n for (int j = -MAX_RY; j <= MAX_RY; ++j) {\n float fj = float(j);\n float m = step(abs(fj), float(ry) + 0.5);\n float wG = exp(-0.5 * (fj*fj) / max(sigY*sigY, 1e-6));\n\n float vTap = clamp(v + fj * texel.y, 0.0, 1.0); // clamp Y\n vec4 s = texture2D(uArt, vec2(fract(u), vTap));\n\n float wM = wG * m;\n accumRGBp += wM * (s.rgb * s.a);\n accumA += wM * s.a;\n wsum += wM;\n }\n vec3 rgb = (accumA > 1e-6) ? (accumRGBp / accumA) : vec3(0.0);\n float a = accumA / max(wsum, 1e-6);\n tex = vec4(rgb, a);\n }\n else {\n // ---- small 2D Gaussian (separable would also work) ----\n const int MAX_RX = 4, MAX_RY = 4; // up to 9x9 taps\n int rx = int(min(floor(3.0 * sigX + 0.5), float(MAX_RX)));\n int ry = int(min(floor(3.0 * sigY + 0.5), float(MAX_RY)));\n\n vec3 accumRGBp = vec3(0.0);\n float accumA = 0.0;\n float wsum = 0.0;\n\n for (int j = -MAX_RY; j <= MAX_RY; ++j) {\n float fj = float(j);\n float my = step(abs(fj), float(ry) + 0.5);\n for (int i = -MAX_RX; i <= MAX_RX; ++i) {\n float fi = float(i);\n float mx = step(abs(fi), float(rx) + 0.5);\n\n float wG = exp(-0.5*(fi*fi)/max(sigX*sigX,1e-6)\n -0.5*(fj*fj)/max(sigY*sigY,1e-6));\n float uTap = fract(u + fi * texel.x); // wrap X\n float vTap = clamp(v + fj * texel.y, 0.0, 1.0); // clamp Y\n vec4 s = texture2D(uArt, vec2(uTap, vTap));\n\n float wM = wG * mx * my;\n accumRGBp += wM * (s.rgb * s.a);\n accumA += wM * s.a;\n wsum += wM;\n }\n }\n vec3 rgb = (accumA > 1e-6) ? (accumRGBp / accumA) : vec3(0.0);\n float a = accumA / max(wsum, 1e-6);\n tex = vec4(rgb, a);\n }\n\n // keep your current vertical AA:\n gl_FragColor = vec4(tex.rgb, tex.a * coverage);\n \n}`,jt=`\nattribute vec2 aPos;\nvarying vec2 vUV;\nvoid main(){\n vUV = (aPos + 1.0) * 0.5; // Convert from [-1,1] to [0,1]\n gl_Position = vec4(aPos, 0.0, 1.0);\n}`,qt=`\nprecision mediump float;\nuniform sampler2D uFBOTex;\nvarying vec2 vUV;\nvoid main(){\n gl_FragColor = texture2D(uFBOTex, vUV);\n}`;function Ta(r,e,s){let t=0,i=0;for(const o of Object.values(r)){const n=o.corners,a=Math.abs(ns(n));if(!a)continue;const A=ba(n,e,s),l=A.length>=3?Math.abs(ns(A)):0;t+=l,i+=a}return{percentOfAd:i?t/i*100:0,percentOfScreen:t/(e*s)*100}}function ns(r){let e=0;for(let s=0,t=r.length-1;s<r.length;t=s++)e+=r[t].x*r[s].y-r[s].x*r[t].y;return e*.5}function ba(r,e,s){const t=[{inside:o=>o.x>=0,inter:(o,n)=>({x:0,y:o.y+(n.y-o.y)*(0-o.x)/(n.x-o.x)})},{inside:o=>o.x<=e,inter:(o,n)=>({x:e,y:o.y+(n.y-o.y)*(e-o.x)/(n.x-o.x)})},{inside:o=>o.y>=0,inter:(o,n)=>({x:o.x+(n.x-o.x)*(0-o.y)/(n.y-o.y),y:0})},{inside:o=>o.y<=s,inter:(o,n)=>({x:o.x+(n.x-o.x)*(s-o.y)/(n.y-o.y),y:s})}];let i=r;for(const o of t){const n=i;if(i=[],!n.length)break;let a=n[n.length-1];for(const A of n){const l=o.inside(A),c=o.inside(a);l?(c||i.push(o.inter(a,A)),i.push(A)):c&&i.push(o.inter(a,A)),a=A}}return i}var Ra="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhYAAAIWCAYAAAALR8TTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAJ5mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0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ggUA2BMFDuvrLdNoNMzm5qbZ2trc00QslV8pc6LsR61WsxcAILvIgAAA9uSjjy4FvhRrL4sJ/dZz7f1QAKIARsEH2Q8AyDYCEADAninwUEChS2VYCjDuF4CoV0T/W02+0v+tAhgAQLYRgAAA9qxzGpb6QZQFudtELP09BR8KOpT50P+drg8+eI/sBwBkHAEIAGDP5ufnAjWTu0Akf9+JWG7ylRrPK7b5XBcAAAQgAIB9UfbDlVTld0qxhu4ZgPjeDwUiMzNnyH4AAAhAAAD7s7i4YBcT6lIwoiDkzl4QBSUq0dLCwUqlbKrVamSfFwAQL4zhBQDsm7IarVbTBiHr6+tmY2PDjuQNQ/V/BLY0y2U/inb87vT0h2Q/AAAWGRAAwL4puMjncztTsYZtxkO9IAo+9Gs/KcsFIvmoPy4AIEYIQAAA+zY9PbVThuWmYSnQGB52QYf+2jWpu/+/qakpsh8AgDZKsAAABzI6Om4ajaZZW2uYZrO1U4IV2sBDE6/U/6ELAIBOZEAAAAfy3nu/CNQLolIslWFp6pUmYykAcVfezM2dI/sBALhNoNMqAAAO6oknngyvXLls1tbWbB+Itp1r6tVvf/sbgg8AwJcQgAAADu3RRx8LNRVLAYg2pf/6178i+AAA3BUBCAAAAIC+oQcEAAAAQN8QgAAAAADoGwIQAAAAAH1DAAIAAACgbwhAAAAAAPQNAQgAAACAviEAAQAAANA3BCAAAAAA+oYABAAAAIDpl/8f5YhO5tQcp94AAAAASUVORK5CYII=";const ya=80,Da=30,Ia=50,Jt=[1,.7,.09];function Sa(r,e,s){const t=r.x*s.width,i=r.y*s.height;let o=null,n=1/0;for(const a of e){const A=a.locs.centroid2D.x,l=a.locs.centroid2D.y,c=t-A,d=i-l,u=Math.sqrt(c*c+d*d);u<=ya&&u<n&&(n=u,o=a)}return o}class as{constructor(e,s){this.playerTexturesLoaded=!1,this.logoToRegion=new Map,this.atlasDirty=!1,this.nextX=0,this.nextY=0,this.rowH=0,this.INITIAL_ATLAS_SIZE=256,this.ATLAS_SIZE=this.INITIAL_ATLAS_SIZE,this.ATLAS_PADDING=4,this.ledOverlayW=0,this.ledOverlayH=0,this.LED_PADDING=100,this.LED_AA_STRENGTH=1,this.LOGO_AA_STRENGTH=1,this.ledArtW=0,this.ledArtH=0,this.ledCubes=[],this.queryInFlight=!1,this.GPUFrameTimeCount=0,this.GPUFrameTimeSum=0,this.avgGPUFrameTime=0,this.CPUFrameTimeCount=0,this.CPUFrameTimeSum=0,this.avgCPUFrameTime=0,this.timestampW=0,this.timestampH=0,this.compileShader=(t,i)=>{const o=this.gl,n=o.createShader(t);return o.shaderSource(n,i),o.compileShader(n),o.getShaderParameter(n,o.COMPILE_STATUS)?n:(h(this.options,"Errors")&&console.error(`Error compiling shader: ${o.getShaderInfoLog(n)}`),o.deleteShader(n),null)},this.createTextureFromImageBitmap=t=>{const i=this.gl,o=i.createTexture();return i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),o},this.drawVideoFrameBase=t=>{const i=this.gl;if(!this.videoProgram||this.videoAPos===void 0||this.videoAUv===void 0||!this.uVideoTexture){h(this.options,"Errors")&&console.error("[WebGL] Video program not initialized");return}i.useProgram(this.videoProgram),i.viewport(0,0,i.canvas.width,i.canvas.height),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t),i.uniform1i(this.uVideoTexture,0),i.bindBuffer(i.ARRAY_BUFFER,this.fsPosBuf),i.enableVertexAttribArray(this.videoAPos),i.vertexAttribPointer(this.videoAPos,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this.fsUvBuf),i.enableVertexAttribArray(this.videoAUv),i.vertexAttribPointer(this.videoAUv,2,i.FLOAT,!1,0,0),i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLES,0,6),this.program&&i.useProgram(this.program)},this.createTextureFromVideoFrame=t=>{const i=this.gl,o=i.createTexture();return i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.bindTexture(i.TEXTURE_2D,null),o},this.deleteTexture=t=>{this.gl.deleteTexture(t)},this.options=s,this.renderer=e,this.gl=e.glContext,this.initTiming()}init(){this.initAtlas(),this.initBuffers(),this.initPrograms(),this.loadPlayerTextures(),this.options.RENDER_LED&&(this.instancedExt=this.gl.getExtension("ANGLE_instanced_arrays"),this.instancedExt||h(this.options,"Errors")&&console.error("ANGLE_instanced_arrays extension not available"))}resolveAssetUrl(e){if(!e.startsWith("/"))return e;try{const s=self.location.href;if(s.startsWith("blob:")){const t=new URL(s.slice(5)).origin;if(t&&t!=="null")return t+e}}catch{}return e}async fetchTexture(e){const s=await fetch(this.resolveAssetUrl(e));if(!s.ok)throw new Error(`HTTP ${s.status}`);const t=await s.blob(),i=await createImageBitmap(t),o=this.gl,n=o.createTexture();return o.bindTexture(o.TEXTURE_2D,n),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),i.close(),n}async loadPlayerTextures(){try{const[e,s]=await Promise.all([this.fetchTexture(Ra),this.fetchTexture(va)]);this.playerCircleTex=e,this.playerArrowTex=s,this.playerTexturesLoaded=!0,h(this.options,"Renderer")&&console.log("[WebGL] Player overlay textures loaded")}catch(e){h(this.options,"Errors")&&console.error("[WebGL] Failed to load player overlay textures:",e)}}drawPlayerOverlay(e,s,t,i){var A;if(!this.playerTexturesLoaded||!this.playerCircleTex||!this.program||this.aPos===void 0||this.aUv===void 0||this.aTransform===void 0||!this.uRes||!this.uOpacity||!this.uAtlas||!this.uAlphaMask||!this.uUseAlphaMask)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,null),o.viewport(0,0,o.canvas.width,o.canvas.height),o.useProgram(this.program),o.uniform2f(this.uRes,t.width,t.height),this.uCanvasRes&&o.uniform2f(this.uCanvasRes,o.canvas.width,o.canvas.height),o.uniform1f(this.uOpacity,1),this.uAAStrength&&o.uniform1f(this.uAAStrength,this.LOGO_AA_STRENGTH),o.uniform1f(this.uUseAlphaMask,i?1:0),this.uTintColor&&o.uniform4f(this.uTintColor,Jt[0],Jt[1],Jt[2],1),e||(i=!1),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,e??null),o.uniform1i(this.uAlphaMask,0),o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this.playerCircleTex),o.uniform1i(this.uAtlas,1);const n=s.circle,a=n.corners;if(this.uploadQuadAndDraw(new Float32Array([a[0].x,a[0].y,a[1].x,a[1].y,a[2].x,a[2].y,a[0].x,a[0].y,a[2].x,a[2].y,a[3].x,a[3].y]),n.tranform,o),this.playerArrowTex&&((A=s.locs)!=null&&A.head2D)){o.bindTexture(o.TEXTURE_2D,this.playerArrowTex);const l=s.locs.head2D,c=Da,d=l.x-c/2,u=l.y-Ia-c,g=d+c,m=u+c,p=new Float32Array([d,u,g,u,g,m,d,u,g,m,d,m]),f=t.width,y=t.height,S=[f/c,0,-d*f/c,0,y/c,-u*y/c,0,0,1];this.uploadQuadAndDraw(p,S,o)}o.uniform1f(this.uUseAlphaMask,1),this.uTintColor&&o.uniform4f(this.uTintColor,0,0,0,0)}uploadQuadAndDraw(e,s,t){const i=new Float32Array(24);for(let a=0;a<6;a++)i[a*4+2]=1,i[a*4+3]=1;const o=new Float32Array(6*9);for(let a=0;a<6;a++)o.set(s,a*9);t.bindBuffer(t.ARRAY_BUFFER,this.posBuf),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW),t.enableVertexAttribArray(this.aPos),t.vertexAttribPointer(this.aPos,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuf),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW),t.enableVertexAttribArray(this.aUv),t.vertexAttribPointer(this.aUv,4,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.transformBuf),t.bufferData(t.ARRAY_BUFFER,o,t.DYNAMIC_DRAW);const n=9*4;for(let a=0;a<3;a++){const A=this.aTransform+a;t.enableVertexAttribArray(A),t.vertexAttribPointer(A,3,t.FLOAT,!1,n,a*3*4)}t.drawArrays(t.TRIANGLES,0,6)}initPrograms(){const e=this.gl;if(this.program=this.linkProgram(da,ua),this.aPos=e.getAttribLocation(this.program,"a_position"),this.aUv=e.getAttribLocation(this.program,"a_uv"),this.aTransform=e.getAttribLocation(this.program,"a_transform"),this.uRes=e.getUniformLocation(this.program,"u_resolution"),this.uCanvasRes=e.getUniformLocation(this.program,"u_canvasResolution"),this.uOpacity=e.getUniformLocation(this.program,"u_opacity"),this.uAAStrength=e.getUniformLocation(this.program,"u_aaStrength"),this.uUseAlphaMask=e.getUniformLocation(this.program,"u_useAlphaMask"),this.uTintColor=e.getUniformLocation(this.program,"u_tintColor"),this.uAtlas=e.getUniformLocation(this.program,"u_atlas"),this.uAlphaMask=e.getUniformLocation(this.program,"u_alphaMask"),this.options.BURNED_TIMECODES_MODE&&(this.videoProgram=this.linkProgram(ca,la),this.videoAPos=e.getAttribLocation(this.videoProgram,"a_position"),this.videoAUv=e.getAttribLocation(this.videoProgram,"a_uv"),this.uVideoTexture=e.getUniformLocation(this.videoProgram,"u_videoTexture")),this.options.RENDER_LED){if(this.blitProgram=this.linkProgram(ga,ma),!this.blitProgram){h(this.options,"Errors")&&console.error("[WebGL] Failed to create blit program");return}this.blit_aPos=e.getAttribLocation(this.blitProgram,"aPos"),this.cubesProgram=this.linkProgram(pa,Ea),this.cubes_uEdgeFeatherPx=e.getUniformLocation(this.cubesProgram,"uEdgeFeatherPx")||void 0,this.fboCompositeProgram=this.linkProgram(jt,qt),this.fboComposite_aPos=e.getAttribLocation(this.fboCompositeProgram,"aPos"),this.fboComposite_uFBOTex=e.getUniformLocation(this.fboCompositeProgram,"uFBOTex"),this.ledCompositeProgram=this.linkProgram(fa,ha),this.comp_aPos=e.getAttribLocation(this.ledCompositeProgram,"a_position"),this.comp_aUv=e.getAttribLocation(this.ledCompositeProgram,"a_uv"),this.comp_uOverlay=e.getUniformLocation(this.ledCompositeProgram,"u_overlay"),this.comp_uAlphaMask=e.getUniformLocation(this.ledCompositeProgram,"u_alphaMask"),this.comp_uUVRect=e.getUniformLocation(this.ledCompositeProgram,"u_uvRect"),this.comp_uRes=e.getUniformLocation(this.ledCompositeProgram,"u_resolution")}}linkProgram(e,s){const t=this.gl,i=this.compileShader(t.VERTEX_SHADER,e),o=this.compileShader(t.FRAGMENT_SHADER,s),n=t.createProgram();if(t.attachShader(n,i),t.attachShader(n,o),t.linkProgram(n),!t.getProgramParameter(n,t.LINK_STATUS)){const a=t.getProgramInfoLog(n);throw h(this.options,"Errors")&&console.error("WebGL link error: "+a),new Error("WebGL link error: "+a)}if(!t.getProgramParameter(n,t.LINK_STATUS)){const a=t.getProgramInfoLog(n);throw new Error("WebGL link error: "+a)}return n}drawAugmentation(e,s,t,i=1,o=!0,n){var m;const a=performance.now();this.syncAtlasGL();const{pos:A,uv:l,transforms:c,vertCount:d}=this.buildQuadData(s);if(o){const p=this.gl;p.bindFramebuffer(p.FRAMEBUFFER,null),p.viewport(0,0,p.canvas.width,p.canvas.height),p.clearColor(0,0,0,0),p.clear(p.COLOR_BUFFER_BIT)}if(!d)return;if(!this.program||this.aPos===void 0||this.aUv===void 0||this.aTransform===void 0||!this.uRes||!this.uOpacity||!this.uAtlas||!this.uAlphaMask){h(this.options,"Errors")&&console.error("[Renderer] Program or attributes not initialized");return}const u=this.gl;u.bindFramebuffer(u.FRAMEBUFFER,null),u.viewport(0,0,u.canvas.width,u.canvas.height),u.useProgram(this.program),u.uniform2f(this.uRes,t.width,t.height),this.uCanvasRes&&u.uniform2f(this.uCanvasRes,u.canvas.width,u.canvas.height),u.uniform1f(this.uOpacity,i),this.uAAStrength&&u.uniform1f(this.uAAStrength,this.LOGO_AA_STRENGTH),this.uUseAlphaMask&&u.uniform1f(this.uUseAlphaMask,1),this.uTintColor&&u.uniform4f(this.uTintColor,0,0,0,0),u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,e),u.uniform1i(this.uAlphaMask,0),u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,this.atlasTex),u.uniform1i(this.uAtlas,1),u.bindBuffer(u.ARRAY_BUFFER,this.posBuf),u.bufferData(u.ARRAY_BUFFER,A,u.DYNAMIC_DRAW),u.enableVertexAttribArray(this.aPos),u.vertexAttribPointer(this.aPos,2,u.FLOAT,!1,0,0),u.bindBuffer(u.ARRAY_BUFFER,this.uvBuf),u.bufferData(u.ARRAY_BUFFER,l,u.DYNAMIC_DRAW),u.enableVertexAttribArray(this.aUv),u.vertexAttribPointer(this.aUv,4,u.FLOAT,!1,0,0),u.bindBuffer(u.ARRAY_BUFFER,this.transformBuf),u.bufferData(u.ARRAY_BUFFER,c,u.DYNAMIC_DRAW);const g=9*4;for(let p=0;p<3;p++){const f=this.aTransform+p;u.enableVertexAttribArray(f),u.vertexAttribPointer(f,3,u.FLOAT,!1,g,p*3*4)}if(u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),this.beginTimer(),u.drawArrays(u.TRIANGLES,0,d),this.endTimer(),this.measureLogoVisibility(s),this.options.DRAW_TIMESTAMP_WEBGL&&n&&this.drawTimestampOnCanvas(n),(m=this.options.debug)!=null&&m.trackPerformance){const f=performance.now()-a;this.CPUFrameTimeCount++,this.CPUFrameTimeSum+=f,this.avgCPUFrameTime=this.CPUFrameTimeSum/this.CPUFrameTimeCount}}ensureTimestampTexture(e){try{const s=this.gl,t=18,i=8,o=6;if(!this.timestampCanvas||this.lastTimestampString!==e){const a=new OffscreenCanvas(1,1).getContext("2d");a.font=`${t}px monospace`;const A=a.measureText(e),l=Math.ceil(A.width+i*2)|0,c=Math.ceil(t+o*2)|0;this.timestampCanvas=new OffscreenCanvas(l,c),this.timestampCtx=this.timestampCanvas.getContext("2d"),this.timestampW=l,this.timestampH=c;const d=this.timestampCtx;d.clearRect(0,0,l,c),d.fillStyle="rgba(0,0,0,0.55)",d.fillRect(0,0,l,c),d.font=`${t}px monospace`,d.textBaseline="middle",d.fillStyle="#00FF88",d.fillText(e,i,c/2),this.timestampTex||(this.timestampTex=s.createTexture()),s.bindTexture(s.TEXTURE_2D,this.timestampTex),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!0),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,this.timestampCanvas),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),this.lastTimestampString=e}}catch(s){h(this.options,"Errors")&&console.error("[WebGL] ensureTimestampTexture failed",s)}}drawTimestampOnCanvas(e){const s=this.gl;try{if(this.ensureTimestampTexture(e),!this.timestampTex||!this.timestampCanvas)return;this.fboCompositeProgram||(this.fboCompositeProgram=this.linkProgram(jt,qt),this.fboComposite_aPos=s.getAttribLocation(this.fboCompositeProgram,"aPos"),this.fboComposite_uFBOTex=s.getUniformLocation(this.fboCompositeProgram,"uFBOTex")),this.timestampVBO||(this.timestampVBO=s.createBuffer(),s.bindBuffer(s.ARRAY_BUFFER,this.timestampVBO),s.bufferData(s.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),s.STATIC_DRAW));const t=s.canvas.width|0,i=s.canvas.height|0,o=10,n=10,a=Math.min(this.timestampW,t-o),A=Math.min(this.timestampH,i-n),l=Math.max(0,t-o-a),c=Math.max(0,i-n-A);s.viewport(l,c,a,A),s.useProgram(this.fboCompositeProgram),s.disable(s.DEPTH_TEST),s.disable(s.CULL_FACE),s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA);const d=this.fboComposite_aPos;s.bindBuffer(s.ARRAY_BUFFER,this.timestampVBO),s.enableVertexAttribArray(d),s.vertexAttribPointer(d,2,s.FLOAT,!1,0,0),d!==0&&(s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,0,0)),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.timestampTex),this.fboComposite_uFBOTex&&s.uniform1i(this.fboComposite_uFBOTex,0),s.drawArrays(s.TRIANGLE_STRIP,0,4),s.viewport(0,0,t,i)}catch(t){h(this.options,"Errors")&&console.error("[WebGL] drawTimestampOnCanvas failed",t)}}buildCubes(e,s,t){var i;try{const o=[];let n=0;const a=e.LedModel;for(const A of a){const l=(i=A.panel)==null?void 0:i.height,c=A.bottomPoints||[];if(!(!l||c.length<2))for(let d=0;d<c.length-1;d++){const u=c[d],g=c[d+1],m=g.x-u.x,p=g.y-u.y,f=(g.z||0)-(u.z||0),y=Math.hypot(m,p,f),S=Math.max(1,Math.round(y/l*t));o.push({uOffsetPx:n,sliceWidthPx:S}),n=(n+S)%s}}this.ledCubes=o}catch{h(this.options,"Errors")&&console.error("[WebGL] Error building LED cubes from model")}}updateLEDCubesFromModel(e,s){if(!(s&&this.ledModelVersion===s)){if(!this.ensureLEDArtFromAds()){h(this.options,"Errors")&&console.error("[LED Debug] No LED art available from ads");return}this.buildCubes(e,this.ledArtW,this.ledArtH),s&&(this.ledModelVersion=s)}}renderCubes(e,s,t,i,o){const n=this.gl,a=this.instancedExt,A=this.cubesProgram,l=this.blitProgram,c=s,d=t,u=i,g=o,m=this.LED_PADDING,p=this.cornerVBO,f=this.quadVBO,y=this.bDstTL,S=this.bDstTR,P=this.bDstBR,v=this.bDstBL,L=this.bH0,G=this.bH1,E=this.bH2,w=this.bU0,x=this.bSW;if(!p||!f||!y||!S||!P||!v||!L||!G||!E||!w||!x){h(this.options,"Errors")&&console.error("[WebGL] Missing required vertex buffers for LED rendering");return}(!this.overlayTex||!this.overlayFBO)&&(this.overlayTex=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.overlayTex),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,i,o,0,n.RGBA,n.UNSIGNED_BYTE,null),this.overlayFBO=n.createFramebuffer(),n.bindFramebuffer(n.FRAMEBUFFER,this.overlayFBO),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this.overlayTex,0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.disable(n.DEPTH_TEST),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA));const W=this.overlayFBO;if(this.overlayTex,!A||!l||!a){h(this.options,"Errors")&&console.error("[WebGL] Missing programs or buffers",{cubesProg:A,blitProg:l,instancedExt:a});return}if(this.blit_aPos===void 0||this.blit_aPos<0){h(this.options,"Errors")&&console.error("[WebGL] Invalid blit_aPos attribute location:",this.blit_aPos);return}n.bindFramebuffer(n.FRAMEBUFFER,W),n.viewport(0,0,u,g),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.useProgram(A),n.bindBuffer(n.ARRAY_BUFFER,p),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,1,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,y),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(1,1),n.bindBuffer(n.ARRAY_BUFFER,S),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,2,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(2,1),n.bindBuffer(n.ARRAY_BUFFER,P),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(3,1),n.bindBuffer(n.ARRAY_BUFFER,v),n.enableVertexAttribArray(4),n.vertexAttribPointer(4,2,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(4,1),n.bindBuffer(n.ARRAY_BUFFER,L),n.enableVertexAttribArray(5),n.vertexAttribPointer(5,3,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(5,1),n.bindBuffer(n.ARRAY_BUFFER,G),n.enableVertexAttribArray(6),n.vertexAttribPointer(6,3,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(6,1),n.bindBuffer(n.ARRAY_BUFFER,E),n.enableVertexAttribArray(7),n.vertexAttribPointer(7,3,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(7,1),n.bindBuffer(n.ARRAY_BUFFER,w),n.enableVertexAttribArray(8),n.vertexAttribPointer(8,1,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(8,1),n.bindBuffer(n.ARRAY_BUFFER,x),n.enableVertexAttribArray(9),n.vertexAttribPointer(9,1,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(9,1),n.uniform2f(n.getUniformLocation(A,"uResolution"),u,g),n.uniform1i(n.getUniformLocation(A,"uFlipY"),1),n.uniform2f(n.getUniformLocation(A,"uShift"),0,0),n.uniform2f(n.getUniformLocation(A,"uArtSize"),this.ledArtW,this.ledArtH),this.cubes_uEdgeFeatherPx&&n.uniform1f(this.cubes_uEdgeFeatherPx,this.LED_AA_STRENGTH),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this.ledArtTex),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.uniform1i(n.getUniformLocation(A,"uArt"),0),n.getParameter(n.TEXTURE_BINDING_2D)!==this.ledArtTex&&h(this.options,"Errors")&&console.error("Warning: Texture binding mismatch!"),a.drawArraysInstancedANGLE(n.TRIANGLES,0,6,e),a.vertexAttribDivisorANGLE(0,0);for(let Z=1;Z<=9;Z++)a.vertexAttribDivisorANGLE(Z,0),n.disableVertexAttribArray(Z);n.disableVertexAttribArray(0);const Ie=m/u,O=m/g,C=(m+c)/u,V=(m+d)/g;this.ledOverlayUVRect=[Ie,O,C,V]}drawAugmentationWithLED(e,s,t,i=1,o,n){this.gl;let a=!1;try{if(o&&o.cubePlaceholders&&o.intrinsics&&o.referenceSize&&this.ensureLEDArtFromAds()){const A=Math.max(1,o.referenceSize.width|0),l=Math.max(1,o.referenceSize.height|0),c=this.LED_PADDING|0,d=A+c*2,u=l+c*2;this.ensureLedOverlay(d,u);const g=this.getCubesTransformationsToLiveImage(o);g&&g>0&&(this.renderCubes(g,A,l,d,u),a=!0)}}catch(A){h(this.options,"Errors")&&console.error("[WebGL] LED prep error:",A)}a?(this.compositeLEDOverlayDirectToCanvas(!0,e),this.drawAugmentation(e,s,t,i,!1,n)):this.drawAugmentation(e,s,t,i,!0,n)}drawLEDOnly(e,s){try{if(!s||!s.cubePlaceholders||!s.intrinsics||!s.referenceSize){h(this.options,"Errors")&&console.error("[LED Debug] Missing LED data - led:",!!s,"cubePlaceholders:",!!(s!=null&&s.cubePlaceholders),"intrinsics:",!!(s!=null&&s.intrinsics),"referenceSize:",!!(s!=null&&s.referenceSize));return}if(!this.ensureLEDArtFromAds()){h(this.options,"Errors")&&console.error("[LED Debug] Failed to ensure LED art from ads");return}const t=s.referenceSize.width,i=s.referenceSize.height,o=t+this.LED_PADDING*2,n=i+this.LED_PADDING*2;this.ensureLedOverlay(o,n);const a=this.getCubesTransformationsToLiveImage(s);if(!a||a===0){h(this.options,"Errors")&&console.error("[LED Debug] No LED cubes to render - check LED model data");return}this.renderCubes(a,t,i,o,n),this.compositeLEDOverlayDirectToCanvas(!0,e)}catch(t){h(this.options,"Errors")&&console.error("[WebGL] LED-only path error",t)}}drawLEDOverlayOnTop(e,s){try{if(!s||!s.cubePlaceholders||!s.intrinsics||!s.referenceSize){h(this.options,"Errors")&&console.error("[LED Debug] Missing LED data for drawLEDOverlayOnTop");return}if(!this.ensureLEDArtFromAds()){h(this.options,"Errors")&&console.error("[LED Debug] Failed to ensure LED art for drawLEDOverlayOnTop");return}const t=s.referenceSize.width,i=s.referenceSize.height,o=t+this.LED_PADDING*2,n=i+this.LED_PADDING*2;this.ensureLedOverlay(o,n);const a=this.getCubesTransformationsToLiveImage(s);a&&a>0&&(this.renderCubes(a,t,i,o,n),this.compositeLEDOverlayDirectToCanvas(!1,e))}catch(t){h(this.options,"Errors")&&console.error("[WebGL] drawLEDOverlayOnTop error",t)}}compositeLEDOverlayDirectToCanvas(e,s){const t=this.gl;if(!this.ledCompositeProgram||!this.overlayTex||!this.fsPosBuf||!this.fsUvBuf||this.comp_aPos===void 0||this.comp_aUv===void 0||!this.comp_uOverlay||!this.comp_uAlphaMask||!this.comp_uUVRect||!this.comp_uRes||!this.ledOverlayUVRect){h(this.options,"Errors")&&console.error("[WebGL] Missing resources for direct LED composite");return}t.bindFramebuffer(t.FRAMEBUFFER,null);const i=t.canvas.width,o=t.canvas.height;t.viewport(0,0,i,o),e&&(t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)),t.useProgram(this.ledCompositeProgram),t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);for(let c=0;c<16;c++)t.disableVertexAttribArray(c);t.bindBuffer(t.ARRAY_BUFFER,this.fsPosBuf),t.enableVertexAttribArray(this.comp_aPos),t.vertexAttribPointer(this.comp_aPos,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.fsUvBuf),t.enableVertexAttribArray(this.comp_aUv),t.vertexAttribPointer(this.comp_aUv,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.overlayTex),t.uniform1i(this.comp_uOverlay,0),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,s),t.uniform1i(this.comp_uAlphaMask,1);const[n,a,A,l]=this.ledOverlayUVRect;t.uniform4f(this.comp_uUVRect,n,a,A,l),t.uniform2f(this.comp_uRes,i,o),t.drawArrays(t.TRIANGLES,0,6)}compositeLEDFBOToCanvas(e,s){const t=this.gl,i=this.quadVBO;if(!this.compositeTex||!this.fboCompositeProgram||!i){h(this.options,"Errors")&&console.error("[WebGL] Missing resources for LED FBO compositing");return}for(;t.getError()!==t.NO_ERROR;);t.bindFramebuffer(t.FRAMEBUFFER,null);const o=t.canvas.width,n=t.canvas.height;if(t.viewport(0,0,o,n),e&&(t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)),this.fboCompositeProgram||(this.fboCompositeProgram=this.linkProgram(jt,qt),this.fboComposite_aPos=t.getAttribLocation(this.fboCompositeProgram,"aPos"),this.fboComposite_uFBOTex=t.getUniformLocation(this.fboCompositeProgram,"uFBOTex")),s&&this.ledCompositeProgram&&this.fsPosBuf&&this.fsUvBuf&&this.comp_aPos!==void 0&&this.comp_aUv!==void 0&&this.comp_uOverlay&&this.comp_uAlphaMask&&this.comp_uUVRect&&this.comp_uRes){t.useProgram(this.ledCompositeProgram),t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);for(let d=0;d<16;d++)t.disableVertexAttribArray(d);t.bindBuffer(t.ARRAY_BUFFER,this.fsPosBuf),t.enableVertexAttribArray(this.comp_aPos),t.vertexAttribPointer(this.comp_aPos,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.fsUvBuf),t.enableVertexAttribArray(this.comp_aUv),t.vertexAttribPointer(this.comp_aUv,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.compositeTex),t.uniform1i(this.comp_uOverlay,0),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,s),t.uniform1i(this.comp_uAlphaMask,1),t.uniform4f(this.comp_uUVRect,0,0,1,1),t.uniform2f(this.comp_uRes,o,n),t.drawArrays(t.TRIANGLES,0,6);return}t.useProgram(this.fboCompositeProgram),t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);for(let d=0;d<16;d++)t.disableVertexAttribArray(d);t.bindBuffer(t.ARRAY_BUFFER,i);const a=this.fboComposite_aPos;if(a===void 0||a<0){h(this.options,"Errors")&&console.error("[WebGL] Invalid fboComposite aPos location:",a);return}t.enableVertexAttribArray(a),t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),a!==0&&(t.enableVertexAttribArray(0),t.vertexAttribPointer(0,2,t.FLOAT,!1,0,0));const A=t.getBufferParameter(t.ARRAY_BUFFER,t.BUFFER_SIZE);A!==32&&h(this.options,"Errors")&&console.error("[WebGL] Unexpected quadVBO size:",A,"expected 32 bytes"),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.compositeTex),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),this.fboComposite_uFBOTex&&t.uniform1i(this.fboComposite_uFBOTex,0);const l=t.getError();l&&h(this.options,"Errors")&&console.error("[WebGL] Error before composite draw:",l),t.drawArrays(t.TRIANGLE_STRIP,0,4);const c=t.getError();c&&h(this.options,"Errors")&&console.error("[WebGL] Error in LED FBO composite:",c)}getDistortionCtx(e){if(!e.intrinsics||!e.distortion)return;const s=e.intrinsics,t=e.distortion,i=t[0],o=t[1],n=t[2],a=s.cx,A=s.cy,l=s.fx,c=s.fy;return{k1:i,k2:o,k3:n,cx:a,cy:A,fx:l,fy:c,undistortNormalized(d,u){let g=d,m=u;for(let p=0;p<5;p++){const f=g*g+m*m,y=f*f,S=y*f,P=1+i*f+o*y+n*S,v=P!==0?1/P:1;g=d*v,m=u*v}return{x:g,y:m}},undistortCanvasPoint(d,u){const g=d.x+u,m=d.y+u,p=(g-(a+u))/l,f=(m-(A+u))/c,y=this.undistortNormalized(p,f),S=a+u+l*y.x,P=A+u+c*y.y;return{x:S-u,y:P-u}}}}pickCorners(e){const s=e.tgtCorners||e.block&&e.block.fenceVertices2D;return!s||s.length!==4?null:[s[0],s[1],s[2],s[3]]}getHinv(e,s){const t=[],i=[];for(let C=0;C<4;C++){const V=e[C].x,Z=e[C].y,Se=s[C].x,U=s[C].y;t.push([V,Z,1,0,0,0,-V*Se,-Z*Se]),i.push(Se),t.push([0,0,0,V,Z,1,-V*U,-Z*U]),i.push(U)}const o=8,n=t.map(C=>C.slice()),a=i.slice();for(let C=0;C<o;C++){let V=C;for(let U=C+1;U<o;U++)Math.abs(n[U][C])>Math.abs(n[V][C])&&(V=U);if(V!==C){const U=n[C];n[C]=n[V],n[V]=U;const Ge=a[C];a[C]=a[V],a[V]=Ge}const Se=1/(n[C][C]||1e-12);for(let U=C;U<o;U++)n[C][U]*=Se;a[C]*=Se;for(let U=0;U<o;U++){if(U===C)continue;const Ge=n[U][C];if(Ge!==0){for(let Tt=C;Tt<o;Tt++)n[U][Tt]-=Ge*n[C][Tt];a[U]-=Ge*a[C]}}}const A=a,l=[A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],1],[c,d,u,g,m,p,f,y,S]=[l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],l[8]],P=m*S-p*y,v=-(g*S-p*f),L=g*y-m*f,G=-(d*S-u*y),E=c*S-u*f,w=-(c*y-d*f),x=d*p-u*m,W=-(c*p-u*g),oe=c*m-d*g,O=1/(c*P+d*v+u*L||1e-12);return[P*O,G*O,x*O,v*O,E*O,W*O,L*O,w*O,oe*O]}getCubesTransformationsToLiveImage(e){if(!e||!e.cubePlaceholders||!e.intrinsics||!e.referenceSize)return;const s=this.LED_PADDING,t=e.cubePlaceholders,i=t.length,o=new Float32Array(i*2),n=new Float32Array(i*2),a=new Float32Array(i*2),A=new Float32Array(i*2),l=new Float32Array(i*3),c=new Float32Array(i*3),d=new Float32Array(i*3),u=new Float32Array(i),g=new Float32Array(i);let m=0;const p=this.getDistortionCtx(e);if(!p)return;for(let y=0;y<i;y++){const S=t[y],P=S.index;if(P<0||P>=this.ledCubes.length)continue;const v=this.pickCorners(S);if(!v)continue;const L=p.undistortCanvasPoint(v[0],s),G=p.undistortCanvasPoint(v[1],s),E=p.undistortCanvasPoint(v[2],s),w=p.undistortCanvasPoint(v[3],s);o.set([L.x,L.y],y*2),n.set([G.x,G.y],y*2),a.set([E.x,E.y],y*2),A.set([w.x,w.y],y*2);const x=this.ledCubes[P],W=Math.max(1,x.sliceWidthPx),oe=[{x:0,y:this.ledArtH},{x:0,y:0},{x:W,y:0},{x:W,y:this.ledArtH}],Ie=[L,G,E,w],O=this.getHinv(oe,Ie);l.set([O[0],O[1],O[2]],y*3),c.set([O[3],O[4],O[5]],y*3),d.set([O[6],O[7],O[8]],y*3),u[y]=x.uOffsetPx/this.ledArtW,g[y]=W,m++}const f=this.gl;return f.bindBuffer(f.ARRAY_BUFFER,this.bDstTL),f.bufferData(f.ARRAY_BUFFER,o,f.DYNAMIC_DRAW),f.bindBuffer(f.ARRAY_BUFFER,this.bDstTR),f.bufferData(f.ARRAY_BUFFER,n,f.DYNAMIC_DRAW),f.bindBuffer(f.ARRAY_BUFFER,this.bDstBR),f.bufferData(f.ARRAY_BUFFER,a,f.DYNAMIC_DRAW),f.bindBuffer(f.ARRAY_BUFFER,this.bDstBL),f.bufferData(f.ARRAY_BUFFER,A,f.DYNAMIC_DRAW),f.bindBuffer(f.ARRAY_BUFFER,this.bH0),f.bufferData(f.ARRAY_BUFFER,l,f.DYNAMIC_DRAW),f.bindBuffer(f.ARRAY_BUFFER,this.bH1),f.bufferData(f.ARRAY_BUFFER,c,f.DYNAMIC_DRAW),f.bindBuffer(f.ARRAY_BUFFER,this.bH2),f.bufferData(f.ARRAY_BUFFER,d,f.DYNAMIC_DRAW),f.bindBuffer(f.ARRAY_BUFFER,this.bU0),f.bufferData(f.ARRAY_BUFFER,u,f.DYNAMIC_DRAW),f.bindBuffer(f.ARRAY_BUFFER,this.bSW),f.bufferData(f.ARRAY_BUFFER,g,f.DYNAMIC_DRAW),m}setLEDArtTexture(e){try{const s=this.gl;this.ledArtTex||(this.ledArtTex=s.createTexture()),s.bindTexture(s.TEXTURE_2D,this.ledArtTex),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e);const t=this.getDims(e);this.ledArtW=t.w||1,this.ledArtH=t.h||1;const i=this.isPowerOf2(this.ledArtW)&&this.isPowerOf2(this.ledArtH);if(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),i)s.generateMipmap(s.TEXTURE_2D),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR_MIPMAP_LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR);else{s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR);const o=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(o){const n=s.getParameter(o.MAX_TEXTURE_MAX_ANISOTROPY_EXT);s.texParameteri(s.TEXTURE_2D,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,n))}}}catch(s){h(this.options,"Errors")&&console.error("[WebGL] setLEDArtTexture failed",s)}}ensureLEDArtFromAds(){var e,s,t,i,o;try{if(this.ledArtTex)return!0;const n=((t=(s=(e=this.renderer.ads)==null?void 0:e.ledAds)==null?void 0:s[0])==null?void 0:t.image)||((o=(i=this.renderer.ads)==null?void 0:i.defaultAd)==null?void 0:o.image);if(!n)return h(this.options,"Errors")&&console.error("[LED Debug] No ad image found in ads object"),!1;if(!this.ledArtTex){const a=this.gl,A=a.createTexture();a.bindTexture(a.TEXTURE_2D,A),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,n),this.ledArtW=n.width||1,this.ledArtH=n.height||1;const l=this.isPowerOf2(this.ledArtW)&&this.isPowerOf2(this.ledArtH);if(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),l)a.generateMipmap(a.TEXTURE_2D),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);else{a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);const c=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(c){const d=a.getParameter(c.MAX_TEXTURE_MAX_ANISOTROPY_EXT);a.texParameteri(a.TEXTURE_2D,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,d))}}this.ledArtTex=A}return!0}catch(n){return h(this.options,"Errors")&&console.error("[LED Debug] Error in ensureLEDArtFromAds:",n),!1}}ensureLedOverlay(e,s){const t=this.gl;this.ledOverlayTex&&this.ledOverlayW===e&&this.ledOverlayH===s||(this.ledOverlayTex&&t.deleteTexture(this.ledOverlayTex),this.ledOverlayFBO&&t.deleteFramebuffer(this.ledOverlayFBO),this.ledOverlayTex=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.ledOverlayTex),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,s,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.ledOverlayFBO=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.ledOverlayFBO),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.ledOverlayTex,0),t.bindFramebuffer(t.FRAMEBUFFER,null),this.ledOverlayW=e,this.ledOverlayH=s)}ensureCompositeFBO(e,s){const t=this.gl;this.compositeTex&&this.compositeFBO,this.compositeTex&&t.deleteTexture(this.compositeTex),this.compositeFBO&&t.deleteFramebuffer(this.compositeFBO),this.compositeTex=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.compositeTex),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,s,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),this.compositeFBO=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.compositeFBO),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.compositeTex,0);const i=t.checkFramebufferStatus(t.FRAMEBUFFER);i!==t.FRAMEBUFFER_COMPLETE&&console.error("[WebGL] Composite FBO incomplete:",i),t.bindFramebuffer(t.FRAMEBUFFER,null)}initBuffers(){const e=this.gl;this.posBuf=e.createBuffer(),this.uvBuf=e.createBuffer(),this.transformBuf=e.createBuffer(),this.fsPosBuf=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.fsPosBuf),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]),e.STATIC_DRAW),this.fsUvBuf=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.fsUvBuf),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]),e.STATIC_DRAW),this.options.RENDER_LED&&(this.quadVBO=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.quadVBO),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW),this.cornerVBO=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.cornerVBO),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,3,1,1,3,2]),e.STATIC_DRAW),this.bDstTL=e.createBuffer(),this.bDstTR=e.createBuffer(),this.bDstBR=e.createBuffer(),this.bDstBL=e.createBuffer(),this.bH0=e.createBuffer(),this.bH1=e.createBuffer(),this.bH2=e.createBuffer(),this.bU0=e.createBuffer(),this.bSW=e.createBuffer())}buildQuadData(e){const s=[],t=[],i=[];return Object.values(e).forEach(o=>{var l,c;const n=(c=(l=this.renderer.ads)==null?void 0:l.adMap.get(o.name))==null?void 0:c.name;if(!n)return;const a=this.logoToRegion.get(n);if(!a)return;const A=o.corners;s.push(A[0].x,A[0].y,A[1].x,A[1].y,A[2].x,A[2].y,A[0].x,A[0].y,A[2].x,A[2].y,A[3].x,A[3].y);for(let d=0;d<6;d++)t.push(a.u0,a.v0,a.u1,a.v1);for(let d=0;d<6;d++)i.push(...o.tranform)}),{pos:new Float32Array(s),uv:new Float32Array(t),transforms:new Float32Array(i),vertCount:s.length/2}}cleanGL(){this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}initAtlas(){this.atlasCanvas=new OffscreenCanvas(this.INITIAL_ATLAS_SIZE,this.INITIAL_ATLAS_SIZE),this.atlasCanvas.width=this.atlasCanvas.height=this.INITIAL_ATLAS_SIZE,this.atlasCtx=this.atlasCanvas.getContext("2d"),this.atlasTex=this.gl.createTexture(),this.atlasCtx.clearRect(0,0,this.INITIAL_ATLAS_SIZE,this.INITIAL_ATLAS_SIZE),this.syncAtlasGL()}getDims(e){if("width"in e&&"height"in e)return{w:e.width,h:e.height};const s=e;return{w:s.displayWidth??s.codedWidth,h:s.displayHeight??s.codedHeight}}isPowerOf2(e){return(e&e-1)===0}calculateRequiredAtlasSize(e,s){const t=this.ATLAS_PADDING*2;let i=(e+t)*(s+t);this.logoToRegion.forEach(a=>{const A=(a.u1-a.u0)*this.ATLAS_SIZE,l=(a.v1-a.v0)*this.ATLAS_SIZE;i+=(A+t)*(l+t)}),i*=1.3;let o=this.INITIAL_ATLAS_SIZE;for(;o*o<i;)o*=2;const n=Math.max(e,s);for(;o<n;)o*=2;return o}resizeAtlas(e,s){const t=this.calculateRequiredAtlasSize(e,s);if(t<=this.ATLAS_SIZE)return;const i=new OffscreenCanvas(t,t),o=i.getContext("2d");o.clearRect(0,0,t,t),o.drawImage(this.atlasCanvas,0,0);const n=this.ATLAS_SIZE/t;this.ATLAS_SIZE=t,this.atlasCanvas=i,this.atlasCtx=o,this.logoToRegion.forEach((a,A)=>{const l={u0:a.u0*n,v0:a.v0*n,u1:a.u1*n,v1:a.v1*n};this.logoToRegion.set(A,l)}),this.syncAtlasGL()}addToAtlas(e,s){if(this.logoToRegion.has(e))return this.logoToRegion.get(e);const{w:t,h:i}=this.getDims(s),o=this.ATLAS_PADDING,n=t+o*2,a=i+o*2;this.nextX+n>this.ATLAS_SIZE&&(this.nextX=0,this.nextY+=this.rowH,this.rowH=0),(this.nextY+a>this.ATLAS_SIZE||this.nextX+n>this.ATLAS_SIZE)&&this.resizeAtlas(n,a);const A=this.nextX+o,l=this.nextY+o;this.atlasCtx.drawImage(s,A,l,t,i);const c={u0:A/this.ATLAS_SIZE,v0:l/this.ATLAS_SIZE,u1:(A+t)/this.ATLAS_SIZE,v1:(l+i)/this.ATLAS_SIZE};return this.logoToRegion.set(e,c),this.atlasDirty=!0,this.nextX+=n,this.rowH=Math.max(this.rowH,a),c}syncAtlasGL(){if(!this.atlasDirty)return;const e=this.gl,s=e.createTexture();e.bindTexture(e.TEXTURE_2D,s),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.atlasCanvas),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),this.isPowerOf2(this.ATLAS_SIZE)?(e.generateMipmap(e.TEXTURE_2D),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR)):(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR));const i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(i){const n=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT);e.texParameteri(e.TEXTURE_2D,i.TEXTURE_MAX_ANISOTROPY_EXT,n)}const o=this.atlasTex;this.atlasTex=s,o&&e.deleteTexture(o),this.atlasDirty=!1}clearAtlas(){this.logoToRegion.clear(),this.nextX=this.nextY=this.rowH=0,this.atlasCtx.clearRect(0,0,this.ATLAS_SIZE,this.ATLAS_SIZE),this.atlasDirty=!0}generateAdTexture(e,s){B.setAttributes({asset:e}),this.addToAtlas(e,s)}measureLogoVisibility(e){const s=this.gl.canvas.width,t=this.gl.canvas.height,i=this.renderer.shot;if(!i)return;const{percentOfAd:o,percentOfScreen:n}=Ta(e,s,t);i.frameCount++,i.sumPercentOfAd+=o,i.sumPercentOfScreen+=n,i.lastProcessingTime=performance.now()}initTiming(){var e;(e=this.options.debug)!=null&&e.trackPerformance&&(this.timerExt=this.gl.getExtension("EXT_disjoint_timer_query"),this.timerExt||h(this.options,"Errors")&&console.error("EXT_disjoint_timer_query not supported"))}beginTimer(){!this.timerExt||this.queryInFlight||(this.query=this.timerExt.createQueryEXT(),this.timerExt.beginQueryEXT(this.timerExt.TIME_ELAPSED_EXT,this.query))}endTimer(){if(!this.timerExt||!this.query||this.queryInFlight)return;this.timerExt.endQueryEXT(this.timerExt.TIME_ELAPSED_EXT),this.queryInFlight=!0;const e=()=>{if(!this.queryInFlight)return;const s=this.timerExt.getQueryObjectEXT(this.query,this.timerExt.QUERY_RESULT_AVAILABLE_EXT),t=this.gl.getParameter(this.timerExt.GPU_DISJOINT_EXT);if(s&&!t){const o=this.timerExt.getQueryObjectEXT(this.query,this.timerExt.QUERY_RESULT_EXT)/1e6;this.GPUFrameTimeSum+=o,this.GPUFrameTimeCount++,this.avgGPUFrameTime=this.GPUFrameTimeSum/this.GPUFrameTimeCount,this.timerExt.deleteQueryEXT(this.query),this.query=null,this.queryInFlight=!1}else requestAnimationFrame(e)};requestAnimationFrame(e)}getAvgGPUFrameTime(){var e;if((e=this.options.debug)!=null&&e.trackPerformance){const s=this.avgGPUFrameTime;return this.GPUFrameTimeCount=0,this.GPUFrameTimeSum=0,this.avgGPUFrameTime=0,s}return 0}getAvgCPUFrameTime(){var e;if((e=this.options.debug)!=null&&e.trackPerformance){const s=this.avgCPUFrameTime;return this.CPUFrameTimeCount=0,this.CPUFrameTimeSum=0,this.avgCPUFrameTime=0,s}return 0}}const Ca=["LeftTop","MidTopLeft","MidTopRight","RightTop","LeftBottom","MidBottomLeft","MidBottomRight","RightBottom"];class As{constructor(e,s){this.ledAds=[],this.overriddenPlaceholders=new Set,this.periodsConfig=null,this.logoAssets=new Map,this.currentPeriod=null,this.getAds=async()=>{try{const t=this.options.adsBaseURL,i=await fetch(t+"/profiles/geo/",{method:"GET",redirect:"follow",cache:"no-store"});if(this.options&&h(this.options,"Ads")&&console.log("[ADS] adListResponse: ",i),!i.ok){B.error("[ADS] Failed to fetch ad list"),this.options&&h(this.options,"Errors")&&console.error("[ADS] Failed to fetch ad list");return}const o=await i.json();if(this.lastJson===JSON.stringify(o))return;if(this.lastJson=JSON.stringify(o),this.options&&h(this.options,"Ads")&&console.log("[ADS] Received new ad profile:",o),this.periodsConfig=o.periods,await this.loadAllLogos(o.logos),!this.currentPeriod&&this.periodsConfig){const n=Object.keys(this.periodsConfig)[0];n&&(this.currentPeriod=n,this.options&&h(this.options,"Ads")&&console.log(`[ADS] No period set, defaulting to first period: ${n}`))}this.currentPeriod&&this.applyPeriodMapping(this.currentPeriod)}catch(t){B.error("[ADS] Error fetching ads",{error:t}),this.options&&h(this.options,"Errors")&&console.error("[ADS] Error fetching ads:",t)}finally{this.refreshTimeoutId&&(clearTimeout(this.refreshTimeoutId),this.refreshTimeoutId=void 0),this.placeholderNames.some(i=>!this.overriddenPlaceholders.has(i))&&(this.refreshTimeoutId=setTimeout(this.getAds,1e4))}},this.loadAdvImage=async t=>{const i=`#${t.name}`,o=t.url;if(i.indexOf(".json")>-1)return;const a=await(await fetch(o)).blob();return await createImageBitmap(a)},this.uploadAdTextures=()=>{this.webgl.clearAtlas(),this.adMap.forEach((t,i)=>{!t||!t.image||this.webgl.generateAdTexture(t.name,t.image)}),this.webgl.syncAtlasGL()},this.overrideAdImage=async(t,i="",o=!1)=>{var l;this.options&&h(this.options,"Ads")&&console.log("[Ads] overrideAdImage called, clickUrl:",i,"isRestore:",o),o?this.options&&h(this.options,"Ads")&&console.log("[Ads] Restore mode - keeping overriddenPlaceholders:",Array.from(this.overriddenPlaceholders)):(this.overriddenPlaceholders.clear(),this.options&&h(this.options,"Ads")&&console.log("[Ads] Cleared overriddenPlaceholders for new global override"));let n;try{n=await this.computeImageBitmapHash(t)}catch{}const a={name:n?`asset_${n}`:"override_global",imageUrl:((l=this.defaultAd)==null?void 0:l.imageUrl)||"",image:t,adUrl:i||""};this.logoAssets.set(n||"override_global",a);let A=0;this.adMap.forEach((c,d)=>{this.overriddenPlaceholders.has(d)||(this.adMap.set(d,a),this.overriddenPlaceholders.add(d),A++)}),this.options&&h(this.options,"Ads")&&console.log("[Ads] overrideAdImage applied to",A,"placeholders"),this.uploadAdTextures()},this.overrideLEDImage=t=>{this.options&&h(this.options,"Ads")&&console.log("[ADS] overrideLEDImage called");const i=this.ledAds[0]||this.defaultAd,o={name:"override_led",imageUrl:(i==null?void 0:i.imageUrl)||"",image:t,adUrl:(i==null?void 0:i.adUrl)||""};this.ledAds=[o];try{this.webgl.setLEDArtTexture(t),this.options&&h(this.options,"Ads")&&console.log("[ADS] overrideLEDImage completed")}catch{this.options&&h(this.options,"Errors")&&console.error("[ADS] Failed to set LED art texture")}},this.overrideAdImageForPlaceholder=async(t,i,o="")=>{var l,c;if(this.options&&h(this.options,"Ads")&&console.log("[Ads] overrideAdImageForPlaceholder called:",{placeholder:i,clickUrl:o,placeholderNames:this.placeholderNames,placeholderNamesLength:(l=this.placeholderNames)==null?void 0:l.length}),this.placeholderNames.indexOf(i)===-1){this.options&&h(this.options,"Errors")&&console.error("[Ads] VALIDATION FAILED - placeholder not in placeholderNames!"),B.error(`[ADS] Unknown placeholder: ${i}`),this.options&&h(this.options,"Errors")&&console.error("[ADS] Unknown placeholder provided to overrideAdImageForPlaceholder:",i);try{t.close()}catch{}return}this.options&&h(this.options,"Ads")&&console.log("[Ads] Placeholder validation passed, proceeding with override"),this.overriddenPlaceholders.add(i);let n;try{n=await this.computeImageBitmapHash(t)}catch{}const a=n||`override_${i}_${Date.now()}`;let A=n?this.logoAssets.get(a):void 0;if(!A)A={name:a,imageUrl:((c=this.defaultAd)==null?void 0:c.imageUrl)||"",image:t,adUrl:o||""},this.logoAssets.set(a,A);else try{t.close()}catch{}this.adMap.set(i,A);try{this.uploadAdTextures()}catch{this.options&&h(this.options,"Errors")&&console.error("[ADS] Failed to set ad texture")}},this.getAdURLAtCoord=(t,i,o)=>{let n;return this.options&&h(this.options,"Ads")&&console.log("[Ads] getAdURLAtCoord called"),this.options&&h(this.options,"Ads")&&console.log("[Ads] adMap keys:",Array.from(this.adMap.keys())),this.options&&h(this.options,"Ads")&&console.log("[Ads] placeholderNames:",this.placeholderNames),this.options&&h(this.options,"Ads")&&console.log("[Ads] click coord:",o),Object.keys(t).forEach(a=>{const A=t[a].corners.map(d=>({x:d.x/i.width,y:d.y/i.height})),l=t[a].name,c=this.isPointInPlaceholder(A,o);if(this.options&&h(this.options,"Ads")&&console.log(`[Ads] Placeholder "${a}" -> name="${l}", isInside=${c}`),c){const d=this.adMap.get(l);this.options&&h(this.options,"Ads")&&console.log(`[Ads] Looking up "${l}" in adMap:`,d),d?this.options&&h(this.options,"Ads")&&console.log("[Ads] ad.adUrl:",d.adUrl):this.options&&h(this.options,"Ads")&&console.log("[Ads] No ad found for placeholder name:",l),d&&(n=d.adUrl)}}),n},this.isPointInPlaceholder=(t,i)=>{let o=!1;const{x:n,y:a}=i,A=t.length;for(let l=0,c=A-1;l<A;c=l++){const d=t[l].x,u=t[l].y,g=t[c].x,m=t[c].y;u>a!=m>a&&n<(g-d)*(a-u)/(m-u)+d&&(o=!o)}return o},this.placeholderNames=s.OVERRIDE_PLACEHOLDER_NAMES||Ca,this.webgl=e,this.options=s,this.adMap=new Map,this.placeholderNames.forEach(t=>{this.adMap.set(t,void 0)}),s.OVERRIDE_AD!==null&&this.getAds()}get ads(){return Array.from(this.logoAssets.values())}get defaultAd(){return this.logoAssets.values().next().value}get hasAds(){return this.logoAssets.size>0}async loadAllLogos(e){const s=[];for(const[t,i]of Object.entries(e)){if(this.logoAssets.has(t))continue;const o=(async()=>{try{const n=i.url.replace(/^http:\\/\\//i,"https://"),a=await fetch(n);if(!a.ok)throw new Error(`HTTP error! Status: ${a.status}`);const A=await a.blob(),l=await createImageBitmap(A),c={name:t,imageUrl:n,image:l,adUrl:i.link};this.logoAssets.set(t,c),this.options&&h(this.options,"Ads")&&console.log(`[ADS] Loaded logo: ${t} from ${n}`)}catch(n){B.error(`[ADS] Failed to load logo ${t}`,{error:n}),this.options&&h(this.options,"Errors")&&console.error(`[ADS] Failed to load logo ${t}:`,n)}})();s.push(o)}await Promise.all(s)}applyPeriodMapping(e){if(!this.periodsConfig||!this.periodsConfig[e]){B.warn(`[ADS] No configuration found for period ${e}`),this.options&&h(this.options,"Ads")&&console.warn(`[ADS] No configuration found for period ${e}`);return}const t=this.periodsConfig[e].logos;this.placeholderNames.forEach(i=>{this.overriddenPlaceholders.has(i)||this.adMap.set(i,void 0)});for(const[i,o]of Object.entries(t)){if(this.overriddenPlaceholders.has(i))continue;const n=this.logoAssets.get(o);n?this.adMap.set(i,n):(B.warn(`[ADS] Logo ${o} not found for placeholder ${i}`),this.options&&h(this.options,"Ads")&&console.warn(`[ADS] Logo ${o} not found for placeholder ${i}`))}this.uploadAdTextures(),this.options&&h(this.options,"Ads")&&console.log(`[ADS] Applied mapping for period ${e}`,t)}updatePeriod(e){this.currentPeriod!==e&&(this.options&&h(this.options,"Ads")&&console.log(`[ADS] Period changed: ${this.currentPeriod} -> ${e}`),this.currentPeriod=e,this.periodsConfig?this.applyPeriodMapping(e):this.options&&h(this.options,"Ads")&&console.log(`[ADS] Period updated to ${e}, but no config loaded yet`))}resumeAutoRefresh(){this.overriddenPlaceholders.clear(),this.logoAssets.clear(),this.ledAds=[],this.lastJson=void 0,this.getAds()}resetPlaceholderToDefault(e){if(this.placeholderNames.indexOf(e)===-1){this.options&&h(this.options,"Errors")&&console.error("[ADS] Unknown placeholder provided to resetPlaceholderToDefault:",e);return}this.overriddenPlaceholders.delete(e),this.defaultAd&&(this.adMap.set(e,this.defaultAd),this.uploadAdTextures(),this.options&&h(this.options,"Ads")&&console.log(`[ADS] Reset placeholder "${e}" to default ad`))}pause(){this.refreshTimeoutId&&(clearTimeout(this.refreshTimeoutId),this.refreshTimeoutId=void 0),this.options&&h(this.options,"Ads")&&console.log("[ADS] Paused ad refresh")}resume(){this.options&&h(this.options,"Ads")&&console.log("[ADS] Resuming ad refresh"),this.placeholderNames.some(s=>!this.overriddenPlaceholders.has(s))&&this.getAds()}async computeImageBitmapHash(e){const s=Math.max(1,e.width||0),t=Math.max(1,e.height||0),i=new OffscreenCanvas(s,t),o=i.getContext("2d");if(!o)throw new Error("2D context not available");o.drawImage(e,0,0,s,t);const a=await(await i.convertToBlob({type:"image/png"})).arrayBuffer(),A=await crypto.subtle.digest("SHA-256",a),l=new Uint8Array(A);let c="";for(let d=0;d<l.length;d++)c+=l[d].toString(16).padStart(2,"0");return c}clearPlaceholder(e){const s=this.adMap.get(e);if(s){let t=!1;if(this.adMap.forEach((i,o)=>{o!==e&&i===s&&(t=!0)}),!t&&s.image)try{s.image.close()}catch{}}this.adMap.set(e,void 0),this.overriddenPlaceholders.delete(e),this.uploadAdTextures()}clearAllPlaceholders(){const e=new Set;this.adMap.forEach((s,t)=>{if(s!=null&&s.image&&!e.has(s.image))try{s.image.close(),e.add(s.image)}catch{}this.adMap.set(t,void 0)}),this.logoAssets.clear(),this.overriddenPlaceholders.clear(),this.uploadAdTextures()}}class cs{constructor(e,s){this.renderDataMap=new Map,this.isRenderData=!1,this.videoFrameTexture=null,this.state="OFF",this.opacity=0,this.lastStateUpdate=0,this.stateUpdateInterval=500,this.lastPerformanceCheck=performance.now(),this.lastStatusUpdate=0,this.STATUS_UPDATE_INTERVAL=200,this.statusInitialized=!1,this.lastWebGLStatus={ready:!1,issue:""},this.lastRenderState="OFF",this.lastDataStatus={stream_data:!1,ads:!1,render_data:!1,alpha_mask:!1,placeholders:!1,processing_size:!1,isLive:!1},this.lastKillswitchStatus={web:!1,local:!1},this.lastZipBufferStatus=void 0,this.rendererStopped=!1,this.currentPeriod=null,this.selectedPlayerId=null,this.setWebGLEventListeners=()=>{const t=this.glContext.canvas;t.addEventListener("webglcontextlost",i=>{console.warn("Context lost:",i),i.preventDefault()}),t.addEventListener("webglcontextrestored",()=>{console.log("Context restored!"),this.webgl=new as(this,this.options),this.ads=new As(this.webgl,this.options),this.webgl.init(),this.updateStatusOverlay()})},this.addMetadataBatch=t=>{if(this.rendererStopped){t.forEach(i=>{if(i.alphaMask)try{i.alphaMask.close()}catch{}});return}t.forEach(i=>{var a,A,l;const o=(A=(a=i.gameMetaData)==null?void 0:a.pointers)==null?void 0:A.players,n=o&&o.length>0;if(!(!i.alphaMask&&!n)){this.options&&h(this.options,"Renderer")&&console.log(`[RendererWorker] Creating texture for timeCode=${i.timecode}`);try{let c;i.alphaMask&&(c=i.alphaMask instanceof VideoFrame?this.webgl.createTextureFromVideoFrame(i.alphaMask):this.webgl.createTextureFromImageBitmap(i.alphaMask));const d=i.timecode,u={width:i.processingWidth,height:i.processingHeight},g=i.placeholders??{},m={alphaMask:c,placeholders:g,processingSize:u,isLive:i.isLive,period:i.period,players:n?o:void 0},p=i.LED;if(p&&(m.led={cubePlaceholders:p.cubePlaceholders,intrinsics:p.intrinsics,distortion:p.distortion,referenceSize:p.referenceSize,modelVersion:p.modelVersion??((l=p.model)==null?void 0:l.version)},p.model&&p.model.LedModel))try{this.webgl.updateLEDCubesFromModel(p.model,m.led.modelVersion)}catch{}this.renderDataMap.set(d,m),B.setAttributes({last_webgl_uploaded_frame:d})}catch{this.options&&h(this.options,"Errors")&&console.error(`[RendererWorker] Error creating texture for timeCode=${i.timecode}`)}finally{i.alphaMask&&i.alphaMask.close()}}})},this.handleBurnedFrameRender=(t,i)=>{var o;if(!this.streamData||!((o=this.ads)!=null&&o.ads)){t.close();return}try{this.videoFrameTexture&&this.webgl.deleteTexture(this.videoFrameTexture),this.videoFrameTexture=this.webgl.createTextureFromImageBitmap(t);const n=this.renderDataMap.get(i);if(n&&n.period&&this.ads&&this.currentPeriod!==n.period&&(this.currentPeriod=n.period,this.ads.updatePeriod(n.period)),this.webgl.drawVideoFrameBase(this.videoFrameTexture),n){n.alphaMask&&this.webgl.drawAugmentation(n.alphaMask,n.placeholders,n.processingSize,1,!1,this.options.DRAW_TIMESTAMP_WEBGL?i:void 0);const a=this.getSelectedPlayerCircle(n);if(a){const A=this.options.MASK_TYPE==="mp4";this.webgl.drawPlayerOverlay(n.alphaMask,a,n.processingSize,A)}this.shot&&(this.shot.frameCount++,this.shot.lastProcessingTime=performance.now())}this.deleteOldTextures(i),B.setAttributes({last_rendered_frame:i,renderer_state:this.state,has_augmentation:!!n,burned_timecode_mode:!0})}catch(n){B.error(`[Renderer] Error rendering burned frame for timeCode=${i}`,{error:n}),this.options&&h(this.options,"Errors")&&console.error("[Renderer] Error rendering burned frame:",n)}finally{t.close()}},this.handleBurnedFrameRenderWithLED=(t,i)=>{var o;if(this.rendererStopped){try{t.close()}catch{}return}if(!this.streamData||!((o=this.ads)!=null&&o.ads)){t.close();return}try{this.videoFrameTexture&&this.webgl.deleteTexture(this.videoFrameTexture),this.videoFrameTexture=this.webgl.createTextureFromImageBitmap(t);const n=this.renderDataMap.get(i);if(n&&n.period&&this.ads&&this.currentPeriod!==n.period&&(this.currentPeriod=n.period,this.ads.updatePeriod(n.period)),this.webgl.drawVideoFrameBase(this.videoFrameTexture),n){n.led&&n.alphaMask&&this.webgl.drawLEDOverlayOnTop(n.alphaMask,n.led),n.alphaMask&&(n.placeholders&&Object.keys(n.placeholders).length>0)&&this.webgl.drawAugmentation(n.alphaMask,n.placeholders,n.processingSize,1,!1,this.options.DRAW_TIMESTAMP_WEBGL?i:void 0);const a=this.getSelectedPlayerCircle(n);if(a){const A=this.options.MASK_TYPE==="mp4";this.webgl.drawPlayerOverlay(n.alphaMask,a,n.processingSize,A)}this.shot&&(this.shot.frameCount++,this.shot.lastProcessingTime=performance.now())}this.deleteOldTextures(i),B.setAttributes({last_rendered_frame:i,renderer_state:this.state,has_augmentation:!!n,has_led:!!(n!=null&&n.led),burned_timecode_mode:!0})}catch(n){B.error(`[Renderer] Error rendering burned frame with LED for timeCode=${i}`,{error:n}),this.options&&h(this.options,"Errors")&&console.error("[Renderer] Error rendering burned frame with LED:",n)}finally{t.close()}},this.handleRenderDraw=(t,i)=>{var p,f,y,S,P,v,L,G;if(this.rendererStopped||!this.streamData||!((p=this.ads)!=null&&p.ads))return;const o=this.renderDataMap.get(t);o&&o.period&&this.ads&&this.currentPeriod!==o.period&&(this.currentPeriod=o.period,this.ads.updatePeriod(o.period)),!!o!==this.isRenderData&&(o?(this.shot&&this.finalizeShot(this.shot,t),this.shot={shotId:crypto.randomUUID(),adURL:((y=(f=this.ads)==null?void 0:f.defaultAd)==null?void 0:y.adUrl)||"",sumPercentOfScreen:0,sumPercentOfAd:0,frameCount:0,start:performance.now(),lastProcessingTime:performance.now()},B.info("didStartDrawingAugmentationMedia",{timecode:t,adID:this.shot.shotId,adURL:this.shot.adURL})):this.shot&&this.finalizeShot(this.shot,t),this.isRenderData=!!o);const n=o?o.isLive:!1,a=!this.zipBufferStatus||this.zipBufferStatus.isReady,A=((S=this.zipBufferStatus)==null?void 0:S.needsFadeout)||!1,l=n&&!A&&!!this.ottActions&&(this.ottActions.toggle[this.streamData.customerId]!==void 0?this.ottActions.toggle[this.streamData.customerId]&&this.ottActions.toggle.web:this.ottActions.toggle.web)&&(this.ottActions.toggle.local!==void 0?this.ottActions.toggle.local:!0),c=((P=this.ottActions)==null?void 0:P.benchmarkPassed)??!1;if(!l||A||!c?(this.state==="ON"||this.state==="FADE_IN")&&(this.state="FADE_OUT"):a&&c&&(this.state==="OFF"||this.state==="FADE_OUT")&&(this.state="FADE_IN"),this.state==="FADE_IN"?(this.opacity===0&&(this.lastStateUpdate=performance.now(),this.opacity=.001),this.opacity=Math.min(1,this.opacity+(performance.now()-this.lastStateUpdate)/this.stateUpdateInterval),this.lastStateUpdate=performance.now(),this.opacity===1&&(this.state="ON")):this.state==="FADE_OUT"&&(this.opacity===1&&(this.lastStateUpdate=performance.now(),this.opacity=.999),this.opacity=Math.max(0,this.opacity-(performance.now()-this.lastStateUpdate)/this.stateUpdateInterval),this.lastStateUpdate=performance.now(),this.opacity===0&&(this.state="OFF")),!o)return;const d=o.alphaMask,u=o.placeholders,g=o.processingSize;if(!g)return;if((this.glContext.canvas.width!==g.width||this.glContext.canvas.height!==g.height)&&(this.glContext.canvas.width=g.width,this.glContext.canvas.height=g.height),i!=0)if(i>0){const E=z.fromStr(t).addFrames(1,this.streamData.fps),w=(v=this.renderDataMap.get(z.toStr(E)))==null?void 0:v.placeholders;w&&Object.keys(w).forEach(x=>{x in u&&(u[x].tranform=u[x].tranform.map((W,oe)=>W*(1-i)+w[x].tranform[oe]*i))})}else{const E=Math.abs(i),w=z.fromStr(t).subtractFrames(1,this.streamData.fps),x=(L=this.renderDataMap.get(z.toStr(w)))==null?void 0:L.placeholders;x&&Object.keys(x).forEach(W=>{W in u&&(u[W].tranform=u[W].tranform.map((oe,Ie)=>x[W].tranform[Ie]*(1-E)+oe*E))})}if(this.options&&h(this.options,"Renderer")&&console.log(`[Renderer] Render logic: binding texture for ${t}`),B.setAttributes({last_rendered_frame:t,renderer_state:this.state}),this.updateStatusOverlay(),d)this.webgl.drawAugmentationWithLED(d,u,g,this.opacity,o.led,this.options.DRAW_TIMESTAMP_WEBGL?t:void 0);else{const E=this.glContext;E.bindFramebuffer(E.FRAMEBUFFER,null),E.viewport(0,0,E.canvas.width,E.canvas.height),E.clearColor(0,0,0,0),E.clear(E.COLOR_BUFFER_BIT)}const m=this.getSelectedPlayerCircle(o);if(m){const E=this.options.MASK_TYPE==="mp4";this.webgl.drawPlayerOverlay(o.alphaMask,m,g,E)}if(this.options&&((G=this.options.debug)!=null&&G.trackPerformance)){const E=performance.now();E-this.lastPerformanceCheck>=this.options.PERFORMANCE_TRACKING_INTERVAL&&(this.trackPerformance(),this.lastPerformanceCheck=E)}},this.handleRenderClear=()=>{this.rendererStopped||(console.log("handleRenderClear"),this.opacity=0,this.state="OFF")},this.handlePlayerClick=t=>{if(!this.streamData||!this.streamData.timeCode)return!1;const i=this.streamData.timeCode,o=this.renderDataMap.get(i);if(!o||!o.players||!o.processingSize)return!1;const n=Sa(t,o.players,o.processingSize);return n?(this.selectedPlayerId===n.id?this.selectedPlayerId=null:this.selectedPlayerId=n.id,!0):(this.selectedPlayerId=null,!1)},this.getAdURLByCoord=t=>{var A,l;if(!this.ads||!this.streamData||!this.streamData.timeCode||!this.renderDataMap)return null;const i=this.streamData.timeCode,o=(A=this.renderDataMap.get(i))==null?void 0:A.placeholders,n=(l=this.renderDataMap.get(i))==null?void 0:l.processingSize;if(!o||!n)return null;console.log("placeholders: ",o);const a=this.ads.getAdURLAtCoord(o,n,t);return console.log("url: ",a),a},this.deleteTexture=t=>{var o;const i=(o=this.renderDataMap.get(t))==null?void 0:o.alphaMask;i&&(this.webgl.deleteTexture(i),this.renderDataMap.delete(t))},this.deleteOldTextures=t=>{if(!this.streamData)return;const i=59.94,o=z.fromStr(t).totalMilliseconds(i);this.renderDataMap.forEach((n,a)=>{z.fromStr(a).totalMilliseconds(i)<o-100&&(this.options&&h(this.options,"Renderer")&&console.log(`[Renderer] Deleting old texture for timeCode=${a}`),n.alphaMask&&this.webgl.deleteTexture(n.alphaMask),this.renderDataMap.delete(a))})},this.deleteAllTextures=()=>{this.renderDataMap.forEach((t,i)=>{t.alphaMask&&this.webgl.deleteTexture(t.alphaMask),this.renderDataMap.delete(i)})},this.cleanGL=()=>{this.webgl.cleanGL()},this.updateStreamData=t=>{this.streamData=t,this.updateStatusOverlay()},this.finalizeShot=(t,i)=>{t.end=t.lastProcessingTime,t.duration=t.end-t.start,B.info("didEndDrawingAugmentationMedia",{timecode:i,adID:t.shotId,adURL:t.adURL}),t.avaragePercentOfAd=t.sumPercentOfAd/t.frameCount,t.avaragePercentOfScreen=t.sumPercentOfScreen/t.frameCount,B.info("didRegisterShot",{adID:t.shotId,adURL:t.adURL,avaragePercentOfScreen:t.avaragePercentOfScreen.toFixed(2),avaragePercentOfAd:t.avaragePercentOfAd.toFixed(2),frameCount:t.frameCount,duration:t.duration.toFixed(0)}),this.shot=void 0},this.trackPerformance=()=>{const t=this.webgl.getAvgGPUFrameTime(),i=this.webgl.getAvgCPUFrameTime();Ba([{metric:"Rendering GPU time",value:t},{metric:"Rendering CPU time",value:i}],B.getMessagePort())},this.glContext=e,this.webgl=new as(this,s),this.options=s,this.ads=new As(this.webgl,s),this.rendererStopped=!1,this.webgl.init(),this.updateStatusOverlay()}isStopped(){return this.rendererStopped}setZipBufferStatus(e){this.zipBufferStatus=e,this.updateStatusOverlay()}updateStatusOverlay(){var A,l,c,d,u;const e=performance.now(),s=!this.statusInitialized;if(!s&&e-this.lastStatusUpdate<this.STATUS_UPDATE_INTERVAL)return;const t={ready:!!this.glContext&&!this.glContext.isContextLost()&&!!this.webgl,issue:(A=this.glContext)!=null&&A.isContextLost()?"Context Lost":""},i=(l=this.streamData)==null?void 0:l.timeCode,o=i?this.renderDataMap.get(i):void 0,n={stream_data:!!this.streamData,timecode:i||"",ads:((c=this.ads)==null?void 0:c.hasAds)??!1,render_data:!!o,alpha_mask:!!(o!=null&&o.alphaMask),placeholders:!!(o!=null&&o.placeholders),processing_size:!!(o!=null&&o.processingSize),isLive:(o==null?void 0:o.isLive)||!1},a={web:((d=this.ottActions)==null?void 0:d.toggle.web)!==!1,local:((u=this.ottActions)==null?void 0:u.toggle.local)!==!1};(s||JSON.stringify(t)!==JSON.stringify(this.lastWebGLStatus)||this.state!==this.lastRenderState||JSON.stringify(n)!==JSON.stringify(this.lastDataStatus)||JSON.stringify(a)!==JSON.stringify(this.lastKillswitchStatus)||JSON.stringify(this.zipBufferStatus)!==JSON.stringify(this.lastZipBufferStatus))&&(B.setAttributes({webgl_status:t,renderer_state:this.state,data_status:n,killswitch_status:a,zip_buffer_status:this.zipBufferStatus}),this.lastWebGLStatus=t,this.lastRenderState=this.state,this.lastDataStatus=n,this.lastKillswitchStatus=a,this.lastZipBufferStatus=this.zipBufferStatus,this.lastStatusUpdate=e,this.statusInitialized=!0)}getSelectedPlayerCircle(e){return this.selectedPlayerId===null||!e.players?null:e.players.find(s=>s.id===this.selectedPlayerId)??null}stop(){this.rendererStopped=!0,this.ads&&this.ads.pause(),this.cleanGL(),this.deleteAllTextures(),this.videoFrameTexture&&(this.webgl.deleteTexture(this.videoFrameTexture),this.videoFrameTexture=null)}}let ut=null,ft=null,ls=null,pe=null,ie=null,b=null,R,F,ht,ds=0,us=0,gt=null,mt,pt,Et=null;self.onmessage=async r=>{var s,t,i,o,n,a,A,l,c,d,u,g,m,p,f,y,S,P;const{data:e}=r;if(e.type==="SET_LOGGER_PORT"&&(pe=e.port,B.setMessagePort(e.port)),e.type==="INIT_OFFSCREEN"){const v=e.offscreen;if(R=e.options,ie=v.getContext("webgl"),R&&h(R,"Renderer")&&console.log("[RendererWorker] Initializing OffscreenCanvas"),!ie||ie!=null&&ie.isContextLost()){B.error("[RendererWorker] Failed to acquire WebGL context"),R&&h(R,"Errors")&&console.error("[RendererWorker] Failed to acquire WebGL context");return}b=new cs(ie,R),R&&h(R,"Renderer")&&console.log("[RendererWorker] OffscreenCanvas initialized, gl context acquired"),pe?pe.postMessage({type:"RENDERER_READY"}):postMessage({type:"RENDERER_READY"}),(async()=>{var L,G,E,w;try{if(gt){const x=await createImageBitmap(gt);mt?(G=(L=b.ads)==null?void 0:L.overrideAdImageForPlaceholder)==null||G.call(L,x,mt,pt):(E=b.ads)==null||E.overrideAdImage(x,pt),gt=null,mt=void 0,pt=void 0}if(Et){const x=await createImageBitmap(Et);(w=b.ads)==null||w.overrideLEDImage(x),Et=null}}catch(x){console.error("[RendererWorker] Failed to flush pending overrides",x)}})()}if(e.type==="SET_DOWNLOADER_PORT"&&(ut=e.port,ut.onmessage=Oa),e.type==="SET_DECODER_PORT"&&(ft=e.port,ft.onmessage=Pa),e.type==="SET_ADAPTER_PORT"&&(ls=e.port,ls.onmessage=Ua),(e.type==="RENDERER_DRAW"||e.type==="RENDERER_CLEAR")&&fs(e),e.type==="BURNED_FRAME_RENDER"&&wa(e),e.type==="VIDEO_CLICK"&&b&&!b.handlePlayerClick(e.clickData)){const L=b.getAdURLByCoord(e.clickData);postMessage({type:"OPEN_URL",url:L})}if(e.type==="STOP_WORKER"){b&&b.stop();return}if(e.type==="RESTART_WORKER"){if(console.log("[RendererWorker] RESTART_WORKER - creating new Renderer instance"),!ie||!R)return;b&&b.stop(),b=new cs(ie,R),console.log("[RendererWorker] New Renderer created, sending RENDERER_READY"),pe?pe.postMessage({type:"RENDERER_READY"}):postMessage({type:"RENDERER_READY"});return}if(e.type==="RESET_ADS"){if(!b)return;try{const v=e.placeholder;v?(R&&h(R,"Renderer")&&console.log(`[RendererWorker] RESET_ADS for placeholder: ${v}`),(s=b.ads)==null||s.resetPlaceholderToDefault(v)):(R&&h(R,"Renderer")&&console.log("[RendererWorker] RESET_ADS - resuming auto-refresh for all"),(t=b.ads)==null||t.resumeAutoRefresh())}catch(v){R&&h(R,"Errors")&&console.error("[RendererWorker] RESET_ADS failed",v)}return}if(e.type==="CLEAR_AD"){if(!b)return;try{const v=e.placeholder;R&&h(R,"Renderer")&&console.log("[RendererWorker] CLEAR_AD",v?`for ${v}`:"all"),v?(i=b.ads)==null||i.clearPlaceholder(v):(o=b.ads)==null||o.clearAllPlaceholders()}catch(v){R&&h(R,"Errors")&&console.error("[RendererWorker] CLEAR_AD failed",v)}return}if(e.type==="CLEAR_LED"){if(!b)return;try{R&&h(R,"Renderer")&&console.log("[RendererWorker] CLEAR_LED")}catch(v){R&&h(R,"Errors")&&console.error("[RendererWorker] CLEAR_LED failed",v)}return}if(e.type==="SET_AD_IMAGE"){if(!b){try{(n=e.imageBitmap)==null||n.close()}catch{}return}try{e.placeholder?(A=(a=b.ads)==null?void 0:a.overrideAdImageForPlaceholder)==null||A.call(a,e.imageBitmap,e.placeholder,e.clickUrl):(l=b.ads)==null||l.overrideAdImage(e.imageBitmap,e.clickUrl)}catch{try{(c=e.imageBitmap)==null||c.close()}catch{}}return}if(e.type==="SET_LED_IMAGE"){if(!b){try{(d=e.imageBitmap)==null||d.close()}catch{}return}try{(u=b.ads)==null||u.overrideLEDImage(e.imageBitmap)}catch{try{(g=e.imageBitmap)==null||g.close()}catch{}}return}if(e.type==="SET_AD_BLOB"){if(console.log("[RendererWorker] SET_AD_BLOB received:",{placeholder:e.placeholder,blobSize:(m=e.blob)==null?void 0:m.size,clickUrl:e.clickUrl,rendererExists:!!b}),!b){console.log("[RendererWorker] No renderer yet, storing as pending"),gt=e.blob,mt=e.placeholder,pt=e.clickUrl;return}try{console.log("[RendererWorker] Processing SET_AD_BLOB, placeholder:",e.placeholder);const v=new Blob([await e.blob.arrayBuffer()],{type:e.blob.type||"image/png"}),L=await createImageBitmap(v);e.placeholder?(console.log("[RendererWorker] Calling overrideAdImageForPlaceholder:",e.placeholder),(f=(p=b.ads)==null?void 0:p.overrideAdImageForPlaceholder)==null||f.call(p,L,e.placeholder,e.clickUrl)):(console.log("[RendererWorker] Calling overrideAdImage (global), isRestore:",e.isRestore),(y=b.ads)==null||y.overrideAdImage(L,e.clickUrl,e.isRestore))}catch(v){console.error("[RendererWorker] SET_AD_BLOB failed",v)}return}if(e.type==="SET_LED_BLOB"){if(!b){Et=e.blob;return}try{R&&h(R,"Renderer")&&console.log("[RendererWorker] SET_LED_BLOB size",(S=e.blob)==null?void 0:S.size);const v=new Blob([await e.blob.arrayBuffer()],{type:e.blob.type||"image/png"}),L=await createImageBitmap(v);(P=b.ads)==null||P.overrideLEDImage(L)}catch(v){R&&h(R,"Errors")&&console.error("[RendererWorker] SET_LED_BLOB failed",v)}return}};function La(){!ut||!F||ut.postMessage({type:"DOWNLOADER_INPUT",streamData:F})}function xa(){!ft||!F||ft.postMessage({type:"DECODER_REQUEST",timeCode:F.timeCode,fps:F.fps})}function Ba(r,e){if(!pe&&!e)return;const s=pe||e,t={type:"TRACK_PERFORMANCE",data:r};s.postMessage(t)}function fs(r){!b||b.isStopped()||(F=r.streamData,b?(F&&(b.updateStreamData(F),F.ottActions&&(b.ottActions=F.ottActions)),b.cleanGL(),r.type==="RENDERER_CLEAR"&&b.handleRenderClear(),r.type==="RENDERER_DRAW"&&F&&(b.handleRenderDraw(F.timeCode,F.frameCorrection),b.deleteOldTextures(F.timeCode)),hs()):R&&h(R,"Errors")&&console.error("[RendererWorker] WebGL context is not initialized."))}function wa(r){if(!b||b.isStopped()){r.imageBitmap.close();return}F=r.streamData,b?(b.updateStreamData(F),F.ottActions&&(b.ottActions=F.ottActions),b.cleanGL(),b.handleBurnedFrameRenderWithLED(r.imageBitmap,r.timecode),hs()):(r.imageBitmap.close(),R&&h(R,"Errors")&&console.error("[RendererWorker] WebGL context not initialized for burned frame"))}function hs(){if(!R)return;const r=performance.now();r-ds>R.DOWNLOADER_UPDATE_FREQUENCY&&(La(),ds=r),r-us>R.DECODER_UPDATE_FREQUENCY&&(xa(),us=r)}function Pa(r){if(!b||b.isStopped())return;const{data:e}=r;if(e.type==="RENDERER_INPUT"){const s=e.batch;R&&h(R,"Renderer")&&console.log(`[RendererWorker] Received a batch of ${s.length} frames`),b&&b.addMetadataBatch(s)}}function Oa(r){const{data:e}=r;if(e.type==="ZIP_BUFFER_STATUS"){ht=e.status,b&&ht&&b.setZipBufferStatus(ht),R&&h(R,"Renderer")&&console.log("[RendererWorker] Zip buffer status:",ht);return}F&&R&&h(R,"Renderer")&&console.log("[RendererWorker] Message from Downloader:",r.data)}function Ua(r){const{data:e}=r;(e.type==="RENDERER_DRAW"||e.type==="RENDERER_CLEAR")&&fs(e)}self.onunhandledrejection=r=>{B.error("[RendererWorker] Unhandled rejection",{error:r.reason}),R&&(h(R,"Errors")&&console.error("[RendererWorker] Unhandled rejection:",r.reason),r.preventDefault())},self.onerror=r=>{B.error("[RendererWorker] Unhandled error",{error:r}),R&&(h(R,"Errors")&&console.error("[RendererWorker] Unhandled error:",r),r instanceof Event&&r.preventDefault())}})();\n',Qt=typeof self<"u"&&self.Blob&&new Blob([Ht],{type:"text/javascript;charset=utf-8"});function ls(r){let e;try{if(e=Qt&&(self.URL||self.webkitURL).createObjectURL(Qt),!e)throw"";const t=new Worker(e,{name:r==null?void 0:r.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Ht),{name:r==null?void 0:r.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const jt='(function(){"use strict";const x=(e,t)=>t==="Errors"?!0:!e.debug||!e.debug.on?!1:e.debug[`log${t}`],jn=e=>Math.abs(e-59.94005994005994)<20?59.94:Math.abs(e-29.97002997002997)<10?29.97:Math.abs(e-14.985014985014985)<8?14.98:0,w={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},I=console,z={};Object.keys(w).forEach(e=>{z[e]=I[e]});const fe="Datadog Browser SDK:",_={debug:z.debug.bind(I,fe),log:z.log.bind(I,fe),info:z.info.bind(I,fe),warn:z.warn.bind(I,fe),error:z.error.bind(I,fe)},Xe="https://docs.datadoghq.com",Lt=`${Xe}/real_user_monitoring/browser/troubleshooting`,Ce="More details:";function At(e,t){return(...n)=>{try{return e(...n)}catch(r){_.error(t,r)}}}function Oe(e){return e!==0&&Math.random()*100<=e}function Wn(e){return zn(e)&&e>=0&&e<=100}function zn(e){return typeof e=="number"}const pe=1e3,H=60*pe,kt=60*H,Hn=365*(24*kt);function me(){return new Date().getTime()}function $(){return me()}function Re(){return performance.now()}function U(){return{relative:Re(),timeStamp:$()}}function Kn(){return{relative:0,timeStamp:It()}}function Vn(e,t){return t-e}function qn(e,t){return e+t}function Yn(e){return e-It()}let Ze;function It(){return Ze===void 0&&(Ze=performance.timing.navigationStart),Ze}const M=1024,Mt=1024*M,Jn=/[^\\u0000-\\u007F]/;function Qe(e){return Jn.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function Xn(e){return{...e}}function Pt(e,t){return Object.keys(e).some(n=>e[n]===t)}function ge(e){return Object.keys(e).length===0}function B(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let e=_dd_temp_;return delete Object.prototype._dd_temp_,typeof e!="object"&&(typeof self=="object"?e=self:typeof window=="object"?e=window:e={}),e}function ne(e,t){const n=B();let r;return n.Zone&&typeof n.Zone.__symbol__=="function"&&(r=e[n.Zone.__symbol__(t)]),r||(r=e[t]),r}let xe,Dt=!1;function Zn(e){xe=e}function Qn(e){Dt=e}function er(e,t,n){const r=n.value;n.value=function(...o){return(xe?b(r):r).apply(this,o)}}function b(e){return function(){return he(e,this,arguments)}}function he(e,t,n){try{return e.apply(t,n)}catch(r){tr(r)}}function tr(e){if(et(e),xe)try{xe(e)}catch(t){et(t)}}function et(...e){Dt&&_.error("[MONITOR]",...e)}function Se(e,t){return ne(B(),"setTimeout")(b(e),t)}function Nt(e){ne(B(),"clearTimeout")(e)}function tt(e,t){return ne(B(),"setInterval")(b(e),t)}function Ft(e){ne(B(),"clearInterval")(e)}class v{constructor(t){this.onFirstSubscribe=t,this.observers=[]}subscribe(t){return this.observers.push(t),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(n=>t!==n),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(t){this.observers.forEach(n=>n(t))}}function $t(...e){return new v(t=>{const n=e.map(r=>r.subscribe(o=>t.notify(o)));return()=>n.forEach(r=>r.unsubscribe())})}function Ut(e,t,n){let r=!1,o,s;return{throttled:(...i)=>{if(r){o=i;return}e(...i),r=!0,s=Se(()=>{o&&e(...o),r=!1,o=void 0},t)},cancel:()=>{Nt(s),r=!1,o=void 0}}}function G(){}function j(e){return e?(parseInt(e,10)^Math.random()*16>>parseInt(e,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,j)}const Le=/([\\w-]+)\\s*=\\s*([^;]+)/g;function nr(e,t){for(Le.lastIndex=0;;){const n=Le.exec(e);if(n){if(n[1]===t)return n[2]}else break}}function rr(e){const t=new Map;for(Le.lastIndex=0;;){const n=Le.exec(e);if(n)t.set(n[1],n[2]);else break}return t}function or(e,t,n=""){const r=e.charCodeAt(t-1),s=r>=55296&&r<=56319?t+1:t;return e.length<=s?e:`${e.slice(0,s)}${n}`}function sr(){return ir()===0}let Ae;function ir(){return Ae??(Ae=ar())}function ar(e=window){var t;const n=e.navigator.userAgent;return e.chrome||/HeadlessChrome/.test(n)?0:((t=e.navigator.vendor)===null||t===void 0?void 0:t.indexOf("Apple"))===0||/safari/i.test(n)&&!/chrome|android/i.test(n)?1:2}function ye(e,t,n=0,r){const o=new Date;o.setTime(o.getTime()+n);const s=`expires=${o.toUTCString()}`,i=r&&r.crossSite?"none":"strict",a=r&&r.domain?`;domain=${r.domain}`:"",c=r&&r.secure?";secure":"",l=r&&r.partitioned?";partitioned":"";document.cookie=`${e}=${t};${s};path=/;samesite=${i}${a}${c}${l}`}function nt(e){return nr(document.cookie,e)}let rt;function K(e){return rt||(rt=rr(document.cookie)),rt.get(e)}function Bt(e,t){ye(e,"",0,t)}function cr(e){if(document.cookie===void 0||document.cookie===null)return!1;try{const t=`dd_cookie_test_${j()}`,n="test";ye(t,n,H,e);const r=nt(t)===n;return Bt(t,e),r}catch(t){return _.error(t),!1}}let ot;function ur(){if(ot===void 0){const e=`dd_site_test_${j()}`,t="test",n=window.location.hostname.split(".");let r=n.pop();for(;n.length&&!nt(e);)r=`${n.pop()}.${r}`,ye(e,t,pe,{domain:r});Bt(e,{domain:r}),ot=r}return ot}const re="_dd_s";function ke(e){return Object.values(e)}function lr(e){return Object.entries(e)}const st=4*kt,Gt=15*H,dr=Hn,be={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},jt=/^([a-zA-Z]+)=([a-z0-9-]+)$/,it="&";function fr(e){return!!e&&(e.indexOf(it)!==-1||jt.test(e))}const pr="1";function V(e,t){const n={isExpired:pr};return t.trackAnonymousUser&&(e!=null&&e.anonymousId?n.anonymousId=e==null?void 0:e.anonymousId:n.anonymousId=j()),n}function Ie(e){return ge(e)}function Wt(e){return!Ie(e)}function Me(e){return e.isExpired!==void 0||!mr(e)}function mr(e){return(e.created===void 0||me()-Number(e.created)<st)&&(e.expire===void 0||me()<Number(e.expire))}function zt(e){e.expire=String(me()+Gt)}function at(e){return lr(e).map(([t,n])=>t==="anonymousId"?`aid=${n}`:`${t}=${n}`).join(it)}function Ht(e){const t={};return fr(e)&&e.split(it).forEach(n=>{const r=jt.exec(n);if(r!==null){const[,o,s]=r;o==="aid"?t.anonymousId=s:t[o]=s}}),t}const gr="_dd",hr="_dd_r",Sr="_dd_l",yr="rum",br="logs";function Er(e){if(!K(re)){const n=K(gr),r=K(hr),o=K(Sr),s={};n&&(s.id=n),o&&/^[01]$/.test(o)&&(s[br]=o),r&&/^[012]$/.test(r)&&(s[yr]=r),Wt(s)&&(zt(s),e.persistSession(s))}}function Kt(e){const t=Cr(e);return cr(t)?{type:be.COOKIE,cookieOptions:t}:void 0}function Tr(e,t){const n={isLockEnabled:sr(),persistSession:wr(t),retrieveSession:vr,expireSession:r=>_r(t,r,e)};return Er(n),n}function wr(e){return t=>{ye(re,at(t),Gt,e)}}function _r(e,t,n){const r=V(t,n);ye(re,at(r),n.trackAnonymousUser?dr:st,e)}function vr(){const e=nt(re);return Ht(e)}function Cr(e){const t={};return t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=ur()),t}const Or="_dd_test_";function Vt(){try{const e=j(),t=`${Or}${e}`;localStorage.setItem(t,e);const n=localStorage.getItem(t);return localStorage.removeItem(t),e===n?{type:be.LOCAL_STORAGE}:void 0}catch{return}}function Rr(e){return{isLockEnabled:!1,persistSession:qt,retrieveSession:xr,expireSession:t=>Lr(t,e)}}function qt(e){localStorage.setItem(re,at(e))}function xr(){const e=localStorage.getItem(re);return Ht(e)}function Lr(e,t){qt(V(e,t))}const Ar=10,kr=100,Yt=[];let Pe;function q(e,t,n=0){var r;const{isLockEnabled:o,persistSession:s,expireSession:i}=t,a=f=>s({...f,lock:l}),c=()=>{const f=t.retrieveSession(),h=f.lock;return f.lock&&delete f.lock,{session:f,lock:h}};if(Pe||(Pe=e),e!==Pe){Yt.push(e);return}if(o&&n>=kr){Jt(t);return}let l,u=c();if(o){if(u.lock){De(e,t,n);return}if(l=j(),a(u.session),u=c(),u.lock!==l){De(e,t,n);return}}let d=e.process(u.session);if(o&&(u=c(),u.lock!==l)){De(e,t,n);return}if(d&&(Me(d)?i(d):(zt(d),o?a(d):s(d))),o&&!(d&&Me(d))){if(u=c(),u.lock!==l){De(e,t,n);return}s(u.session),d=u.session}(r=e.after)===null||r===void 0||r.call(e,d||u.session),Jt(t)}function De(e,t,n){Se(()=>{q(e,t,n+1)},Ar)}function Jt(e){Pe=void 0;const t=Yt.shift();t&&q(t,e)}const Xt=pe;function Ir(e){switch(e.sessionPersistence){case be.COOKIE:return Kt(e);case be.LOCAL_STORAGE:return Vt();case void 0:{let t=Kt(e);return!t&&e.allowFallbackToLocalStorage&&(t=Vt()),t}default:_.error(`Invalid session persistence \'${String(e.sessionPersistence)}\'`)}}function Mr(e,t,n,r){const o=new v,s=new v,i=new v,a=e.type===be.COOKIE?Tr(t,e.cookieOptions):Rr(t),{expireSession:c}=a,l=tt(g,Xt);let u;m();const{throttled:d,cancel:f}=Ut(()=>{q({process:y=>{if(Ie(y))return;const de=E(y);return O(de),de},after:y=>{Wt(y)&&!R()&&Bn(y),u=y}},a)},Xt);function h(){q({process:y=>R()?E(y):void 0},a)}function g(){q({process:y=>Me(y)?V(y,t):void 0,after:E},a)}function E(y){return Me(y)&&(y=V(y,t)),R()&&(F(y)?le():(i.notify({previousState:u,newState:y}),u=y)),y}function m(){q({process:y=>{if(Ie(y))return V(y,t)},after:y=>{u=y}},a)}function O(y){if(Ie(y))return!1;const{trackingType:de,isTracked:Gi}=r(y[n]);y[n]=de,delete y.isExpired,Gi&&!y.id&&(y.id=j(),y.created=String(me()))}function R(){return u[n]!==void 0}function F(y){return u.id!==y.id||u[n]!==y[n]}function le(){u=V(u,t),s.notify()}function Bn(y){u=y,o.notify()}function Gn(y){q({process:de=>({...de,...y}),after:E},a)}return{expandOrRenewSession:d,expandSession:h,getSession:()=>u,renewObservable:o,expireObservable:s,sessionStateUpdateObservable:i,restartSession:m,expire:()=>{f(),c(u),E(V(u,t))},stop:()=>{Ft(l)},updateSessionState:Gn}}const ct={GRANTED:"granted",NOT_GRANTED:"not-granted"};function Pr(e){const t=new v;return{tryToInit(n){e||(e=n)},update(n){e=n,t.notify()},isGranted(){return e===ct.GRANTED},observable:t}}function Y(e,t,n){if(typeof e!="object"||e===null)return JSON.stringify(e);const r=oe(Object.prototype),o=oe(Array.prototype),s=oe(Object.getPrototypeOf(e)),i=oe(e);try{return JSON.stringify(e,t,n)}catch{return"<error: unable to serialize object>"}finally{r(),o(),s(),i()}}function oe(e){const t=e,n=t.toJSON;return n?(delete t.toJSON,()=>{t.toJSON=n}):G}function ut(e){return Dr(e,location.href).href}function Dr(e,t){const n=Nr();if(n)try{return t!==void 0?new n(e,t):new n(e)}catch(s){throw new Error(`Failed to construct URL: ${String(s)} ${Y({url:e,base:t})}`)}if(t===void 0&&!/:/.test(e))throw new Error(`Invalid URL: \'${e}\'`);let r=document;const o=r.createElement("a");if(t!==void 0){r=document.implementation.createHTMLDocument("");const s=r.createElement("base");s.href=t,r.head.appendChild(s),r.body.appendChild(o)}return o.href=e,o}const Zt=URL;let Ne;function Nr(){if(Ne===void 0)try{Ne=new Zt("http://test/path").href==="http://test/path"}catch{Ne=!1}return Ne?Zt:void 0}const Fr="datad0g.com",$r="dd0g-gov.com",se="datadoghq.com",Ur="ddog-gov.com",Br="pci.browser-intake-datadoghq.com",Gr=["ddsource","ddtags"];function Ee(e,t,n){const r=jr(e,t);return{build(o,s){const i=zr(e,t,n,o,s);return r(i)},urlPrefix:r(""),trackType:t}}function jr(e,t){const n=`/api/v2/${t}`,r=e.proxy;if(typeof r=="string"){const s=ut(r);return i=>`${s}?ddforward=${encodeURIComponent(`${n}?${i}`)}`}if(typeof r=="function")return s=>r({path:n,parameters:s});const o=Wr(t,e);return s=>`https://${o}${n}?${s}`}function Wr(e,t){const{site:n=se,internalAnalyticsSubdomain:r}=t;if(e==="logs"&&t.usePciIntake&&n===se)return Br;if(r&&n===se)return`${r}.${se}`;if(n===$r)return`http-intake.logs.${n}`;const o=n.split("."),s=o.pop();return`browser-intake-${o.join("-")}.${s}`}function zr({clientToken:e,internalAnalyticsSubdomain:t},n,r,o,{retry:s,encoding:i}){const a=["sdk_version:6.5.0",`api:${o}`].concat(r);s&&a.push(`retry_count:${s.count}`,`retry_after:${s.lastFailureStatus}`);const c=["ddsource=browser",`ddtags=${encodeURIComponent(a.join(","))}`,`dd-api-key=${e}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${j()}`];return i&&c.push(`dd-evp-encoding=${i}`),n==="rum"&&c.push(`batch_time=${$()}`),t&&c.reverse(),c.join("&")}const Hr=200;function Kr(e){const{env:t,service:n,version:r,datacenter:o}=e,s=[];return t&&s.push(Fe("env",t)),n&&s.push(Fe("service",n)),r&&s.push(Fe("version",r)),o&&s.push(Fe("datacenter",o)),s}function Fe(e,t){const n=Hr-e.length-1;(t.length>n||Vr(t))&&_.warn(`${e} value doesn\'t meet tag requirements and will be sanitized. ${Ce} ${Xe}/getting_started/tagging/#defining-tags`);const r=t.replace(/,/g,"_");return`${e}:${r}`}function Vr(e){return qr()?new RegExp("[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]","u").test(e):!1}function qr(){try{return new RegExp("[\\\\p{Ll}]","u"),!0}catch{return!1}}function Yr(e){const t=e.site||se,n=Kr(e),r=Jr(e,n);return{replica:Xr(e,n),site:t,...r}}function Jr(e,t){return{logsEndpointBuilder:Ee(e,"logs",t),rumEndpointBuilder:Ee(e,"rum",t),sessionReplayEndpointBuilder:Ee(e,"replay",t)}}function Xr(e,t){if(!e.replica)return;const n={...e,site:se,clientToken:e.replica.clientToken},r={logsEndpointBuilder:Ee(n,"logs",t),rumEndpointBuilder:Ee(n,"rum",t)};return{applicationId:e.replica.applicationId,...r}}function Zr(e){return Gr.every(t=>e.includes(t))}function lt(e,t){return e!=null&&typeof e!="string"?(_.error(`${t} must be defined as a string`),!1):!0}function Qr(e){return e&&typeof e=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(e)?(_.error(`Site should be a valid Datadog site. ${Ce} ${Xe}/getting_started/site/.`),!1):!0}function $e(e,t){return e!==void 0&&!Wn(e)?(_.error(`${t} Sample Rate should be a number between 0 and 100`),!1):!0}function eo(e){var t,n,r,o,s,i;if(!e||!e.clientToken){_.error("Client Token is not configured, we will not send any data.");return}if(!(!Qr(e.site)||!$e(e.sessionSampleRate,"Session")||!$e(e.telemetrySampleRate,"Telemetry")||!$e(e.telemetryConfigurationSampleRate,"Telemetry Configuration")||!$e(e.telemetryUsageSampleRate,"Telemetry Usage")||!lt(e.version,"Version")||!lt(e.env,"Env")||!lt(e.service,"Service"))){if(e.trackingConsent!==void 0&&!Pt(ct,e.trackingConsent)){_.error(\'Tracking Consent should be either "granted" or "not-granted"\');return}return{beforeSend:e.beforeSend&&At(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:Ir(e),sessionSampleRate:(t=e.sessionSampleRate)!==null&&t!==void 0?t:100,telemetrySampleRate:(n=e.telemetrySampleRate)!==null&&n!==void 0?n:20,telemetryConfigurationSampleRate:(r=e.telemetryConfigurationSampleRate)!==null&&r!==void 0?r:5,telemetryUsageSampleRate:(o=e.telemetryUsageSampleRate)!==null&&o!==void 0?o:5,service:e.service||void 0,silentMultipleInit:!!e.silentMultipleInit,allowUntrustedEvents:!!e.allowUntrustedEvents,trackingConsent:(s=e.trackingConsent)!==null&&s!==void 0?s:ct.GRANTED,trackAnonymousUser:(i=e.trackAnonymousUser)!==null&&i!==void 0?i:!0,storeContextsAcrossPages:!!e.storeContextsAcrossPages,batchBytesLimit:16*M,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*pe,batchMessagesLimit:50,messageBytesLimit:256*M,...Yr(e)}}}function to(e){return{session_sample_rate:e.sessionSampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:e.telemetryUsageSampleRate,use_before_send:!!e.beforeSend,use_partitioned_cross_site_session_cookie:e.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:!!e.proxy,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_anonymous_user:e.trackAnonymousUser,session_persistence:e.sessionPersistence,allow_fallback_to_local_storage:!!e.allowFallbackToLocalStorage,store_contexts_across_pages:!!e.storeContextsAcrossPages,allow_untrusted_events:!!e.allowUntrustedEvents,tracking_consent:e.trackingConsent}}var dt;(function(e){e.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",e.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(dt||(dt={}));const Qt=new Set;function no(e){Array.isArray(e)&&ro(e.filter(t=>Pt(dt,t)))}function ro(e){e.forEach(t=>{Qt.add(t)})}function oo(){return Qt}const Te="?";function P(e){const t=[];let n=ft(e,"stack");const r=String(e);return n&&n.startsWith(r)&&(n=n.slice(r.length)),n&&n.split(`\n`).forEach(o=>{const s=ao(o)||uo(o)||fo(o)||go(o);s&&(!s.func&&s.line&&(s.func=Te),t.push(s))}),{message:ft(e,"message"),name:ft(e,"name"),stack:t}}const en="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\\\w+\\\\.|\\\\/).*?)",ie="(?::(\\\\d+))",so=new RegExp(`^\\\\s*at (.*?) ?\\\\(${en}${ie}?${ie}?\\\\)?\\\\s*$`,"i"),io=new RegExp(`\\\\((\\\\S*)${ie}${ie}\\\\)`);function ao(e){const t=so.exec(e);if(!t)return;const n=t[2]&&t[2].indexOf("native")===0,r=t[2]&&t[2].indexOf("eval")===0,o=io.exec(t[2]);return r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]),{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||Te,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}const co=new RegExp(`^\\\\s*at ?${en}${ie}?${ie}??\\\\s*$`,"i");function uo(e){const t=co.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:Te,line:t[2]?+t[2]:void 0,url:t[1]}}const lo=/^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;function fo(e){const t=lo.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||Te,line:+t[3],url:t[2]}}const po=/^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,mo=/(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;function go(e){const t=po.exec(e);if(!t)return;const n=t[3]&&t[3].indexOf(" > eval")>-1,r=mo.exec(t[3]);return n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0),{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||Te,line:t[4]?+t[4]:void 0,url:t[3]}}function ft(e,t){if(typeof e!="object"||!e||!(t in e))return;const n=e[t];return typeof n=="string"?n:void 0}function ho(e,t,n,r){const o=[{url:t,column:r,line:n}],{name:s,message:i}=yo(e);return{name:s,message:i,stack:o}}const So=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;function yo(e){let t,n;return{}.toString.call(e)==="[object String]"&&([,t,n]=So.exec(e)),{name:t,message:n}}function Ue(e){const n=new Error(e);n.name="HandlingStack";let r;return he(()=>{const o=P(n);o.stack=o.stack.slice(2),r=J(o)}),r}function J(e){let t=tn(e);return e.stack.forEach(n=>{const r=n.func==="?"?"<anonymous>":n.func,o=n.args&&n.args.length>0?`(${n.args.join(", ")})`:"",s=n.line?`:${n.line}`:"",i=n.line&&n.column?`:${n.column}`:"";t+=`\n at ${r}${o} @ ${n.url}${s}${i}`}),t}function tn(e){return`${e.name||"Error"}: ${e.message}`}function X(e,t,n,{computeHandlingStack:r}={}){let o=e[t];if(typeof o!="function")if(t in e&&t.startsWith("on"))o=G;else return{stop:G};let s=!1;const i=function(){if(s)return o.apply(this,arguments);const a=Array.from(arguments);let c;he(n,null,[{target:this,parameters:a,onPostCall:u=>{c=u},handlingStack:r?Ue("instrumented method"):void 0}]);const l=o.apply(this,a);return c&&he(c,null,[l]),l};return e[t]=i,{stop:()=>{s=!0,e[t]===i&&(e[t]=o)}}}const bo=220*M,Eo="$",To=3;function D(e,t=bo){const n=oe(Object.prototype),r=oe(Array.prototype),o=[],s=new WeakMap,i=pt(e,Eo,void 0,o,s),a=JSON.stringify(i);let c=a?a.length:0;if(c>t){gt(t,"discarded",e);return}for(;o.length>0&&c<t;){const l=o.shift();let u=0;if(Array.isArray(l.source))for(let d=0;d<l.source.length;d++){const f=pt(l.source[d],l.path,d,o,s);if(f!==void 0?c+=JSON.stringify(f).length:c+=4,c+=u,u=1,c>t){gt(t,"truncated",e);break}l.target[d]=f}else for(const d in l.source)if(Object.prototype.hasOwnProperty.call(l.source,d)){const f=pt(l.source[d],l.path,d,o,s);if(f!==void 0&&(c+=JSON.stringify(f).length+u+d.length+To,u=1),c>t){gt(t,"truncated",e);break}l.target[d]=f}}return n(),r(),i}function pt(e,t,n,r,o){const s=vo(e);if(!s||typeof s!="object")return wo(s);const i=mt(s);if(i!=="[Object]"&&i!=="[Array]"&&i!=="[Error]")return i;const a=e;if(o.has(a))return`[Reference seen at ${o.get(a)}]`;const c=n!==void 0?`${t}.${n}`:t,l=Array.isArray(s)?[]:{};return o.set(a,c),r.push({source:s,target:l,path:c}),l}function wo(e){return typeof e=="bigint"?`[BigInt] ${e.toString()}`:typeof e=="function"?`[Function] ${e.name||"unknown"}`:typeof e=="symbol"?`[Symbol] ${e.description||e.toString()}`:e}function mt(e){try{if(e instanceof Event)return _o(e);if(e instanceof RegExp)return`[RegExp] ${e.toString()}`;const n=Object.prototype.toString.call(e).match(/\\[object (.*)\\]/);if(n&&n[1])return`[${n[1]}]`}catch{}return"[Unserializable]"}function _o(e){return{type:e.type,isTrusted:e.isTrusted,currentTarget:e.currentTarget?mt(e.currentTarget):null,target:e.target?mt(e.target):null}}function vo(e){const t=e;if(t&&typeof t.toJSON=="function")try{return t.toJSON()}catch{}return e}function gt(e,t,n){_.warn(`The data provided has been ${t} as it is over the limit of ${e} characters:`,n)}const nn="No stack, consider using an instance of Error";function rn({stackTrace:e,originalError:t,handlingStack:n,componentStack:r,startClocks:o,nonErrorPrefix:s,source:i,handling:a}){const c=W(t),l=Co(e,c,s,t),u=Oo(c,e)?J(e):nn,d=c?an(t,i):void 0,f=e?e.name:void 0,h=on(t),g=sn(t);return{startClocks:o,source:i,handling:a,handlingStack:n,componentStack:r,originalError:t,type:f,message:l,stack:u,causes:d,fingerprint:h,context:g}}function Co(e,t,n,r){return e!=null&&e.message&&(e!=null&&e.name)?e.message:t?"Empty message":`${n} ${Y(D(r))}`}function Oo(e,t){return t===void 0?!1:e?!0:t.stack.length>0&&(t.stack.length>1||t.stack[0].url!==void 0)}function on(e){return W(e)&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function sn(e){if(e!==null&&typeof e=="object"&&"dd_context"in e)return e.dd_context}function Ro(e){var t;return(t=/@ (.+)/.exec(e))===null||t===void 0?void 0:t[1]}function W(e){return e instanceof Error||Object.prototype.toString.call(e)==="[object Error]"}function an(e,t){let n=e;const r=[];for(;W(n==null?void 0:n.cause)&&r.length<10;){const o=P(n.cause);r.push({message:n.cause.message,source:t,type:o==null?void 0:o.name,stack:J(o)}),n=n.cause}return r.length?r:void 0}const L={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function xo(e){const t=(o,s)=>{const i=rn({stackTrace:o,originalError:s,startClocks:U(),nonErrorPrefix:"Uncaught",source:L.SOURCE,handling:"unhandled"});e.notify(i)},{stop:n}=Lo(t),{stop:r}=Ao(t);return{stop:()=>{n(),r()}}}function Lo(e){return X(window,"onerror",({parameters:[t,n,r,o,s]})=>{let i;W(s)?i=P(s):i=ho(t,n,r,o),e(i,s??t)})}function Ao(e){return X(window,"onunhandledrejection",({parameters:[t]})=>{const n=t.reason||"Empty reason",r=P(n);e(r,n)})}function ko(e){const t={version:"6.5.0",onReady(n){n()},...e};return Object.defineProperty(t,"_setDebug",{get(){return Qn},enumerable:!1}),t}function Io(e,t,n){const r=e[t];r&&!r.q&&r.version&&_.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),e[t]=n,r&&r.q&&r.q.forEach(o=>At(o,"onReady callback threw an error:")())}function cn(e,t){t.silentMultipleInit||_.error(`${e} is already initialized.`)}function Z(e,t,n,r,o){return ht(e,t,[n],r,o)}function ht(e,t,n,r,{once:o,capture:s,passive:i}={}){const a=b(f=>{!f.isTrusted&&!f.__ddIsTrusted&&!e.allowUntrustedEvents||(o&&d(),r(f))}),c=i?{capture:s,passive:i}:s,l=window.EventTarget&&t instanceof EventTarget?window.EventTarget.prototype:t,u=ne(l,"addEventListener");n.forEach(f=>u.call(t,f,a,c));function d(){const f=ne(l,"removeEventListener");n.forEach(h=>f.call(t,h,a,c))}return{stop:d}}const Be={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function Mo(e,t){const n=[];t.includes(Be.cspViolation)&&n.push(Do(e));const r=t.filter(o=>o!==Be.cspViolation);return r.length&&n.push(Po(r)),$t(...n)}function Po(e){return new v(t=>{if(!window.ReportingObserver)return;const n=b((o,s)=>o.forEach(i=>t.notify(No(i)))),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),()=>{r.disconnect()}})}function Do(e){return new v(t=>{const{stop:n}=Z(e,document,"securitypolicyviolation",r=>{t.notify(Fo(r))});return n})}function No(e){const{type:t,body:n}=e;return un({type:n.id,message:`${t}: ${n.message}`,originalError:e,stack:ln(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)})}function Fo(e){const t=`\'${e.blockedURI}\' blocked by \'${e.effectiveDirective}\' directive`;return un({type:e.effectiveDirective,message:`${Be.cspViolation}: ${t}`,originalError:e,csp:{disposition:e.disposition},stack:ln(e.effectiveDirective,e.originalPolicy?`${t} of the policy "${or(e.originalPolicy,100,"...")}"`:"no policy",e.sourceFile,e.lineNumber,e.columnNumber)})}function un(e){return{startClocks:U(),source:L.REPORT,handling:"unhandled",...e}}function ln(e,t,n,r,o){return n?J({name:e,message:t,stack:[{func:"?",url:n,line:r??void 0,column:o??void 0}]}):void 0}function dn(e,t){const n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}function fn(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Ge(e,t,n=$o()){if(t===void 0)return e;if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,o)}if(n.hasAlreadyBeenSeen(t))return;if(Array.isArray(t)){const o=Array.isArray(e)?e:[];for(let s=0;s<t.length;++s)o[s]=Ge(o[s],t[s],n);return o}const r=fn(e)==="object"?e:{};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Ge(r[o],t[o],n));return r}function pn(e){return Ge(void 0,e)}function ae(...e){let t;for(const n of e)n!=null&&(t=Ge(t,n));return t}function $o(){if(typeof WeakSet<"u"){const t=new WeakSet;return{hasAlreadyBeenSeen(n){const r=t.has(n);return r||t.add(n),r}}}const e=[];return{hasAlreadyBeenSeen(t){const n=e.indexOf(t)>=0;return n||e.push(t),n}}}function Uo(){var e;const t=window.navigator;return{status:t.onLine?"connected":"not_connected",interfaces:t.connection&&t.connection.type?[t.connection.type]:void 0,effective_type:(e=t.connection)===null||e===void 0?void 0:e.effectiveType}}function Bo(e){const t=new Set;return e.forEach(n=>t.add(n)),Array.from(t)}function mn(e,t){const n=e.indexOf(t);n>=0&&e.splice(n,1)}const Go=500;function gn(){const e=[];return{add:o=>{e.push(o)>Go&&e.splice(0,1)},remove:o=>{mn(e,o)},drain:o=>{e.forEach(s=>s(o)),e.length=0}}}const Q={log:"log",configuration:"configuration",usage:"usage"},jo=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],Wo=[Ur];let hn=gn(),ce=e=>{hn.add(()=>ce(e))};function zo(e,t){let n;const r=new v,o=new Set,s=!Wo.includes(t.site)&&Oe(t.telemetrySampleRate),i={[Q.log]:s,[Q.configuration]:s&&Oe(t.telemetryConfigurationSampleRate),[Q.usage]:s&&Oe(t.telemetryUsageSampleRate)},a=Ho();ce=l=>{const u=Y(l);if(i[l.type]&&o.size<t.maxTelemetryEventsPerPage&&!o.has(u)){const d=c(e,l,a);r.notify(d),dn("telemetry",d),o.add(u)}},Zn(yn);function c(l,u,d){return ae({type:"telemetry",date:$(),service:l,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:ae(u,{runtime_env:d,connectivity:Uo(),sdk_setup:"npm"}),experimental_features:Array.from(oo())},n!==void 0?n():{})}return{setContextProvider:l=>{n=l},observable:r,enabled:s}}function Ho(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function Ko(){hn.drain()}function Vo(e){return e.site===Fr}function Sn(e,t){et(w.debug,e,t),ce({type:Q.log,message:e,status:"debug",...t})}function yn(e,t){ce({type:Q.log,status:"error",...Jo(e),...t})}function qo(e){ce({type:Q.configuration,configuration:e})}function Yo(e){ce({type:Q.usage,usage:e})}function Jo(e){if(W(e)){const t=P(e);return{error:{kind:t.name,stack:J(Xo(t))},message:t.message}}return{error:{stack:nn},message:`Uncaught ${Y(e)}`}}function Xo(e){return e.stack=e.stack.filter(t=>!t.url||jo.some(n=>t.url.startsWith(n))),e}const we=1/0,Zo=H;let _e=null;const je=new Set;function Qo(){je.forEach(e=>e())}function es({expireDelay:e,maxEntries:t}){let n=[];const r=[];_e||(_e=tt(()=>Qo(),Zo));const o=()=>{const h=Re()-e;for(;n.length>0&&n[n.length-1].endTime<h;){const g=n.pop();g&&r.push(g.startTime)}};je.add(o);function s(h,g){const E={value:h,startTime:g,endTime:we,remove:()=>{mn(n,E)},close:m=>{E.endTime=m}};return t&&n.length>=t&&n.pop(),n.unshift(E),E}function i(h=we,g={returnInactive:!1}){for(const E of n)if(E.startTime<=h){if(g.returnInactive||h<=E.endTime)return E.value;break}}function a(h){const g=n[0];g&&g.endTime===we&&g.close(h)}function c(h=we,g=0){const E=qn(h,g);return n.filter(m=>m.startTime<=E&&h<=m.endTime).map(m=>m.value)}function l(){return n.map(({startTime:h,endTime:g,value:E})=>({startTime:h,endTime:g===we?"Infinity":g,value:E}))}function u(){return r}function d(){n=[]}function f(){je.delete(o),je.size===0&&_e&&(Ft(_e),_e=null)}return{add:s,find:i,closeActive:a,findAll:c,reset:d,stop:f,getAllEntries:l,getDeletedEntries:u}}const ts=H,ns=st;function rs(e,t,n,r){const o=new v,s=new v,i=Mr(e.sessionStoreStrategyType,e,t,n),a=es({expireDelay:ns});i.renewObservable.subscribe(()=>{a.add(c(),Re()),o.notify()}),i.expireObservable.subscribe(()=>{s.notify(),a.closeActive(Re())}),i.expandOrRenewSession(),a.add(c(),Kn().relative),r.observable.subscribe(()=>{r.isGranted()?i.expandOrRenewSession():i.expire()}),os(e,()=>{r.isGranted()&&i.expandOrRenewSession()}),ss(e,()=>i.expandSession()),is(e,()=>i.restartSession());function c(){return{id:i.getSession().id,trackingType:i.getSession()[t],isReplayForced:!!i.getSession().forcedReplay,anonymousId:i.getSession().anonymousId}}return{findSession:(l,u)=>a.find(l,u),renewObservable:o,expireObservable:s,sessionStateUpdateObservable:i.sessionStateUpdateObservable,expire:i.expire,updateSessionState:i.updateSessionState}}function os(e,t){ht(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function ss(e,t){const n=()=>{document.visibilityState==="visible"&&t()};Z(e,document,"visibilitychange",n),tt(n,ts)}function is(e,t){Z(e,window,"resume",t,{capture:!0})}function bn(e){return e>=500}function as(e){try{return e.clone()}catch{return}}const cs=80*M,us=32,En=3*Mt,ls=H,Tn=pe;function wn(e,t,n,r,o){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?vn(e,t,n,{onSuccess:()=>Cn(0,t,n,r,o),onFailure:()=>{t.queuedPayloads.enqueue(e),_n(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function _n(e,t,n,r){e.transportStatus===2&&Se(()=>{const o=e.queuedPayloads.first();vn(o,e,t,{onSuccess:()=>{e.queuedPayloads.dequeue(),e.currentBackoffTime=Tn,Cn(1,e,t,n,r)},onFailure:()=>{e.currentBackoffTime=Math.min(ls,e.currentBackoffTime*2),_n(e,t,n,r)}})},e.currentBackoffTime)}function vn(e,t,n,{onSuccess:r,onFailure:o}){t.bandwidthMonitor.add(e),n(e,s=>{t.bandwidthMonitor.remove(e),ds(s)?(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:s.status},o()):(t.transportStatus=0,r())})}function Cn(e,t,n,r,o){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:`Reached max ${r} events size queued for upload: ${En/Mt}MiB`,source:L.AGENT,startClocks:U()}),t.queueFullReported=!0);const s=t.queuedPayloads;for(t.queuedPayloads=On();s.size()>0;)wn(s.dequeue(),t,n,r,o)}function ds(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||bn(e.status))}function fs(){return{transportStatus:0,currentBackoffTime:Tn,bandwidthMonitor:ps(),queuedPayloads:On(),queueFullReported:!1}}function On(){const e=[];return{bytesCount:0,enqueue(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first(){return e[0]},dequeue(){const t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size(){return e.length},isFull(){return this.bytesCount>=En}}}function ps(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=cs&&this.ongoingRequestCount<us},add(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}}}function ms(e,t,n){const r=fs(),o=(s,i)=>Ss(e,t,s,i);return{send:s=>{wn(s,r,o,e.trackType,n)},sendOnExit:s=>{gs(e,t,s)}}}function gs(e,t,n){if(!!navigator.sendBeacon&&n.bytesCount<t)try{const s=e.build("beacon",n);if(navigator.sendBeacon(s,n.data))return}catch(s){hs(s)}const o=e.build("xhr",n);St(o,n.data)}let Rn=!1;function hs(e){Rn||(Rn=!0,yn(e))}function Ss(e,t,n,r){if(ys()&&n.bytesCount<t){const s=e.build("fetch",n);fetch(s,{method:"POST",body:n.data,keepalive:!0,mode:"cors"}).then(b(i=>r==null?void 0:r({status:i.status,type:i.type})),b(()=>{const i=e.build("xhr",n);St(i,n.data,r)}))}else{const s=e.build("xhr",n);St(s,n.data,r)}}function ys(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function St(e,t,n){const r=new XMLHttpRequest;r.open("POST",e,!0),t instanceof Blob&&r.setRequestHeader("Content-Type",t.type),Z({allowUntrustedEvents:!0},r,"loadend",()=>{n==null||n({status:r.status})},{once:!0}),r.send(t)}function yt(){const e=bs();if(e)return{getCapabilities(){var t;return JSON.parse(((t=e.getCapabilities)===null||t===void 0?void 0:t.call(e))||"[]")},getPrivacyLevel(){var t;return(t=e.getPrivacyLevel)===null||t===void 0?void 0:t.call(e)},getAllowedWebViewHosts(){return JSON.parse(e.getAllowedWebViewHosts())},send(t,n,r){const o=r?{id:r}:void 0;e.send(JSON.stringify({eventType:t,event:n,view:o}))}}}function We(e){var t;e===void 0&&(e=(t=B().location)===null||t===void 0?void 0:t.hostname);const n=yt();return!!n&&n.getAllowedWebViewHosts().some(r=>e===r||e.endsWith(`.${r}`))}function bs(){return B().DatadogEventBridge}const ze={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function Es(e){return new v(t=>{const{stop:n}=ht(e,window,["visibilitychange","freeze"],o=>{o.type==="visibilitychange"&&document.visibilityState==="hidden"?t.notify({reason:ze.HIDDEN}):o.type==="freeze"&&t.notify({reason:ze.FROZEN})},{capture:!0}),r=Z(e,window,"beforeunload",()=>{t.notify({reason:ze.UNLOADING})}).stop;return()=>{n(),r()}})}function Ts(e){return ke(ze).includes(e)}function ws({encoder:e,request:t,flushController:n,messageBytesLimit:r}){let o={};const s=n.flushObservable.subscribe(d=>u(d));function i(d,f,h){n.notifyBeforeAddMessage(f),h!==void 0?(o[h]=d,n.notifyAfterAddMessage()):e.write(e.isEmpty?d:`\n${d}`,g=>{n.notifyAfterAddMessage(g-f)})}function a(d){return d!==void 0&&o[d]!==void 0}function c(d){const f=o[d];delete o[d];const h=e.estimateEncodedBytesCount(f);n.notifyAfterRemoveMessage(h)}function l(d,f){const h=Y(d),g=e.estimateEncodedBytesCount(h);if(g>=r){_.warn(`Discarded a message whose size was bigger than the maximum allowed size ${r}KB. ${Ce} ${Lt}/#technical-limitations`);return}a(f)&&c(f),i(h,g,f)}function u(d){const f=ke(o).join(`\n`);o={};const h=Ts(d.reason),g=h?t.sendOnExit:t.send;if(h&&e.isAsync){const E=e.finishSync();E.outputBytesCount&&g(xn(E));const m=[E.pendingData,f].filter(Boolean).join(`\n`);m&&g({data:m,bytesCount:Qe(m)})}else f&&e.write(e.isEmpty?f:`\n${f}`),e.finish(E=>{g(xn(E))})}return{flushController:n,add:l,upsert:l,stop:s.unsubscribe}}function xn(e){let t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}function _s({messagesLimit:e,bytesLimit:t,durationLimit:n,pageExitObservable:r,sessionExpireObservable:o}){const s=r.subscribe(g=>u(g.reason)),i=o.subscribe(()=>u("session_expire")),a=new v(()=>()=>{s.unsubscribe(),i.unsubscribe()});let c=0,l=0;function u(g){if(l===0)return;const E=l,m=c;l=0,c=0,h(),a.notify({reason:g,messagesCount:E,bytesCount:m})}let d;function f(){d===void 0&&(d=Se(()=>{u("duration_limit")},n))}function h(){Nt(d),d=void 0}return{flushObservable:a,get messagesCount(){return l},notifyBeforeAddMessage(g){c+g>=t&&u("bytes_limit"),l+=1,c+=g,f()},notifyAfterAddMessage(g=0){c+=g,l>=e?u("messages_limit"):c>=t&&u("bytes_limit")},notifyAfterRemoveMessage(g){c-=g,l-=1,l===0&&h()}}}function Ln(e,t,n,r,o,s,i=ws){const a=l(e,t),c=n&&l(e,n);function l(u,{endpoint:d,encoder:f}){return i({encoder:f,request:ms(d,u.batchBytesLimit,r),flushController:_s({messagesLimit:u.batchMessagesLimit,bytesLimit:u.batchBytesLimit,durationLimit:u.flushTimeout,pageExitObservable:o,sessionExpireObservable:s}),messageBytesLimit:u.messageBytesLimit})}return{flushObservable:a.flushController.flushObservable,add(u,d=!0){a.add(u),c&&d&&c.add(n.transformMessage?n.transformMessage(u):u)},upsert:(u,d)=>{a.upsert(u,d),c&&c.upsert(n.transformMessage?n.transformMessage(u):u,d)},stop:()=>{a.stop(),c&&c.stop()}}}function He(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(n,r){const o=Qe(n);t+=o,e+=n,r&&r(o)},finish(n){n(this.finishSync())},finishSync(){const n={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,n},estimateEncodedBytesCount(n){return n.length}}}class vs{constructor(){this.callbacks={}}notify(t,n){const r=this.callbacks[t];r&&r.forEach(o=>o(n))}subscribe(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),{unsubscribe:()=>{this.callbacks[t]=this.callbacks[t].filter(r=>n!==r)}}}}function Cs(e,t,n){let r=0,o=!1;return{isLimitReached(){if(r===0&&Se(()=>{r=0},H),r+=1,r<=t||o)return o=!1,!1;if(r===t+1){o=!0;try{n({message:`Reached max number of ${e}s by minute: ${t}`,source:L.AGENT,startClocks:U()})}finally{o=!1}}return!0}}}let bt;const Et=new WeakMap;function Os(e){return bt||(bt=Rs(e)),bt}function Rs(e){return new v(t=>{const{stop:n}=X(XMLHttpRequest.prototype,"open",xs),{stop:r}=X(XMLHttpRequest.prototype,"send",s=>{Ls(s,e,t)},{computeHandlingStack:!0}),{stop:o}=X(XMLHttpRequest.prototype,"abort",As);return()=>{n(),r(),o()}})}function xs({target:e,parameters:[t,n]}){Et.set(e,{state:"open",method:String(t).toUpperCase(),url:ut(String(n))})}function Ls({target:e,handlingStack:t},n,r){const o=Et.get(e);if(!o)return;const s=o;s.state="start",s.startClocks=U(),s.isAborted=!1,s.xhr=e,s.handlingStack=t;let i=!1;const{stop:a}=X(e,"onreadystatechange",()=>{e.readyState===XMLHttpRequest.DONE&&c()}),c=()=>{if(l(),a(),i)return;i=!0;const u=o;u.state="complete",u.duration=Vn(s.startClocks.timeStamp,$()),u.status=e.status,r.notify(Xn(u))},{stop:l}=Z(n,e,"loadend",c);r.notify(s)}function As({target:e}){const t=Et.get(e);t&&(t.isAborted=!0)}let Tt;function An(){return Tt||(Tt=ks()),Tt}function ks(){return new v(e=>{if(!window.fetch)return;const{stop:t}=X(window,"fetch",n=>Is(n,e),{computeHandlingStack:!0});return t})}function Is({parameters:e,onPostCall:t,handlingStack:n},r){const[o,s]=e;let i=s&&s.method;i===void 0&&o instanceof Request&&(i=o.method);const a=i!==void 0?String(i).toUpperCase():"GET",c=o instanceof Request?o.url:ut(String(o)),l=U(),u={state:"start",init:s,input:o,method:a,startClocks:l,url:c,handlingStack:n};r.notify(u),e[0]=u.input,e[1]=u.init,t(d=>Ms(r,d,u))}function Ms(e,t,n){const r=n;function o(s){r.state="resolve",Object.assign(r,s),e.notify(r)}t.then(b(s=>{o({response:s,responseType:s.type,status:s.status,isAborted:!1})}),b(s=>{var i,a;o({status:0,isAborted:((a=(i=r.init)===null||i===void 0?void 0:i.signal)===null||a===void 0?void 0:a.aborted)||s instanceof DOMException&&s.code===DOMException.ABORT_ERR,error:s})}))}let wt={};function Ps(e){const t=e.map(n=>(wt[n]||(wt[n]=Ds(n)),wt[n]));return $t(...t)}function Ds(e){return new v(t=>{const n=I[e];return I[e]=(...r)=>{n.apply(console,r);const o=Ue("console error");he(()=>{t.notify(Ns(r,e,o))})},()=>{I[e]=n}})}function Ns(e,t,n){const r=e.map(s=>Fs(s)).join(" ");let o;if(t===w.error){const s=e.find(W);o={stack:s?J(P(s)):void 0,fingerprint:on(s),causes:s?an(s,"console"):void 0,startClocks:U(),message:r,source:L.CONSOLE,handling:"handled",handlingStack:n,context:sn(s)}}return{api:t,message:r,error:o,handlingStack:n}}function Fs(e){return typeof e=="string"?D(e):W(e)?tn(P(e)):Y(D(e),void 0,2)}function $s(e){const t=fn(e)==="object";return t||_.error("Unsupported context:",e),t}function _t(e,t,n){const r={...e};for(const[o,{required:s,type:i}]of Object.entries(t))i==="string"&&o in r&&(r[o]=String(r[o])),s&&!(o in e)&&_.warn(`The property ${o} of ${n} is required; context will not be sent to the intake.`);return r}function Ke(e="",{customerDataTracker:t,propertiesConfig:n={}}={}){let r={};const o=new v,s={getContext:()=>pn(r),setContext:i=>{$s(i)?(r=D(_t(i,n,e)),t==null||t.updateCustomerData(r)):s.clearContext(),o.notify()},setContextProperty:(i,a)=>{r=D(_t({...r,[i]:a},n,e)),t==null||t.updateCustomerData(r),o.notify()},removeContextProperty:i=>{delete r[i],t==null||t.updateCustomerData(r),_t(r,n,e),o.notify()},clearContext:()=>{r={},t==null||t.resetCustomerData(),o.notify()},changeObservable:o};return s}const Us="_dd_c",Bs=[];function vt(e,t,n,r){const o=Gs(n,r);Bs.push(Z(e,window,"storage",({key:l})=>{o===l&&i()})),t.changeObservable.subscribe(a);const s=ae(c(),t.getContext());ge(s)||t.setContext(s);function i(){t.setContext(c())}function a(){localStorage.setItem(o,JSON.stringify(t.getContext()))}function c(){const l=localStorage.getItem(o);return l?JSON.parse(l):{}}}function Gs(e,t){return`${Us}_${e}_${t}`}const js=3*M,Ws=16*M,zs=200;function Hs(e=2){const t=new Map;let n=!1;function r(o=0){if(n||e===0)return;const s=e===2?js:Ws;let i=o;t.forEach(a=>{i+=a.getBytesCount()}),i>s&&(Ks(s),n=!0)}return{createDetachedTracker:()=>{const o=kn(()=>r(o.getBytesCount()));return o},getOrCreateTracker:o=>(t.has(o)||t.set(o,kn(r)),t.get(o)),setCompressionStatus:o=>{e===0&&(e=o,r())},getCompressionStatus:()=>e,stop:()=>{t.forEach(o=>o.stop()),t.clear()}}}function kn(e){let t=0;const{throttled:n,cancel:r}=Ut(s=>{t=Qe(Y(s)),e()},zs),o=()=>{r(),t=0};return{updateCustomerData:s=>{ge(s)?o():n(s)},resetCustomerData:o,getBytesCount:()=>t,stop:()=>{r()}}}function Ks(e){_.warn(`Customer data exceeds the recommended ${e/M}KiB threshold. ${Ce} ${Lt}/#customer-data-exceeds-the-recommended-threshold-warning`)}function Vs(e,t,n){const r=e.getReader(),o=[];let s=0;i();function i(){r.read().then(b(c=>{if(c.done){a();return}o.push(c.value),s+=c.value.length,s>n.bytesLimit?a():i()}),b(c=>t(c)))}function a(){r.cancel().catch(G);let c,l;{let u;if(o.length===1)u=o[0];else{u=new Uint8Array(s);let d=0;o.forEach(f=>{u.set(f,d),d+=f.length})}c=u.slice(0,n.bytesLimit),l=u.length>n.bytesLimit}t(void 0,c,l)}}const qs="datadog-synthetics-public-id",Ys="datadog-synthetics-result-id",Js="datadog-synthetics-injects-rum";function In(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||K(Js))}function Xs(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||K(qs);return typeof e=="string"?e:void 0}function Zs(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||K(Ys);return typeof e=="string"?e:void 0}function Ve(e,t,n){const r=n.getHandler(),o=Array.isArray(r)?r:[r];return Mn[e]>=Mn[n.getLevel()]&&o.includes(t)}const S={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},Mn={[S.ok]:0,[S.debug]:1,[S.info]:2,[S.notice]:4,[S.warn]:5,[S.error]:6,[S.critical]:7,[S.alert]:8,[S.emerg]:9};function qe(e,{includeMessage:t=!1}={}){return{stack:e.stack,kind:e.type,message:t?e.message:void 0,causes:e.causes,fingerprint:e.fingerprint,handling:e.handling}}var Qs=function(e,t,n,r){var o=arguments.length,s=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};const ve={console:"console",http:"http",silent:"silent"},ei=Object.keys(S);let k=class{constructor(t,n,r,o=ve.http,s=S.debug,i={}){this.handleLogStrategy=t,this.handlerType=o,this.level=s,this.contextManager=Ke("logger",{customerDataTracker:n}),this.contextManager.setContext(i),r&&this.contextManager.setContextProperty("logger",{name:r})}logImplementation(t,n,r=S.info,o,s){const i=D(n);let a;if(o!=null){const c=rn({stackTrace:W(o)?P(o):void 0,originalError:o,nonErrorPrefix:"Provided",source:L.LOGGER,handling:"handled",startClocks:U()});a=ae({error:qe(c,{includeMessage:!0})},i)}else a=i;this.handleLogStrategy({message:D(t),context:a,status:r},this,s)}log(t,n,r=S.info,o){let s;Ve(r,ve.http,this)&&(s=Ue("log")),this.logImplementation(t,n,r,o,s)}setContext(t){this.contextManager.setContext(t)}getContext(){return this.contextManager.getContext()}setContextProperty(t,n){this.contextManager.setContextProperty(t,n)}removeContextProperty(t){this.contextManager.removeContextProperty(t)}clearContext(){this.contextManager.clearContext()}setHandler(t){this.handlerType=t}getHandler(){return this.handlerType}setLevel(t){this.level=t}getLevel(){return this.level}};Qs([er],k.prototype,"logImplementation",null),k.prototype.ok=N(S.ok),k.prototype.debug=N(S.debug),k.prototype.info=N(S.info),k.prototype.notice=N(S.notice),k.prototype.warn=N(S.warn),k.prototype.error=N(S.error),k.prototype.critical=N(S.critical),k.prototype.alert=N(S.alert),k.prototype.emerg=N(S.emerg);function N(e){return function(t,n,r){let o;Ve(e,ve.http,this)&&(o=Ue("log")),this.logImplementation(t,n,e,r,o)}}function ti(e,t,n){return{view:{referrer:document.referrer,url:window.location.href},context:e.getContext(),user:t.getContext(),account:n.getContext()}}const ni=32*M;function ri(e){e.usePciIntake===!0&&e.site&&e.site!=="datadoghq.com"&&_.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const t=eo(e),n=Pn(e.forwardConsoleLogs,ke(w),"Forward Console Logs"),r=Pn(e.forwardReports,ke(Be),"Forward Reports");if(!(!t||!n||!r))return e.forwardErrorsToLogs&&!n.includes(w.error)&&n.push(w.error),{forwardErrorsToLogs:e.forwardErrorsToLogs!==!1,forwardConsoleLogs:n,forwardReports:r,requestErrorResponseLengthLimit:ni,...t}}function Pn(e,t,n){if(e===void 0)return[];if(!(e==="all"||Array.isArray(e)&&e.every(r=>t.includes(r)))){_.error(`${n} should be "all" or an array with allowed values "${t.join(\'", "\')}"`);return}return e==="all"?t:Bo(e)}function oi(e){const t=to(e);return{forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports,use_pci_intake:e.usePciIntake,...t}}function si(e,t,n){const r=gn();let o,s;const i=t.observable.subscribe(a);function a(){if(!s||!o||!t.isGranted())return;i.unsubscribe();const c=n(o,s);r.drain(c)}return{init(c){if(!c){_.error("Missing configuration");return}if(no(c.enableExperimentalFeatures),We()&&(c=ii(c)),o=c,s){cn("DD_LOGS",c);return}const l=ri(c);l&&(s=l,An().subscribe(G),t.tryToInit(l.trackingConsent),a())},get initConfiguration(){return o},getInternalContext:G,handleLog(c,l,u,d=e(),f=$()){r.add(h=>h.handleLog(c,l,u,d,f))}}}function ii(e){return{...e,clientToken:"empty"}}const Ct="logs";function ai(e){const t=Hs(),n=Ke("global context",{customerDataTracker:t.getOrCreateTracker(2)}),r=Ke("user",{customerDataTracker:t.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),o=Ke("account",{customerDataTracker:t.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),s=Pr();function i(){return ti(n,r,o)}let a=si(i,s,(u,d)=>{u.storeContextsAcrossPages&&(vt(d,n,Ct,2),vt(d,r,Ct,1),vt(d,o,Ct,4));const f=e(u,d,i,s);return a=ci(u,f),f});const c={},l=new k((...u)=>a.handleLog(...u),t.createDetachedTracker());return ko({logger:l,init:b(u=>a.init(u)),setTrackingConsent:b(u=>{s.update(u),Yo({feature:"set-tracking-consent",tracking_consent:u})}),getGlobalContext:b(()=>n.getContext()),setGlobalContext:b(u=>n.setContext(u)),setGlobalContextProperty:b((u,d)=>n.setContextProperty(u,d)),removeGlobalContextProperty:b(u=>n.removeContextProperty(u)),clearGlobalContext:b(()=>n.clearContext()),createLogger:b((u,d={})=>(c[u]=new k((...f)=>a.handleLog(...f),t.createDetachedTracker(),D(u),d.handler,d.level,D(d.context)),c[u])),getLogger:b(u=>c[u]),getInitConfiguration:b(()=>pn(a.initConfiguration)),getInternalContext:b(u=>a.getInternalContext(u)),setUser:b(r.setContext),getUser:b(r.getContext),setUserProperty:b(r.setContextProperty),removeUserProperty:b(r.removeContextProperty),clearUser:b(r.clearContext),setAccount:b(o.setContext),getAccount:b(o.getContext),setAccountProperty:b(o.setContextProperty),removeAccountProperty:b(o.removeContextProperty),clearAccount:b(o.clearContext)})}function ci(e,t){return{init:n=>{cn("DD_LOGS",n)},initConfiguration:e,...t}}const ui="logs";function li(e,t){const n=rs(e,ui,r=>fi(e,r),t);return{findTrackedSession:(r,o={returnInactive:!1})=>{const s=n.findSession(r,o);return s&&s.trackingType==="1"?{id:s.id,anonymousId:s.anonymousId}:void 0},expireObservable:n.expireObservable}}function di(e){const n=Dn(e)==="1"?{}:void 0;return{findTrackedSession:()=>n,expireObservable:new v}}function Dn(e){return Oe(e.sessionSampleRate)?"1":"0"}function fi(e,t){const n=pi(t)?t:Dn(e);return{trackingType:n,isTracked:n==="1"}}function pi(e){return e==="0"||e==="1"}let Nn=!1;function Ye(e){const t=window;if(In()){const r=n(t.DD_RUM_SYNTHETICS);return!r&&!Nn&&(Nn=!0,Sn("Logs sent before RUM is injected by the synthetics worker",{testId:Xs(),resultId:Zs()})),r}return n(t.DD_RUM);function n(r){if(r&&r.getInternalContext)return r.getInternalContext(e)}}function mi(e,t,n,r,o){const s=ei.concat(["custom"]),i={};s.forEach(a=>{i[a]=Cs(a,t.eventRateLimiterThreshold,o)}),n.subscribe(0,({rawLogsEvent:a,messageContext:c=void 0,savedCommonContext:l=void 0,domainContext:u})=>{var d,f;const h=Yn(a.date),g=e.findTrackedSession(h);if(!e.findTrackedSession(h,{returnInactive:!0}))return;const m=l||r();let O;!ge(m.account)&&m.account.id&&(O=m.account),g&&g.anonymousId&&!m.user.anonymous_id&&(m.user.anonymous_id=g.anonymousId);const R=ae({service:t.service,session_id:g?g.id:void 0,session:g?{id:g.id}:void 0,usr:ge(m.user)?void 0:m.user,account:O,view:m.view},m.context,Ye(h),a,c);((d=t.beforeSend)===null||d===void 0?void 0:d.call(t,R,u))===!1||R.origin!==L.AGENT&&((f=i[R.status])!==null&&f!==void 0?f:i.custom).isLimitReached()||n.notify(1,R)})}const gi={[w.log]:S.info,[w.debug]:S.debug,[w.info]:S.info,[w.warn]:S.warn,[w.error]:S.error};function hi(e,t){const n=Ps(e.forwardConsoleLogs).subscribe(r=>{var o;const s={rawLogsEvent:{date:$(),message:r.message,origin:L.CONSOLE,error:r.error&&qe(r.error),status:gi[r.api]},messageContext:(o=r.error)===null||o===void 0?void 0:o.context,domainContext:{handlingStack:r.handlingStack}};t.notify(0,s)});return{stop:()=>{n.unsubscribe()}}}function Si(e,t){const n=Mo(e,e.forwardReports).subscribe(r=>{let o=r.message,s;const i=r.originalError.type==="deprecation"?S.warn:S.error;i===S.error?s=qe(r):r.stack&&(o+=` Found in ${Ro(r.stack)}`),t.notify(0,{rawLogsEvent:{date:$(),message:o,origin:L.REPORT,error:s,status:i}})});return{stop:()=>{n.unsubscribe()}}}function yi(e,t){if(!e.forwardErrorsToLogs)return{stop:G};const n=Os(e).subscribe(s=>{s.state==="complete"&&o("xhr",s)}),r=An().subscribe(s=>{s.state==="resolve"&&o("fetch",s)});function o(s,i){!Zr(i.url)&&(wi(i)||bn(i.status))&&("xhr"in i?bi(i.xhr,e,a):i.response?Ti(i.response,e,a):i.error&&Ei(i.error,e,a));function a(c){const l={isAborted:i.isAborted,handlingStack:i.handlingStack};t.notify(0,{rawLogsEvent:{message:`${_i(s)} error ${i.method} ${i.url}`,date:i.startClocks.timeStamp,error:{stack:c||"Failed to load",handling:void 0},http:{method:i.method,status_code:i.status,url:i.url},status:S.error,origin:L.NETWORK},domainContext:l})}}return{stop:()=>{n.unsubscribe(),r.unsubscribe()}}}function bi(e,t,n){typeof e.response=="string"?n(Ot(e.response,t)):n(e.response)}function Ei(e,t,n){n(Ot(J(P(e)),t))}function Ti(e,t,n){const r=as(e);!r||!r.body?n():window.TextDecoder?vi(r.body,t.requestErrorResponseLengthLimit,(o,s)=>{n(o?`Unable to retrieve response: ${o}`:s)}):r.text().then(b(o=>n(Ot(o,t))),b(o=>n(`Unable to retrieve response: ${o}`)))}function wi(e){return e.status===0&&e.responseType!=="opaque"}function Ot(e,t){return e.length>t.requestErrorResponseLengthLimit?`${e.substring(0,t.requestErrorResponseLengthLimit)}...`:e}function _i(e){return e==="xhr"?"XHR":"Fetch"}function vi(e,t,n){Vs(e,(r,o,s)=>{if(r)n(r);else{let i=new TextDecoder().decode(o);s&&(i+="..."),n(void 0,i)}},{bytesLimit:t,collectStreamBody:!0})}function Ci(e,t){if(!e.forwardErrorsToLogs)return{stop:G};const n=new v,{stop:r}=xo(n),o=n.subscribe(s=>{t.notify(0,{rawLogsEvent:{message:s.message,date:s.startClocks.timeStamp,error:qe(s),origin:L.SOURCE,status:S.error},messageContext:s.context})});return{stop:()=>{r(),o.unsubscribe()}}}const Oi=vs;function Ri(e){function t(n,r,o,s,i){const a=ae(r.getContext(),n.context);if(Ve(n.status,ve.console,r)&&Li(n,a),Ve(n.status,ve.http,r)){const c={rawLogsEvent:{date:i||$(),message:n.message,status:n.status,origin:L.LOGGER},messageContext:a,savedCommonContext:s};o&&(c.domainContext={handlingStack:o}),e.notify(0,c)}}return{handleLog:t}}const xi={[S.ok]:w.debug,[S.debug]:w.debug,[S.info]:w.info,[S.notice]:w.info,[S.warn]:w.warn,[S.error]:w.error,[S.critical]:w.error,[S.alert]:w.error,[S.emerg]:w.error};function Li({status:e,message:t},n){z[xi[e]].call(I,t,n)}function Ai(e,t,n,r,o){const s=Ln(e,{endpoint:e.logsEndpointBuilder,encoder:He()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:He()},n,r,o.expireObservable);return t.subscribe(1,i=>{s.add(i)}),s}function ki(e){const t=yt();e.subscribe(1,n=>{t.send("log",n)})}function Ii(e){return{get:t=>{const n=e.findTrackedSession(t);if(n)return{session_id:n.id}}}}function Mi(e){return t=>{e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:L.AGENT,status:S.error}}),Sn("Error reported to customer",{"error.message":t.message})}}function Pi(e,t,n,r,o){const s=zo("browser-logs-sdk",t);s.setContextProvider(()=>{var a,c,l,u,d,f;return{application:{id:(a=Ye())===null||a===void 0?void 0:a.application_id},session:{id:(c=o.findTrackedSession())===null||c===void 0?void 0:c.id},view:{id:(u=(l=Ye())===null||l===void 0?void 0:l.view)===null||u===void 0?void 0:u.id},action:{id:(f=(d=Ye())===null||d===void 0?void 0:d.user_action)===null||f===void 0?void 0:f.id}}});const i=[];if(We()){const a=yt(),c=s.observable.subscribe(l=>a.send("internal_telemetry",l));i.push(()=>c.unsubscribe())}else{const a=Ln(t,{endpoint:t.rumEndpointBuilder,encoder:He()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:He()},n,r,o.expireObservable);i.push(()=>a.stop());const c=s.observable.subscribe(l=>a.add(l,Vo(t)));i.push(()=>c.unsubscribe())}return Ko(),qo(oi(e)),{telemetry:s,stop:()=>{i.forEach(a=>a())}}}function Di(e,t,n,r){const o=new Oi,s=[];o.subscribe(1,f=>dn("logs",f));const i=Mi(o),a=Es(t),c=t.sessionStoreStrategyType&&!We()&&!In()?li(t,r):di(t),{stop:l}=Pi(e,t,i,a,c);s.push(()=>l()),yi(t,o),Ci(t,o),hi(t,o),Si(t,o);const{handleLog:u}=Ri(o);if(mi(c,t,o,n,i),We())ki(o);else{const{stop:f}=Ai(t,o,i,a,c);s.push(()=>f())}const d=Ii(c);return{handleLog:u,getInternalContext:d.get,stop:()=>{s.forEach(f=>f())}}}const ee=ai(Di);Io(B(),"DD_LOGS",ee);const C=class C{constructor(t,n,r,o,s){this.copy=()=>new C(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const i=":";let a=("0"+this.h).slice(-2)+i+("0"+this.m).slice(-2)+i+("0"+this.s).slice(-2)+i+("0"+this.f).slice(-2);return a+="."+(this.field?"1":"2"),a},this.toZipTimeCodeString=()=>{const i=this.copy();return i.f=0,i.s=i.s%2===0?i.s:i.s-1,i.field=0,C.toStr(i)},this.toFrames=i=>{let a=60,c=0;Math.floor(i)==60?(a=60,c=0):Math.floor(i)==59?(a=60,c=4):Math.floor(i)==30?(a=30,c=0):Math.floor(i)==29&&(a=30,c=2);let l=this.h,u=this.m,d=this.s,f=this.f,h=this.field;const g=l*60+u,m=(g-Math.floor(g/10))*c;return l*(a*3600)+u*(a*60)+d*a+(f*2+h)-m},this.addSeconds=i=>{let a=this.copy();if(a.s+=i,a.s>=60){const c=Math.floor(a.s/60);if(a.s=a.s%60,a.m+=c,a.m>=60){const l=Math.floor(a.m/60);a.m=a.m%60,a.h+=l}}return a},this.addFrames=(i,a)=>{let c=this.toFrames(a);return c+=i,C.fromFrames(c,a)},this.subtractFrames=(i,a)=>this.addFrames(-i,a),this.h=t||0,this.m=n||0,this.s=r||0,this.f=o||0,this.field=s||0}static compare(t,n){return t.h!==n.h?t.h<n.h?-1:1:t.m!==n.m?t.m<n.m?-1:1:t.s!==n.s?t.s<n.s?-1:1:t.f!==n.f?t.f<n.f?-1:1:t.field!==n.field?t.field<n.field?-1:1:0}static generateTimecodeRange(t,n,r){const o=[];let s=t;for(;C.compare(s,n)<=0;)o.push(s),s=s.addSeconds(r);return o}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(t){return this.toFrames(t)*1e3/t}};C.calculateCurrentTimeCode=t=>{var d;if(!t.video||!t.clocker||!t.gameParams)throw new Error("OTTPlayer is not initialized");const n=t.video,r=t.clocker,o=r.videoFPScalculator.getFPS(),a=(n.currentTime-r.syncPoint.playerTime)%(60*60*24)*o+r.syncPoint.frame;if(a===0||o===0)throw new Error("Current frame is 0 or fps is 0");const c=C.calculateCurrentOffset(a,(d=t.gameParams)==null?void 0:d.offsets);if(c===void 0)throw new Error("Offset is undefined");let l=Math.floor(a-c);return l<0&&(l+=5178816),l>=5178816&&(l-=5178816),C.fromFrames(l,o)},C.calculateCurrentOffset=(t,n)=>{for(let r=1;r<n.length;r++)if(t<n[r].frame)return n[r-1].offset;return Math.abs(n[n.length-1].offset)},C.fromFrames=(t,n)=>{let r=60,o=0;Math.floor(n)==60?(r=60,o=0):Math.floor(n)==59?(r=60,o=4):Math.floor(n)==30?(r=30,o=0):Math.floor(n)==29&&(r=30,o=2);let s=Math.floor(n*60),i=Math.floor(n*60*10),a=i*6,c=t,l=Math.floor(c/a);c-=l*a;let u=Math.floor(c/i);c-=u*i,c>=r*60&&(c+=o*(Math.floor((c-r*60)/s)+1));let d=Math.floor(c/(r*60));c-=d*(r*60);let f=Math.floor(c/r);c-=f*r;let h=c;d+=u*10;let g=0;return g=h%2,h=Math.floor(h/2),new C(l,d,f,h,g)},C.toStr=t=>{const n="_";let r=("0"+t.h).slice(-2)+n+("0"+t.m).slice(-2)+n+("0"+t.s).slice(-2)+n+("0"+t.f).slice(-2);return t.field&&(r+="_1"),r},C.fromStr=t=>{const r=t.split("_").map(Number);if(r.length==4){const[o,s,i,a]=r;return new C(o,s,i,a,0)}else if(r.length==5){const[o,s,i,a,c]=r;return new C(o,s,i,a,c)}else throw new Error("Invalid timecode format: "+t)},C.fromMetadata=t=>{const n=/^(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d))?$/,r=t.timecode.match(n);if(!r)throw new Error("Invalid timecode format: "+t.timecode);const[,o,s,i,a,c]=r,l=Number(o),u=Number(s),d=Number(i),f=Number(a),h=c?Number(c):0;return new C(l,u,d,f,h)};let te=C;const p=class p{constructor(t){this.listenerMap=new Map,p.options=t,this.isLoggingOn=t.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&ee.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const n="bb_logger_mac_uuid";let r=localStorage.getItem(n);r||(r=crypto.randomUUID(),localStorage.setItem(n,r)),p.tracking.mac=r,p.tracking.dev=`${t.platform}_${t.browserName}`,p.beatHandle||(p.options&&x(p.options,"Logger")&&console.log("[Logger] Starting tracking beat"),p.beatHandle=window.setInterval(p.flushTracking,15e3))}static setMessagePort(t){this.messagePort=t}static getMessagePort(){return this.messagePort}setLoggingOn(t){this.isLoggingOn=t}addEventListener(t,n){const r=o=>n(o);this.listenerMap.set(n,{eventName:t,wrappedListener:r}),this.eventTarget.addEventListener(t,r)}removeEventListener(t,n){const r=this.listenerMap.get(n);r&&r.eventName===t&&(this.eventTarget.removeEventListener(t,r.wrappedListener),this.listenerMap.delete(n))}removeAllEventListeners(){for(const[t,{eventName:n,wrappedListener:r}]of this.listenerMap)this.eventTarget.removeEventListener(n,r);this.listenerMap.clear()}setAttributes(t){p.processAttributes(t);for(const n in t)ee.logger.setContextProperty(n,t[n])}info(t,n){t==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(n==null?void 0:n.url)||""}),t==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(n==null?void 0:n.isEnabled)??!0}),t==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",n),t==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",n),t==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",n),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.info(t,n),p.options&&x(p.options,"Logger")&&console.log("[Logger] Sending info: ",t))}error(t,n){this.emit("mediaSessionDidError",{message:t,...n||{}}),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.error(t,n),p.tracking.err_time=Date.now().toFixed(0),p.tracking.err_desc=t+(n?` - ${JSON.stringify(n)}`:""),p.options&&x(p.options,"Logger")&&console.log("[Logger] Sending error: ",t))}criticalError(t,n){this.emit("mediaSessionDidFailOnError",{message:t,...n||{}}),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.error(t,n),p.tracking.err_time=Date.now().toFixed(0),p.tracking.err_desc=t+(n?` - ${JSON.stringify(n)}`:""),p.options&&x(p.options,"Logger")&&console.log("[Logger] Sending critical error: ",t))}warn(t,n){n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.warn(t,n),p.options&&x(p.options,"Logger")&&console.log("[Logger] Sending warn: ",t))}handleMessageFromWorker(t){t.actionType==="INFO"?this.info(t.message,t.attributes):t.actionType==="ERROR"?this.error(t.message,t.attributes):t.actionType==="CRITICAL_ERROR"?this.criticalError(t.message,t.attributes):t.actionType==="WARN"?this.warn(t.message,t.attributes):t.actionType==="SET_ATTRIBUTES"&&t.attributes&&this.setAttributes(t.attributes)}static setAttributes(t){if(!p.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{p.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:t})}catch(n){console.error("[Logger] Error posting message:",n)}}static info(t,n){p.messagePort.postMessage({type:"LOG",actionType:"INFO",message:t,attributes:n})}static error(t,n){p.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:t,attributes:n})}static warn(t,n){p.messagePort.postMessage({type:"LOG",actionType:"WARN",message:t,attributes:n})}static criticalError(t,n){p.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:t,attributes:n})}static processAttributes(t){if(t.player_version&&(p.tracking.sdk=t.player_version),t.media_id&&(p.tracking.gid=t.media_id),t.game_id&&(p.tracking.buc=t.game_id),t.bb_session_id&&(p.tracking.sid=t.bb_session_id,p.options&&x(p.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",p.tracking.sid)),t.last_timecode){const r=te.fromStr(t.last_timecode);p.tracking.tc=r.print(),p.lastTimecodeMillis=r.totalMilliseconds(59.94),p.lastTimecodeMillis&&p.lastZipMillis&&(p.tracking.cache=(p.lastZipMillis-p.lastTimecodeMillis).toFixed(0))}t.last_offset&&(p.tracking.off=t.last_offset),t.last_loading_zip&&(p.tracking.zip=t.last_loading_zip+".zip",p.lastZipMillis=te.fromStr(t.last_loading_zip).totalMilliseconds(59.94),p.lastTimecodeMillis&&p.lastZipMillis&&(p.tracking.cache=(p.lastZipMillis-p.lastTimecodeMillis).toFixed(0))),t.last_rendered_frame&&(p.tracking.aug_time=Date.now().toFixed(0)),t.asset&&(p.tracking.asset=t.asset)}static objectToQuery(t){return Object.entries(t).filter(([n,r])=>r!==0&&r!=="").map(([n,r])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`).join("&")}emit(t,n){const r=new CustomEvent(t,{detail:n});this.eventTarget.dispatchEvent(r)}};p.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},p.lastTimecodeMillis=0,p.lastZipMillis=0,p.flushTracking=()=>{const t=Date.now().toFixed(0);p.tracking.now=t;const r=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${p.objectToQuery(p.tracking)}&platform=Web`;p.options&&x(p.options,"Logger")&&console.log("[Logger] Flushing tracking data:",r),fetch(r,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),p.tracking.err_desc="",p.tracking.err_time=""};let ue=p;const Fn=(()=>{const e=()=>{const m=navigator.userAgent;return/windows/i.test(m)?"Windows":/android/i.test(m)?"Android":/iphone|ipad|ipod/i.test(m)?"iOS":/mac/i.test(m)?"Mac":/ipad/i.test(m)?"iPad":"Something else"},t=()=>e()==="Mac",n=()=>e()==="iPad",r=()=>e()==="iOS",o=()=>{const m=e();return m==="iOS"||m==="Mac"||m==="iPad"},s=()=>e()==="Windows",i=()=>e()==="Android",a=()=>{switch(e()){case"Windows":return"a Windows PC";case"Android":return"an Android phone";case"iOS":return"an iPhone";case"Mac":return"a Mac";case"iPad":return"an iPad";default:return"an Unknown device"}},c=()=>({header:[navigator.platform,navigator.userAgent,navigator.appVersion,navigator.vendor,window.opera],dataos:[{name:"Windows Phone",value:"Windows Phone",version:"OS"},{name:"Windows",value:"Win",version:"NT"},{name:"iPhone",value:"iPhone",version:"OS"},{name:"iPad",value:"iPad",version:"OS"},{name:"Kindle",value:"Silk",version:"Silk"},{name:"Android",value:"Android",version:"Android"},{name:"PlayBook",value:"PlayBook",version:"OS"},{name:"BlackBerry",value:"BlackBerry",version:"/"},{name:"Macintosh",value:"Mac",version:"OS X"},{name:"Linux",value:"Linux",version:"rv"},{name:"Palm",value:"Palm",version:"PalmOS"}],databrowser:[{name:"Chrome",value:"Chrome",version:"Chrome"},{name:"Firefox",value:"Firefox",version:"Firefox"},{name:"Safari",value:"Safari",version:"Version"},{name:"Internet Explorer",value:"MSIE",version:"MSIE"},{name:"Opera",value:"Opera",version:"Opera"},{name:"BlackBerry",value:"CLDC",version:"CLDC"},{name:"Mozilla",value:"Mozilla",version:"Mozilla"}],init(){const R=this.header.join(" ");return this.matchItem(R,this.dataos)},matchItem(R,F){for(let le=0;le<F.length;le+=1)if(new RegExp(F[le].value,"i").test(R))return F[le].name;return"unknown"}}).init(),l=()=>{const m=navigator.userAgent;return m.indexOf("Chrome")>-1&&m.indexOf("Edge")===-1?"Chrome":m.indexOf("Safari")>-1&&m.indexOf("Chrome")===-1?"Safari":m.indexOf("Firefox")>-1?"Firefox":m.indexOf("MSIE")>-1||m.indexOf("Trident")>-1?"Internet Explorer":m.indexOf("Edge")>-1?"Edge":"Unknown"};return{getCurrentPlatform:e,isMac:t,isiPad:n,isiPhone:r,isApple:o,isWindows:s,isAndroid:i,getDeviceDescription:a,getDeviceName:c,getBrowserName:l,isSafariMac:()=>t()&&l()==="Safari",isChromeMac:()=>t()&&l()==="Chrome",isChromeWin:()=>s()&&l()==="Chrome",isFirefoxMac:()=>t()&&l()==="Firefox",isFirefoxWin:()=>s()&&l()==="Firefox"}})(),Rt={lastRendererFrameSent:0,isRAFSeen:!1,isRVFCSeen:!1,RVFCmissed:!1,RVFCframeExpected:0,compensationMode:!1,compensationCounter:0,frameCorrection:0,lastMessageSent:""};let Je=null,A,T;self.onmessage=async e=>{const{data:t}=e;t.type==="SET_LOGGER_PORT"&&ue.setMessagePort(t.port),t.type==="SET_RENDERER_PORT"&&(Je=t.port,Je.onmessage=Ni),t.type==="ADAPTER_UPDATE_DATA"&&(T=t.data,$n()),t.type==="SET_OPTIONS"&&(A=t.options,ue.setMessagePort(self))};function Ni(e){A&&x(A,"Adapter")&&console.log("[AdapterWorker] Message from Renderer:",e.data)}const $n=()=>{!T||T.siData.isVideoPaused||(Fn.isChromeMac()?Fi():Fn.isSafariMac()&&$i())},Fi=()=>{if(!T||T.siData.isVideoPaused||!T.vfcData.lastFrameMetadata)return;const{siData:e,vfcData:t,afData:n,debugControls:r}=T;if(!e.isRAFSeen){let o=4,s=-11,i=1,a=5;if(r){const m=parseInt(r["Window Start (ms)"],10);isNaN(m)||(o=m);const O=parseInt(r["Window End (ms)"],10);isNaN(O)||(s=O);const R=parseInt(r["Frame Correction"],10);isNaN(R)||(i=R);const F=parseInt(r["Timeout time"],10);isNaN(F)||(a=F)}const c=1e3/t.videoFPS;1e3/n.animationFPS;const l=n.lastTimestamp,u=t.storedMetadata.reduce((m,O)=>Math.abs(O.expectedDisplayTime-l)<Math.abs(m.expectedDisplayTime-l)?O:m),d=u.expectedDisplayTime-o,f=[];for(let m=-10;m<10;m++)f.push(d+m*c);const h=u.expectedDisplayTime-s,g=[];for(let m=-10;m<10;m++)g.push(h+m*c);let E=null;f.forEach((m,O)=>{l>m&&l<g[O]&&(E=O-10)}),E!==null?setTimeout(m=>xt(t.lastCalculatedMediaTimeVideoFrame+m*Math.round(60/t.videoFPS)+i),a,E):xt(Rt.lastRendererFrameSent)}},$i=()=>{if(!T||T.siData.isVideoPaused||!T.vfcData.lastFrameMetadata)return;const{siData:e,vfcData:t,afData:n}=T;let r=n.lastCalculatedPlayerTimeFraction;const o=n.previousCalculatedPlayerTimeFraction;r<.3&&r>.1&&o<.3&&o>.1&&(r=Math.min(r,o));let s=0;r<.1?s=0:r>.1&&r<.3?s=(r-.1)/(.3-.1):s=1;let i=n.lastCalculatedPlayerTimeVideoFrame;s==1&&(i++,s=0),xt(i,s)},xt=(e,t)=>{if(!T)return;Rt.lastRendererFrameSent=e,T.siData.workingFps;const n=te.fromFrames(e,6e4/1001),r=T.vfcData.videoFPS;if(r<=10||r>70){console.error("Video FPS is out of supported range: "+r),Bi(n);return}T.afData.animationFPS,Ui(n,t)},Ui=(e,t)=>{const n=te.toStr(e);Rt.lastMessageSent=n,A&&x(A,"Adapter")&&console.log(`[AdapterWorker] Rendering augmentation for timecode: ${n} , ${e}`),Un(n,t)},Bi=e=>{const t=te.toStr(e);A&&x(A,"Adapter")&&console.log("[AdapterWorker] Clearing augmentation"),Un(t,0,!0)},Un=(e,t,n)=>{if(!Je||!T)return;const r=e;A&&x(A,"Adapter")&&console.log(`[AdapterWorker] Sending current time code to the Renderer: ${r}`);const o={timeCode:r,frameCorrection:t||0,fps:jn(T.siData.workingFps),zipBaseURL:T.zipBaseURL,adsBaseURL:T.adsBaseURL,bucketName:T.bucketName,customerId:T.customerId,offsets:T.offsets},i={type:n?"RENDERER_CLEAR":"RENDERER_DRAW",streamData:o};Je.postMessage(i)};self.onunhandledrejection=e=>{ue.error("[AdapterWorker] Unhandled rejection",{error:e.reason}),A&&(x(A,"Errors")&&console.error("[AdapterWorker] Unhandled rejection:",e.reason),e.preventDefault())},self.onerror=e=>{ue.error("[AdapterWorker] Unhandled error",{error:e}),A&&(x(A,"Errors")&&console.error("[AdapterWorker] Unhandled error:",e),e instanceof Event&&e.preventDefault())},setInterval($n,2)})();\n',Yt=typeof self<"u"&&self.Blob&&new Blob([jt],{type:"text/javascript;charset=utf-8"});function ds(r){let e;try{if(e=Yt&&(self.URL||self.webkitURL).createObjectURL(Yt),!e)throw"";const t=new Worker(e,{name:r==null?void 0:r.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jt),{name:r==null?void 0:r.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class Xt{constructor(){this.metrics=new Map,this.containers=[],this.createContainer=()=>{const e=document.createElement("div");e.style.display="flex",e.style.gap="30px",e.style.marginTop="2px",e.style.marginBottom="2px",e.style.fontSize="12px",e.style.fontFamily="monospace";const t={div:e,metrics:[]};return this.containers.push(t),document.body.appendChild(e),t},this.createMetric=(e,t)=>{const s=document.createElement("span");s.style.display="inline-flex",s.style.gap="4px",s.style.whiteSpace="nowrap",s.style.flexShrink="0";const i=document.createElement("span");i.textContent=`${e}:`,i.style.flexShrink="0",i.style.fontWeight="bold";const n=document.createElement("span");n.style.minWidth="0",n.style.textAlign="right",n.style.whiteSpace="nowrap",n.style.flexShrink="0",n.style.display="inline-block",n.textContent="",s.appendChild(i),s.appendChild(n);const o={name:e,value:"",span:s,valueSpan:n,maxWidth:0};return t.metrics.push(o),t.div.appendChild(s),this.metrics.set(e,o),o},this.updateMetric=(e,t)=>{const s=this.metrics.get(e);if(!s){console.error("Metric does not exist");return}typeof t=="boolean"?s.value=t?"true":"false":s.value=t,s.valueSpan.textContent=String(s.value);const i=s.valueSpan.offsetWidth;i>s.maxWidth&&(s.maxWidth=i,s.valueSpan.style.minWidth=`${i}px`)}}delete(){this.containers.forEach(e=>{e.div.remove()})}}const O=class O{constructor(e){if(this.canPlayListner=()=>this.setupCanvas(),this.clickListner=s=>{this.clicker.click(s)},this.mediaTime=0,this.timecodeChecker=new ns(0),this.rendererReady=!1,this.pendingAdBitmaps=[],this.lastAdBlobPerPlaceholder=new Map,this.lastClickUrlPerPlaceholder=new Map,this.logger=e.logger,this.OTTPlayer=e,this.options=e.options,this.debug=this.options.debug?this.options.debug.on:!1,this.options.debug&&this.debug){this.metrics=new Xt;const s=this.metrics.createContainer();if(this.metrics.createMetric("Last Downloaded Zip",s),this.metrics.createMetric("Last Decoded Frame",s),this.metrics.createMetric("Last WebGL Uploaded Frame",s),this.metrics.createMetric("Last Rendered Frame",s),this.metrics.createMetric("Renderer State",s),this.options.debug.trackPerformance){const i=this.metrics.createContainer();this.metrics.createMetric("Rendering GPU time",i),this.metrics.createMetric("Rendering CPU time",i),this.metrics.createMetric("Chunking time",i),this.metrics.createMetric("Decoding time",i)}}this.downloaderWorker=new as,this.decoderWorker=new cs,this.rendererWorker=new ls;const t=[this.downloaderWorker,this.decoderWorker,this.rendererWorker];this.options.ADAPTER_RUN_IN_WORKER&&(this.adapterWorker=new ds,t.push(this.adapterWorker)),window.BB.workerInstances.push(...t),this.rendererToDownloader=new MessageChannel,this.rendererToMain=new MessageChannel,this.downloaderToDecoder=new MessageChannel,this.decoderToRenderer=new MessageChannel,this.options.ADAPTER_RUN_IN_WORKER&&(this.adapterToRenderer=new MessageChannel),this.setupWorkers(),this.canvas=document.createElement("canvas"),this.OTTPlayer.video.readyState>=3?this.setupCanvas():this.OTTPlayer.video.addEventListener("canplay",this.canPlayListner,{once:!0}),this.processedTimecodes=[],this.clicker=new os(this.OTTPlayer,this.rendererWorker),this.segmentFirstFrameTimecode=new L,this.syncPoint={frame:0,playerTime:0,stringTime:""},this.cacheStarted=!1,this.animationFPScalculator=new it(20),this.videoFPScalculator=new it(20),this.startAnimationFrameLoop(),this.startVideoFrameCallbackLoop()}startAnimationFrameLoop(){const e=()=>{this.animationFPScalculator.addTimestamp(performance.now()/1e3),this.OTTPlayer.RUN_PIXEL_TICKERS&&this.OTTPlayer.pixelTickers.forEach(t=>{t.update()}),this.animationFrameLoopId=requestAnimationFrame(e)};this.animationFrameLoopId=requestAnimationFrame(e)}startVideoFrameCallbackLoop(){const e=(t,s)=>{this.mediaTime=s.mediaTime,this.videoFPScalculator.addTimestamp(s.mediaTime),this.videoFrameCallbackLoopId=this.OTTPlayer.video.requestVideoFrameCallback(e)};this.videoFrameCallbackLoopId=this.OTTPlayer.video.requestVideoFrameCallback(e)}updateCanvasSize(){if(!this.canvasContainer)return;const e=this.canvasContainer,t=e.style.width,s=e.style.height;if(O.DEBUG_RESIZE&&console.log("[Clocker.updateCanvasSize] Called",{containerId:e.id||"no-id",containerInline:{w:t||"none",h:s||"none"},containerOffset:{w:e.offsetWidth,h:e.offsetHeight}}),t&&s){this.canvas.style.width=t,this.canvas.style.height=s,O.DEBUG_RESIZE&&console.log("[Clocker.updateCanvasSize] Using inline styles, disconnecting ResizeObserver"),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0);return}const i=window.getComputedStyle(e);O.DEBUG_RESIZE&&console.log("[Clocker.updateCanvasSize] Using computed styles",{w:i.width,h:i.height}),this.canvas.style.width=i.width,this.canvas.style.height=i.height,!this.resizeObserver&&typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(n=>{var l;O.resizeObserverCallCount++;const o=O.resizeObserverCallCount,a=window.getComputedStyle(e),c=this.canvas.style.width,d=this.canvas.style.height;O.DEBUG_RESIZE&&console.log(`[Clocker.ResizeObserver] #${o} Fired`,{timestamp:Date.now(),containerId:e.id||"no-id",entryContentRect:(l=n[0])!=null&&l.contentRect?{w:n[0].contentRect.width,h:n[0].contentRect.height}:null,containerOffset:{w:e.offsetWidth,h:e.offsetHeight},containerComputed:{w:a.width,h:a.height},canvasBefore:{w:c,h:d},canvasAfter:{w:a.width,h:a.height},changed:c!==a.width||d!==a.height}),this.canvas.style.width=a.width,this.canvas.style.height=a.height}),this.resizeObserver.observe(e),O.DEBUG_RESIZE&&console.log("[Clocker.updateCanvasSize] ResizeObserver created and observing"))}setupCanvas(){const e=this.OTTPlayer.video,t=this.options.CANVAS_CONTAINER||e.parentElement;if(!t){console.error("[Clocker] No container found for canvas placement"),this.logger.error("setupCanvas failed: no container found");return}this.canvasContainer=t,console.log("video.videoWidth: ",e.videoWidth),console.log("video.videoHeight: ",e.videoHeight),this.canvas.width=e.videoWidth,this.canvas.height=e.videoHeight,this.canvas.style.zIndex="3000",this.canvas.style.position="absolute",this.canvas.style.top="0%",this.canvas.style.left="0",console.log("container: ",t),console.log("[OTTPlayer] container sizes:"),console.log("container.style.width: ",t.style.width),console.log("container.style.height: ",t.style.height),this.updateCanvasSize(),this.canvas.style.pointerEvents="none",t.addEventListener("click",this.clickListner),t.style.position="relative",t.appendChild(this.canvas);const s=this.canvas.transferControlToOffscreen(),{CANVAS_CONTAINER:i,...n}=this.options,o={type:"INIT_OFFSCREEN",offscreen:s,options:n};this.rendererWorker.postMessage(o,[s]),e.onseeked=()=>{this.onVideoSeeked()},e.onseeking=()=>{this.onVideoSeeked()}}setupWorkers(){const{CANVAS_CONTAINER:e,...t}=this.options;this.downloaderWorker.onmessage=s=>{s.data.type==="LOG"?(s.data.actionType==="SET_ATTRIBUTES"&&s.data.attributes.last_loading_zip&&this.metrics&&this.metrics.updateMetric("Last Downloaded Zip",s.data.attributes.last_loading_zip),this.logger.handleMessageFromWorker(s.data)):s.data.type==="TRACK_PERFORMANCE"&&this.trackPerformance(s.data)},this.decoderWorker.onmessage=s=>{if(s.data.type==="LOG"){if(s.data.actionType==="SET_ATTRIBUTES"&&(s.data.attributes.last_decoded_frame&&this.metrics&&this.metrics.updateMetric("Last Decoded Frame",s.data.attributes.last_decoded_frame),this.OTTPlayer.statusOverlay)){const i=s.data.attributes;i.decoder_status&&this.OTTPlayer.statusOverlay.updateMetric("health","decoder",i.decoder_status.healthy,i.decoder_status.issue),i.timecode_status&&this.OTTPlayer.statusOverlay.updateMetric("timecode","consistency",i.timecode_status.consistent,i.timecode_status.errorCount>0?`Errors: ${i.timecode_status.errorCount}`:void 0)}this.logger.handleMessageFromWorker(s.data)}else s.data.type==="TRACK_PERFORMANCE"&&this.trackPerformance(s.data)},this.rendererWorker.onmessage=s=>{s.data.type==="LOG"?(s.data.actionType==="SET_ATTRIBUTES"&&this.metrics&&(s.data.attributes.last_webgl_uploaded_frame&&this.metrics.updateMetric("Last WebGL Uploaded Frame",s.data.attributes.last_webgl_uploaded_frame),s.data.attributes.last_rendered_frame&&this.metrics.updateMetric("Last Rendered Frame",s.data.attributes.last_rendered_frame),s.data.attributes.renderer_state&&this.metrics.updateMetric("Renderer State",s.data.attributes.renderer_state)),this.logger.handleMessageFromWorker(s.data)):s.data.type==="TRACK_PERFORMANCE"?this.trackPerformance(s.data):s.data.type==="RENDERER_READY"&&(this.rendererReady=!0,this.flushOverrides(!0))},this.adapterWorker&&(this.adapterWorker.onmessage=s=>{s.data.type==="LOG"?this.logger.handleMessageFromWorker(s.data):s.data.type==="TRACK_PERFORMANCE"&&this.trackPerformance(s.data)}),this.rendererWorker.postMessage({type:"SET_DOWNLOADER_PORT",port:this.rendererToDownloader.port1},[this.rendererToDownloader.port1]),this.downloaderWorker.postMessage({type:"SET_RENDERER_PORT",port:this.rendererToDownloader.port2},[this.rendererToDownloader.port2]),this.downloaderWorker.postMessage({type:"SET_DECODER_PORT",port:this.downloaderToDecoder.port1},[this.downloaderToDecoder.port1]),this.decoderWorker.postMessage({type:"SET_DOWNLOADER_PORT",port:this.downloaderToDecoder.port2},[this.downloaderToDecoder.port2]),this.decoderWorker.postMessage({type:"SET_RENDERER_PORT",port:this.decoderToRenderer.port1},[this.decoderToRenderer.port1]),this.rendererWorker.postMessage({type:"SET_DECODER_PORT",port:this.decoderToRenderer.port2},[this.decoderToRenderer.port2]),this.adapterWorker&&this.adapterToRenderer&&(this.adapterWorker.postMessage({type:"SET_RENDERER_PORT",port:this.adapterToRenderer.port1},[this.adapterToRenderer.port1]),this.rendererWorker.postMessage({type:"SET_ADAPTER_PORT",port:this.adapterToRenderer.port2},[this.adapterToRenderer.port2])),this.rendererWorker.postMessage({type:"SET_LOGGER_PORT",port:this.rendererToMain.port1},[this.rendererToMain.port1]),this.rendererToMain.port2.onmessage=s=>{var i,n;if(s.data.type==="LOG"){if(s.data.actionType==="SET_ATTRIBUTES"&&(this.metrics&&(s.data.attributes.last_webgl_uploaded_frame&&this.metrics.updateMetric("Last WebGL Uploaded Frame",s.data.attributes.last_webgl_uploaded_frame),s.data.attributes.last_rendered_frame&&this.metrics.updateMetric("Last Rendered Frame",s.data.attributes.last_rendered_frame),s.data.attributes.renderer_state&&this.metrics.updateMetric("Renderer State",s.data.attributes.renderer_state)),this.OTTPlayer.statusOverlay)){const o=s.data.attributes;if(o.webgl_status&&this.OTTPlayer.statusOverlay.updateMetric("health","webgl",o.webgl_status.ready,o.webgl_status.issue),o.renderer_state&&this.OTTPlayer.statusOverlay.updateMetric("switches","render_state",o.renderer_state),o.data_status){const a=o.data_status;this.OTTPlayer.statusOverlay.updateMetric("data","stream_data",a.stream_data,a.timecode||void 0),this.OTTPlayer.statusOverlay.updateMetric("data","ads",a.ads),this.OTTPlayer.statusOverlay.updateMetric("data","render_data",a.render_data),this.OTTPlayer.statusOverlay.updateMetric("data","alpha_mask",a.alpha_mask),this.OTTPlayer.statusOverlay.updateMetric("data","placeholders",a.placeholders),this.OTTPlayer.statusOverlay.updateMetric("data","processing_size",a.processing_size),this.OTTPlayer.statusOverlay.updateMetric("switches","isLive",a.isLive)}if(o.killswitch_status){const a=o.killswitch_status;this.OTTPlayer.statusOverlay.updateMetric("switches","killswitch_web",a.web),this.OTTPlayer.statusOverlay.updateMetric("switches","killswitch_local",a.local)}if(o.zip_buffer_status){const a=o.zip_buffer_status,c=((i=a.retryingTimecodes)==null?void 0:i.length)||0,d=((n=a.failedTimecodes)==null?void 0:n.length)||0;let l=`${a.continuousSeconds.toFixed(1)}s`;(c>0||d>0)&&(l+=` | Retrying: ${c}, Failed: ${d}`),this.OTTPlayer.statusOverlay.updateMetric("data","zip_buffer",!a.needsFadeout,l)}}this.logger.handleMessageFromWorker(s.data)}else s.data.type==="TRACK_PERFORMANCE"?this.trackPerformance(s.data):s.data.type==="RENDERER_READY"&&(this.rendererReady=!0,this.flushOverrides(!0))},this.downloaderWorker.postMessage({type:"SET_OPTIONS",options:t}),this.decoderWorker.postMessage({type:"SET_OPTIONS",options:t}),this.adapterWorker&&this.adapterWorker.postMessage({type:"SET_OPTIONS",options:t}),this.rendererWorker.postMessage({type:"SET_OPTIONS",options:t})}callAdapterWorker(e){this.adapterWorker&&this.adapterWorker.postMessage({type:"ADAPTER_UPDATE_DATA",data:e})}callRendererWorkerWithFrame(e,t){if(!this.OTTPlayer.gameParams||!this.OTTPlayer.gameParams.bucketName){e.close();return}const s={timeCode:t,frameCorrection:0,fps:ce(this.videoFPScalculator.getFPS()),zipBaseURL:this.OTTPlayer.options.zipBaseURL,adsBaseURL:this.OTTPlayer.options.adsBaseURL,bucketName:this.OTTPlayer.gameParams.bucketName,offsets:this.OTTPlayer.gameParams.offsets,customerId:this.OTTPlayer.gameParams.customerId,ottActions:this.OTTPlayer.ottActions},i={type:"BURNED_FRAME_RENDER",imageBitmap:e,timecode:t,streamData:s};this.rendererWorker.postMessage(i,[e]),this.logger.setAttributes({last_timecode:t})}setAdImage(e,t,s){if(!this.rendererReady){this.pendingAdBitmaps.push({imageBitmap:e,placeholder:t,clickUrl:s});return}const i={type:"SET_AD_IMAGE",imageBitmap:e,placeholder:t,clickUrl:s};this.rendererWorker.postMessage(i,[e])}setLEDImage(e){if(!this.rendererReady){if(this.pendingLEDBitmap)try{this.pendingLEDBitmap.close()}catch{}this.pendingLEDBitmap=e;return}const t={type:"SET_LED_IMAGE",imageBitmap:e};this.rendererWorker.postMessage(t,[e])}setAdBlob(e,t,s){t?(this.lastAdBlobPerPlaceholder.set(t,e),s?this.lastClickUrlPerPlaceholder.set(t,s):this.lastClickUrlPerPlaceholder.delete(t)):(this.lastGlobalAdBlob=e,this.lastGlobalClickUrl=s);const i={type:"SET_AD_BLOB",blob:e,placeholder:t,clickUrl:s};this.rendererWorker.postMessage(i)}setLEDBlob(e){this.lastLEDBlob=e;const t={type:"SET_LED_BLOB",blob:e};this.rendererWorker.postMessage(t)}resetAds(e){e?(this.lastAdBlobPerPlaceholder.delete(e),this.lastClickUrlPerPlaceholder.delete(e)):(this.lastGlobalAdBlob=void 0,this.lastGlobalClickUrl=void 0),this.rendererWorker.postMessage({type:"RESET_ADS",placeholder:e})}clearAd(e){e?(this.lastAdBlobPerPlaceholder.delete(e),this.lastClickUrlPerPlaceholder.delete(e)):(this.lastGlobalAdBlob=void 0,this.lastGlobalClickUrl=void 0,this.lastAdBlobPerPlaceholder.clear(),this.lastClickUrlPerPlaceholder.clear());const t={type:"CLEAR_AD",placeholder:e};this.rendererWorker.postMessage(t)}clearLED(){this.lastLEDBlob=void 0;const e={type:"CLEAR_LED"};this.rendererWorker.postMessage(e)}callRendererWorker(e,t,s){var a,c;this.options&&y(this.options,"Clocker")&&console.log(`[Clocker] Sending current time code to the Renderer: ${e}`);const i=s?"RENDERER_CLEAR":"RENDERER_DRAW";if(!e||!this.OTTPlayer.gameParams||!this.OTTPlayer.gameParams.bucketName||!this.OTTPlayer.gameParams.offsets){const d={type:i};this.rendererWorker.postMessage(d);return}const n={timeCode:e,frameCorrection:t||0,fps:ce(this.videoFPScalculator.getFPS()),zipBaseURL:this.OTTPlayer.options.zipBaseURL,adsBaseURL:this.OTTPlayer.options.adsBaseURL,bucketName:this.OTTPlayer.gameParams.bucketName,offsets:this.OTTPlayer.gameParams.offsets,customerId:this.OTTPlayer.gameParams.customerId,ottActions:this.OTTPlayer.ottActions?{...this.OTTPlayer.ottActions,benchmarkPassed:((c=(a=this.OTTPlayer.adapter)==null?void 0:a.benchmark)==null?void 0:c.hasPassed())??!1}:void 0},o={type:i,streamData:n};this.rendererWorker.postMessage(o),s||this.logger.setAttributes({last_timecode:e})}onVideoSeeked(){this.restartWorkers(),this.OTTPlayer.adapter&&this.OTTPlayer.adapter.onVideoSeeked(),this.logger.info("didSeek")}stopWorkers(){const e={type:"STOP_WORKER"};this.downloaderWorker.postMessage(e),this.decoderWorker.postMessage(e),this.rendererWorker.postMessage(e)}restartWorkers(){this.rendererReady=!1;const e={type:"RESTART_WORKER"};this.downloaderWorker.postMessage(e),this.decoderWorker.postMessage(e),this.rendererWorker.postMessage(e)}pause(){this.stopWorkers(),this.animationFrameLoopId&&(cancelAnimationFrame(this.animationFrameLoopId),this.animationFrameLoopId=void 0),this.videoFrameCallbackLoopId&&(this.OTTPlayer.video.cancelVideoFrameCallback(this.videoFrameCallbackLoopId),this.videoFrameCallbackLoopId=void 0)}resume(){this.restartWorkers(),this.animationFrameLoopId||this.startAnimationFrameLoop(),this.videoFrameCallbackLoopId||this.startVideoFrameCallbackLoop()}trackPerformance(e){var t;if((t=this.options.debug)!=null&&t.trackPerformance&&this.metrics)for(let s of e.data)this.metrics.updateMetric(s.metric,s.value.toFixed(2))}flushOverrides(e=!1){var t;if(this.options&&y(this.options,"Clocker")&&console.log("[Clocker] flushOverrides called, reapplyLast:",e),this.options&&y(this.options,"Clocker")&&console.log("[Clocker] lastGlobalAdBlob:",!!this.lastGlobalAdBlob,(t=this.lastGlobalAdBlob)==null?void 0:t.size),this.options&&y(this.options,"Clocker")&&console.log("[Clocker] lastAdBlobPerPlaceholder:",this.lastAdBlobPerPlaceholder.size,Array.from(this.lastAdBlobPerPlaceholder.keys())),e){if(this.lastGlobalAdBlob){this.options&&y(this.options,"Clocker")&&console.log("[Clocker] Re-applying global blob, size:",this.lastGlobalAdBlob.size,"clickUrl:",this.lastGlobalClickUrl);const s={type:"SET_AD_BLOB",blob:this.lastGlobalAdBlob,clickUrl:this.lastGlobalClickUrl,isRestore:!0};this.rendererWorker.postMessage(s)}this.lastAdBlobPerPlaceholder.size>0&&this.lastAdBlobPerPlaceholder.forEach((s,i)=>{const n=this.lastClickUrlPerPlaceholder.get(i);this.options&&y(this.options,"Clocker")&&console.log("[Clocker] Re-applying per-placeholder blob:",i,"size:",s==null?void 0:s.size,"clickUrl:",n);const o={type:"SET_AD_BLOB",blob:s,placeholder:i,clickUrl:n,isRestore:!0};this.rendererWorker.postMessage(o)})}if(this.pendingAdBitmaps.length>0){for(const s of this.pendingAdBitmaps){const i={type:"SET_AD_IMAGE",imageBitmap:s.imageBitmap,placeholder:s.placeholder,clickUrl:s.clickUrl};this.rendererWorker.postMessage(i,[s.imageBitmap])}this.pendingAdBitmaps=[]}if(this.pendingLEDBitmap){const s=this.pendingLEDBitmap;this.pendingLEDBitmap=void 0;const i={type:"SET_LED_IMAGE",imageBitmap:s};this.rendererWorker.postMessage(i,[s])}else if(e&&this.lastLEDBlob){const s={type:"SET_LED_BLOB",blob:this.lastLEDBlob};this.rendererWorker.postMessage(s)}}delete(){const e=this.OTTPlayer.video,t=this.canvasContainer||e.parentElement;if(this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),t&&this.canvas&&t.contains(this.canvas)&&t.removeChild(this.canvas),this.rendererWorker.terminate(),this.downloaderWorker.terminate(),this.decoderWorker.terminate(),this.adapterWorker&&this.adapterWorker.terminate(),this.metrics&&this.metrics.delete(),this.animationFrameLoopId&&cancelAnimationFrame(this.animationFrameLoopId),this.videoFrameCallbackLoopId&&e.cancelVideoFrameCallback(this.videoFrameCallbackLoopId),e.removeEventListener("canplay",this.canPlayListner),t&&t.removeEventListener("click",this.clickListner),this.pendingAdBitmaps&&this.pendingAdBitmaps.length>0){for(const s of this.pendingAdBitmaps)try{s.imageBitmap.close()}catch{}this.pendingAdBitmaps=[]}if(this.pendingLEDBitmap){try{this.pendingLEDBitmap.close()}catch{}this.pendingLEDBitmap=void 0}}};O.DEBUG_RESIZE=!0,O.resizeObserverCallCount=0;let nt=O;class us{constructor(){this.controls=new Map,this.containers=[]}createContainer(e){const t=document.createElement("div");t.style.display="flex",t.style.flexWrap="wrap",t.style.gap="10px",t.style.padding="10px",t.style.marginBottom="10px",t.style.border="1px solid #ccc",t.style.fontSize="14px",t.style.backgroundColor="#f9f9f9";const s=document.createElement("button");s.textContent="Apply",s.style.cursor="pointer";const i={div:t,controls:[],button:s};return s.addEventListener("click",()=>{const n={};i.controls.forEach(o=>{o.type==="input"||o.type==="select"?o.appliedValue=o.element.value:o.type==="checkbox"&&(o.appliedValue=String(o.element.checked)),n[o.name]=o.appliedValue}),e&&e(n)}),t.appendChild(s),document.body.appendChild(t),this.containers.push(i),i}createInput(e,t="",s){const i=document.createElement("label");i.style.display="flex",i.style.flexDirection="column",i.style.fontWeight="bold";const n=document.createElement("span");n.textContent=e,n.style.marginBottom="3px";const o=document.createElement("input");o.type="text",o.value=String(t),o.style.minWidth="60px";const a={name:e,type:"input",element:o,container:s,appliedValue:String(t)};this.controls.set(e,a),s.controls.push(a),i.appendChild(n),i.appendChild(o),s.div.insertBefore(i,s.button)}createSelect(e,t,s="",i){const n=document.createElement("label");n.style.display="flex",n.style.flexDirection="column",n.style.fontWeight="bold";const o=document.createElement("span");o.textContent=e,o.style.marginBottom="3px";const a=document.createElement("select");a.style.minWidth="80px",Object.entries(t).forEach(([d,l])=>{const u=document.createElement("option");u.textContent=d,u.value=String(l),a.appendChild(u)}),a.value=String(s);const c={name:e,type:"select",element:a,container:i,appliedValue:String(s)};this.controls.set(e,c),i.controls.push(c),n.appendChild(o),n.appendChild(a),i.div.insertBefore(n,i.button)}createCheckbox(e,t=!1,s){const i=document.createElement("label");i.style.display="flex",i.style.fontWeight="bold";const n=document.createElement("span");n.textContent=e,n.style.marginRight="5px";const o=document.createElement("input");o.type="checkbox",o.checked=t;const a={name:e,type:"checkbox",element:o,container:s,appliedValue:String(t)};this.controls.set(e,a),s.controls.push(a),i.appendChild(n),i.appendChild(o),s.div.insertBefore(i,s.button)}exportData(){const e={};return this.controls.forEach(t=>{e[t.name]=t.appliedValue}),e}getValue(e){const t=this.controls.get(e);return t?t.appliedValue:(console.error(`No control found with name: ${e}`),"")}delete(){this.containers.forEach(e=>{e.div.remove()}),this.containers=[],this.controls.clear()}}const Ie=r=>r.toString().padStart(2,"0"),ot=":",hs=(r,e,t=!1)=>{let s="";return Array.isArray(r)?(s=[Ie(r[0]),Ie(r[1]),Ie(r[2]),Ie(r[3])].join(":"),t==!0?r[4]==1&&e?s+=".2":s+=".1":r[4]==1&&e&&(s+=".1")):(s=("0"+r.h).slice(-2)+ot+("0"+r.m).slice(-2)+ot+("0"+r.s).slice(-2)+ot+("0"+r.f).slice(-2),s+="."+(r.field?"1":"2")),s},fs=(r,e,t)=>{let s=60,i=0;Math.floor(e)==60?(s=60,i=0):Math.floor(e)==59?(s=60,i=4):Math.floor(e)==30?(s=30,i=0):Math.floor(e)==29&&(s=30,i=2);let n=0,a=Math.floor(e*60*10)*6,c=r[0],d=r[1],l=r[2],u=r[3],f=r[4];return n+=c*a,n+=d*(s*60),n+=l*s,n+=u*2+f,n-=i*d,n+=i*Math.floor(d/10),n},B=(()=>{const r=()=>{const g=navigator.userAgent;return/windows/i.test(g)?"Windows":/android/i.test(g)?"Android":/iphone|ipad|ipod/i.test(g)?"iOS":/mac/i.test(g)?"Mac":/ipad/i.test(g)?"iPad":"Something else"},e=()=>r()==="Mac",t=()=>r()==="iPad",s=()=>r()==="iOS",i=()=>{const g=r();return g==="iOS"||g==="Mac"||g==="iPad"},n=()=>r()==="Windows",o=()=>r()==="Android",a=()=>{switch(r()){case"Windows":return"a Windows PC";case"Android":return"an Android phone";case"iOS":return"an iPhone";case"Mac":return"a Mac";case"iPad":return"an iPad";default:return"an Unknown device"}},c=()=>({header:[navigator.platform,navigator.userAgent,navigator.appVersion,navigator.vendor,window.opera],dataos:[{name:"Windows Phone",value:"Windows Phone",version:"OS"},{name:"Windows",value:"Win",version:"NT"},{name:"iPhone",value:"iPhone",version:"OS"},{name:"iPad",value:"iPad",version:"OS"},{name:"Kindle",value:"Silk",version:"Silk"},{name:"Android",value:"Android",version:"Android"},{name:"PlayBook",value:"PlayBook",version:"OS"},{name:"BlackBerry",value:"BlackBerry",version:"/"},{name:"Macintosh",value:"Mac",version:"OS X"},{name:"Linux",value:"Linux",version:"rv"},{name:"Palm",value:"Palm",version:"PalmOS"}],databrowser:[{name:"Chrome",value:"Chrome",version:"Chrome"},{name:"Firefox",value:"Firefox",version:"Firefox"},{name:"Safari",value:"Safari",version:"Version"},{name:"Internet Explorer",value:"MSIE",version:"MSIE"},{name:"Opera",value:"Opera",version:"Opera"},{name:"BlackBerry",value:"CLDC",version:"CLDC"},{name:"Mozilla",value:"Mozilla",version:"Mozilla"}],init(){const b=this.header.join(" ");return this.matchItem(b,this.dataos)},matchItem(b,T){for(let C=0;C<T.length;C+=1)if(new RegExp(T[C].value,"i").test(b))return T[C].name;return"unknown"}}).init(),d=()=>{const g=navigator.userAgent;return g.indexOf("Chrome")>-1&&g.indexOf("Edge")===-1?"Chrome":g.indexOf("Safari")>-1&&g.indexOf("Chrome")===-1?"Safari":g.indexOf("Firefox")>-1?"Firefox":g.indexOf("MSIE")>-1||g.indexOf("Trident")>-1?"Internet Explorer":g.indexOf("Edge")>-1?"Edge":"Unknown"};return{getCurrentPlatform:r,isMac:e,isiPad:t,isiPhone:s,isApple:i,isWindows:n,isAndroid:o,getDeviceDescription:a,getDeviceName:c,getBrowserName:d,isSafariMac:()=>e()&&d()==="Safari",isChromeMac:()=>e()&&d()==="Chrome",isChromeWin:()=>n()&&d()==="Chrome",isFirefoxMac:()=>e()&&d()==="Firefox",isFirefoxWin:()=>n()&&d()==="Firefox"}})();class ps{constructor(e=10){this.testStartTime=0,this.currentState="FAILED",this.previousState="FAILED",this.testDurationMs=e*1e3,this.lastConditions=this.getEmptyConditions()}test(e){const t=Object.values(e).every(i=>i===!0);if(this.previousState=this.currentState,!t){this.currentState="FAILED",this.testStartTime=0,this.lastConditions=e;const i=this.previousState==="PASSED"||this.previousState==="TESTING";return{state:"FAILED",failedConditions:this.getFailedConditions(e),shouldClear:i}}const s=performance.now();if(this.currentState==="FAILED"&&(this.currentState="TESTING",this.testStartTime=s),this.currentState==="TESTING"){const i=s-this.testStartTime,n=this.testDurationMs-i;return n<=0?(this.currentState="PASSED",{state:"PASSED"}):{state:"TESTING",remainingSeconds:Math.ceil(n/1e3)}}return this.lastConditions=e,{state:"PASSED"}}hasPassed(){return this.currentState==="PASSED"}getStatus(){if(this.currentState==="FAILED")return{state:"FAILED",failedConditions:this.getFailedConditions(this.lastConditions)};if(this.currentState==="TESTING"){const t=performance.now()-this.testStartTime,s=this.testDurationMs-t;return{state:"TESTING",remainingSeconds:Math.ceil(s/1e3)}}return{state:"PASSED"}}reset(){this.currentState="FAILED",this.testStartTime=0}setDuration(e){this.testDurationMs=e*1e3}getFailedConditions(e){const t=[];return e.gameParams||t.push("game_params"),e.browserSupported||t.push("browser"),e.patternDetected||t.push("pattern"),e.fpsSupported||t.push("fps"),e.noMKAdsPlaying||t.push("mk_ads"),e.syncPointSet||t.push("sync_point"),t}getEmptyConditions(){return{gameParams:!1,browserSupported:!1,patternDetected:!1,fpsSupported:!1,noMKAdsPlaying:!0,syncPointSet:!1}}}class ms{constructor(){this.OUT_WIDTH=4,this.OUT_HEIGHT=1,this.canvas=document.createElement("canvas");const e=this.canvas.getContext("webgl2");if(!e)throw new Error("WebGL2 not supported");this.gl=e;const t=`#version 300 es
|
|
1
|
+
(function(de,ye){typeof exports=="object"&&typeof module<"u"?module.exports=ye():typeof define=="function"&&define.amd?define(ye):(de=typeof globalThis<"u"?globalThis:de||self,de.OTTPlayer=ye())})(this,function(){"use strict";const de=t=>Math.abs(t-59.94005994005994)<20?59.94:Math.abs(t-29.97002997002997)<10?29.97:Math.abs(t-14.985014985014985)<8?14.98:0,ye=t=>t>30&&t<70?59.94005994005994:t>15?29.97002997002997:t>7?14.985014985014985:0;class ot{constructor(e){this.frameDurations=[],this.frameDurationsCapacity=e,this.lastTimestamp=null}addFrameDuration(e){return this.frameDurations.push(e),this.frameDurations.length>this.frameDurationsCapacity&&this.frameDurations.shift(),this.calculateAverage()}addTimestamp(e){if(this.lastTimestamp===null)return this.lastTimestamp=e,null;const r=e-this.lastTimestamp;return this.lastTimestamp=e,this.addFrameDuration(r)}calculateAverage(){if(this.frameDurations.length===0)return 0;const r=this.frameDurations.reduce((o,a)=>o+a,0)/this.frameDurations.length,n=this.frameDurations.filter(o=>Math.abs(o-r)<=r*.2);return n.reduce((o,a)=>o+a,0)/n.length||r}getFPS(){const e=this.calculateAverage();if(e===0)return 0;const r=1/e;return ye(r)}getPerciseFPS(){const e=this.calculateAverage();return e===0?0:1/e}}const U=class U{constructor(e,r,n,s,i){this.copy=()=>new U(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const o=":";let a=("0"+this.h).slice(-2)+o+("0"+this.m).slice(-2)+o+("0"+this.s).slice(-2)+o+("0"+this.f).slice(-2);return a+="."+(this.field?"1":"2"),a},this.toZipTimeCodeString=()=>{const o=this.copy();return o.f=0,o.s=o.s%2===0?o.s:o.s-1,o.field=0,U.toStr(o)},this.toFrames=o=>{let a=60,c=0;Math.floor(o)==60?(a=60,c=0):Math.floor(o)==59?(a=60,c=4):Math.floor(o)==30?(a=30,c=0):Math.floor(o)==29&&(a=30,c=2);let d=this.h,l=this.m,u=this.s,h=this.f,f=this.field;const m=d*60+l,p=(m-Math.floor(m/10))*c;return d*(a*3600)+l*(a*60)+u*a+(h*2+f)-p},this.addSeconds=o=>{let a=this.copy();if(a.s+=o,a.s>=60){const c=Math.floor(a.s/60);if(a.s=a.s%60,a.m+=c,a.m>=60){const d=Math.floor(a.m/60);a.m=a.m%60,a.h+=d}}return a},this.addFrames=(o,a)=>{let c=this.toFrames(a);return c+=o,U.fromFrames(c,a)},this.subtractFrames=(o,a)=>this.addFrames(-o,a),this.h=e||0,this.m=r||0,this.s=n||0,this.f=s||0,this.field=i||0}static compare(e,r){return e.h!==r.h?e.h<r.h?-1:1:e.m!==r.m?e.m<r.m?-1:1:e.s!==r.s?e.s<r.s?-1:1:e.f!==r.f?e.f<r.f?-1:1:e.field!==r.field?e.field<r.field?-1:1:0}static generateTimecodeRange(e,r,n){const s=[];let i=e;for(;U.compare(i,r)<=0;)s.push(i),i=i.addSeconds(n);return s}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(e){return this.toFrames(e)*1e3/e}};U.calculateCurrentTimeCode=e=>{var u;if(!e.video||!e.clocker||!e.gameParams)throw new Error("OTTPlayer is not initialized");const r=e.video,n=e.clocker,s=n.videoFPScalculator.getFPS(),a=(r.currentTime-n.syncPoint.playerTime)%(60*60*24)*s+n.syncPoint.frame;if(a===0||s===0)throw new Error("Current frame is 0 or fps is 0");const c=U.calculateCurrentOffset(a,(u=e.gameParams)==null?void 0:u.offsets);if(c===void 0)throw new Error("Offset is undefined");let d=Math.floor(a-c);return d<0&&(d+=5178816),d>=5178816&&(d-=5178816),U.fromFrames(d,s)},U.calculateCurrentOffset=(e,r)=>{for(let n=1;n<r.length;n++)if(e<r[n].frame)return r[n-1].offset;return Math.abs(r[r.length-1].offset)},U.fromFrames=(e,r)=>{let n=60,s=0;Math.floor(r)==60?(n=60,s=0):Math.floor(r)==59?(n=60,s=4):Math.floor(r)==30?(n=30,s=0):Math.floor(r)==29&&(n=30,s=2);let i=Math.floor(r*60),o=Math.floor(r*60*10),a=o*6,c=e,d=Math.floor(c/a);c-=d*a;let l=Math.floor(c/o);c-=l*o,c>=n*60&&(c+=s*(Math.floor((c-n*60)/i)+1));let u=Math.floor(c/(n*60));c-=u*(n*60);let h=Math.floor(c/n);c-=h*n;let f=c;u+=l*10;let m=0;return m=f%2,f=Math.floor(f/2),new U(d,u,h,f,m)},U.toStr=e=>{const r="_";let n=("0"+e.h).slice(-2)+r+("0"+e.m).slice(-2)+r+("0"+e.s).slice(-2)+r+("0"+e.f).slice(-2);return e.field&&(n+="_1"),n},U.fromStr=e=>{const n=e.split("_").map(Number);if(n.length==4){const[s,i,o,a]=n;return new U(s,i,o,a,0)}else if(n.length==5){const[s,i,o,a,c]=n;return new U(s,i,o,a,c)}else throw new Error("Invalid timecode format: "+e)},U.fromMetadata=e=>{const r=/^(\d{2}):(\d{2}):(\d{2}):(\d{2})(?:\.(\d))?$/,n=e.timecode.match(r);if(!n)throw new Error("Invalid timecode format: "+e.timecode);const[,s,i,o,a,c]=n,d=Number(s),l=Number(i),u=Number(o),h=Number(a),f=c?Number(c):0;return new U(d,l,u,h,f)};let L=U;const nn=async(t,e)=>{e&&Object.assign(t,e);let r;typeof document>"u"?r=new URL(self.location.href):r=new URL(document.location.href);const n=r.searchParams.get("config");if(n){let s;if(sn(n))s=await(await fetch(n)).json();else try{s=JSON.parse(decodeURIComponent(n))}catch(i){console.error("Failed to parse config parameter as JSON:",i);return}Object.assign(t,s)}},sn=t=>{try{return new URL(t),!0}catch{return!1}},y=(t,e)=>e==="Errors"?!0:!t.debug||!t.debug.on?!1:t.debug[`log${e}`];class on{constructor(e){this.last10=[],this.errorsInProgress=[],this.lastFrameTC=null,this.fps=e}setFPS(e){this.fps=e}timecodeRecieved(e){if(!e)return;const r=L.fromStr(e);if(this.last10.push(r),this.last10.length>10&&this.last10.shift(),this.lastFrameTC){const n=this.incrementInterlaced(this.lastFrameTC);L.compare(r,n)!==0&&(console.warn("Timecode sequence is invalid! Detected at:",e),this.errorsInProgress.push({preTCs:[...this.last10],postTCs:[],framesAfter:0,printed:!1}))}for(const n of this.errorsInProgress)n.printed||(n.postTCs.push(r),n.framesAfter++);for(const n of this.errorsInProgress)if(!n.printed&&n.framesAfter>=10){console.error("Full 20-frame sequence around error:");const s=[...n.preTCs,...n.postTCs];console.error(s.map(i=>L.toStr(i))),n.printed=!0}this.lastFrameTC=r}incrementInterlaced(e){const r=e.copy();return r.field===0?(r.field=1,r):(r.field=0,r.f++,r.f>=30&&(r.f=0,r.s++,r.s>=60&&(r.s=0,r.m++,r.m>=60&&(r.m=0,r.h++))),r)}}class an{constructor(e,r){this.click=async n=>{const s=this.video.getBoundingClientRect(),i=(n.clientX-s.left)/s.width,o=(n.clientY-s.top)/s.height,a={x:i,y:o};this.renderer.postMessage({type:"VIDEO_CLICK",clickData:a})},this.video=e.video,this.logger=e.logger,this.renderer=r,this.renderer.onmessage=n=>{if(n.data.type==="OPEN_URL"){const s=n.data.url;s&&(window.open(s,"_blank"),this.logger.info("didClickAd",{url:s}))}}}}const zt='(function(){"use strict";const T=(e,t)=>t==="Errors"?!0:!e.debug||!e.debug.on?!1:e.debug[`log${t}`],_={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},x=console,z={};Object.keys(_).forEach(e=>{z[e]=x[e]});const pe="Datadog Browser SDK:",w={debug:z.debug.bind(x,pe),log:z.log.bind(x,pe),info:z.info.bind(x,pe),warn:z.warn.bind(x,pe),error:z.error.bind(x,pe)},Xe="https://docs.datadoghq.com",Lt=`${Xe}/real_user_monitoring/browser/troubleshooting`,Ce="More details:";function At(e,t){return(...n)=>{try{return e(...n)}catch(r){w.error(t,r)}}}function ve(e){return e!==0&&Math.random()*100<=e}function Un(e){return Bn(e)&&e>=0&&e<=100}function Bn(e){return typeof e=="number"}const he=1e3,K=60*he,It=60*K,Gn=365*(24*It);function ge(){return new Date().getTime()}function F(){return ge()}function Le(){return performance.now()}function U(){return{relative:Le(),timeStamp:F()}}function jn(){return{relative:0,timeStamp:kt()}}function Hn(e,t){return t-e}function zn(e,t){return e+t}function Kn(e){return e-kt()}let Qe;function kt(){return Qe===void 0&&(Qe=performance.timing.navigationStart),Qe}const D=1024,xt=1024*D,Wn=/[^\\u0000-\\u007F]/;function et(e){return Wn.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function Jn(e){return{...e}}function Dt(e,t){return Object.keys(e).some(n=>e[n]===t)}function me(e){return Object.keys(e).length===0}function B(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let e=_dd_temp_;return delete Object.prototype._dd_temp_,typeof e!="object"&&(typeof self=="object"?e=self:typeof window=="object"?e=window:e={}),e}function re(e,t){const n=B();let r;return n.Zone&&typeof n.Zone.__symbol__=="function"&&(r=e[n.Zone.__symbol__(t)]),r||(r=e[t]),r}let Ae,Mt=!1;function Yn(e){Ae=e}function qn(e){Mt=e}function Zn(e,t,n){const r=n.value;n.value=function(...o){return(Ae?y(r):r).apply(this,o)}}function y(e){return function(){return Se(e,this,arguments)}}function Se(e,t,n){try{return e.apply(t,n)}catch(r){Vn(r)}}function Vn(e){if(tt(e),Ae)try{Ae(e)}catch(t){tt(t)}}function tt(...e){Mt&&w.error("[MONITOR]",...e)}function ye(e,t){return re(B(),"setTimeout")(y(e),t)}function Nt(e){re(B(),"clearTimeout")(e)}function nt(e,t){return re(B(),"setInterval")(y(e),t)}function $t(e){re(B(),"clearInterval")(e)}class O{constructor(t){this.onFirstSubscribe=t,this.observers=[]}subscribe(t){return this.observers.push(t),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(n=>t!==n),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(t){this.observers.forEach(n=>n(t))}}function Pt(...e){return new O(t=>{const n=e.map(r=>r.subscribe(o=>t.notify(o)));return()=>n.forEach(r=>r.unsubscribe())})}function Ft(e,t,n){let r=!1,o,s;return{throttled:(...i)=>{if(r){o=i;return}e(...i),r=!0,s=ye(()=>{o&&e(...o),r=!1,o=void 0},t)},cancel:()=>{Nt(s),r=!1,o=void 0}}}function G(){}function j(e){return e?(parseInt(e,10)^Math.random()*16>>parseInt(e,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,j)}const Ie=/([\\w-]+)\\s*=\\s*([^;]+)/g;function Xn(e,t){for(Ie.lastIndex=0;;){const n=Ie.exec(e);if(n){if(n[1]===t)return n[2]}else break}}function Qn(e){const t=new Map;for(Ie.lastIndex=0;;){const n=Ie.exec(e);if(n)t.set(n[1],n[2]);else break}return t}function er(e,t,n=""){const r=e.charCodeAt(t-1),s=r>=55296&&r<=56319?t+1:t;return e.length<=s?e:`${e.slice(0,s)}${n}`}function tr(){return nr()===0}let ke;function nr(){return ke??(ke=rr())}function rr(e=window){var t;const n=e.navigator.userAgent;return e.chrome||/HeadlessChrome/.test(n)?0:((t=e.navigator.vendor)===null||t===void 0?void 0:t.indexOf("Apple"))===0||/safari/i.test(n)&&!/chrome|android/i.test(n)?1:2}function be(e,t,n=0,r){const o=new Date;o.setTime(o.getTime()+n);const s=`expires=${o.toUTCString()}`,i=r&&r.crossSite?"none":"strict",a=r&&r.domain?`;domain=${r.domain}`:"",c=r&&r.secure?";secure":"",l=r&&r.partitioned?";partitioned":"";document.cookie=`${e}=${t};${s};path=/;samesite=${i}${a}${c}${l}`}function rt(e){return Xn(document.cookie,e)}let ot;function W(e){return ot||(ot=Qn(document.cookie)),ot.get(e)}function Ut(e,t){be(e,"",0,t)}function or(e){if(document.cookie===void 0||document.cookie===null)return!1;try{const t=`dd_cookie_test_${j()}`,n="test";be(t,n,K,e);const r=rt(t)===n;return Ut(t,e),r}catch(t){return w.error(t),!1}}let st;function sr(){if(st===void 0){const e=`dd_site_test_${j()}`,t="test",n=window.location.hostname.split(".");let r=n.pop();for(;n.length&&!rt(e);)r=`${n.pop()}.${r}`,be(e,t,he,{domain:r});Ut(e,{domain:r}),st=r}return st}const oe="_dd_s";function xe(e){return Object.values(e)}function ir(e){return Object.entries(e)}const it=4*It,Bt=15*K,ar=Gn,Ee={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},Gt=/^([a-zA-Z]+)=([a-z0-9-]+)$/,at="&";function cr(e){return!!e&&(e.indexOf(at)!==-1||Gt.test(e))}const ur="1";function J(e,t){const n={isExpired:ur};return t.trackAnonymousUser&&(e!=null&&e.anonymousId?n.anonymousId=e==null?void 0:e.anonymousId:n.anonymousId=j()),n}function De(e){return me(e)}function jt(e){return!De(e)}function Me(e){return e.isExpired!==void 0||!lr(e)}function lr(e){return(e.created===void 0||ge()-Number(e.created)<it)&&(e.expire===void 0||ge()<Number(e.expire))}function Ht(e){e.expire=String(ge()+Bt)}function ct(e){return ir(e).map(([t,n])=>t==="anonymousId"?`aid=${n}`:`${t}=${n}`).join(at)}function zt(e){const t={};return cr(e)&&e.split(at).forEach(n=>{const r=Gt.exec(n);if(r!==null){const[,o,s]=r;o==="aid"?t.anonymousId=s:t[o]=s}}),t}const dr="_dd",fr="_dd_r",pr="_dd_l",hr="rum",gr="logs";function mr(e){if(!W(oe)){const n=W(dr),r=W(fr),o=W(pr),s={};n&&(s.id=n),o&&/^[01]$/.test(o)&&(s[gr]=o),r&&/^[012]$/.test(r)&&(s[hr]=r),jt(s)&&(Ht(s),e.persistSession(s))}}function Kt(e){const t=Tr(e);return or(t)?{type:Ee.COOKIE,cookieOptions:t}:void 0}function Sr(e,t){const n={isLockEnabled:tr(),persistSession:yr(t),retrieveSession:Er,expireSession:r=>br(t,r,e)};return mr(n),n}function yr(e){return t=>{be(oe,ct(t),Bt,e)}}function br(e,t,n){const r=J(t,n);be(oe,ct(r),n.trackAnonymousUser?ar:it,e)}function Er(){const e=rt(oe);return zt(e)}function Tr(e){const t={};return t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=sr()),t}const _r="_dd_test_";function Wt(){try{const e=j(),t=`${_r}${e}`;localStorage.setItem(t,e);const n=localStorage.getItem(t);return localStorage.removeItem(t),e===n?{type:Ee.LOCAL_STORAGE}:void 0}catch{return}}function wr(e){return{isLockEnabled:!1,persistSession:Jt,retrieveSession:Or,expireSession:t=>Rr(t,e)}}function Jt(e){localStorage.setItem(oe,ct(e))}function Or(){const e=localStorage.getItem(oe);return zt(e)}function Rr(e,t){Jt(J(e,t))}const Cr=10,vr=100,Yt=[];let Ne;function Y(e,t,n=0){var r;const{isLockEnabled:o,persistSession:s,expireSession:i}=t,a=f=>s({...f,lock:l}),c=()=>{const f=t.retrieveSession(),h=f.lock;return f.lock&&delete f.lock,{session:f,lock:h}};if(Ne||(Ne=e),e!==Ne){Yt.push(e);return}if(o&&n>=vr){qt(t);return}let l,u=c();if(o){if(u.lock){$e(e,t,n);return}if(l=j(),a(u.session),u=c(),u.lock!==l){$e(e,t,n);return}}let d=e.process(u.session);if(o&&(u=c(),u.lock!==l)){$e(e,t,n);return}if(d&&(Me(d)?i(d):(Ht(d),o?a(d):s(d))),o&&!(d&&Me(d))){if(u=c(),u.lock!==l){$e(e,t,n);return}s(u.session),d=u.session}(r=e.after)===null||r===void 0||r.call(e,d||u.session),qt(t)}function $e(e,t,n){ye(()=>{Y(e,t,n+1)},Cr)}function qt(e){Ne=void 0;const t=Yt.shift();t&&Y(t,e)}const Zt=he;function Lr(e){switch(e.sessionPersistence){case Ee.COOKIE:return Kt(e);case Ee.LOCAL_STORAGE:return Wt();case void 0:{let t=Kt(e);return!t&&e.allowFallbackToLocalStorage&&(t=Wt()),t}default:w.error(`Invalid session persistence \'${String(e.sessionPersistence)}\'`)}}function Ar(e,t,n,r){const o=new O,s=new O,i=new O,a=e.type===Ee.COOKIE?Sr(t,e.cookieOptions):wr(t),{expireSession:c}=a,l=nt(g,Zt);let u;E();const{throttled:d,cancel:f}=Ft(()=>{Y({process:S=>{if(De(S))return;const fe=b(S);return de(fe),fe},after:S=>{jt(S)&&!k()&&Mi(S),u=S}},a)},Zt);function h(){Y({process:S=>k()?b(S):void 0},a)}function g(){Y({process:S=>Me(S)?J(S,t):void 0,after:b},a)}function b(S){return Me(S)&&(S=J(S,t)),k()&&(te(S)?ne():(i.notify({previousState:u,newState:S}),u=S)),S}function E(){Y({process:S=>{if(De(S))return J(S,t)},after:S=>{u=S}},a)}function de(S){if(De(S))return!1;const{trackingType:fe,isTracked:$i}=r(S[n]);S[n]=fe,delete S.isExpired,$i&&!S.id&&(S.id=j(),S.created=String(ge()))}function k(){return u[n]!==void 0}function te(S){return u.id!==S.id||u[n]!==S[n]}function ne(){u=J(u,t),s.notify()}function Mi(S){u=S,o.notify()}function Ni(S){Y({process:fe=>({...fe,...S}),after:b},a)}return{expandOrRenewSession:d,expandSession:h,getSession:()=>u,renewObservable:o,expireObservable:s,sessionStateUpdateObservable:i,restartSession:E,expire:()=>{f(),c(u),b(J(u,t))},stop:()=>{$t(l)},updateSessionState:Ni}}const ut={GRANTED:"granted",NOT_GRANTED:"not-granted"};function Ir(e){const t=new O;return{tryToInit(n){e||(e=n)},update(n){e=n,t.notify()},isGranted(){return e===ut.GRANTED},observable:t}}function q(e,t,n){if(typeof e!="object"||e===null)return JSON.stringify(e);const r=se(Object.prototype),o=se(Array.prototype),s=se(Object.getPrototypeOf(e)),i=se(e);try{return JSON.stringify(e,t,n)}catch{return"<error: unable to serialize object>"}finally{r(),o(),s(),i()}}function se(e){const t=e,n=t.toJSON;return n?(delete t.toJSON,()=>{t.toJSON=n}):G}function lt(e){return kr(e,location.href).href}function kr(e,t){const n=xr();if(n)try{return t!==void 0?new n(e,t):new n(e)}catch(s){throw new Error(`Failed to construct URL: ${String(s)} ${q({url:e,base:t})}`)}if(t===void 0&&!/:/.test(e))throw new Error(`Invalid URL: \'${e}\'`);let r=document;const o=r.createElement("a");if(t!==void 0){r=document.implementation.createHTMLDocument("");const s=r.createElement("base");s.href=t,r.head.appendChild(s),r.body.appendChild(o)}return o.href=e,o}const Vt=URL;let Pe;function xr(){if(Pe===void 0)try{Pe=new Vt("http://test/path").href==="http://test/path"}catch{Pe=!1}return Pe?Vt:void 0}const Dr="datad0g.com",Mr="dd0g-gov.com",ie="datadoghq.com",Nr="ddog-gov.com",$r="pci.browser-intake-datadoghq.com",Pr=["ddsource","ddtags"];function Te(e,t,n){const r=Fr(e,t);return{build(o,s){const i=Br(e,t,n,o,s);return r(i)},urlPrefix:r(""),trackType:t}}function Fr(e,t){const n=`/api/v2/${t}`,r=e.proxy;if(typeof r=="string"){const s=lt(r);return i=>`${s}?ddforward=${encodeURIComponent(`${n}?${i}`)}`}if(typeof r=="function")return s=>r({path:n,parameters:s});const o=Ur(t,e);return s=>`https://${o}${n}?${s}`}function Ur(e,t){const{site:n=ie,internalAnalyticsSubdomain:r}=t;if(e==="logs"&&t.usePciIntake&&n===ie)return $r;if(r&&n===ie)return`${r}.${ie}`;if(n===Mr)return`http-intake.logs.${n}`;const o=n.split("."),s=o.pop();return`browser-intake-${o.join("-")}.${s}`}function Br({clientToken:e,internalAnalyticsSubdomain:t},n,r,o,{retry:s,encoding:i}){const a=["sdk_version:6.5.0",`api:${o}`].concat(r);s&&a.push(`retry_count:${s.count}`,`retry_after:${s.lastFailureStatus}`);const c=["ddsource=browser",`ddtags=${encodeURIComponent(a.join(","))}`,`dd-api-key=${e}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${j()}`];return i&&c.push(`dd-evp-encoding=${i}`),n==="rum"&&c.push(`batch_time=${F()}`),t&&c.reverse(),c.join("&")}const Gr=200;function jr(e){const{env:t,service:n,version:r,datacenter:o}=e,s=[];return t&&s.push(Fe("env",t)),n&&s.push(Fe("service",n)),r&&s.push(Fe("version",r)),o&&s.push(Fe("datacenter",o)),s}function Fe(e,t){const n=Gr-e.length-1;(t.length>n||Hr(t))&&w.warn(`${e} value doesn\'t meet tag requirements and will be sanitized. ${Ce} ${Xe}/getting_started/tagging/#defining-tags`);const r=t.replace(/,/g,"_");return`${e}:${r}`}function Hr(e){return zr()?new RegExp("[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]","u").test(e):!1}function zr(){try{return new RegExp("[\\\\p{Ll}]","u"),!0}catch{return!1}}function Kr(e){const t=e.site||ie,n=jr(e),r=Wr(e,n);return{replica:Jr(e,n),site:t,...r}}function Wr(e,t){return{logsEndpointBuilder:Te(e,"logs",t),rumEndpointBuilder:Te(e,"rum",t),sessionReplayEndpointBuilder:Te(e,"replay",t)}}function Jr(e,t){if(!e.replica)return;const n={...e,site:ie,clientToken:e.replica.clientToken},r={logsEndpointBuilder:Te(n,"logs",t),rumEndpointBuilder:Te(n,"rum",t)};return{applicationId:e.replica.applicationId,...r}}function Yr(e){return Pr.every(t=>e.includes(t))}function dt(e,t){return e!=null&&typeof e!="string"?(w.error(`${t} must be defined as a string`),!1):!0}function qr(e){return e&&typeof e=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(e)?(w.error(`Site should be a valid Datadog site. ${Ce} ${Xe}/getting_started/site/.`),!1):!0}function Ue(e,t){return e!==void 0&&!Un(e)?(w.error(`${t} Sample Rate should be a number between 0 and 100`),!1):!0}function Zr(e){var t,n,r,o,s,i;if(!e||!e.clientToken){w.error("Client Token is not configured, we will not send any data.");return}if(!(!qr(e.site)||!Ue(e.sessionSampleRate,"Session")||!Ue(e.telemetrySampleRate,"Telemetry")||!Ue(e.telemetryConfigurationSampleRate,"Telemetry Configuration")||!Ue(e.telemetryUsageSampleRate,"Telemetry Usage")||!dt(e.version,"Version")||!dt(e.env,"Env")||!dt(e.service,"Service"))){if(e.trackingConsent!==void 0&&!Dt(ut,e.trackingConsent)){w.error(\'Tracking Consent should be either "granted" or "not-granted"\');return}return{beforeSend:e.beforeSend&&At(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:Lr(e),sessionSampleRate:(t=e.sessionSampleRate)!==null&&t!==void 0?t:100,telemetrySampleRate:(n=e.telemetrySampleRate)!==null&&n!==void 0?n:20,telemetryConfigurationSampleRate:(r=e.telemetryConfigurationSampleRate)!==null&&r!==void 0?r:5,telemetryUsageSampleRate:(o=e.telemetryUsageSampleRate)!==null&&o!==void 0?o:5,service:e.service||void 0,silentMultipleInit:!!e.silentMultipleInit,allowUntrustedEvents:!!e.allowUntrustedEvents,trackingConsent:(s=e.trackingConsent)!==null&&s!==void 0?s:ut.GRANTED,trackAnonymousUser:(i=e.trackAnonymousUser)!==null&&i!==void 0?i:!0,storeContextsAcrossPages:!!e.storeContextsAcrossPages,batchBytesLimit:16*D,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*he,batchMessagesLimit:50,messageBytesLimit:256*D,...Kr(e)}}}function Vr(e){return{session_sample_rate:e.sessionSampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:e.telemetryUsageSampleRate,use_before_send:!!e.beforeSend,use_partitioned_cross_site_session_cookie:e.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:!!e.proxy,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_anonymous_user:e.trackAnonymousUser,session_persistence:e.sessionPersistence,allow_fallback_to_local_storage:!!e.allowFallbackToLocalStorage,store_contexts_across_pages:!!e.storeContextsAcrossPages,allow_untrusted_events:!!e.allowUntrustedEvents,tracking_consent:e.trackingConsent}}var ft;(function(e){e.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",e.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(ft||(ft={}));const Xt=new Set;function Xr(e){Array.isArray(e)&&Qr(e.filter(t=>Dt(ft,t)))}function Qr(e){e.forEach(t=>{Xt.add(t)})}function eo(){return Xt}const _e="?";function M(e){const t=[];let n=pt(e,"stack");const r=String(e);return n&&n.startsWith(r)&&(n=n.slice(r.length)),n&&n.split(`\n`).forEach(o=>{const s=ro(o)||so(o)||ao(o)||lo(o);s&&(!s.func&&s.line&&(s.func=_e),t.push(s))}),{message:pt(e,"message"),name:pt(e,"name"),stack:t}}const Qt="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\\\w+\\\\.|\\\\/).*?)",ae="(?::(\\\\d+))",to=new RegExp(`^\\\\s*at (.*?) ?\\\\(${Qt}${ae}?${ae}?\\\\)?\\\\s*$`,"i"),no=new RegExp(`\\\\((\\\\S*)${ae}${ae}\\\\)`);function ro(e){const t=to.exec(e);if(!t)return;const n=t[2]&&t[2].indexOf("native")===0,r=t[2]&&t[2].indexOf("eval")===0,o=no.exec(t[2]);return r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]),{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||_e,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}const oo=new RegExp(`^\\\\s*at ?${Qt}${ae}?${ae}??\\\\s*$`,"i");function so(e){const t=oo.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:_e,line:t[2]?+t[2]:void 0,url:t[1]}}const io=/^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;function ao(e){const t=io.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||_e,line:+t[3],url:t[2]}}const co=/^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,uo=/(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;function lo(e){const t=co.exec(e);if(!t)return;const n=t[3]&&t[3].indexOf(" > eval")>-1,r=uo.exec(t[3]);return n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0),{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||_e,line:t[4]?+t[4]:void 0,url:t[3]}}function pt(e,t){if(typeof e!="object"||!e||!(t in e))return;const n=e[t];return typeof n=="string"?n:void 0}function fo(e,t,n,r){const o=[{url:t,column:r,line:n}],{name:s,message:i}=ho(e);return{name:s,message:i,stack:o}}const po=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;function ho(e){let t,n;return{}.toString.call(e)==="[object String]"&&([,t,n]=po.exec(e)),{name:t,message:n}}function Be(e){const n=new Error(e);n.name="HandlingStack";let r;return Se(()=>{const o=M(n);o.stack=o.stack.slice(2),r=Z(o)}),r}function Z(e){let t=en(e);return e.stack.forEach(n=>{const r=n.func==="?"?"<anonymous>":n.func,o=n.args&&n.args.length>0?`(${n.args.join(", ")})`:"",s=n.line?`:${n.line}`:"",i=n.line&&n.column?`:${n.column}`:"";t+=`\n at ${r}${o} @ ${n.url}${s}${i}`}),t}function en(e){return`${e.name||"Error"}: ${e.message}`}function V(e,t,n,{computeHandlingStack:r}={}){let o=e[t];if(typeof o!="function")if(t in e&&t.startsWith("on"))o=G;else return{stop:G};let s=!1;const i=function(){if(s)return o.apply(this,arguments);const a=Array.from(arguments);let c;Se(n,null,[{target:this,parameters:a,onPostCall:u=>{c=u},handlingStack:r?Be("instrumented method"):void 0}]);const l=o.apply(this,a);return c&&Se(c,null,[l]),l};return e[t]=i,{stop:()=>{s=!0,e[t]===i&&(e[t]=o)}}}const go=220*D,mo="$",So=3;function N(e,t=go){const n=se(Object.prototype),r=se(Array.prototype),o=[],s=new WeakMap,i=ht(e,mo,void 0,o,s),a=JSON.stringify(i);let c=a?a.length:0;if(c>t){mt(t,"discarded",e);return}for(;o.length>0&&c<t;){const l=o.shift();let u=0;if(Array.isArray(l.source))for(let d=0;d<l.source.length;d++){const f=ht(l.source[d],l.path,d,o,s);if(f!==void 0?c+=JSON.stringify(f).length:c+=4,c+=u,u=1,c>t){mt(t,"truncated",e);break}l.target[d]=f}else for(const d in l.source)if(Object.prototype.hasOwnProperty.call(l.source,d)){const f=ht(l.source[d],l.path,d,o,s);if(f!==void 0&&(c+=JSON.stringify(f).length+u+d.length+So,u=1),c>t){mt(t,"truncated",e);break}l.target[d]=f}}return n(),r(),i}function ht(e,t,n,r,o){const s=Eo(e);if(!s||typeof s!="object")return yo(s);const i=gt(s);if(i!=="[Object]"&&i!=="[Array]"&&i!=="[Error]")return i;const a=e;if(o.has(a))return`[Reference seen at ${o.get(a)}]`;const c=n!==void 0?`${t}.${n}`:t,l=Array.isArray(s)?[]:{};return o.set(a,c),r.push({source:s,target:l,path:c}),l}function yo(e){return typeof e=="bigint"?`[BigInt] ${e.toString()}`:typeof e=="function"?`[Function] ${e.name||"unknown"}`:typeof e=="symbol"?`[Symbol] ${e.description||e.toString()}`:e}function gt(e){try{if(e instanceof Event)return bo(e);if(e instanceof RegExp)return`[RegExp] ${e.toString()}`;const n=Object.prototype.toString.call(e).match(/\\[object (.*)\\]/);if(n&&n[1])return`[${n[1]}]`}catch{}return"[Unserializable]"}function bo(e){return{type:e.type,isTrusted:e.isTrusted,currentTarget:e.currentTarget?gt(e.currentTarget):null,target:e.target?gt(e.target):null}}function Eo(e){const t=e;if(t&&typeof t.toJSON=="function")try{return t.toJSON()}catch{}return e}function mt(e,t,n){w.warn(`The data provided has been ${t} as it is over the limit of ${e} characters:`,n)}const tn="No stack, consider using an instance of Error";function nn({stackTrace:e,originalError:t,handlingStack:n,componentStack:r,startClocks:o,nonErrorPrefix:s,source:i,handling:a}){const c=H(t),l=To(e,c,s,t),u=_o(c,e)?Z(e):tn,d=c?sn(t,i):void 0,f=e?e.name:void 0,h=rn(t),g=on(t);return{startClocks:o,source:i,handling:a,handlingStack:n,componentStack:r,originalError:t,type:f,message:l,stack:u,causes:d,fingerprint:h,context:g}}function To(e,t,n,r){return e!=null&&e.message&&(e!=null&&e.name)?e.message:t?"Empty message":`${n} ${q(N(r))}`}function _o(e,t){return t===void 0?!1:e?!0:t.stack.length>0&&(t.stack.length>1||t.stack[0].url!==void 0)}function rn(e){return H(e)&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function on(e){if(e!==null&&typeof e=="object"&&"dd_context"in e)return e.dd_context}function wo(e){var t;return(t=/@ (.+)/.exec(e))===null||t===void 0?void 0:t[1]}function H(e){return e instanceof Error||Object.prototype.toString.call(e)==="[object Error]"}function sn(e,t){let n=e;const r=[];for(;H(n==null?void 0:n.cause)&&r.length<10;){const o=M(n.cause);r.push({message:n.cause.message,source:t,type:o==null?void 0:o.name,stack:Z(o)}),n=n.cause}return r.length?r:void 0}const v={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function Oo(e){const t=(o,s)=>{const i=nn({stackTrace:o,originalError:s,startClocks:U(),nonErrorPrefix:"Uncaught",source:v.SOURCE,handling:"unhandled"});e.notify(i)},{stop:n}=Ro(t),{stop:r}=Co(t);return{stop:()=>{n(),r()}}}function Ro(e){return V(window,"onerror",({parameters:[t,n,r,o,s]})=>{let i;H(s)?i=M(s):i=fo(t,n,r,o),e(i,s??t)})}function Co(e){return V(window,"onunhandledrejection",({parameters:[t]})=>{const n=t.reason||"Empty reason",r=M(n);e(r,n)})}function vo(e){const t={version:"6.5.0",onReady(n){n()},...e};return Object.defineProperty(t,"_setDebug",{get(){return qn},enumerable:!1}),t}function Lo(e,t,n){const r=e[t];r&&!r.q&&r.version&&w.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),e[t]=n,r&&r.q&&r.q.forEach(o=>At(o,"onReady callback threw an error:")())}function an(e,t){t.silentMultipleInit||w.error(`${e} is already initialized.`)}function X(e,t,n,r,o){return St(e,t,[n],r,o)}function St(e,t,n,r,{once:o,capture:s,passive:i}={}){const a=y(f=>{!f.isTrusted&&!f.__ddIsTrusted&&!e.allowUntrustedEvents||(o&&d(),r(f))}),c=i?{capture:s,passive:i}:s,l=window.EventTarget&&t instanceof EventTarget?window.EventTarget.prototype:t,u=re(l,"addEventListener");n.forEach(f=>u.call(t,f,a,c));function d(){const f=re(l,"removeEventListener");n.forEach(h=>f.call(t,h,a,c))}return{stop:d}}const Ge={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function Ao(e,t){const n=[];t.includes(Ge.cspViolation)&&n.push(ko(e));const r=t.filter(o=>o!==Ge.cspViolation);return r.length&&n.push(Io(r)),Pt(...n)}function Io(e){return new O(t=>{if(!window.ReportingObserver)return;const n=y((o,s)=>o.forEach(i=>t.notify(xo(i)))),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),()=>{r.disconnect()}})}function ko(e){return new O(t=>{const{stop:n}=X(e,document,"securitypolicyviolation",r=>{t.notify(Do(r))});return n})}function xo(e){const{type:t,body:n}=e;return cn({type:n.id,message:`${t}: ${n.message}`,originalError:e,stack:un(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)})}function Do(e){const t=`\'${e.blockedURI}\' blocked by \'${e.effectiveDirective}\' directive`;return cn({type:e.effectiveDirective,message:`${Ge.cspViolation}: ${t}`,originalError:e,csp:{disposition:e.disposition},stack:un(e.effectiveDirective,e.originalPolicy?`${t} of the policy "${er(e.originalPolicy,100,"...")}"`:"no policy",e.sourceFile,e.lineNumber,e.columnNumber)})}function cn(e){return{startClocks:U(),source:v.REPORT,handling:"unhandled",...e}}function un(e,t,n,r,o){return n?Z({name:e,message:t,stack:[{func:"?",url:n,line:r??void 0,column:o??void 0}]}):void 0}function ln(e,t){const n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}function dn(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function je(e,t,n=Mo()){if(t===void 0)return e;if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,o)}if(n.hasAlreadyBeenSeen(t))return;if(Array.isArray(t)){const o=Array.isArray(e)?e:[];for(let s=0;s<t.length;++s)o[s]=je(o[s],t[s],n);return o}const r=dn(e)==="object"?e:{};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=je(r[o],t[o],n));return r}function fn(e){return je(void 0,e)}function ce(...e){let t;for(const n of e)n!=null&&(t=je(t,n));return t}function Mo(){if(typeof WeakSet<"u"){const t=new WeakSet;return{hasAlreadyBeenSeen(n){const r=t.has(n);return r||t.add(n),r}}}const e=[];return{hasAlreadyBeenSeen(t){const n=e.indexOf(t)>=0;return n||e.push(t),n}}}function No(){var e;const t=window.navigator;return{status:t.onLine?"connected":"not_connected",interfaces:t.connection&&t.connection.type?[t.connection.type]:void 0,effective_type:(e=t.connection)===null||e===void 0?void 0:e.effectiveType}}function $o(e){const t=new Set;return e.forEach(n=>t.add(n)),Array.from(t)}function pn(e,t){const n=e.indexOf(t);n>=0&&e.splice(n,1)}const Po=500;function hn(){const e=[];return{add:o=>{e.push(o)>Po&&e.splice(0,1)},remove:o=>{pn(e,o)},drain:o=>{e.forEach(s=>s(o)),e.length=0}}}const Q={log:"log",configuration:"configuration",usage:"usage"},Fo=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],Uo=[Nr];let gn=hn(),ue=e=>{gn.add(()=>ue(e))};function Bo(e,t){let n;const r=new O,o=new Set,s=!Uo.includes(t.site)&&ve(t.telemetrySampleRate),i={[Q.log]:s,[Q.configuration]:s&&ve(t.telemetryConfigurationSampleRate),[Q.usage]:s&&ve(t.telemetryUsageSampleRate)},a=Go();ue=l=>{const u=q(l);if(i[l.type]&&o.size<t.maxTelemetryEventsPerPage&&!o.has(u)){const d=c(e,l,a);r.notify(d),ln("telemetry",d),o.add(u)}},Yn(Sn);function c(l,u,d){return ce({type:"telemetry",date:F(),service:l,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:ce(u,{runtime_env:d,connectivity:No(),sdk_setup:"npm"}),experimental_features:Array.from(eo())},n!==void 0?n():{})}return{setContextProvider:l=>{n=l},observable:r,enabled:s}}function Go(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function jo(){gn.drain()}function Ho(e){return e.site===Dr}function mn(e,t){tt(_.debug,e,t),ue({type:Q.log,message:e,status:"debug",...t})}function Sn(e,t){ue({type:Q.log,status:"error",...Wo(e),...t})}function zo(e){ue({type:Q.configuration,configuration:e})}function Ko(e){ue({type:Q.usage,usage:e})}function Wo(e){if(H(e)){const t=M(e);return{error:{kind:t.name,stack:Z(Jo(t))},message:t.message}}return{error:{stack:tn},message:`Uncaught ${q(e)}`}}function Jo(e){return e.stack=e.stack.filter(t=>!t.url||Fo.some(n=>t.url.startsWith(n))),e}const we=1/0,Yo=K;let Oe=null;const He=new Set;function qo(){He.forEach(e=>e())}function Zo({expireDelay:e,maxEntries:t}){let n=[];const r=[];Oe||(Oe=nt(()=>qo(),Yo));const o=()=>{const h=Le()-e;for(;n.length>0&&n[n.length-1].endTime<h;){const g=n.pop();g&&r.push(g.startTime)}};He.add(o);function s(h,g){const b={value:h,startTime:g,endTime:we,remove:()=>{pn(n,b)},close:E=>{b.endTime=E}};return t&&n.length>=t&&n.pop(),n.unshift(b),b}function i(h=we,g={returnInactive:!1}){for(const b of n)if(b.startTime<=h){if(g.returnInactive||h<=b.endTime)return b.value;break}}function a(h){const g=n[0];g&&g.endTime===we&&g.close(h)}function c(h=we,g=0){const b=zn(h,g);return n.filter(E=>E.startTime<=b&&h<=E.endTime).map(E=>E.value)}function l(){return n.map(({startTime:h,endTime:g,value:b})=>({startTime:h,endTime:g===we?"Infinity":g,value:b}))}function u(){return r}function d(){n=[]}function f(){He.delete(o),He.size===0&&Oe&&($t(Oe),Oe=null)}return{add:s,find:i,closeActive:a,findAll:c,reset:d,stop:f,getAllEntries:l,getDeletedEntries:u}}const Vo=K,Xo=it;function Qo(e,t,n,r){const o=new O,s=new O,i=Ar(e.sessionStoreStrategyType,e,t,n),a=Zo({expireDelay:Xo});i.renewObservable.subscribe(()=>{a.add(c(),Le()),o.notify()}),i.expireObservable.subscribe(()=>{s.notify(),a.closeActive(Le())}),i.expandOrRenewSession(),a.add(c(),jn().relative),r.observable.subscribe(()=>{r.isGranted()?i.expandOrRenewSession():i.expire()}),es(e,()=>{r.isGranted()&&i.expandOrRenewSession()}),ts(e,()=>i.expandSession()),ns(e,()=>i.restartSession());function c(){return{id:i.getSession().id,trackingType:i.getSession()[t],isReplayForced:!!i.getSession().forcedReplay,anonymousId:i.getSession().anonymousId}}return{findSession:(l,u)=>a.find(l,u),renewObservable:o,expireObservable:s,sessionStateUpdateObservable:i.sessionStateUpdateObservable,expire:i.expire,updateSessionState:i.updateSessionState}}function es(e,t){St(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function ts(e,t){const n=()=>{document.visibilityState==="visible"&&t()};X(e,document,"visibilitychange",n),nt(n,Vo)}function ns(e,t){X(e,window,"resume",t,{capture:!0})}function yn(e){return e>=500}function rs(e){try{return e.clone()}catch{return}}const os=80*D,ss=32,bn=3*xt,is=K,En=he;function Tn(e,t,n,r,o){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?wn(e,t,n,{onSuccess:()=>On(0,t,n,r,o),onFailure:()=>{t.queuedPayloads.enqueue(e),_n(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function _n(e,t,n,r){e.transportStatus===2&&ye(()=>{const o=e.queuedPayloads.first();wn(o,e,t,{onSuccess:()=>{e.queuedPayloads.dequeue(),e.currentBackoffTime=En,On(1,e,t,n,r)},onFailure:()=>{e.currentBackoffTime=Math.min(is,e.currentBackoffTime*2),_n(e,t,n,r)}})},e.currentBackoffTime)}function wn(e,t,n,{onSuccess:r,onFailure:o}){t.bandwidthMonitor.add(e),n(e,s=>{t.bandwidthMonitor.remove(e),as(s)?(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:s.status},o()):(t.transportStatus=0,r())})}function On(e,t,n,r,o){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:`Reached max ${r} events size queued for upload: ${bn/xt}MiB`,source:v.AGENT,startClocks:U()}),t.queueFullReported=!0);const s=t.queuedPayloads;for(t.queuedPayloads=Rn();s.size()>0;)Tn(s.dequeue(),t,n,r,o)}function as(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||yn(e.status))}function cs(){return{transportStatus:0,currentBackoffTime:En,bandwidthMonitor:us(),queuedPayloads:Rn(),queueFullReported:!1}}function Rn(){const e=[];return{bytesCount:0,enqueue(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first(){return e[0]},dequeue(){const t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size(){return e.length},isFull(){return this.bytesCount>=bn}}}function us(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=os&&this.ongoingRequestCount<ss},add(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}}}function ls(e,t,n){const r=cs(),o=(s,i)=>ps(e,t,s,i);return{send:s=>{Tn(s,r,o,e.trackType,n)},sendOnExit:s=>{ds(e,t,s)}}}function ds(e,t,n){if(!!navigator.sendBeacon&&n.bytesCount<t)try{const s=e.build("beacon",n);if(navigator.sendBeacon(s,n.data))return}catch(s){fs(s)}const o=e.build("xhr",n);yt(o,n.data)}let Cn=!1;function fs(e){Cn||(Cn=!0,Sn(e))}function ps(e,t,n,r){if(hs()&&n.bytesCount<t){const s=e.build("fetch",n);fetch(s,{method:"POST",body:n.data,keepalive:!0,mode:"cors"}).then(y(i=>r==null?void 0:r({status:i.status,type:i.type})),y(()=>{const i=e.build("xhr",n);yt(i,n.data,r)}))}else{const s=e.build("xhr",n);yt(s,n.data,r)}}function hs(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function yt(e,t,n){const r=new XMLHttpRequest;r.open("POST",e,!0),t instanceof Blob&&r.setRequestHeader("Content-Type",t.type),X({allowUntrustedEvents:!0},r,"loadend",()=>{n==null||n({status:r.status})},{once:!0}),r.send(t)}function bt(){const e=gs();if(e)return{getCapabilities(){var t;return JSON.parse(((t=e.getCapabilities)===null||t===void 0?void 0:t.call(e))||"[]")},getPrivacyLevel(){var t;return(t=e.getPrivacyLevel)===null||t===void 0?void 0:t.call(e)},getAllowedWebViewHosts(){return JSON.parse(e.getAllowedWebViewHosts())},send(t,n,r){const o=r?{id:r}:void 0;e.send(JSON.stringify({eventType:t,event:n,view:o}))}}}function ze(e){var t;e===void 0&&(e=(t=B().location)===null||t===void 0?void 0:t.hostname);const n=bt();return!!n&&n.getAllowedWebViewHosts().some(r=>e===r||e.endsWith(`.${r}`))}function gs(){return B().DatadogEventBridge}const Ke={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function ms(e){return new O(t=>{const{stop:n}=St(e,window,["visibilitychange","freeze"],o=>{o.type==="visibilitychange"&&document.visibilityState==="hidden"?t.notify({reason:Ke.HIDDEN}):o.type==="freeze"&&t.notify({reason:Ke.FROZEN})},{capture:!0}),r=X(e,window,"beforeunload",()=>{t.notify({reason:Ke.UNLOADING})}).stop;return()=>{n(),r()}})}function Ss(e){return xe(Ke).includes(e)}function ys({encoder:e,request:t,flushController:n,messageBytesLimit:r}){let o={};const s=n.flushObservable.subscribe(d=>u(d));function i(d,f,h){n.notifyBeforeAddMessage(f),h!==void 0?(o[h]=d,n.notifyAfterAddMessage()):e.write(e.isEmpty?d:`\n${d}`,g=>{n.notifyAfterAddMessage(g-f)})}function a(d){return d!==void 0&&o[d]!==void 0}function c(d){const f=o[d];delete o[d];const h=e.estimateEncodedBytesCount(f);n.notifyAfterRemoveMessage(h)}function l(d,f){const h=q(d),g=e.estimateEncodedBytesCount(h);if(g>=r){w.warn(`Discarded a message whose size was bigger than the maximum allowed size ${r}KB. ${Ce} ${Lt}/#technical-limitations`);return}a(f)&&c(f),i(h,g,f)}function u(d){const f=xe(o).join(`\n`);o={};const h=Ss(d.reason),g=h?t.sendOnExit:t.send;if(h&&e.isAsync){const b=e.finishSync();b.outputBytesCount&&g(vn(b));const E=[b.pendingData,f].filter(Boolean).join(`\n`);E&&g({data:E,bytesCount:et(E)})}else f&&e.write(e.isEmpty?f:`\n${f}`),e.finish(b=>{g(vn(b))})}return{flushController:n,add:l,upsert:l,stop:s.unsubscribe}}function vn(e){let t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}function bs({messagesLimit:e,bytesLimit:t,durationLimit:n,pageExitObservable:r,sessionExpireObservable:o}){const s=r.subscribe(g=>u(g.reason)),i=o.subscribe(()=>u("session_expire")),a=new O(()=>()=>{s.unsubscribe(),i.unsubscribe()});let c=0,l=0;function u(g){if(l===0)return;const b=l,E=c;l=0,c=0,h(),a.notify({reason:g,messagesCount:b,bytesCount:E})}let d;function f(){d===void 0&&(d=ye(()=>{u("duration_limit")},n))}function h(){Nt(d),d=void 0}return{flushObservable:a,get messagesCount(){return l},notifyBeforeAddMessage(g){c+g>=t&&u("bytes_limit"),l+=1,c+=g,f()},notifyAfterAddMessage(g=0){c+=g,l>=e?u("messages_limit"):c>=t&&u("bytes_limit")},notifyAfterRemoveMessage(g){c-=g,l-=1,l===0&&h()}}}function Ln(e,t,n,r,o,s,i=ys){const a=l(e,t),c=n&&l(e,n);function l(u,{endpoint:d,encoder:f}){return i({encoder:f,request:ls(d,u.batchBytesLimit,r),flushController:bs({messagesLimit:u.batchMessagesLimit,bytesLimit:u.batchBytesLimit,durationLimit:u.flushTimeout,pageExitObservable:o,sessionExpireObservable:s}),messageBytesLimit:u.messageBytesLimit})}return{flushObservable:a.flushController.flushObservable,add(u,d=!0){a.add(u),c&&d&&c.add(n.transformMessage?n.transformMessage(u):u)},upsert:(u,d)=>{a.upsert(u,d),c&&c.upsert(n.transformMessage?n.transformMessage(u):u,d)},stop:()=>{a.stop(),c&&c.stop()}}}function We(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(n,r){const o=et(n);t+=o,e+=n,r&&r(o)},finish(n){n(this.finishSync())},finishSync(){const n={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,n},estimateEncodedBytesCount(n){return n.length}}}class Es{constructor(){this.callbacks={}}notify(t,n){const r=this.callbacks[t];r&&r.forEach(o=>o(n))}subscribe(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),{unsubscribe:()=>{this.callbacks[t]=this.callbacks[t].filter(r=>n!==r)}}}}function Ts(e,t,n){let r=0,o=!1;return{isLimitReached(){if(r===0&&ye(()=>{r=0},K),r+=1,r<=t||o)return o=!1,!1;if(r===t+1){o=!0;try{n({message:`Reached max number of ${e}s by minute: ${t}`,source:v.AGENT,startClocks:U()})}finally{o=!1}}return!0}}}let Et;const Tt=new WeakMap;function _s(e){return Et||(Et=ws(e)),Et}function ws(e){return new O(t=>{const{stop:n}=V(XMLHttpRequest.prototype,"open",Os),{stop:r}=V(XMLHttpRequest.prototype,"send",s=>{Rs(s,e,t)},{computeHandlingStack:!0}),{stop:o}=V(XMLHttpRequest.prototype,"abort",Cs);return()=>{n(),r(),o()}})}function Os({target:e,parameters:[t,n]}){Tt.set(e,{state:"open",method:String(t).toUpperCase(),url:lt(String(n))})}function Rs({target:e,handlingStack:t},n,r){const o=Tt.get(e);if(!o)return;const s=o;s.state="start",s.startClocks=U(),s.isAborted=!1,s.xhr=e,s.handlingStack=t;let i=!1;const{stop:a}=V(e,"onreadystatechange",()=>{e.readyState===XMLHttpRequest.DONE&&c()}),c=()=>{if(l(),a(),i)return;i=!0;const u=o;u.state="complete",u.duration=Hn(s.startClocks.timeStamp,F()),u.status=e.status,r.notify(Jn(u))},{stop:l}=X(n,e,"loadend",c);r.notify(s)}function Cs({target:e}){const t=Tt.get(e);t&&(t.isAborted=!0)}let _t;function An(){return _t||(_t=vs()),_t}function vs(){return new O(e=>{if(!window.fetch)return;const{stop:t}=V(window,"fetch",n=>Ls(n,e),{computeHandlingStack:!0});return t})}function Ls({parameters:e,onPostCall:t,handlingStack:n},r){const[o,s]=e;let i=s&&s.method;i===void 0&&o instanceof Request&&(i=o.method);const a=i!==void 0?String(i).toUpperCase():"GET",c=o instanceof Request?o.url:lt(String(o)),l=U(),u={state:"start",init:s,input:o,method:a,startClocks:l,url:c,handlingStack:n};r.notify(u),e[0]=u.input,e[1]=u.init,t(d=>As(r,d,u))}function As(e,t,n){const r=n;function o(s){r.state="resolve",Object.assign(r,s),e.notify(r)}t.then(y(s=>{o({response:s,responseType:s.type,status:s.status,isAborted:!1})}),y(s=>{var i,a;o({status:0,isAborted:((a=(i=r.init)===null||i===void 0?void 0:i.signal)===null||a===void 0?void 0:a.aborted)||s instanceof DOMException&&s.code===DOMException.ABORT_ERR,error:s})}))}let wt={};function Is(e){const t=e.map(n=>(wt[n]||(wt[n]=ks(n)),wt[n]));return Pt(...t)}function ks(e){return new O(t=>{const n=x[e];return x[e]=(...r)=>{n.apply(console,r);const o=Be("console error");Se(()=>{t.notify(xs(r,e,o))})},()=>{x[e]=n}})}function xs(e,t,n){const r=e.map(s=>Ds(s)).join(" ");let o;if(t===_.error){const s=e.find(H);o={stack:s?Z(M(s)):void 0,fingerprint:rn(s),causes:s?sn(s,"console"):void 0,startClocks:U(),message:r,source:v.CONSOLE,handling:"handled",handlingStack:n,context:on(s)}}return{api:t,message:r,error:o,handlingStack:n}}function Ds(e){return typeof e=="string"?N(e):H(e)?en(M(e)):q(N(e),void 0,2)}function Ms(e){const t=dn(e)==="object";return t||w.error("Unsupported context:",e),t}function Ot(e,t,n){const r={...e};for(const[o,{required:s,type:i}]of Object.entries(t))i==="string"&&o in r&&(r[o]=String(r[o])),s&&!(o in e)&&w.warn(`The property ${o} of ${n} is required; context will not be sent to the intake.`);return r}function Je(e="",{customerDataTracker:t,propertiesConfig:n={}}={}){let r={};const o=new O,s={getContext:()=>fn(r),setContext:i=>{Ms(i)?(r=N(Ot(i,n,e)),t==null||t.updateCustomerData(r)):s.clearContext(),o.notify()},setContextProperty:(i,a)=>{r=N(Ot({...r,[i]:a},n,e)),t==null||t.updateCustomerData(r),o.notify()},removeContextProperty:i=>{delete r[i],t==null||t.updateCustomerData(r),Ot(r,n,e),o.notify()},clearContext:()=>{r={},t==null||t.resetCustomerData(),o.notify()},changeObservable:o};return s}const Ns="_dd_c",$s=[];function Rt(e,t,n,r){const o=Ps(n,r);$s.push(X(e,window,"storage",({key:l})=>{o===l&&i()})),t.changeObservable.subscribe(a);const s=ce(c(),t.getContext());me(s)||t.setContext(s);function i(){t.setContext(c())}function a(){localStorage.setItem(o,JSON.stringify(t.getContext()))}function c(){const l=localStorage.getItem(o);return l?JSON.parse(l):{}}}function Ps(e,t){return`${Ns}_${e}_${t}`}const Fs=3*D,Us=16*D,Bs=200;function Gs(e=2){const t=new Map;let n=!1;function r(o=0){if(n||e===0)return;const s=e===2?Fs:Us;let i=o;t.forEach(a=>{i+=a.getBytesCount()}),i>s&&(js(s),n=!0)}return{createDetachedTracker:()=>{const o=In(()=>r(o.getBytesCount()));return o},getOrCreateTracker:o=>(t.has(o)||t.set(o,In(r)),t.get(o)),setCompressionStatus:o=>{e===0&&(e=o,r())},getCompressionStatus:()=>e,stop:()=>{t.forEach(o=>o.stop()),t.clear()}}}function In(e){let t=0;const{throttled:n,cancel:r}=Ft(s=>{t=et(q(s)),e()},Bs),o=()=>{r(),t=0};return{updateCustomerData:s=>{me(s)?o():n(s)},resetCustomerData:o,getBytesCount:()=>t,stop:()=>{r()}}}function js(e){w.warn(`Customer data exceeds the recommended ${e/D}KiB threshold. ${Ce} ${Lt}/#customer-data-exceeds-the-recommended-threshold-warning`)}function Hs(e,t,n){const r=e.getReader(),o=[];let s=0;i();function i(){r.read().then(y(c=>{if(c.done){a();return}o.push(c.value),s+=c.value.length,s>n.bytesLimit?a():i()}),y(c=>t(c)))}function a(){r.cancel().catch(G);let c,l;{let u;if(o.length===1)u=o[0];else{u=new Uint8Array(s);let d=0;o.forEach(f=>{u.set(f,d),d+=f.length})}c=u.slice(0,n.bytesLimit),l=u.length>n.bytesLimit}t(void 0,c,l)}}const zs="datadog-synthetics-public-id",Ks="datadog-synthetics-result-id",Ws="datadog-synthetics-injects-rum";function kn(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||W(Ws))}function Js(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||W(zs);return typeof e=="string"?e:void 0}function Ys(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||W(Ks);return typeof e=="string"?e:void 0}function Ye(e,t,n){const r=n.getHandler(),o=Array.isArray(r)?r:[r];return xn[e]>=xn[n.getLevel()]&&o.includes(t)}const m={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},xn={[m.ok]:0,[m.debug]:1,[m.info]:2,[m.notice]:4,[m.warn]:5,[m.error]:6,[m.critical]:7,[m.alert]:8,[m.emerg]:9};function qe(e,{includeMessage:t=!1}={}){return{stack:e.stack,kind:e.type,message:t?e.message:void 0,causes:e.causes,fingerprint:e.fingerprint,handling:e.handling}}var qs=function(e,t,n,r){var o=arguments.length,s=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};const Re={console:"console",http:"http",silent:"silent"},Zs=Object.keys(m);let A=class{constructor(t,n,r,o=Re.http,s=m.debug,i={}){this.handleLogStrategy=t,this.handlerType=o,this.level=s,this.contextManager=Je("logger",{customerDataTracker:n}),this.contextManager.setContext(i),r&&this.contextManager.setContextProperty("logger",{name:r})}logImplementation(t,n,r=m.info,o,s){const i=N(n);let a;if(o!=null){const c=nn({stackTrace:H(o)?M(o):void 0,originalError:o,nonErrorPrefix:"Provided",source:v.LOGGER,handling:"handled",startClocks:U()});a=ce({error:qe(c,{includeMessage:!0})},i)}else a=i;this.handleLogStrategy({message:N(t),context:a,status:r},this,s)}log(t,n,r=m.info,o){let s;Ye(r,Re.http,this)&&(s=Be("log")),this.logImplementation(t,n,r,o,s)}setContext(t){this.contextManager.setContext(t)}getContext(){return this.contextManager.getContext()}setContextProperty(t,n){this.contextManager.setContextProperty(t,n)}removeContextProperty(t){this.contextManager.removeContextProperty(t)}clearContext(){this.contextManager.clearContext()}setHandler(t){this.handlerType=t}getHandler(){return this.handlerType}setLevel(t){this.level=t}getLevel(){return this.level}};qs([Zn],A.prototype,"logImplementation",null),A.prototype.ok=$(m.ok),A.prototype.debug=$(m.debug),A.prototype.info=$(m.info),A.prototype.notice=$(m.notice),A.prototype.warn=$(m.warn),A.prototype.error=$(m.error),A.prototype.critical=$(m.critical),A.prototype.alert=$(m.alert),A.prototype.emerg=$(m.emerg);function $(e){return function(t,n,r){let o;Ye(e,Re.http,this)&&(o=Be("log")),this.logImplementation(t,n,e,r,o)}}function Vs(e,t,n){return{view:{referrer:document.referrer,url:window.location.href},context:e.getContext(),user:t.getContext(),account:n.getContext()}}const Xs=32*D;function Qs(e){e.usePciIntake===!0&&e.site&&e.site!=="datadoghq.com"&&w.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const t=Zr(e),n=Dn(e.forwardConsoleLogs,xe(_),"Forward Console Logs"),r=Dn(e.forwardReports,xe(Ge),"Forward Reports");if(!(!t||!n||!r))return e.forwardErrorsToLogs&&!n.includes(_.error)&&n.push(_.error),{forwardErrorsToLogs:e.forwardErrorsToLogs!==!1,forwardConsoleLogs:n,forwardReports:r,requestErrorResponseLengthLimit:Xs,...t}}function Dn(e,t,n){if(e===void 0)return[];if(!(e==="all"||Array.isArray(e)&&e.every(r=>t.includes(r)))){w.error(`${n} should be "all" or an array with allowed values "${t.join(\'", "\')}"`);return}return e==="all"?t:$o(e)}function ei(e){const t=Vr(e);return{forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports,use_pci_intake:e.usePciIntake,...t}}function ti(e,t,n){const r=hn();let o,s;const i=t.observable.subscribe(a);function a(){if(!s||!o||!t.isGranted())return;i.unsubscribe();const c=n(o,s);r.drain(c)}return{init(c){if(!c){w.error("Missing configuration");return}if(Xr(c.enableExperimentalFeatures),ze()&&(c=ni(c)),o=c,s){an("DD_LOGS",c);return}const l=Qs(c);l&&(s=l,An().subscribe(G),t.tryToInit(l.trackingConsent),a())},get initConfiguration(){return o},getInternalContext:G,handleLog(c,l,u,d=e(),f=F()){r.add(h=>h.handleLog(c,l,u,d,f))}}}function ni(e){return{...e,clientToken:"empty"}}const Ct="logs";function ri(e){const t=Gs(),n=Je("global context",{customerDataTracker:t.getOrCreateTracker(2)}),r=Je("user",{customerDataTracker:t.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),o=Je("account",{customerDataTracker:t.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),s=Ir();function i(){return Vs(n,r,o)}let a=ti(i,s,(u,d)=>{u.storeContextsAcrossPages&&(Rt(d,n,Ct,2),Rt(d,r,Ct,1),Rt(d,o,Ct,4));const f=e(u,d,i,s);return a=oi(u,f),f});const c={},l=new A((...u)=>a.handleLog(...u),t.createDetachedTracker());return vo({logger:l,init:y(u=>a.init(u)),setTrackingConsent:y(u=>{s.update(u),Ko({feature:"set-tracking-consent",tracking_consent:u})}),getGlobalContext:y(()=>n.getContext()),setGlobalContext:y(u=>n.setContext(u)),setGlobalContextProperty:y((u,d)=>n.setContextProperty(u,d)),removeGlobalContextProperty:y(u=>n.removeContextProperty(u)),clearGlobalContext:y(()=>n.clearContext()),createLogger:y((u,d={})=>(c[u]=new A((...f)=>a.handleLog(...f),t.createDetachedTracker(),N(u),d.handler,d.level,N(d.context)),c[u])),getLogger:y(u=>c[u]),getInitConfiguration:y(()=>fn(a.initConfiguration)),getInternalContext:y(u=>a.getInternalContext(u)),setUser:y(r.setContext),getUser:y(r.getContext),setUserProperty:y(r.setContextProperty),removeUserProperty:y(r.removeContextProperty),clearUser:y(r.clearContext),setAccount:y(o.setContext),getAccount:y(o.getContext),setAccountProperty:y(o.setContextProperty),removeAccountProperty:y(o.removeContextProperty),clearAccount:y(o.clearContext)})}function oi(e,t){return{init:n=>{an("DD_LOGS",n)},initConfiguration:e,...t}}const si="logs";function ii(e,t){const n=Qo(e,si,r=>ci(e,r),t);return{findTrackedSession:(r,o={returnInactive:!1})=>{const s=n.findSession(r,o);return s&&s.trackingType==="1"?{id:s.id,anonymousId:s.anonymousId}:void 0},expireObservable:n.expireObservable}}function ai(e){const n=Mn(e)==="1"?{}:void 0;return{findTrackedSession:()=>n,expireObservable:new O}}function Mn(e){return ve(e.sessionSampleRate)?"1":"0"}function ci(e,t){const n=ui(t)?t:Mn(e);return{trackingType:n,isTracked:n==="1"}}function ui(e){return e==="0"||e==="1"}let Nn=!1;function Ze(e){const t=window;if(kn()){const r=n(t.DD_RUM_SYNTHETICS);return!r&&!Nn&&(Nn=!0,mn("Logs sent before RUM is injected by the synthetics worker",{testId:Js(),resultId:Ys()})),r}return n(t.DD_RUM);function n(r){if(r&&r.getInternalContext)return r.getInternalContext(e)}}function li(e,t,n,r,o){const s=Zs.concat(["custom"]),i={};s.forEach(a=>{i[a]=Ts(a,t.eventRateLimiterThreshold,o)}),n.subscribe(0,({rawLogsEvent:a,messageContext:c=void 0,savedCommonContext:l=void 0,domainContext:u})=>{var d,f;const h=Kn(a.date),g=e.findTrackedSession(h);if(!e.findTrackedSession(h,{returnInactive:!0}))return;const E=l||r();let de;!me(E.account)&&E.account.id&&(de=E.account),g&&g.anonymousId&&!E.user.anonymous_id&&(E.user.anonymous_id=g.anonymousId);const k=ce({service:t.service,session_id:g?g.id:void 0,session:g?{id:g.id}:void 0,usr:me(E.user)?void 0:E.user,account:de,view:E.view},E.context,Ze(h),a,c);((d=t.beforeSend)===null||d===void 0?void 0:d.call(t,k,u))===!1||k.origin!==v.AGENT&&((f=i[k.status])!==null&&f!==void 0?f:i.custom).isLimitReached()||n.notify(1,k)})}const di={[_.log]:m.info,[_.debug]:m.debug,[_.info]:m.info,[_.warn]:m.warn,[_.error]:m.error};function fi(e,t){const n=Is(e.forwardConsoleLogs).subscribe(r=>{var o;const s={rawLogsEvent:{date:F(),message:r.message,origin:v.CONSOLE,error:r.error&&qe(r.error),status:di[r.api]},messageContext:(o=r.error)===null||o===void 0?void 0:o.context,domainContext:{handlingStack:r.handlingStack}};t.notify(0,s)});return{stop:()=>{n.unsubscribe()}}}function pi(e,t){const n=Ao(e,e.forwardReports).subscribe(r=>{let o=r.message,s;const i=r.originalError.type==="deprecation"?m.warn:m.error;i===m.error?s=qe(r):r.stack&&(o+=` Found in ${wo(r.stack)}`),t.notify(0,{rawLogsEvent:{date:F(),message:o,origin:v.REPORT,error:s,status:i}})});return{stop:()=>{n.unsubscribe()}}}function hi(e,t){if(!e.forwardErrorsToLogs)return{stop:G};const n=_s(e).subscribe(s=>{s.state==="complete"&&o("xhr",s)}),r=An().subscribe(s=>{s.state==="resolve"&&o("fetch",s)});function o(s,i){!Yr(i.url)&&(yi(i)||yn(i.status))&&("xhr"in i?gi(i.xhr,e,a):i.response?Si(i.response,e,a):i.error&&mi(i.error,e,a));function a(c){const l={isAborted:i.isAborted,handlingStack:i.handlingStack};t.notify(0,{rawLogsEvent:{message:`${bi(s)} error ${i.method} ${i.url}`,date:i.startClocks.timeStamp,error:{stack:c||"Failed to load",handling:void 0},http:{method:i.method,status_code:i.status,url:i.url},status:m.error,origin:v.NETWORK},domainContext:l})}}return{stop:()=>{n.unsubscribe(),r.unsubscribe()}}}function gi(e,t,n){typeof e.response=="string"?n(vt(e.response,t)):n(e.response)}function mi(e,t,n){n(vt(Z(M(e)),t))}function Si(e,t,n){const r=rs(e);!r||!r.body?n():window.TextDecoder?Ei(r.body,t.requestErrorResponseLengthLimit,(o,s)=>{n(o?`Unable to retrieve response: ${o}`:s)}):r.text().then(y(o=>n(vt(o,t))),y(o=>n(`Unable to retrieve response: ${o}`)))}function yi(e){return e.status===0&&e.responseType!=="opaque"}function vt(e,t){return e.length>t.requestErrorResponseLengthLimit?`${e.substring(0,t.requestErrorResponseLengthLimit)}...`:e}function bi(e){return e==="xhr"?"XHR":"Fetch"}function Ei(e,t,n){Hs(e,(r,o,s)=>{if(r)n(r);else{let i=new TextDecoder().decode(o);s&&(i+="..."),n(void 0,i)}},{bytesLimit:t,collectStreamBody:!0})}function Ti(e,t){if(!e.forwardErrorsToLogs)return{stop:G};const n=new O,{stop:r}=Oo(n),o=n.subscribe(s=>{t.notify(0,{rawLogsEvent:{message:s.message,date:s.startClocks.timeStamp,error:qe(s),origin:v.SOURCE,status:m.error},messageContext:s.context})});return{stop:()=>{r(),o.unsubscribe()}}}const _i=Es;function wi(e){function t(n,r,o,s,i){const a=ce(r.getContext(),n.context);if(Ye(n.status,Re.console,r)&&Ri(n,a),Ye(n.status,Re.http,r)){const c={rawLogsEvent:{date:i||F(),message:n.message,status:n.status,origin:v.LOGGER},messageContext:a,savedCommonContext:s};o&&(c.domainContext={handlingStack:o}),e.notify(0,c)}}return{handleLog:t}}const Oi={[m.ok]:_.debug,[m.debug]:_.debug,[m.info]:_.info,[m.notice]:_.info,[m.warn]:_.warn,[m.error]:_.error,[m.critical]:_.error,[m.alert]:_.error,[m.emerg]:_.error};function Ri({status:e,message:t},n){z[Oi[e]].call(x,t,n)}function Ci(e,t,n,r,o){const s=Ln(e,{endpoint:e.logsEndpointBuilder,encoder:We()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:We()},n,r,o.expireObservable);return t.subscribe(1,i=>{s.add(i)}),s}function vi(e){const t=bt();e.subscribe(1,n=>{t.send("log",n)})}function Li(e){return{get:t=>{const n=e.findTrackedSession(t);if(n)return{session_id:n.id}}}}function Ai(e){return t=>{e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:v.AGENT,status:m.error}}),mn("Error reported to customer",{"error.message":t.message})}}function Ii(e,t,n,r,o){const s=Bo("browser-logs-sdk",t);s.setContextProvider(()=>{var a,c,l,u,d,f;return{application:{id:(a=Ze())===null||a===void 0?void 0:a.application_id},session:{id:(c=o.findTrackedSession())===null||c===void 0?void 0:c.id},view:{id:(u=(l=Ze())===null||l===void 0?void 0:l.view)===null||u===void 0?void 0:u.id},action:{id:(f=(d=Ze())===null||d===void 0?void 0:d.user_action)===null||f===void 0?void 0:f.id}}});const i=[];if(ze()){const a=bt(),c=s.observable.subscribe(l=>a.send("internal_telemetry",l));i.push(()=>c.unsubscribe())}else{const a=Ln(t,{endpoint:t.rumEndpointBuilder,encoder:We()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:We()},n,r,o.expireObservable);i.push(()=>a.stop());const c=s.observable.subscribe(l=>a.add(l,Ho(t)));i.push(()=>c.unsubscribe())}return jo(),zo(ei(e)),{telemetry:s,stop:()=>{i.forEach(a=>a())}}}function ki(e,t,n,r){const o=new _i,s=[];o.subscribe(1,f=>ln("logs",f));const i=Ai(o),a=ms(t),c=t.sessionStoreStrategyType&&!ze()&&!kn()?ii(t,r):ai(t),{stop:l}=Ii(e,t,i,a,c);s.push(()=>l()),hi(t,o),Ti(t,o),fi(t,o),pi(t,o);const{handleLog:u}=wi(o);if(li(c,t,o,n,i),ze())vi(o);else{const{stop:f}=Ci(t,o,i,a,c);s.push(()=>f())}const d=Li(c);return{handleLog:u,getInternalContext:d.get,stop:()=>{s.forEach(f=>f())}}}const ee=ri(ki);Lo(B(),"DD_LOGS",ee);const R=class R{constructor(t,n,r,o,s){this.copy=()=>new R(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const i=":";let a=("0"+this.h).slice(-2)+i+("0"+this.m).slice(-2)+i+("0"+this.s).slice(-2)+i+("0"+this.f).slice(-2);return a+="."+(this.field?"1":"2"),a},this.toZipTimeCodeString=()=>{const i=this.copy();return i.f=0,i.s=i.s%2===0?i.s:i.s-1,i.field=0,R.toStr(i)},this.toFrames=i=>{let a=60,c=0;Math.floor(i)==60?(a=60,c=0):Math.floor(i)==59?(a=60,c=4):Math.floor(i)==30?(a=30,c=0):Math.floor(i)==29&&(a=30,c=2);let l=this.h,u=this.m,d=this.s,f=this.f,h=this.field;const g=l*60+u,E=(g-Math.floor(g/10))*c;return l*(a*3600)+u*(a*60)+d*a+(f*2+h)-E},this.addSeconds=i=>{let a=this.copy();if(a.s+=i,a.s>=60){const c=Math.floor(a.s/60);if(a.s=a.s%60,a.m+=c,a.m>=60){const l=Math.floor(a.m/60);a.m=a.m%60,a.h+=l}}return a},this.addFrames=(i,a)=>{let c=this.toFrames(a);return c+=i,R.fromFrames(c,a)},this.subtractFrames=(i,a)=>this.addFrames(-i,a),this.h=t||0,this.m=n||0,this.s=r||0,this.f=o||0,this.field=s||0}static compare(t,n){return t.h!==n.h?t.h<n.h?-1:1:t.m!==n.m?t.m<n.m?-1:1:t.s!==n.s?t.s<n.s?-1:1:t.f!==n.f?t.f<n.f?-1:1:t.field!==n.field?t.field<n.field?-1:1:0}static generateTimecodeRange(t,n,r){const o=[];let s=t;for(;R.compare(s,n)<=0;)o.push(s),s=s.addSeconds(r);return o}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(t){return this.toFrames(t)*1e3/t}};R.calculateCurrentTimeCode=t=>{var d;if(!t.video||!t.clocker||!t.gameParams)throw new Error("OTTPlayer is not initialized");const n=t.video,r=t.clocker,o=r.videoFPScalculator.getFPS(),a=(n.currentTime-r.syncPoint.playerTime)%(60*60*24)*o+r.syncPoint.frame;if(a===0||o===0)throw new Error("Current frame is 0 or fps is 0");const c=R.calculateCurrentOffset(a,(d=t.gameParams)==null?void 0:d.offsets);if(c===void 0)throw new Error("Offset is undefined");let l=Math.floor(a-c);return l<0&&(l+=5178816),l>=5178816&&(l-=5178816),R.fromFrames(l,o)},R.calculateCurrentOffset=(t,n)=>{for(let r=1;r<n.length;r++)if(t<n[r].frame)return n[r-1].offset;return Math.abs(n[n.length-1].offset)},R.fromFrames=(t,n)=>{let r=60,o=0;Math.floor(n)==60?(r=60,o=0):Math.floor(n)==59?(r=60,o=4):Math.floor(n)==30?(r=30,o=0):Math.floor(n)==29&&(r=30,o=2);let s=Math.floor(n*60),i=Math.floor(n*60*10),a=i*6,c=t,l=Math.floor(c/a);c-=l*a;let u=Math.floor(c/i);c-=u*i,c>=r*60&&(c+=o*(Math.floor((c-r*60)/s)+1));let d=Math.floor(c/(r*60));c-=d*(r*60);let f=Math.floor(c/r);c-=f*r;let h=c;d+=u*10;let g=0;return g=h%2,h=Math.floor(h/2),new R(l,d,f,h,g)},R.toStr=t=>{const n="_";let r=("0"+t.h).slice(-2)+n+("0"+t.m).slice(-2)+n+("0"+t.s).slice(-2)+n+("0"+t.f).slice(-2);return t.field&&(r+="_1"),r},R.fromStr=t=>{const r=t.split("_").map(Number);if(r.length==4){const[o,s,i,a]=r;return new R(o,s,i,a,0)}else if(r.length==5){const[o,s,i,a,c]=r;return new R(o,s,i,a,c)}else throw new Error("Invalid timecode format: "+t)},R.fromMetadata=t=>{const n=/^(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d))?$/,r=t.timecode.match(n);if(!r)throw new Error("Invalid timecode format: "+t.timecode);const[,o,s,i,a,c]=r,l=Number(o),u=Number(s),d=Number(i),f=Number(a),h=c?Number(c):0;return new R(l,u,d,f,h)};let C=R;const p=class p{constructor(t){this.listenerMap=new Map,p.options=t,this.isLoggingOn=t.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&ee.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const n="bb_logger_mac_uuid";let r=localStorage.getItem(n);r||(r=crypto.randomUUID(),localStorage.setItem(n,r)),p.tracking.mac=r,p.tracking.dev=`${t.platform}_${t.browserName}`,p.beatHandle||(p.options&&T(p.options,"Logger")&&console.log("[Logger] Starting tracking beat"),p.beatHandle=window.setInterval(p.flushTracking,15e3))}static setMessagePort(t){this.messagePort=t}static getMessagePort(){return this.messagePort}setLoggingOn(t){this.isLoggingOn=t}addEventListener(t,n){const r=o=>n(o);this.listenerMap.set(n,{eventName:t,wrappedListener:r}),this.eventTarget.addEventListener(t,r)}removeEventListener(t,n){const r=this.listenerMap.get(n);r&&r.eventName===t&&(this.eventTarget.removeEventListener(t,r.wrappedListener),this.listenerMap.delete(n))}removeAllEventListeners(){for(const[t,{eventName:n,wrappedListener:r}]of this.listenerMap)this.eventTarget.removeEventListener(n,r);this.listenerMap.clear()}setAttributes(t){p.processAttributes(t);for(const n in t)ee.logger.setContextProperty(n,t[n])}info(t,n){t==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(n==null?void 0:n.url)||""}),t==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(n==null?void 0:n.isEnabled)??!0}),t==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",n),t==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",n),t==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",n),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.info(t,n),p.options&&T(p.options,"Logger")&&console.log("[Logger] Sending info: ",t))}error(t,n){this.emit("mediaSessionDidError",{message:t,...n||{}}),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.error(t,n),p.tracking.err_time=Date.now().toFixed(0),p.tracking.err_desc=t+(n?` - ${JSON.stringify(n)}`:""),p.options&&T(p.options,"Logger")&&console.log("[Logger] Sending error: ",t))}criticalError(t,n){this.emit("mediaSessionDidFailOnError",{message:t,...n||{}}),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.error(t,n),p.tracking.err_time=Date.now().toFixed(0),p.tracking.err_desc=t+(n?` - ${JSON.stringify(n)}`:""),p.options&&T(p.options,"Logger")&&console.log("[Logger] Sending critical error: ",t))}warn(t,n){n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.warn(t,n),p.options&&T(p.options,"Logger")&&console.log("[Logger] Sending warn: ",t))}handleMessageFromWorker(t){t.actionType==="INFO"?this.info(t.message,t.attributes):t.actionType==="ERROR"?this.error(t.message,t.attributes):t.actionType==="CRITICAL_ERROR"?this.criticalError(t.message,t.attributes):t.actionType==="WARN"?this.warn(t.message,t.attributes):t.actionType==="SET_ATTRIBUTES"&&t.attributes&&this.setAttributes(t.attributes)}static setAttributes(t){if(!p.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{p.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:t})}catch(n){console.error("[Logger] Error posting message:",n)}}static info(t,n){p.messagePort.postMessage({type:"LOG",actionType:"INFO",message:t,attributes:n})}static error(t,n){p.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:t,attributes:n})}static warn(t,n){p.messagePort.postMessage({type:"LOG",actionType:"WARN",message:t,attributes:n})}static criticalError(t,n){p.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:t,attributes:n})}static processAttributes(t){if(t.player_version&&(p.tracking.sdk=t.player_version),t.media_id&&(p.tracking.gid=t.media_id),t.game_id&&(p.tracking.buc=t.game_id),t.bb_session_id&&(p.tracking.sid=t.bb_session_id,p.options&&T(p.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",p.tracking.sid)),t.last_timecode){const r=C.fromStr(t.last_timecode);p.tracking.tc=r.print(),p.lastTimecodeMillis=r.totalMilliseconds(59.94),p.lastTimecodeMillis&&p.lastZipMillis&&(p.tracking.cache=(p.lastZipMillis-p.lastTimecodeMillis).toFixed(0))}t.last_offset&&(p.tracking.off=t.last_offset),t.last_loading_zip&&(p.tracking.zip=t.last_loading_zip+".zip",p.lastZipMillis=C.fromStr(t.last_loading_zip).totalMilliseconds(59.94),p.lastTimecodeMillis&&p.lastZipMillis&&(p.tracking.cache=(p.lastZipMillis-p.lastTimecodeMillis).toFixed(0))),t.last_rendered_frame&&(p.tracking.aug_time=Date.now().toFixed(0)),t.asset&&(p.tracking.asset=t.asset)}static objectToQuery(t){return Object.entries(t).filter(([n,r])=>r!==0&&r!=="").map(([n,r])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`).join("&")}emit(t,n){const r=new CustomEvent(t,{detail:n});this.eventTarget.dispatchEvent(r)}};p.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},p.lastTimecodeMillis=0,p.lastZipMillis=0,p.flushTracking=()=>{const t=Date.now().toFixed(0);p.tracking.now=t;const r=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${p.objectToQuery(p.tracking)}&platform=Web`;p.options&&T(p.options,"Logger")&&console.log("[Logger] Flushing tracking data:",r),fetch(r,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),p.tracking.err_desc="",p.tracking.err_time=""};let L=p;class $n{constructor(t,n,r){this.jobsQueue=[],this.processedTimecodes=[],this.retryingTimecodes=new Set,this.permanentlyFailedTimecodes=new Set,this.activeDownloads=new Set,this.pendingRetryTimeouts=new Map,this.downloaderStopped=!1,this.firstDownload=!0,this.updateStreamData=o=>{this.downloaderStopped||(this.streamData=o,this.initiateJobs(this.options.DOWNLOADER_ZIP_START_OFFSET,this.options.DOWNLOADER_ZIP_END_OFFSET,this.options.DOWNLOADER_ZIP_LENGTH_SECONDS),this.clearOldJobs(1),this.notifyZipBufferStatus(),this.startNextJob())},this.initiateJobs=(o,s,i)=>{if(!this.streamData){L.error("[Downloader] Stream data is not available"),this.options&&T(this.options,"Errors")&&console.error("[Downloader] Stream data is not available");return}const a=C.fromStr(this.streamData.timeCode),c=a.addSeconds(o),l=a.addSeconds(s),u=C.generateTimecodeRange(c,l,i);for(const d of u){const f=d.toZipTimeCodeString();this.processedTimecodes.includes(f)||this.addJob(f)}},this.clearOldJobs=o=>{if(!this.streamData){L.error("[Downloader] Stream data is not available"),this.options&&T(this.options,"Errors")&&console.error("[Downloader] Stream data is not available");return}const i=C.fromStr(this.streamData.timeCode).totalSeconds()-o;this.processedTimecodes=this.processedTimecodes.filter(l=>C.fromStr(l).totalSeconds()>i),Array.from(this.retryingTimecodes).filter(l=>C.fromStr(l).totalSeconds()<=i).forEach(l=>this.retryingTimecodes.delete(l)),Array.from(this.permanentlyFailedTimecodes).filter(l=>C.fromStr(l).totalSeconds()<=i).forEach(l=>this.permanentlyFailedTimecodes.delete(l))},this.clearAllJobs=()=>{this.jobsQueue=[],this.processedTimecodes=[],this.retryingTimecodes.clear(),this.permanentlyFailedTimecodes.clear(),this.activeDownloads.clear(),this.pendingRetryTimeouts.forEach(o=>clearTimeout(o)),this.pendingRetryTimeouts.clear()},this.addJob=o=>{if(!this.downloaderStopped){if(this.jobsQueue.some(s=>s===o)){this.options&&T(this.options,"Downloader")&&console.log(`[Downloader] Job already in queue for timeCode=${o}`);return}if(this.activeDownloads.has(o)){this.options&&T(this.options,"Downloader")&&console.log(`[Downloader] Job already downloading for timeCode=${o}`);return}this.jobsQueue.push(o),this.startNextJob()}},this.startNextJob=()=>{if(!this.downloaderStopped&&this.jobsQueue.length>0){const o=this.jobsQueue.shift();this.options&&T(this.options,"Downloader")&&console.log(`[Downloader] Starting job timeCode=${o}`),this.downloadZip(o)}},this.downloadZip=async o=>{if(!this.streamData){L.error("[Downloader] Stream data is not available"),this.options&&T(this.options,"Errors")&&console.error("[Downloader] Stream data is not available");return}this.activeDownloads.add(o),this.firstDownload&&(this.firstDownload=!1,L.info("didStartAugmentationDownload",{timestamp:o}));const{fps:s,zipBaseURL:i,bucketName:a}=this.streamData,c=async(l=0)=>{const u=this.shouldBeFinalRetry(o,60);try{if(this.options&&T(this.options,"Downloader")){const h=l>0?` (retry ${l}${u?", final":""})`:"";console.log(`[Downloader] Fetching zip for timeCode=${o}${h}`)}const d=await this.fetchMetadata(i,a,s,o,u);if(this.downloaderStopped)return;this.retryingTimecodes.delete(o),this.activeDownloads.delete(o);const f=this.pendingRetryTimeouts.get(o);f!==void 0&&(clearTimeout(f),this.pendingRetryTimeouts.delete(o)),this.processedTimecodes.includes(o)||this.processedTimecodes.push(o),this.postArrayBufferToDecoder(o,d),L.setAttributes({last_loading_zip:o}),this.notifyZipBufferStatus(),this.startNextJob()}catch(d){if(l===0&&this.retryingTimecodes.add(o),this.downloaderStopped){this.options&&T(this.options,"Downloader")&&console.log("[Downloader] Stopping retry - downloader has been stopped"),this.startNextJob();return}if(u){L.error("[Downloader] Error fetching zip",{error:d.message||d}),this.options&&T(this.options,"Errors")&&console.error("[Downloader] Error fetching zip:",d),this.retryingTimecodes.delete(o),this.permanentlyFailedTimecodes.add(o),this.activeDownloads.delete(o);const h=this.pendingRetryTimeouts.get(o);h!==void 0&&(clearTimeout(h),this.pendingRetryTimeouts.delete(o)),this.notifyZipBufferStatus(),this.startNextJob();return}const f=setTimeout(()=>{this.pendingRetryTimeouts.delete(o),c(l+1)},1e3);this.pendingRetryTimeouts.set(o,f)}};await c()},this.shouldBeFinalRetry=(o,s)=>{var d;if(!((d=this.streamData)!=null&&d.timeCode))return!1;const i=C.fromStr(o),a=C.fromStr(this.streamData.timeCode),c=i.toFrames(s),l=a.toFrames(s);return c-l<=60},this.fetchMetadata=async(o,s,i,a,c=!1)=>{const l=`${o}/${s}`,u=this.options.MASK_TYPE==="mp4"?this.options.BUCKET_SUBFOLDER_PATH:"",d=`${l}/${u}${a}.zip`,f=performance.now();let h;const g={},b=!!(this.options.authNbaToken||this.options.authEmail&&this.options.authPassword);if(this.options.SEND_METRICS){let te="?platform=Web";if(this.streamData&&this.streamData.timeCode){const ne=this.streamData.timeCode;ne.match(/^\\d{2}_\\d{2}_\\d{2}_\\d{2}$/)?te+=`&tc=${ne}_1`:ne.match(/^\\d{2}_\\d{2}_\\d{2}_\\d{2}_1$/)&&(te+=`&tc=${ne.replace(/_1$/,"_2")}`)}c&&(te+=`${te?"&":"?"}fr=true`),h=await fetch(d+te,{headers:g,cache:"no-store",credentials:b?"include":"omit"})}else h=await fetch(d,{headers:g,cache:"no-store",credentials:b?"include":"omit"});const E=await h.arrayBuffer(),k=(performance.now()-f)/1e3;if(!h.ok)throw new Error(`HTTP error! Status: ${h.status} (MASK_TYPE: ${this.options.MASK_TYPE})`);return k>1&&L.warn("didFetchZip",{downloadTaskURL:d,downloadTime:k}),E},this.stop=()=>{this.downloaderStopped=!0,this.clearAllJobs()},this.postArrayBufferToDecoder=t,this.onZipBufferStatusChange=r,this.options=n}isStopped(){return this.downloaderStopped}roundToZipBoundary(t,n){const r=t.totalSeconds(),o=Math.floor(r/n)*n,s=Math.floor(o/3600),i=Math.floor(o%3600/60),a=o%60;return new C(s,i,a,0,0)}calculateContinuousZipBuffer(){if(!this.streamData)return 0;const t=C.fromStr(this.streamData.timeCode),n=this.options.DOWNLOADER_ZIP_LENGTH_SECONDS;let r=t.addSeconds(this.options.DOWNLOADER_ZIP_START_OFFSET);r=this.roundToZipBoundary(r,n);let o=0;const s=Math.ceil(this.options.DOWNLOADER_ZIP_END_OFFSET/n);for(let i=0;i<s;i++){const a=r.toZipTimeCodeString();if(this.permanentlyFailedTimecodes.has(a)||!this.processedTimecodes.includes(a))break;o+=n,r=r.addSeconds(n)}return o}notifyZipBufferStatus(){if(!this.onZipBufferStatusChange)return;const t=this.calculateContinuousZipBuffer();this.onZipBufferStatusChange({continuousSeconds:t,isReady:t>=this.options.ZIP_BUFFER_READY_THRESHOLD,needsFadeout:t<=this.options.ZIP_BUFFER_FADEOUT_THRESHOLD,retryingTimecodes:Array.from(this.retryingTimecodes),failedTimecodes:Array.from(this.permanentlyFailedTimecodes)})}}let Ve=null,le=null,P,I;function Pn(e){Ve&&Ve.postMessage({type:"ZIP_BUFFER_STATUS",status:e})}self.onmessage=async e=>{const{data:t}=e;if(t.type==="SET_LOGGER_PORT"&&L.setMessagePort(t.port),t.type==="SET_RENDERER_PORT"&&(Ve=t.port,Ve.onmessage=xi),t.type==="SET_DECODER_PORT"&&(le=t.port,le.onmessage=Di),t.type==="SET_OPTIONS"&&(I=t.options,L.setMessagePort(self),P=new $n(Fn,I,Pn)),t.type==="STOP_WORKER"){P&&P.stop();return}if(t.type==="RESTART_WORKER"){if(!I)return;P&&P.stop(),P=new $n(Fn,I,Pn);return}};async function xi(e){const{data:t}=e;if(self.postMessage(t),t.type==="DOWNLOADER_INPUT"){if(!P||P.isStopped())return;P.updateStreamData(t.streamData)}}function Fn(e,t){if(!le)return;I&&T(I,"Downloader")&&console.log(`[DownloaderWorker] Posting an ArrayBuffer to Decoder, timeCode=${e}`);const n={type:"DECODER_INPUT",timeCode:e,arrayBuffer:t};le==null||le.postMessage(n,{transfer:[t]})}function Di(e){I&&T(I,"Downloader")&&console.log("[DownloaderWorker] Received message from Decoder:",e.data)}self.onunhandledrejection=e=>{L.error("[DownloaderWorker] Unhandled rejection",{error:e.reason}),I&&(T(I,"Errors")&&console.error("[DownloaderWorker] Unhandled rejection:",e.reason),e.preventDefault())},self.onerror=e=>{L.error("[DownloaderWorker] Unhandled error",{error:e}),I&&(T(I,"Errors")&&console.error("[DownloaderWorker] Unhandled error:",e),e instanceof Event&&e.preventDefault())}})();\n',Vt=typeof self<"u"&&self.Blob&&new Blob([zt],{type:"text/javascript;charset=utf-8"});function cn(t){let e;try{if(e=Vt&&(self.URL||self.webkitURL).createObjectURL(Vt),!e)throw"";const r=new Worker(e,{name:t==null?void 0:t.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(zt),{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const Wt='(function(){"use strict";const B=(a,n)=>n==="Errors"?!0:!a.debug||!a.debug.on?!1:a.debug[`log${n}`];function Zt(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var mt={},Qt;function fn(){return Qt||(Qt=1,function(a){var n=function(){var e=new Date,t=4,s=3,l=2,h=1,m=t,y={setLogLevel:function(b){b==this.debug?m=h:b==this.info?m=l:b==this.warn?m=s:(b==this.error,m=t)},debug:function(b,x){console.debug===void 0&&(console.debug=console.log),h>=m&&console.debug("["+n.getDurationString(new Date-e,1e3)+"]","["+b+"]",x)},log:function(b,x){this.debug(b.msg)},info:function(b,x){l>=m&&console.info("["+n.getDurationString(new Date-e,1e3)+"]","["+b+"]",x)},warn:function(b,x){s>=m&&console.warn("["+n.getDurationString(new Date-e,1e3)+"]","["+b+"]",x)},error:function(b,x){t>=m&&console.error("["+n.getDurationString(new Date-e,1e3)+"]","["+b+"]",x)}};return y}();n.getDurationString=function(e,t){var s;function l(w,T){for(var C=""+w,F=C.split(".");F[0].length<T;)F[0]="0"+F[0];return F.join(".")}e<0?(s=!0,e=-e):s=!1;var h=t||1,m=e/h,y=Math.floor(m/3600);m-=y*3600;var b=Math.floor(m/60);m-=b*60;var x=m*1e3;return m=Math.floor(m),x-=m*1e3,x=Math.floor(x),(s?"-":"")+y+":"+l(b,2)+":"+l(m,2)+"."+l(x,3)},n.printRanges=function(e){var t=e.length;if(t>0){for(var s="",l=0;l<t;l++)l>0&&(s+=","),s+="["+n.getDurationString(e.start(l))+","+n.getDurationString(e.end(l))+"]";return s}else return"(empty)"},a.Log=n;var o=function(e){if(e instanceof ArrayBuffer)this.buffer=e,this.dataview=new DataView(e);else throw"Needs an array buffer";this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var s=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:t?s=this.dataview.getInt8(this.position):s=this.dataview.getUint8(this.position);break;case 2:t?s=this.dataview.getInt16(this.position):s=this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";s=this.dataview.getUint8(this.position)<<16,s|=this.dataview.getUint8(this.position+1)<<8,s|=this.dataview.getUint8(this.position+2);break;case 4:t?s=this.dataview.getInt32(this.position):s=this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";s=this.dataview.getUint32(this.position)<<32,s|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,s}else throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",s=0;s<e;s++)t+=String.fromCharCode(this.readUint8());return t}else throw"Not enough bytes in buffer"},o.prototype.readCString=function(){for(var e=[];;){var t=this.readUint8();if(t!==0)e.push(t);else break}return String.fromCharCode.apply(null,e)},o.prototype.readInt8=function(){return this.readAnyInt(1,!0)},o.prototype.readInt16=function(){return this.readAnyInt(2,!0)},o.prototype.readInt32=function(){return this.readAnyInt(4,!0)},o.prototype.readInt64=function(){return this.readAnyInt(8,!1)},o.prototype.readUint8Array=function(e){for(var t=new Uint8Array(e),s=0;s<e;s++)t[s]=this.readUint8();return t},o.prototype.readInt16Array=function(e){for(var t=new Int16Array(e),s=0;s<e;s++)t[s]=this.readInt16();return t},o.prototype.readUint16Array=function(e){for(var t=new Int16Array(e),s=0;s<e;s++)t[s]=this.readUint16();return t},o.prototype.readUint32Array=function(e){for(var t=new Uint32Array(e),s=0;s<e;s++)t[s]=this.readUint32();return t},o.prototype.readInt32Array=function(e){for(var t=new Int32Array(e),s=0;s<e;s++)t[s]=this.readInt32();return t},a.MP4BoxStream=o;var d=function(e,t,s){this._byteOffset=t||0,e instanceof ArrayBuffer?this.buffer=e:typeof e=="object"?(this.dataView=e,t&&(this._byteOffset+=t)):this.buffer=new ArrayBuffer(e||0),this.position=0,this.endianness=s??d.LITTLE_ENDIAN};d.prototype={},d.prototype.getPosition=function(){return this.position},d.prototype._realloc=function(e){if(this._dynamicSize){var t=this._byteOffset+this.position+e,s=this._buffer.byteLength;if(t<=s){t>this._byteLength&&(this._byteLength=t);return}for(s<1&&(s=1);t>s;)s*=2;var l=new ArrayBuffer(s),h=new Uint8Array(this._buffer),m=new Uint8Array(l,0,h.length);m.set(h),this.buffer=l,this._byteLength=t}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),s=new Uint8Array(this._buffer,0,t.length);t.set(s),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(e*1);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=e*1,t},d.prototype.readInt32Array=function(e,t){e=e??this.byteLength-this.position/4;var s=new Int32Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readInt16Array=function(e,t){e=e??this.byteLength-this.position/2;var s=new Int16Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readInt8Array=function(e){e=e??this.byteLength-this.position;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=e??this.byteLength-this.position/4;var s=new Uint32Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readUint16Array=function(e,t){e=e??this.byteLength-this.position/2;var s=new Uint16Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readUint8Array=function(e){e=e??this.byteLength-this.position;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=e??this.byteLength-this.position/8;var s=new Float64Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readFloat32Array=function(e,t){e=e??this.byteLength-this.position/4;var s=new Float32Array(e);return d.memcpy(s.buffer,0,this.buffer,this.byteOffset+this.position,e*s.BYTES_PER_ELEMENT),d.arrayToNative(s,t??this.endianness),this.position+=s.byteLength,s},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,e??this.endianness);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,e??this.endianness);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,e??this.endianness);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,e??this.endianness);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,e??this.endianness);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,e??this.endianness);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,s,l,h){var m=new Uint8Array(e,t,h),y=new Uint8Array(s,l,h);m.set(y)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=0;s<e.byteLength;s+=e.BYTES_PER_ELEMENT)for(var l=s+e.BYTES_PER_ELEMENT-1,h=s;l>h;l--,h++){var m=t[h];t[h]=t[l],t[l]=m}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],s=0;s<e.length;s++)t[s]=e[s];return String.fromCharCode.apply(null,t)},d.prototype.readString=function(e,t){return t==null||t=="ASCII"?String.fromCharCodeUint8.apply(null,[this.mapUint8Array(e??this.byteLength-this.position)]):new TextDecoder(t).decode(this.mapUint8Array(e))},d.prototype.readCString=function(e){var t=this.byteLength-this.position,s=new Uint8Array(this._buffer,this._byteOffset+this.position),l=t;e!=null&&(l=Math.min(e,t));for(var h=0;h<l&&s[h]!==0;h++);var m=String.fromCharCodeUint8.apply(null,[this.mapUint8Array(h)]);return e!=null?this.position+=l-h:h!=t&&(this.position+=1),m};var c=Math.pow(2,32);d.prototype.readInt64=function(){return this.readInt32()*c+this.readUint32()},d.prototype.readUint64=function(){return this.readUint32()*c+this.readUint32()},d.prototype.readInt64=function(){return this.readUint32()*c+this.readUint32()},d.prototype.readUint24=function(){return(this.readUint8()<<16)+(this.readUint8()<<8)+this.readUint8()},a.DataStream=d,d.prototype.save=function(e){var t=new Blob([this.buffer]);if(window.URL&&URL.createObjectURL){var s=window.URL.createObjectURL(t),l=document.createElement("a");document.body.appendChild(l),l.setAttribute("href",s),l.setAttribute("download",e),l.setAttribute("target","_self"),l.click(),window.URL.revokeObjectURL(s)}else throw"DataStream.save: Can\'t create object URL."},d.prototype._dynamicSize=!0,Object.defineProperty(d.prototype,"dynamicSize",{get:function(){return this._dynamicSize},set:function(e){e||this._trimAlloc(),this._dynamicSize=e}}),d.prototype.shift=function(e){var t=new ArrayBuffer(this._byteLength-e),s=new Uint8Array(t),l=new Uint8Array(this._buffer,e,s.length);s.set(l),this.buffer=t,this.position-=e},d.prototype.writeInt32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Int32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt32Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeInt32(e[s],t)},d.prototype.writeInt16Array=function(e,t){if(this._realloc(e.length*2),e instanceof Int16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt16Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeInt16(e[s],t)},d.prototype.writeInt8Array=function(e){if(this._realloc(e.length*1),e instanceof Int8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt8Array(e.length);else for(var t=0;t<e.length;t++)this.writeInt8(e[t])},d.prototype.writeUint32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Uint32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint32Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeUint32(e[s],t)},d.prototype.writeUint16Array=function(e,t){if(this._realloc(e.length*2),e instanceof Uint16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint16Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeUint16(e[s],t)},d.prototype.writeUint8Array=function(e){if(this._realloc(e.length*1),e instanceof Uint8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint8Array(e.length);else for(var t=0;t<e.length;t++)this.writeUint8(e[t])},d.prototype.writeFloat64Array=function(e,t){if(this._realloc(e.length*8),e instanceof Float64Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat64Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeFloat64(e[s],t)},d.prototype.writeFloat32Array=function(e,t){if(this._realloc(e.length*4),e instanceof Float32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)d.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat32Array(e.length,t);else for(var s=0;s<e.length;s++)this.writeFloat32(e[s],t)},d.prototype.writeInt32=function(e,t){this._realloc(4),this._dataView.setInt32(this.position,e,t??this.endianness),this.position+=4},d.prototype.writeInt16=function(e,t){this._realloc(2),this._dataView.setInt16(this.position,e,t??this.endianness),this.position+=2},d.prototype.writeInt8=function(e){this._realloc(1),this._dataView.setInt8(this.position,e),this.position+=1},d.prototype.writeUint32=function(e,t){this._realloc(4),this._dataView.setUint32(this.position,e,t??this.endianness),this.position+=4},d.prototype.writeUint16=function(e,t){this._realloc(2),this._dataView.setUint16(this.position,e,t??this.endianness),this.position+=2},d.prototype.writeUint8=function(e){this._realloc(1),this._dataView.setUint8(this.position,e),this.position+=1},d.prototype.writeFloat32=function(e,t){this._realloc(4),this._dataView.setFloat32(this.position,e,t??this.endianness),this.position+=4},d.prototype.writeFloat64=function(e,t){this._realloc(8),this._dataView.setFloat64(this.position,e,t??this.endianness),this.position+=8},d.prototype.writeUCS2String=function(e,t,s){s==null&&(s=e.length);for(var l=0;l<e.length&&l<s;l++)this.writeUint16(e.charCodeAt(l),t);for(;l<s;l++)this.writeUint16(0)},d.prototype.writeString=function(e,t,s){var l=0;if(t==null||t=="ASCII")if(s!=null){var h=Math.min(e.length,s);for(l=0;l<h;l++)this.writeUint8(e.charCodeAt(l));for(;l<s;l++)this.writeUint8(0)}else for(l=0;l<e.length;l++)this.writeUint8(e.charCodeAt(l));else this.writeUint8Array(new TextEncoder(t).encode(e.substring(0,s)))},d.prototype.writeCString=function(e,t){var s=0;if(t!=null){var l=Math.min(e.length,t);for(s=0;s<l;s++)this.writeUint8(e.charCodeAt(s));for(;s<t;s++)this.writeUint8(0)}else{for(s=0;s<e.length;s++)this.writeUint8(e.charCodeAt(s));this.writeUint8(0)}},d.prototype.writeStruct=function(e,t){for(var s=0;s<e.length;s+=2){var l=e[s+1];this.writeType(l,t[e[s]],t)}},d.prototype.writeType=function(e,t,s){var l;if(typeof e=="function")return e(this,t);if(typeof e=="object"&&!(e instanceof Array))return e.set(this,t,s);var h=null,m="ASCII",y=this.position;switch(typeof e=="string"&&/:/.test(e)&&(l=e.split(":"),e=l[0],h=parseInt(l[1])),typeof e=="string"&&/,/.test(e)&&(l=e.split(","),e=l[0],m=parseInt(l[1])),e){case"uint8":this.writeUint8(t);break;case"int8":this.writeInt8(t);break;case"uint16":this.writeUint16(t,this.endianness);break;case"int16":this.writeInt16(t,this.endianness);break;case"uint32":this.writeUint32(t,this.endianness);break;case"int32":this.writeInt32(t,this.endianness);break;case"float32":this.writeFloat32(t,this.endianness);break;case"float64":this.writeFloat64(t,this.endianness);break;case"uint16be":this.writeUint16(t,d.BIG_ENDIAN);break;case"int16be":this.writeInt16(t,d.BIG_ENDIAN);break;case"uint32be":this.writeUint32(t,d.BIG_ENDIAN);break;case"int32be":this.writeInt32(t,d.BIG_ENDIAN);break;case"float32be":this.writeFloat32(t,d.BIG_ENDIAN);break;case"float64be":this.writeFloat64(t,d.BIG_ENDIAN);break;case"uint16le":this.writeUint16(t,d.LITTLE_ENDIAN);break;case"int16le":this.writeInt16(t,d.LITTLE_ENDIAN);break;case"uint32le":this.writeUint32(t,d.LITTLE_ENDIAN);break;case"int32le":this.writeInt32(t,d.LITTLE_ENDIAN);break;case"float32le":this.writeFloat32(t,d.LITTLE_ENDIAN);break;case"float64le":this.writeFloat64(t,d.LITTLE_ENDIAN);break;case"cstring":this.writeCString(t,h);break;case"string":this.writeString(t,m,h);break;case"u16string":this.writeUCS2String(t,this.endianness,h);break;case"u16stringle":this.writeUCS2String(t,d.LITTLE_ENDIAN,h);break;case"u16stringbe":this.writeUCS2String(t,d.BIG_ENDIAN,h);break;default:if(e.length==3){for(var b=e[1],x=0;x<t.length;x++)this.writeType(b,t[x]);break}else{this.writeStruct(e,t);break}}h!=null&&(this.position=y,this._realloc(h),this.position=y+h)},d.prototype.writeUint64=function(e){var t=Math.floor(e/c);this.writeUint32(t),this.writeUint32(e&4294967295)},d.prototype.writeUint24=function(e){this.writeUint8((e&16711680)>>16),this.writeUint8((e&65280)>>8),this.writeUint8(e&255)},d.prototype.adjustUint32=function(e,t){var s=this.position;this.seek(e),this.writeUint32(t),this.seek(s)},d.prototype.mapInt32Array=function(e,t){this._realloc(e*4);var s=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*4,s},d.prototype.mapInt16Array=function(e,t){this._realloc(e*2);var s=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*2,s},d.prototype.mapInt8Array=function(e){this._realloc(e*1);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=e*1,t},d.prototype.mapUint32Array=function(e,t){this._realloc(e*4);var s=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*4,s},d.prototype.mapUint16Array=function(e,t){this._realloc(e*2);var s=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*2,s},d.prototype.mapFloat64Array=function(e,t){this._realloc(e*8);var s=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*8,s},d.prototype.mapFloat32Array=function(e,t){this._realloc(e*4);var s=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(s,t??this.endianness),this.position+=e*4,s};var f=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};f.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN),f.prototype.initialized=function(){var e;return this.bufferIndex>-1?!0:this.buffers.length>0?(e=this.buffers[0],e.fileStart===0?(this.buffer=e,this.bufferIndex=0,n.debug("MultiBufferStream","Stream ready for parsing"),!0):(n.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1)):(n.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1)},ArrayBuffer.concat=function(e,t){n.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var s=new Uint8Array(e.byteLength+t.byteLength);return s.set(new Uint8Array(e),0),s.set(new Uint8Array(t),e.byteLength),s.buffer},f.prototype.reduceBuffer=function(e,t,s){var l;return l=new Uint8Array(s),l.set(new Uint8Array(e,t,s)),l.buffer.fileStart=e.fileStart+t,l.buffer.usedBytes=0,l.buffer},f.prototype.insertBuffer=function(e){for(var t=!0,s=0;s<this.buffers.length;s++){var l=this.buffers[s];if(e.fileStart<=l.fileStart){if(e.fileStart===l.fileStart)if(e.byteLength>l.byteLength){this.buffers.splice(s,1),s--;continue}else n.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring");else e.fileStart+e.byteLength<=l.fileStart||(e=this.reduceBuffer(e,0,l.fileStart-e.fileStart)),n.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(s,0,e),s===0&&(this.buffer=e);t=!1;break}else if(e.fileStart<l.fileStart+l.byteLength){var h=l.fileStart+l.byteLength-e.fileStart,m=e.byteLength-h;if(m>0)e=this.reduceBuffer(e,h,m);else{t=!1;break}}}t&&(n.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),s===0&&(this.buffer=e))},f.prototype.logBufferLevel=function(e){var t,s,l,h,m=[],y,b="";for(l=0,h=0,t=0;t<this.buffers.length;t++)s=this.buffers[t],t===0?(y={},m.push(y),y.start=s.fileStart,y.end=s.fileStart+s.byteLength,b+="["+y.start+"-"):y.end===s.fileStart?y.end=s.fileStart+s.byteLength:(y={},y.start=s.fileStart,b+=m[m.length-1].end-1+"], ["+y.start+"-",y.end=s.fileStart+s.byteLength,m.push(y)),l+=s.usedBytes,h+=s.byteLength;m.length>0&&(b+=y.end-1+"]");var x=e?n.info:n.debug;this.buffers.length===0?x("MultiBufferStream","No more buffer in memory"):x("MultiBufferStream",""+this.buffers.length+" stored buffer(s) ("+l+"/"+h+" bytes), continuous ranges: "+b)},f.prototype.cleanBuffers=function(){var e,t;for(e=0;e<this.buffers.length;e++)t=this.buffers[e],t.usedBytes===t.byteLength&&(n.debug("MultiBufferStream","Removing buffer #"+e),this.buffers.splice(e,1),e--)},f.prototype.mergeNextBuffer=function(){var e;if(this.bufferIndex+1<this.buffers.length)if(e=this.buffers[this.bufferIndex+1],e.fileStart===this.buffer.fileStart+this.buffer.byteLength){var t=this.buffer.byteLength,s=this.buffer.usedBytes,l=this.buffer.fileStart;return this.buffers[this.bufferIndex]=ArrayBuffer.concat(this.buffer,e),this.buffer=this.buffers[this.bufferIndex],this.buffers.splice(this.bufferIndex+1,1),this.buffer.usedBytes=s,this.buffer.fileStart=l,n.debug("ISOFile","Concatenating buffer for box parsing (length: "+t+"->"+this.buffer.byteLength+")"),!0}else return!1;else return!1},f.prototype.findPosition=function(e,t,s){var l,h=null,m=-1;for(e===!0?l=0:l=this.bufferIndex;l<this.buffers.length&&(h=this.buffers[l],h.fileStart<=t);){m=l,s&&(h.fileStart+h.byteLength<=t?h.usedBytes=h.byteLength:h.usedBytes=t-h.fileStart,this.logBufferLevel());l++}return m!==-1?(h=this.buffers[m],h.fileStart+h.byteLength>=t?(n.debug("MultiBufferStream","Found position in existing buffer #"+m),m):-1):-1},f.prototype.findEndContiguousBuf=function(e){var t,s,l,h=e!==void 0?e:this.bufferIndex;if(s=this.buffers[h],this.buffers.length>h+1)for(t=h+1;t<this.buffers.length&&(l=this.buffers[t],l.fileStart===s.fileStart+s.byteLength);t++)s=l;return s.fileStart+s.byteLength},f.prototype.getEndFilePositionAfter=function(e){var t=this.findPosition(!0,e,!1);return t!==-1?this.findEndContiguousBuf(t):e},f.prototype.addUsedBytes=function(e){this.buffer.usedBytes+=e,this.logBufferLevel()},f.prototype.setAllUsedBytes=function(){this.buffer.usedBytes=this.buffer.byteLength,this.logBufferLevel()},f.prototype.seek=function(e,t,s){var l;return l=this.findPosition(t,e,s),l!==-1?(this.buffer=this.buffers[l],this.bufferIndex=l,this.position=e-this.buffer.fileStart,n.debug("MultiBufferStream","Repositioning parser at buffer position: "+this.position),!0):(n.debug("MultiBufferStream","Position "+e+" not found in buffered data"),!1)},f.prototype.getPosition=function(){if(this.bufferIndex===-1||this.buffers[this.bufferIndex]===null)throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.position},f.prototype.getLength=function(){return this.byteLength},f.prototype.getEndPosition=function(){if(this.bufferIndex===-1||this.buffers[this.bufferIndex]===null)throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.byteLength},a.MultiBufferStream=f;var u=function(){var e=3,t=4,s=5,l=6,h=[];h[e]="ES_Descriptor",h[t]="DecoderConfigDescriptor",h[s]="DecoderSpecificInfo",h[l]="SLConfigDescriptor",this.getDescriptorName=function(b){return h[b]};var m=this,y={};return this.parseOneDescriptor=function(b){var x=0,w,T,C;for(w=b.readUint8(),C=b.readUint8();C&128;)x=(x<<7)+(C&127),C=b.readUint8();return x=(x<<7)+(C&127),n.debug("MPEG4DescriptorParser","Found "+(h[w]||"Descriptor "+w)+", size "+x+" at position "+b.getPosition()),h[w]?T=new y[h[w]](x):T=new y.Descriptor(x),T.parse(b),T},y.Descriptor=function(b,x){this.tag=b,this.size=x,this.descs=[]},y.Descriptor.prototype.parse=function(b){this.data=b.readUint8Array(this.size)},y.Descriptor.prototype.findDescriptor=function(b){for(var x=0;x<this.descs.length;x++)if(this.descs[x].tag==b)return this.descs[x];return null},y.Descriptor.prototype.parseRemainingDescriptors=function(b){for(var x=b.position;b.position<x+this.size;){var w=m.parseOneDescriptor(b);this.descs.push(w)}},y.ES_Descriptor=function(b){y.Descriptor.call(this,e,b)},y.ES_Descriptor.prototype=new y.Descriptor,y.ES_Descriptor.prototype.parse=function(b){if(this.ES_ID=b.readUint16(),this.flags=b.readUint8(),this.size-=3,this.flags&128?(this.dependsOn_ES_ID=b.readUint16(),this.size-=2):this.dependsOn_ES_ID=0,this.flags&64){var x=b.readUint8();this.URL=b.readString(x),this.size-=x+1}else this.URL="";this.flags&32?(this.OCR_ES_ID=b.readUint16(),this.size-=2):this.OCR_ES_ID=0,this.parseRemainingDescriptors(b)},y.ES_Descriptor.prototype.getOTI=function(b){var x=this.findDescriptor(t);return x?x.oti:0},y.ES_Descriptor.prototype.getAudioConfig=function(b){var x=this.findDescriptor(t);if(!x)return null;var w=x.findDescriptor(s);if(w&&w.data){var T=(w.data[0]&248)>>3;return T===31&&w.data.length>=2&&(T=32+((w.data[0]&7)<<3)+((w.data[1]&224)>>5)),T}else return null},y.DecoderConfigDescriptor=function(b){y.Descriptor.call(this,t,b)},y.DecoderConfigDescriptor.prototype=new y.Descriptor,y.DecoderConfigDescriptor.prototype.parse=function(b){this.oti=b.readUint8(),this.streamType=b.readUint8(),this.upStream=(this.streamType>>1&1)!==0,this.streamType=this.streamType>>>2,this.bufferSize=b.readUint24(),this.maxBitrate=b.readUint32(),this.avgBitrate=b.readUint32(),this.size-=13,this.parseRemainingDescriptors(b)},y.DecoderSpecificInfo=function(b){y.Descriptor.call(this,s,b)},y.DecoderSpecificInfo.prototype=new y.Descriptor,y.SLConfigDescriptor=function(b){y.Descriptor.call(this,l,b)},y.SLConfigDescriptor.prototype=new y.Descriptor,this};a.MPEG4DescriptorParser=u;var r={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){r.FullBox.prototype=new r.Box,r.ContainerBox.prototype=new r.Box,r.SampleEntry.prototype=new r.Box,r.TrackGroupTypeBox.prototype=new r.FullBox,r.BASIC_BOXES.forEach(function(e){r.createBoxCtor(e)}),r.FULL_BOXES.forEach(function(e){r.createFullBoxCtor(e)}),r.CONTAINER_BOXES.forEach(function(e){r.createContainerBoxCtor(e[0],null,e[1])})},Box:function(e,t,s){this.type=e,this.size=t,this.uuid=s},FullBox:function(e,t,s){r.Box.call(this,e,t,s),this.flags=0,this.version=0},ContainerBox:function(e,t,s){r.Box.call(this,e,t,s),this.boxes=[]},SampleEntry:function(e,t,s,l){r.ContainerBox.call(this,e,t),this.hdr_size=s,this.start=l},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){r.FullBox.call(this,e,t)},createBoxCtor:function(e,t){r.boxCodes.push(e),r[e+"Box"]=function(s){r.Box.call(this,e,s)},r[e+"Box"].prototype=new r.Box,t&&(r[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){r[e+"Box"]=function(s){r.FullBox.call(this,e,s)},r[e+"Box"].prototype=new r.FullBox,r[e+"Box"].prototype.parse=function(s){this.parseFullHeader(s),t&&t.call(this,s)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,s=0;s<t;s++)this[e[s]+"s"]=[]}},createContainerBoxCtor:function(e,t,s){r[e+"Box"]=function(l){r.ContainerBox.call(this,e,l),r.addSubBoxArrays.call(this,s)},r[e+"Box"].prototype=new r.ContainerBox,t&&(r[e+"Box"].prototype.parse=t)},createMediaSampleEntryCtor:function(e,t,s){r.sampleEntryCodes[e]=[],r[e+"SampleEntry"]=function(l,h){r.SampleEntry.call(this,l,h),r.addSubBoxArrays.call(this,s)},r[e+"SampleEntry"].prototype=new r.SampleEntry,t&&(r[e+"SampleEntry"].prototype.parse=t)},createSampleEntryCtor:function(e,t,s,l){r.sampleEntryCodes[e].push(t),r[t+"SampleEntry"]=function(h){r[e+"SampleEntry"].call(this,t,h),r.addSubBoxArrays.call(this,l)},r[t+"SampleEntry"].prototype=new r[e+"SampleEntry"],s&&(r[t+"SampleEntry"].prototype.parse=s)},createEncryptedSampleEntryCtor:function(e,t,s){r.createSampleEntryCtor.call(this,e,t,s,["sinf"])},createSampleGroupCtor:function(e,t){r[e+"SampleGroupEntry"]=function(s){r.SampleGroupEntry.call(this,e,s)},r[e+"SampleGroupEntry"].prototype=new r.SampleGroupEntry,t&&(r[e+"SampleGroupEntry"].prototype.parse=t)},createTrackGroupCtor:function(e,t){r[e+"TrackGroupTypeBox"]=function(s){r.TrackGroupTypeBox.call(this,e,s)},r[e+"TrackGroupTypeBox"].prototype=new r.TrackGroupTypeBox,t&&(r[e+"TrackGroupTypeBox"].prototype.parse=t)},createUUIDBox:function(e,t,s,l){r.UUIDs.push(e),r.UUIDBoxes[e]=function(h){t?r.FullBox.call(this,"uuid",h,e):s?r.ContainerBox.call(this,"uuid",h,e):r.Box.call(this,"uuid",h,e)},r.UUIDBoxes[e].prototype=t?new r.FullBox:s?new r.ContainerBox:new r.Box,l&&(t?r.UUIDBoxes[e].prototype.parse=function(h){this.parseFullHeader(h),l&&l.call(this,h)}:r.UUIDBoxes[e].prototype.parse=l)}};r.initialize(),r.TKHD_FLAG_ENABLED=1,r.TKHD_FLAG_IN_MOVIE=2,r.TKHD_FLAG_IN_PREVIEW=4,r.TFHD_FLAG_BASE_DATA_OFFSET=1,r.TFHD_FLAG_SAMPLE_DESC=2,r.TFHD_FLAG_SAMPLE_DUR=8,r.TFHD_FLAG_SAMPLE_SIZE=16,r.TFHD_FLAG_SAMPLE_FLAGS=32,r.TFHD_FLAG_DUR_EMPTY=65536,r.TFHD_FLAG_DEFAULT_BASE_IS_MOOF=131072,r.TRUN_FLAGS_DATA_OFFSET=1,r.TRUN_FLAGS_FIRST_FLAG=4,r.TRUN_FLAGS_DURATION=256,r.TRUN_FLAGS_SIZE=512,r.TRUN_FLAGS_FLAGS=1024,r.TRUN_FLAGS_CTS_OFFSET=2048,r.Box.prototype.add=function(e){return this.addBox(new r[e+"Box"])},r.Box.prototype.addBox=function(e){return this.boxes.push(e),this[e.type+"s"]?this[e.type+"s"].push(e):this[e.type]=e,e},r.Box.prototype.set=function(e,t){return this[e]=t,this},r.Box.prototype.addEntry=function(e,t){var s=t||"entries";return this[s]||(this[s]=[]),this[s].push(e),this},a.BoxParser=r,r.parseUUID=function(e){return r.parseHex16(e)},r.parseHex16=function(e){for(var t="",s=0;s<16;s++){var l=e.readUint8().toString(16);t+=l.length===1?"0"+l:l}return t},r.parseOneBox=function(e,t,s){var l,h=e.getPosition(),m=0,y,b;if(e.getEndPosition()-h<8)return n.debug("BoxParser","Not enough data in stream to parse the type and size of the box"),{code:r.ERR_NOT_ENOUGH_DATA};if(s&&s<8)return n.debug("BoxParser","Not enough bytes left in the parent box to parse a new box"),{code:r.ERR_NOT_ENOUGH_DATA};var x=e.readUint32(),w=e.readString(4),T=w;if(n.debug("BoxParser","Found box of type \'"+w+"\' and size "+x+" at position "+h),m=8,w=="uuid"){if(e.getEndPosition()-e.getPosition()<16||s-m<16)return e.seek(h),n.debug("BoxParser","Not enough bytes left in the parent box to parse a UUID box"),{code:r.ERR_NOT_ENOUGH_DATA};b=r.parseUUID(e),m+=16,T=b}if(x==1){if(e.getEndPosition()-e.getPosition()<8||s&&s-m<8)return e.seek(h),n.warn("BoxParser",\'Not enough data in stream to parse the extended size of the "\'+w+\'" box\'),{code:r.ERR_NOT_ENOUGH_DATA};x=e.readUint64(),m+=8}else if(x===0){if(s)x=s;else if(w!=="mdat")return n.error("BoxParser","Unlimited box size not supported for type: \'"+w+"\'"),l=new r.Box(w,x),{code:r.OK,box:l,size:l.size}}return x!==0&&x<m?(n.error("BoxParser","Box of type "+w+" has an invalid size "+x+" (too small to be a box)"),{code:r.ERR_NOT_ENOUGH_DATA,type:w,size:x,hdr_size:m,start:h}):x!==0&&s&&x>s?(n.error("BoxParser","Box of type \'"+w+"\' has a size "+x+" greater than its container size "+s),{code:r.ERR_NOT_ENOUGH_DATA,type:w,size:x,hdr_size:m,start:h}):x!==0&&h+x>e.getEndPosition()?(e.seek(h),n.info("BoxParser","Not enough data in stream to parse the entire \'"+w+"\' box"),{code:r.ERR_NOT_ENOUGH_DATA,type:w,size:x,hdr_size:m,start:h}):t?{code:r.OK,type:w,size:x,hdr_size:m,start:h}:(r[w+"Box"]?l=new r[w+"Box"](x):w!=="uuid"?(n.warn("BoxParser","Unknown box type: \'"+w+"\'"),l=new r.Box(w,x),l.has_unparsed_data=!0):r.UUIDBoxes[b]?l=new r.UUIDBoxes[b](x):(n.warn("BoxParser","Unknown uuid type: \'"+b+"\'"),l=new r.Box(w,x),l.uuid=b,l.has_unparsed_data=!0),l.hdr_size=m,l.start=h,l.write===r.Box.prototype.write&&l.type!=="mdat"&&(n.info("BoxParser","\'"+T+"\' box writing not yet implemented, keeping unparsed data in memory for later write"),l.parseDataAndRewind(e)),l.parse(e),y=e.getPosition()-(l.start+l.size),y<0?(n.warn("BoxParser","Parsing of box \'"+T+"\' did not read the entire indicated box data size (missing "+-y+" bytes), seeking forward"),e.seek(l.start+l.size)):y>0&&(n.error("BoxParser","Parsing of box \'"+T+"\' read "+y+" more bytes than the indicated box data size, seeking backwards"),l.size!==0&&e.seek(l.start+l.size)),{code:r.OK,box:l,size:l.size})},r.Box.prototype.parse=function(e){this.type!="mdat"?this.data=e.readUint8Array(this.size-this.hdr_size):this.size===0?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},r.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},r.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},r.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},r.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},r.ContainerBox.prototype.parse=function(e){for(var t,s;e.getPosition()<this.start+this.size;)if(t=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),t.code===r.OK)if(s=t.box,this.boxes.push(s),this.subBoxNames&&this.subBoxNames.indexOf(s.type)!=-1)this[this.subBoxNames[this.subBoxNames.indexOf(s.type)]+"s"].push(s);else{var l=s.type!=="uuid"?s.type:s.uuid;this[l]?n.warn("Box of type "+l+" already stored in field of this type"):this[l]=s}else return},r.Box.prototype.parseLanguage=function(e){this.language=e.readUint16();var t=[];t[0]=this.language>>10&31,t[1]=this.language>>5&31,t[2]=this.language&31,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},r.SAMPLE_ENTRY_TYPE_VISUAL="Visual",r.SAMPLE_ENTRY_TYPE_AUDIO="Audio",r.SAMPLE_ENTRY_TYPE_HINT="Hint",r.SAMPLE_ENTRY_TYPE_METADATA="Metadata",r.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",r.SAMPLE_ENTRY_TYPE_SYSTEM="System",r.SAMPLE_ENTRY_TYPE_TEXT="Text",r.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},r.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},r.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},r.SampleEntry.prototype.parseFooter=function(e){r.ContainerBox.prototype.parse.call(this,e)},r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_HINT),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SYSTEM),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_TEXT),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)}),r.createMediaSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"fLaC"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_TEXT,"enct"),r.createEncryptedSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA,"encm"),r.createBoxCtor("a1lx",function(e){var t=e.readUint8()&1,s=((t&1)+1)*16;this.layer_size=[];for(var l=0;l<3;l++)s==16?this.layer_size[l]=e.readUint16():this.layer_size[l]=e.readUint32()}),r.createBoxCtor("a1op",function(e){this.op_index=e.readUint8()}),r.createFullBoxCtor("auxC",function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)}),r.createBoxCtor("av1C",function(e){var t=e.readUint8();if(t>>7&!1){n.error("av1C marker problem");return}if(this.version=t&127,this.version!==1){n.error("av1C version "+this.version+" not supported");return}if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=t&31,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=t&3,t=e.readUint8(),this.reserved_1=t>>5&7,this.reserved_1!==0){n.error("av1C reserved_1 parsing problem");return}if(this.initial_presentation_delay_present=t>>4&1,this.initial_presentation_delay_present===1)this.initial_presentation_delay_minus_one=t&15;else if(this.reserved_2=t&15,this.reserved_2!==0){n.error("av1C reserved_2 parsing problem");return}var s=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(s)}),r.createBoxCtor("avcC",function(e){var t,s;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=e.readUint8()&3,this.nb_SPS_nalus=e.readUint8()&31,s=this.size-this.hdr_size-6,this.SPS=[],t=0;t<this.nb_SPS_nalus;t++)this.SPS[t]={},this.SPS[t].length=e.readUint16(),this.SPS[t].nalu=e.readUint8Array(this.SPS[t].length),s-=2+this.SPS[t].length;for(this.nb_PPS_nalus=e.readUint8(),s--,this.PPS=[],t=0;t<this.nb_PPS_nalus;t++)this.PPS[t]={},this.PPS[t].length=e.readUint16(),this.PPS[t].nalu=e.readUint8Array(this.PPS[t].length),s-=2+this.PPS[t].length;s>0&&(this.ext=e.readUint8Array(s))}),r.createBoxCtor("btrt",function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()}),r.createFullBoxCtor("ccst",function(e){var t=e.readUint8();this.all_ref_pics_intra=(t&128)==128,this.intra_pred_used=(t&64)==64,this.max_ref_per_pic=(t&63)>>2,e.readUint24()}),r.createBoxCtor("cdef",function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t<this.channel_count;t++)this.channel_indexes.push(e.readUint16()),this.channel_types.push(e.readUint16()),this.channel_associations.push(e.readUint16())}),r.createBoxCtor("clap",function(e){this.cleanApertureWidthN=e.readUint32(),this.cleanApertureWidthD=e.readUint32(),this.cleanApertureHeightN=e.readUint32(),this.cleanApertureHeightD=e.readUint32(),this.horizOffN=e.readUint32(),this.horizOffD=e.readUint32(),this.vertOffN=e.readUint32(),this.vertOffD=e.readUint32()}),r.createBoxCtor("clli",function(e){this.max_content_light_level=e.readUint16(),this.max_pic_average_light_level=e.readUint16()}),r.createFullBoxCtor("cmex",function(e){this.flags&1&&(this.pos_x=e.readInt32()),this.flags&2&&(this.pos_y=e.readInt32()),this.flags&4&&(this.pos_z=e.readInt32()),this.flags&8&&(this.version==0?this.flags&16?(this.quat_x=e.readInt32(),this.quat_y=e.readInt32(),this.quat_z=e.readInt32()):(this.quat_x=e.readInt16(),this.quat_y=e.readInt16(),this.quat_z=e.readInt16()):this.version==1),this.flags&32&&(this.id=e.readUint32())}),r.createFullBoxCtor("cmin",function(e){this.focal_length_x=e.readInt32(),this.principal_point_x=e.readInt32(),this.principal_point_y=e.readInt32(),this.flags&1&&(this.focal_length_y=e.readInt32(),this.skew_factor=e.readInt32())}),r.createBoxCtor("cmpd",function(e){for(this.component_count=e.readUint32(),this.component_types=[],this.component_type_urls=[],i=0;i<this.component_count;i++){var t=e.readUint16();this.component_types.push(t),t>=32768&&this.component_type_urls.push(e.readCString())}}),r.createFullBoxCtor("co64",function(e){var t,s;if(t=e.readUint32(),this.chunk_offsets=[],this.version===0)for(s=0;s<t;s++)this.chunk_offsets.push(e.readUint64())}),r.createFullBoxCtor("CoLL",function(e){this.maxCLL=e.readUint16(),this.maxFALL=e.readUint16()}),r.createBoxCtor("colr",function(e){if(this.colour_type=e.readString(4),this.colour_type==="nclx"){this.colour_primaries=e.readUint16(),this.transfer_characteristics=e.readUint16(),this.matrix_coefficients=e.readUint16();var t=e.readUint8();this.full_range_flag=t>>7}else this.colour_type==="rICC"?this.ICC_profile=e.readUint8Array(this.size-4):this.colour_type==="prof"&&(this.ICC_profile=e.readUint8Array(this.size-4))}),r.createFullBoxCtor("cprt",function(e){this.parseLanguage(e),this.notice=e.readCString()}),r.createFullBoxCtor("cslg",function(e){this.version===0&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())}),r.createFullBoxCtor("ctts",function(e){var t,s;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],this.version===0)for(s=0;s<t;s++){this.sample_counts.push(e.readUint32());var l=e.readInt32();l<0&&n.warn("BoxParser","ctts box uses negative values without using version 1"),this.sample_offsets.push(l)}else if(this.version==1)for(s=0;s<t;s++)this.sample_counts.push(e.readUint32()),this.sample_offsets.push(e.readInt32())}),r.createBoxCtor("dac3",function(e){var t=e.readUint8(),s=e.readUint8(),l=e.readUint8();this.fscod=t>>6,this.bsid=t>>1&31,this.bsmod=(t&1)<<2|s>>6&3,this.acmod=s>>3&7,this.lfeon=s>>2&1,this.bit_rate_code=s&3|l>>5&7}),r.createBoxCtor("dec3",function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=t&7,this.ind_subs=[];for(var s=0;s<this.num_ind_sub+1;s++){var l={};this.ind_subs.push(l);var h=e.readUint8(),m=e.readUint8(),y=e.readUint8();l.fscod=h>>6,l.bsid=h>>1&31,l.bsmod=(h&1)<<4|m>>4&15,l.acmod=m>>1&7,l.lfeon=m&1,l.num_dep_sub=y>>1&15,l.num_dep_sub>0&&(l.chan_loc=(y&1)<<8|e.readUint8())}}),r.createFullBoxCtor("dfLa",function(e){var t=127,s=128,l=[],h=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];do{var m=e.readUint8(),y=Math.min(m&t,h.length-1);if(y?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),l.push(h[y]),m&s)break}while(!0);this.numMetadataBlocks=l.length+" ("+l.join(", ")+")"}),r.createBoxCtor("dimm",function(e){this.bytessent=e.readUint64()}),r.createBoxCtor("dmax",function(e){this.time=e.readUint32()}),r.createBoxCtor("dmed",function(e){this.bytessent=e.readUint64()}),r.createBoxCtor("dOps",function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),this.ChannelMappingFamily!==0){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t<this.OutputChannelCount;t++)this.ChannelMapping[t]=e.readUint8()}}),r.createFullBoxCtor("dref",function(e){var t,s;this.entries=[];for(var l=e.readUint32(),h=0;h<l;h++)if(t=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),t.code===r.OK)s=t.box,this.entries.push(s);else return}),r.createBoxCtor("drep",function(e){this.bytessent=e.readUint64()}),r.createFullBoxCtor("elng",function(e){this.extended_language=e.readString(this.size-this.hdr_size)}),r.createFullBoxCtor("elst",function(e){this.entries=[];for(var t=e.readUint32(),s=0;s<t;s++){var l={};this.entries.push(l),this.version===1?(l.segment_duration=e.readUint64(),l.media_time=e.readInt64()):(l.segment_duration=e.readUint32(),l.media_time=e.readInt32()),l.media_rate_integer=e.readInt16(),l.media_rate_fraction=e.readInt16()}}),r.createFullBoxCtor("emsg",function(e){this.version==1?(this.timescale=e.readUint32(),this.presentation_time=e.readUint64(),this.event_duration=e.readUint32(),this.id=e.readUint32(),this.scheme_id_uri=e.readCString(),this.value=e.readCString()):(this.scheme_id_uri=e.readCString(),this.value=e.readCString(),this.timescale=e.readUint32(),this.presentation_time_delta=e.readUint32(),this.event_duration=e.readUint32(),this.id=e.readUint32());var t=this.size-this.hdr_size-(4*4+(this.scheme_id_uri.length+1)+(this.value.length+1));this.version==1&&(t-=4),this.message_data=e.readUint8Array(t)}),r.createEntityToGroupCtor=function(e,t){r[e+"Box"]=function(s){r.FullBox.call(this,e,s)},r[e+"Box"].prototype=new r.FullBox,r[e+"Box"].prototype.parse=function(s){if(this.parseFullHeader(s),t)t.call(this,s);else for(this.group_id=s.readUint32(),this.num_entities_in_group=s.readUint32(),this.entity_ids=[],i=0;i<this.num_entities_in_group;i++){var l=s.readUint32();this.entity_ids.push(l)}}},r.createEntityToGroupCtor("aebr"),r.createEntityToGroupCtor("afbr"),r.createEntityToGroupCtor("albc"),r.createEntityToGroupCtor("altr"),r.createEntityToGroupCtor("brst"),r.createEntityToGroupCtor("dobr"),r.createEntityToGroupCtor("eqiv"),r.createEntityToGroupCtor("favc"),r.createEntityToGroupCtor("fobr"),r.createEntityToGroupCtor("iaug"),r.createEntityToGroupCtor("pano"),r.createEntityToGroupCtor("slid"),r.createEntityToGroupCtor("ster"),r.createEntityToGroupCtor("tsyn"),r.createEntityToGroupCtor("wbbr"),r.createEntityToGroupCtor("prgr"),r.createEntityToGroupCtor("pymd",function(e){this.group_id=e.readUint32(),this.num_entities_in_group=e.readUint32(),this.entity_ids=[];for(var t=0;t<this.num_entities_in_group;t++){var s=e.readUint32();this.entity_ids.push(s)}for(this.tile_size_x=e.readUint16(),this.tile_size_y=e.readUint16(),this.layer_binning=[],this.tiles_in_layer_column_minus1=[],this.tiles_in_layer_row_minus1=[],t=0;t<this.num_entities_in_group;t++)this.layer_binning[t]=e.readUint16(),this.tiles_in_layer_row_minus1[t]=e.readUint16(),this.tiles_in_layer_column_minus1[t]=e.readUint16()}),r.createFullBoxCtor("esds",function(e){var t=e.readUint8Array(this.size-this.hdr_size);if(typeof u<"u"){var s=new u;this.esd=s.parseOneDescriptor(new d(t.buffer,0,d.BIG_ENDIAN))}}),r.createBoxCtor("fiel",function(e){this.fieldCount=e.readUint8(),this.fieldOrdering=e.readUint8()}),r.createBoxCtor("frma",function(e){this.data_format=e.readString(4)}),r.createBoxCtor("ftyp",function(e){var t=this.size-this.hdr_size;this.major_brand=e.readString(4),this.minor_version=e.readUint32(),t-=8,this.compatible_brands=[];for(var s=0;t>=4;)this.compatible_brands[s]=e.readString(4),t-=4,s++}),r.createFullBoxCtor("hdlr",function(e){this.version===0&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),this.name[this.name.length-1]==="\\0"&&(this.name=this.name.slice(0,-1)))}),r.createBoxCtor("hvcC",function(e){var t,s,l,h;this.configurationVersion=e.readUint8(),h=e.readUint8(),this.general_profile_space=h>>6,this.general_tier_flag=(h&32)>>5,this.general_profile_idc=h&31,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=e.readUint16()&4095,this.parallelismType=e.readUint8()&3,this.chroma_format_idc=e.readUint8()&3,this.bit_depth_luma_minus8=e.readUint8()&7,this.bit_depth_chroma_minus8=e.readUint8()&7,this.avgFrameRate=e.readUint16(),h=e.readUint8(),this.constantFrameRate=h>>6,this.numTemporalLayers=(h&13)>>3,this.temporalIdNested=(h&4)>>2,this.lengthSizeMinusOne=h&3,this.nalu_arrays=[];var m=e.readUint8();for(t=0;t<m;t++){var y=[];this.nalu_arrays.push(y),h=e.readUint8(),y.completeness=(h&128)>>7,y.nalu_type=h&63;var b=e.readUint16();for(s=0;s<b;s++){var x={};y.push(x),l=e.readUint16(),x.data=e.readUint8Array(l)}}}),r.createFullBoxCtor("iinf",function(e){var t;this.version===0?this.entry_count=e.readUint16():this.entry_count=e.readUint32(),this.item_infos=[];for(var s=0;s<this.entry_count;s++)if(t=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),t.code===r.OK)t.box.type!=="infe"&&n.error("BoxParser","Expected \'infe\' box, got "+t.box.type),this.item_infos[s]=t.box;else return}),r.createFullBoxCtor("iloc",function(e){var t;t=e.readUint8(),this.offset_size=t>>4&15,this.length_size=t&15,t=e.readUint8(),this.base_offset_size=t>>4&15,this.version===1||this.version===2?this.index_size=t&15:this.index_size=0,this.items=[];var s=0;if(this.version<2)s=e.readUint16();else if(this.version===2)s=e.readUint32();else throw"version of iloc box not supported";for(var l=0;l<s;l++){var h={};if(this.items.push(h),this.version<2)h.item_ID=e.readUint16();else if(this.version===2)h.item_ID=e.readUint32();else throw"version of iloc box not supported";switch(this.version===1||this.version===2?h.construction_method=e.readUint16()&15:h.construction_method=0,h.data_reference_index=e.readUint16(),this.base_offset_size){case 0:h.base_offset=0;break;case 4:h.base_offset=e.readUint32();break;case 8:h.base_offset=e.readUint64();break;default:throw"Error reading base offset size"}var m=e.readUint16();h.extents=[];for(var y=0;y<m;y++){var b={};if(h.extents.push(b),this.version===1||this.version===2)switch(this.index_size){case 0:b.extent_index=0;break;case 4:b.extent_index=e.readUint32();break;case 8:b.extent_index=e.readUint64();break;default:throw"Error reading extent index"}switch(this.offset_size){case 0:b.extent_offset=0;break;case 4:b.extent_offset=e.readUint32();break;case 8:b.extent_offset=e.readUint64();break;default:throw"Error reading extent index"}switch(this.length_size){case 0:b.extent_length=0;break;case 4:b.extent_length=e.readUint32();break;case 8:b.extent_length=e.readUint64();break;default:throw"Error reading extent index"}}}}),r.createBoxCtor("imir",function(e){var t=e.readUint8();this.reserved=t>>7,this.axis=t&1}),r.createFullBoxCtor("infe",function(e){if((this.version===0||this.version===1)&&(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),this.version===1){this.extension_type=e.readString(4),n.warn("BoxParser","Cannot parse extension type"),e.seek(this.start+this.size);return}this.version>=2&&(this.version===2?this.item_ID=e.readUint16():this.version===3&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),this.item_type==="mime"?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):this.item_type==="uri "&&(this.item_uri_type=e.readCString()))}),r.createFullBoxCtor("ipma",function(e){var t,s;for(entry_count=e.readUint32(),this.associations=[],t=0;t<entry_count;t++){var l={};this.associations.push(l),this.version<1?l.id=e.readUint16():l.id=e.readUint32();var h=e.readUint8();for(l.props=[],s=0;s<h;s++){var m=e.readUint8(),y={};l.props.push(y),y.essential=(m&128)>>7===1,this.flags&1?y.property_index=(m&127)<<8|e.readUint8():y.property_index=m&127}}}),r.createFullBoxCtor("iref",function(e){var t,s;for(this.references=[];e.getPosition()<this.start+this.size;)if(t=r.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),t.code===r.OK)this.version===0?s=new r.SingleItemTypeReferenceBox(t.type,t.size,t.hdr_size,t.start):s=new r.SingleItemTypeReferenceBoxLarge(t.type,t.size,t.hdr_size,t.start),s.write===r.Box.prototype.write&&s.type!=="mdat"&&(n.warn("BoxParser",s.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),this.references.push(s);else return}),r.createBoxCtor("irot",function(e){this.angle=e.readUint8()&3}),r.createFullBoxCtor("ispe",function(e){this.image_width=e.readUint32(),this.image_height=e.readUint32()}),r.createFullBoxCtor("kind",function(e){this.schemeURI=e.readCString(),this.value=e.readCString()}),r.createFullBoxCtor("leva",function(e){var t=e.readUint8();this.levels=[];for(var s=0;s<t;s++){var l={};this.levels[s]=l,l.track_ID=e.readUint32();var h=e.readUint8();switch(l.padding_flag=h>>7,l.assignment_type=h&127,l.assignment_type){case 0:l.grouping_type=e.readString(4);break;case 1:l.grouping_type=e.readString(4),l.grouping_type_parameter=e.readUint32();break;case 2:break;case 3:break;case 4:l.sub_track_id=e.readUint32();break;default:n.warn("BoxParser","Unknown leva assignement type")}}}),r.createBoxCtor("lhvC",function(e){var t,s,l;this.configurationVersion=e.readUint8(),this.min_spatial_segmentation_idc=e.readUint16()&4095,this.parallelismType=e.readUint8()&3,l=e.readUint8(),this.numTemporalLayers=(l&13)>>3,this.temporalIdNested=(l&4)>>2,this.lengthSizeMinusOne=l&3,this.nalu_arrays=[];var h=e.readUint8();for(t=0;t<h;t++){var m=[];this.nalu_arrays.push(m),l=e.readUint8(),m.completeness=(l&128)>>7,m.nalu_type=l&63;var y=e.readUint16();for(s=0;s<y;s++){var b={};m.push(b);var x=e.readUint16();b.data=e.readUint8Array(x)}}}),r.createBoxCtor("lsel",function(e){this.layer_id=e.readUint16()}),r.createBoxCtor("maxr",function(e){this.period=e.readUint32(),this.bytes=e.readUint32()});function p(e,t){this.x=e,this.y=t}p.prototype.toString=function(){return"("+this.x+","+this.y+")"},r.createBoxCtor("mdcv",function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()}),r.createFullBoxCtor("mdhd",function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()}),r.createFullBoxCtor("mehd",function(e){this.flags&1&&(n.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),this.version==1?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()}),r.createFullBoxCtor("meta",function(e){this.boxes=[],r.ContainerBox.prototype.parse.call(this,e)}),r.createFullBoxCtor("mfhd",function(e){this.sequence_number=e.readUint32()}),r.createFullBoxCtor("mfro",function(e){this._size=e.readUint32()}),r.createFullBoxCtor("mskC",function(e){this.bits_per_pixel=e.readUint8()}),r.createFullBoxCtor("mvhd",function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()}),r.createBoxCtor("npck",function(e){this.packetssent=e.readUint32()}),r.createBoxCtor("nump",function(e){this.packetssent=e.readUint64()}),r.createFullBoxCtor("padb",function(e){var t=e.readUint32();this.padbits=[];for(var s=0;s<Math.floor((t+1)/2);s++)this.padbits=e.readUint8()}),r.createBoxCtor("pasp",function(e){this.hSpacing=e.readUint32(),this.vSpacing=e.readUint32()}),r.createBoxCtor("payl",function(e){this.text=e.readString(this.size-this.hdr_size)}),r.createBoxCtor("payt",function(e){this.payloadID=e.readUint32();var t=e.readUint8();this.rtpmap_string=e.readString(t)}),r.createFullBoxCtor("pdin",function(e){var t=(this.size-this.hdr_size)/8;this.rate=[],this.initial_delay=[];for(var s=0;s<t;s++)this.rate[s]=e.readUint32(),this.initial_delay[s]=e.readUint32()}),r.createFullBoxCtor("pitm",function(e){this.version===0?this.item_id=e.readUint16():this.item_id=e.readUint32()}),r.createFullBoxCtor("pixi",function(e){var t;for(this.num_channels=e.readUint8(),this.bits_per_channels=[],t=0;t<this.num_channels;t++)this.bits_per_channels[t]=e.readUint8()}),r.createBoxCtor("pmax",function(e){this.bytes=e.readUint32()}),r.createFullBoxCtor("prdi",function(e){if(this.step_count=e.readUint16(),this.item_count=[],this.flags&2)for(var t=0;t<this.step_count;t++)this.item_count[t]=e.readUint16()}),r.createFullBoxCtor("prft",function(e){this.ref_track_id=e.readUint32(),this.ntp_timestamp=e.readUint64(),this.version===0?this.media_time=e.readUint32():this.media_time=e.readUint64()}),r.createFullBoxCtor("pssh",function(e){if(this.system_id=r.parseHex16(e),this.version>0){var t=e.readUint32();this.kid=[];for(var s=0;s<t;s++)this.kid[s]=r.parseHex16(e)}var l=e.readUint32();l>0&&(this.data=e.readUint8Array(l))}),r.createFullBoxCtor("clef",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),r.createFullBoxCtor("enof",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),r.createFullBoxCtor("prof",function(e){this.width=e.readUint32(),this.height=e.readUint32()}),r.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),r.createBoxCtor("rtp ",function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)}),r.createFullBoxCtor("saio",function(e){this.flags&1&&(this.aux_info_type=e.readString(4),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var s=0;s<t;s++)this.version===0?this.offset[s]=e.readUint32():this.offset[s]=e.readUint64()}),r.createFullBoxCtor("saiz",function(e){if(this.flags&1&&(this.aux_info_type=e.readString(4),this.aux_info_type_parameter=e.readUint32()),this.default_sample_info_size=e.readUint8(),this.sample_count=e.readUint32(),this.sample_info_size=[],this.default_sample_info_size===0)for(var t=0;t<this.sample_count;t++)this.sample_info_size[t]=e.readUint8()}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA,"mett",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA,"metx",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"sbtt",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"stpp",function(e){this.parseHeader(e),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.auxiliary_mime_types=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"stxt",function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_SUBTITLE,"tx3g",function(e){this.parseHeader(e),this.displayFlags=e.readUint32(),this.horizontal_justification=e.readInt8(),this.vertical_justification=e.readInt8(),this.bg_color_rgba=e.readUint8Array(4),this.box_record=e.readInt16Array(4),this.style_record=e.readUint8Array(12),this.parseFooter(e)}),r.createSampleEntryCtor(r.SAMPLE_ENTRY_TYPE_METADATA,"wvtt",function(e){this.parseHeader(e),this.parseFooter(e)}),r.createSampleGroupCtor("alst",function(e){var t,s=e.readUint16();for(this.first_output_sample=e.readUint16(),this.sample_offset=[],t=0;t<s;t++)this.sample_offset[t]=e.readUint32();var l=this.description_length-4-4*s;for(this.num_output_samples=[],this.num_total_samples=[],t=0;t<l/4;t++)this.num_output_samples[t]=e.readUint16(),this.num_total_samples[t]=e.readUint16()}),r.createSampleGroupCtor("avll",function(e){this.layerNumber=e.readUint8(),this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()}),r.createSampleGroupCtor("avss",function(e){this.subSequenceIdentifier=e.readUint16(),this.layerNumber=e.readUint8();var t=e.readUint8();this.durationFlag=t>>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var s=e.readUint8(),l=0;l<s;l++){var h={};this.dependency.push(h),h.subSeqDirectionFlag=e.readUint8(),h.layerNumber=e.readUint8(),h.subSequenceIdentifier=e.readUint16()}}),r.createSampleGroupCtor("dtrt",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("mvif",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("prol",function(e){this.roll_distance=e.readInt16()}),r.createSampleGroupCtor("rap ",function(e){var t=e.readUint8();this.num_leading_samples_known=t>>7,this.num_leading_samples=t&127}),r.createSampleGroupCtor("rash",function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(this.operation_point_count===1?2:this.operation_point_count*6)+9)n.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(this.operation_point_count===1)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t<this.operation_point_count;t++)this.available_bitrate[t]=e.readUint32(),this.target_rate_share[t]=e.readUint16()}this.maximum_bitrate=e.readUint32(),this.minimum_bitrate=e.readUint32(),this.discard_priority=e.readUint8()}}),r.createSampleGroupCtor("roll",function(e){this.roll_distance=e.readInt16()}),r.SampleGroupEntry.prototype.parse=function(e){n.warn("BoxParser","Unknown Sample Group type: "+this.grouping_type),this.data=e.readUint8Array(this.description_length)},r.createSampleGroupCtor("scif",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("scnm",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("seig",function(e){this.reserved=e.readUint8();var t=e.readUint8();this.crypt_byte_block=t>>4,this.skip_byte_block=t&15,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=r.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,this.isProtected===1&&this.Per_Sample_IV_Size===0&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))}),r.createSampleGroupCtor("stsa",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("sync",function(e){var t=e.readUint8();this.NAL_unit_type=t&63}),r.createSampleGroupCtor("tele",function(e){var t=e.readUint8();this.level_independently_decodable=t>>7}),r.createSampleGroupCtor("tsas",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("tscl",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createSampleGroupCtor("vipr",function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")}),r.createFullBoxCtor("sbgp",function(e){this.grouping_type=e.readString(4),this.version===1?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),s=0;s<t;s++){var l={};this.entries.push(l),l.sample_count=e.readInt32(),l.group_description_index=e.readInt32()}});function _(e,t){this.bad_pixel_row=e,this.bad_pixel_column=t}_.prototype.toString=function(){return"[row: "+this.bad_pixel_row+", column: "+this.bad_pixel_column+"]"},r.createFullBoxCtor("sbpm",function(e){var t;for(this.component_count=e.readUint16(),this.component_index=[],t=0;t<this.component_count;t++)this.component_index.push(e.readUint16());var s=e.readUint8();for(this.correction_applied=(s&128)==128,this.num_bad_rows=e.readUint32(),this.num_bad_cols=e.readUint32(),this.num_bad_pixels=e.readUint32(),this.bad_rows=[],this.bad_columns=[],this.bad_pixels=[],t=0;t<this.num_bad_rows;t++)this.bad_rows.push(e.readUint32());for(t=0;t<this.num_bad_cols;t++)this.bad_columns.push(e.readUint32());for(t=0;t<this.num_bad_pixels;t++){var l=e.readUint32(),h=e.readUint32();this.bad_pixels.push(new _(l,h))}}),r.createFullBoxCtor("schm",function(e){this.scheme_type=e.readString(4),this.scheme_version=e.readUint32(),this.flags&1&&(this.scheme_uri=e.readString(this.size-this.hdr_size-8))}),r.createBoxCtor("sdp ",function(e){this.sdptext=e.readString(this.size-this.hdr_size)}),r.createFullBoxCtor("sdtp",function(e){var t,s=this.size-this.hdr_size;this.is_leading=[],this.sample_depends_on=[],this.sample_is_depended_on=[],this.sample_has_redundancy=[];for(var l=0;l<s;l++)t=e.readUint8(),this.is_leading[l]=t>>6,this.sample_depends_on[l]=t>>4&3,this.sample_is_depended_on[l]=t>>2&3,this.sample_has_redundancy[l]=t&3}),r.createFullBoxCtor("senc"),r.createFullBoxCtor("sgpd",function(e){this.grouping_type=e.readString(4),n.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),this.version===1?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),s=0;s<t;s++){var l;r[this.grouping_type+"SampleGroupEntry"]?l=new r[this.grouping_type+"SampleGroupEntry"](this.grouping_type):l=new r.SampleGroupEntry(this.grouping_type),this.entries.push(l),this.version===1?this.default_length===0?l.description_length=e.readUint32():l.description_length=this.default_length:l.description_length=this.default_length,l.write===r.SampleGroupEntry.prototype.write&&(n.info("BoxParser","SampleGroup for type "+this.grouping_type+" writing not yet implemented, keeping unparsed data in memory for later write"),l.data=e.readUint8Array(l.description_length),e.position-=l.description_length),l.parse(e)}}),r.createFullBoxCtor("sidx",function(e){this.reference_ID=e.readUint32(),this.timescale=e.readUint32(),this.version===0?(this.earliest_presentation_time=e.readUint32(),this.first_offset=e.readUint32()):(this.earliest_presentation_time=e.readUint64(),this.first_offset=e.readUint64()),e.readUint16(),this.references=[];for(var t=e.readUint16(),s=0;s<t;s++){var l={};this.references.push(l);var h=e.readUint32();l.reference_type=h>>31&1,l.referenced_size=h&2147483647,l.subsegment_duration=e.readUint32(),h=e.readUint32(),l.starts_with_SAP=h>>31&1,l.SAP_type=h>>28&7,l.SAP_delta_time=h&268435455}}),r.SingleItemTypeReferenceBox=function(e,t,s,l){r.Box.call(this,e,t),this.hdr_size=s,this.start=l},r.SingleItemTypeReferenceBox.prototype=new r.Box,r.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var s=0;s<t;s++)this.references[s]={},this.references[s].to_item_ID=e.readUint16()},r.SingleItemTypeReferenceBoxLarge=function(e,t,s,l){r.Box.call(this,e,t),this.hdr_size=s,this.start=l},r.SingleItemTypeReferenceBoxLarge.prototype=new r.Box,r.SingleItemTypeReferenceBoxLarge.prototype.parse=function(e){this.from_item_ID=e.readUint32();var t=e.readUint16();this.references=[];for(var s=0;s<t;s++)this.references[s]={},this.references[s].to_item_ID=e.readUint32()},r.createFullBoxCtor("SmDm",function(e){this.primaryRChromaticity_x=e.readUint16(),this.primaryRChromaticity_y=e.readUint16(),this.primaryGChromaticity_x=e.readUint16(),this.primaryGChromaticity_y=e.readUint16(),this.primaryBChromaticity_x=e.readUint16(),this.primaryBChromaticity_y=e.readUint16(),this.whitePointChromaticity_x=e.readUint16(),this.whitePointChromaticity_y=e.readUint16(),this.luminanceMax=e.readUint32(),this.luminanceMin=e.readUint32()}),r.createFullBoxCtor("smhd",function(e){this.balance=e.readUint16(),e.readUint16()}),r.createFullBoxCtor("ssix",function(e){this.subsegments=[];for(var t=e.readUint32(),s=0;s<t;s++){var l={};this.subsegments.push(l),l.ranges=[];for(var h=e.readUint32(),m=0;m<h;m++){var y={};l.ranges.push(y),y.level=e.readUint8(),y.range_size=e.readUint24()}}}),r.createFullBoxCtor("stco",function(e){var t;if(t=e.readUint32(),this.chunk_offsets=[],this.version===0)for(var s=0;s<t;s++)this.chunk_offsets.push(e.readUint32())}),r.createFullBoxCtor("stdp",function(e){var t=(this.size-this.hdr_size)/2;this.priority=[];for(var s=0;s<t;s++)this.priority[s]=e.readUint16()}),r.createFullBoxCtor("sthd"),r.createFullBoxCtor("stri",function(e){this.switch_group=e.readUint16(),this.alternate_group=e.readUint16(),this.sub_track_id=e.readUint32();var t=(this.size-this.hdr_size-8)/4;this.attribute_list=[];for(var s=0;s<t;s++)this.attribute_list[s]=e.readUint32()}),r.createFullBoxCtor("stsc",function(e){var t,s;if(t=e.readUint32(),this.first_chunk=[],this.samples_per_chunk=[],this.sample_description_index=[],this.version===0)for(s=0;s<t;s++)this.first_chunk.push(e.readUint32()),this.samples_per_chunk.push(e.readUint32()),this.sample_description_index.push(e.readUint32())}),r.createFullBoxCtor("stsd",function(e){var t,s,l,h;for(this.entries=[],l=e.readUint32(),t=1;t<=l;t++)if(s=r.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),s.code===r.OK)r[s.type+"SampleEntry"]?(h=new r[s.type+"SampleEntry"](s.size),h.hdr_size=s.hdr_size,h.start=s.start):(n.warn("BoxParser","Unknown sample entry type: "+s.type),h=new r.SampleEntry(s.type,s.size,s.hdr_size,s.start)),h.write===r.SampleEntry.prototype.write&&(n.info("BoxParser","SampleEntry "+h.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),h.parseDataAndRewind(e)),h.parse(e),this.entries.push(h);else return}),r.createFullBoxCtor("stsg",function(e){this.grouping_type=e.readUint32();var t=e.readUint16();this.group_description_index=[];for(var s=0;s<t;s++)this.group_description_index[s]=e.readUint32()}),r.createFullBoxCtor("stsh",function(e){var t,s;if(t=e.readUint32(),this.shadowed_sample_numbers=[],this.sync_sample_numbers=[],this.version===0)for(s=0;s<t;s++)this.shadowed_sample_numbers.push(e.readUint32()),this.sync_sample_numbers.push(e.readUint32())}),r.createFullBoxCtor("stss",function(e){var t,s;if(s=e.readUint32(),this.version===0)for(this.sample_numbers=[],t=0;t<s;t++)this.sample_numbers.push(e.readUint32())}),r.createFullBoxCtor("stsz",function(e){var t;if(this.sample_sizes=[],this.version===0)for(this.sample_size=e.readUint32(),this.sample_count=e.readUint32(),t=0;t<this.sample_count;t++)this.sample_size===0?this.sample_sizes.push(e.readUint32()):this.sample_sizes[t]=this.sample_size}),r.createFullBoxCtor("stts",function(e){var t,s,l;if(t=e.readUint32(),this.sample_counts=[],this.sample_deltas=[],this.version===0)for(s=0;s<t;s++)this.sample_counts.push(e.readUint32()),l=e.readInt32(),l<0&&(n.warn("BoxParser","File uses negative stts sample delta, using value 1 instead, sync may be lost!"),l=1),this.sample_deltas.push(l)}),r.createFullBoxCtor("stvi",function(e){var t=e.readUint32();this.single_view_allowed=t&3,this.stereo_scheme=e.readUint32();var s=e.readUint32();this.stereo_indication_type=e.readString(s);var l,h;for(this.boxes=[];e.getPosition()<this.start+this.size;)if(l=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),l.code===r.OK)h=l.box,this.boxes.push(h),this[h.type]=h;else return}),r.createBoxCtor("styp",function(e){r.ftypBox.prototype.parse.call(this,e)}),r.createFullBoxCtor("stz2",function(e){var t,s;if(this.sample_sizes=[],this.version===0)if(this.reserved=e.readUint24(),this.field_size=e.readUint8(),s=e.readUint32(),this.field_size===4)for(t=0;t<s;t+=2){var l=e.readUint8();this.sample_sizes[t]=l>>4&15,this.sample_sizes[t+1]=l&15}else if(this.field_size===8)for(t=0;t<s;t++)this.sample_sizes[t]=e.readUint8();else if(this.field_size===16)for(t=0;t<s;t++)this.sample_sizes[t]=e.readUint16();else n.error("BoxParser","Error in length field in stz2 box")}),r.createFullBoxCtor("subs",function(e){var t,s,l,h;for(l=e.readUint32(),this.entries=[],t=0;t<l;t++){var m={};if(this.entries[t]=m,m.sample_delta=e.readUint32(),m.subsamples=[],h=e.readUint16(),h>0)for(s=0;s<h;s++){var y={};m.subsamples.push(y),this.version==1?y.size=e.readUint32():y.size=e.readUint16(),y.priority=e.readUint8(),y.discardable=e.readUint8(),y.codec_specific_parameters=e.readUint32()}}}),r.createFullBoxCtor("tenc",function(e){if(e.readUint8(),this.version===0)e.readUint8();else{var t=e.readUint8();this.default_crypt_byte_block=t>>4&15,this.default_skip_byte_block=t&15}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=r.parseHex16(e),this.default_isProtected===1&&this.default_Per_Sample_IV_Size===0&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))}),r.createFullBoxCtor("tfdt",function(e){this.version==1?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()}),r.createFullBoxCtor("tfhd",function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&r.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0}),r.createFullBoxCtor("tfra",function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=t&3,this.entries=[];for(var s=e.readUint32(),l=0;l<s;l++)this.version===1?(this.time=e.readUint64(),this.moof_offset=e.readUint64()):(this.time=e.readUint32(),this.moof_offset=e.readUint32()),this.traf_number=e["readUint"+8*(this.length_size_of_traf_num+1)](),this.trun_number=e["readUint"+8*(this.length_size_of_trun_num+1)](),this.sample_number=e["readUint"+8*(this.length_size_of_sample_num+1)]()}),r.createFullBoxCtor("tkhd",function(e){this.version==1?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint32()),e.readUint32Array(2),this.layer=e.readInt16(),this.alternate_group=e.readInt16(),this.volume=e.readInt16()>>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()}),r.createBoxCtor("tmax",function(e){this.time=e.readUint32()}),r.createBoxCtor("tmin",function(e){this.time=e.readUint32()}),r.createBoxCtor("totl",function(e){this.bytessent=e.readUint32()}),r.createBoxCtor("tpay",function(e){this.bytessent=e.readUint32()}),r.createBoxCtor("tpyl",function(e){this.bytessent=e.readUint64()}),r.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},r.createTrackGroupCtor("msrc"),r.TrackReferenceTypeBox=function(e,t,s,l){r.Box.call(this,e,t),this.hdr_size=s,this.start=l},r.TrackReferenceTypeBox.prototype=new r.Box,r.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},r.trefBox.prototype.parse=function(e){for(var t,s;e.getPosition()<this.start+this.size;)if(t=r.parseOneBox(e,!0,this.size-(e.getPosition()-this.start)),t.code===r.OK)s=new r.TrackReferenceTypeBox(t.type,t.size,t.hdr_size,t.start),s.write===r.Box.prototype.write&&s.type!=="mdat"&&(n.info("BoxParser","TrackReference "+s.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),this.boxes.push(s);else return},r.createFullBoxCtor("trep",function(e){for(this.track_ID=e.readUint32(),this.boxes=[];e.getPosition()<this.start+this.size;)if(ret=r.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),ret.code===r.OK)box=ret.box,this.boxes.push(box);else return}),r.createFullBoxCtor("trex",function(e){this.track_id=e.readUint32(),this.default_sample_description_index=e.readUint32(),this.default_sample_duration=e.readUint32(),this.default_sample_size=e.readUint32(),this.default_sample_flags=e.readUint32()}),r.createBoxCtor("trpy",function(e){this.bytessent=e.readUint64()}),r.createFullBoxCtor("trun",function(e){var t=0;if(this.sample_count=e.readUint32(),t+=4,this.size-this.hdr_size>t&&this.flags&r.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&r.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var s=0;s<this.sample_count;s++)this.flags&r.TRUN_FLAGS_DURATION&&(this.sample_duration[s]=e.readUint32()),this.flags&r.TRUN_FLAGS_SIZE&&(this.sample_size[s]=e.readUint32()),this.flags&r.TRUN_FLAGS_FLAGS&&(this.sample_flags[s]=e.readUint32()),this.flags&r.TRUN_FLAGS_CTS_OFFSET&&(this.version===0?this.sample_composition_time_offset[s]=e.readUint32():this.sample_composition_time_offset[s]=e.readInt32())}),r.createFullBoxCtor("tsel",function(e){this.switch_group=e.readUint32();var t=(this.size-this.hdr_size-4)/4;this.attribute_list=[];for(var s=0;s<t;s++)this.attribute_list[s]=e.readUint32()}),r.createFullBoxCtor("txtC",function(e){this.config=e.readCString()}),r.createBoxCtor("tyco",function(e){var t=(this.size-this.hdr_size)/4;this.compatible_brands=[];for(var s=0;s<t;s++)this.compatible_brands[s]=e.readString(4)}),r.createFullBoxCtor("udes",function(e){this.lang=e.readCString(),this.name=e.readCString(),this.description=e.readCString(),this.tags=e.readCString()}),r.createFullBoxCtor("uncC",function(e){var t;if(this.profile=e.readUint32(),this.version!=1){if(this.version==0){for(this.component_count=e.readUint32(),this.component_index=[],this.component_bit_depth_minus_one=[],this.component_format=[],this.component_align_size=[],t=0;t<this.component_count;t++)this.component_index.push(e.readUint16()),this.component_bit_depth_minus_one.push(e.readUint8()),this.component_format.push(e.readUint8()),this.component_align_size.push(e.readUint8());this.sampling_type=e.readUint8(),this.interleave_type=e.readUint8(),this.block_size=e.readUint8();var s=e.readUint8();this.component_little_endian=s>>7&1,this.block_pad_lsb=s>>6&1,this.block_little_endian=s>>5&1,this.block_reversed=s>>4&1,this.pad_unknown=s>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}}}),r.createFullBoxCtor("url ",function(e){this.flags!==1&&(this.location=e.readCString())}),r.createFullBoxCtor("urn ",function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())}),r.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/\'/g,"'")}),r.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,function(e){this.system_id=r.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))}),r.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),r.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=r.parseHex16(e)}),r.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t<this.fragment_count;t++){var s={},l=0,h=0;this.version===1?(l=e.readUint64(),h=e.readUint64()):(l=e.readUint32(),h=e.readUint32()),s.absolute_time=l,s.absolute_duration=h,this.entries.push(s)}}),r.createUUIDBox("6d1d9b0542d544e680e2141daff757b2",!0,!1,function(e){this.version===1?(this.absolute_time=e.readUint64(),this.duration=e.readUint64()):(this.absolute_time=e.readUint32(),this.duration=e.readUint32())}),r.createFullBoxCtor("vmhd",function(e){this.graphicsmode=e.readUint16(),this.opcolor=e.readUint16Array(3)}),r.createFullBoxCtor("vpcC",function(e){var t;this.version===1?(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=t&1,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=t&15,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=t&1,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))}),r.createBoxCtor("vttC",function(e){this.text=e.readString(this.size-this.hdr_size)}),r.createFullBoxCtor("vvcC",function(e){var t,s,l={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(A){this.held_bits=A.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(A){this.held_bits=A.readUint16(),this.num_held_bits=16},extract_bits:function(A){var R=this.held_bits>>this.num_held_bits-A&(1<<A)-1;return this.num_held_bits-=A,R}};if(l.stream_read_1_bytes(e),l.extract_bits(5),this.lengthSizeMinusOne=l.extract_bits(2),this.ptl_present_flag=l.extract_bits(1),this.ptl_present_flag){l.stream_read_2_bytes(e),this.ols_idx=l.extract_bits(9),this.num_sublayers=l.extract_bits(3),this.constant_frame_rate=l.extract_bits(2),this.chroma_format_idc=l.extract_bits(2),l.stream_read_1_bytes(e),this.bit_depth_minus8=l.extract_bits(3),l.extract_bits(5);{if(l.stream_read_2_bytes(e),l.extract_bits(2),this.num_bytes_constraint_info=l.extract_bits(6),this.general_profile_idc=l.extract_bits(7),this.general_tier_flag=l.extract_bits(1),this.general_level_idc=e.readUint8(),l.stream_read_1_bytes(e),this.ptl_frame_only_constraint_flag=l.extract_bits(1),this.ptl_multilayer_enabled_flag=l.extract_bits(1),this.general_constraint_info=new Uint8Array(this.num_bytes_constraint_info),this.num_bytes_constraint_info){for(t=0;t<this.num_bytes_constraint_info-1;t++){var h=l.extract_bits(6);l.stream_read_1_bytes(e);var m=l.extract_bits(2);this.general_constraint_info[t]=h<<2|m}this.general_constraint_info[this.num_bytes_constraint_info-1]=l.extract_bits(6)}else l.extract_bits(6);if(this.num_sublayers>1){for(l.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,s=this.num_sublayers-2;s>=0;--s){var y=l.extract_bits(1);this.ptl_sublayer_present_mask|=y<<s}for(s=this.num_sublayers;s<=8&&this.num_sublayers>1;++s)l.extract_bits(1);for(this.sublayer_level_idc=[],s=this.num_sublayers-2;s>=0;--s)this.ptl_sublayer_present_mask&1<<s&&(this.sublayer_level_idc[s]=e.readUint8())}if(this.ptl_num_sub_profiles=e.readUint8(),this.general_sub_profile_idc=[],this.ptl_num_sub_profiles)for(t=0;t<this.ptl_num_sub_profiles;t++)this.general_sub_profile_idc.push(e.readUint32())}this.max_picture_width=e.readUint16(),this.max_picture_height=e.readUint16(),this.avg_frame_rate=e.readUint16()}var b=12,x=13;this.nalu_arrays=[];var w=e.readUint8();for(t=0;t<w;t++){var T=[];this.nalu_arrays.push(T),l.stream_read_1_bytes(e),T.completeness=l.extract_bits(1),l.extract_bits(2),T.nalu_type=l.extract_bits(5);var C=1;for(T.nalu_type!=x&&T.nalu_type!=b&&(C=e.readUint16()),s=0;s<C;s++){var F=e.readUint16();T.push({data:e.readUint8Array(F),length:F})}}}),r.createFullBoxCtor("vvnC",function(e){var t=strm.readUint8();this.lengthSizeMinusOne=t&3}),r.SampleEntry.prototype.isVideo=function(){return!1},r.SampleEntry.prototype.isAudio=function(){return!1},r.SampleEntry.prototype.isSubtitle=function(){return!1},r.SampleEntry.prototype.isMetadata=function(){return!1},r.SampleEntry.prototype.isHint=function(){return!1},r.SampleEntry.prototype.getCodec=function(){return this.type.replace(".","")},r.SampleEntry.prototype.getWidth=function(){return""},r.SampleEntry.prototype.getHeight=function(){return""},r.SampleEntry.prototype.getChannelCount=function(){return""},r.SampleEntry.prototype.getSampleRate=function(){return""},r.SampleEntry.prototype.getSampleSize=function(){return""},r.VisualSampleEntry.prototype.isVideo=function(){return!0},r.VisualSampleEntry.prototype.getWidth=function(){return this.width},r.VisualSampleEntry.prototype.getHeight=function(){return this.height},r.AudioSampleEntry.prototype.isAudio=function(){return!0},r.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},r.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},r.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},r.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},r.MetadataSampleEntry.prototype.isMetadata=function(){return!0},r.decimalToHex=function(e,t){var s=Number(e).toString(16);for(t=typeof t>"u"||t===null?t=2:t;s.length<t;)s="0"+s;return s},r.avc1SampleEntry.prototype.getCodec=r.avc2SampleEntry.prototype.getCodec=r.avc3SampleEntry.prototype.getCodec=r.avc4SampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this);return this.avcC?e+"."+r.decimalToHex(this.avcC.AVCProfileIndication)+r.decimalToHex(this.avcC.profile_compatibility)+r.decimalToHex(this.avcC.AVCLevelIndication):e},r.hev1SampleEntry.prototype.getCodec=r.hvc1SampleEntry.prototype.getCodec=function(){var e,t=r.SampleEntry.prototype.getCodec.call(this);if(this.hvcC){switch(t+=".",this.hvcC.general_profile_space){case 0:t+="";break;case 1:t+="A";break;case 2:t+="B";break;case 3:t+="C";break}t+=this.hvcC.general_profile_idc,t+=".";var s=this.hvcC.general_profile_compatibility,l=0;for(e=0;e<32&&(l|=s&1,e!=31);e++)l<<=1,s>>=1;t+=r.decimalToHex(l,0),t+=".",this.hvcC.general_tier_flag===0?t+="L":t+="H",t+=this.hvcC.general_level_idc;var h=!1,m="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||h)&&(m="."+r.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+m,h=!0);t+=m}return t},r.vvc1SampleEntry.prototype.getCodec=r.vvi1SampleEntry.prototype.getCodec=function(){var e,t=r.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var s="";if(this.vvcC.general_constraint_info){var l=[],h=0;h|=this.vvcC.ptl_frame_only_constraint<<7,h|=this.vvcC.ptl_multilayer_enabled<<6;var m;for(e=0;e<this.vvcC.general_constraint_info.length;++e)h|=this.vvcC.general_constraint_info[e]>>2&63,l.push(h),h&&(m=e),h=this.vvcC.general_constraint_info[e]>>2&3;if(m===void 0)s=".CA";else{s=".C";var y="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",b=0,x=0;for(e=0;e<=m;++e)for(b=b<<8|l[e],x+=8;x>=5;){var w=b>>x-5&31;s+=y[w],x-=5,b&=(1<<x)-1}x&&(b<<=5-x,s+=y[b&31])}}t+=s}return t},r.mp4aSampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),s=this.esds.esd.getAudioConfig();return e+"."+r.decimalToHex(t)+(s?"."+s:"")}else return e},r.stxtSampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},r.vp08SampleEntry.prototype.getCodec=r.vp09SampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;t==0&&(t="00");var s=this.vpcC.bitDepth;return s==8&&(s="08"),e+".0"+this.vpcC.profile+"."+t+"."+s},r.av01SampleEntry.prototype.getCodec=function(){var e=r.SampleEntry.prototype.getCodec.call(this),t=this.av1C.seq_level_idx_0;t<10&&(t="0"+t);var s;return this.av1C.seq_profile===2&&this.av1C.high_bitdepth===1?s=this.av1C.twelve_bit===1?"12":"10":this.av1C.seq_profile<=2&&(s=this.av1C.high_bitdepth===1?"10":"08"),e+"."+this.av1C.seq_profile+"."+t+(this.av1C.seq_tier_0?"H":"M")+"."+s},r.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>c&&(this.size+=8),this.type==="uuid"&&(this.size+=16),n.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>c?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),this.type==="uuid"&&e.writeUint8Array(this.uuid),this.size>c&&e.writeUint64(this.size)},r.FullBox.prototype.writeHeader=function(e){this.size+=4,r.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},r.Box.prototype.write=function(e){this.type==="mdat"?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},r.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&(this.boxes[t].write(e),this.size+=this.boxes[t].size);n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.TrackReferenceTypeBox.prototype.write=function(e){this.size=this.track_ids.length*4,this.writeHeader(e),e.writeUint32Array(this.track_ids)},r.avcCBox.prototype.write=function(e){var t;for(this.size=7,t=0;t<this.SPS.length;t++)this.size+=2+this.SPS[t].length;for(t=0;t<this.PPS.length;t++)this.size+=2+this.PPS[t].length;for(this.ext&&(this.size+=this.ext.length),this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8(this.AVCProfileIndication),e.writeUint8(this.profile_compatibility),e.writeUint8(this.AVCLevelIndication),e.writeUint8(this.lengthSizeMinusOne+252),e.writeUint8(this.SPS.length+224),t=0;t<this.SPS.length;t++)e.writeUint16(this.SPS[t].length),e.writeUint8Array(this.SPS[t].nalu);for(e.writeUint8(this.PPS.length),t=0;t<this.PPS.length;t++)e.writeUint16(this.PPS[t].length),e.writeUint8Array(this.PPS[t].nalu);this.ext&&e.writeUint8Array(this.ext)},r.co64Box.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),t=0;t<this.chunk_offsets.length;t++)e.writeUint64(this.chunk_offsets[t])},r.cslgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4*5,this.writeHeader(e),e.writeInt32(this.compositionToDTSShift),e.writeInt32(this.leastDecodeToDisplayDelta),e.writeInt32(this.greatestDecodeToDisplayDelta),e.writeInt32(this.compositionStartTime),e.writeInt32(this.compositionEndTime)},r.cttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),this.version===1?e.writeInt32(this.sample_offsets[t]):e.writeUint32(this.sample_offsets[t])},r.drefBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++)this.entries[t].write(e),this.size+=this.entries[t].size;n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.elngBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.extended_language.length,this.writeHeader(e),e.writeString(this.extended_language)},r.elstBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+12*this.entries.length,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var s=this.entries[t];e.writeUint32(s.segment_duration),e.writeInt32(s.media_time),e.writeInt16(s.media_rate_integer),e.writeInt16(s.media_rate_fraction)}},r.emsgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4*4+this.message_data.length+(this.scheme_id_uri.length+1)+(this.value.length+1),this.writeHeader(e),e.writeCString(this.scheme_id_uri),e.writeCString(this.value),e.writeUint32(this.timescale),e.writeUint32(this.presentation_time_delta),e.writeUint32(this.event_duration),e.writeUint32(this.id),e.writeUint8Array(this.message_data)},r.ftypBox.prototype.write=function(e){this.size=8+4*this.compatible_brands.length,this.writeHeader(e),e.writeString(this.major_brand,null,4),e.writeUint32(this.minor_version);for(var t=0;t<this.compatible_brands.length;t++)e.writeString(this.compatible_brands[t],null,4)},r.hdlrBox.prototype.write=function(e){this.size=5*4+this.name.length+1,this.version=0,this.flags=0,this.writeHeader(e),e.writeUint32(0),e.writeString(this.handler,null,4),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeCString(this.name)},r.hvcCBox.prototype.write=function(e){var t,s;for(this.size=23,t=0;t<this.nalu_arrays.length;t++)for(this.size+=3,s=0;s<this.nalu_arrays[t].length;s++)this.size+=2+this.nalu_arrays[t][s].data.length;for(this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8((this.general_profile_space<<6)+(this.general_tier_flag<<5)+this.general_profile_idc),e.writeUint32(this.general_profile_compatibility),e.writeUint8Array(this.general_constraint_indicator),e.writeUint8(this.general_level_idc),e.writeUint16(this.min_spatial_segmentation_idc+(15<<24)),e.writeUint8(this.parallelismType+252),e.writeUint8(this.chroma_format_idc+252),e.writeUint8(this.bit_depth_luma_minus8+248),e.writeUint8(this.bit_depth_chroma_minus8+248),e.writeUint16(this.avgFrameRate),e.writeUint8((this.constantFrameRate<<6)+(this.numTemporalLayers<<3)+(this.temporalIdNested<<2)+this.lengthSizeMinusOne),e.writeUint8(this.nalu_arrays.length),t=0;t<this.nalu_arrays.length;t++)for(e.writeUint8((this.nalu_arrays[t].completeness<<7)+this.nalu_arrays[t].nalu_type),e.writeUint16(this.nalu_arrays[t].length),s=0;s<this.nalu_arrays[t].length;s++)e.writeUint16(this.nalu_arrays[t][s].data.length),e.writeUint8Array(this.nalu_arrays[t][s].data)},r.kindBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.schemeURI.length+1+(this.value.length+1),this.writeHeader(e),e.writeCString(this.schemeURI),e.writeCString(this.value)},r.mdhdBox.prototype.write=function(e){this.size=4*4+2*2,this.flags=0,this.version=0,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint16(this.language),e.writeUint16(0)},r.mehdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.fragment_duration)},r.mfhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.sequence_number)},r.mvhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=23*4+2*2,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint32(this.rate),e.writeUint16(this.volume<<8),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32Array(this.matrix),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(this.next_track_id)},r.SampleEntry.prototype.writeHeader=function(e){this.size=8,r.Box.prototype.writeHeader.call(this,e),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint16(this.data_reference_index)},r.SampleEntry.prototype.writeFooter=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e),this.size+=this.boxes[t].size;n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.SampleEntry.prototype.write=function(e){this.writeHeader(e),e.writeUint8Array(this.data),this.size+=this.data.length,n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.VisualSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=2*7+6*4+32,e.writeUint16(0),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.width),e.writeUint16(this.height),e.writeUint32(this.horizresolution),e.writeUint32(this.vertresolution),e.writeUint32(0),e.writeUint16(this.frame_count),e.writeUint8(Math.min(31,this.compressorname.length)),e.writeString(this.compressorname,null,31),e.writeUint16(this.depth),e.writeInt16(-1),this.writeFooter(e)},r.AudioSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=2*4+3*4,e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.channel_count),e.writeUint16(this.samplesize),e.writeUint16(0),e.writeUint16(0),e.writeUint32(this.samplerate<<16),this.writeFooter(e)},r.stppSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=this.namespace.length+1+this.schema_location.length+1+this.auxiliary_mime_types.length+1,e.writeCString(this.namespace),e.writeCString(this.schema_location),e.writeCString(this.auxiliary_mime_types),this.writeFooter(e)},r.SampleGroupEntry.prototype.write=function(e){e.writeUint8Array(this.data)},r.sbgpBox.prototype.write=function(e){this.version=1,this.flags=0,this.size=12+8*this.entries.length,this.writeHeader(e),e.writeString(this.grouping_type,null,4),e.writeUint32(this.grouping_type_parameter),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var s=this.entries[t];e.writeInt32(s.sample_count),e.writeInt32(s.group_description_index)}},r.sgpdBox.prototype.write=function(e){var t,s;for(this.flags=0,this.size=12,t=0;t<this.entries.length;t++)s=this.entries[t],this.version===1&&(this.default_length===0&&(this.size+=4),this.size+=s.data.length);for(this.writeHeader(e),e.writeString(this.grouping_type,null,4),this.version===1&&e.writeUint32(this.default_length),this.version>=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t<this.entries.length;t++)s=this.entries[t],this.version===1&&this.default_length===0&&e.writeUint32(s.description_length),s.write(e)},r.sidxBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4*4+2+2+12*this.references.length,this.writeHeader(e),e.writeUint32(this.reference_ID),e.writeUint32(this.timescale),e.writeUint32(this.earliest_presentation_time),e.writeUint32(this.first_offset),e.writeUint16(0),e.writeUint16(this.references.length);for(var t=0;t<this.references.length;t++){var s=this.references[t];e.writeUint32(s.reference_type<<31|s.referenced_size),e.writeUint32(s.subsegment_duration),e.writeUint32(s.starts_with_SAP<<31|s.SAP_type<<28|s.SAP_delta_time)}},r.smhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=4,this.writeHeader(e),e.writeUint16(this.balance),e.writeUint16(0)},r.stcoBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),e.writeUint32Array(this.chunk_offsets)},r.stscBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+12*this.first_chunk.length,this.writeHeader(e),e.writeUint32(this.first_chunk.length),t=0;t<this.first_chunk.length;t++)e.writeUint32(this.first_chunk[t]),e.writeUint32(this.samples_per_chunk[t]),e.writeUint32(this.sample_description_index[t])},r.stsdBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=0,this.writeHeader(e),e.writeUint32(this.entries.length),this.size+=4,t=0;t<this.entries.length;t++)this.entries[t].write(e),this.size+=this.entries[t].size;n.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},r.stshBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.shadowed_sample_numbers.length,this.writeHeader(e),e.writeUint32(this.shadowed_sample_numbers.length),t=0;t<this.shadowed_sample_numbers.length;t++)e.writeUint32(this.shadowed_sample_numbers[t]),e.writeUint32(this.sync_sample_numbers[t])},r.stssBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.sample_numbers.length,this.writeHeader(e),e.writeUint32(this.sample_numbers.length),e.writeUint32Array(this.sample_numbers)},r.stszBox.prototype.write=function(e){var t,s=!0;if(this.version=0,this.flags=0,this.sample_sizes.length>0)for(t=0;t+1<this.sample_sizes.length;)if(this.sample_sizes[t+1]!==this.sample_sizes[0]){s=!1;break}else t++;else s=!1;this.size=8,s||(this.size+=4*this.sample_sizes.length),this.writeHeader(e),s?e.writeUint32(this.sample_sizes[0]):e.writeUint32(0),e.writeUint32(this.sample_sizes.length),s||e.writeUint32Array(this.sample_sizes)},r.sttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),e.writeUint32(this.sample_deltas[t])},r.tfdtBox.prototype.write=function(e){var t=Math.pow(2,32)-1;this.version=this.baseMediaDecodeTime>t?1:0,this.flags=0,this.size=4,this.version===1&&(this.size+=4),this.writeHeader(e),this.version===1?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},r.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&r.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&r.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&r.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&r.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&r.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&r.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&r.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&r.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&r.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&r.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},r.tkhdBox.prototype.write=function(e){this.version=0,this.size=4*18+2*4,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},r.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4*5,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},r.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&r.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&r.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&r.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&r.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&r.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&r.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&r.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&r.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t<this.sample_count;t++)this.flags&r.TRUN_FLAGS_DURATION&&e.writeUint32(this.sample_duration[t]),this.flags&r.TRUN_FLAGS_SIZE&&e.writeUint32(this.sample_size[t]),this.flags&r.TRUN_FLAGS_FLAGS&&e.writeUint32(this.sample_flags[t]),this.flags&r.TRUN_FLAGS_CTS_OFFSET&&(this.version===0?e.writeUint32(this.sample_composition_time_offset[t]):e.writeInt32(this.sample_composition_time_offset[t]))},r["url Box"].prototype.write=function(e){this.version=0,this.location?(this.flags=0,this.size=this.location.length+1):(this.flags=1,this.size=0),this.writeHeader(e),this.location&&e.writeCString(this.location)},r["urn Box"].prototype.write=function(e){this.version=0,this.flags=0,this.size=this.name.length+1+(this.location?this.location.length+1:0),this.writeHeader(e),e.writeCString(this.name),this.location&&e.writeCString(this.location)},r.vmhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=8,this.writeHeader(e),e.writeUint16(this.graphicsmode),e.writeUint16Array(this.opcolor)},r.cttsBox.prototype.unpack=function(e){var t,s,l;for(l=0,t=0;t<this.sample_counts.length;t++)for(s=0;s<this.sample_counts[t];s++)e[l].pts=e[l].dts+this.sample_offsets[t],l++},r.sttsBox.prototype.unpack=function(e){var t,s,l;for(l=0,t=0;t<this.sample_counts.length;t++)for(s=0;s<this.sample_counts[t];s++)l===0?e[l].dts=0:e[l].dts=e[l-1].dts+this.sample_deltas[t],l++},r.stcoBox.prototype.unpack=function(e){var t;for(t=0;t<this.chunk_offsets.length;t++)e[t].offset=this.chunk_offsets[t]},r.stscBox.prototype.unpack=function(e){var t,s,l,h,m;for(h=0,m=0,t=0;t<this.first_chunk.length;t++)for(s=0;s<(t+1<this.first_chunk.length?this.first_chunk[t+1]:1/0);s++)for(m++,l=0;l<this.samples_per_chunk[t];l++){if(e[h])e[h].description_index=this.sample_description_index[t],e[h].chunk_index=m;else return;h++}},r.stszBox.prototype.unpack=function(e){var t;for(t=0;t<this.sample_sizes.length;t++)e[t].size=this.sample_sizes[t]},r.DIFF_BOXES_PROP_NAMES=["boxes","entries","references","subsamples","items","item_infos","extents","associations","subsegments","ranges","seekLists","seekPoints","esd","levels"],r.DIFF_PRIMITIVE_ARRAY_PROP_NAMES=["compatible_brands","matrix","opcolor","sample_counts","sample_counts","sample_deltas","first_chunk","samples_per_chunk","sample_sizes","chunk_offsets","sample_offsets","sample_description_index","sample_duration"],r.boxEqualFields=function(e,t){if(e&&!t)return!1;var s;for(s in e)if(!(r.DIFF_BOXES_PROP_NAMES.indexOf(s)>-1)){if(e[s]instanceof r.Box||t[s]instanceof r.Box)continue;if(typeof e[s]>"u"||typeof t[s]>"u")continue;if(typeof e[s]=="function"||typeof t[s]=="function")continue;if(e.subBoxNames&&e.subBoxNames.indexOf(s.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(s.slice(0,4))>-1)continue;if(s==="data"||s==="start"||s==="size"||s==="creation_time"||s==="modification_time")continue;if(r.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(s)>-1)continue;if(e[s]!==t[s])return!1}return!0},r.boxEqual=function(e,t){if(!r.boxEqualFields(e,t))return!1;for(var s=0;s<r.DIFF_BOXES_PROP_NAMES.length;s++){var l=r.DIFF_BOXES_PROP_NAMES[s];if(e[l]&&t[l]&&!r.boxEqual(e[l],t[l]))return!1}return!0};var g=function(){};g.prototype.parseSample=function(e){var t,s,l=new o(e.buffer);for(t=[];!l.isEos();)s=r.parseOneBox(l,!1),s.code===r.OK&&s.box.type==="vttc"&&t.push(s.box);return t},g.prototype.getText=function(e,t,s){function l(w,T,C){return C=C||"0",w=w+"",w.length>=T?w:new Array(T-w.length+1).join(C)+w}function h(w){var T=Math.floor(w/3600),C=Math.floor((w-T*3600)/60),F=Math.floor(w-T*3600-C*60),A=Math.floor((w-T*3600-C*60-F)*1e3);return""+l(T,2)+":"+l(C,2)+":"+l(F,2)+"."+l(A,3)}for(var m=this.parseSample(s),y="",b=0;b<m.length;b++){var x=m[b];y+=h(e)+" --> "+h(t)+`\\r\n`,y+=x.payl.text}return y};var v=function(){};v.prototype.parseSample=function(e){var t={},s;t.resources=[];var l=new o(e.data.buffer);if(!e.subsamples||e.subsamples.length===0)t.documentString=l.readString(e.data.length);else if(t.documentString=l.readString(e.subsamples[0].size),e.subsamples.length>1)for(s=1;s<e.subsamples.length;s++)t.resources[s]=l.readUint8Array(e.subsamples[s].size);return typeof DOMParser<"u"&&(t.document=new DOMParser().parseFromString(t.documentString,"application/xml")),t};var E=function(){};E.prototype.parseSample=function(e){var t,s=new o(e.data.buffer);return t=s.readString(e.data.length),t},E.prototype.parseConfig=function(e){var t,s=new o(e.buffer);return s.readUint32(),t=s.readCString(),t},a.VTTin4Parser=g,a.XMLSubtitlein4Parser=v,a.Textin4Parser=E;var S=function(e){this.stream=e||new f,this.boxes=[],this.mdats=[],this.moofs=[],this.isProgressive=!1,this.moovStartFound=!1,this.onMoovStart=null,this.moovStartSent=!1,this.onReady=null,this.readySent=!1,this.onSegment=null,this.onSamples=null,this.onError=null,this.sampleListBuilt=!1,this.fragmentedTracks=[],this.extractedTracks=[],this.isFragmentationInitialized=!1,this.sampleProcessingStarted=!1,this.nextMoofNumber=0,this.itemListBuilt=!1,this.items=[],this.entity_groups=[],this.onSidx=null,this.sidxSent=!1};S.prototype.setSegmentOptions=function(e,t,s){var l=this.getTrackById(e);if(l){var h={};this.fragmentedTracks.push(h),h.id=e,h.user=t,h.trak=l,l.nextSample=0,h.segmentStream=null,h.nb_samples=1e3,h.rapAlignement=!0,s&&(s.nbSamples&&(h.nb_samples=s.nbSamples),s.rapAlignement&&(h.rapAlignement=s.rapAlignement))}},S.prototype.unsetSegmentOptions=function(e){for(var t=-1,s=0;s<this.fragmentedTracks.length;s++){var l=this.fragmentedTracks[s];l.id==e&&(t=s)}t>-1&&this.fragmentedTracks.splice(t,1)},S.prototype.setExtractionOptions=function(e,t,s){var l=this.getTrackById(e);if(l){var h={};this.extractedTracks.push(h),h.id=e,h.user=t,h.trak=l,l.nextSample=0,h.nb_samples=1e3,h.samples=[],s&&s.nbSamples&&(h.nb_samples=s.nbSamples)}},S.prototype.unsetExtractionOptions=function(e){for(var t=-1,s=0;s<this.extractedTracks.length;s++){var l=this.extractedTracks[s];l.id==e&&(t=s)}t>-1&&this.extractedTracks.splice(t,1)},S.prototype.parse=function(){var e,t,s=!1;if(!(this.restoreParsePosition&&!this.restoreParsePosition()))for(;;)if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}else if(this.saveParsePosition&&this.saveParsePosition(),e=r.parseOneBox(this.stream,s),e.code===r.ERR_NOT_ENOUGH_DATA)if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}else return;else{var l;switch(t=e.box,l=t.type!=="uuid"?t.type:t.uuid,this.boxes.push(t),l){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,this.mdats.length===0&&(this.isProgressive=!0);default:this[l]!==void 0&&n.warn("ISOFile","Duplicate Box of type: "+l+", overriding previous occurrence"),this[l]=t;break}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},S.prototype.checkBuffer=function(e){if(e==null)throw"Buffer must be defined and non empty";if(e.fileStart===void 0)throw"Buffer must have a fileStart property";return e.byteLength===0?(n.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(n.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),this.stream.initialized()?!0:(n.warn("ISOFile","Not ready to start parsing"),!1))},S.prototype.appendBuffer=function(e,t){var s;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(s=this.nextSeekPosition,this.nextSeekPosition=void 0):s=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(s=this.stream.getEndFilePositionAfter(s))):this.nextParsePosition?s=this.nextParsePosition:s=0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(n.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+s),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),s},S.prototype.getInfo=function(){var e,t,s={},l,h,m,y,b=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(s.hasMoov=!0,s.duration=this.moov.mvhd.duration,s.timescale=this.moov.mvhd.timescale,s.isFragmented=this.moov.mvex!=null,s.isFragmented&&this.moov.mvex.mehd&&(s.fragment_duration=this.moov.mvex.mehd.fragment_duration),s.isProgressive=this.isProgressive,s.hasIOD=this.moov.iods!=null,s.brands=[],s.brands.push(this.ftyp.major_brand),s.brands=s.brands.concat(this.ftyp.compatible_brands),s.created=new Date(b+this.moov.mvhd.creation_time*1e3),s.modified=new Date(b+this.moov.mvhd.modification_time*1e3),s.tracks=[],s.audioTracks=[],s.videoTracks=[],s.subtitleTracks=[],s.metadataTracks=[],s.hintTracks=[],s.otherTracks=[],e=0;e<this.moov.traks.length;e++){if(l=this.moov.traks[e],y=l.mdia.minf.stbl.stsd.entries[0],h={},s.tracks.push(h),h.id=l.tkhd.track_id,h.name=l.mdia.hdlr.name,h.references=[],l.tref)for(t=0;t<l.tref.boxes.length;t++)m={},h.references.push(m),m.type=l.tref.boxes[t].type,m.track_ids=l.tref.boxes[t].track_ids;l.edts&&(h.edits=l.edts.elst.entries),h.created=new Date(b+l.tkhd.creation_time*1e3),h.modified=new Date(b+l.tkhd.modification_time*1e3),h.movie_duration=l.tkhd.duration,h.movie_timescale=s.timescale,h.layer=l.tkhd.layer,h.alternate_group=l.tkhd.alternate_group,h.volume=l.tkhd.volume,h.matrix=l.tkhd.matrix,h.track_width=l.tkhd.width/65536,h.track_height=l.tkhd.height/65536,h.timescale=l.mdia.mdhd.timescale,h.cts_shift=l.mdia.minf.stbl.cslg,h.duration=l.mdia.mdhd.duration,h.samples_duration=l.samples_duration,h.codec=y.getCodec(),h.kind=l.udta&&l.udta.kinds.length?l.udta.kinds[0]:{schemeURI:"",value:""},h.language=l.mdia.elng?l.mdia.elng.extended_language:l.mdia.mdhd.languageString,h.nb_samples=l.samples.length,h.size=l.samples_size,h.bitrate=h.size*8*h.timescale/h.samples_duration,y.isAudio()?(h.type="audio",s.audioTracks.push(h),h.audio={},h.audio.sample_rate=y.getSampleRate(),h.audio.channel_count=y.getChannelCount(),h.audio.sample_size=y.getSampleSize()):y.isVideo()?(h.type="video",s.videoTracks.push(h),h.video={},h.video.width=y.getWidth(),h.video.height=y.getHeight()):y.isSubtitle()?(h.type="subtitles",s.subtitleTracks.push(h)):y.isHint()?(h.type="metadata",s.hintTracks.push(h)):y.isMetadata()?(h.type="metadata",s.metadataTracks.push(h)):(h.type="metadata",s.otherTracks.push(h))}else s.hasMoov=!1;if(s.mime="",s.hasMoov&&s.tracks){for(s.videoTracks&&s.videoTracks.length>0?s.mime+=\'video/mp4; codecs="\':s.audioTracks&&s.audioTracks.length>0?s.mime+=\'audio/mp4; codecs="\':s.mime+=\'application/mp4; codecs="\',e=0;e<s.tracks.length;e++)e!==0&&(s.mime+=","),s.mime+=s.tracks[e].codec;s.mime+=\'"; profiles="\',s.mime+=this.ftyp.compatible_brands.join(),s.mime+=\'"\'}return s},S.prototype.setNextSeekPositionFromSample=function(e){e&&(this.nextSeekPosition?this.nextSeekPosition=Math.min(e.offset+e.alreadyRead,this.nextSeekPosition):this.nextSeekPosition=e.offset+e.alreadyRead)},S.prototype.processSamples=function(e){var t,s;if(this.sampleProcessingStarted){if(this.isFragmentationInitialized&&this.onSegment!==null)for(t=0;t<this.fragmentedTracks.length;t++){var l=this.fragmentedTracks[t];for(s=l.trak;s.nextSample<s.samples.length&&this.sampleProcessingStarted;){n.debug("ISOFile","Creating media fragment on track #"+l.id+" for sample "+s.nextSample);var h=this.createFragment(l.id,s.nextSample,l.segmentStream);if(h)l.segmentStream=h,s.nextSample++;else break;if((s.nextSample%l.nb_samples===0||e||s.nextSample>=s.samples.length)&&(n.info("ISOFile","Sending fragmented data on track #"+l.id+" for samples ["+Math.max(0,s.nextSample-l.nb_samples)+","+(s.nextSample-1)+"]"),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(l.id,l.user,l.segmentStream.buffer,s.nextSample,e||s.nextSample>=s.samples.length),l.segmentStream=null,l!==this.fragmentedTracks[t]))break}}if(this.onSamples!==null)for(t=0;t<this.extractedTracks.length;t++){var m=this.extractedTracks[t];for(s=m.trak;s.nextSample<s.samples.length&&this.sampleProcessingStarted;){n.debug("ISOFile","Exporting on track #"+m.id+" sample #"+s.nextSample);var y=this.getSample(s,s.nextSample);if(y)s.nextSample++,m.samples.push(y);else{this.setNextSeekPositionFromSample(s.samples[s.nextSample]);break}if((s.nextSample%m.nb_samples===0||s.nextSample>=s.samples.length)&&(n.debug("ISOFile","Sending samples on track #"+m.id+" for sample "+s.nextSample),this.onSamples&&this.onSamples(m.id,m.user,m.samples),m.samples=[],m!==this.extractedTracks[t]))break}}}},S.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},S.prototype.getBoxes=function(e,t){var s=[];return S._sweep.call(this,e,s,t),s},S._sweep=function(e,t,s){this.type&&this.type==e&&t.push(this);for(var l in this.boxes){if(t.length&&s)return;S._sweep.call(this.boxes[l],e,t,s)}},S.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);if(t)return t.samples},S.prototype.getTrackSample=function(e,t){var s=this.getTrackById(e),l=this.getSample(s,t);return l},S.prototype.releaseUsedSamples=function(e,t){var s=0,l=this.getTrackById(e);l.lastValidSample||(l.lastValidSample=0);for(var h=l.lastValidSample;h<t;h++)s+=this.releaseSample(l,h);n.info("ISOFile","Track #"+e+" released samples up to "+t+" (released size: "+s+", remaining: "+this.samplesDataSize+")"),l.lastValidSample=t},S.prototype.start=function(){this.sampleProcessingStarted=!0,this.processSamples(!1)},S.prototype.stop=function(){this.sampleProcessingStarted=!1},S.prototype.flush=function(){n.info("ISOFile","Flushing remaining samples"),this.updateSampleLists(),this.processSamples(!0),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0)},S.prototype.seekTrack=function(e,t,s){var l,h,m=1/0,y=0,b=0,x;if(s.samples.length===0)return n.info("ISOFile","No sample in track, cannot seek! Using time "+n.getDurationString(0,1)+" and offset: 0"),{offset:0,time:0};for(l=0;l<s.samples.length;l++){if(h=s.samples[l],l===0)b=0,x=h.timescale;else if(h.cts>e*h.timescale){b=l-1;break}t&&h.is_sync&&(y=l)}for(t&&(b=y),e=s.samples[b].cts,s.nextSample=b;s.samples[b].alreadyRead===s.samples[b].size&&s.samples[b+1];)b++;return m=s.samples[b].offset+s.samples[b].alreadyRead,n.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+s.nextSample+" on track "+s.tkhd.track_id+", time "+n.getDurationString(e,x)+" and offset: "+m),{offset:m,time:e/x}},S.prototype.getTrackDuration=function(e){var t;return e.samples?(t=e.samples[e.samples.length-1],(t.cts+t.duration)/t.timescale):1/0},S.prototype.seek=function(e,t){var s=this.moov,l,h,m,y={offset:1/0,time:1/0};if(this.moov){for(m=0;m<s.traks.length;m++)l=s.traks[m],!(e>this.getTrackDuration(l))&&(h=this.seekTrack(e,t,l),h.offset<y.offset&&(y.offset=h.offset),h.time<y.time&&(y.time=h.time));return n.info("ISOFile","Seeking at time "+n.getDurationString(y.time,1)+" needs a buffer with a fileStart position of "+y.offset),y.offset===1/0?y={offset:this.nextParsePosition,time:0}:y.offset=this.stream.getEndFilePositionAfter(y.offset),n.info("ISOFile","Adjusted seek position (after checking data already in buffer): "+y.offset),y}else throw"Cannot seek: moov not received!"},S.prototype.equal=function(e){for(var t=0;t<this.boxes.length&&t<e.boxes.length;){var s=this.boxes[t],l=e.boxes[t];if(!r.boxEqual(s,l))return!1;t++}return!0},a.ISOFile=S,S.prototype.lastBoxStartPosition=0,S.prototype.parsingMdat=null,S.prototype.nextParsePosition=0,S.prototype.discardMdatData=!1,S.prototype.processIncompleteBox=function(e){var t,s,l;return e.type==="mdat"?(t=new r[e.type+"Box"](e.size),this.parsingMdat=t,this.boxes.push(t),this.mdats.push(t),t.start=e.start,t.hdr_size=e.hdr_size,this.stream.addUsedBytes(t.hdr_size),this.lastBoxStartPosition=t.start+t.size,l=this.stream.seek(t.start+t.size,!1,this.discardMdatData),l?(this.parsingMdat=null,!0):(this.moovStartFound?this.nextParsePosition=this.stream.findEndContiguousBuf():this.nextParsePosition=t.start+t.size,!1)):(e.type==="moov"&&(this.moovStartFound=!0,this.mdats.length===0&&(this.isProgressive=!0)),s=this.stream.mergeNextBuffer?this.stream.mergeNextBuffer():!1,s?(this.nextParsePosition=this.stream.getEndPosition(),!0):(e.type?this.moovStartFound?this.nextParsePosition=this.stream.getEndPosition():this.nextParsePosition=this.stream.getPosition()+e.size:this.nextParsePosition=this.stream.getEndPosition(),!1))},S.prototype.hasIncompleteMdat=function(){return this.parsingMdat!==null},S.prototype.processIncompleteMdat=function(){var e,t;return e=this.parsingMdat,t=this.stream.seek(e.start+e.size,!1,this.discardMdatData),t?(n.debug("ISOFile","Found \'mdat\' end in buffered data"),this.parsingMdat=null,!0):(this.nextParsePosition=this.stream.findEndContiguousBuf(),!1)},S.prototype.restoreParsePosition=function(){return this.stream.seek(this.lastBoxStartPosition,!0,this.discardMdatData)},S.prototype.saveParsePosition=function(){this.lastBoxStartPosition=this.stream.getPosition()},S.prototype.updateUsedBytes=function(e,t){this.stream.addUsedBytes&&(e.type==="mdat"?(this.stream.addUsedBytes(e.hdr_size),this.discardMdatData&&this.stream.addUsedBytes(e.size-e.hdr_size)):this.stream.addUsedBytes(e.size))},S.prototype.add=r.Box.prototype.add,S.prototype.addBox=r.Box.prototype.addBox,S.prototype.init=function(e){var t=e||{};this.add("ftyp").set("major_brand",t.brands&&t.brands[0]||"iso4").set("minor_version",0).set("compatible_brands",t.brands||["iso4"]);var s=this.add("moov");return s.add("mvhd").set("timescale",t.timescale||600).set("rate",t.rate||65536).set("creation_time",0).set("modification_time",0).set("duration",t.duration||0).set("volume",t.width?0:256).set("matrix",[65536,0,0,0,65536,0,0,0,1073741824]).set("next_track_id",1),s.add("mvex"),this},S.prototype.addTrack=function(e){this.moov||this.init(e);var t=e||{};t.width=t.width||320,t.height=t.height||320,t.id=t.id||this.moov.mvhd.next_track_id,t.type=t.type||"avc1";var s=this.moov.add("trak");this.moov.mvhd.next_track_id=t.id+1,s.add("tkhd").set("flags",r.TKHD_FLAG_ENABLED|r.TKHD_FLAG_IN_MOVIE|r.TKHD_FLAG_IN_PREVIEW).set("creation_time",0).set("modification_time",0).set("track_id",t.id).set("duration",t.duration||0).set("layer",t.layer||0).set("alternate_group",0).set("volume",1).set("matrix",[0,0,0,0,0,0,0,0,0]).set("width",t.width<<16).set("height",t.height<<16);var l=s.add("mdia");l.add("mdhd").set("creation_time",0).set("modification_time",0).set("timescale",t.timescale||1).set("duration",t.media_duration||0).set("language",t.language||"und"),l.add("hdlr").set("handler",t.hdlr||"vide").set("name",t.name||"Track created with MP4Box.js"),l.add("elng").set("extended_language",t.language||"fr-FR");var h=l.add("minf");if(r[t.type+"SampleEntry"]!==void 0){var m=new r[t.type+"SampleEntry"];m.data_reference_index=1;var y="";for(var b in r.sampleEntryCodes)for(var x=r.sampleEntryCodes[b],w=0;w<x.length;w++)if(x.indexOf(t.type)>-1){y=b;break}switch(y){case"Visual":if(h.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),m.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var T=new r.avcCBox;T.parse(new o(t.avcDecoderConfigRecord)),m.addBox(T)}else if(t.hevcDecoderConfigRecord){var C=new r.hvcCBox;C.parse(new o(t.hevcDecoderConfigRecord)),m.addBox(C)}break;case"Audio":h.add("smhd").set("balance",t.balance||0),m.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":h.add("hmhd");break;case"Subtitle":switch(h.add("sthd"),t.type){case"stpp":m.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break}break;case"Metadata":h.add("nmhd");break;case"System":h.add("nmhd");break;default:h.add("nmhd");break}t.description&&m.addBox(t.description),t.description_boxes&&t.description_boxes.forEach(function(A){m.addBox(A)}),h.add("dinf").add("dref").addEntry(new r["url Box"]().set("flags",1));var F=h.add("stbl");return F.add("stsd").addEntry(m),F.add("stts").set("sample_counts",[]).set("sample_deltas",[]),F.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),F.add("stco").set("chunk_offsets",[]),F.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(s),t.id}},r.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},S.prototype.addSample=function(e,t,s){var l=s||{},h={},m=this.getTrackById(e);if(m!==null){h.number=m.samples.length,h.track_id=m.tkhd.track_id,h.timescale=m.mdia.mdhd.timescale,h.description_index=l.sample_description_index?l.sample_description_index-1:0,h.description=m.mdia.minf.stbl.stsd.entries[h.description_index],h.data=t,h.size=t.byteLength,h.alreadyRead=h.size,h.duration=l.duration||1,h.cts=l.cts||0,h.dts=l.dts||0,h.is_sync=l.is_sync||!1,h.is_leading=l.is_leading||0,h.depends_on=l.depends_on||0,h.is_depended_on=l.is_depended_on||0,h.has_redundancy=l.has_redundancy||0,h.degradation_priority=l.degradation_priority||0,h.offset=0,h.subsamples=l.subsamples,m.samples.push(h),m.samples_size+=h.size,m.samples_duration+=h.duration,m.first_dts===void 0&&(m.first_dts=l.dts),this.processSamples();var y=this.createSingleSampleMoof(h);return this.addBox(y),y.computeSize(),y.trafs[0].truns[0].data_offset=y.size+8,this.add("mdat").data=new Uint8Array(t),h}},S.prototype.createSingleSampleMoof=function(e){var t=0;e.is_sync?t=1<<25:t=65536;var s=new r.moofBox;s.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var l=s.add("traf"),h=this.getTrackById(e.track_id);return l.add("tfhd").set("track_id",e.track_id).set("flags",r.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),l.add("tfdt").set("baseMediaDecodeTime",e.dts-(h.first_dts||0)),l.add("trun").set("flags",r.TRUN_FLAGS_DATA_OFFSET|r.TRUN_FLAGS_DURATION|r.TRUN_FLAGS_SIZE|r.TRUN_FLAGS_FLAGS|r.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),s},S.prototype.lastMoofIndex=0,S.prototype.samplesDataSize=0,S.prototype.resetTables=function(){var e,t,s,l,h,m,y,b;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e<this.moov.traks.length;e++){t=this.moov.traks[e],t.tkhd.duration=0,t.mdia.mdhd.duration=0,s=t.mdia.minf.stbl.stco||t.mdia.minf.stbl.co64,s.chunk_offsets=[],l=t.mdia.minf.stbl.stsc,l.first_chunk=[],l.samples_per_chunk=[],l.sample_description_index=[],h=t.mdia.minf.stbl.stsz||t.mdia.minf.stbl.stz2,h.sample_sizes=[],m=t.mdia.minf.stbl.stts,m.sample_counts=[],m.sample_deltas=[],y=t.mdia.minf.stbl.ctts,y&&(y.sample_counts=[],y.sample_offsets=[]),b=t.mdia.minf.stbl.stss;var x=t.mdia.minf.stbl.boxes.indexOf(b);x!=-1&&(t.mdia.minf.stbl.boxes[x]=null)}},S.initSampleGroups=function(e,t,s,l,h){var m,y,b,x;function w(T,C,F){this.grouping_type=T,this.grouping_type_parameter=C,this.sbgp=F,this.last_sample_in_run=-1,this.entry_index=-1}for(t&&(t.sample_groups_info=[]),e.sample_groups_info||(e.sample_groups_info=[]),y=0;y<s.length;y++){for(x=s[y].grouping_type+"/"+s[y].grouping_type_parameter,b=new w(s[y].grouping_type,s[y].grouping_type_parameter,s[y]),t&&(t.sample_groups_info[x]=b),e.sample_groups_info[x]||(e.sample_groups_info[x]=b),m=0;m<l.length;m++)l[m].grouping_type===s[y].grouping_type&&(b.description=l[m],b.description.used=!0);if(h)for(m=0;m<h.length;m++)h[m].grouping_type===s[y].grouping_type&&(b.fragment_description=h[m],b.fragment_description.used=!0,b.is_fragment=!0)}if(t){if(h)for(y=0;y<h.length;y++)!h[y].used&&h[y].version>=2&&(x=h[y].grouping_type+"/0",b=new w(h[y].grouping_type,0),b.is_fragment=!0,t.sample_groups_info[x]||(t.sample_groups_info[x]=b))}else for(y=0;y<l.length;y++)!l[y].used&&l[y].version>=2&&(x=l[y].grouping_type+"/0",b=new w(l[y].grouping_type,0),e.sample_groups_info[x]||(e.sample_groups_info[x]=b))},S.setSampleGroupProperties=function(e,t,s,l){var h,m;t.sample_groups=[];for(h in l)if(t.sample_groups[h]={},t.sample_groups[h].grouping_type=l[h].grouping_type,t.sample_groups[h].grouping_type_parameter=l[h].grouping_type_parameter,s>=l[h].last_sample_in_run&&(l[h].last_sample_in_run<0&&(l[h].last_sample_in_run=0),l[h].entry_index++,l[h].entry_index<=l[h].sbgp.entries.length-1&&(l[h].last_sample_in_run+=l[h].sbgp.entries[l[h].entry_index].sample_count)),l[h].entry_index<=l[h].sbgp.entries.length-1?t.sample_groups[h].group_description_index=l[h].sbgp.entries[l[h].entry_index].group_description_index:t.sample_groups[h].group_description_index=-1,t.sample_groups[h].group_description_index!==0){var y;l[h].fragment_description?y=l[h].fragment_description:y=l[h].description,t.sample_groups[h].group_description_index>0?(t.sample_groups[h].group_description_index>65535?m=(t.sample_groups[h].group_description_index>>16)-1:m=t.sample_groups[h].group_description_index-1,y&&m>=0&&(t.sample_groups[h].description=y.entries[m])):y&&y.version>=2&&y.default_group_description_index>0&&(t.sample_groups[h].description=y.entries[y.default_group_description_index-1])}},S.process_sdtp=function(e,t,s){t&&(e?(t.is_leading=e.is_leading[s],t.depends_on=e.sample_depends_on[s],t.is_depended_on=e.sample_is_depended_on[s],t.has_redundancy=e.sample_has_redundancy[s]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},S.prototype.buildSampleLists=function(){var e,t;for(e=0;e<this.moov.traks.length;e++)t=this.moov.traks[e],this.buildTrakSampleLists(t)},S.prototype.buildTrakSampleLists=function(e){var t,s,l,h,m,y,b,x,w,T,C,F,A,R,P,K,Z,$,G,q,ee,Ee,j,W;if(e.samples=[],e.samples_duration=0,e.samples_size=0,s=e.mdia.minf.stbl.stco||e.mdia.minf.stbl.co64,l=e.mdia.minf.stbl.stsc,h=e.mdia.minf.stbl.stsz||e.mdia.minf.stbl.stz2,m=e.mdia.minf.stbl.stts,y=e.mdia.minf.stbl.ctts,b=e.mdia.minf.stbl.stss,x=e.mdia.minf.stbl.stsd,w=e.mdia.minf.stbl.subs,F=e.mdia.minf.stbl.stdp,T=e.mdia.minf.stbl.sbgps,C=e.mdia.minf.stbl.sgpds,$=-1,G=-1,q=-1,ee=-1,Ee=0,j=0,W=0,S.initSampleGroups(e,null,T,C),!(typeof h>"u")){for(t=0;t<h.sample_sizes.length;t++){var L={};L.number=t,L.track_id=e.tkhd.track_id,L.timescale=e.mdia.mdhd.timescale,L.alreadyRead=0,e.samples[t]=L,L.size=h.sample_sizes[t],e.samples_size+=L.size,t===0?(R=1,A=0,L.chunk_index=R,L.chunk_run_index=A,Z=l.samples_per_chunk[A],K=0,A+1<l.first_chunk.length?P=l.first_chunk[A+1]-1:P=1/0):t<Z?(L.chunk_index=R,L.chunk_run_index=A):(R++,L.chunk_index=R,K=0,R<=P||(A++,A+1<l.first_chunk.length?P=l.first_chunk[A+1]-1:P=1/0),L.chunk_run_index=A,Z+=l.samples_per_chunk[A]),L.description_index=l.sample_description_index[L.chunk_run_index]-1,L.description=x.entries[L.description_index],L.offset=s.chunk_offsets[L.chunk_index-1]+K,K+=L.size,t>$&&(G++,$<0&&($=0),$+=m.sample_counts[G]),t>0?(e.samples[t-1].duration=m.sample_deltas[G],e.samples_duration+=e.samples[t-1].duration,L.dts=e.samples[t-1].dts+e.samples[t-1].duration):L.dts=0,y?(t>=q&&(ee++,q<0&&(q=0),q+=y.sample_counts[ee]),L.cts=e.samples[t].dts+y.sample_offsets[ee]):L.cts=L.dts,b?(t==b.sample_numbers[Ee]-1?(L.is_sync=!0,Ee++):(L.is_sync=!1,L.degradation_priority=0),w&&w.entries[j].sample_delta+W==t+1&&(L.subsamples=w.entries[j].subsamples,W+=w.entries[j].sample_delta,j++)):L.is_sync=!0,S.process_sdtp(e.mdia.minf.stbl.sdtp,L,L.number),F?L.degradation_priority=F.priority[t]:L.degradation_priority=0,w&&w.entries[j].sample_delta+W==t&&(L.subsamples=w.entries[j].subsamples,W+=w.entries[j].sample_delta),(T.length>0||C.length>0)&&S.setSampleGroupProperties(e,L,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},S.prototype.updateSampleLists=function(){var e,t,s,l,h,m,y,b,x,w,T,C,F,A,R;if(this.moov!==void 0){for(;this.lastMoofIndex<this.moofs.length;)if(x=this.moofs[this.lastMoofIndex],this.lastMoofIndex++,x.type=="moof")for(w=x,e=0;e<w.trafs.length;e++){for(T=w.trafs[e],C=this.getTrackById(T.tfhd.track_id),F=this.getTrexById(T.tfhd.track_id),T.tfhd.flags&r.TFHD_FLAG_SAMPLE_DESC?l=T.tfhd.default_sample_description_index:l=F?F.default_sample_description_index:1,T.tfhd.flags&r.TFHD_FLAG_SAMPLE_DUR?h=T.tfhd.default_sample_duration:h=F?F.default_sample_duration:0,T.tfhd.flags&r.TFHD_FLAG_SAMPLE_SIZE?m=T.tfhd.default_sample_size:m=F?F.default_sample_size:0,T.tfhd.flags&r.TFHD_FLAG_SAMPLE_FLAGS?y=T.tfhd.default_sample_flags:y=F?F.default_sample_flags:0,T.sample_number=0,T.sbgps.length>0&&S.initSampleGroups(C,T,T.sbgps,C.mdia.minf.stbl.sgpds,T.sgpds),t=0;t<T.truns.length;t++){var P=T.truns[t];for(s=0;s<P.sample_count;s++){A={},A.moof_number=this.lastMoofIndex,A.number_in_traf=T.sample_number,T.sample_number++,A.number=C.samples.length,T.first_sample_index=C.samples.length,C.samples.push(A),A.track_id=C.tkhd.track_id,A.timescale=C.mdia.mdhd.timescale,A.description_index=l-1,A.description=C.mdia.minf.stbl.stsd.entries[A.description_index],A.size=m,P.flags&r.TRUN_FLAGS_SIZE&&(A.size=P.sample_size[s]),C.samples_size+=A.size,A.duration=h,P.flags&r.TRUN_FLAGS_DURATION&&(A.duration=P.sample_duration[s]),C.samples_duration+=A.duration,C.first_traf_merged||s>0?A.dts=C.samples[C.samples.length-2].dts+C.samples[C.samples.length-2].duration:(T.tfdt?A.dts=T.tfdt.baseMediaDecodeTime:A.dts=0,C.first_traf_merged=!0),A.cts=A.dts,P.flags&r.TRUN_FLAGS_CTS_OFFSET&&(A.cts=A.dts+P.sample_composition_time_offset[s]),R=y,P.flags&r.TRUN_FLAGS_FLAGS?R=P.sample_flags[s]:s===0&&P.flags&r.TRUN_FLAGS_FIRST_FLAG&&(R=P.first_sample_flags),A.is_sync=!(R>>16&1),A.is_leading=R>>26&3,A.depends_on=R>>24&3,A.is_depended_on=R>>22&3,A.has_redundancy=R>>20&3,A.degradation_priority=R&65535;var K=!!(T.tfhd.flags&r.TFHD_FLAG_BASE_DATA_OFFSET),Z=!!(T.tfhd.flags&r.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),$=!!(P.flags&r.TRUN_FLAGS_DATA_OFFSET),G=0;K?G=T.tfhd.base_data_offset:Z||t===0?G=w.start:G=b,t===0&&s===0?$?A.offset=G+P.data_offset:A.offset=G:A.offset=b,b=A.offset+A.size,(T.sbgps.length>0||T.sgpds.length>0||C.mdia.minf.stbl.sbgps.length>0||C.mdia.minf.stbl.sgpds.length>0)&&S.setSampleGroupProperties(C,A,A.number_in_traf,T.sample_groups_info)}}if(T.subs){C.has_fragment_subsamples=!0;var q=T.first_sample_index;for(t=0;t<T.subs.entries.length;t++)q+=T.subs.entries[t].sample_delta,A=C.samples[q-1],A.subsamples=T.subs.entries[t].subsamples}}}},S.prototype.getSample=function(e,t){var s,l=e.samples[t];if(!this.moov)return null;if(!l.data)l.data=new Uint8Array(l.size),l.alreadyRead=0,this.samplesDataSize+=l.size,n.debug("ISOFile","Allocating sample #"+t+" on track #"+e.tkhd.track_id+" of size "+l.size+" (total: "+this.samplesDataSize+")");else if(l.alreadyRead==l.size)return l;for(;;){var h=this.stream.findPosition(!0,l.offset+l.alreadyRead,!1);if(h>-1){s=this.stream.buffers[h];var m=s.byteLength-(l.offset+l.alreadyRead-s.fileStart);if(l.size-l.alreadyRead<=m)return n.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+l.alreadyRead+" offset: "+(l.offset+l.alreadyRead-s.fileStart)+" read size: "+(l.size-l.alreadyRead)+" full size: "+l.size+")"),d.memcpy(l.data.buffer,l.alreadyRead,s,l.offset+l.alreadyRead-s.fileStart,l.size-l.alreadyRead),s.usedBytes+=l.size-l.alreadyRead,this.stream.logBufferLevel(),l.alreadyRead=l.size,l;if(m===0)return null;n.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+l.alreadyRead+" offset: "+(l.offset+l.alreadyRead-s.fileStart)+" read size: "+m+" full size: "+l.size+")"),d.memcpy(l.data.buffer,l.alreadyRead,s,l.offset+l.alreadyRead-s.fileStart,m),l.alreadyRead+=m,s.usedBytes+=m,this.stream.logBufferLevel()}else return null}},S.prototype.releaseSample=function(e,t){var s=e.samples[t];return s.data?(this.samplesDataSize-=s.size,s.data=null,s.alreadyRead=0,s.size):0},S.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},S.prototype.getCodecs=function(){var e,t="";for(e=0;e<this.moov.traks.length;e++){var s=this.moov.traks[e];e>0&&(t+=","),t+=s.mdia.minf.stbl.stsd.entries[0].getCodec()}return t},S.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t<this.moov.mvex.trexs.length;t++){var s=this.moov.mvex.trexs[t];if(s.track_id==e)return s}return null},S.prototype.getTrackById=function(e){if(this.moov===void 0)return null;for(var t=0;t<this.moov.traks.length;t++){var s=this.moov.traks[t];if(s.tkhd.track_id==e)return s}return null},S.prototype.itemsDataSize=0,S.prototype.flattenItemInfo=function(){var e=this.items,t=this.entity_groups,s,l,h,m=this.meta;if(m!=null&&m.hdlr!==void 0&&m.iinf!==void 0){for(s=0;s<m.iinf.item_infos.length;s++)h={},h.id=m.iinf.item_infos[s].item_ID,e[h.id]=h,h.ref_to=[],h.name=m.iinf.item_infos[s].item_name,m.iinf.item_infos[s].protection_index>0&&(h.protection=m.ipro.protections[m.iinf.item_infos[s].protection_index-1]),m.iinf.item_infos[s].item_type?h.type=m.iinf.item_infos[s].item_type:h.type="mime",h.content_type=m.iinf.item_infos[s].content_type,h.content_encoding=m.iinf.item_infos[s].content_encoding;if(m.grpl)for(s=0;s<m.grpl.boxes.length;s++)entity_group={},entity_group.id=m.grpl.boxes[s].group_id,entity_group.entity_ids=m.grpl.boxes[s].entity_ids,entity_group.type=m.grpl.boxes[s].type,t[entity_group.id]=entity_group;if(m.iloc)for(s=0;s<m.iloc.items.length;s++){var y=m.iloc.items[s];switch(h=e[y.item_ID],y.data_reference_index!==0&&(n.warn("Item storage with reference to other files: not supported"),h.source=m.dinf.boxes[y.data_reference_index-1]),y.construction_method){case 0:break;case 1:break;case 2:n.warn("Item storage with construction_method : not supported");break}for(h.extents=[],h.size=0,l=0;l<y.extents.length;l++)h.extents[l]={},h.extents[l].offset=y.extents[l].extent_offset+y.base_offset,y.construction_method==1&&(h.extents[l].offset+=m.idat.start+m.idat.hdr_size),h.extents[l].length=y.extents[l].extent_length,h.extents[l].alreadyRead=0,h.size+=h.extents[l].length}if(m.pitm&&(e[m.pitm.item_id].primary=!0),m.iref)for(s=0;s<m.iref.references.length;s++){var b=m.iref.references[s];for(l=0;l<b.references.length;l++)e[b.from_item_ID].ref_to.push({type:b.type,id:b.references[l]})}if(m.iprp)for(var x=0;x<m.iprp.ipmas.length;x++){var w=m.iprp.ipmas[x];for(s=0;s<w.associations.length;s++){var T=w.associations[s];if(h=e[T.id],h||(h=t[T.id]),h)for(h.properties===void 0&&(h.properties={},h.properties.boxes=[]),l=0;l<T.props.length;l++){var C=T.props[l];if(C.property_index>0&&C.property_index-1<m.iprp.ipco.boxes.length){var F=m.iprp.ipco.boxes[C.property_index-1];h.properties[F.type]=F,h.properties.boxes.push(F)}}}}}},S.prototype.getItem=function(e){var t,s;if(!this.meta)return null;if(s=this.items[e],!s.data&&s.size)s.data=new Uint8Array(s.size),s.alreadyRead=0,this.itemsDataSize+=s.size,n.debug("ISOFile","Allocating item #"+e+" of size "+s.size+" (total: "+this.itemsDataSize+")");else if(s.alreadyRead===s.size)return s;for(var l=0;l<s.extents.length;l++){var h=s.extents[l];if(h.alreadyRead!==h.length){var m=this.stream.findPosition(!0,h.offset+h.alreadyRead,!1);if(m>-1){t=this.stream.buffers[m];var y=t.byteLength-(h.offset+h.alreadyRead-t.fileStart);if(h.length-h.alreadyRead<=y)n.debug("ISOFile","Getting item #"+e+" extent #"+l+" data (alreadyRead: "+h.alreadyRead+" offset: "+(h.offset+h.alreadyRead-t.fileStart)+" read size: "+(h.length-h.alreadyRead)+" full extent size: "+h.length+" full item size: "+s.size+")"),d.memcpy(s.data.buffer,s.alreadyRead,t,h.offset+h.alreadyRead-t.fileStart,h.length-h.alreadyRead),t.usedBytes+=h.length-h.alreadyRead,this.stream.logBufferLevel(),s.alreadyRead+=h.length-h.alreadyRead,h.alreadyRead=h.length;else return n.debug("ISOFile","Getting item #"+e+" extent #"+l+" partial data (alreadyRead: "+h.alreadyRead+" offset: "+(h.offset+h.alreadyRead-t.fileStart)+" read size: "+y+" full extent size: "+h.length+" full item size: "+s.size+")"),d.memcpy(s.data.buffer,s.alreadyRead,t,h.offset+h.alreadyRead-t.fileStart,y),h.alreadyRead+=y,s.alreadyRead+=y,t.usedBytes+=y,this.stream.logBufferLevel(),null}else return null}}return s.alreadyRead===s.size?s:null},S.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var s=0;s<t.extents.length;s++){var l=t.extents[s];l.alreadyRead=0}return t.size}else return 0},S.prototype.processItems=function(e){for(var t in this.items){var s=this.items[t];this.getItem(s.id),e&&!s.sent&&(e(s),s.sent=!0,s.data=null)}},S.prototype.hasItem=function(e){for(var t in this.items){var s=this.items[t];if(s.name===e)return s.id}return-1},S.prototype.getMetaHandler=function(){return this.meta?this.meta.hdlr.handler:null},S.prototype.getPrimaryItem=function(){return!this.meta||!this.meta.pitm?null:this.getItem(this.meta.pitm.item_id)},S.prototype.itemToFragmentedTrackFile=function(e){var t=e||{},s=null;if(t.itemId?s=this.getItem(t.itemId):s=this.getPrimaryItem(),s==null)return null;var l=new S;l.discardMdatData=!1;var h={type:s.type,description_boxes:s.properties.boxes};s.properties.ispe&&(h.width=s.properties.ispe.image_width,h.height=s.properties.ispe.image_height);var m=l.addTrack(h);return m?(l.addSample(m,s.data),l):null},S.prototype.write=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e)},S.prototype.createFragment=function(e,t,s){var l=this.getTrackById(e),h=this.getSample(l,t);if(h==null)return this.setNextSeekPositionFromSample(l.samples[t]),null;var m=s||new d;m.endianness=d.BIG_ENDIAN;var y=this.createSingleSampleMoof(h);y.write(m),y.trafs[0].truns[0].data_offset=y.size+8,n.debug("MP4Box","Adjusting data_offset with new value "+y.trafs[0].truns[0].data_offset),m.adjustUint32(y.trafs[0].truns[0].data_offset_position,y.trafs[0].truns[0].data_offset);var b=new r.mdatBox;return b.data=h.data,b.write(m),m},S.writeInitializationSegment=function(e,t,s,l){var h;n.debug("ISOFile","Generating initialization segment");var m=new d;m.endianness=d.BIG_ENDIAN,e.write(m);var y=t.add("mvex");for(s&&y.add("mehd").set("fragment_duration",s),h=0;h<t.traks.length;h++)y.add("trex").set("track_id",t.traks[h].tkhd.track_id).set("default_sample_description_index",1).set("default_sample_duration",l).set("default_sample_size",0).set("default_sample_flags",65536);return t.write(m),m.buffer},S.prototype.save=function(e){var t=new d;t.endianness=d.BIG_ENDIAN,this.write(t),t.save(e)},S.prototype.getBuffer=function(){var e=new d;return e.endianness=d.BIG_ENDIAN,this.write(e),e.buffer},S.prototype.initializeSegmentation=function(){var e,t,s,l;for(this.onSegment===null&&n.warn("MP4Box","No segmentation callback set!"),this.isFragmentationInitialized||(this.isFragmentationInitialized=!0,this.nextMoofNumber=0,this.resetTables()),t=[],e=0;e<this.fragmentedTracks.length;e++){var h=new r.moovBox;h.mvhd=this.moov.mvhd,h.boxes.push(h.mvhd),s=this.getTrackById(this.fragmentedTracks[e].id),h.boxes.push(s),h.traks.push(s),l={},l.id=s.tkhd.track_id,l.user=this.fragmentedTracks[e].user,l.buffer=S.writeInitializationSegment(this.ftyp,h,this.moov.mvex&&this.moov.mvex.mehd?this.moov.mvex.mehd.fragment_duration:void 0,this.moov.traks[e].samples.length>0?this.moov.traks[e].samples[0].duration:0),t.push(l)}return t},r.Box.prototype.printHeader=function(e){this.size+=8,this.size>c&&(this.size+=8),this.type==="uuid"&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},r.FullBox.prototype.printHeader=function(e){this.size+=4,r.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},r.Box.prototype.print=function(e){this.printHeader(e)},r.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t<this.boxes.length;t++)if(this.boxes[t]){var s=e.indent;e.indent+=" ",this.boxes[t].print(e),e.indent=s}},S.prototype.print=function(e){e.indent="";for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&this.boxes[t].print(e)},r.mvhdBox.prototype.print=function(e){r.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"timescale: "+this.timescale),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"rate: "+this.rate),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},r.tkhdBox.prototype.print=function(e){r.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var U={};U.createFile=function(e,t){var s=e!==void 0?e:!0,l=new S(t);return l.discardMdatData=!s,l},a.createFile=U.createFile}(mt)),mt}var yt=fn(),hn=Zt(yt),vt={exports:{}},ei;function un(){return ei||(ei=1,function(a){var n={};a.exports=n,n.parse=function(o,d){for(var c=n.bin.readUshort,f=n.bin.readUint,_=0,u={},r=new Uint8Array(o),p=r.length-4;f(r,p)!=101010256;)p--;var _=p;_+=4,_+=4;var g=c(r,_);_+=2,c(r,_),_+=2;var v=f(r,_);_+=4;var E=f(r,_);_+=4,_=E;for(var S=0;S<g;S++){f(r,_),_+=4,_+=4,_+=4,_+=4,f(r,_),_+=4;var v=f(r,_);_+=4;var U=f(r,_);_+=4;var e=c(r,_),t=c(r,_+2),s=c(r,_+4);_+=6,_+=8;var l=f(r,_);_+=4,_+=e+t+s,n._readLocal(r,l,u,v,U,d)}return u},n._readLocal=function(o,d,c,f,u,r){var p=n.bin.readUshort,_=n.bin.readUint;_(o,d),d+=4,p(o,d),d+=2,p(o,d),d+=2;var g=p(o,d);d+=2,_(o,d),d+=4,_(o,d),d+=4,d+=8;var v=p(o,d);d+=2;var E=p(o,d);d+=2;var S=n.bin.readUTF8(o,d,v);if(d+=v,d+=E,r){c[S]={size:u,csize:f};return}var U=new Uint8Array(o.buffer,d);if(g==0)c[S]=new Uint8Array(U.buffer.slice(d,d+f));else if(g==8){var e=new Uint8Array(u);n.inflateRaw(U,e),c[S]=e}else throw"unknown compression method: "+g},n.inflateRaw=function(o,d){return n.F.inflate(o,d)},n.inflate=function(o,d){return o[0],o[1],n.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),d)},n.deflate=function(o,d){d==null&&(d={level:6});var c=0,f=new Uint8Array(50+Math.floor(o.length*1.1));f[c]=120,f[c+1]=156,c+=2,c=n.F.deflateRaw(o,f,c,d.level);var u=n.adler(o,0,o.length);return f[c+0]=u>>>24&255,f[c+1]=u>>>16&255,f[c+2]=u>>>8&255,f[c+3]=u>>>0&255,new Uint8Array(f.buffer,0,c+4)},n.deflateRaw=function(o,d){d==null&&(d={level:6});var c=new Uint8Array(50+Math.floor(o.length*1.1)),f=n.F.deflateRaw(o,c,f,d.level);return new Uint8Array(c.buffer,0,f)},n.encode=function(o,d){d==null&&(d=!1);var c=0,f=n.bin.writeUint,u=n.bin.writeUshort,r={};for(var p in o){var _=!n._noNeed(p)&&!d,g=o[p],v=n.crc.crc(g,0,g.length);r[p]={cpr:_,usize:g.length,crc:v,file:_?n.deflateRaw(g):g}}for(var p in r)c+=r[p].file.length+30+46+2*n.bin.sizeUTF8(p);c+=22;var E=new Uint8Array(c),S=0,U=[];for(var p in r){var e=r[p];U.push(S),S=n._writeHeader(E,S,p,e,0)}var t=0,s=S;for(var p in r){var e=r[p];U.push(S),S=n._writeHeader(E,S,p,e,1,U[t++])}var l=S-s;return f(E,S,101010256),S+=4,S+=4,u(E,S,t),S+=2,u(E,S,t),S+=2,f(E,S,l),S+=4,f(E,S,s),S+=4,S+=2,E.buffer},n._noNeed=function(o){var d=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(d)!=-1},n._writeHeader=function(o,d,c,f,u,r){var p=n.bin.writeUint,_=n.bin.writeUshort,g=f.file;p(o,d,u==0?67324752:33639248),d+=4,u==1&&(d+=2),_(o,d,20),d+=2,_(o,d,0),d+=2,_(o,d,f.cpr?8:0),d+=2,p(o,d,0),d+=4,p(o,d,f.crc),d+=4,p(o,d,g.length),d+=4,p(o,d,f.usize),d+=4,_(o,d,n.bin.sizeUTF8(c)),d+=2,_(o,d,0),d+=2,u==1&&(d+=2,d+=2,d+=6,p(o,d,r),d+=4);var v=n.bin.writeUTF8(o,d,c);return d+=v,u==0&&(o.set(g,d),d+=g.length),d},n.crc={table:function(){for(var o=new Uint32Array(256),d=0;d<256;d++){for(var c=d,f=0;f<8;f++)c&1?c=3988292384^c>>>1:c=c>>>1;o[d]=c}return o}(),update:function(o,d,c,f){for(var u=0;u<f;u++)o=n.crc.table[(o^d[c+u])&255]^o>>>8;return o},crc:function(o,d,c){return n.crc.update(4294967295,o,d,c)^4294967295}},n.adler=function(o,d,c){for(var f=1,u=0,r=d,p=d+c;r<p;){for(var _=Math.min(r+5552,p);r<_;)f+=o[r++],u+=f;f=f%65521,u=u%65521}return u<<16|f},n.bin={readUshort:function(o,d){return o[d]|o[d+1]<<8},writeUshort:function(o,d,c){o[d]=c&255,o[d+1]=c>>8&255},readUint:function(o,d){return o[d+3]*(256*256*256)+(o[d+2]<<16|o[d+1]<<8|o[d])},writeUint:function(o,d,c){o[d]=c&255,o[d+1]=c>>8&255,o[d+2]=c>>16&255,o[d+3]=c>>24&255},readASCII:function(o,d,c){for(var f="",u=0;u<c;u++)f+=String.fromCharCode(o[d+u]);return f},writeASCII:function(o,d,c){for(var f=0;f<c.length;f++)o[d+f]=c.charCodeAt(f)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,d,c){for(var f="",u,r=0;r<c;r++)f+="%"+n.bin.pad(o[d+r].toString(16));try{u=decodeURIComponent(f)}catch{return n.bin.readASCII(o,d,c)}return u},writeUTF8:function(o,d,c){for(var f=c.length,u=0,r=0;r<f;r++){var p=c.charCodeAt(r);if(!(p&4294967168))o[d+u]=p,u++;else if(!(p&4294965248))o[d+u]=192|p>>6,o[d+u+1]=128|p>>0&63,u+=2;else if(!(p&4294901760))o[d+u]=224|p>>12,o[d+u+1]=128|p>>6&63,o[d+u+2]=128|p>>0&63,u+=3;else if(!(p&4294967295-(1<<21)+1))o[d+u]=240|p>>18,o[d+u+1]=128|p>>12&63,o[d+u+2]=128|p>>6&63,o[d+u+3]=128|p>>0&63,u+=4;else throw"e"}return u},sizeUTF8:function(o){for(var d=o.length,c=0,f=0;f<d;f++){var u=o.charCodeAt(f);if(!(u&4294967168))c++;else if(!(u&4294965248))c+=2;else if(!(u&4294901760))c+=3;else if(!(u&4294967295-(1<<21)+1))c+=4;else throw"e"}return c}},n.F={},n.F.deflateRaw=function(o,d,c,f){var u=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]],r=u[f],p=n.F.U,_=n.F._goodIndex;n.F._hash;var g=n.F._putsE,v=0,E=c<<3,S=0,U=o.length;if(f==0){for(;v<U;){var e=Math.min(65535,U-v);g(d,E,v+e==U?1:0),E=n.F._copyExact(o,v,e,d,E+8),v+=e}return E>>>3}var t=p.lits,s=p.strt,l=p.prev,h=0,m=0,y=0,b=0,x=0,w=0;for(U>2&&(w=n.F._hash(o,0),s[w]=0),v=0;v<U;v++){if(x=w,v+1<U-2){w=n.F._hash(o,v+1);var T=v+1&32767;l[T]=s[w],s[w]=T}if(S<=v){(h>14e3||m>26697)&&U-v>100&&(S<v&&(t[h]=v-S,h+=2,S=v),E=n.F._writeBlock(v==U-1||S==U?1:0,t,h,b,o,y,v-y,d,E),h=m=b=0,y=v);var C=0;v<U-2&&(C=n.F._bestMatch(o,v,l,x,Math.min(r[2],U-v),r[3]));var e=C>>>16,F=C&65535;if(C!=0){var e=C>>>16,F=C&65535,A=_(e,p.of0);p.lhst[257+A]++;var R=_(F,p.df0);p.dhst[R]++,b+=p.exb[A]+p.dxb[R],t[h]=e<<23|v-S,t[h+1]=F<<16|A<<8|R,h+=2,S=v+e}else p.lhst[o[v]]++;m++}}for((y!=v||o.length==0)&&(S<v&&(t[h]=v-S,h+=2,S=v),E=n.F._writeBlock(1,t,h,b,o,y,v-y,d,E),h=0,m=0,h=m=b=0,y=v);E&7;)E++;return E>>>3},n.F._bestMatch=function(o,d,c,f,u,r){var p=d&32767,_=c[p],g=p-_+32768&32767;if(_==p||f!=n.F._hash(o,d-g))return 0;for(var v=0,E=0,S=Math.min(32767,d);g<=S&&--r!=0&&_!=p;){if(v==0||o[d+v]==o[d+v-g]){var U=n.F._howLong(o,d,g);if(U>v){if(v=U,E=g,v>=u)break;g+2<U&&(U=g+2);for(var e=0,t=0;t<U-2;t++){var s=d-g+t+32768&32767,l=c[s],h=s-l+32768&32767;h>e&&(e=h,_=s)}}}p=_,_=c[p],g+=p-_+32768&32767}return v<<16|E},n.F._howLong=function(o,d,c){if(o[d]!=o[d-c]||o[d+1]!=o[d+1-c]||o[d+2]!=o[d+2-c])return 0;var f=d,u=Math.min(o.length,d+258);for(d+=3;d<u&&o[d]==o[d-c];)d++;return d-f},n.F._hash=function(o,d){return(o[d]<<8|o[d+1])+(o[d+2]<<4)&65535},n.saved=0,n.F._writeBlock=function(o,d,c,f,u,r,p,_,g){var v=n.F.U,E=n.F._putsF,S=n.F._putsE,U,e,t,s,l,h,m,y,b;v.lhst[256]++,U=n.F.getTrees(),e=U[0],t=U[1],s=U[2],l=U[3],h=U[4],m=U[5],y=U[6],b=U[7];var x=(g+3&7?8-(g+3&7):0)+32+(p<<3),w=f+n.F.contSize(v.fltree,v.lhst)+n.F.contSize(v.fdtree,v.dhst),T=f+n.F.contSize(v.ltree,v.lhst)+n.F.contSize(v.dtree,v.dhst);T+=14+3*m+n.F.contSize(v.itree,v.ihst)+(v.ihst[16]*2+v.ihst[17]*3+v.ihst[18]*7);for(var C=0;C<286;C++)v.lhst[C]=0;for(var C=0;C<30;C++)v.dhst[C]=0;for(var C=0;C<19;C++)v.ihst[C]=0;var F=x<w&&x<T?0:w<T?1:2;if(E(_,g,o),E(_,g+1,F),g+=3,F==0){for(;g&7;)g++;g=n.F._copyExact(u,r,p,_,g)}else{var A,R;if(F==1&&(A=v.fltree,R=v.fdtree),F==2){n.F.makeCodes(v.ltree,e),n.F.revCodes(v.ltree,e),n.F.makeCodes(v.dtree,t),n.F.revCodes(v.dtree,t),n.F.makeCodes(v.itree,s),n.F.revCodes(v.itree,s),A=v.ltree,R=v.dtree,S(_,g,l-257),g+=5,S(_,g,h-1),g+=5,S(_,g,m-4),g+=4;for(var P=0;P<m;P++)S(_,g+P*3,v.itree[(v.ordr[P]<<1)+1]);g+=3*m,g=n.F._codeTiny(y,v.itree,_,g),g=n.F._codeTiny(b,v.itree,_,g)}for(var K=r,Z=0;Z<c;Z+=2){for(var $=d[Z],G=$>>>23,q=K+($&(1<<23)-1);K<q;)g=n.F._writeLit(u[K++],A,_,g);if(G!=0){var ee=d[Z+1],Ee=ee>>16,j=ee>>8&255,W=ee&255;g=n.F._writeLit(257+j,A,_,g),S(_,g,G-v.of0[j]),g+=v.exb[j],g=n.F._writeLit(W,R,_,g),E(_,g,Ee-v.df0[W]),g+=v.dxb[W],K+=G}}g=n.F._writeLit(256,A,_,g)}return g},n.F._copyExact=function(o,d,c,f,u){var r=u>>>3;return f[r]=c,f[r+1]=c>>>8,f[r+2]=255-f[r],f[r+3]=255-f[r+1],r+=4,f.set(new Uint8Array(o.buffer,d,c),r),u+(c+4<<3)},n.F.getTrees=function(){for(var o=n.F.U,d=n.F._hufTree(o.lhst,o.ltree,15),c=n.F._hufTree(o.dhst,o.dtree,15),f=[],u=n.F._lenCodes(o.ltree,f),r=[],p=n.F._lenCodes(o.dtree,r),_=0;_<f.length;_+=2)o.ihst[f[_]]++;for(var _=0;_<r.length;_+=2)o.ihst[r[_]]++;for(var g=n.F._hufTree(o.ihst,o.itree,7),v=19;v>4&&o.itree[(o.ordr[v-1]<<1)+1]==0;)v--;return[d,c,g,u,p,v,f,r]},n.F.getSecond=function(o){for(var d=[],c=0;c<o.length;c+=2)d.push(o[c+1]);return d},n.F.nonZero=function(o){for(var d="",c=0;c<o.length;c+=2)o[c+1]!=0&&(d+=(c>>1)+",");return d},n.F.contSize=function(o,d){for(var c=0,f=0;f<d.length;f++)c+=d[f]*o[(f<<1)+1];return c},n.F._codeTiny=function(o,d,c,f){for(var u=0;u<o.length;u+=2){var r=o[u],p=o[u+1];f=n.F._writeLit(r,d,c,f);var _=r==16?2:r==17?3:7;r>15&&(n.F._putsE(c,f,p,_),f+=_)}return f},n.F._lenCodes=function(o,d){for(var c=o.length;c!=2&&o[c-1]==0;)c-=2;for(var f=0;f<c;f+=2){var u=o[f+1],r=f+3<c?o[f+3]:-1,p=f+5<c?o[f+5]:-1,_=f==0?-1:o[f-1];if(u==0&&r==u&&p==u){for(var g=f+5;g+2<c&&o[g+2]==u;)g+=2;var v=Math.min(g+1-f>>>1,138);v<11?d.push(17,v-3):d.push(18,v-11),f+=v*2-2}else if(u==_&&r==u&&p==u){for(var g=f+5;g+2<c&&o[g+2]==u;)g+=2;var v=Math.min(g+1-f>>>1,6);d.push(16,v-3),f+=v*2-2}else d.push(u,0)}return c>>>1},n.F._hufTree=function(o,d,c){var f=[],u=o.length,r=d.length,p=0;for(p=0;p<r;p+=2)d[p]=0,d[p+1]=0;for(p=0;p<u;p++)o[p]!=0&&f.push({lit:p,f:o[p]});var _=f.length,g=f.slice(0);if(_==0)return 0;if(_==1){var v=f[0].lit,g=v==0?1:0;return d[(v<<1)+1]=1,d[(g<<1)+1]=1,1}f.sort(function(l,h){return l.f-h.f});var E=f[0],S=f[1],U=0,e=1,t=2;for(f[0]={lit:-1,f:E.f+S.f,l:E,r:S,d:0};e!=_-1;)U!=e&&(t==_||f[U].f<f[t].f)?E=f[U++]:E=f[t++],U!=e&&(t==_||f[U].f<f[t].f)?S=f[U++]:S=f[t++],f[e++]={lit:-1,f:E.f+S.f,l:E,r:S};var s=n.F.setDepth(f[e-1],0);for(s>c&&(n.F.restrictDepth(g,c,s),s=c),p=0;p<_;p++)d[(g[p].lit<<1)+1]=g[p].d;return s},n.F.setDepth=function(o,d){return o.lit!=-1?(o.d=d,d):Math.max(n.F.setDepth(o.l,d+1),n.F.setDepth(o.r,d+1))},n.F.restrictDepth=function(o,d,c){var f=0,u=1<<c-d,r=0;for(o.sort(function(_,g){return g.d==_.d?_.f-g.f:g.d-_.d}),f=0;f<o.length&&o[f].d>d;f++){var p=o[f].d;o[f].d=d,r+=u-(1<<c-p)}for(r=r>>>c-d;r>0;){var p=o[f].d;p<d?(o[f].d++,r-=1<<d-p-1):f++}for(;f>=0;f--)o[f].d==d&&r<0&&(o[f].d--,r++);r!=0&&console.log("debt left")},n.F._goodIndex=function(o,d){var c=0;return d[c|16]<=o&&(c|=16),d[c|8]<=o&&(c|=8),d[c|4]<=o&&(c|=4),d[c|2]<=o&&(c|=2),d[c|1]<=o&&(c|=1),c},n.F._writeLit=function(o,d,c,f){return n.F._putsF(c,f,d[o<<1]),f+d[(o<<1)+1]},n.F.inflate=function(o,d){var c=Uint8Array;if(o[0]==3&&o[1]==0)return d||new c(0);var f=n.F,u=f._bitsF,r=f._bitsE,p=f._decodeTiny,_=f.makeCodes,g=f.codes2map,v=f._get17,E=f.U,S=d==null;S&&(d=new c(o.length>>>2<<3));for(var U=0,e=0,t=0,s=0,l=0,h=0,m=0,y=0,b=0,x,w;U==0;){if(U=u(o,b,1),e=u(o,b+1,2),b+=3,e==0){b&7&&(b+=8-(b&7));var T=(b>>>3)+4,C=o[T-4]|o[T-3]<<8;S&&(d=n.F._check(d,y+C)),d.set(new c(o.buffer,o.byteOffset+T,C),y),b=T+C<<3,y+=C;continue}if(S&&(d=n.F._check(d,y+(1<<17))),e==1&&(x=E.flmap,w=E.fdmap,h=511,m=31),e==2){t=r(o,b,5)+257,s=r(o,b+5,5)+1,l=r(o,b+10,4)+4,b+=14;for(var F=0;F<38;F+=2)E.itree[F]=0,E.itree[F+1]=0;for(var A=1,F=0;F<l;F++){var R=r(o,b+F*3,3);E.itree[(E.ordr[F]<<1)+1]=R,R>A&&(A=R)}b+=3*l,_(E.itree,A),g(E.itree,A,E.imap),x=E.lmap,w=E.dmap,b=p(E.imap,(1<<A)-1,t+s,o,b,E.ttree);var P=f._copyOut(E.ttree,0,t,E.ltree);h=(1<<P)-1;var K=f._copyOut(E.ttree,t,s,E.dtree);m=(1<<K)-1,_(E.ltree,P),g(E.ltree,P,x),_(E.dtree,K),g(E.dtree,K,w)}for(;;){var Z=x[v(o,b)&h];b+=Z&15;var $=Z>>>4;if(!($>>>8))d[y++]=$;else{if($==256)break;var G=y+$-254;if($>264){var q=E.ldef[$-257];G=y+(q>>>3)+r(o,b,q&7),b+=q&7}var ee=w[v(o,b)&m];b+=ee&15;var Ee=ee>>>4,j=E.ddef[Ee],W=(j>>>4)+u(o,b,j&15);for(b+=j&15,S&&(d=n.F._check(d,y+(1<<17)));y<G;)d[y]=d[y++-W],d[y]=d[y++-W],d[y]=d[y++-W],d[y]=d[y++-W];y=G}}}return d.length==y?d:d.slice(0,y)},n.F._check=function(o,d){var c=o.length;if(d<=c)return o;var f=new Uint8Array(Math.max(c<<1,d));return f.set(o,0),f},n.F._decodeTiny=function(o,d,c,f,u,r){for(var p=n.F._bitsE,_=n.F._get17,g=0;g<c;){var v=o[_(f,u)&d];u+=v&15;var E=v>>>4;if(E<=15)r[g]=E,g++;else{var S=0,U=0;E==16?(U=3+p(f,u,2),u+=2,S=r[g-1]):E==17?(U=3+p(f,u,3),u+=3):E==18&&(U=11+p(f,u,7),u+=7);for(var e=g+U;g<e;)r[g]=S,g++}}return u},n.F._copyOut=function(o,d,c,f){for(var u=0,r=0,p=f.length>>>1;r<c;){var _=o[r+d];f[r<<1]=0,f[(r<<1)+1]=_,_>u&&(u=_),r++}for(;r<p;)f[r<<1]=0,f[(r<<1)+1]=0,r++;return u},n.F.makeCodes=function(o,d){for(var c=n.F.U,f=o.length,u,r,p,_,g,v=c.bl_count,_=0;_<=d;_++)v[_]=0;for(_=1;_<f;_+=2)v[o[_]]++;var E=c.next_code;for(u=0,v[0]=0,r=1;r<=d;r++)u=u+v[r-1]<<1,E[r]=u;for(p=0;p<f;p+=2)g=o[p+1],g!=0&&(o[p]=E[g],E[g]++)},n.F.codes2map=function(o,d,c){for(var f=o.length,u=n.F.U,r=u.rev15,p=0;p<f;p+=2)if(o[p+1]!=0)for(var _=p>>1,g=o[p+1],v=_<<4|g,E=d-g,S=o[p]<<E,U=S+(1<<E);S!=U;){var e=r[S]>>>15-d;c[e]=v,S++}},n.F.revCodes=function(o,d){for(var c=n.F.U.rev15,f=15-d,u=0;u<o.length;u+=2){var r=o[u]<<d-o[u+1];o[u]=c[r]>>>f}},n.F._putsE=function(o,d,c){c=c<<(d&7);var f=d>>>3;o[f]|=c,o[f+1]|=c>>>8},n.F._putsF=function(o,d,c){c=c<<(d&7);var f=d>>>3;o[f]|=c,o[f+1]|=c>>>8,o[f+2]|=c>>>16},n.F._bitsE=function(o,d,c){return(o[d>>>3]|o[(d>>>3)+1]<<8)>>>(d&7)&(1<<c)-1},n.F._bitsF=function(o,d,c){return(o[d>>>3]|o[(d>>>3)+1]<<8|o[(d>>>3)+2]<<16)>>>(d&7)&(1<<c)-1},n.F._get17=function(o,d){return(o[d>>>3]|o[(d>>>3)+1]<<8|o[(d>>>3)+2]<<16)>>>(d&7)},n.F._get25=function(o,d){return(o[d>>>3]|o[(d>>>3)+1]<<8|o[(d>>>3)+2]<<16|o[(d>>>3)+3]<<24)>>>(d&7)},n.F.U=function(){var o=Uint16Array,d=Uint32Array;return{next_code:new o(16),bl_count:new o(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new o(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new d(32),flmap:new o(512),fltree:[],fdmap:new o(32),fdtree:[],lmap:new o(32768),ltree:[],ttree:[],dmap:new o(32768),dtree:[],imap:new o(512),itree:[],rev15:new o(32768),lhst:new d(286),dhst:new d(30),ihst:new d(19),lits:new d(15e3),strt:new o(65536),prev:new o(32768)}}(),function(){for(var o=n.F.U,d=32768,c=0;c<d;c++){var f=c;f=(f&2863311530)>>>1|(f&1431655765)<<1,f=(f&3435973836)>>>2|(f&858993459)<<2,f=(f&4042322160)>>>4|(f&252645135)<<4,f=(f&4278255360)>>>8|(f&16711935)<<8,o.rev15[c]=(f>>>16|f<<16)>>>17}function u(r,p,_){for(;p--!=0;)r.push(0,_)}for(var c=0;c<32;c++)o.ldef[c]=o.of0[c]<<3|o.exb[c],o.ddef[c]=o.df0[c]<<4|o.dxb[c];u(o.fltree,144,8),u(o.fltree,112,9),u(o.fltree,24,7),u(o.fltree,8,8),n.F.makeCodes(o.fltree,9),n.F.codes2map(o.fltree,9,o.flmap),n.F.revCodes(o.fltree,9),u(o.fdtree,32,5),n.F.makeCodes(o.fdtree,5),n.F.codes2map(o.fdtree,5,o.fdmap),n.F.revCodes(o.fdtree,5),u(o.itree,19,0),u(o.ltree,286,0),u(o.dtree,30,0),u(o.ttree,320,0)}()}(vt)),vt.exports}var pn=un(),ti=Zt(pn);const V=class V{constructor(n,o,d,c,f){this.copy=()=>new V(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const u=":";let r=("0"+this.h).slice(-2)+u+("0"+this.m).slice(-2)+u+("0"+this.s).slice(-2)+u+("0"+this.f).slice(-2);return r+="."+(this.field?"1":"2"),r},this.toZipTimeCodeString=()=>{const u=this.copy();return u.f=0,u.s=u.s%2===0?u.s:u.s-1,u.field=0,V.toStr(u)},this.toFrames=u=>{let r=60,p=0;Math.floor(u)==60?(r=60,p=0):Math.floor(u)==59?(r=60,p=4):Math.floor(u)==30?(r=30,p=0):Math.floor(u)==29&&(r=30,p=2);let _=this.h,g=this.m,v=this.s,E=this.f,S=this.field;const U=_*60+g,t=(U-Math.floor(U/10))*p;return _*(r*3600)+g*(r*60)+v*r+(E*2+S)-t},this.addSeconds=u=>{let r=this.copy();if(r.s+=u,r.s>=60){const p=Math.floor(r.s/60);if(r.s=r.s%60,r.m+=p,r.m>=60){const _=Math.floor(r.m/60);r.m=r.m%60,r.h+=_}}return r},this.addFrames=(u,r)=>{let p=this.toFrames(r);return p+=u,V.fromFrames(p,r)},this.subtractFrames=(u,r)=>this.addFrames(-u,r),this.h=n||0,this.m=o||0,this.s=d||0,this.f=c||0,this.field=f||0}static compare(n,o){return n.h!==o.h?n.h<o.h?-1:1:n.m!==o.m?n.m<o.m?-1:1:n.s!==o.s?n.s<o.s?-1:1:n.f!==o.f?n.f<o.f?-1:1:n.field!==o.field?n.field<o.field?-1:1:0}static generateTimecodeRange(n,o,d){const c=[];let f=n;for(;V.compare(f,o)<=0;)c.push(f),f=f.addSeconds(d);return c}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(n){return this.toFrames(n)*1e3/n}};V.calculateCurrentTimeCode=n=>{var v;if(!n.video||!n.clocker||!n.gameParams)throw new Error("OTTPlayer is not initialized");const o=n.video,d=n.clocker,c=d.videoFPScalculator.getFPS(),r=(o.currentTime-d.syncPoint.playerTime)%(60*60*24)*c+d.syncPoint.frame;if(r===0||c===0)throw new Error("Current frame is 0 or fps is 0");const p=V.calculateCurrentOffset(r,(v=n.gameParams)==null?void 0:v.offsets);if(p===void 0)throw new Error("Offset is undefined");let _=Math.floor(r-p);return _<0&&(_+=5178816),_>=5178816&&(_-=5178816),V.fromFrames(_,c)},V.calculateCurrentOffset=(n,o)=>{for(let d=1;d<o.length;d++)if(n<o[d].frame)return o[d-1].offset;return Math.abs(o[o.length-1].offset)},V.fromFrames=(n,o)=>{let d=60,c=0;Math.floor(o)==60?(d=60,c=0):Math.floor(o)==59?(d=60,c=4):Math.floor(o)==30?(d=30,c=0):Math.floor(o)==29&&(d=30,c=2);let f=Math.floor(o*60),u=Math.floor(o*60*10),r=u*6,p=n,_=Math.floor(p/r);p-=_*r;let g=Math.floor(p/u);p-=g*u,p>=d*60&&(p+=c*(Math.floor((p-d*60)/f)+1));let v=Math.floor(p/(d*60));p-=v*(d*60);let E=Math.floor(p/d);p-=E*d;let S=p;v+=g*10;let U=0;return U=S%2,S=Math.floor(S/2),new V(_,v,E,S,U)},V.toStr=n=>{const o="_";let d=("0"+n.h).slice(-2)+o+("0"+n.m).slice(-2)+o+("0"+n.s).slice(-2)+o+("0"+n.f).slice(-2);return n.field&&(d+="_1"),d},V.fromStr=n=>{const d=n.split("_").map(Number);if(d.length==4){const[c,f,u,r]=d;return new V(c,f,u,r,0)}else if(d.length==5){const[c,f,u,r,p]=d;return new V(c,f,u,r,p)}else throw new Error("Invalid timecode format: "+n)},V.fromMetadata=n=>{const o=/^(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d))?$/,d=n.timecode.match(o);if(!d)throw new Error("Invalid timecode format: "+n.timecode);const[,c,f,u,r,p]=d,_=Number(c),g=Number(f),v=Number(u),E=Number(r),S=p?Number(p):0;return new V(_,g,v,E,S)};let O=V;const M={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},te=console,he={};Object.keys(M).forEach(a=>{he[a]=te[a]});const Be="Datadog Browser SDK:",N={debug:he.debug.bind(te,Be),log:he.log.bind(te,Be),info:he.info.bind(te,Be),warn:he.warn.bind(te,Be),error:he.error.bind(te,Be)},St="https://docs.datadoghq.com",ii=`${St}/real_user_monitoring/browser/troubleshooting`,Ve="More details:";function ni(a,n){return(...o)=>{try{return a(...o)}catch(d){N.error(n,d)}}}function $e(a){return a!==0&&Math.random()*100<=a}function _n(a){return gn(a)&&a>=0&&a<=100}function gn(a){return typeof a=="number"}const ke=1e3,ue=60*ke,ri=60*ue,mn=365*(24*ri);function Le(){return new Date().getTime()}function oe(){return Le()}function je(){return performance.now()}function ae(){return{relative:je(),timeStamp:oe()}}function yn(){return{relative:0,timeStamp:si()}}function vn(a,n){return n-a}function Sn(a,n){return a+n}function bn(a){return a-si()}let bt;function si(){return bt===void 0&&(bt=performance.timing.navigationStart),bt}const ie=1024,oi=1024*ie,xn=/[^\\u0000-\\u007F]/;function xt(a){return xn.test(a)?window.TextEncoder!==void 0?new TextEncoder().encode(a).length:new Blob([a]).size:a.length}function En(a){return{...a}}function ai(a,n){return Object.keys(a).some(o=>a[o]===n)}function De(a){return Object.keys(a).length===0}function de(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let a=_dd_temp_;return delete Object.prototype._dd_temp_,typeof a!="object"&&(typeof self=="object"?a=self:typeof window=="object"?a=window:a={}),a}function Ue(a,n){const o=de();let d;return o.Zone&&typeof o.Zone.__symbol__=="function"&&(d=a[o.Zone.__symbol__(n)]),d||(d=a[n]),d}let Ke,di=!1;function Un(a){Ke=a}function wn(a){di=a}function Tn(a,n,o){const d=o.value;o.value=function(...c){return(Ke?D(d):d).apply(this,c)}}function D(a){return function(){return Re(a,this,arguments)}}function Re(a,n,o){try{return a.apply(n,o)}catch(d){Cn(d)}}function Cn(a){if(Et(a),Ke)try{Ke(a)}catch(n){Et(n)}}function Et(...a){di&&N.error("[MONITOR]",...a)}function Pe(a,n){return Ue(de(),"setTimeout")(D(a),n)}function li(a){Ue(de(),"clearTimeout")(a)}function Ut(a,n){return Ue(de(),"setInterval")(D(a),n)}function ci(a){Ue(de(),"clearInterval")(a)}class H{constructor(n){this.onFirstSubscribe=n,this.observers=[]}subscribe(n){return this.observers.push(n),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(o=>n!==o),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(n){this.observers.forEach(o=>o(n))}}function fi(...a){return new H(n=>{const o=a.map(d=>d.subscribe(c=>n.notify(c)));return()=>o.forEach(d=>d.unsubscribe())})}function hi(a,n,o){let d=!1,c,f;return{throttled:(...u)=>{if(d){c=u;return}a(...u),d=!0,f=Pe(()=>{c&&a(...c),d=!1,c=void 0},n)},cancel:()=>{li(f),d=!1,c=void 0}}}function le(){}function ce(a){return a?(parseInt(a,10)^Math.random()*16>>parseInt(a,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,ce)}const qe=/([\\w-]+)\\s*=\\s*([^;]+)/g;function An(a,n){for(qe.lastIndex=0;;){const o=qe.exec(a);if(o){if(o[1]===n)return o[2]}else break}}function In(a){const n=new Map;for(qe.lastIndex=0;;){const o=qe.exec(a);if(o)n.set(o[1],o[2]);else break}return n}function Fn(a,n,o=""){const d=a.charCodeAt(n-1),f=d>=55296&&d<=56319?n+1:n;return a.length<=f?a:`${a.slice(0,f)}${o}`}function Bn(){return kn()===0}let We;function kn(){return We??(We=Ln())}function Ln(a=window){var n;const o=a.navigator.userAgent;return a.chrome||/HeadlessChrome/.test(o)?0:((n=a.navigator.vendor)===null||n===void 0?void 0:n.indexOf("Apple"))===0||/safari/i.test(o)&&!/chrome|android/i.test(o)?1:2}function Oe(a,n,o=0,d){const c=new Date;c.setTime(c.getTime()+o);const f=`expires=${c.toUTCString()}`,u=d&&d.crossSite?"none":"strict",r=d&&d.domain?`;domain=${d.domain}`:"",p=d&&d.secure?";secure":"",_=d&&d.partitioned?";partitioned":"";document.cookie=`${a}=${n};${f};path=/;samesite=${u}${r}${p}${_}`}function wt(a){return An(document.cookie,a)}let Tt;function pe(a){return Tt||(Tt=In(document.cookie)),Tt.get(a)}function ui(a,n){Oe(a,"",0,n)}function Dn(a){if(document.cookie===void 0||document.cookie===null)return!1;try{const n=`dd_cookie_test_${ce()}`,o="test";Oe(n,o,ue,a);const d=wt(n)===o;return ui(n,a),d}catch(n){return N.error(n),!1}}let Ct;function Rn(){if(Ct===void 0){const a=`dd_site_test_${ce()}`,n="test",o=window.location.hostname.split(".");let d=o.pop();for(;o.length&&!wt(a);)d=`${o.pop()}.${d}`,Oe(a,n,ke,{domain:d});ui(a,{domain:d}),Ct=d}return Ct}const we="_dd_s";function Je(a){return Object.values(a)}function Pn(a){return Object.entries(a)}const At=4*ri,pi=15*ue,On=mn,ze={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},_i=/^([a-zA-Z]+)=([a-z0-9-]+)$/,It="&";function zn(a){return!!a&&(a.indexOf(It)!==-1||_i.test(a))}const Mn="1";function _e(a,n){const o={isExpired:Mn};return n.trackAnonymousUser&&(a!=null&&a.anonymousId?o.anonymousId=a==null?void 0:a.anonymousId:o.anonymousId=ce()),o}function Xe(a){return De(a)}function gi(a){return!Xe(a)}function Ze(a){return a.isExpired!==void 0||!Nn(a)}function Nn(a){return(a.created===void 0||Le()-Number(a.created)<At)&&(a.expire===void 0||Le()<Number(a.expire))}function mi(a){a.expire=String(Le()+pi)}function Ft(a){return Pn(a).map(([n,o])=>n==="anonymousId"?`aid=${o}`:`${n}=${o}`).join(It)}function yi(a){const n={};return zn(a)&&a.split(It).forEach(o=>{const d=_i.exec(o);if(d!==null){const[,c,f]=d;c==="aid"?n.anonymousId=f:n[c]=f}}),n}const Gn="_dd",Hn="_dd_r",Yn="_dd_l",Vn="rum",$n="logs";function jn(a){if(!pe(we)){const o=pe(Gn),d=pe(Hn),c=pe(Yn),f={};o&&(f.id=o),c&&/^[01]$/.test(c)&&(f[$n]=c),d&&/^[012]$/.test(d)&&(f[Vn]=d),gi(f)&&(mi(f),a.persistSession(f))}}function vi(a){const n=Xn(a);return Dn(n)?{type:ze.COOKIE,cookieOptions:n}:void 0}function Kn(a,n){const o={isLockEnabled:Bn(),persistSession:qn(n),retrieveSession:Jn,expireSession:d=>Wn(n,d,a)};return jn(o),o}function qn(a){return n=>{Oe(we,Ft(n),pi,a)}}function Wn(a,n,o){const d=_e(n,o);Oe(we,Ft(d),o.trackAnonymousUser?On:At,a)}function Jn(){const a=wt(we);return yi(a)}function Xn(a){const n={};return n.secure=!!a.useSecureSessionCookie||!!a.usePartitionedCrossSiteSessionCookie,n.crossSite=!!a.usePartitionedCrossSiteSessionCookie,n.partitioned=!!a.usePartitionedCrossSiteSessionCookie,a.trackSessionAcrossSubdomains&&(n.domain=Rn()),n}const Zn="_dd_test_";function Si(){try{const a=ce(),n=`${Zn}${a}`;localStorage.setItem(n,a);const o=localStorage.getItem(n);return localStorage.removeItem(n),a===o?{type:ze.LOCAL_STORAGE}:void 0}catch{return}}function Qn(a){return{isLockEnabled:!1,persistSession:bi,retrieveSession:er,expireSession:n=>tr(n,a)}}function bi(a){localStorage.setItem(we,Ft(a))}function er(){const a=localStorage.getItem(we);return yi(a)}function tr(a,n){bi(_e(a,n))}const ir=10,nr=100,xi=[];let Qe;function ge(a,n,o=0){var d;const{isLockEnabled:c,persistSession:f,expireSession:u}=n,r=E=>f({...E,lock:_}),p=()=>{const E=n.retrieveSession(),S=E.lock;return E.lock&&delete E.lock,{session:E,lock:S}};if(Qe||(Qe=a),a!==Qe){xi.push(a);return}if(c&&o>=nr){Ei(n);return}let _,g=p();if(c){if(g.lock){et(a,n,o);return}if(_=ce(),r(g.session),g=p(),g.lock!==_){et(a,n,o);return}}let v=a.process(g.session);if(c&&(g=p(),g.lock!==_)){et(a,n,o);return}if(v&&(Ze(v)?u(v):(mi(v),c?r(v):f(v))),c&&!(v&&Ze(v))){if(g=p(),g.lock!==_){et(a,n,o);return}f(g.session),v=g.session}(d=a.after)===null||d===void 0||d.call(a,v||g.session),Ei(n)}function et(a,n,o){Pe(()=>{ge(a,n,o+1)},ir)}function Ei(a){Qe=void 0;const n=xi.shift();n&&ge(n,a)}const Ui=ke;function rr(a){switch(a.sessionPersistence){case ze.COOKIE:return vi(a);case ze.LOCAL_STORAGE:return Si();case void 0:{let n=vi(a);return!n&&a.allowFallbackToLocalStorage&&(n=Si()),n}default:N.error(`Invalid session persistence \'${String(a.sessionPersistence)}\'`)}}function sr(a,n,o,d){const c=new H,f=new H,u=new H,r=a.type===ze.COOKIE?Kn(n,a.cookieOptions):Qn(n),{expireSession:p}=r,_=Ut(U,Ui);let g;t();const{throttled:v,cancel:E}=hi(()=>{ge({process:x=>{if(Xe(x))return;const w=e(x);return s(w),w},after:x=>{gi(x)&&!l()&&y(x),g=x}},r)},Ui);function S(){ge({process:x=>l()?e(x):void 0},r)}function U(){ge({process:x=>Ze(x)?_e(x,n):void 0,after:e},r)}function e(x){return Ze(x)&&(x=_e(x,n)),l()&&(h(x)?m():(u.notify({previousState:g,newState:x}),g=x)),x}function t(){ge({process:x=>{if(Xe(x))return _e(x,n)},after:x=>{g=x}},r)}function s(x){if(Xe(x))return!1;const{trackingType:w,isTracked:T}=d(x[o]);x[o]=w,delete x.isExpired,T&&!x.id&&(x.id=ce(),x.created=String(Le()))}function l(){return g[o]!==void 0}function h(x){return g.id!==x.id||g[o]!==x[o]}function m(){g=_e(g,n),f.notify()}function y(x){g=x,c.notify()}function b(x){ge({process:w=>({...w,...x}),after:e},r)}return{expandOrRenewSession:v,expandSession:S,getSession:()=>g,renewObservable:c,expireObservable:f,sessionStateUpdateObservable:u,restartSession:t,expire:()=>{E(),p(g),e(_e(g,n))},stop:()=>{ci(_)},updateSessionState:b}}const Bt={GRANTED:"granted",NOT_GRANTED:"not-granted"};function or(a){const n=new H;return{tryToInit(o){a||(a=o)},update(o){a=o,n.notify()},isGranted(){return a===Bt.GRANTED},observable:n}}function me(a,n,o){if(typeof a!="object"||a===null)return JSON.stringify(a);const d=Te(Object.prototype),c=Te(Array.prototype),f=Te(Object.getPrototypeOf(a)),u=Te(a);try{return JSON.stringify(a,n,o)}catch{return"<error: unable to serialize object>"}finally{d(),c(),f(),u()}}function Te(a){const n=a,o=n.toJSON;return o?(delete n.toJSON,()=>{n.toJSON=o}):le}function kt(a){return ar(a,location.href).href}function ar(a,n){const o=dr();if(o)try{return n!==void 0?new o(a,n):new o(a)}catch(f){throw new Error(`Failed to construct URL: ${String(f)} ${me({url:a,base:n})}`)}if(n===void 0&&!/:/.test(a))throw new Error(`Invalid URL: \'${a}\'`);let d=document;const c=d.createElement("a");if(n!==void 0){d=document.implementation.createHTMLDocument("");const f=d.createElement("base");f.href=n,d.head.appendChild(f),d.body.appendChild(c)}return c.href=a,c}const wi=URL;let tt;function dr(){if(tt===void 0)try{tt=new wi("http://test/path").href==="http://test/path"}catch{tt=!1}return tt?wi:void 0}const lr="datad0g.com",cr="dd0g-gov.com",Ce="datadoghq.com",fr="ddog-gov.com",hr="pci.browser-intake-datadoghq.com",ur=["ddsource","ddtags"];function Me(a,n,o){const d=pr(a,n);return{build(c,f){const u=gr(a,n,o,c,f);return d(u)},urlPrefix:d(""),trackType:n}}function pr(a,n){const o=`/api/v2/${n}`,d=a.proxy;if(typeof d=="string"){const f=kt(d);return u=>`${f}?ddforward=${encodeURIComponent(`${o}?${u}`)}`}if(typeof d=="function")return f=>d({path:o,parameters:f});const c=_r(n,a);return f=>`https://${c}${o}?${f}`}function _r(a,n){const{site:o=Ce,internalAnalyticsSubdomain:d}=n;if(a==="logs"&&n.usePciIntake&&o===Ce)return hr;if(d&&o===Ce)return`${d}.${Ce}`;if(o===cr)return`http-intake.logs.${o}`;const c=o.split("."),f=c.pop();return`browser-intake-${c.join("-")}.${f}`}function gr({clientToken:a,internalAnalyticsSubdomain:n},o,d,c,{retry:f,encoding:u}){const r=["sdk_version:6.5.0",`api:${c}`].concat(d);f&&r.push(`retry_count:${f.count}`,`retry_after:${f.lastFailureStatus}`);const p=["ddsource=browser",`ddtags=${encodeURIComponent(r.join(","))}`,`dd-api-key=${a}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${ce()}`];return u&&p.push(`dd-evp-encoding=${u}`),o==="rum"&&p.push(`batch_time=${oe()}`),n&&p.reverse(),p.join("&")}const mr=200;function yr(a){const{env:n,service:o,version:d,datacenter:c}=a,f=[];return n&&f.push(it("env",n)),o&&f.push(it("service",o)),d&&f.push(it("version",d)),c&&f.push(it("datacenter",c)),f}function it(a,n){const o=mr-a.length-1;(n.length>o||vr(n))&&N.warn(`${a} value doesn\'t meet tag requirements and will be sanitized. ${Ve} ${St}/getting_started/tagging/#defining-tags`);const d=n.replace(/,/g,"_");return`${a}:${d}`}function vr(a){return Sr()?new RegExp("[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]","u").test(a):!1}function Sr(){try{return new RegExp("[\\\\p{Ll}]","u"),!0}catch{return!1}}function br(a){const n=a.site||Ce,o=yr(a),d=xr(a,o);return{replica:Er(a,o),site:n,...d}}function xr(a,n){return{logsEndpointBuilder:Me(a,"logs",n),rumEndpointBuilder:Me(a,"rum",n),sessionReplayEndpointBuilder:Me(a,"replay",n)}}function Er(a,n){if(!a.replica)return;const o={...a,site:Ce,clientToken:a.replica.clientToken},d={logsEndpointBuilder:Me(o,"logs",n),rumEndpointBuilder:Me(o,"rum",n)};return{applicationId:a.replica.applicationId,...d}}function Ur(a){return ur.every(n=>a.includes(n))}function Lt(a,n){return a!=null&&typeof a!="string"?(N.error(`${n} must be defined as a string`),!1):!0}function wr(a){return a&&typeof a=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(a)?(N.error(`Site should be a valid Datadog site. ${Ve} ${St}/getting_started/site/.`),!1):!0}function nt(a,n){return a!==void 0&&!_n(a)?(N.error(`${n} Sample Rate should be a number between 0 and 100`),!1):!0}function Tr(a){var n,o,d,c,f,u;if(!a||!a.clientToken){N.error("Client Token is not configured, we will not send any data.");return}if(!(!wr(a.site)||!nt(a.sessionSampleRate,"Session")||!nt(a.telemetrySampleRate,"Telemetry")||!nt(a.telemetryConfigurationSampleRate,"Telemetry Configuration")||!nt(a.telemetryUsageSampleRate,"Telemetry Usage")||!Lt(a.version,"Version")||!Lt(a.env,"Env")||!Lt(a.service,"Service"))){if(a.trackingConsent!==void 0&&!ai(Bt,a.trackingConsent)){N.error(\'Tracking Consent should be either "granted" or "not-granted"\');return}return{beforeSend:a.beforeSend&&ni(a.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:rr(a),sessionSampleRate:(n=a.sessionSampleRate)!==null&&n!==void 0?n:100,telemetrySampleRate:(o=a.telemetrySampleRate)!==null&&o!==void 0?o:20,telemetryConfigurationSampleRate:(d=a.telemetryConfigurationSampleRate)!==null&&d!==void 0?d:5,telemetryUsageSampleRate:(c=a.telemetryUsageSampleRate)!==null&&c!==void 0?c:5,service:a.service||void 0,silentMultipleInit:!!a.silentMultipleInit,allowUntrustedEvents:!!a.allowUntrustedEvents,trackingConsent:(f=a.trackingConsent)!==null&&f!==void 0?f:Bt.GRANTED,trackAnonymousUser:(u=a.trackAnonymousUser)!==null&&u!==void 0?u:!0,storeContextsAcrossPages:!!a.storeContextsAcrossPages,batchBytesLimit:16*ie,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*ke,batchMessagesLimit:50,messageBytesLimit:256*ie,...br(a)}}}function Cr(a){return{session_sample_rate:a.sessionSampleRate,telemetry_sample_rate:a.telemetrySampleRate,telemetry_configuration_sample_rate:a.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:a.telemetryUsageSampleRate,use_before_send:!!a.beforeSend,use_partitioned_cross_site_session_cookie:a.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:a.useSecureSessionCookie,use_proxy:!!a.proxy,silent_multiple_init:a.silentMultipleInit,track_session_across_subdomains:a.trackSessionAcrossSubdomains,track_anonymous_user:a.trackAnonymousUser,session_persistence:a.sessionPersistence,allow_fallback_to_local_storage:!!a.allowFallbackToLocalStorage,store_contexts_across_pages:!!a.storeContextsAcrossPages,allow_untrusted_events:!!a.allowUntrustedEvents,tracking_consent:a.trackingConsent}}var Dt;(function(a){a.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",a.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(Dt||(Dt={}));const Ti=new Set;function Ar(a){Array.isArray(a)&&Ir(a.filter(n=>ai(Dt,n)))}function Ir(a){a.forEach(n=>{Ti.add(n)})}function Fr(){return Ti}const Ne="?";function ne(a){const n=[];let o=Rt(a,"stack");const d=String(a);return o&&o.startsWith(d)&&(o=o.slice(d.length)),o&&o.split(`\n`).forEach(c=>{const f=Lr(c)||Rr(c)||Or(c)||Nr(c);f&&(!f.func&&f.line&&(f.func=Ne),n.push(f))}),{message:Rt(a,"message"),name:Rt(a,"name"),stack:n}}const Ci="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\\\w+\\\\.|\\\\/).*?)",Ae="(?::(\\\\d+))",Br=new RegExp(`^\\\\s*at (.*?) ?\\\\(${Ci}${Ae}?${Ae}?\\\\)?\\\\s*$`,"i"),kr=new RegExp(`\\\\((\\\\S*)${Ae}${Ae}\\\\)`);function Lr(a){const n=Br.exec(a);if(!n)return;const o=n[2]&&n[2].indexOf("native")===0,d=n[2]&&n[2].indexOf("eval")===0,c=kr.exec(n[2]);return d&&c&&(n[2]=c[1],n[3]=c[2],n[4]=c[3]),{args:o?[n[2]]:[],column:n[4]?+n[4]:void 0,func:n[1]||Ne,line:n[3]?+n[3]:void 0,url:o?void 0:n[2]}}const Dr=new RegExp(`^\\\\s*at ?${Ci}${Ae}?${Ae}??\\\\s*$`,"i");function Rr(a){const n=Dr.exec(a);if(n)return{args:[],column:n[3]?+n[3]:void 0,func:Ne,line:n[2]?+n[2]:void 0,url:n[1]}}const Pr=/^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;function Or(a){const n=Pr.exec(a);if(n)return{args:[],column:n[4]?+n[4]:void 0,func:n[1]||Ne,line:+n[3],url:n[2]}}const zr=/^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,Mr=/(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;function Nr(a){const n=zr.exec(a);if(!n)return;const o=n[3]&&n[3].indexOf(" > eval")>-1,d=Mr.exec(n[3]);return o&&d&&(n[3]=d[1],n[4]=d[2],n[5]=void 0),{args:n[2]?n[2].split(","):[],column:n[5]?+n[5]:void 0,func:n[1]||Ne,line:n[4]?+n[4]:void 0,url:n[3]}}function Rt(a,n){if(typeof a!="object"||!a||!(n in a))return;const o=a[n];return typeof o=="string"?o:void 0}function Gr(a,n,o,d){const c=[{url:n,column:d,line:o}],{name:f,message:u}=Yr(a);return{name:f,message:u,stack:c}}const Hr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;function Yr(a){let n,o;return{}.toString.call(a)==="[object String]"&&([,n,o]=Hr.exec(a)),{name:n,message:o}}function rt(a){const o=new Error(a);o.name="HandlingStack";let d;return Re(()=>{const c=ne(o);c.stack=c.stack.slice(2),d=ye(c)}),d}function ye(a){let n=Ai(a);return a.stack.forEach(o=>{const d=o.func==="?"?"<anonymous>":o.func,c=o.args&&o.args.length>0?`(${o.args.join(", ")})`:"",f=o.line?`:${o.line}`:"",u=o.line&&o.column?`:${o.column}`:"";n+=`\n at ${d}${c} @ ${o.url}${f}${u}`}),n}function Ai(a){return`${a.name||"Error"}: ${a.message}`}function ve(a,n,o,{computeHandlingStack:d}={}){let c=a[n];if(typeof c!="function")if(n in a&&n.startsWith("on"))c=le;else return{stop:le};let f=!1;const u=function(){if(f)return c.apply(this,arguments);const r=Array.from(arguments);let p;Re(o,null,[{target:this,parameters:r,onPostCall:g=>{p=g},handlingStack:d?rt("instrumented method"):void 0}]);const _=c.apply(this,r);return p&&Re(p,null,[_]),_};return a[n]=u,{stop:()=>{f=!0,a[n]===u&&(a[n]=c)}}}const Vr=220*ie,$r="$",jr=3;function re(a,n=Vr){const o=Te(Object.prototype),d=Te(Array.prototype),c=[],f=new WeakMap,u=Pt(a,$r,void 0,c,f),r=JSON.stringify(u);let p=r?r.length:0;if(p>n){zt(n,"discarded",a);return}for(;c.length>0&&p<n;){const _=c.shift();let g=0;if(Array.isArray(_.source))for(let v=0;v<_.source.length;v++){const E=Pt(_.source[v],_.path,v,c,f);if(E!==void 0?p+=JSON.stringify(E).length:p+=4,p+=g,g=1,p>n){zt(n,"truncated",a);break}_.target[v]=E}else for(const v in _.source)if(Object.prototype.hasOwnProperty.call(_.source,v)){const E=Pt(_.source[v],_.path,v,c,f);if(E!==void 0&&(p+=JSON.stringify(E).length+g+v.length+jr,g=1),p>n){zt(n,"truncated",a);break}_.target[v]=E}}return o(),d(),u}function Pt(a,n,o,d,c){const f=Wr(a);if(!f||typeof f!="object")return Kr(f);const u=Ot(f);if(u!=="[Object]"&&u!=="[Array]"&&u!=="[Error]")return u;const r=a;if(c.has(r))return`[Reference seen at ${c.get(r)}]`;const p=o!==void 0?`${n}.${o}`:n,_=Array.isArray(f)?[]:{};return c.set(r,p),d.push({source:f,target:_,path:p}),_}function Kr(a){return typeof a=="bigint"?`[BigInt] ${a.toString()}`:typeof a=="function"?`[Function] ${a.name||"unknown"}`:typeof a=="symbol"?`[Symbol] ${a.description||a.toString()}`:a}function Ot(a){try{if(a instanceof Event)return qr(a);if(a instanceof RegExp)return`[RegExp] ${a.toString()}`;const o=Object.prototype.toString.call(a).match(/\\[object (.*)\\]/);if(o&&o[1])return`[${o[1]}]`}catch{}return"[Unserializable]"}function qr(a){return{type:a.type,isTrusted:a.isTrusted,currentTarget:a.currentTarget?Ot(a.currentTarget):null,target:a.target?Ot(a.target):null}}function Wr(a){const n=a;if(n&&typeof n.toJSON=="function")try{return n.toJSON()}catch{}return a}function zt(a,n,o){N.warn(`The data provided has been ${n} as it is over the limit of ${a} characters:`,o)}const Ii="No stack, consider using an instance of Error";function Fi({stackTrace:a,originalError:n,handlingStack:o,componentStack:d,startClocks:c,nonErrorPrefix:f,source:u,handling:r}){const p=fe(n),_=Jr(a,p,f,n),g=Xr(p,a)?ye(a):Ii,v=p?Li(n,u):void 0,E=a?a.name:void 0,S=Bi(n),U=ki(n);return{startClocks:c,source:u,handling:r,handlingStack:o,componentStack:d,originalError:n,type:E,message:_,stack:g,causes:v,fingerprint:S,context:U}}function Jr(a,n,o,d){return a!=null&&a.message&&(a!=null&&a.name)?a.message:n?"Empty message":`${o} ${me(re(d))}`}function Xr(a,n){return n===void 0?!1:a?!0:n.stack.length>0&&(n.stack.length>1||n.stack[0].url!==void 0)}function Bi(a){return fe(a)&&"dd_fingerprint"in a?String(a.dd_fingerprint):void 0}function ki(a){if(a!==null&&typeof a=="object"&&"dd_context"in a)return a.dd_context}function Zr(a){var n;return(n=/@ (.+)/.exec(a))===null||n===void 0?void 0:n[1]}function fe(a){return a instanceof Error||Object.prototype.toString.call(a)==="[object Error]"}function Li(a,n){let o=a;const d=[];for(;fe(o==null?void 0:o.cause)&&d.length<10;){const c=ne(o.cause);d.push({message:o.cause.message,source:n,type:c==null?void 0:c.name,stack:ye(c)}),o=o.cause}return d.length?d:void 0}const J={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function Qr(a){const n=(c,f)=>{const u=Fi({stackTrace:c,originalError:f,startClocks:ae(),nonErrorPrefix:"Uncaught",source:J.SOURCE,handling:"unhandled"});a.notify(u)},{stop:o}=es(n),{stop:d}=ts(n);return{stop:()=>{o(),d()}}}function es(a){return ve(window,"onerror",({parameters:[n,o,d,c,f]})=>{let u;fe(f)?u=ne(f):u=Gr(n,o,d,c),a(u,f??n)})}function ts(a){return ve(window,"onunhandledrejection",({parameters:[n]})=>{const o=n.reason||"Empty reason",d=ne(o);a(d,o)})}function is(a){const n={version:"6.5.0",onReady(o){o()},...a};return Object.defineProperty(n,"_setDebug",{get(){return wn},enumerable:!1}),n}function ns(a,n,o){const d=a[n];d&&!d.q&&d.version&&N.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),a[n]=o,d&&d.q&&d.q.forEach(c=>ni(c,"onReady callback threw an error:")())}function Di(a,n){n.silentMultipleInit||N.error(`${a} is already initialized.`)}function Se(a,n,o,d,c){return Mt(a,n,[o],d,c)}function Mt(a,n,o,d,{once:c,capture:f,passive:u}={}){const r=D(E=>{!E.isTrusted&&!E.__ddIsTrusted&&!a.allowUntrustedEvents||(c&&v(),d(E))}),p=u?{capture:f,passive:u}:f,_=window.EventTarget&&n instanceof EventTarget?window.EventTarget.prototype:n,g=Ue(_,"addEventListener");o.forEach(E=>g.call(n,E,r,p));function v(){const E=Ue(_,"removeEventListener");o.forEach(S=>E.call(n,S,r,p))}return{stop:v}}const st={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function rs(a,n){const o=[];n.includes(st.cspViolation)&&o.push(os(a));const d=n.filter(c=>c!==st.cspViolation);return d.length&&o.push(ss(d)),fi(...o)}function ss(a){return new H(n=>{if(!window.ReportingObserver)return;const o=D((c,f)=>c.forEach(u=>n.notify(as(u)))),d=new window.ReportingObserver(o,{types:a,buffered:!0});return d.observe(),()=>{d.disconnect()}})}function os(a){return new H(n=>{const{stop:o}=Se(a,document,"securitypolicyviolation",d=>{n.notify(ds(d))});return o})}function as(a){const{type:n,body:o}=a;return Ri({type:o.id,message:`${n}: ${o.message}`,originalError:a,stack:Pi(o.id,o.message,o.sourceFile,o.lineNumber,o.columnNumber)})}function ds(a){const n=`\'${a.blockedURI}\' blocked by \'${a.effectiveDirective}\' directive`;return Ri({type:a.effectiveDirective,message:`${st.cspViolation}: ${n}`,originalError:a,csp:{disposition:a.disposition},stack:Pi(a.effectiveDirective,a.originalPolicy?`${n} of the policy "${Fn(a.originalPolicy,100,"...")}"`:"no policy",a.sourceFile,a.lineNumber,a.columnNumber)})}function Ri(a){return{startClocks:ae(),source:J.REPORT,handling:"unhandled",...a}}function Pi(a,n,o,d,c){return o?ye({name:a,message:n,stack:[{func:"?",url:o,line:d??void 0,column:c??void 0}]}):void 0}function Oi(a,n){const o=window.__ddBrowserSdkExtensionCallback;o&&o({type:a,payload:n})}function zi(a){return a===null?"null":Array.isArray(a)?"array":typeof a}function ot(a,n,o=ls()){if(n===void 0)return a;if(typeof n!="object"||n===null)return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp){const c=n.flags||[n.global?"g":"",n.ignoreCase?"i":"",n.multiline?"m":"",n.sticky?"y":"",n.unicode?"u":""].join("");return new RegExp(n.source,c)}if(o.hasAlreadyBeenSeen(n))return;if(Array.isArray(n)){const c=Array.isArray(a)?a:[];for(let f=0;f<n.length;++f)c[f]=ot(c[f],n[f],o);return c}const d=zi(a)==="object"?a:{};for(const c in n)Object.prototype.hasOwnProperty.call(n,c)&&(d[c]=ot(d[c],n[c],o));return d}function Mi(a){return ot(void 0,a)}function Ie(...a){let n;for(const o of a)o!=null&&(n=ot(n,o));return n}function ls(){if(typeof WeakSet<"u"){const n=new WeakSet;return{hasAlreadyBeenSeen(o){const d=n.has(o);return d||n.add(o),d}}}const a=[];return{hasAlreadyBeenSeen(n){const o=a.indexOf(n)>=0;return o||a.push(n),o}}}function cs(){var a;const n=window.navigator;return{status:n.onLine?"connected":"not_connected",interfaces:n.connection&&n.connection.type?[n.connection.type]:void 0,effective_type:(a=n.connection)===null||a===void 0?void 0:a.effectiveType}}function fs(a){const n=new Set;return a.forEach(o=>n.add(o)),Array.from(n)}function Ni(a,n){const o=a.indexOf(n);o>=0&&a.splice(o,1)}const hs=500;function Gi(){const a=[];return{add:c=>{a.push(c)>hs&&a.splice(0,1)},remove:c=>{Ni(a,c)},drain:c=>{a.forEach(f=>f(c)),a.length=0}}}const be={log:"log",configuration:"configuration",usage:"usage"},us=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],ps=[fr];let Hi=Gi(),Fe=a=>{Hi.add(()=>Fe(a))};function _s(a,n){let o;const d=new H,c=new Set,f=!ps.includes(n.site)&&$e(n.telemetrySampleRate),u={[be.log]:f,[be.configuration]:f&&$e(n.telemetryConfigurationSampleRate),[be.usage]:f&&$e(n.telemetryUsageSampleRate)},r=gs();Fe=_=>{const g=me(_);if(u[_.type]&&c.size<n.maxTelemetryEventsPerPage&&!c.has(g)){const v=p(a,_,r);d.notify(v),Oi("telemetry",v),c.add(g)}},Un(Vi);function p(_,g,v){return Ie({type:"telemetry",date:oe(),service:_,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:Ie(g,{runtime_env:v,connectivity:cs(),sdk_setup:"npm"}),experimental_features:Array.from(Fr())},o!==void 0?o():{})}return{setContextProvider:_=>{o=_},observable:d,enabled:f}}function gs(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function ms(){Hi.drain()}function ys(a){return a.site===lr}function Yi(a,n){Et(M.debug,a,n),Fe({type:be.log,message:a,status:"debug",...n})}function Vi(a,n){Fe({type:be.log,status:"error",...bs(a),...n})}function vs(a){Fe({type:be.configuration,configuration:a})}function Ss(a){Fe({type:be.usage,usage:a})}function bs(a){if(fe(a)){const n=ne(a);return{error:{kind:n.name,stack:ye(xs(n))},message:n.message}}return{error:{stack:Ii},message:`Uncaught ${me(a)}`}}function xs(a){return a.stack=a.stack.filter(n=>!n.url||us.some(o=>n.url.startsWith(o))),a}const Ge=1/0,Es=ue;let He=null;const at=new Set;function Us(){at.forEach(a=>a())}function ws({expireDelay:a,maxEntries:n}){let o=[];const d=[];He||(He=Ut(()=>Us(),Es));const c=()=>{const S=je()-a;for(;o.length>0&&o[o.length-1].endTime<S;){const U=o.pop();U&&d.push(U.startTime)}};at.add(c);function f(S,U){const e={value:S,startTime:U,endTime:Ge,remove:()=>{Ni(o,e)},close:t=>{e.endTime=t}};return n&&o.length>=n&&o.pop(),o.unshift(e),e}function u(S=Ge,U={returnInactive:!1}){for(const e of o)if(e.startTime<=S){if(U.returnInactive||S<=e.endTime)return e.value;break}}function r(S){const U=o[0];U&&U.endTime===Ge&&U.close(S)}function p(S=Ge,U=0){const e=Sn(S,U);return o.filter(t=>t.startTime<=e&&S<=t.endTime).map(t=>t.value)}function _(){return o.map(({startTime:S,endTime:U,value:e})=>({startTime:S,endTime:U===Ge?"Infinity":U,value:e}))}function g(){return d}function v(){o=[]}function E(){at.delete(c),at.size===0&&He&&(ci(He),He=null)}return{add:f,find:u,closeActive:r,findAll:p,reset:v,stop:E,getAllEntries:_,getDeletedEntries:g}}const Ts=ue,Cs=At;function As(a,n,o,d){const c=new H,f=new H,u=sr(a.sessionStoreStrategyType,a,n,o),r=ws({expireDelay:Cs});u.renewObservable.subscribe(()=>{r.add(p(),je()),c.notify()}),u.expireObservable.subscribe(()=>{f.notify(),r.closeActive(je())}),u.expandOrRenewSession(),r.add(p(),yn().relative),d.observable.subscribe(()=>{d.isGranted()?u.expandOrRenewSession():u.expire()}),Is(a,()=>{d.isGranted()&&u.expandOrRenewSession()}),Fs(a,()=>u.expandSession()),Bs(a,()=>u.restartSession());function p(){return{id:u.getSession().id,trackingType:u.getSession()[n],isReplayForced:!!u.getSession().forcedReplay,anonymousId:u.getSession().anonymousId}}return{findSession:(_,g)=>r.find(_,g),renewObservable:c,expireObservable:f,sessionStateUpdateObservable:u.sessionStateUpdateObservable,expire:u.expire,updateSessionState:u.updateSessionState}}function Is(a,n){Mt(a,window,["click","touchstart","keydown","scroll"],n,{capture:!0,passive:!0})}function Fs(a,n){const o=()=>{document.visibilityState==="visible"&&n()};Se(a,document,"visibilitychange",o),Ut(o,Ts)}function Bs(a,n){Se(a,window,"resume",n,{capture:!0})}function $i(a){return a>=500}function ks(a){try{return a.clone()}catch{return}}const Ls=80*ie,Ds=32,ji=3*oi,Rs=ue,Ki=ke;function qi(a,n,o,d,c){n.transportStatus===0&&n.queuedPayloads.size()===0&&n.bandwidthMonitor.canHandle(a)?Ji(a,n,o,{onSuccess:()=>Xi(0,n,o,d,c),onFailure:()=>{n.queuedPayloads.enqueue(a),Wi(n,o,d,c)}}):n.queuedPayloads.enqueue(a)}function Wi(a,n,o,d){a.transportStatus===2&&Pe(()=>{const c=a.queuedPayloads.first();Ji(c,a,n,{onSuccess:()=>{a.queuedPayloads.dequeue(),a.currentBackoffTime=Ki,Xi(1,a,n,o,d)},onFailure:()=>{a.currentBackoffTime=Math.min(Rs,a.currentBackoffTime*2),Wi(a,n,o,d)}})},a.currentBackoffTime)}function Ji(a,n,o,{onSuccess:d,onFailure:c}){n.bandwidthMonitor.add(a),o(a,f=>{n.bandwidthMonitor.remove(a),Ps(f)?(n.transportStatus=n.bandwidthMonitor.ongoingRequestCount>0?1:2,a.retry={count:a.retry?a.retry.count+1:1,lastFailureStatus:f.status},c()):(n.transportStatus=0,d())})}function Xi(a,n,o,d,c){a===0&&n.queuedPayloads.isFull()&&!n.queueFullReported&&(c({message:`Reached max ${d} events size queued for upload: ${ji/oi}MiB`,source:J.AGENT,startClocks:ae()}),n.queueFullReported=!0);const f=n.queuedPayloads;for(n.queuedPayloads=Zi();f.size()>0;)qi(f.dequeue(),n,o,d,c)}function Ps(a){return a.type!=="opaque"&&(a.status===0&&!navigator.onLine||a.status===408||a.status===429||$i(a.status))}function Os(){return{transportStatus:0,currentBackoffTime:Ki,bandwidthMonitor:zs(),queuedPayloads:Zi(),queueFullReported:!1}}function Zi(){const a=[];return{bytesCount:0,enqueue(n){this.isFull()||(a.push(n),this.bytesCount+=n.bytesCount)},first(){return a[0]},dequeue(){const n=a.shift();return n&&(this.bytesCount-=n.bytesCount),n},size(){return a.length},isFull(){return this.bytesCount>=ji}}}function zs(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(a){return this.ongoingRequestCount===0||this.ongoingByteCount+a.bytesCount<=Ls&&this.ongoingRequestCount<Ds},add(a){this.ongoingRequestCount+=1,this.ongoingByteCount+=a.bytesCount},remove(a){this.ongoingRequestCount-=1,this.ongoingByteCount-=a.bytesCount}}}function Ms(a,n,o){const d=Os(),c=(f,u)=>Hs(a,n,f,u);return{send:f=>{qi(f,d,c,a.trackType,o)},sendOnExit:f=>{Ns(a,n,f)}}}function Ns(a,n,o){if(!!navigator.sendBeacon&&o.bytesCount<n)try{const f=a.build("beacon",o);if(navigator.sendBeacon(f,o.data))return}catch(f){Gs(f)}const c=a.build("xhr",o);Nt(c,o.data)}let Qi=!1;function Gs(a){Qi||(Qi=!0,Vi(a))}function Hs(a,n,o,d){if(Ys()&&o.bytesCount<n){const f=a.build("fetch",o);fetch(f,{method:"POST",body:o.data,keepalive:!0,mode:"cors"}).then(D(u=>d==null?void 0:d({status:u.status,type:u.type})),D(()=>{const u=a.build("xhr",o);Nt(u,o.data,d)}))}else{const f=a.build("xhr",o);Nt(f,o.data,d)}}function Ys(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function Nt(a,n,o){const d=new XMLHttpRequest;d.open("POST",a,!0),n instanceof Blob&&d.setRequestHeader("Content-Type",n.type),Se({allowUntrustedEvents:!0},d,"loadend",()=>{o==null||o({status:d.status})},{once:!0}),d.send(n)}function Gt(){const a=Vs();if(a)return{getCapabilities(){var n;return JSON.parse(((n=a.getCapabilities)===null||n===void 0?void 0:n.call(a))||"[]")},getPrivacyLevel(){var n;return(n=a.getPrivacyLevel)===null||n===void 0?void 0:n.call(a)},getAllowedWebViewHosts(){return JSON.parse(a.getAllowedWebViewHosts())},send(n,o,d){const c=d?{id:d}:void 0;a.send(JSON.stringify({eventType:n,event:o,view:c}))}}}function dt(a){var n;a===void 0&&(a=(n=de().location)===null||n===void 0?void 0:n.hostname);const o=Gt();return!!o&&o.getAllowedWebViewHosts().some(d=>a===d||a.endsWith(`.${d}`))}function Vs(){return de().DatadogEventBridge}const lt={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function $s(a){return new H(n=>{const{stop:o}=Mt(a,window,["visibilitychange","freeze"],c=>{c.type==="visibilitychange"&&document.visibilityState==="hidden"?n.notify({reason:lt.HIDDEN}):c.type==="freeze"&&n.notify({reason:lt.FROZEN})},{capture:!0}),d=Se(a,window,"beforeunload",()=>{n.notify({reason:lt.UNLOADING})}).stop;return()=>{o(),d()}})}function js(a){return Je(lt).includes(a)}function Ks({encoder:a,request:n,flushController:o,messageBytesLimit:d}){let c={};const f=o.flushObservable.subscribe(v=>g(v));function u(v,E,S){o.notifyBeforeAddMessage(E),S!==void 0?(c[S]=v,o.notifyAfterAddMessage()):a.write(a.isEmpty?v:`\n${v}`,U=>{o.notifyAfterAddMessage(U-E)})}function r(v){return v!==void 0&&c[v]!==void 0}function p(v){const E=c[v];delete c[v];const S=a.estimateEncodedBytesCount(E);o.notifyAfterRemoveMessage(S)}function _(v,E){const S=me(v),U=a.estimateEncodedBytesCount(S);if(U>=d){N.warn(`Discarded a message whose size was bigger than the maximum allowed size ${d}KB. ${Ve} ${ii}/#technical-limitations`);return}r(E)&&p(E),u(S,U,E)}function g(v){const E=Je(c).join(`\n`);c={};const S=js(v.reason),U=S?n.sendOnExit:n.send;if(S&&a.isAsync){const e=a.finishSync();e.outputBytesCount&&U(en(e));const t=[e.pendingData,E].filter(Boolean).join(`\n`);t&&U({data:t,bytesCount:xt(t)})}else E&&a.write(a.isEmpty?E:`\n${E}`),a.finish(e=>{U(en(e))})}return{flushController:o,add:_,upsert:_,stop:f.unsubscribe}}function en(a){let n;return typeof a.output=="string"?n=a.output:n=new Blob([a.output],{type:"text/plain"}),{data:n,bytesCount:a.outputBytesCount,encoding:a.encoding}}function qs({messagesLimit:a,bytesLimit:n,durationLimit:o,pageExitObservable:d,sessionExpireObservable:c}){const f=d.subscribe(U=>g(U.reason)),u=c.subscribe(()=>g("session_expire")),r=new H(()=>()=>{f.unsubscribe(),u.unsubscribe()});let p=0,_=0;function g(U){if(_===0)return;const e=_,t=p;_=0,p=0,S(),r.notify({reason:U,messagesCount:e,bytesCount:t})}let v;function E(){v===void 0&&(v=Pe(()=>{g("duration_limit")},o))}function S(){li(v),v=void 0}return{flushObservable:r,get messagesCount(){return _},notifyBeforeAddMessage(U){p+U>=n&&g("bytes_limit"),_+=1,p+=U,E()},notifyAfterAddMessage(U=0){p+=U,_>=a?g("messages_limit"):p>=n&&g("bytes_limit")},notifyAfterRemoveMessage(U){p-=U,_-=1,_===0&&S()}}}function tn(a,n,o,d,c,f,u=Ks){const r=_(a,n),p=o&&_(a,o);function _(g,{endpoint:v,encoder:E}){return u({encoder:E,request:Ms(v,g.batchBytesLimit,d),flushController:qs({messagesLimit:g.batchMessagesLimit,bytesLimit:g.batchBytesLimit,durationLimit:g.flushTimeout,pageExitObservable:c,sessionExpireObservable:f}),messageBytesLimit:g.messageBytesLimit})}return{flushObservable:r.flushController.flushObservable,add(g,v=!0){r.add(g),p&&v&&p.add(o.transformMessage?o.transformMessage(g):g)},upsert:(g,v)=>{r.upsert(g,v),p&&p.upsert(o.transformMessage?o.transformMessage(g):g,v)},stop:()=>{r.stop(),p&&p.stop()}}}function ct(){let a="",n=0;return{isAsync:!1,get isEmpty(){return!a},write(o,d){const c=xt(o);n+=c,a+=o,d&&d(c)},finish(o){o(this.finishSync())},finishSync(){const o={output:a,outputBytesCount:n,rawBytesCount:n,pendingData:""};return a="",n=0,o},estimateEncodedBytesCount(o){return o.length}}}class Ws{constructor(){this.callbacks={}}notify(n,o){const d=this.callbacks[n];d&&d.forEach(c=>c(o))}subscribe(n,o){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(o),{unsubscribe:()=>{this.callbacks[n]=this.callbacks[n].filter(d=>o!==d)}}}}function Js(a,n,o){let d=0,c=!1;return{isLimitReached(){if(d===0&&Pe(()=>{d=0},ue),d+=1,d<=n||c)return c=!1,!1;if(d===n+1){c=!0;try{o({message:`Reached max number of ${a}s by minute: ${n}`,source:J.AGENT,startClocks:ae()})}finally{c=!1}}return!0}}}let Ht;const Yt=new WeakMap;function Xs(a){return Ht||(Ht=Zs(a)),Ht}function Zs(a){return new H(n=>{const{stop:o}=ve(XMLHttpRequest.prototype,"open",Qs),{stop:d}=ve(XMLHttpRequest.prototype,"send",f=>{eo(f,a,n)},{computeHandlingStack:!0}),{stop:c}=ve(XMLHttpRequest.prototype,"abort",to);return()=>{o(),d(),c()}})}function Qs({target:a,parameters:[n,o]}){Yt.set(a,{state:"open",method:String(n).toUpperCase(),url:kt(String(o))})}function eo({target:a,handlingStack:n},o,d){const c=Yt.get(a);if(!c)return;const f=c;f.state="start",f.startClocks=ae(),f.isAborted=!1,f.xhr=a,f.handlingStack=n;let u=!1;const{stop:r}=ve(a,"onreadystatechange",()=>{a.readyState===XMLHttpRequest.DONE&&p()}),p=()=>{if(_(),r(),u)return;u=!0;const g=c;g.state="complete",g.duration=vn(f.startClocks.timeStamp,oe()),g.status=a.status,d.notify(En(g))},{stop:_}=Se(o,a,"loadend",p);d.notify(f)}function to({target:a}){const n=Yt.get(a);n&&(n.isAborted=!0)}let Vt;function nn(){return Vt||(Vt=io()),Vt}function io(){return new H(a=>{if(!window.fetch)return;const{stop:n}=ve(window,"fetch",o=>no(o,a),{computeHandlingStack:!0});return n})}function no({parameters:a,onPostCall:n,handlingStack:o},d){const[c,f]=a;let u=f&&f.method;u===void 0&&c instanceof Request&&(u=c.method);const r=u!==void 0?String(u).toUpperCase():"GET",p=c instanceof Request?c.url:kt(String(c)),_=ae(),g={state:"start",init:f,input:c,method:r,startClocks:_,url:p,handlingStack:o};d.notify(g),a[0]=g.input,a[1]=g.init,n(v=>ro(d,v,g))}function ro(a,n,o){const d=o;function c(f){d.state="resolve",Object.assign(d,f),a.notify(d)}n.then(D(f=>{c({response:f,responseType:f.type,status:f.status,isAborted:!1})}),D(f=>{var u,r;c({status:0,isAborted:((r=(u=d.init)===null||u===void 0?void 0:u.signal)===null||r===void 0?void 0:r.aborted)||f instanceof DOMException&&f.code===DOMException.ABORT_ERR,error:f})}))}let $t={};function so(a){const n=a.map(o=>($t[o]||($t[o]=oo(o)),$t[o]));return fi(...n)}function oo(a){return new H(n=>{const o=te[a];return te[a]=(...d)=>{o.apply(console,d);const c=rt("console error");Re(()=>{n.notify(ao(d,a,c))})},()=>{te[a]=o}})}function ao(a,n,o){const d=a.map(f=>lo(f)).join(" ");let c;if(n===M.error){const f=a.find(fe);c={stack:f?ye(ne(f)):void 0,fingerprint:Bi(f),causes:f?Li(f,"console"):void 0,startClocks:ae(),message:d,source:J.CONSOLE,handling:"handled",handlingStack:o,context:ki(f)}}return{api:n,message:d,error:c,handlingStack:o}}function lo(a){return typeof a=="string"?re(a):fe(a)?Ai(ne(a)):me(re(a),void 0,2)}function co(a){const n=zi(a)==="object";return n||N.error("Unsupported context:",a),n}function jt(a,n,o){const d={...a};for(const[c,{required:f,type:u}]of Object.entries(n))u==="string"&&c in d&&(d[c]=String(d[c])),f&&!(c in a)&&N.warn(`The property ${c} of ${o} is required; context will not be sent to the intake.`);return d}function ft(a="",{customerDataTracker:n,propertiesConfig:o={}}={}){let d={};const c=new H,f={getContext:()=>Mi(d),setContext:u=>{co(u)?(d=re(jt(u,o,a)),n==null||n.updateCustomerData(d)):f.clearContext(),c.notify()},setContextProperty:(u,r)=>{d=re(jt({...d,[u]:r},o,a)),n==null||n.updateCustomerData(d),c.notify()},removeContextProperty:u=>{delete d[u],n==null||n.updateCustomerData(d),jt(d,o,a),c.notify()},clearContext:()=>{d={},n==null||n.resetCustomerData(),c.notify()},changeObservable:c};return f}const fo="_dd_c",ho=[];function Kt(a,n,o,d){const c=uo(o,d);ho.push(Se(a,window,"storage",({key:_})=>{c===_&&u()})),n.changeObservable.subscribe(r);const f=Ie(p(),n.getContext());De(f)||n.setContext(f);function u(){n.setContext(p())}function r(){localStorage.setItem(c,JSON.stringify(n.getContext()))}function p(){const _=localStorage.getItem(c);return _?JSON.parse(_):{}}}function uo(a,n){return`${fo}_${a}_${n}`}const po=3*ie,_o=16*ie,go=200;function mo(a=2){const n=new Map;let o=!1;function d(c=0){if(o||a===0)return;const f=a===2?po:_o;let u=c;n.forEach(r=>{u+=r.getBytesCount()}),u>f&&(yo(f),o=!0)}return{createDetachedTracker:()=>{const c=rn(()=>d(c.getBytesCount()));return c},getOrCreateTracker:c=>(n.has(c)||n.set(c,rn(d)),n.get(c)),setCompressionStatus:c=>{a===0&&(a=c,d())},getCompressionStatus:()=>a,stop:()=>{n.forEach(c=>c.stop()),n.clear()}}}function rn(a){let n=0;const{throttled:o,cancel:d}=hi(f=>{n=xt(me(f)),a()},go),c=()=>{d(),n=0};return{updateCustomerData:f=>{De(f)?c():o(f)},resetCustomerData:c,getBytesCount:()=>n,stop:()=>{d()}}}function yo(a){N.warn(`Customer data exceeds the recommended ${a/ie}KiB threshold. ${Ve} ${ii}/#customer-data-exceeds-the-recommended-threshold-warning`)}function vo(a,n,o){const d=a.getReader(),c=[];let f=0;u();function u(){d.read().then(D(p=>{if(p.done){r();return}c.push(p.value),f+=p.value.length,f>o.bytesLimit?r():u()}),D(p=>n(p)))}function r(){d.cancel().catch(le);let p,_;{let g;if(c.length===1)g=c[0];else{g=new Uint8Array(f);let v=0;c.forEach(E=>{g.set(E,v),v+=E.length})}p=g.slice(0,o.bytesLimit),_=g.length>o.bytesLimit}n(void 0,p,_)}}const So="datadog-synthetics-public-id",bo="datadog-synthetics-result-id",xo="datadog-synthetics-injects-rum";function sn(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||pe(xo))}function Eo(){const a=window._DATADOG_SYNTHETICS_PUBLIC_ID||pe(So);return typeof a=="string"?a:void 0}function Uo(){const a=window._DATADOG_SYNTHETICS_RESULT_ID||pe(bo);return typeof a=="string"?a:void 0}function ht(a,n,o){const d=o.getHandler(),c=Array.isArray(d)?d:[d];return on[a]>=on[o.getLevel()]&&c.includes(n)}const k={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},on={[k.ok]:0,[k.debug]:1,[k.info]:2,[k.notice]:4,[k.warn]:5,[k.error]:6,[k.critical]:7,[k.alert]:8,[k.emerg]:9};function ut(a,{includeMessage:n=!1}={}){return{stack:a.stack,kind:a.type,message:n?a.message:void 0,causes:a.causes,fingerprint:a.fingerprint,handling:a.handling}}var wo=function(a,n,o,d){var c=arguments.length,f=c<3?n:d===null?d=Object.getOwnPropertyDescriptor(n,o):d,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(a,n,o,d);else for(var r=a.length-1;r>=0;r--)(u=a[r])&&(f=(c<3?u(f):c>3?u(n,o,f):u(n,o))||f);return c>3&&f&&Object.defineProperty(n,o,f),f};const Ye={console:"console",http:"http",silent:"silent"},To=Object.keys(k);let Q=class{constructor(n,o,d,c=Ye.http,f=k.debug,u={}){this.handleLogStrategy=n,this.handlerType=c,this.level=f,this.contextManager=ft("logger",{customerDataTracker:o}),this.contextManager.setContext(u),d&&this.contextManager.setContextProperty("logger",{name:d})}logImplementation(n,o,d=k.info,c,f){const u=re(o);let r;if(c!=null){const p=Fi({stackTrace:fe(c)?ne(c):void 0,originalError:c,nonErrorPrefix:"Provided",source:J.LOGGER,handling:"handled",startClocks:ae()});r=Ie({error:ut(p,{includeMessage:!0})},u)}else r=u;this.handleLogStrategy({message:re(n),context:r,status:d},this,f)}log(n,o,d=k.info,c){let f;ht(d,Ye.http,this)&&(f=rt("log")),this.logImplementation(n,o,d,c,f)}setContext(n){this.contextManager.setContext(n)}getContext(){return this.contextManager.getContext()}setContextProperty(n,o){this.contextManager.setContextProperty(n,o)}removeContextProperty(n){this.contextManager.removeContextProperty(n)}clearContext(){this.contextManager.clearContext()}setHandler(n){this.handlerType=n}getHandler(){return this.handlerType}setLevel(n){this.level=n}getLevel(){return this.level}};wo([Tn],Q.prototype,"logImplementation",null),Q.prototype.ok=se(k.ok),Q.prototype.debug=se(k.debug),Q.prototype.info=se(k.info),Q.prototype.notice=se(k.notice),Q.prototype.warn=se(k.warn),Q.prototype.error=se(k.error),Q.prototype.critical=se(k.critical),Q.prototype.alert=se(k.alert),Q.prototype.emerg=se(k.emerg);function se(a){return function(n,o,d){let c;ht(a,Ye.http,this)&&(c=rt("log")),this.logImplementation(n,o,a,d,c)}}function Co(a,n,o){return{view:{referrer:document.referrer,url:window.location.href},context:a.getContext(),user:n.getContext(),account:o.getContext()}}const Ao=32*ie;function Io(a){a.usePciIntake===!0&&a.site&&a.site!=="datadoghq.com"&&N.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const n=Tr(a),o=an(a.forwardConsoleLogs,Je(M),"Forward Console Logs"),d=an(a.forwardReports,Je(st),"Forward Reports");if(!(!n||!o||!d))return a.forwardErrorsToLogs&&!o.includes(M.error)&&o.push(M.error),{forwardErrorsToLogs:a.forwardErrorsToLogs!==!1,forwardConsoleLogs:o,forwardReports:d,requestErrorResponseLengthLimit:Ao,...n}}function an(a,n,o){if(a===void 0)return[];if(!(a==="all"||Array.isArray(a)&&a.every(d=>n.includes(d)))){N.error(`${o} should be "all" or an array with allowed values "${n.join(\'", "\')}"`);return}return a==="all"?n:fs(a)}function Fo(a){const n=Cr(a);return{forward_errors_to_logs:a.forwardErrorsToLogs,forward_console_logs:a.forwardConsoleLogs,forward_reports:a.forwardReports,use_pci_intake:a.usePciIntake,...n}}function Bo(a,n,o){const d=Gi();let c,f;const u=n.observable.subscribe(r);function r(){if(!f||!c||!n.isGranted())return;u.unsubscribe();const p=o(c,f);d.drain(p)}return{init(p){if(!p){N.error("Missing configuration");return}if(Ar(p.enableExperimentalFeatures),dt()&&(p=ko(p)),c=p,f){Di("DD_LOGS",p);return}const _=Io(p);_&&(f=_,nn().subscribe(le),n.tryToInit(_.trackingConsent),r())},get initConfiguration(){return c},getInternalContext:le,handleLog(p,_,g,v=a(),E=oe()){d.add(S=>S.handleLog(p,_,g,v,E))}}}function ko(a){return{...a,clientToken:"empty"}}const qt="logs";function Lo(a){const n=mo(),o=ft("global context",{customerDataTracker:n.getOrCreateTracker(2)}),d=ft("user",{customerDataTracker:n.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),c=ft("account",{customerDataTracker:n.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),f=or();function u(){return Co(o,d,c)}let r=Bo(u,f,(g,v)=>{g.storeContextsAcrossPages&&(Kt(v,o,qt,2),Kt(v,d,qt,1),Kt(v,c,qt,4));const E=a(g,v,u,f);return r=Do(g,E),E});const p={},_=new Q((...g)=>r.handleLog(...g),n.createDetachedTracker());return is({logger:_,init:D(g=>r.init(g)),setTrackingConsent:D(g=>{f.update(g),Ss({feature:"set-tracking-consent",tracking_consent:g})}),getGlobalContext:D(()=>o.getContext()),setGlobalContext:D(g=>o.setContext(g)),setGlobalContextProperty:D((g,v)=>o.setContextProperty(g,v)),removeGlobalContextProperty:D(g=>o.removeContextProperty(g)),clearGlobalContext:D(()=>o.clearContext()),createLogger:D((g,v={})=>(p[g]=new Q((...E)=>r.handleLog(...E),n.createDetachedTracker(),re(g),v.handler,v.level,re(v.context)),p[g])),getLogger:D(g=>p[g]),getInitConfiguration:D(()=>Mi(r.initConfiguration)),getInternalContext:D(g=>r.getInternalContext(g)),setUser:D(d.setContext),getUser:D(d.getContext),setUserProperty:D(d.setContextProperty),removeUserProperty:D(d.removeContextProperty),clearUser:D(d.clearContext),setAccount:D(c.setContext),getAccount:D(c.getContext),setAccountProperty:D(c.setContextProperty),removeAccountProperty:D(c.removeContextProperty),clearAccount:D(c.clearContext)})}function Do(a,n){return{init:o=>{Di("DD_LOGS",o)},initConfiguration:a,...n}}const Ro="logs";function Po(a,n){const o=As(a,Ro,d=>zo(a,d),n);return{findTrackedSession:(d,c={returnInactive:!1})=>{const f=o.findSession(d,c);return f&&f.trackingType==="1"?{id:f.id,anonymousId:f.anonymousId}:void 0},expireObservable:o.expireObservable}}function Oo(a){const o=dn(a)==="1"?{}:void 0;return{findTrackedSession:()=>o,expireObservable:new H}}function dn(a){return $e(a.sessionSampleRate)?"1":"0"}function zo(a,n){const o=Mo(n)?n:dn(a);return{trackingType:o,isTracked:o==="1"}}function Mo(a){return a==="0"||a==="1"}let ln=!1;function pt(a){const n=window;if(sn()){const d=o(n.DD_RUM_SYNTHETICS);return!d&&!ln&&(ln=!0,Yi("Logs sent before RUM is injected by the synthetics worker",{testId:Eo(),resultId:Uo()})),d}return o(n.DD_RUM);function o(d){if(d&&d.getInternalContext)return d.getInternalContext(a)}}function No(a,n,o,d,c){const f=To.concat(["custom"]),u={};f.forEach(r=>{u[r]=Js(r,n.eventRateLimiterThreshold,c)}),o.subscribe(0,({rawLogsEvent:r,messageContext:p=void 0,savedCommonContext:_=void 0,domainContext:g})=>{var v,E;const S=bn(r.date),U=a.findTrackedSession(S);if(!a.findTrackedSession(S,{returnInactive:!0}))return;const t=_||d();let s;!De(t.account)&&t.account.id&&(s=t.account),U&&U.anonymousId&&!t.user.anonymous_id&&(t.user.anonymous_id=U.anonymousId);const l=Ie({service:n.service,session_id:U?U.id:void 0,session:U?{id:U.id}:void 0,usr:De(t.user)?void 0:t.user,account:s,view:t.view},t.context,pt(S),r,p);((v=n.beforeSend)===null||v===void 0?void 0:v.call(n,l,g))===!1||l.origin!==J.AGENT&&((E=u[l.status])!==null&&E!==void 0?E:u.custom).isLimitReached()||o.notify(1,l)})}const Go={[M.log]:k.info,[M.debug]:k.debug,[M.info]:k.info,[M.warn]:k.warn,[M.error]:k.error};function Ho(a,n){const o=so(a.forwardConsoleLogs).subscribe(d=>{var c;const f={rawLogsEvent:{date:oe(),message:d.message,origin:J.CONSOLE,error:d.error&&ut(d.error),status:Go[d.api]},messageContext:(c=d.error)===null||c===void 0?void 0:c.context,domainContext:{handlingStack:d.handlingStack}};n.notify(0,f)});return{stop:()=>{o.unsubscribe()}}}function Yo(a,n){const o=rs(a,a.forwardReports).subscribe(d=>{let c=d.message,f;const u=d.originalError.type==="deprecation"?k.warn:k.error;u===k.error?f=ut(d):d.stack&&(c+=` Found in ${Zr(d.stack)}`),n.notify(0,{rawLogsEvent:{date:oe(),message:c,origin:J.REPORT,error:f,status:u}})});return{stop:()=>{o.unsubscribe()}}}function Vo(a,n){if(!a.forwardErrorsToLogs)return{stop:le};const o=Xs(a).subscribe(f=>{f.state==="complete"&&c("xhr",f)}),d=nn().subscribe(f=>{f.state==="resolve"&&c("fetch",f)});function c(f,u){!Ur(u.url)&&(qo(u)||$i(u.status))&&("xhr"in u?$o(u.xhr,a,r):u.response?Ko(u.response,a,r):u.error&&jo(u.error,a,r));function r(p){const _={isAborted:u.isAborted,handlingStack:u.handlingStack};n.notify(0,{rawLogsEvent:{message:`${Wo(f)} error ${u.method} ${u.url}`,date:u.startClocks.timeStamp,error:{stack:p||"Failed to load",handling:void 0},http:{method:u.method,status_code:u.status,url:u.url},status:k.error,origin:J.NETWORK},domainContext:_})}}return{stop:()=>{o.unsubscribe(),d.unsubscribe()}}}function $o(a,n,o){typeof a.response=="string"?o(Wt(a.response,n)):o(a.response)}function jo(a,n,o){o(Wt(ye(ne(a)),n))}function Ko(a,n,o){const d=ks(a);!d||!d.body?o():window.TextDecoder?Jo(d.body,n.requestErrorResponseLengthLimit,(c,f)=>{o(c?`Unable to retrieve response: ${c}`:f)}):d.text().then(D(c=>o(Wt(c,n))),D(c=>o(`Unable to retrieve response: ${c}`)))}function qo(a){return a.status===0&&a.responseType!=="opaque"}function Wt(a,n){return a.length>n.requestErrorResponseLengthLimit?`${a.substring(0,n.requestErrorResponseLengthLimit)}...`:a}function Wo(a){return a==="xhr"?"XHR":"Fetch"}function Jo(a,n,o){vo(a,(d,c,f)=>{if(d)o(d);else{let u=new TextDecoder().decode(c);f&&(u+="..."),o(void 0,u)}},{bytesLimit:n,collectStreamBody:!0})}function Xo(a,n){if(!a.forwardErrorsToLogs)return{stop:le};const o=new H,{stop:d}=Qr(o),c=o.subscribe(f=>{n.notify(0,{rawLogsEvent:{message:f.message,date:f.startClocks.timeStamp,error:ut(f),origin:J.SOURCE,status:k.error},messageContext:f.context})});return{stop:()=>{d(),c.unsubscribe()}}}const Zo=Ws;function Qo(a){function n(o,d,c,f,u){const r=Ie(d.getContext(),o.context);if(ht(o.status,Ye.console,d)&&ta(o,r),ht(o.status,Ye.http,d)){const p={rawLogsEvent:{date:u||oe(),message:o.message,status:o.status,origin:J.LOGGER},messageContext:r,savedCommonContext:f};c&&(p.domainContext={handlingStack:c}),a.notify(0,p)}}return{handleLog:n}}const ea={[k.ok]:M.debug,[k.debug]:M.debug,[k.info]:M.info,[k.notice]:M.info,[k.warn]:M.warn,[k.error]:M.error,[k.critical]:M.error,[k.alert]:M.error,[k.emerg]:M.error};function ta({status:a,message:n},o){he[ea[a]].call(te,n,o)}function ia(a,n,o,d,c){const f=tn(a,{endpoint:a.logsEndpointBuilder,encoder:ct()},a.replica&&{endpoint:a.replica.logsEndpointBuilder,encoder:ct()},o,d,c.expireObservable);return n.subscribe(1,u=>{f.add(u)}),f}function na(a){const n=Gt();a.subscribe(1,o=>{n.send("log",o)})}function ra(a){return{get:n=>{const o=a.findTrackedSession(n);if(o)return{session_id:o.id}}}}function sa(a){return n=>{a.notify(0,{rawLogsEvent:{message:n.message,date:n.startClocks.timeStamp,origin:J.AGENT,status:k.error}}),Yi("Error reported to customer",{"error.message":n.message})}}function oa(a,n,o,d,c){const f=_s("browser-logs-sdk",n);f.setContextProvider(()=>{var r,p,_,g,v,E;return{application:{id:(r=pt())===null||r===void 0?void 0:r.application_id},session:{id:(p=c.findTrackedSession())===null||p===void 0?void 0:p.id},view:{id:(g=(_=pt())===null||_===void 0?void 0:_.view)===null||g===void 0?void 0:g.id},action:{id:(E=(v=pt())===null||v===void 0?void 0:v.user_action)===null||E===void 0?void 0:E.id}}});const u=[];if(dt()){const r=Gt(),p=f.observable.subscribe(_=>r.send("internal_telemetry",_));u.push(()=>p.unsubscribe())}else{const r=tn(n,{endpoint:n.rumEndpointBuilder,encoder:ct()},n.replica&&{endpoint:n.replica.rumEndpointBuilder,encoder:ct()},o,d,c.expireObservable);u.push(()=>r.stop());const p=f.observable.subscribe(_=>r.add(_,ys(n)));u.push(()=>p.unsubscribe())}return ms(),vs(Fo(a)),{telemetry:f,stop:()=>{u.forEach(r=>r())}}}function aa(a,n,o,d){const c=new Zo,f=[];c.subscribe(1,E=>Oi("logs",E));const u=sa(c),r=$s(n),p=n.sessionStoreStrategyType&&!dt()&&!sn()?Po(n,d):Oo(n),{stop:_}=oa(a,n,u,r,p);f.push(()=>_()),Vo(n,c),Xo(n,c),Ho(n,c),Yo(n,c);const{handleLog:g}=Qo(c);if(No(p,n,c,o,u),dt())na(c);else{const{stop:E}=ia(n,c,u,r,p);f.push(()=>E())}const v=ra(p);return{handleLog:g,getInternalContext:v.get,stop:()=>{f.forEach(E=>E())}}}const xe=Lo(aa);ns(de(),"DD_LOGS",xe);const I=class I{constructor(n){this.listenerMap=new Map,I.options=n,this.isLoggingOn=n.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&xe.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const o="bb_logger_mac_uuid";let d=localStorage.getItem(o);d||(d=crypto.randomUUID(),localStorage.setItem(o,d)),I.tracking.mac=d,I.tracking.dev=`${n.platform}_${n.browserName}`,I.beatHandle||(I.options&&B(I.options,"Logger")&&console.log("[Logger] Starting tracking beat"),I.beatHandle=window.setInterval(I.flushTracking,15e3))}static setMessagePort(n){this.messagePort=n}static getMessagePort(){return this.messagePort}setLoggingOn(n){this.isLoggingOn=n}addEventListener(n,o){const d=c=>o(c);this.listenerMap.set(o,{eventName:n,wrappedListener:d}),this.eventTarget.addEventListener(n,d)}removeEventListener(n,o){const d=this.listenerMap.get(o);d&&d.eventName===n&&(this.eventTarget.removeEventListener(n,d.wrappedListener),this.listenerMap.delete(o))}removeAllEventListeners(){for(const[n,{eventName:o,wrappedListener:d}]of this.listenerMap)this.eventTarget.removeEventListener(o,d);this.listenerMap.clear()}setAttributes(n){I.processAttributes(n);for(const o in n)xe.logger.setContextProperty(o,n[o])}info(n,o){n==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(o==null?void 0:o.url)||""}),n==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(o==null?void 0:o.isEnabled)??!0}),n==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",o),n==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",o),n==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",o),o&&I.processAttributes(o),this.isLoggingOn&&(xe.logger.info(n,o),I.options&&B(I.options,"Logger")&&console.log("[Logger] Sending info: ",n))}error(n,o){this.emit("mediaSessionDidError",{message:n,...o||{}}),o&&I.processAttributes(o),this.isLoggingOn&&(xe.logger.error(n,o),I.tracking.err_time=Date.now().toFixed(0),I.tracking.err_desc=n+(o?` - ${JSON.stringify(o)}`:""),I.options&&B(I.options,"Logger")&&console.log("[Logger] Sending error: ",n))}criticalError(n,o){this.emit("mediaSessionDidFailOnError",{message:n,...o||{}}),o&&I.processAttributes(o),this.isLoggingOn&&(xe.logger.error(n,o),I.tracking.err_time=Date.now().toFixed(0),I.tracking.err_desc=n+(o?` - ${JSON.stringify(o)}`:""),I.options&&B(I.options,"Logger")&&console.log("[Logger] Sending critical error: ",n))}warn(n,o){o&&I.processAttributes(o),this.isLoggingOn&&(xe.logger.warn(n,o),I.options&&B(I.options,"Logger")&&console.log("[Logger] Sending warn: ",n))}handleMessageFromWorker(n){n.actionType==="INFO"?this.info(n.message,n.attributes):n.actionType==="ERROR"?this.error(n.message,n.attributes):n.actionType==="CRITICAL_ERROR"?this.criticalError(n.message,n.attributes):n.actionType==="WARN"?this.warn(n.message,n.attributes):n.actionType==="SET_ATTRIBUTES"&&n.attributes&&this.setAttributes(n.attributes)}static setAttributes(n){if(!I.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{I.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:n})}catch(o){console.error("[Logger] Error posting message:",o)}}static info(n,o){I.messagePort.postMessage({type:"LOG",actionType:"INFO",message:n,attributes:o})}static error(n,o){I.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:n,attributes:o})}static warn(n,o){I.messagePort.postMessage({type:"LOG",actionType:"WARN",message:n,attributes:o})}static criticalError(n,o){I.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:n,attributes:o})}static processAttributes(n){if(n.player_version&&(I.tracking.sdk=n.player_version),n.media_id&&(I.tracking.gid=n.media_id),n.game_id&&(I.tracking.buc=n.game_id),n.bb_session_id&&(I.tracking.sid=n.bb_session_id,I.options&&B(I.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",I.tracking.sid)),n.last_timecode){const d=O.fromStr(n.last_timecode);I.tracking.tc=d.print(),I.lastTimecodeMillis=d.totalMilliseconds(59.94),I.lastTimecodeMillis&&I.lastZipMillis&&(I.tracking.cache=(I.lastZipMillis-I.lastTimecodeMillis).toFixed(0))}n.last_offset&&(I.tracking.off=n.last_offset),n.last_loading_zip&&(I.tracking.zip=n.last_loading_zip+".zip",I.lastZipMillis=O.fromStr(n.last_loading_zip).totalMilliseconds(59.94),I.lastTimecodeMillis&&I.lastZipMillis&&(I.tracking.cache=(I.lastZipMillis-I.lastTimecodeMillis).toFixed(0))),n.last_rendered_frame&&(I.tracking.aug_time=Date.now().toFixed(0)),n.asset&&(I.tracking.asset=n.asset)}static objectToQuery(n){return Object.entries(n).filter(([o,d])=>d!==0&&d!=="").map(([o,d])=>`${encodeURIComponent(o)}=${encodeURIComponent(String(d))}`).join("&")}emit(n,o){const d=new CustomEvent(n,{detail:o});this.eventTarget.dispatchEvent(d)}};I.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},I.lastTimecodeMillis=0,I.lastZipMillis=0,I.flushTracking=()=>{const n=Date.now().toFixed(0);I.tracking.now=n;const d=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${I.objectToQuery(I.tracking)}&platform=Web`;I.options&&B(I.options,"Logger")&&console.log("[Logger] Flushing tracking data:",d),fetch(d,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),I.tracking.err_desc="",I.tracking.err_time=""};let z=I;class Jt{constructor(n,o,d){this.videoDecoder=null,this.reservedVideoDecoder=null,this.videoDecoderNeedsKeyFrame=!1,this.reservedVideoDecoderNeedsKeyFrame=!1,this.currentTimecode="",this.fps=0,this.unchunkedJobs=[],this.jobChunking=null,this.jobsQueue=[],this.chunksQueue=[],this.chunksForDecodingFrames=[],this.processedMetadata=[],this.alphaFramesQueue=[],this.lastJobEndTimecode=0,this.lastProcessedFrameTimecode=0,this.storedFrames=[],this.pendingBitmapConversions=[],this.isBitmapConversionRunning=!1,this.videoDecoderConfigured=!1,this.reservedVideoDecoderConfigured=!1,this.timecodeErrorCount=0,this.decoderStopped=!1,this.chunkCount=0,this.chunkingTimeSum=0,this.avgChunkingTime=0,this.decodingFrameCount=0,this.decodingTimeSum=0,this.avgDecodingTime=0,this.lastPerformanceCheck=performance.now(),this.loggerTimeoutStart=0,this.loggerTimeout=1e4,this.lastStatusUpdate=0,this.STATUS_UPDATE_INTERVAL=200,this.lastDecoderStatus={healthy:!0,issue:""},this.lastTimecodeStatus={consistent:!0,errorCount:0},this.addJob=(c,f)=>{if(this.decoderStopped)return;if(this.options.MASK_TYPE==="alpha"){this.queueAlphaJob(c,f);return}const{alphaMp4:u,metadataList:r}=this.parseZipAndMetadata(f,c);if(!u){this.options&&B(this.options,"Decoder")&&console.log("[Decoder] No alpha.mp4 found, no decoding needed.");return}const p={timeCode:c,alphaMp4:u,metadata:r,chunks:[],totalFrameCount:r.length,framesProcessed:0,framesSentToDecoder:0,useReserveDecoder:r.length<3,chunkingTime:0};this.jobChunking?this.unchunkedJobs.push(p):(this.jobChunking=p,this.chunkJob(p)),this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Added job:",p)},this.queueAlphaJob=(c,f)=>{const{metadataList:u,alphaFiles:r}=this.parseAlphaZip(f,c);for(const p of u)this.alphaFramesQueue.push({timeCode:p.timecode,metadata:p,alphaFiles:r,composited:!1});this.options&&B(this.options,"Decoder")&&console.log(`[Decoder] Queued ${u.length} alpha frames for ${c}`)},this.compositeUpcomingAlphaFrames=async()=>{if(!this.currentTimecode)return;const c=O.fromStr(this.currentTimecode).totalMilliseconds(this.fps),f=c+this.options.DECODER_LEAD_TIME_MILLIS,u=this.alphaFramesQueue.filter(r=>{const p=O.fromStr(r.timeCode).totalMilliseconds(this.fps);return p>=c&&p<=f&&!r.composited}).sort((r,p)=>{const _=O.fromStr(r.timeCode).totalMilliseconds(this.fps),g=O.fromStr(p.timeCode).totalMilliseconds(this.fps);return _-g}).slice(0,this.options.DECODER_FRAME_BATCH_SIZE);for(const r of u){if(this.decoderStopped)break;try{const p=await this.compositeAlphaMasks(r.metadata,r.alphaFiles);p&&(r.metadata.alphaMask=p),this.processedMetadata.push(r.metadata),z.setAttributes({last_decoded_frame:r.metadata.timecode})}catch(p){this.options&&B(this.options,"Errors")&&console.error("[Decoder] Alpha composite failed:",r.timeCode,p)}finally{r.composited=!0}}this.processedMetadata.length>0&&(this.postBatchToRenderer(this.processedMetadata),this.processedMetadata=[])},this.parseAlphaZip=(c,f)=>{const u=ti.parse(c),r=Object.keys(u).filter(_=>_.endsWith(".json")).sort(this.numericFileComparator).map(_=>{const g=JSON.parse(new TextDecoder().decode(u[_]));return g.timecode=O.toStr(O.fromMetadata(g)),g}),p=new Map;return Object.keys(u).filter(_=>_.endsWith(".alpha")).forEach(_=>{p.set(_,u[_])}),this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Alpha ZIP",f,"metadata=",r.length,"alphaFiles=",p.size),{metadataList:r,alphaFiles:p}},this.compositeAlphaMasks=async(c,f)=>{const{processingWidth:u,processingHeight:r,placeholders:p,timecode:_}=c;if((!p||Object.keys(p).length===0)&&!c.LED)return null;const g=new Uint8ClampedArray(u*r*4).fill(255);let v=_.replace(/:/g,"_");v=v.replace(/_([01])$/,".$1");for(const[S,U]of Object.entries(p||{})){const e=`${v}_${S}.alpha`;let t;for(const[y,b]of f)if(y===e){t=b;break}if(!t){this.options&&B(this.options,"Decoder")&&console.log(`[Decoder] No alpha file found for placeholder ${S} (expected: ${e})`);continue}const{maskX:s,maskY:l,width:h,height:m}=U;if(t.length!==h*m){this.options&&B(this.options,"Errors")&&console.error(`[Decoder] Alpha data size mismatch for ${S}: expected ${h*m}, got ${t.length}`);continue}for(let y=0;y<m;y++)for(let b=0;b<h;b++){const x=y*h+b,w=s+b,T=l+y;if(w>=u||T>=r||w<0||T<0)continue;const C=(T*u+w)*4,F=t[x];g[C]=F,g[C+1]=F,g[C+2]=F,g[C+3]=F}}const E=new ImageData(g,u,r);return createImageBitmap(E)},this.clearOldJobsAndChunks=c=>{const u=O.fromStr(this.currentTimecode).totalMilliseconds(this.fps)-c;this.unchunkedJobs=this.unchunkedJobs.filter(r=>O.fromStr(r.timeCode).totalMilliseconds(this.fps)>u),this.jobsQueue=this.jobsQueue.filter(r=>O.fromStr(r.timeCode).totalMilliseconds(this.fps)>u),this.chunksQueue=this.chunksQueue.filter(r=>O.fromStr(r.timeCode).totalMilliseconds(this.fps)>u),this.alphaFramesQueue=this.alphaFramesQueue.filter(r=>O.fromStr(r.timeCode).totalMilliseconds(this.fps)>u)},this.clearAllJobsAndChunks=()=>{this.unchunkedJobs=[],this.jobsQueue=[],this.chunksQueue=[],this.alphaFramesQueue=[]},this.updateCurrentTimecode=(c,f)=>{if(!this.decoderStopped&&this.options){if(this.fps=59.94,this.currentTimecode){const u=O.fromStr(c).totalMilliseconds(this.fps),r=O.fromStr(this.currentTimecode).totalMilliseconds(this.fps);if(u<r||u>r+this.options.DECODER_LEAD_TIME_MILLIS){this.timecodeErrorCount++,this.updateStatus();const p=performance.now();if(u<r&&(p-this.loggerTimeoutStart>this.loggerTimeout&&(this.loggerTimeoutStart=p,z.error("[Decoder] Timecode is going backwards")),this.options&&B(this.options,"Errors")&&console.error("[Decoder] Timecode is going backwards")),u>r+this.options.DECODER_LEAD_TIME_MILLIS&&(p-this.loggerTimeoutStart>this.loggerTimeout&&(this.loggerTimeoutStart=p,z.error("[Decoder] Timecode is too far ahead")),this.options&&B(this.options,"Errors")&&console.error("[Decoder] Timecode is too far ahead")),this.timecodeErrorCount>5&&!this.options.BURNED_TIMECODES_MODE&&this.restartDecoder(),!this.options.BURNED_TIMECODES_MODE)return}}this.timecodeErrorCount=0,this.currentTimecode=c,this.clearOldJobsAndChunks(2100),this.options.MASK_TYPE==="alpha"?this.compositeUpcomingAlphaFrames():this.decodeUpcomingChunks(),this.updateStatus()}},this.setupMP4Box=(c=!1)=>{const f=hn.createFile();return f.onError=u=>{z.error("[Decoder] MP4 parsing error",u),this.options&&B(this.options,"Errors")&&console.error("[Decoder] MP4 parsing error:",u)},f.onReady=u=>{const r=u.tracks.find(p=>p.type==="video");if(r){if(!(c?this.reservedVideoDecoderConfigured:this.videoDecoderConfigured)){this.options&&B(this.options,"Decoder")&&console.error("[Decoder] Starting a new VideoDecoder");let _;c?(this.reservedVideoDecoder=new VideoDecoder({output:this.onFrameDecoded,error:this.onDecoderError}),_=this.reservedVideoDecoder):(this.videoDecoder=new VideoDecoder({output:this.onFrameDecoded,error:this.onDecoderError}),_=this.videoDecoder),_.configure({codec:r.codec,codedWidth:r.video.width,codedHeight:r.video.height,description:this.getDescription(f.getTrackById(r.id)),hardwareAcceleration:"prefer-hardware",optimizeForLatency:!0}),c?(this.reservedVideoDecoderConfigured=!0,this.reservedVideoDecoderNeedsKeyFrame=!0):(this.videoDecoderConfigured=!0,this.videoDecoderNeedsKeyFrame=!0,this.updateStatus())}f.setExtractionOptions(r.id),f.start()}},f.onSamples=async(u,r,p)=>{var E;const _=[];let g=0,v=0;if(this.options&&B(this.options,"Decoder")&&console.log("[Decoder] onSamples for job",(E=this.jobChunking)==null?void 0:E.timeCode,"samples=",p.length),this.options.browserName==="Firefox"){const S=p.map(e=>e.cts).sort((e,t)=>e-t);g=200-S[0],v=S[S.length-1]+g}for(const S of p){const U=this.options.browserName==="Firefox"?S.cts+this.lastJobEndTimecode+g:S.cts,e=new EncodedVideoChunk({type:S.is_sync?"key":"delta",timestamp:U,data:new Uint8Array(S.data)});_.push(e)}this.storeChunks(_),this.options.browserName==="Firefox"&&(this.lastJobEndTimecode+=v)},f},this.chunkJob=async c=>{c.chunkingTime=performance.now(),this.mp4boxfile=this.setupMP4Box(c.useReserveDecoder);const u=await new Blob([c.alphaMp4],{type:"video/mp4"}).arrayBuffer();u.fileStart=0,this.mp4boxfile.appendBuffer(u)},this.storeChunks=c=>{var r;this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Storing chunks:",c);const f=this.jobChunking;if(c.length!==f.metadata.length){const p=f.metadata.filter(_=>_.placeholders||_.LED&&_.LED.cubePlaceholders);p.length==c.length&&(f.metadata=p)}if(this.options&&B(this.options,"Errors")&&c.length!==f.metadata.length){const p=f.metadata.findIndex((_,g)=>!c[g]);console.error("[Decoder] MISMATCH: first undefined chunk at index",p)}if((r=this.options.debug)!=null&&r.trackPerformance&&(f.chunkingTime=performance.now()-f.chunkingTime,this.chunkCount++,this.chunkingTimeSum+=f.chunkingTime,this.avgChunkingTime=this.chunkingTimeSum/this.chunkCount),this.unchunkedJobs.length>0){const p=this.unchunkedJobs.shift();this.jobChunking=p,this.chunkJob(p)}else this.jobChunking=null;const u=f==null?void 0:f.metadata.map((p,_)=>({timeCode:p.timecode,chunk:c[_],metadata:p,job:f,cancelled:!1,decodingTime:0}));f.chunks=u,this.chunksQueue.push(...u),this.jobsQueue.push(f),this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Jobs Queue:",this.jobsQueue),this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Chunks Queue:",this.chunksQueue)},this.onFrameDecoded=c=>{var p;let f=0;if(this.options.browserName==="Firefox"){f=this.lastProcessedFrameTimecode+200;const _=c.timestamp;if(_!==f){if(this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Frame out of order, storing frame:",_),this.storedFrames.push(c),this.storedFrames.sort((g,v)=>g.timestamp-v.timestamp),this.storedFrames[0].timestamp===f){const g=this.storedFrames.shift();g&&this.onFrameDecoded(g)}this.storedFrames.sort((g,v)=>g.timestamp-v.timestamp);return}this.lastProcessedFrameTimecode=_}this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Frame decoded:",c);const u=this.chunksForDecodingFrames.shift();if(!u){z.error("[Decoder] No current chunk for a processed frame"),this.options&&B(this.options,"Errors")&&console.error("[Decoder] No current chunk for a processed frame");return}if(u.cancelled||this.decoderStopped){this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Skipping cancelled chunk:",u.timeCode),c.close();return}const r=u.metadata;if((p=this.options.debug)!=null&&p.trackPerformance){const _=performance.now();u.decodingTime=_-u.decodingTime,this.decodingFrameCount++,this.decodingTimeSum+=u.decodingTime,this.avgDecodingTime=this.decodingTimeSum/this.decodingFrameCount,_-this.lastPerformanceCheck>=this.options.PERFORMANCE_TRACKING_INTERVAL&&(this.trackPerformance(),this.lastPerformanceCheck=_)}if(u.job.framesProcessed++,this.pendingBitmapConversions.push({frame:c,metadata:r,job:u.job}),this.drainBitmapConversionQueue(),this.options.browserName==="Firefox"&&this.storedFrames.length>0){const _=(f+200)%24200||400;if(this.storedFrames[0].timestamp===_){const g=this.storedFrames.shift();g&&this.onFrameDecoded(g)}}},this.onDecoderError=c=>{var r,p;z.error("[Decoder] VideoDecoder error",c),this.options&&B(this.options,"Errors")&&console.error("[Decoder] VideoDecoder error:",c),this.videoDecoderConfigured=!1,this.reservedVideoDecoderConfigured=!1,this.videoDecoderNeedsKeyFrame=!0,this.reservedVideoDecoderNeedsKeyFrame=!0,this.updateStatus();const f=this.chunksForDecodingFrames.shift();if(!f){z.error("[Decoder] No broken chunk for an error"),this.options&&B(this.options,"Errors")&&console.error("[Decoder] No broken chunk for an error");return}const u=f.job;u&&u.chunks.forEach(_=>_.cancelled=!0),(r=this.reservedVideoDecoder)==null||r.close(),(p=this.videoDecoder)==null||p.close()},this.parseZipAndMetadata=(c,f)=>{var e;const u=ti.parse(c),r=((e=u["alpha.mp4"])==null?void 0:e.buffer)||null,p=Object.keys(u).filter(t=>t.endsWith(".json")).sort(this.numericFileComparator).map(t=>{const s=JSON.parse(new TextDecoder().decode(u[t]));return s.timecode=O.toStr(O.fromMetadata(s)),s}),_=p.length;let g=120;const[v,E,S]=f.split("_").map(Number);E%10===0&&S===0?g=120:S===0&&(g=116),_!==g&&(z.error("[Decoder] Metadata count mismatch",{expected:g,actual:_,timecode:f}),this.options&&B(this.options,"Errors")&&console.error("[Decoder] Metadata count mismatch:",{expected:g,actual:_,timecode:f}));const U=p;return this.options&&B(this.options,"Decoder")&&console.log("[Decoder] ZIP",f,"metadataFull=",p.length,"metadataFiltered=",U.length),{alphaMp4:r,metadataList:U}},this.numericFileComparator=(c,f)=>{const u=/^(\\d{2})_(\\d{2})_(\\d{2})_(\\d{2})(?:\\.(\\d+))?\\.(.+)$/,r=c.match(u),p=f.match(u);if(!r||!p)return 0;const[,_,g,v,E,S="0",U]=r,[,e,t,s,l,h="0",m]=p;return parseInt(_,10)-parseInt(e,10)||parseInt(g,10)-parseInt(t,10)||parseInt(v,10)-parseInt(s,10)||parseInt(E,10)-parseInt(l,10)||parseInt(S,10)-parseInt(h,10)||U.localeCompare(m)},this.getDescription=c=>{for(const f of c.mdia.minf.stbl.stsd.entries){const u=f.avcC||f.hvcC||f.vpcC||f.av1C;if(u){const r=new yt.DataStream(void 0,0,yt.DataStream.BIG_ENDIAN);return u.write(r),new Uint8Array(r.buffer,8)}}return null},this.trackPerformance=()=>{const c=this.getAvgChunkingTime(),f=this.getAvgDecodingTime();ca([{metric:"Chunking time",value:c},{metric:"Decoding time",value:f}])},this.postBatchToRenderer=n,this.restartDecoder=o,this.options=d,this.mp4boxfile=this.setupMP4Box()}isStopped(){return this.decoderStopped}updateStatus(){const n=performance.now();if(n-this.lastStatusUpdate<this.STATUS_UPDATE_INTERVAL)return;const o={healthy:this.videoDecoderConfigured&&!this.decoderStopped,issue:this.videoDecoderConfigured?this.decoderStopped?"Stopped":"":"Not configured"},d={consistent:this.timecodeErrorCount<=3,errorCount:this.timecodeErrorCount};(JSON.stringify(o)!==JSON.stringify(this.lastDecoderStatus)||JSON.stringify(d)!==JSON.stringify(this.lastTimecodeStatus))&&(z.setAttributes({decoder_status:o,timecode_status:d}),this.lastDecoderStatus=o,this.lastTimecodeStatus=d,this.lastStatusUpdate=n)}decodeUpcomingChunks(){const n=O.fromStr(this.currentTimecode).totalMilliseconds(this.fps),o=n+this.options.DECODER_LEAD_TIME_MILLIS,d=this.chunksQueue.filter(f=>{const u=O.fromStr(f.timeCode).totalMilliseconds(this.fps);return u>=n&&u<=o&&!f.decoded});d.sort((f,u)=>{const r=O.fromStr(f.timeCode).totalMilliseconds(this.fps),p=O.fromStr(u.timeCode).totalMilliseconds(this.fps);return r-p});const c=d.slice(0,this.options.DECODER_FRAME_BATCH_SIZE);for(const f of c){if(f.cancelled){this.options&&B(this.options,"Decoder")&&console.log("[Decoder] Skipping cancelled chunk:",f.timeCode);continue}const u=f.job.useReserveDecoder?this.reservedVideoDecoder:this.videoDecoder;if(!u||u.state==="closed"){z.error("[Decoder] No VideoDecoder available"),this.options&&B(this.options,"Errors")&&console.error("[Decoder] No VideoDecoder available");continue}if((f.job.useReserveDecoder?this.reservedVideoDecoderNeedsKeyFrame:this.videoDecoderNeedsKeyFrame)&&f.chunk.type==="delta"){z.error("[Decoder] Decoder needs a key frame, skipping delta chunk",{chunkTimeCode:f.timeCode}),this.options&&B(this.options,"Errors")&&console.error("[Decoder] Decoder needs a key frame, skipping delta chunk:",f.timeCode),f.decoded=!0;continue}try{this.chunksForDecodingFrames.push(f),f.chunk.type==="key"&&(f.job.useReserveDecoder?this.reservedVideoDecoderNeedsKeyFrame=!1:this.videoDecoderNeedsKeyFrame=!1),f.decodingTime=performance.now(),u.decode(f.chunk)}catch(p){z.error("[Decoder] Error decoding chunk",p),this.options&&B(this.options,"Errors")&&console.error("[Decoder] Error decoding chunk:",p),this.videoDecoderConfigured=!1,this.reservedVideoDecoderConfigured=!1,this.videoDecoderNeedsKeyFrame=!0,this.updateStatus(),this.reservedVideoDecoderNeedsKeyFrame=!0,f.job.chunks.forEach(g=>g.cancelled=!0),u.close()}finally{if(f.decoded=!0,f.job.framesSentToDecoder++,f.job.framesSentToDecoder>=f.job.totalFrameCount){u.flush(),f.job.useReserveDecoder;continue}}}}async drainBitmapConversionQueue(){if(!this.isBitmapConversionRunning){for(this.isBitmapConversionRunning=!0;this.pendingBitmapConversions.length>0;){const{frame:n,metadata:o,job:d}=this.pendingBitmapConversions.shift();try{const c=await createImageBitmap(n);n.close(),o.alphaMask=c}catch{n.close();continue}this.processedMetadata.push(o),z.setAttributes({last_decoded_frame:o.timecode}),(this.processedMetadata.length>=this.options.DECODER_FRAME_BATCH_SIZE||d.framesProcessed>=d.totalFrameCount)&&(this.postBatchToRenderer(this.processedMetadata),this.processedMetadata=[])}this.isBitmapConversionRunning=!1}}getAvgChunkingTime(){var n;if((n=this.options.debug)!=null&&n.trackPerformance){const o=this.avgChunkingTime;return this.chunkCount=0,this.chunkingTimeSum=0,this.avgChunkingTime=0,o}return 0}getAvgDecodingTime(){var n;if((n=this.options.debug)!=null&&n.trackPerformance){const o=this.avgDecodingTime;return this.decodingFrameCount=0,this.decodingTimeSum=0,this.avgDecodingTime=0,o}return 0}stop(){var n,o;this.decoderStopped=!0,this.updateStatus(),this.clearAllJobsAndChunks(),this.pendingBitmapConversions.forEach(({frame:d})=>{try{d.close()}catch{}}),this.pendingBitmapConversions=[];try{(n=this.videoDecoder)==null||n.close()}catch(d){z.error("[Decoder] Error closing main VideoDecoder",d),this.options&&B(this.options,"Errors")&&console.error("[Decoder] Error closing main VideoDecoder:",d)}try{(o=this.reservedVideoDecoder)==null||o.close()}catch(d){z.error("[Decoder] Error closing reserved VideoDecoder",d),this.options&&B(this.options,"Errors")&&console.error("[Decoder] Error closing reserved VideoDecoder:",d)}}}let cn=null,_t=null,X,Y;self.onmessage=async a=>{const{data:n}=a;if(n.type==="SET_LOGGER_PORT"&&z.setMessagePort(n.port),n.type==="SET_DOWNLOADER_PORT"&&(cn=n.port,cn.onmessage=da),n.type==="SET_RENDERER_PORT"&&(_t=n.port,_t.onmessage=la),n.type==="SET_OPTIONS"&&(Y=n.options,z.setMessagePort(self),X=new Jt(Xt,gt,Y)),n.type==="STOP_WORKER"){X&&X.stop();return}if(n.type==="RESTART_WORKER"){if(!Y)return;gt();return}};function da(a){const{data:n}=a;if(n.type==="DECODER_INPUT"){if(!X||X.isStopped())return;const{timeCode:o,arrayBuffer:d}=n;Y&&B(Y,"Decoder")&&console.log("[DecoderWorker] Received ArrayBuffer from Downloader, timeCode =",o),X.addJob(o,d)}}function la(a){const{data:n}=a;if(n.type==="DECODER_REQUEST"){if(!X||X.isStopped())return;const{timeCode:o,fps:d}=n;Y&&B(Y,"Decoder")&&console.log("[DecoderWorker] Received TimeCode request from Renderer, timeCode =",o),X.updateCurrentTimecode(o,d)}}function gt(){Y&&(X.stop(),X=new Jt(Xt,gt,Y))}function Xt(a){if(!_t)return;Y&&B(Y,"Decoder")&&console.log(`[DecoderWorker] Posting a batch of ${a.length} frames to Renderer`);const n=a.map(o=>o.alphaMask).filter(o=>o instanceof ImageBitmap);try{_t.postMessage({type:"RENDERER_INPUT",batch:a},n)}catch(o){z.error("[DecoderWorker] Error posting batch to Renderer",{error:o}),Y&&B(Y,"Errors")&&console.error("[DecoderWorker] Error posting batch to Renderer:",o),n.forEach(d=>{try{d.close()}catch{}});return}}function ca(a){const n={type:"TRACK_PERFORMANCE",data:a};self.postMessage(n)}self.onunhandledrejection=a=>{z.error("[DecoderWorker] Unhandled rejection",{error:a.reason}),Y&&(B(Y,"Errors")&&console.error("[DecoderWorker] Unhandled rejection:",a.reason),X.stop(),X=new Jt(Xt,gt,Y),a.preventDefault())},self.onerror=a=>{z.error("[DecoderWorker] Unhandled error",{error:a}),Y&&(B(Y,"Errors")&&console.error("[DecoderWorker] Unhandled error:",a),a instanceof Event&&a.preventDefault())}})();\n',Ht=typeof self<"u"&&self.Blob&&new Blob([Wt],{type:"text/javascript;charset=utf-8"});function ln(t){let e;try{if(e=Ht&&(self.URL||self.webkitURL).createObjectURL(Ht),!e)throw"";const r=new Worker(e,{name:t==null?void 0:t.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Wt),{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const Qt='(function(){"use strict";const g=(s,e)=>e==="Errors"?!0:!s.debug||!s.debug.on?!1:s.debug[`log${e}`],M={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},H=console,ae={};Object.keys(M).forEach(s=>{ae[s]=H[s]});const xe="Datadog Browser SDK:",F={debug:ae.debug.bind(H,xe),log:ae.log.bind(H,xe),info:ae.info.bind(H,xe),warn:ae.warn.bind(H,xe),error:ae.error.bind(H,xe)},Rt="https://docs.datadoghq.com",$t=`${Rt}/real_user_monitoring/browser/troubleshooting`,Xe="More details:";function er(s,e){return(...r)=>{try{return s(...r)}catch(t){F.error(e,t)}}}function Ye(s){return s!==0&&Math.random()*100<=s}function gs(s){return ms(s)&&s>=0&&s<=100}function ms(s){return typeof s=="number"}const Le=1e3,Ae=60*Le,tr=60*Ae,ps=365*(24*tr);function Be(){return new Date().getTime()}function $(){return Be()}function Ve(){return performance.now()}function ee(){return{relative:Ve(),timeStamp:$()}}function Es(){return{relative:0,timeStamp:rr()}}function Ts(s,e){return e-s}function bs(s,e){return s+e}function Rs(s){return s-rr()}let vt;function rr(){return vt===void 0&&(vt=performance.timing.navigationStart),vt}const _=1024,sr=1024*_,vs=/[^\\u0000-\\u007F]/;function yt(s){return vs.test(s)?window.TextEncoder!==void 0?new TextEncoder().encode(s).length:new Blob([s]).size:s.length}function ys(s){return{...s}}function ir(s,e){return Object.keys(s).some(r=>s[r]===e)}function we(s){return Object.keys(s).length===0}function te(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let s=_dd_temp_;return delete Object.prototype._dd_temp_,typeof s!="object"&&(typeof self=="object"?s=self:typeof window=="object"?s=window:s={}),s}function be(s,e){const r=te();let t;return r.Zone&&typeof r.Zone.__symbol__=="function"&&(t=s[r.Zone.__symbol__(e)]),t||(t=s[e]),t}let He,or=!1;function Ds(s){He=s}function Is(s){or=s}function Ss(s,e,r){const t=r.value;r.value=function(...i){return(He?x(t):t).apply(this,i)}}function x(s){return function(){return Pe(s,this,arguments)}}function Pe(s,e,r){try{return s.apply(e,r)}catch(t){Cs(t)}}function Cs(s){if(Dt(s),He)try{He(s)}catch(e){Dt(e)}}function Dt(...s){or&&F.error("[MONITOR]",...s)}function Ue(s,e){return be(te(),"setTimeout")(x(s),e)}function nr(s){be(te(),"clearTimeout")(s)}function It(s,e){return be(te(),"setInterval")(x(s),e)}function ar(s){be(te(),"clearInterval")(s)}class Q{constructor(e){this.onFirstSubscribe=e,this.observers=[]}subscribe(e){return this.observers.push(e),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(r=>e!==r),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(e){this.observers.forEach(r=>r(e))}}function Ar(...s){return new Q(e=>{const r=s.map(t=>t.subscribe(i=>e.notify(i)));return()=>r.forEach(t=>t.unsubscribe())})}function lr(s,e,r){let t=!1,i,o;return{throttled:(...n)=>{if(t){i=n;return}s(...n),t=!0,o=Ue(()=>{i&&s(...i),t=!1,i=void 0},e)},cancel:()=>{nr(o),t=!1,i=void 0}}}function re(){}function se(s){return s?(parseInt(s,10)^Math.random()*16>>parseInt(s,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,se)}const ze=/([\\w-]+)\\s*=\\s*([^;]+)/g;function xs(s,e){for(ze.lastIndex=0;;){const r=ze.exec(s);if(r){if(r[1]===e)return r[2]}else break}}function Ls(s){const e=new Map;for(ze.lastIndex=0;;){const r=ze.exec(s);if(r)e.set(r[1],r[2]);else break}return e}function Bs(s,e,r=""){const t=s.charCodeAt(e-1),o=t>=55296&&t<=56319?e+1:e;return s.length<=o?s:`${s.slice(0,o)}${r}`}function ws(){return Ps()===0}let Ze;function Ps(){return Ze??(Ze=Us())}function Us(s=window){var e;const r=s.navigator.userAgent;return s.chrome||/HeadlessChrome/.test(r)?0:((e=s.navigator.vendor)===null||e===void 0?void 0:e.indexOf("Apple"))===0||/safari/i.test(r)&&!/chrome|android/i.test(r)?1:2}function Oe(s,e,r=0,t){const i=new Date;i.setTime(i.getTime()+r);const o=`expires=${i.toUTCString()}`,n=t&&t.crossSite?"none":"strict",a=t&&t.domain?`;domain=${t.domain}`:"",A=t&&t.secure?";secure":"",c=t&&t.partitioned?";partitioned":"";document.cookie=`${s}=${e};${o};path=/;samesite=${n}${a}${A}${c}`}function St(s){return xs(document.cookie,s)}let Ct;function le(s){return Ct||(Ct=Ls(document.cookie)),Ct.get(s)}function cr(s,e){Oe(s,"",0,e)}function Os(s){if(document.cookie===void 0||document.cookie===null)return!1;try{const e=`dd_cookie_test_${se()}`,r="test";Oe(e,r,Ae,s);const t=St(e)===r;return cr(e,s),t}catch(e){return F.error(e),!1}}let xt;function Ns(){if(xt===void 0){const s=`dd_site_test_${se()}`,e="test",r=window.location.hostname.split(".");let t=r.pop();for(;r.length&&!St(s);)t=`${r.pop()}.${t}`,Oe(s,e,Le,{domain:t});cr(s,{domain:t}),xt=t}return xt}const Re="_dd_s";function _e(s){return Object.values(s)}function Ms(s){return Object.entries(s)}const Lt=4*tr,dr=15*Ae,Fs=ps,Ne={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},ur=/^([a-zA-Z]+)=([a-z0-9-]+)$/,Bt="&";function ks(s){return!!s&&(s.indexOf(Bt)!==-1||ur.test(s))}const Qs="1";function ce(s,e){const r={isExpired:Qs};return e.trackAnonymousUser&&(s!=null&&s.anonymousId?r.anonymousId=s==null?void 0:s.anonymousId:r.anonymousId=se()),r}function Ke(s){return we(s)}function fr(s){return!Ke(s)}function je(s){return s.isExpired!==void 0||!Gs(s)}function Gs(s){return(s.created===void 0||Be()-Number(s.created)<Lt)&&(s.expire===void 0||Be()<Number(s.expire))}function hr(s){s.expire=String(Be()+dr)}function wt(s){return Ms(s).map(([e,r])=>e==="anonymousId"?`aid=${r}`:`${e}=${r}`).join(Bt)}function gr(s){const e={};return ks(s)&&s.split(Bt).forEach(r=>{const t=ur.exec(r);if(t!==null){const[,i,o]=t;i==="aid"?e.anonymousId=o:e[i]=o}}),e}const Ws="_dd",Xs="_dd_r",Ys="_dd_l",Vs="rum",Hs="logs";function zs(s){if(!le(Re)){const r=le(Ws),t=le(Xs),i=le(Ys),o={};r&&(o.id=r),i&&/^[01]$/.test(i)&&(o[Hs]=i),t&&/^[012]$/.test(t)&&(o[Vs]=t),fr(o)&&(hr(o),s.persistSession(o))}}function mr(s){const e=qs(s);return Os(e)?{type:Ne.COOKIE,cookieOptions:e}:void 0}function Zs(s,e){const r={isLockEnabled:ws(),persistSession:_s(e),retrieveSession:js,expireSession:t=>Ks(e,t,s)};return zs(r),r}function _s(s){return e=>{Oe(Re,wt(e),dr,s)}}function Ks(s,e,r){const t=ce(e,r);Oe(Re,wt(t),r.trackAnonymousUser?Fs:Lt,s)}function js(){const s=St(Re);return gr(s)}function qs(s){const e={};return e.secure=!!s.useSecureSessionCookie||!!s.usePartitionedCrossSiteSessionCookie,e.crossSite=!!s.usePartitionedCrossSiteSessionCookie,e.partitioned=!!s.usePartitionedCrossSiteSessionCookie,s.trackSessionAcrossSubdomains&&(e.domain=Ns()),e}const Js="_dd_test_";function pr(){try{const s=se(),e=`${Js}${s}`;localStorage.setItem(e,s);const r=localStorage.getItem(e);return localStorage.removeItem(e),s===r?{type:Ne.LOCAL_STORAGE}:void 0}catch{return}}function $s(s){return{isLockEnabled:!1,persistSession:Er,retrieveSession:ei,expireSession:e=>ti(e,s)}}function Er(s){localStorage.setItem(Re,wt(s))}function ei(){const s=localStorage.getItem(Re);return gr(s)}function ti(s,e){Er(ce(s,e))}const ri=10,si=100,Tr=[];let qe;function de(s,e,r=0){var t;const{isLockEnabled:i,persistSession:o,expireSession:n}=e,a=u=>o({...u,lock:c}),A=()=>{const u=e.retrieveSession(),h=u.lock;return u.lock&&delete u.lock,{session:u,lock:h}};if(qe||(qe=s),s!==qe){Tr.push(s);return}if(i&&r>=si){br(e);return}let c,l=A();if(i){if(l.lock){Je(s,e,r);return}if(c=se(),a(l.session),l=A(),l.lock!==c){Je(s,e,r);return}}let d=s.process(l.session);if(i&&(l=A(),l.lock!==c)){Je(s,e,r);return}if(d&&(je(d)?n(d):(hr(d),i?a(d):o(d))),i&&!(d&&je(d))){if(l=A(),l.lock!==c){Je(s,e,r);return}o(l.session),d=l.session}(t=s.after)===null||t===void 0||t.call(s,d||l.session),br(e)}function Je(s,e,r){Ue(()=>{de(s,e,r+1)},ri)}function br(s){qe=void 0;const e=Tr.shift();e&&de(e,s)}const Rr=Le;function ii(s){switch(s.sessionPersistence){case Ne.COOKIE:return mr(s);case Ne.LOCAL_STORAGE:return pr();case void 0:{let e=mr(s);return!e&&s.allowFallbackToLocalStorage&&(e=pr()),e}default:F.error(`Invalid session persistence \'${String(s.sessionPersistence)}\'`)}}function oi(s,e,r,t){const i=new Q,o=new Q,n=new Q,a=s.type===Ne.COOKIE?Zs(e,s.cookieOptions):$s(e),{expireSession:A}=a,c=It(f,Rr);let l;b();const{throttled:d,cancel:u}=lr(()=>{de({process:E=>{if(Ke(E))return;const w=m(E);return S(w),w},after:E=>{fr(E)&&!p()&&C(E),l=E}},a)},Rr);function h(){de({process:E=>p()?m(E):void 0},a)}function f(){de({process:E=>je(E)?ce(E,e):void 0,after:m},a)}function m(E){return je(E)&&(E=ce(E,e)),p()&&(y(E)?R():(n.notify({previousState:l,newState:E}),l=E)),E}function b(){de({process:E=>{if(Ke(E))return ce(E,e)},after:E=>{l=E}},a)}function S(E){if(Ke(E))return!1;const{trackingType:w,isTracked:B}=t(E[r]);E[r]=w,delete E.isExpired,B&&!E.id&&(E.id=se(),E.created=String(Be()))}function p(){return l[r]!==void 0}function y(E){return l.id!==E.id||l[r]!==E[r]}function R(){l=ce(l,e),o.notify()}function C(E){l=E,i.notify()}function P(E){de({process:w=>({...w,...E}),after:m},a)}return{expandOrRenewSession:d,expandSession:h,getSession:()=>l,renewObservable:i,expireObservable:o,sessionStateUpdateObservable:n,restartSession:b,expire:()=>{u(),A(l),m(ce(l,e))},stop:()=>{ar(c)},updateSessionState:P}}const Pt={GRANTED:"granted",NOT_GRANTED:"not-granted"};function ni(s){const e=new Q;return{tryToInit(r){s||(s=r)},update(r){s=r,e.notify()},isGranted(){return s===Pt.GRANTED},observable:e}}function ue(s,e,r){if(typeof s!="object"||s===null)return JSON.stringify(s);const t=ve(Object.prototype),i=ve(Array.prototype),o=ve(Object.getPrototypeOf(s)),n=ve(s);try{return JSON.stringify(s,e,r)}catch{return"<error: unable to serialize object>"}finally{t(),i(),o(),n()}}function ve(s){const e=s,r=e.toJSON;return r?(delete e.toJSON,()=>{e.toJSON=r}):re}function Ut(s){return ai(s,location.href).href}function ai(s,e){const r=Ai();if(r)try{return e!==void 0?new r(s,e):new r(s)}catch(o){throw new Error(`Failed to construct URL: ${String(o)} ${ue({url:s,base:e})}`)}if(e===void 0&&!/:/.test(s))throw new Error(`Invalid URL: \'${s}\'`);let t=document;const i=t.createElement("a");if(e!==void 0){t=document.implementation.createHTMLDocument("");const o=t.createElement("base");o.href=e,t.head.appendChild(o),t.body.appendChild(i)}return i.href=s,i}const vr=URL;let $e;function Ai(){if($e===void 0)try{$e=new vr("http://test/path").href==="http://test/path"}catch{$e=!1}return $e?vr:void 0}const li="datad0g.com",ci="dd0g-gov.com",ye="datadoghq.com",di="ddog-gov.com",ui="pci.browser-intake-datadoghq.com",fi=["ddsource","ddtags"];function Me(s,e,r){const t=hi(s,e);return{build(i,o){const n=mi(s,e,r,i,o);return t(n)},urlPrefix:t(""),trackType:e}}function hi(s,e){const r=`/api/v2/${e}`,t=s.proxy;if(typeof t=="string"){const o=Ut(t);return n=>`${o}?ddforward=${encodeURIComponent(`${r}?${n}`)}`}if(typeof t=="function")return o=>t({path:r,parameters:o});const i=gi(e,s);return o=>`https://${i}${r}?${o}`}function gi(s,e){const{site:r=ye,internalAnalyticsSubdomain:t}=e;if(s==="logs"&&e.usePciIntake&&r===ye)return ui;if(t&&r===ye)return`${t}.${ye}`;if(r===ci)return`http-intake.logs.${r}`;const i=r.split("."),o=i.pop();return`browser-intake-${i.join("-")}.${o}`}function mi({clientToken:s,internalAnalyticsSubdomain:e},r,t,i,{retry:o,encoding:n}){const a=["sdk_version:6.5.0",`api:${i}`].concat(t);o&&a.push(`retry_count:${o.count}`,`retry_after:${o.lastFailureStatus}`);const A=["ddsource=browser",`ddtags=${encodeURIComponent(a.join(","))}`,`dd-api-key=${s}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${se()}`];return n&&A.push(`dd-evp-encoding=${n}`),r==="rum"&&A.push(`batch_time=${$()}`),e&&A.reverse(),A.join("&")}const pi=200;function Ei(s){const{env:e,service:r,version:t,datacenter:i}=s,o=[];return e&&o.push(et("env",e)),r&&o.push(et("service",r)),t&&o.push(et("version",t)),i&&o.push(et("datacenter",i)),o}function et(s,e){const r=pi-s.length-1;(e.length>r||Ti(e))&&F.warn(`${s} value doesn\'t meet tag requirements and will be sanitized. ${Xe} ${Rt}/getting_started/tagging/#defining-tags`);const t=e.replace(/,/g,"_");return`${s}:${t}`}function Ti(s){return bi()?new RegExp("[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]","u").test(s):!1}function bi(){try{return new RegExp("[\\\\p{Ll}]","u"),!0}catch{return!1}}function Ri(s){const e=s.site||ye,r=Ei(s),t=vi(s,r);return{replica:yi(s,r),site:e,...t}}function vi(s,e){return{logsEndpointBuilder:Me(s,"logs",e),rumEndpointBuilder:Me(s,"rum",e),sessionReplayEndpointBuilder:Me(s,"replay",e)}}function yi(s,e){if(!s.replica)return;const r={...s,site:ye,clientToken:s.replica.clientToken},t={logsEndpointBuilder:Me(r,"logs",e),rumEndpointBuilder:Me(r,"rum",e)};return{applicationId:s.replica.applicationId,...t}}function Di(s){return fi.every(e=>s.includes(e))}function Ot(s,e){return s!=null&&typeof s!="string"?(F.error(`${e} must be defined as a string`),!1):!0}function Ii(s){return s&&typeof s=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(s)?(F.error(`Site should be a valid Datadog site. ${Xe} ${Rt}/getting_started/site/.`),!1):!0}function tt(s,e){return s!==void 0&&!gs(s)?(F.error(`${e} Sample Rate should be a number between 0 and 100`),!1):!0}function Si(s){var e,r,t,i,o,n;if(!s||!s.clientToken){F.error("Client Token is not configured, we will not send any data.");return}if(!(!Ii(s.site)||!tt(s.sessionSampleRate,"Session")||!tt(s.telemetrySampleRate,"Telemetry")||!tt(s.telemetryConfigurationSampleRate,"Telemetry Configuration")||!tt(s.telemetryUsageSampleRate,"Telemetry Usage")||!Ot(s.version,"Version")||!Ot(s.env,"Env")||!Ot(s.service,"Service"))){if(s.trackingConsent!==void 0&&!ir(Pt,s.trackingConsent)){F.error(\'Tracking Consent should be either "granted" or "not-granted"\');return}return{beforeSend:s.beforeSend&&er(s.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:ii(s),sessionSampleRate:(e=s.sessionSampleRate)!==null&&e!==void 0?e:100,telemetrySampleRate:(r=s.telemetrySampleRate)!==null&&r!==void 0?r:20,telemetryConfigurationSampleRate:(t=s.telemetryConfigurationSampleRate)!==null&&t!==void 0?t:5,telemetryUsageSampleRate:(i=s.telemetryUsageSampleRate)!==null&&i!==void 0?i:5,service:s.service||void 0,silentMultipleInit:!!s.silentMultipleInit,allowUntrustedEvents:!!s.allowUntrustedEvents,trackingConsent:(o=s.trackingConsent)!==null&&o!==void 0?o:Pt.GRANTED,trackAnonymousUser:(n=s.trackAnonymousUser)!==null&&n!==void 0?n:!0,storeContextsAcrossPages:!!s.storeContextsAcrossPages,batchBytesLimit:16*_,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*Le,batchMessagesLimit:50,messageBytesLimit:256*_,...Ri(s)}}}function Ci(s){return{session_sample_rate:s.sessionSampleRate,telemetry_sample_rate:s.telemetrySampleRate,telemetry_configuration_sample_rate:s.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:s.telemetryUsageSampleRate,use_before_send:!!s.beforeSend,use_partitioned_cross_site_session_cookie:s.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:s.useSecureSessionCookie,use_proxy:!!s.proxy,silent_multiple_init:s.silentMultipleInit,track_session_across_subdomains:s.trackSessionAcrossSubdomains,track_anonymous_user:s.trackAnonymousUser,session_persistence:s.sessionPersistence,allow_fallback_to_local_storage:!!s.allowFallbackToLocalStorage,store_contexts_across_pages:!!s.storeContextsAcrossPages,allow_untrusted_events:!!s.allowUntrustedEvents,tracking_consent:s.trackingConsent}}var Nt;(function(s){s.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",s.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(Nt||(Nt={}));const yr=new Set;function xi(s){Array.isArray(s)&&Li(s.filter(e=>ir(Nt,e)))}function Li(s){s.forEach(e=>{yr.add(e)})}function Bi(){return yr}const Fe="?";function K(s){const e=[];let r=Mt(s,"stack");const t=String(s);return r&&r.startsWith(t)&&(r=r.slice(t.length)),r&&r.split(`\n`).forEach(i=>{const o=Ui(i)||Ni(i)||Fi(i)||Gi(i);o&&(!o.func&&o.line&&(o.func=Fe),e.push(o))}),{message:Mt(s,"message"),name:Mt(s,"name"),stack:e}}const Dr="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\\\w+\\\\.|\\\\/).*?)",De="(?::(\\\\d+))",wi=new RegExp(`^\\\\s*at (.*?) ?\\\\(${Dr}${De}?${De}?\\\\)?\\\\s*$`,"i"),Pi=new RegExp(`\\\\((\\\\S*)${De}${De}\\\\)`);function Ui(s){const e=wi.exec(s);if(!e)return;const r=e[2]&&e[2].indexOf("native")===0,t=e[2]&&e[2].indexOf("eval")===0,i=Pi.exec(e[2]);return t&&i&&(e[2]=i[1],e[3]=i[2],e[4]=i[3]),{args:r?[e[2]]:[],column:e[4]?+e[4]:void 0,func:e[1]||Fe,line:e[3]?+e[3]:void 0,url:r?void 0:e[2]}}const Oi=new RegExp(`^\\\\s*at ?${Dr}${De}?${De}??\\\\s*$`,"i");function Ni(s){const e=Oi.exec(s);if(e)return{args:[],column:e[3]?+e[3]:void 0,func:Fe,line:e[2]?+e[2]:void 0,url:e[1]}}const Mi=/^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;function Fi(s){const e=Mi.exec(s);if(e)return{args:[],column:e[4]?+e[4]:void 0,func:e[1]||Fe,line:+e[3],url:e[2]}}const ki=/^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,Qi=/(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;function Gi(s){const e=ki.exec(s);if(!e)return;const r=e[3]&&e[3].indexOf(" > eval")>-1,t=Qi.exec(e[3]);return r&&t&&(e[3]=t[1],e[4]=t[2],e[5]=void 0),{args:e[2]?e[2].split(","):[],column:e[5]?+e[5]:void 0,func:e[1]||Fe,line:e[4]?+e[4]:void 0,url:e[3]}}function Mt(s,e){if(typeof s!="object"||!s||!(e in s))return;const r=s[e];return typeof r=="string"?r:void 0}function Wi(s,e,r,t){const i=[{url:e,column:t,line:r}],{name:o,message:n}=Yi(s);return{name:o,message:n,stack:i}}const Xi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;function Yi(s){let e,r;return{}.toString.call(s)==="[object String]"&&([,e,r]=Xi.exec(s)),{name:e,message:r}}function rt(s){const r=new Error(s);r.name="HandlingStack";let t;return Pe(()=>{const i=K(r);i.stack=i.stack.slice(2),t=fe(i)}),t}function fe(s){let e=Ir(s);return s.stack.forEach(r=>{const t=r.func==="?"?"<anonymous>":r.func,i=r.args&&r.args.length>0?`(${r.args.join(", ")})`:"",o=r.line?`:${r.line}`:"",n=r.line&&r.column?`:${r.column}`:"";e+=`\n at ${t}${i} @ ${r.url}${o}${n}`}),e}function Ir(s){return`${s.name||"Error"}: ${s.message}`}function he(s,e,r,{computeHandlingStack:t}={}){let i=s[e];if(typeof i!="function")if(e in s&&e.startsWith("on"))i=re;else return{stop:re};let o=!1;const n=function(){if(o)return i.apply(this,arguments);const a=Array.from(arguments);let A;Pe(r,null,[{target:this,parameters:a,onPostCall:l=>{A=l},handlingStack:t?rt("instrumented method"):void 0}]);const c=i.apply(this,a);return A&&Pe(A,null,[c]),c};return s[e]=n,{stop:()=>{o=!0,s[e]===n&&(s[e]=i)}}}const Vi=220*_,Hi="$",zi=3;function j(s,e=Vi){const r=ve(Object.prototype),t=ve(Array.prototype),i=[],o=new WeakMap,n=Ft(s,Hi,void 0,i,o),a=JSON.stringify(n);let A=a?a.length:0;if(A>e){Qt(e,"discarded",s);return}for(;i.length>0&&A<e;){const c=i.shift();let l=0;if(Array.isArray(c.source))for(let d=0;d<c.source.length;d++){const u=Ft(c.source[d],c.path,d,i,o);if(u!==void 0?A+=JSON.stringify(u).length:A+=4,A+=l,l=1,A>e){Qt(e,"truncated",s);break}c.target[d]=u}else for(const d in c.source)if(Object.prototype.hasOwnProperty.call(c.source,d)){const u=Ft(c.source[d],c.path,d,i,o);if(u!==void 0&&(A+=JSON.stringify(u).length+l+d.length+zi,l=1),A>e){Qt(e,"truncated",s);break}c.target[d]=u}}return r(),t(),n}function Ft(s,e,r,t,i){const o=Ki(s);if(!o||typeof o!="object")return Zi(o);const n=kt(o);if(n!=="[Object]"&&n!=="[Array]"&&n!=="[Error]")return n;const a=s;if(i.has(a))return`[Reference seen at ${i.get(a)}]`;const A=r!==void 0?`${e}.${r}`:e,c=Array.isArray(o)?[]:{};return i.set(a,A),t.push({source:o,target:c,path:A}),c}function Zi(s){return typeof s=="bigint"?`[BigInt] ${s.toString()}`:typeof s=="function"?`[Function] ${s.name||"unknown"}`:typeof s=="symbol"?`[Symbol] ${s.description||s.toString()}`:s}function kt(s){try{if(s instanceof Event)return _i(s);if(s instanceof RegExp)return`[RegExp] ${s.toString()}`;const r=Object.prototype.toString.call(s).match(/\\[object (.*)\\]/);if(r&&r[1])return`[${r[1]}]`}catch{}return"[Unserializable]"}function _i(s){return{type:s.type,isTrusted:s.isTrusted,currentTarget:s.currentTarget?kt(s.currentTarget):null,target:s.target?kt(s.target):null}}function Ki(s){const e=s;if(e&&typeof e.toJSON=="function")try{return e.toJSON()}catch{}return s}function Qt(s,e,r){F.warn(`The data provided has been ${e} as it is over the limit of ${s} characters:`,r)}const Sr="No stack, consider using an instance of Error";function Cr({stackTrace:s,originalError:e,handlingStack:r,componentStack:t,startClocks:i,nonErrorPrefix:o,source:n,handling:a}){const A=ie(e),c=ji(s,A,o,e),l=qi(A,s)?fe(s):Sr,d=A?Br(e,n):void 0,u=s?s.name:void 0,h=xr(e),f=Lr(e);return{startClocks:i,source:n,handling:a,handlingStack:r,componentStack:t,originalError:e,type:u,message:c,stack:l,causes:d,fingerprint:h,context:f}}function ji(s,e,r,t){return s!=null&&s.message&&(s!=null&&s.name)?s.message:e?"Empty message":`${r} ${ue(j(t))}`}function qi(s,e){return e===void 0?!1:s?!0:e.stack.length>0&&(e.stack.length>1||e.stack[0].url!==void 0)}function xr(s){return ie(s)&&"dd_fingerprint"in s?String(s.dd_fingerprint):void 0}function Lr(s){if(s!==null&&typeof s=="object"&&"dd_context"in s)return s.dd_context}function Ji(s){var e;return(e=/@ (.+)/.exec(s))===null||e===void 0?void 0:e[1]}function ie(s){return s instanceof Error||Object.prototype.toString.call(s)==="[object Error]"}function Br(s,e){let r=s;const t=[];for(;ie(r==null?void 0:r.cause)&&t.length<10;){const i=K(r.cause);t.push({message:r.cause.message,source:e,type:i==null?void 0:i.name,stack:fe(i)}),r=r.cause}return t.length?t:void 0}const X={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function $i(s){const e=(i,o)=>{const n=Cr({stackTrace:i,originalError:o,startClocks:ee(),nonErrorPrefix:"Uncaught",source:X.SOURCE,handling:"unhandled"});s.notify(n)},{stop:r}=eo(e),{stop:t}=to(e);return{stop:()=>{r(),t()}}}function eo(s){return he(window,"onerror",({parameters:[e,r,t,i,o]})=>{let n;ie(o)?n=K(o):n=Wi(e,r,t,i),s(n,o??e)})}function to(s){return he(window,"onunhandledrejection",({parameters:[e]})=>{const r=e.reason||"Empty reason",t=K(r);s(t,r)})}function ro(s){const e={version:"6.5.0",onReady(r){r()},...s};return Object.defineProperty(e,"_setDebug",{get(){return Is},enumerable:!1}),e}function so(s,e,r){const t=s[e];t&&!t.q&&t.version&&F.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),s[e]=r,t&&t.q&&t.q.forEach(i=>er(i,"onReady callback threw an error:")())}function wr(s,e){e.silentMultipleInit||F.error(`${s} is already initialized.`)}function ge(s,e,r,t,i){return Gt(s,e,[r],t,i)}function Gt(s,e,r,t,{once:i,capture:o,passive:n}={}){const a=x(u=>{!u.isTrusted&&!u.__ddIsTrusted&&!s.allowUntrustedEvents||(i&&d(),t(u))}),A=n?{capture:o,passive:n}:o,c=window.EventTarget&&e instanceof EventTarget?window.EventTarget.prototype:e,l=be(c,"addEventListener");r.forEach(u=>l.call(e,u,a,A));function d(){const u=be(c,"removeEventListener");r.forEach(h=>u.call(e,h,a,A))}return{stop:d}}const st={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function io(s,e){const r=[];e.includes(st.cspViolation)&&r.push(no(s));const t=e.filter(i=>i!==st.cspViolation);return t.length&&r.push(oo(t)),Ar(...r)}function oo(s){return new Q(e=>{if(!window.ReportingObserver)return;const r=x((i,o)=>i.forEach(n=>e.notify(ao(n)))),t=new window.ReportingObserver(r,{types:s,buffered:!0});return t.observe(),()=>{t.disconnect()}})}function no(s){return new Q(e=>{const{stop:r}=ge(s,document,"securitypolicyviolation",t=>{e.notify(Ao(t))});return r})}function ao(s){const{type:e,body:r}=s;return Pr({type:r.id,message:`${e}: ${r.message}`,originalError:s,stack:Ur(r.id,r.message,r.sourceFile,r.lineNumber,r.columnNumber)})}function Ao(s){const e=`\'${s.blockedURI}\' blocked by \'${s.effectiveDirective}\' directive`;return Pr({type:s.effectiveDirective,message:`${st.cspViolation}: ${e}`,originalError:s,csp:{disposition:s.disposition},stack:Ur(s.effectiveDirective,s.originalPolicy?`${e} of the policy "${Bs(s.originalPolicy,100,"...")}"`:"no policy",s.sourceFile,s.lineNumber,s.columnNumber)})}function Pr(s){return{startClocks:ee(),source:X.REPORT,handling:"unhandled",...s}}function Ur(s,e,r,t,i){return r?fe({name:s,message:e,stack:[{func:"?",url:r,line:t??void 0,column:i??void 0}]}):void 0}function Or(s,e){const r=window.__ddBrowserSdkExtensionCallback;r&&r({type:s,payload:e})}function Nr(s){return s===null?"null":Array.isArray(s)?"array":typeof s}function it(s,e,r=lo()){if(e===void 0)return s;if(typeof e!="object"||e===null)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const i=e.flags||[e.global?"g":"",e.ignoreCase?"i":"",e.multiline?"m":"",e.sticky?"y":"",e.unicode?"u":""].join("");return new RegExp(e.source,i)}if(r.hasAlreadyBeenSeen(e))return;if(Array.isArray(e)){const i=Array.isArray(s)?s:[];for(let o=0;o<e.length;++o)i[o]=it(i[o],e[o],r);return i}const t=Nr(s)==="object"?s:{};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=it(t[i],e[i],r));return t}function Mr(s){return it(void 0,s)}function Ie(...s){let e;for(const r of s)r!=null&&(e=it(e,r));return e}function lo(){if(typeof WeakSet<"u"){const e=new WeakSet;return{hasAlreadyBeenSeen(r){const t=e.has(r);return t||e.add(r),t}}}const s=[];return{hasAlreadyBeenSeen(e){const r=s.indexOf(e)>=0;return r||s.push(e),r}}}function co(){var s;const e=window.navigator;return{status:e.onLine?"connected":"not_connected",interfaces:e.connection&&e.connection.type?[e.connection.type]:void 0,effective_type:(s=e.connection)===null||s===void 0?void 0:s.effectiveType}}function uo(s){const e=new Set;return s.forEach(r=>e.add(r)),Array.from(e)}function Fr(s,e){const r=s.indexOf(e);r>=0&&s.splice(r,1)}const fo=500;function kr(){const s=[];return{add:i=>{s.push(i)>fo&&s.splice(0,1)},remove:i=>{Fr(s,i)},drain:i=>{s.forEach(o=>o(i)),s.length=0}}}const me={log:"log",configuration:"configuration",usage:"usage"},ho=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],go=[di];let Qr=kr(),Se=s=>{Qr.add(()=>Se(s))};function mo(s,e){let r;const t=new Q,i=new Set,o=!go.includes(e.site)&&Ye(e.telemetrySampleRate),n={[me.log]:o,[me.configuration]:o&&Ye(e.telemetryConfigurationSampleRate),[me.usage]:o&&Ye(e.telemetryUsageSampleRate)},a=po();Se=c=>{const l=ue(c);if(n[c.type]&&i.size<e.maxTelemetryEventsPerPage&&!i.has(l)){const d=A(s,c,a);t.notify(d),Or("telemetry",d),i.add(l)}},Ds(Wr);function A(c,l,d){return Ie({type:"telemetry",date:$(),service:c,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:Ie(l,{runtime_env:d,connectivity:co(),sdk_setup:"npm"}),experimental_features:Array.from(Bi())},r!==void 0?r():{})}return{setContextProvider:c=>{r=c},observable:t,enabled:o}}function po(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function Eo(){Qr.drain()}function To(s){return s.site===li}function Gr(s,e){Dt(M.debug,s,e),Se({type:me.log,message:s,status:"debug",...e})}function Wr(s,e){Se({type:me.log,status:"error",...vo(s),...e})}function bo(s){Se({type:me.configuration,configuration:s})}function Ro(s){Se({type:me.usage,usage:s})}function vo(s){if(ie(s)){const e=K(s);return{error:{kind:e.name,stack:fe(yo(e))},message:e.message}}return{error:{stack:Sr},message:`Uncaught ${ue(s)}`}}function yo(s){return s.stack=s.stack.filter(e=>!e.url||ho.some(r=>e.url.startsWith(r))),s}const ke=1/0,Do=Ae;let Qe=null;const ot=new Set;function Io(){ot.forEach(s=>s())}function So({expireDelay:s,maxEntries:e}){let r=[];const t=[];Qe||(Qe=It(()=>Io(),Do));const i=()=>{const h=Ve()-s;for(;r.length>0&&r[r.length-1].endTime<h;){const f=r.pop();f&&t.push(f.startTime)}};ot.add(i);function o(h,f){const m={value:h,startTime:f,endTime:ke,remove:()=>{Fr(r,m)},close:b=>{m.endTime=b}};return e&&r.length>=e&&r.pop(),r.unshift(m),m}function n(h=ke,f={returnInactive:!1}){for(const m of r)if(m.startTime<=h){if(f.returnInactive||h<=m.endTime)return m.value;break}}function a(h){const f=r[0];f&&f.endTime===ke&&f.close(h)}function A(h=ke,f=0){const m=bs(h,f);return r.filter(b=>b.startTime<=m&&h<=b.endTime).map(b=>b.value)}function c(){return r.map(({startTime:h,endTime:f,value:m})=>({startTime:h,endTime:f===ke?"Infinity":f,value:m}))}function l(){return t}function d(){r=[]}function u(){ot.delete(i),ot.size===0&&Qe&&(ar(Qe),Qe=null)}return{add:o,find:n,closeActive:a,findAll:A,reset:d,stop:u,getAllEntries:c,getDeletedEntries:l}}const Co=Ae,xo=Lt;function Lo(s,e,r,t){const i=new Q,o=new Q,n=oi(s.sessionStoreStrategyType,s,e,r),a=So({expireDelay:xo});n.renewObservable.subscribe(()=>{a.add(A(),Ve()),i.notify()}),n.expireObservable.subscribe(()=>{o.notify(),a.closeActive(Ve())}),n.expandOrRenewSession(),a.add(A(),Es().relative),t.observable.subscribe(()=>{t.isGranted()?n.expandOrRenewSession():n.expire()}),Bo(s,()=>{t.isGranted()&&n.expandOrRenewSession()}),wo(s,()=>n.expandSession()),Po(s,()=>n.restartSession());function A(){return{id:n.getSession().id,trackingType:n.getSession()[e],isReplayForced:!!n.getSession().forcedReplay,anonymousId:n.getSession().anonymousId}}return{findSession:(c,l)=>a.find(c,l),renewObservable:i,expireObservable:o,sessionStateUpdateObservable:n.sessionStateUpdateObservable,expire:n.expire,updateSessionState:n.updateSessionState}}function Bo(s,e){Gt(s,window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0})}function wo(s,e){const r=()=>{document.visibilityState==="visible"&&e()};ge(s,document,"visibilitychange",r),It(r,Co)}function Po(s,e){ge(s,window,"resume",e,{capture:!0})}function Xr(s){return s>=500}function Uo(s){try{return s.clone()}catch{return}}const Oo=80*_,No=32,Yr=3*sr,Mo=Ae,Vr=Le;function Hr(s,e,r,t,i){e.transportStatus===0&&e.queuedPayloads.size()===0&&e.bandwidthMonitor.canHandle(s)?Zr(s,e,r,{onSuccess:()=>_r(0,e,r,t,i),onFailure:()=>{e.queuedPayloads.enqueue(s),zr(e,r,t,i)}}):e.queuedPayloads.enqueue(s)}function zr(s,e,r,t){s.transportStatus===2&&Ue(()=>{const i=s.queuedPayloads.first();Zr(i,s,e,{onSuccess:()=>{s.queuedPayloads.dequeue(),s.currentBackoffTime=Vr,_r(1,s,e,r,t)},onFailure:()=>{s.currentBackoffTime=Math.min(Mo,s.currentBackoffTime*2),zr(s,e,r,t)}})},s.currentBackoffTime)}function Zr(s,e,r,{onSuccess:t,onFailure:i}){e.bandwidthMonitor.add(s),r(s,o=>{e.bandwidthMonitor.remove(s),Fo(o)?(e.transportStatus=e.bandwidthMonitor.ongoingRequestCount>0?1:2,s.retry={count:s.retry?s.retry.count+1:1,lastFailureStatus:o.status},i()):(e.transportStatus=0,t())})}function _r(s,e,r,t,i){s===0&&e.queuedPayloads.isFull()&&!e.queueFullReported&&(i({message:`Reached max ${t} events size queued for upload: ${Yr/sr}MiB`,source:X.AGENT,startClocks:ee()}),e.queueFullReported=!0);const o=e.queuedPayloads;for(e.queuedPayloads=Kr();o.size()>0;)Hr(o.dequeue(),e,r,t,i)}function Fo(s){return s.type!=="opaque"&&(s.status===0&&!navigator.onLine||s.status===408||s.status===429||Xr(s.status))}function ko(){return{transportStatus:0,currentBackoffTime:Vr,bandwidthMonitor:Qo(),queuedPayloads:Kr(),queueFullReported:!1}}function Kr(){const s=[];return{bytesCount:0,enqueue(e){this.isFull()||(s.push(e),this.bytesCount+=e.bytesCount)},first(){return s[0]},dequeue(){const e=s.shift();return e&&(this.bytesCount-=e.bytesCount),e},size(){return s.length},isFull(){return this.bytesCount>=Yr}}}function Qo(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(s){return this.ongoingRequestCount===0||this.ongoingByteCount+s.bytesCount<=Oo&&this.ongoingRequestCount<No},add(s){this.ongoingRequestCount+=1,this.ongoingByteCount+=s.bytesCount},remove(s){this.ongoingRequestCount-=1,this.ongoingByteCount-=s.bytesCount}}}function Go(s,e,r){const t=ko(),i=(o,n)=>Yo(s,e,o,n);return{send:o=>{Hr(o,t,i,s.trackType,r)},sendOnExit:o=>{Wo(s,e,o)}}}function Wo(s,e,r){if(!!navigator.sendBeacon&&r.bytesCount<e)try{const o=s.build("beacon",r);if(navigator.sendBeacon(o,r.data))return}catch(o){Xo(o)}const i=s.build("xhr",r);Wt(i,r.data)}let jr=!1;function Xo(s){jr||(jr=!0,Wr(s))}function Yo(s,e,r,t){if(Vo()&&r.bytesCount<e){const o=s.build("fetch",r);fetch(o,{method:"POST",body:r.data,keepalive:!0,mode:"cors"}).then(x(n=>t==null?void 0:t({status:n.status,type:n.type})),x(()=>{const n=s.build("xhr",r);Wt(n,r.data,t)}))}else{const o=s.build("xhr",r);Wt(o,r.data,t)}}function Vo(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function Wt(s,e,r){const t=new XMLHttpRequest;t.open("POST",s,!0),e instanceof Blob&&t.setRequestHeader("Content-Type",e.type),ge({allowUntrustedEvents:!0},t,"loadend",()=>{r==null||r({status:t.status})},{once:!0}),t.send(e)}function Xt(){const s=Ho();if(s)return{getCapabilities(){var e;return JSON.parse(((e=s.getCapabilities)===null||e===void 0?void 0:e.call(s))||"[]")},getPrivacyLevel(){var e;return(e=s.getPrivacyLevel)===null||e===void 0?void 0:e.call(s)},getAllowedWebViewHosts(){return JSON.parse(s.getAllowedWebViewHosts())},send(e,r,t){const i=t?{id:t}:void 0;s.send(JSON.stringify({eventType:e,event:r,view:i}))}}}function nt(s){var e;s===void 0&&(s=(e=te().location)===null||e===void 0?void 0:e.hostname);const r=Xt();return!!r&&r.getAllowedWebViewHosts().some(t=>s===t||s.endsWith(`.${t}`))}function Ho(){return te().DatadogEventBridge}const at={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function zo(s){return new Q(e=>{const{stop:r}=Gt(s,window,["visibilitychange","freeze"],i=>{i.type==="visibilitychange"&&document.visibilityState==="hidden"?e.notify({reason:at.HIDDEN}):i.type==="freeze"&&e.notify({reason:at.FROZEN})},{capture:!0}),t=ge(s,window,"beforeunload",()=>{e.notify({reason:at.UNLOADING})}).stop;return()=>{r(),t()}})}function Zo(s){return _e(at).includes(s)}function _o({encoder:s,request:e,flushController:r,messageBytesLimit:t}){let i={};const o=r.flushObservable.subscribe(d=>l(d));function n(d,u,h){r.notifyBeforeAddMessage(u),h!==void 0?(i[h]=d,r.notifyAfterAddMessage()):s.write(s.isEmpty?d:`\n${d}`,f=>{r.notifyAfterAddMessage(f-u)})}function a(d){return d!==void 0&&i[d]!==void 0}function A(d){const u=i[d];delete i[d];const h=s.estimateEncodedBytesCount(u);r.notifyAfterRemoveMessage(h)}function c(d,u){const h=ue(d),f=s.estimateEncodedBytesCount(h);if(f>=t){F.warn(`Discarded a message whose size was bigger than the maximum allowed size ${t}KB. ${Xe} ${$t}/#technical-limitations`);return}a(u)&&A(u),n(h,f,u)}function l(d){const u=_e(i).join(`\n`);i={};const h=Zo(d.reason),f=h?e.sendOnExit:e.send;if(h&&s.isAsync){const m=s.finishSync();m.outputBytesCount&&f(qr(m));const b=[m.pendingData,u].filter(Boolean).join(`\n`);b&&f({data:b,bytesCount:yt(b)})}else u&&s.write(s.isEmpty?u:`\n${u}`),s.finish(m=>{f(qr(m))})}return{flushController:r,add:c,upsert:c,stop:o.unsubscribe}}function qr(s){let e;return typeof s.output=="string"?e=s.output:e=new Blob([s.output],{type:"text/plain"}),{data:e,bytesCount:s.outputBytesCount,encoding:s.encoding}}function Ko({messagesLimit:s,bytesLimit:e,durationLimit:r,pageExitObservable:t,sessionExpireObservable:i}){const o=t.subscribe(f=>l(f.reason)),n=i.subscribe(()=>l("session_expire")),a=new Q(()=>()=>{o.unsubscribe(),n.unsubscribe()});let A=0,c=0;function l(f){if(c===0)return;const m=c,b=A;c=0,A=0,h(),a.notify({reason:f,messagesCount:m,bytesCount:b})}let d;function u(){d===void 0&&(d=Ue(()=>{l("duration_limit")},r))}function h(){nr(d),d=void 0}return{flushObservable:a,get messagesCount(){return c},notifyBeforeAddMessage(f){A+f>=e&&l("bytes_limit"),c+=1,A+=f,u()},notifyAfterAddMessage(f=0){A+=f,c>=s?l("messages_limit"):A>=e&&l("bytes_limit")},notifyAfterRemoveMessage(f){A-=f,c-=1,c===0&&h()}}}function Jr(s,e,r,t,i,o,n=_o){const a=c(s,e),A=r&&c(s,r);function c(l,{endpoint:d,encoder:u}){return n({encoder:u,request:Go(d,l.batchBytesLimit,t),flushController:Ko({messagesLimit:l.batchMessagesLimit,bytesLimit:l.batchBytesLimit,durationLimit:l.flushTimeout,pageExitObservable:i,sessionExpireObservable:o}),messageBytesLimit:l.messageBytesLimit})}return{flushObservable:a.flushController.flushObservable,add(l,d=!0){a.add(l),A&&d&&A.add(r.transformMessage?r.transformMessage(l):l)},upsert:(l,d)=>{a.upsert(l,d),A&&A.upsert(r.transformMessage?r.transformMessage(l):l,d)},stop:()=>{a.stop(),A&&A.stop()}}}function At(){let s="",e=0;return{isAsync:!1,get isEmpty(){return!s},write(r,t){const i=yt(r);e+=i,s+=r,t&&t(i)},finish(r){r(this.finishSync())},finishSync(){const r={output:s,outputBytesCount:e,rawBytesCount:e,pendingData:""};return s="",e=0,r},estimateEncodedBytesCount(r){return r.length}}}class jo{constructor(){this.callbacks={}}notify(e,r){const t=this.callbacks[e];t&&t.forEach(i=>i(r))}subscribe(e,r){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(r),{unsubscribe:()=>{this.callbacks[e]=this.callbacks[e].filter(t=>r!==t)}}}}function qo(s,e,r){let t=0,i=!1;return{isLimitReached(){if(t===0&&Ue(()=>{t=0},Ae),t+=1,t<=e||i)return i=!1,!1;if(t===e+1){i=!0;try{r({message:`Reached max number of ${s}s by minute: ${e}`,source:X.AGENT,startClocks:ee()})}finally{i=!1}}return!0}}}let Yt;const Vt=new WeakMap;function Jo(s){return Yt||(Yt=$o(s)),Yt}function $o(s){return new Q(e=>{const{stop:r}=he(XMLHttpRequest.prototype,"open",en),{stop:t}=he(XMLHttpRequest.prototype,"send",o=>{tn(o,s,e)},{computeHandlingStack:!0}),{stop:i}=he(XMLHttpRequest.prototype,"abort",rn);return()=>{r(),t(),i()}})}function en({target:s,parameters:[e,r]}){Vt.set(s,{state:"open",method:String(e).toUpperCase(),url:Ut(String(r))})}function tn({target:s,handlingStack:e},r,t){const i=Vt.get(s);if(!i)return;const o=i;o.state="start",o.startClocks=ee(),o.isAborted=!1,o.xhr=s,o.handlingStack=e;let n=!1;const{stop:a}=he(s,"onreadystatechange",()=>{s.readyState===XMLHttpRequest.DONE&&A()}),A=()=>{if(c(),a(),n)return;n=!0;const l=i;l.state="complete",l.duration=Ts(o.startClocks.timeStamp,$()),l.status=s.status,t.notify(ys(l))},{stop:c}=ge(r,s,"loadend",A);t.notify(o)}function rn({target:s}){const e=Vt.get(s);e&&(e.isAborted=!0)}let Ht;function $r(){return Ht||(Ht=sn()),Ht}function sn(){return new Q(s=>{if(!window.fetch)return;const{stop:e}=he(window,"fetch",r=>on(r,s),{computeHandlingStack:!0});return e})}function on({parameters:s,onPostCall:e,handlingStack:r},t){const[i,o]=s;let n=o&&o.method;n===void 0&&i instanceof Request&&(n=i.method);const a=n!==void 0?String(n).toUpperCase():"GET",A=i instanceof Request?i.url:Ut(String(i)),c=ee(),l={state:"start",init:o,input:i,method:a,startClocks:c,url:A,handlingStack:r};t.notify(l),s[0]=l.input,s[1]=l.init,e(d=>nn(t,d,l))}function nn(s,e,r){const t=r;function i(o){t.state="resolve",Object.assign(t,o),s.notify(t)}e.then(x(o=>{i({response:o,responseType:o.type,status:o.status,isAborted:!1})}),x(o=>{var n,a;i({status:0,isAborted:((a=(n=t.init)===null||n===void 0?void 0:n.signal)===null||a===void 0?void 0:a.aborted)||o instanceof DOMException&&o.code===DOMException.ABORT_ERR,error:o})}))}let zt={};function an(s){const e=s.map(r=>(zt[r]||(zt[r]=An(r)),zt[r]));return Ar(...e)}function An(s){return new Q(e=>{const r=H[s];return H[s]=(...t)=>{r.apply(console,t);const i=rt("console error");Pe(()=>{e.notify(ln(t,s,i))})},()=>{H[s]=r}})}function ln(s,e,r){const t=s.map(o=>cn(o)).join(" ");let i;if(e===M.error){const o=s.find(ie);i={stack:o?fe(K(o)):void 0,fingerprint:xr(o),causes:o?Br(o,"console"):void 0,startClocks:ee(),message:t,source:X.CONSOLE,handling:"handled",handlingStack:r,context:Lr(o)}}return{api:e,message:t,error:i,handlingStack:r}}function cn(s){return typeof s=="string"?j(s):ie(s)?Ir(K(s)):ue(j(s),void 0,2)}function dn(s){const e=Nr(s)==="object";return e||F.error("Unsupported context:",s),e}function Zt(s,e,r){const t={...s};for(const[i,{required:o,type:n}]of Object.entries(e))n==="string"&&i in t&&(t[i]=String(t[i])),o&&!(i in s)&&F.warn(`The property ${i} of ${r} is required; context will not be sent to the intake.`);return t}function lt(s="",{customerDataTracker:e,propertiesConfig:r={}}={}){let t={};const i=new Q,o={getContext:()=>Mr(t),setContext:n=>{dn(n)?(t=j(Zt(n,r,s)),e==null||e.updateCustomerData(t)):o.clearContext(),i.notify()},setContextProperty:(n,a)=>{t=j(Zt({...t,[n]:a},r,s)),e==null||e.updateCustomerData(t),i.notify()},removeContextProperty:n=>{delete t[n],e==null||e.updateCustomerData(t),Zt(t,r,s),i.notify()},clearContext:()=>{t={},e==null||e.resetCustomerData(),i.notify()},changeObservable:i};return o}const un="_dd_c",fn=[];function _t(s,e,r,t){const i=hn(r,t);fn.push(ge(s,window,"storage",({key:c})=>{i===c&&n()})),e.changeObservable.subscribe(a);const o=Ie(A(),e.getContext());we(o)||e.setContext(o);function n(){e.setContext(A())}function a(){localStorage.setItem(i,JSON.stringify(e.getContext()))}function A(){const c=localStorage.getItem(i);return c?JSON.parse(c):{}}}function hn(s,e){return`${un}_${s}_${e}`}const gn=3*_,mn=16*_,pn=200;function En(s=2){const e=new Map;let r=!1;function t(i=0){if(r||s===0)return;const o=s===2?gn:mn;let n=i;e.forEach(a=>{n+=a.getBytesCount()}),n>o&&(Tn(o),r=!0)}return{createDetachedTracker:()=>{const i=es(()=>t(i.getBytesCount()));return i},getOrCreateTracker:i=>(e.has(i)||e.set(i,es(t)),e.get(i)),setCompressionStatus:i=>{s===0&&(s=i,t())},getCompressionStatus:()=>s,stop:()=>{e.forEach(i=>i.stop()),e.clear()}}}function es(s){let e=0;const{throttled:r,cancel:t}=lr(o=>{e=yt(ue(o)),s()},pn),i=()=>{t(),e=0};return{updateCustomerData:o=>{we(o)?i():r(o)},resetCustomerData:i,getBytesCount:()=>e,stop:()=>{t()}}}function Tn(s){F.warn(`Customer data exceeds the recommended ${s/_}KiB threshold. ${Xe} ${$t}/#customer-data-exceeds-the-recommended-threshold-warning`)}function bn(s,e,r){const t=s.getReader(),i=[];let o=0;n();function n(){t.read().then(x(A=>{if(A.done){a();return}i.push(A.value),o+=A.value.length,o>r.bytesLimit?a():n()}),x(A=>e(A)))}function a(){t.cancel().catch(re);let A,c;{let l;if(i.length===1)l=i[0];else{l=new Uint8Array(o);let d=0;i.forEach(u=>{l.set(u,d),d+=u.length})}A=l.slice(0,r.bytesLimit),c=l.length>r.bytesLimit}e(void 0,A,c)}}const Rn="datadog-synthetics-public-id",vn="datadog-synthetics-result-id",yn="datadog-synthetics-injects-rum";function ts(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||le(yn))}function Dn(){const s=window._DATADOG_SYNTHETICS_PUBLIC_ID||le(Rn);return typeof s=="string"?s:void 0}function In(){const s=window._DATADOG_SYNTHETICS_RESULT_ID||le(vn);return typeof s=="string"?s:void 0}function ct(s,e,r){const t=r.getHandler(),i=Array.isArray(t)?t:[t];return rs[s]>=rs[r.getLevel()]&&i.includes(e)}const I={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},rs={[I.ok]:0,[I.debug]:1,[I.info]:2,[I.notice]:4,[I.warn]:5,[I.error]:6,[I.critical]:7,[I.alert]:8,[I.emerg]:9};function dt(s,{includeMessage:e=!1}={}){return{stack:s.stack,kind:s.type,message:e?s.message:void 0,causes:s.causes,fingerprint:s.fingerprint,handling:s.handling}}var Sn=function(s,e,r,t){var i=arguments.length,o=i<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,r):t,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,r,t);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(i<3?n(o):i>3?n(e,r,o):n(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o};const Ge={console:"console",http:"http",silent:"silent"},Cn=Object.keys(I);let V=class{constructor(e,r,t,i=Ge.http,o=I.debug,n={}){this.handleLogStrategy=e,this.handlerType=i,this.level=o,this.contextManager=lt("logger",{customerDataTracker:r}),this.contextManager.setContext(n),t&&this.contextManager.setContextProperty("logger",{name:t})}logImplementation(e,r,t=I.info,i,o){const n=j(r);let a;if(i!=null){const A=Cr({stackTrace:ie(i)?K(i):void 0,originalError:i,nonErrorPrefix:"Provided",source:X.LOGGER,handling:"handled",startClocks:ee()});a=Ie({error:dt(A,{includeMessage:!0})},n)}else a=n;this.handleLogStrategy({message:j(e),context:a,status:t},this,o)}log(e,r,t=I.info,i){let o;ct(t,Ge.http,this)&&(o=rt("log")),this.logImplementation(e,r,t,i,o)}setContext(e){this.contextManager.setContext(e)}getContext(){return this.contextManager.getContext()}setContextProperty(e,r){this.contextManager.setContextProperty(e,r)}removeContextProperty(e){this.contextManager.removeContextProperty(e)}clearContext(){this.contextManager.clearContext()}setHandler(e){this.handlerType=e}getHandler(){return this.handlerType}setLevel(e){this.level=e}getLevel(){return this.level}};Sn([Ss],V.prototype,"logImplementation",null),V.prototype.ok=q(I.ok),V.prototype.debug=q(I.debug),V.prototype.info=q(I.info),V.prototype.notice=q(I.notice),V.prototype.warn=q(I.warn),V.prototype.error=q(I.error),V.prototype.critical=q(I.critical),V.prototype.alert=q(I.alert),V.prototype.emerg=q(I.emerg);function q(s){return function(e,r,t){let i;ct(s,Ge.http,this)&&(i=rt("log")),this.logImplementation(e,r,s,t,i)}}function xn(s,e,r){return{view:{referrer:document.referrer,url:window.location.href},context:s.getContext(),user:e.getContext(),account:r.getContext()}}const Ln=32*_;function Bn(s){s.usePciIntake===!0&&s.site&&s.site!=="datadoghq.com"&&F.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const e=Si(s),r=ss(s.forwardConsoleLogs,_e(M),"Forward Console Logs"),t=ss(s.forwardReports,_e(st),"Forward Reports");if(!(!e||!r||!t))return s.forwardErrorsToLogs&&!r.includes(M.error)&&r.push(M.error),{forwardErrorsToLogs:s.forwardErrorsToLogs!==!1,forwardConsoleLogs:r,forwardReports:t,requestErrorResponseLengthLimit:Ln,...e}}function ss(s,e,r){if(s===void 0)return[];if(!(s==="all"||Array.isArray(s)&&s.every(t=>e.includes(t)))){F.error(`${r} should be "all" or an array with allowed values "${e.join(\'", "\')}"`);return}return s==="all"?e:uo(s)}function wn(s){const e=Ci(s);return{forward_errors_to_logs:s.forwardErrorsToLogs,forward_console_logs:s.forwardConsoleLogs,forward_reports:s.forwardReports,use_pci_intake:s.usePciIntake,...e}}function Pn(s,e,r){const t=kr();let i,o;const n=e.observable.subscribe(a);function a(){if(!o||!i||!e.isGranted())return;n.unsubscribe();const A=r(i,o);t.drain(A)}return{init(A){if(!A){F.error("Missing configuration");return}if(xi(A.enableExperimentalFeatures),nt()&&(A=Un(A)),i=A,o){wr("DD_LOGS",A);return}const c=Bn(A);c&&(o=c,$r().subscribe(re),e.tryToInit(c.trackingConsent),a())},get initConfiguration(){return i},getInternalContext:re,handleLog(A,c,l,d=s(),u=$()){t.add(h=>h.handleLog(A,c,l,d,u))}}}function Un(s){return{...s,clientToken:"empty"}}const Kt="logs";function On(s){const e=En(),r=lt("global context",{customerDataTracker:e.getOrCreateTracker(2)}),t=lt("user",{customerDataTracker:e.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),i=lt("account",{customerDataTracker:e.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),o=ni();function n(){return xn(r,t,i)}let a=Pn(n,o,(l,d)=>{l.storeContextsAcrossPages&&(_t(d,r,Kt,2),_t(d,t,Kt,1),_t(d,i,Kt,4));const u=s(l,d,n,o);return a=Nn(l,u),u});const A={},c=new V((...l)=>a.handleLog(...l),e.createDetachedTracker());return ro({logger:c,init:x(l=>a.init(l)),setTrackingConsent:x(l=>{o.update(l),Ro({feature:"set-tracking-consent",tracking_consent:l})}),getGlobalContext:x(()=>r.getContext()),setGlobalContext:x(l=>r.setContext(l)),setGlobalContextProperty:x((l,d)=>r.setContextProperty(l,d)),removeGlobalContextProperty:x(l=>r.removeContextProperty(l)),clearGlobalContext:x(()=>r.clearContext()),createLogger:x((l,d={})=>(A[l]=new V((...u)=>a.handleLog(...u),e.createDetachedTracker(),j(l),d.handler,d.level,j(d.context)),A[l])),getLogger:x(l=>A[l]),getInitConfiguration:x(()=>Mr(a.initConfiguration)),getInternalContext:x(l=>a.getInternalContext(l)),setUser:x(t.setContext),getUser:x(t.getContext),setUserProperty:x(t.setContextProperty),removeUserProperty:x(t.removeContextProperty),clearUser:x(t.clearContext),setAccount:x(i.setContext),getAccount:x(i.getContext),setAccountProperty:x(i.setContextProperty),removeAccountProperty:x(i.removeContextProperty),clearAccount:x(i.clearContext)})}function Nn(s,e){return{init:r=>{wr("DD_LOGS",r)},initConfiguration:s,...e}}const Mn="logs";function Fn(s,e){const r=Lo(s,Mn,t=>Qn(s,t),e);return{findTrackedSession:(t,i={returnInactive:!1})=>{const o=r.findSession(t,i);return o&&o.trackingType==="1"?{id:o.id,anonymousId:o.anonymousId}:void 0},expireObservable:r.expireObservable}}function kn(s){const r=is(s)==="1"?{}:void 0;return{findTrackedSession:()=>r,expireObservable:new Q}}function is(s){return Ye(s.sessionSampleRate)?"1":"0"}function Qn(s,e){const r=Gn(e)?e:is(s);return{trackingType:r,isTracked:r==="1"}}function Gn(s){return s==="0"||s==="1"}let os=!1;function ut(s){const e=window;if(ts()){const t=r(e.DD_RUM_SYNTHETICS);return!t&&!os&&(os=!0,Gr("Logs sent before RUM is injected by the synthetics worker",{testId:Dn(),resultId:In()})),t}return r(e.DD_RUM);function r(t){if(t&&t.getInternalContext)return t.getInternalContext(s)}}function Wn(s,e,r,t,i){const o=Cn.concat(["custom"]),n={};o.forEach(a=>{n[a]=qo(a,e.eventRateLimiterThreshold,i)}),r.subscribe(0,({rawLogsEvent:a,messageContext:A=void 0,savedCommonContext:c=void 0,domainContext:l})=>{var d,u;const h=Rs(a.date),f=s.findTrackedSession(h);if(!s.findTrackedSession(h,{returnInactive:!0}))return;const b=c||t();let S;!we(b.account)&&b.account.id&&(S=b.account),f&&f.anonymousId&&!b.user.anonymous_id&&(b.user.anonymous_id=f.anonymousId);const p=Ie({service:e.service,session_id:f?f.id:void 0,session:f?{id:f.id}:void 0,usr:we(b.user)?void 0:b.user,account:S,view:b.view},b.context,ut(h),a,A);((d=e.beforeSend)===null||d===void 0?void 0:d.call(e,p,l))===!1||p.origin!==X.AGENT&&((u=n[p.status])!==null&&u!==void 0?u:n.custom).isLimitReached()||r.notify(1,p)})}const Xn={[M.log]:I.info,[M.debug]:I.debug,[M.info]:I.info,[M.warn]:I.warn,[M.error]:I.error};function Yn(s,e){const r=an(s.forwardConsoleLogs).subscribe(t=>{var i;const o={rawLogsEvent:{date:$(),message:t.message,origin:X.CONSOLE,error:t.error&&dt(t.error),status:Xn[t.api]},messageContext:(i=t.error)===null||i===void 0?void 0:i.context,domainContext:{handlingStack:t.handlingStack}};e.notify(0,o)});return{stop:()=>{r.unsubscribe()}}}function Vn(s,e){const r=io(s,s.forwardReports).subscribe(t=>{let i=t.message,o;const n=t.originalError.type==="deprecation"?I.warn:I.error;n===I.error?o=dt(t):t.stack&&(i+=` Found in ${Ji(t.stack)}`),e.notify(0,{rawLogsEvent:{date:$(),message:i,origin:X.REPORT,error:o,status:n}})});return{stop:()=>{r.unsubscribe()}}}function Hn(s,e){if(!s.forwardErrorsToLogs)return{stop:re};const r=Jo(s).subscribe(o=>{o.state==="complete"&&i("xhr",o)}),t=$r().subscribe(o=>{o.state==="resolve"&&i("fetch",o)});function i(o,n){!Di(n.url)&&(Kn(n)||Xr(n.status))&&("xhr"in n?zn(n.xhr,s,a):n.response?_n(n.response,s,a):n.error&&Zn(n.error,s,a));function a(A){const c={isAborted:n.isAborted,handlingStack:n.handlingStack};e.notify(0,{rawLogsEvent:{message:`${jn(o)} error ${n.method} ${n.url}`,date:n.startClocks.timeStamp,error:{stack:A||"Failed to load",handling:void 0},http:{method:n.method,status_code:n.status,url:n.url},status:I.error,origin:X.NETWORK},domainContext:c})}}return{stop:()=>{r.unsubscribe(),t.unsubscribe()}}}function zn(s,e,r){typeof s.response=="string"?r(jt(s.response,e)):r(s.response)}function Zn(s,e,r){r(jt(fe(K(s)),e))}function _n(s,e,r){const t=Uo(s);!t||!t.body?r():window.TextDecoder?qn(t.body,e.requestErrorResponseLengthLimit,(i,o)=>{r(i?`Unable to retrieve response: ${i}`:o)}):t.text().then(x(i=>r(jt(i,e))),x(i=>r(`Unable to retrieve response: ${i}`)))}function Kn(s){return s.status===0&&s.responseType!=="opaque"}function jt(s,e){return s.length>e.requestErrorResponseLengthLimit?`${s.substring(0,e.requestErrorResponseLengthLimit)}...`:s}function jn(s){return s==="xhr"?"XHR":"Fetch"}function qn(s,e,r){bn(s,(t,i,o)=>{if(t)r(t);else{let n=new TextDecoder().decode(i);o&&(n+="..."),r(void 0,n)}},{bytesLimit:e,collectStreamBody:!0})}function Jn(s,e){if(!s.forwardErrorsToLogs)return{stop:re};const r=new Q,{stop:t}=$i(r),i=r.subscribe(o=>{e.notify(0,{rawLogsEvent:{message:o.message,date:o.startClocks.timeStamp,error:dt(o),origin:X.SOURCE,status:I.error},messageContext:o.context})});return{stop:()=>{t(),i.unsubscribe()}}}const $n=jo;function ea(s){function e(r,t,i,o,n){const a=Ie(t.getContext(),r.context);if(ct(r.status,Ge.console,t)&&ra(r,a),ct(r.status,Ge.http,t)){const A={rawLogsEvent:{date:n||$(),message:r.message,status:r.status,origin:X.LOGGER},messageContext:a,savedCommonContext:o};i&&(A.domainContext={handlingStack:i}),s.notify(0,A)}}return{handleLog:e}}const ta={[I.ok]:M.debug,[I.debug]:M.debug,[I.info]:M.info,[I.notice]:M.info,[I.warn]:M.warn,[I.error]:M.error,[I.critical]:M.error,[I.alert]:M.error,[I.emerg]:M.error};function ra({status:s,message:e},r){ae[ta[s]].call(H,e,r)}function sa(s,e,r,t,i){const o=Jr(s,{endpoint:s.logsEndpointBuilder,encoder:At()},s.replica&&{endpoint:s.replica.logsEndpointBuilder,encoder:At()},r,t,i.expireObservable);return e.subscribe(1,n=>{o.add(n)}),o}function ia(s){const e=Xt();s.subscribe(1,r=>{e.send("log",r)})}function oa(s){return{get:e=>{const r=s.findTrackedSession(e);if(r)return{session_id:r.id}}}}function na(s){return e=>{s.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,origin:X.AGENT,status:I.error}}),Gr("Error reported to customer",{"error.message":e.message})}}function aa(s,e,r,t,i){const o=mo("browser-logs-sdk",e);o.setContextProvider(()=>{var a,A,c,l,d,u;return{application:{id:(a=ut())===null||a===void 0?void 0:a.application_id},session:{id:(A=i.findTrackedSession())===null||A===void 0?void 0:A.id},view:{id:(l=(c=ut())===null||c===void 0?void 0:c.view)===null||l===void 0?void 0:l.id},action:{id:(u=(d=ut())===null||d===void 0?void 0:d.user_action)===null||u===void 0?void 0:u.id}}});const n=[];if(nt()){const a=Xt(),A=o.observable.subscribe(c=>a.send("internal_telemetry",c));n.push(()=>A.unsubscribe())}else{const a=Jr(e,{endpoint:e.rumEndpointBuilder,encoder:At()},e.replica&&{endpoint:e.replica.rumEndpointBuilder,encoder:At()},r,t,i.expireObservable);n.push(()=>a.stop());const A=o.observable.subscribe(c=>a.add(c,To(e)));n.push(()=>A.unsubscribe())}return Eo(),bo(wn(s)),{telemetry:o,stop:()=>{n.forEach(a=>a())}}}function Aa(s,e,r,t){const i=new $n,o=[];i.subscribe(1,u=>Or("logs",u));const n=na(i),a=zo(e),A=e.sessionStoreStrategyType&&!nt()&&!ts()?Fn(e,t):kn(e),{stop:c}=aa(s,e,n,a,A);o.push(()=>c()),Hn(e,i),Jn(e,i),Yn(e,i),Vn(e,i);const{handleLog:l}=ea(i);if(Wn(A,e,i,r,n),nt())ia(i);else{const{stop:u}=sa(e,i,n,a,A);o.push(()=>u())}const d=oa(A);return{handleLog:l,getInternalContext:d.get,stop:()=>{o.forEach(u=>u())}}}const pe=On(Aa);so(te(),"DD_LOGS",pe);const G=class G{constructor(e,r,t,i,o){this.copy=()=>new G(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const n=":";let a=("0"+this.h).slice(-2)+n+("0"+this.m).slice(-2)+n+("0"+this.s).slice(-2)+n+("0"+this.f).slice(-2);return a+="."+(this.field?"1":"2"),a},this.toZipTimeCodeString=()=>{const n=this.copy();return n.f=0,n.s=n.s%2===0?n.s:n.s-1,n.field=0,G.toStr(n)},this.toFrames=n=>{let a=60,A=0;Math.floor(n)==60?(a=60,A=0):Math.floor(n)==59?(a=60,A=4):Math.floor(n)==30?(a=30,A=0):Math.floor(n)==29&&(a=30,A=2);let c=this.h,l=this.m,d=this.s,u=this.f,h=this.field;const f=c*60+l,b=(f-Math.floor(f/10))*A;return c*(a*3600)+l*(a*60)+d*a+(u*2+h)-b},this.addSeconds=n=>{let a=this.copy();if(a.s+=n,a.s>=60){const A=Math.floor(a.s/60);if(a.s=a.s%60,a.m+=A,a.m>=60){const c=Math.floor(a.m/60);a.m=a.m%60,a.h+=c}}return a},this.addFrames=(n,a)=>{let A=this.toFrames(a);return A+=n,G.fromFrames(A,a)},this.subtractFrames=(n,a)=>this.addFrames(-n,a),this.h=e||0,this.m=r||0,this.s=t||0,this.f=i||0,this.field=o||0}static compare(e,r){return e.h!==r.h?e.h<r.h?-1:1:e.m!==r.m?e.m<r.m?-1:1:e.s!==r.s?e.s<r.s?-1:1:e.f!==r.f?e.f<r.f?-1:1:e.field!==r.field?e.field<r.field?-1:1:0}static generateTimecodeRange(e,r,t){const i=[];let o=e;for(;G.compare(o,r)<=0;)i.push(o),o=o.addSeconds(t);return i}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(e){return this.toFrames(e)*1e3/e}};G.calculateCurrentTimeCode=e=>{var d;if(!e.video||!e.clocker||!e.gameParams)throw new Error("OTTPlayer is not initialized");const r=e.video,t=e.clocker,i=t.videoFPScalculator.getFPS(),a=(r.currentTime-t.syncPoint.playerTime)%(60*60*24)*i+t.syncPoint.frame;if(a===0||i===0)throw new Error("Current frame is 0 or fps is 0");const A=G.calculateCurrentOffset(a,(d=e.gameParams)==null?void 0:d.offsets);if(A===void 0)throw new Error("Offset is undefined");let c=Math.floor(a-A);return c<0&&(c+=5178816),c>=5178816&&(c-=5178816),G.fromFrames(c,i)},G.calculateCurrentOffset=(e,r)=>{for(let t=1;t<r.length;t++)if(e<r[t].frame)return r[t-1].offset;return Math.abs(r[r.length-1].offset)},G.fromFrames=(e,r)=>{let t=60,i=0;Math.floor(r)==60?(t=60,i=0):Math.floor(r)==59?(t=60,i=4):Math.floor(r)==30?(t=30,i=0):Math.floor(r)==29&&(t=30,i=2);let o=Math.floor(r*60),n=Math.floor(r*60*10),a=n*6,A=e,c=Math.floor(A/a);A-=c*a;let l=Math.floor(A/n);A-=l*n,A>=t*60&&(A+=i*(Math.floor((A-t*60)/o)+1));let d=Math.floor(A/(t*60));A-=d*(t*60);let u=Math.floor(A/t);A-=u*t;let h=A;d+=l*10;let f=0;return f=h%2,h=Math.floor(h/2),new G(c,d,u,h,f)},G.toStr=e=>{const r="_";let t=("0"+e.h).slice(-2)+r+("0"+e.m).slice(-2)+r+("0"+e.s).slice(-2)+r+("0"+e.f).slice(-2);return e.field&&(t+="_1"),t},G.fromStr=e=>{const t=e.split("_").map(Number);if(t.length==4){const[i,o,n,a]=t;return new G(i,o,n,a,0)}else if(t.length==5){const[i,o,n,a,A]=t;return new G(i,o,n,a,A)}else throw new Error("Invalid timecode format: "+e)},G.fromMetadata=e=>{const r=/^(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d))?$/,t=e.timecode.match(r);if(!t)throw new Error("Invalid timecode format: "+e.timecode);const[,i,o,n,a,A]=t,c=Number(i),l=Number(o),d=Number(n),u=Number(a),h=A?Number(A):0;return new G(c,l,d,u,h)};let z=G;const T=class T{constructor(e){this.listenerMap=new Map,T.options=e,this.isLoggingOn=e.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&pe.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const r="bb_logger_mac_uuid";let t=localStorage.getItem(r);t||(t=crypto.randomUUID(),localStorage.setItem(r,t)),T.tracking.mac=t,T.tracking.dev=`${e.platform}_${e.browserName}`,T.beatHandle||(T.options&&g(T.options,"Logger")&&console.log("[Logger] Starting tracking beat"),T.beatHandle=window.setInterval(T.flushTracking,15e3))}static setMessagePort(e){this.messagePort=e}static getMessagePort(){return this.messagePort}setLoggingOn(e){this.isLoggingOn=e}addEventListener(e,r){const t=i=>r(i);this.listenerMap.set(r,{eventName:e,wrappedListener:t}),this.eventTarget.addEventListener(e,t)}removeEventListener(e,r){const t=this.listenerMap.get(r);t&&t.eventName===e&&(this.eventTarget.removeEventListener(e,t.wrappedListener),this.listenerMap.delete(r))}removeAllEventListeners(){for(const[e,{eventName:r,wrappedListener:t}]of this.listenerMap)this.eventTarget.removeEventListener(r,t);this.listenerMap.clear()}setAttributes(e){T.processAttributes(e);for(const r in e)pe.logger.setContextProperty(r,e[r])}info(e,r){e==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(r==null?void 0:r.url)||""}),e==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(r==null?void 0:r.isEnabled)??!0}),e==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",r),e==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",r),e==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",r),r&&T.processAttributes(r),this.isLoggingOn&&(pe.logger.info(e,r),T.options&&g(T.options,"Logger")&&console.log("[Logger] Sending info: ",e))}error(e,r){this.emit("mediaSessionDidError",{message:e,...r||{}}),r&&T.processAttributes(r),this.isLoggingOn&&(pe.logger.error(e,r),T.tracking.err_time=Date.now().toFixed(0),T.tracking.err_desc=e+(r?` - ${JSON.stringify(r)}`:""),T.options&&g(T.options,"Logger")&&console.log("[Logger] Sending error: ",e))}criticalError(e,r){this.emit("mediaSessionDidFailOnError",{message:e,...r||{}}),r&&T.processAttributes(r),this.isLoggingOn&&(pe.logger.error(e,r),T.tracking.err_time=Date.now().toFixed(0),T.tracking.err_desc=e+(r?` - ${JSON.stringify(r)}`:""),T.options&&g(T.options,"Logger")&&console.log("[Logger] Sending critical error: ",e))}warn(e,r){r&&T.processAttributes(r),this.isLoggingOn&&(pe.logger.warn(e,r),T.options&&g(T.options,"Logger")&&console.log("[Logger] Sending warn: ",e))}handleMessageFromWorker(e){e.actionType==="INFO"?this.info(e.message,e.attributes):e.actionType==="ERROR"?this.error(e.message,e.attributes):e.actionType==="CRITICAL_ERROR"?this.criticalError(e.message,e.attributes):e.actionType==="WARN"?this.warn(e.message,e.attributes):e.actionType==="SET_ATTRIBUTES"&&e.attributes&&this.setAttributes(e.attributes)}static setAttributes(e){if(!T.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{T.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:e})}catch(r){console.error("[Logger] Error posting message:",r)}}static info(e,r){T.messagePort.postMessage({type:"LOG",actionType:"INFO",message:e,attributes:r})}static error(e,r){T.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:e,attributes:r})}static warn(e,r){T.messagePort.postMessage({type:"LOG",actionType:"WARN",message:e,attributes:r})}static criticalError(e,r){T.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:e,attributes:r})}static processAttributes(e){if(e.player_version&&(T.tracking.sdk=e.player_version),e.media_id&&(T.tracking.gid=e.media_id),e.game_id&&(T.tracking.buc=e.game_id),e.bb_session_id&&(T.tracking.sid=e.bb_session_id,T.options&&g(T.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",T.tracking.sid)),e.last_timecode){const t=z.fromStr(e.last_timecode);T.tracking.tc=t.print(),T.lastTimecodeMillis=t.totalMilliseconds(59.94),T.lastTimecodeMillis&&T.lastZipMillis&&(T.tracking.cache=(T.lastZipMillis-T.lastTimecodeMillis).toFixed(0))}e.last_offset&&(T.tracking.off=e.last_offset),e.last_loading_zip&&(T.tracking.zip=e.last_loading_zip+".zip",T.lastZipMillis=z.fromStr(e.last_loading_zip).totalMilliseconds(59.94),T.lastTimecodeMillis&&T.lastZipMillis&&(T.tracking.cache=(T.lastZipMillis-T.lastTimecodeMillis).toFixed(0))),e.last_rendered_frame&&(T.tracking.aug_time=Date.now().toFixed(0)),e.asset&&(T.tracking.asset=e.asset)}static objectToQuery(e){return Object.entries(e).filter(([r,t])=>t!==0&&t!=="").map(([r,t])=>`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`).join("&")}emit(e,r){const t=new CustomEvent(e,{detail:r});this.eventTarget.dispatchEvent(t)}};T.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},T.lastTimecodeMillis=0,T.lastZipMillis=0,T.flushTracking=()=>{const e=Date.now().toFixed(0);T.tracking.now=e;const t=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${T.objectToQuery(T.tracking)}&platform=Web`;T.options&&g(T.options,"Logger")&&console.log("[Logger] Flushing tracking data:",t),fetch(t,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),T.tracking.err_desc="",T.tracking.err_time=""};let U=T;const la=`\nattribute vec2 a_position;\nattribute vec2 a_uv;\n\nvarying vec2 v_uv;\n\nvoid main() {\n // Flip Y coordinate to correct upside-down rendering\n v_uv = vec2(a_uv.x, 1.0 - a_uv.y);\n gl_Position = vec4(a_position * 2.0 - 1.0, 0.0, 1.0);\n}\n`,ca=`\nprecision mediump float;\n\nuniform sampler2D u_videoTexture;\nvarying vec2 v_uv;\n\nvoid main() {\n gl_FragColor = texture2D(u_videoTexture, v_uv);\n}\n`,da=`\nprecision highp float;\n\nattribute vec2 a_position; // pixel coords, 6 verts / quad\nattribute vec4 a_uv; // atlas UV (min_u, min_v, max_u, max_v)\nattribute mat3 a_transform; // transformation matrix for this vertex\n\nuniform vec2 u_resolution; // full frame size\n\nvarying vec2 v_maskUV; // for alpha mask\nvarying vec4 v_adUV; // atlas UV bounds\nvarying mat3 v_transform; // pass transform to fragment shader\n\nvoid main () {\n vec2 clipSpace = 2.0 * (a_position / u_resolution) - 1.0;\n gl_Position = vec4(clipSpace * vec2(1.0,-1.0), 0.0, 1.0);\n\n v_adUV = a_uv; // Pass through all 4 UV coordinates\n v_maskUV = a_position / u_resolution;\n v_transform = a_transform;\n}\n`,ua=`\nprecision highp float;\n\nuniform sampler2D u_atlas; // packed logos\nuniform sampler2D u_alphaMask; // full-frame mask (changes every video frame)\nuniform float u_opacity;\nuniform float u_aaStrength; // AA strength multiplier (1.0 = auto, >1.0 = softer, <1.0 = sharper)\nuniform float u_useAlphaMask; // 1.0 = apply alpha mask, 0.0 = bypass (e.g. player circles)\nuniform vec4 u_tintColor; // rgb = tint, a = mix factor (0.0 = use texture, 1.0 = use tint)\nuniform vec2 u_resolution; // processing size (placeholders space)\nuniform vec2 u_canvasResolution; // actual canvas size (gl_FragCoord space)\n\nvarying vec4 v_adUV; // min_u, min_v, max_u, max_v\nvarying vec2 v_maskUV;\nvarying mat3 v_transform; // transformation matrix for this fragment\n\nvec2 transformPoint(vec2 point) {\n float x = (v_transform[0][0] * point.x + v_transform[0][1] * point.y + v_transform[0][2]) / \n (v_transform[2][0] * point.x + v_transform[2][1] * point.y + 1.0);\n float y = (v_transform[1][0] * point.x + v_transform[1][1] * point.y + v_transform[1][2]) / \n (v_transform[2][0] * point.x + v_transform[2][1] * point.y + 1.0);\n return vec2(x, y) / u_resolution;\n}\n\nvoid main () {\n // Convert current fragment coord (canvas space) to processing space\n vec2 curCanvas = vec2(gl_FragCoord.x, u_canvasResolution.y - gl_FragCoord.y);\n vec2 scale = vec2(u_resolution.x / u_canvasResolution.x, u_resolution.y / u_canvasResolution.y);\n vec2 curProcessing = curCanvas * scale;\n \n // Transform the current position using the transformation matrix\n vec2 transformedUV = transformPoint(curProcessing);\n \n // Logo bounds in normalized space (texel-center coordinates)\n float left = -0.5 / u_resolution.x;\n float right = 1.0 + 0.5 / u_resolution.x;\n float top = -0.5 / u_resolution.y;\n float bottom = 1.0 + 0.5 / u_resolution.y;\n \n // Hard discard well outside bounds to avoid artifacts\n if(transformedUV.x < left - 0.01 || transformedUV.x > right + 0.01 || \n transformedUV.y < top - 0.01 || transformedUV.y > bottom + 0.01) {\n discard;\n }\n \n // --- Analytic antialiasing: calculate screen-space derivatives ---\n // Extract transform components\n float M00 = v_transform[0][0], M01 = v_transform[0][1], M02 = v_transform[0][2];\n float M10 = v_transform[1][0], M11 = v_transform[1][1], M12 = v_transform[1][2];\n float M20 = v_transform[2][0], M21 = v_transform[2][1];\n \n float w = M20 * curProcessing.x + M21 * curProcessing.y + 1.0;\n float invw = 1.0 / max(abs(w), 1e-6);\n float invw2 = invw * invw;\n \n float nx = M00 * curProcessing.x + M01 * curProcessing.y + M02;\n float ny = M10 * curProcessing.x + M11 * curProcessing.y + M12;\n \n // Derivatives of transformed coordinates w.r.t. screen space\n float dtx_dx = (M00 * w - nx * M20) * invw2 / u_resolution.x;\n float dtx_dy = (M01 * w - nx * M21) * invw2 / u_resolution.y;\n float dty_dx = (M10 * w - ny * M20) * invw2 / u_resolution.x;\n float dty_dy = (M11 * w - ny * M21) * invw2 / u_resolution.y;\n \n // Approximate fwidth (how much logo-space coords change per screen pixel)\n float dxAA = abs(dtx_dx) + abs(dtx_dy);\n float dyAA = abs(dty_dx) + abs(dty_dy);\n \n // Apply AA strength multiplier\n float aaStrength = max(u_aaStrength, 0.1);\n dxAA *= aaStrength;\n dyAA *= aaStrength;\n \n // Distance to each edge in logo-normalized space\n float distLeft = transformedUV.x - 0.0;\n float distRight = 1.0 - transformedUV.x;\n float distTop = transformedUV.y - 0.0;\n float distBottom = 1.0 - transformedUV.y;\n \n // Coverage based on distance to edges (antialiasing on all 4 edges)\n float covX = min(smoothstep(0.0, dxAA, distLeft), smoothstep(0.0, dxAA, distRight));\n float covY = min(smoothstep(0.0, dyAA, distTop), smoothstep(0.0, dyAA, distBottom));\n float coverage = min(covX, covY);\n \n // Clamp UV to valid range for sampling\n vec2 clampedUV = clamp(transformedUV, 0.0, 1.0);\n \n // Map the clamped coordinate to the atlas region\n vec2 atlasUV = mix(vec2(v_adUV.x, v_adUV.y), // min_u, min_v\n vec2(v_adUV.z, v_adUV.w), // max_u, max_v\n clampedUV); // interpolation factor\n \n float rawMask = texture2D(u_alphaMask, v_maskUV).r;\n float mask = mix(1.0, rawMask, u_useAlphaMask);\n vec4 ad = texture2D(u_atlas, atlasUV);\n vec3 finalRGB = mix(ad.rgb, u_tintColor.rgb, u_tintColor.a);\n\n // Apply coverage-based antialiasing to alpha\n float a = ad.a * mask * u_opacity * coverage;\n gl_FragColor = vec4(finalRGB * a, a);\n}\n`,fa=`\nattribute vec2 a_position; // 0..1 full-screen quad\nattribute vec2 a_uv; // 0..1\n\nvarying vec2 v_uv;\n\nvoid main() {\n v_uv = a_uv;\n gl_Position = vec4(a_position * 2.0 - 1.0, 0.0, 1.0);\n}\n`,ha=`\nprecision mediump float;\n\nuniform sampler2D u_overlay; // LED overlay texture (padded FBO)\nuniform sampler2D u_alphaMask; // same alpha mask as legacy augmentation\nuniform vec4 u_uvRect; // crop rect in overlay UVs (u0,v0,u1,v1)\nuniform vec2 u_resolution; // main canvas size (processing size)\n\nvarying vec2 v_uv; // 0..1 across main canvas\n\nvoid main() {\n // Sample overlay with cropped UVs\n vec2 uv = mix(u_uvRect.xy, u_uvRect.zw, v_uv);\n vec4 overlay = texture2D(u_overlay, uv);\n\n // Sample alpha mask using main-canvas coords (flip Y to match augmentation)\n vec2 maskUV = vec2(gl_FragCoord.x / u_resolution.x, 1.0 - (gl_FragCoord.y / u_resolution.y));\n float mask = texture2D(u_alphaMask, maskUV).r;\n\n // Simple composite with mask\n gl_FragColor = vec4(overlay.rgb, overlay.a * mask);\n}\n`,ga=`\nattribute vec2 aPos;\nvarying vec2 vUV;\nuniform vec4 uUVRect; // (u0,v0,u1,v1)\nvoid main(){\n vUV = mix(uUVRect.xy, uUVRect.zw, (aPos*0.5)+0.5);\n gl_Position = vec4(aPos,0.0,1.0);\n}`,ma=`\nprecision highp float;\nuniform sampler2D uTex;\nvarying vec2 vUV;\nvoid main(){ gl_FragColor = texture2D(uTex, vUV); }`,pa=`\nprecision highp float;\nattribute float aCornerIndex; // 0=TL,1=TR,2=BR,3=BL\nattribute vec2 aDstTL;\nattribute vec2 aDstTR;\nattribute vec2 aDstBR;\nattribute vec2 aDstBL;\nattribute vec3 aH0; // Hinv rows (screen -> slice)\nattribute vec3 aH1;\nattribute vec3 aH2;\nattribute float aU0; // normalized u0\nattribute float aSliceW; // slice width in pixels\n\nuniform vec2 uResolution; // target surface size in pixels\nuniform vec2 uShift; // pixel shift BEFORE normalization (see Pass A note)\nuniform bool uFlipY; // true for top-left pixel coords\n\nvarying vec3 vH0; varying vec3 vH1; varying vec3 vH2;\nvarying float vU0; varying float vSliceW;\n\nvec2 pick2(vec2 tl, vec2 tr, vec2 br, vec2 bl, float i){\n if (i < 0.5) return tl;\n if (i < 1.5) return tr;\n if (i < 2.5) return br;\n return bl;\n}\nvec2 toNDC(vec2 p){\n float xN = (p.x + uShift.x) / uResolution.x;\n float yN = (p.y + uShift.y) / uResolution.y;\n if (uFlipY) yN = 1.0 - yN;\n return vec2(xN, yN) * 2.0 - 1.0;\n}\nvoid main(){\n vec2 dst = pick2(aDstTL, aDstTR, aDstBR, aDstBL, aCornerIndex);\n gl_Position = vec4(toNDC(dst), 0.0, 1.0);\n vH0=aH0; vH1=aH1; vH2=aH2; vU0=aU0; vSliceW=aSliceW;\n}`,Ea=`\nprecision highp float;\nuniform sampler2D uArt;\nuniform vec2 uResolution; // same as VS\nuniform vec2 uArtSize; // (artW, artH)\nuniform float uEdgeFeatherPx; // AA strength multiplier (1.0 = auto, >1.0 = softer, <1.0 = sharper)\nvarying vec3 vH0; varying vec3 vH1; varying vec3 vH2;\nvarying float vU0; varying float vSliceW;\nvoid main(){\n // gl_FragCoord is bottom-left; convert to top-left pixels with uResolution.y - y\n vec2 scr = vec2(gl_FragCoord.x, uResolution.y - gl_FragCoord.y);\n float wx = dot(vH0, vec3(scr, 1.0));\n float wy = dot(vH1, vec3(scr, 1.0));\n float w = dot(vH2, vec3(scr, 1.0));\n if (abs(w) < 1e-6) discard;\n float invw = 1.0 / w;\n float sx = wx * invw;\n float sy = wy * invw;\n\n // slice window in texel-center space\n float left = -0.5;\n float right = vSliceW - 0.5;\n float top = -0.5;\n float bottom = uArtSize.y - 0.5;\n\n // --- analytic "fwidth" approximation (per 1 screen pixel) ---\n float dsx_dx = (vH0.x * w - wx * vH2.x) * (invw * invw);\n float dsx_dy = (vH0.y * w - wx * vH2.y) * (invw * invw);\n float dsy_dx = (vH1.x * w - wy * vH2.x) * (invw * invw);\n float dsy_dy = (vH1.y * w - wy * vH2.y) * (invw * invw);\n\n // like fwidth: |d/dx| + |d/dy|\n float dxAA = abs(dsx_dx) + abs(dsx_dy);\n float dyAA = abs(dsy_dx) + abs(dsy_dy);\n\n // Apply AA strength multiplier\n float aaStrength = max(uEdgeFeatherPx, 0.1);\n dyAA *= aaStrength;\n dxAA *= aaStrength;\n\n // distance to nearest border in slice-space\n float distX = min(sx - left, right - sx);\n float distY = min(sy - top, bottom - sy);\n\n // coverage over ~1 screen pixel\n //float covX = clamp(distX / max(dxAA, 1e-6), 0.0, 1.0);\n //float covY = clamp(distY / max(dyAA, 1e-6), 0.0, 1.0);\n // softer rolloff, use smoothstep instead:\n float covY = smoothstep(0.0, dyAA, distY);\n //float coverage = min(covX, covY);\n float coverage = covY;\n\n // sample inside the slice (center-sample + clamp to avoid holes)\n float sxc = clamp(sx, left, right);\n float syc = clamp(sy, top, bottom);\n float u = vU0 + (sxc + 0.5) / uArtSize.x;\n float v = (syc + 0.5) / uArtSize.y;\n\n vec2 texel = 1.0 / uArtSize;\n float sigX = 0.0;//max(uBlurPxX, 0.0);\n float sigY = 0.0;//max(uBlurPxY, 0.0);\n vec4 tex;\n\n if (sigX == 0.0 && sigY == 0.0) {\n // no blur\n tex = texture2D(uArt, vec2(fract(u), clamp(v, 0.0, 1.0)));\n }\n else if (sigY == 0.0) {\n // ---- horizontal Gaussian blur (fast) ----\n const int MAX_R = 8; // up to 17 taps\n int r = int(min(floor(3.0 * sigX + 0.5), float(MAX_R)));\n\n vec3 accumRGBp = vec3(0.0); // premultiplied RGB\n float accumA = 0.0;\n float wsum = 0.0;\n\n for (int k = -MAX_R; k <= MAX_R; ++k) {\n float fk = float(k);\n // mask: 1.0 when |k| <= r (no abs(int)!)\n float m = step(abs(fk), float(r) + 0.5);\n\n // Gaussian weight (guard sigma)\n float wG = exp(-0.5 * (fk*fk) / max(sigX*sigX, 1e-6));\n\n float uTap = fract(u + fk * texel.x); // wrap X\n vec4 s = texture2D(uArt, vec2(uTap, clamp(v, 0.0, 1.0)));\n\n float wM = wG * m;\n accumRGBp += wM * (s.rgb * s.a);\n accumA += wM * s.a;\n wsum += wM;\n }\n vec3 rgb = (accumA > 1e-6) ? (accumRGBp / accumA) : vec3(0.0);\n float a = accumA / max(wsum, 1e-6);\n tex = vec4(rgb, a);\n }\n else if (sigX == 0.0) {\n // ---- vertical-only blur ----\n const int MAX_RY = 8;\n int ry = int(min(floor(3.0 * sigY + 0.5), float(MAX_RY)));\n\n vec3 accumRGBp = vec3(0.0);\n float accumA = 0.0;\n float wsum = 0.0;\n\n for (int j = -MAX_RY; j <= MAX_RY; ++j) {\n float fj = float(j);\n float m = step(abs(fj), float(ry) + 0.5);\n float wG = exp(-0.5 * (fj*fj) / max(sigY*sigY, 1e-6));\n\n float vTap = clamp(v + fj * texel.y, 0.0, 1.0); // clamp Y\n vec4 s = texture2D(uArt, vec2(fract(u), vTap));\n\n float wM = wG * m;\n accumRGBp += wM * (s.rgb * s.a);\n accumA += wM * s.a;\n wsum += wM;\n }\n vec3 rgb = (accumA > 1e-6) ? (accumRGBp / accumA) : vec3(0.0);\n float a = accumA / max(wsum, 1e-6);\n tex = vec4(rgb, a);\n }\n else {\n // ---- small 2D Gaussian (separable would also work) ----\n const int MAX_RX = 4, MAX_RY = 4; // up to 9x9 taps\n int rx = int(min(floor(3.0 * sigX + 0.5), float(MAX_RX)));\n int ry = int(min(floor(3.0 * sigY + 0.5), float(MAX_RY)));\n\n vec3 accumRGBp = vec3(0.0);\n float accumA = 0.0;\n float wsum = 0.0;\n\n for (int j = -MAX_RY; j <= MAX_RY; ++j) {\n float fj = float(j);\n float my = step(abs(fj), float(ry) + 0.5);\n for (int i = -MAX_RX; i <= MAX_RX; ++i) {\n float fi = float(i);\n float mx = step(abs(fi), float(rx) + 0.5);\n\n float wG = exp(-0.5*(fi*fi)/max(sigX*sigX,1e-6)\n -0.5*(fj*fj)/max(sigY*sigY,1e-6));\n float uTap = fract(u + fi * texel.x); // wrap X\n float vTap = clamp(v + fj * texel.y, 0.0, 1.0); // clamp Y\n vec4 s = texture2D(uArt, vec2(uTap, vTap));\n\n float wM = wG * mx * my;\n accumRGBp += wM * (s.rgb * s.a);\n accumA += wM * s.a;\n wsum += wM;\n }\n }\n vec3 rgb = (accumA > 1e-6) ? (accumRGBp / accumA) : vec3(0.0);\n float a = accumA / max(wsum, 1e-6);\n tex = vec4(rgb, a);\n }\n\n // keep your current vertical AA:\n gl_FragColor = vec4(tex.rgb, tex.a * coverage);\n \n}`,qt=`\nattribute vec2 aPos;\nvarying vec2 vUV;\nvoid main(){\n vUV = (aPos + 1.0) * 0.5; // Convert from [-1,1] to [0,1]\n gl_Position = vec4(aPos, 0.0, 1.0);\n}`,Jt=`\nprecision mediump float;\nuniform sampler2D uFBOTex;\nvarying vec2 vUV;\nvoid main(){\n gl_FragColor = texture2D(uFBOTex, vUV);\n}`;function Ta(s,e,r){let t=0,i=0;for(const o of Object.values(s)){const n=o.corners,a=Math.abs(ns(n));if(!a)continue;const A=ba(n,e,r),c=A.length>=3?Math.abs(ns(A)):0;t+=c,i+=a}return{percentOfAd:i?t/i*100:0,percentOfScreen:t/(e*r)*100}}function ns(s){let e=0;for(let r=0,t=s.length-1;r<s.length;t=r++)e+=s[t].x*s[r].y-s[r].x*s[t].y;return e*.5}function ba(s,e,r){const t=[{inside:o=>o.x>=0,inter:(o,n)=>({x:0,y:o.y+(n.y-o.y)*(0-o.x)/(n.x-o.x)})},{inside:o=>o.x<=e,inter:(o,n)=>({x:e,y:o.y+(n.y-o.y)*(e-o.x)/(n.x-o.x)})},{inside:o=>o.y>=0,inter:(o,n)=>({x:o.x+(n.x-o.x)*(0-o.y)/(n.y-o.y),y:0})},{inside:o=>o.y<=r,inter:(o,n)=>({x:o.x+(n.x-o.x)*(r-o.y)/(n.y-o.y),y:r})}];let i=s;for(const o of t){const n=i;if(i=[],!n.length)break;let a=n[n.length-1];for(const A of n){const c=o.inside(A),l=o.inside(a);c?(l||i.push(o.inter(a,A)),i.push(A)):l&&i.push(o.inter(a,A)),a=A}}return i}var Ra="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhYAAAIWCAYAAA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Jw+fZLsBwBkDAEIAOC+1AOioCGXGzHDwwfvAxkYCMzIyLANZLTkcGZmmuADADKIAAQAcF8rK8uBMiAuEHG9IJpktddARP87P3JXu0XUgK4JWwCAbCIAAQA8kAIHF4S43SD7KcXypVf6Z7jJV2UmXwFAhhGAAAAe6OLFC4ECD1eKpZG8+5uI5UbvFm3woQzI1NRpyq8AIKOYggUA2BMFDuvrLdNoNMzm5qbZ2trc00QslV8pc6LsR61WsxcAILvIgAAA9uSjjy4FvhRrL4sJ/dZz7f1QAKIARsEH2Q8AyDYCEADAninwUEChS2VYCjDuF4CoV0T/W02+0v+tAhgAQLYRgAAA9qxzGpb6QZQFudtELP09BR8KOpT50P+drg8+eI/sBwBkHAEIAGDP5ufnAjWTu0Akf9+JWG7ylRrPK7b5XBcAAAQgAIB9UfbDlVTld0qxhu4ZgPjeDwUiMzNnyH4AAAhAAAD7s7i4YBcT6lIwoiDkzl4QBSUq0dLCwUqlbKrVamSfFwAQL4zhBQDsm7IarVbTBiHr6+tmY2PDjuQNQ/V/BLY0y2U/inb87vT0h2Q/AAAWGRAAwL4puMjncztTsYZtxkO9IAo+9Gs/KcsFIvmoPy4AIEYIQAAA+zY9PbVThuWmYSnQGB52QYf+2jWpu/+/qakpsh8AgDZKsAAABzI6Om4ajaZZW2uYZrO1U4IV2sBDE6/U/6ELAIBOZEAAAAfy3nu/CNQLolIslWFp6pUmYykAcVfezM2dI/sBALhNoNMqAAAO6oknngyvXLls1tbWbB+Itp1r6tVvf/sbgg8AwJcQgAAADu3RRx8LNRVLAYg2pf/6178i+AAA3BUBCAAAAIC+oQcEAAAAQN8QgAAAAADoGwIQAAAAAH1DAAIAAACgbwhAAAAAAPQNAQgAAACAviEAAQAAANA3BCAAAAAA+oYABAAAAIDpl/8f5YhO5tQcp94AAAAASUVORK5CYII=";const ya=80,Da=30,Ia=50,Sa=6,Ee=[1,.7,.09];function Ca(s,e,r){const t=s.x*r.width,i=s.y*r.height;let o=null,n=1/0;for(const a of e){const A=a.locs.centroid2D.x,c=a.locs.centroid2D.y,l=t-A,d=i-c,u=Math.sqrt(l*l+d*d);u<=ya&&u<n&&(n=u,o=a)}return o}class as{constructor(e,r){this.playerTexturesLoaded=!1,this.logoToRegion=new Map,this.atlasDirty=!1,this.nextX=0,this.nextY=0,this.rowH=0,this.INITIAL_ATLAS_SIZE=256,this.ATLAS_SIZE=this.INITIAL_ATLAS_SIZE,this.ATLAS_PADDING=4,this.ledOverlayW=0,this.ledOverlayH=0,this.LED_PADDING=100,this.LED_AA_STRENGTH=1,this.LOGO_AA_STRENGTH=1,this.ledArtW=0,this.ledArtH=0,this.ledCubes=[],this.queryInFlight=!1,this.GPUFrameTimeCount=0,this.GPUFrameTimeSum=0,this.avgGPUFrameTime=0,this.CPUFrameTimeCount=0,this.CPUFrameTimeSum=0,this.avgCPUFrameTime=0,this.timestampW=0,this.timestampH=0,this.lastPlayerNameString="",this.playerNameW=0,this.playerNameH=0,this.compileShader=(t,i)=>{const o=this.gl,n=o.createShader(t);return o.shaderSource(n,i),o.compileShader(n),o.getShaderParameter(n,o.COMPILE_STATUS)?n:(g(this.options,"Errors")&&console.error(`Error compiling shader: ${o.getShaderInfoLog(n)}`),o.deleteShader(n),null)},this.createTextureFromImageBitmap=t=>{const i=this.gl,o=i.createTexture();return i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),o},this.drawVideoFrameBase=t=>{const i=this.gl;if(!this.videoProgram||this.videoAPos===void 0||this.videoAUv===void 0||!this.uVideoTexture){g(this.options,"Errors")&&console.error("[WebGL] Video program not initialized");return}i.useProgram(this.videoProgram),i.viewport(0,0,i.canvas.width,i.canvas.height),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t),i.uniform1i(this.uVideoTexture,0),i.bindBuffer(i.ARRAY_BUFFER,this.fsPosBuf),i.enableVertexAttribArray(this.videoAPos),i.vertexAttribPointer(this.videoAPos,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this.fsUvBuf),i.enableVertexAttribArray(this.videoAUv),i.vertexAttribPointer(this.videoAUv,2,i.FLOAT,!1,0,0),i.clearColor(0,0,0,1),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLES,0,6),this.program&&i.useProgram(this.program)},this.updateTextureFromImageBitmap=(t,i)=>{const o=this.gl;o.bindTexture(o.TEXTURE_2D,t),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,i)},this.deleteTexture=t=>{this.gl.deleteTexture(t)},this.options=r,this.renderer=e,this.gl=e.glContext,this.initTiming()}init(){this.initAtlas(),this.initBuffers(),this.initPrograms(),this.loadPlayerTextures(),this.options.RENDER_LED&&(this.instancedExt=this.gl.getExtension("ANGLE_instanced_arrays"),this.instancedExt||g(this.options,"Errors")&&console.error("ANGLE_instanced_arrays extension not available"))}resolveAssetUrl(e){if(!e.startsWith("/"))return e;try{const r=self.location.href;if(r.startsWith("blob:")){const t=new URL(r.slice(5)).origin;if(t&&t!=="null")return t+e}}catch{}return e}async fetchTexture(e){const r=await fetch(this.resolveAssetUrl(e));if(!r.ok)throw new Error(`HTTP ${r.status}`);const t=await r.blob(),i=await createImageBitmap(t),o=this.gl,n=o.createTexture();return o.bindTexture(o.TEXTURE_2D,n),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),i.close(),n}async loadPlayerTextures(){try{const[e,r]=await Promise.all([this.fetchTexture(Ra),this.fetchTexture(va)]);this.playerCircleTex=e,this.playerArrowTex=r,this.playerTexturesLoaded=!0,g(this.options,"Renderer")&&console.log("[WebGL] Player overlay textures loaded")}catch(e){g(this.options,"Errors")&&console.error("[WebGL] Failed to load player overlay textures:",e)}}drawPlayerOverlay(e,r,t,i){var l,d,u;if(!this.playerTexturesLoaded||!this.playerCircleTex||!this.program||this.aPos===void 0||this.aUv===void 0||this.aTransform===void 0||!this.uRes||!this.uOpacity||!this.uAtlas||!this.uAlphaMask||!this.uUseAlphaMask)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,null),o.viewport(0,0,o.canvas.width,o.canvas.height),o.useProgram(this.program);const n=i&&!!e;o.uniform2f(this.uRes,t.width,t.height),this.uCanvasRes&&o.uniform2f(this.uCanvasRes,o.canvas.width,o.canvas.height),o.uniform1f(this.uOpacity,1),this.uAAStrength&&o.uniform1f(this.uAAStrength,this.LOGO_AA_STRENGTH),o.uniform1f(this.uUseAlphaMask,n?1:0),this.uTintColor&&o.uniform4f(this.uTintColor,Ee[0],Ee[1],Ee[2],1),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,e??null),o.uniform1i(this.uAlphaMask,0),o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this.playerCircleTex),o.uniform1i(this.uAtlas,1);const a=r.circle,A=a.corners;this.uploadQuadAndDraw(new Float32Array([A[0].x,A[0].y,A[1].x,A[1].y,A[2].x,A[2].y,A[0].x,A[0].y,A[2].x,A[2].y,A[3].x,A[3].y]),a.tranform,o);const c=(l=r.locs)==null?void 0:l.head2D;if(c){const h=Da,f=c.y-Ia-h,m=t.width,b=t.height,S=((u=(d=r.player)==null?void 0:d.shortName)==null?void 0:u.trim())??"";if(S&&this.ensurePlayerNameTexture(S)){o.uniform1f(this.uUseAlphaMask,0),this.uTintColor&&o.uniform4f(this.uTintColor,0,0,0,0),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this.playerNameTex),o.uniform1i(this.uAtlas,1);const p=this.playerNameW,y=this.playerNameH,R=f-Sa,C=R-y,P=c.x-p/2,E=c.x+p/2,w=new Float32Array([P,C,E,C,E,R,P,C,E,R,P,R]),B=[m/p,0,-P*m/p,0,b/y,-C*b/y,0,0,1];this.uploadQuadAndDraw(w,B,o),this.uTintColor&&o.uniform4f(this.uTintColor,Ee[0],Ee[1],Ee[2],1)}if(this.playerArrowTex){o.uniform1f(this.uUseAlphaMask,0),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this.playerArrowTex),o.uniform1i(this.uAtlas,1);const p=c.x-h/2,y=f,R=p+h,C=y+h,P=new Float32Array([p,y,R,y,R,C,p,y,R,C,p,C]),E=[m/h,0,-p*m/h,0,b/h,-y*b/h,0,0,1];this.uploadQuadAndDraw(P,E,o)}}o.uniform1f(this.uUseAlphaMask,1),this.uTintColor&&o.uniform4f(this.uTintColor,0,0,0,0)}ensurePlayerNameTexture(e){if(!e)return this.lastPlayerNameString="",this.playerNameW=0,this.playerNameH=0,!1;try{const r=this.gl,t=16,i=6,o=4,n=200,a=`800 ${t}px system-ui, -apple-system, "Segoe UI", sans-serif`,A=1.5;if(this.lastPlayerNameString!==e){const l=new OffscreenCanvas(1,1).getContext("2d");l.font=a,l.letterSpacing=`${A}px`;let d=e;if(l.measureText(d).width>n){const R="...";for(;d.length>1&&l.measureText(d+R).width>n;)d=d.slice(0,-1);d+=R}const u=Math.ceil(l.measureText(d).width),h=Math.max(2,Math.ceil(u+i*2)),f=Math.max(2,Math.ceil(t+o*2));this.playerNameCanvas=new OffscreenCanvas(h,f),this.playerNameCtx=this.playerNameCanvas.getContext("2d");const m=this.playerNameCtx;m.clearRect(0,0,h,f),m.font=a,m.letterSpacing=`${A}px`,m.textAlign="center",m.textBaseline="middle";const[b,S,p]=Ee,y=`rgb(${Math.round(b*255)},${Math.round(S*255)},${Math.round(p*255)})`;m.lineJoin="round",m.lineWidth=1.75,m.strokeStyle=y,m.strokeText(d,h/2,f/2),m.fillStyle=y,m.fillText(d,h/2,f/2),this.playerNameTex||(this.playerNameTex=r.createTexture()),r.bindTexture(r.TEXTURE_2D,this.playerNameTex),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,this.playerNameCanvas),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),this.lastPlayerNameString=e,this.playerNameW=h,this.playerNameH=f}return this.playerNameW>0&&this.playerNameH>0}catch(r){return g(this.options,"Errors")&&console.error("[WebGL] ensurePlayerNameTexture failed",r),!1}}uploadQuadAndDraw(e,r,t){const i=new Float32Array(24);for(let a=0;a<6;a++)i[a*4+2]=1,i[a*4+3]=1;const o=new Float32Array(6*9);for(let a=0;a<6;a++)o.set(r,a*9);t.bindBuffer(t.ARRAY_BUFFER,this.posBuf),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW),t.enableVertexAttribArray(this.aPos),t.vertexAttribPointer(this.aPos,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuf),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW),t.enableVertexAttribArray(this.aUv),t.vertexAttribPointer(this.aUv,4,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.transformBuf),t.bufferData(t.ARRAY_BUFFER,o,t.DYNAMIC_DRAW);const n=9*4;for(let a=0;a<3;a++){const A=this.aTransform+a;t.enableVertexAttribArray(A),t.vertexAttribPointer(A,3,t.FLOAT,!1,n,a*3*4)}t.drawArrays(t.TRIANGLES,0,6)}initPrograms(){const e=this.gl;if(this.program=this.linkProgram(da,ua),this.aPos=e.getAttribLocation(this.program,"a_position"),this.aUv=e.getAttribLocation(this.program,"a_uv"),this.aTransform=e.getAttribLocation(this.program,"a_transform"),this.uRes=e.getUniformLocation(this.program,"u_resolution"),this.uCanvasRes=e.getUniformLocation(this.program,"u_canvasResolution"),this.uOpacity=e.getUniformLocation(this.program,"u_opacity"),this.uAAStrength=e.getUniformLocation(this.program,"u_aaStrength"),this.uUseAlphaMask=e.getUniformLocation(this.program,"u_useAlphaMask"),this.uTintColor=e.getUniformLocation(this.program,"u_tintColor"),this.uAtlas=e.getUniformLocation(this.program,"u_atlas"),this.uAlphaMask=e.getUniformLocation(this.program,"u_alphaMask"),this.options.BURNED_TIMECODES_MODE&&(this.videoProgram=this.linkProgram(la,ca),this.videoAPos=e.getAttribLocation(this.videoProgram,"a_position"),this.videoAUv=e.getAttribLocation(this.videoProgram,"a_uv"),this.uVideoTexture=e.getUniformLocation(this.videoProgram,"u_videoTexture")),this.options.RENDER_LED){if(this.blitProgram=this.linkProgram(ga,ma),!this.blitProgram){g(this.options,"Errors")&&console.error("[WebGL] Failed to create blit program");return}this.blit_aPos=e.getAttribLocation(this.blitProgram,"aPos"),this.cubesProgram=this.linkProgram(pa,Ea),this.cubes_uEdgeFeatherPx=e.getUniformLocation(this.cubesProgram,"uEdgeFeatherPx")||void 0,this.fboCompositeProgram=this.linkProgram(qt,Jt),this.fboComposite_aPos=e.getAttribLocation(this.fboCompositeProgram,"aPos"),this.fboComposite_uFBOTex=e.getUniformLocation(this.fboCompositeProgram,"uFBOTex"),this.ledCompositeProgram=this.linkProgram(fa,ha),this.comp_aPos=e.getAttribLocation(this.ledCompositeProgram,"a_position"),this.comp_aUv=e.getAttribLocation(this.ledCompositeProgram,"a_uv"),this.comp_uOverlay=e.getUniformLocation(this.ledCompositeProgram,"u_overlay"),this.comp_uAlphaMask=e.getUniformLocation(this.ledCompositeProgram,"u_alphaMask"),this.comp_uUVRect=e.getUniformLocation(this.ledCompositeProgram,"u_uvRect"),this.comp_uRes=e.getUniformLocation(this.ledCompositeProgram,"u_resolution")}}linkProgram(e,r){const t=this.gl,i=this.compileShader(t.VERTEX_SHADER,e),o=this.compileShader(t.FRAGMENT_SHADER,r),n=t.createProgram();if(t.attachShader(n,i),t.attachShader(n,o),t.linkProgram(n),!t.getProgramParameter(n,t.LINK_STATUS)){const a=t.getProgramInfoLog(n);throw g(this.options,"Errors")&&console.error("WebGL link error: "+a),new Error("WebGL link error: "+a)}if(!t.getProgramParameter(n,t.LINK_STATUS)){const a=t.getProgramInfoLog(n);throw new Error("WebGL link error: "+a)}return n}drawAugmentation(e,r,t,i=1,o=!0,n){var f;const a=performance.now();this.syncAtlasGL();const{pos:A,uv:c,transforms:l,vertCount:d}=this.buildQuadData(r);if(o){const m=this.gl;m.bindFramebuffer(m.FRAMEBUFFER,null),m.viewport(0,0,m.canvas.width,m.canvas.height),m.clearColor(0,0,0,0),m.clear(m.COLOR_BUFFER_BIT)}if(!d)return;if(!this.program||this.aPos===void 0||this.aUv===void 0||this.aTransform===void 0||!this.uRes||!this.uOpacity||!this.uAtlas||!this.uAlphaMask){g(this.options,"Errors")&&console.error("[Renderer] Program or attributes not initialized");return}const u=this.gl;u.bindFramebuffer(u.FRAMEBUFFER,null),u.viewport(0,0,u.canvas.width,u.canvas.height),u.useProgram(this.program),u.uniform2f(this.uRes,t.width,t.height),this.uCanvasRes&&u.uniform2f(this.uCanvasRes,u.canvas.width,u.canvas.height),u.uniform1f(this.uOpacity,i),this.uAAStrength&&u.uniform1f(this.uAAStrength,this.LOGO_AA_STRENGTH),this.uUseAlphaMask&&u.uniform1f(this.uUseAlphaMask,1),this.uTintColor&&u.uniform4f(this.uTintColor,0,0,0,0),u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,e),u.uniform1i(this.uAlphaMask,0),u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,this.atlasTex),u.uniform1i(this.uAtlas,1),u.bindBuffer(u.ARRAY_BUFFER,this.posBuf),u.bufferData(u.ARRAY_BUFFER,A,u.DYNAMIC_DRAW),u.enableVertexAttribArray(this.aPos),u.vertexAttribPointer(this.aPos,2,u.FLOAT,!1,0,0),u.bindBuffer(u.ARRAY_BUFFER,this.uvBuf),u.bufferData(u.ARRAY_BUFFER,c,u.DYNAMIC_DRAW),u.enableVertexAttribArray(this.aUv),u.vertexAttribPointer(this.aUv,4,u.FLOAT,!1,0,0),u.bindBuffer(u.ARRAY_BUFFER,this.transformBuf),u.bufferData(u.ARRAY_BUFFER,l,u.DYNAMIC_DRAW);const h=9*4;for(let m=0;m<3;m++){const b=this.aTransform+m;u.enableVertexAttribArray(b),u.vertexAttribPointer(b,3,u.FLOAT,!1,h,m*3*4)}if(u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),this.beginTimer(),u.drawArrays(u.TRIANGLES,0,d),this.endTimer(),this.measureLogoVisibility(r),this.options.DRAW_TIMESTAMP_WEBGL&&n&&this.drawTimestampOnCanvas(n),(f=this.options.debug)!=null&&f.trackPerformance){const b=performance.now()-a;this.CPUFrameTimeCount++,this.CPUFrameTimeSum+=b,this.avgCPUFrameTime=this.CPUFrameTimeSum/this.CPUFrameTimeCount}}ensureTimestampTexture(e){try{const r=this.gl,t=18,i=8,o=6;if(!this.timestampCanvas||this.lastTimestampString!==e){const a=new OffscreenCanvas(1,1).getContext("2d");a.font=`${t}px monospace`;const A=a.measureText(e),c=Math.ceil(A.width+i*2)|0,l=Math.ceil(t+o*2)|0;this.timestampCanvas=new OffscreenCanvas(c,l),this.timestampCtx=this.timestampCanvas.getContext("2d"),this.timestampW=c,this.timestampH=l;const d=this.timestampCtx;d.clearRect(0,0,c,l),d.fillStyle="rgba(0,0,0,0.55)",d.fillRect(0,0,c,l),d.font=`${t}px monospace`,d.textBaseline="middle",d.fillStyle="#00FF88",d.fillText(e,i,l/2),this.timestampTex||(this.timestampTex=r.createTexture()),r.bindTexture(r.TEXTURE_2D,this.timestampTex),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,this.timestampCanvas),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),this.lastTimestampString=e}}catch(r){g(this.options,"Errors")&&console.error("[WebGL] ensureTimestampTexture failed",r)}}drawTimestampOnCanvas(e){const r=this.gl;try{if(this.ensureTimestampTexture(e),!this.timestampTex||!this.timestampCanvas)return;this.fboCompositeProgram||(this.fboCompositeProgram=this.linkProgram(qt,Jt),this.fboComposite_aPos=r.getAttribLocation(this.fboCompositeProgram,"aPos"),this.fboComposite_uFBOTex=r.getUniformLocation(this.fboCompositeProgram,"uFBOTex")),this.timestampVBO||(this.timestampVBO=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,this.timestampVBO),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),r.STATIC_DRAW));const t=r.canvas.width|0,i=r.canvas.height|0,o=10,n=10,a=Math.min(this.timestampW,t-o),A=Math.min(this.timestampH,i-n),c=Math.max(0,t-o-a),l=Math.max(0,i-n-A);r.viewport(c,l,a,A),r.useProgram(this.fboCompositeProgram),r.disable(r.DEPTH_TEST),r.disable(r.CULL_FACE),r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA);const d=this.fboComposite_aPos;r.bindBuffer(r.ARRAY_BUFFER,this.timestampVBO),r.enableVertexAttribArray(d),r.vertexAttribPointer(d,2,r.FLOAT,!1,0,0),d!==0&&(r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,0,0)),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.timestampTex),this.fboComposite_uFBOTex&&r.uniform1i(this.fboComposite_uFBOTex,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.viewport(0,0,t,i)}catch(t){g(this.options,"Errors")&&console.error("[WebGL] drawTimestampOnCanvas failed",t)}}buildCubes(e,r,t){var i;try{const o=[];let n=0;const a=e.LedModelSPH;if(a&&a.length>0&&a.some(c=>{var l;return(((l=c.bottomPoints)==null?void 0:l.length)??0)>=2})){const c=[];let l=0;for(const d of a){const u=d.bottomPoints||[];for(let h=0;h<u.length-1;h++){const f=u[h],m=u[h+1],b=m.x-f.x,S=m.y-f.y,p=(m.z||0)-(f.z||0),y=Math.hypot(b,S,p);c.push(y),l+=y}}if(l>0)for(const d of c){const u=Math.max(1,Math.round(d/l*r));o.push({uOffsetPx:n,sliceWidthPx:u}),n=(n+u)%r}}else{const c=e.LedModel;for(const l of c){const d=(i=l.panel)==null?void 0:i.height,u=l.bottomPoints||[];if(!(!d||u.length<2))for(let h=0;h<u.length-1;h++){const f=u[h],m=u[h+1],b=m.x-f.x,S=m.y-f.y,p=(m.z||0)-(f.z||0),y=Math.hypot(b,S,p),R=Math.max(1,Math.round(y/d*t));o.push({uOffsetPx:n,sliceWidthPx:R}),n=(n+R)%r}}}this.ledCubes=o}catch{g(this.options,"Errors")&&console.error("[WebGL] Error building LED cubes from model")}}updateLEDCubesFromModel(e,r){if(!(r&&this.ledModelVersion===r)){if(!this.ensureLEDArtFromAds()){g(this.options,"Errors")&&console.error("[LED Debug] No LED art available from ads");return}this.buildCubes(e,this.ledArtW,this.ledArtH),r&&(this.ledModelVersion=r)}}renderCubes(e,r,t,i,o){const n=this.gl,a=this.instancedExt,A=this.cubesProgram,c=this.blitProgram,l=r,d=t,u=i,h=o,f=this.LED_PADDING,m=this.cornerVBO,b=this.quadVBO,S=this.bDstTL,p=this.bDstTR,y=this.bDstBR,R=this.bDstBL,C=this.bH0,P=this.bH1,E=this.bH2,w=this.bU0,B=this.bSW;if(!m||!b||!S||!p||!y||!R||!C||!P||!E||!w||!B){g(this.options,"Errors")&&console.error("[WebGL] Missing required vertex buffers for LED rendering");return}(!this.overlayTex||!this.overlayFBO)&&(this.overlayTex=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.overlayTex),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,i,o,0,n.RGBA,n.UNSIGNED_BYTE,null),this.overlayFBO=n.createFramebuffer(),n.bindFramebuffer(n.FRAMEBUFFER,this.overlayFBO),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this.overlayTex,0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.disable(n.DEPTH_TEST),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA));const W=this.overlayFBO;if(this.overlayTex,!A||!c||!a){g(this.options,"Errors")&&console.error("[WebGL] Missing programs or buffers",{cubesProg:A,blitProg:c,instancedExt:a});return}if(this.blit_aPos===void 0||this.blit_aPos<0){g(this.options,"Errors")&&console.error("[WebGL] Invalid blit_aPos attribute location:",this.blit_aPos);return}n.bindFramebuffer(n.FRAMEBUFFER,W),n.viewport(0,0,u,h),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.useProgram(A),n.bindBuffer(n.ARRAY_BUFFER,m),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,1,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,S),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(1,1),n.bindBuffer(n.ARRAY_BUFFER,p),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,2,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(2,1),n.bindBuffer(n.ARRAY_BUFFER,y),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(3,1),n.bindBuffer(n.ARRAY_BUFFER,R),n.enableVertexAttribArray(4),n.vertexAttribPointer(4,2,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(4,1),n.bindBuffer(n.ARRAY_BUFFER,C),n.enableVertexAttribArray(5),n.vertexAttribPointer(5,3,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(5,1),n.bindBuffer(n.ARRAY_BUFFER,P),n.enableVertexAttribArray(6),n.vertexAttribPointer(6,3,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(6,1),n.bindBuffer(n.ARRAY_BUFFER,E),n.enableVertexAttribArray(7),n.vertexAttribPointer(7,3,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(7,1),n.bindBuffer(n.ARRAY_BUFFER,w),n.enableVertexAttribArray(8),n.vertexAttribPointer(8,1,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(8,1),n.bindBuffer(n.ARRAY_BUFFER,B),n.enableVertexAttribArray(9),n.vertexAttribPointer(9,1,n.FLOAT,!1,0,0),a.vertexAttribDivisorANGLE(9,1),n.uniform2f(n.getUniformLocation(A,"uResolution"),u,h),n.uniform1i(n.getUniformLocation(A,"uFlipY"),1),n.uniform2f(n.getUniformLocation(A,"uShift"),0,0),n.uniform2f(n.getUniformLocation(A,"uArtSize"),this.ledArtW,this.ledArtH),this.cubes_uEdgeFeatherPx&&n.uniform1f(this.cubes_uEdgeFeatherPx,this.LED_AA_STRENGTH),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this.ledArtTex),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.uniform1i(n.getUniformLocation(A,"uArt"),0),n.getParameter(n.TEXTURE_BINDING_2D)!==this.ledArtTex&&g(this.options,"Errors")&&console.error("Warning: Texture binding mismatch!"),a.drawArraysInstancedANGLE(n.TRIANGLES,0,6,e),a.vertexAttribDivisorANGLE(0,0);for(let Z=1;Z<=9;Z++)a.vertexAttribDivisorANGLE(Z,0),n.disableVertexAttribArray(Z);n.disableVertexAttribArray(0);const ne=f/u,Y=f/h,L=(f+l)/u,O=(f+d)/h;this.ledOverlayUVRect=[ne,Y,L,O]}drawAugmentationWithLED(e,r,t,i=1,o,n){this.gl;let a=!1;try{if(o&&o.cubePlaceholders&&o.intrinsics&&o.referenceSize&&this.ensureLEDArtFromAds()){const A=Math.max(1,o.referenceSize.width|0),c=Math.max(1,o.referenceSize.height|0),l=this.LED_PADDING|0,d=A+l*2,u=c+l*2;this.ensureLedOverlay(d,u);const h=this.getCubesTransformationsToLiveImage(o);h&&h>0&&(this.renderCubes(h,A,c,d,u),a=!0)}}catch(A){g(this.options,"Errors")&&console.error("[WebGL] LED prep error:",A)}a?(this.compositeLEDOverlayDirectToCanvas(!0,e),this.drawAugmentation(e,r,t,i,!1,n)):this.drawAugmentation(e,r,t,i,!0,n)}drawLEDOnly(e,r){try{if(!r||!r.cubePlaceholders||!r.intrinsics||!r.referenceSize){g(this.options,"Errors")&&console.error("[LED Debug] Missing LED data - led:",!!r,"cubePlaceholders:",!!(r!=null&&r.cubePlaceholders),"intrinsics:",!!(r!=null&&r.intrinsics),"referenceSize:",!!(r!=null&&r.referenceSize));return}if(!this.ensureLEDArtFromAds()){g(this.options,"Errors")&&console.error("[LED Debug] Failed to ensure LED art from ads");return}const t=r.referenceSize.width,i=r.referenceSize.height,o=t+this.LED_PADDING*2,n=i+this.LED_PADDING*2;this.ensureLedOverlay(o,n);const a=this.getCubesTransformationsToLiveImage(r);if(!a||a===0){g(this.options,"Errors")&&console.error("[LED Debug] No LED cubes to render - check LED model data");return}this.renderCubes(a,t,i,o,n),this.compositeLEDOverlayDirectToCanvas(!0,e)}catch(t){g(this.options,"Errors")&&console.error("[WebGL] LED-only path error",t)}}drawLEDOverlayOnTop(e,r,t){try{if(!r||!r.cubePlaceholders||!r.intrinsics||!r.referenceSize||!this.ensureLEDArtFromAds())return 0;const i=r.referenceSize.width,o=r.referenceSize.height,n=i+this.LED_PADDING*2,a=o+this.LED_PADDING*2;this.ensureLedOverlay(n,a);const A=this.getCubesTransformationsToLiveImage(r);return A&&A>0?(this.renderCubes(A,i,o,n,a),this.compositeLEDOverlayDirectToCanvas(!1,e),A):0}catch(i){return g(this.options,"Errors")&&console.error("[WebGL] drawLEDOverlayOnTop error",i),0}}compositeLEDOverlayDirectToCanvas(e,r){const t=this.gl;if(!this.ledCompositeProgram||!this.overlayTex||!this.fsPosBuf||!this.fsUvBuf||this.comp_aPos===void 0||this.comp_aUv===void 0||!this.comp_uOverlay||!this.comp_uAlphaMask||!this.comp_uUVRect||!this.comp_uRes||!this.ledOverlayUVRect){g(this.options,"Errors")&&console.error("[WebGL] Missing resources for direct LED composite");return}t.bindFramebuffer(t.FRAMEBUFFER,null);const i=t.canvas.width,o=t.canvas.height;t.viewport(0,0,i,o),e&&(t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)),t.useProgram(this.ledCompositeProgram),t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);for(let l=0;l<16;l++)t.disableVertexAttribArray(l);t.bindBuffer(t.ARRAY_BUFFER,this.fsPosBuf),t.enableVertexAttribArray(this.comp_aPos),t.vertexAttribPointer(this.comp_aPos,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.fsUvBuf),t.enableVertexAttribArray(this.comp_aUv),t.vertexAttribPointer(this.comp_aUv,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.overlayTex),t.uniform1i(this.comp_uOverlay,0),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,r),t.uniform1i(this.comp_uAlphaMask,1);const[n,a,A,c]=this.ledOverlayUVRect;t.uniform4f(this.comp_uUVRect,n,a,A,c),t.uniform2f(this.comp_uRes,i,o),t.drawArrays(t.TRIANGLES,0,6)}compositeLEDFBOToCanvas(e,r){const t=this.gl,i=this.quadVBO;if(!this.compositeTex||!this.fboCompositeProgram||!i){g(this.options,"Errors")&&console.error("[WebGL] Missing resources for LED FBO compositing");return}for(;t.getError()!==t.NO_ERROR;);t.bindFramebuffer(t.FRAMEBUFFER,null);const o=t.canvas.width,n=t.canvas.height;if(t.viewport(0,0,o,n),e&&(t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)),this.fboCompositeProgram||(this.fboCompositeProgram=this.linkProgram(qt,Jt),this.fboComposite_aPos=t.getAttribLocation(this.fboCompositeProgram,"aPos"),this.fboComposite_uFBOTex=t.getUniformLocation(this.fboCompositeProgram,"uFBOTex")),r&&this.ledCompositeProgram&&this.fsPosBuf&&this.fsUvBuf&&this.comp_aPos!==void 0&&this.comp_aUv!==void 0&&this.comp_uOverlay&&this.comp_uAlphaMask&&this.comp_uUVRect&&this.comp_uRes){t.useProgram(this.ledCompositeProgram),t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);for(let d=0;d<16;d++)t.disableVertexAttribArray(d);t.bindBuffer(t.ARRAY_BUFFER,this.fsPosBuf),t.enableVertexAttribArray(this.comp_aPos),t.vertexAttribPointer(this.comp_aPos,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,this.fsUvBuf),t.enableVertexAttribArray(this.comp_aUv),t.vertexAttribPointer(this.comp_aUv,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.compositeTex),t.uniform1i(this.comp_uOverlay,0),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,r),t.uniform1i(this.comp_uAlphaMask,1),t.uniform4f(this.comp_uUVRect,0,0,1,1),t.uniform2f(this.comp_uRes,o,n),t.drawArrays(t.TRIANGLES,0,6);return}t.useProgram(this.fboCompositeProgram),t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);for(let d=0;d<16;d++)t.disableVertexAttribArray(d);t.bindBuffer(t.ARRAY_BUFFER,i);const a=this.fboComposite_aPos;if(a===void 0||a<0){g(this.options,"Errors")&&console.error("[WebGL] Invalid fboComposite aPos location:",a);return}t.enableVertexAttribArray(a),t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),a!==0&&(t.enableVertexAttribArray(0),t.vertexAttribPointer(0,2,t.FLOAT,!1,0,0));const A=t.getBufferParameter(t.ARRAY_BUFFER,t.BUFFER_SIZE);A!==32&&g(this.options,"Errors")&&console.error("[WebGL] Unexpected quadVBO size:",A,"expected 32 bytes"),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.compositeTex),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),this.fboComposite_uFBOTex&&t.uniform1i(this.fboComposite_uFBOTex,0);const c=t.getError();c&&g(this.options,"Errors")&&console.error("[WebGL] Error before composite draw:",c),t.drawArrays(t.TRIANGLE_STRIP,0,4);const l=t.getError();l&&g(this.options,"Errors")&&console.error("[WebGL] Error in LED FBO composite:",l)}getDistortionCtx(e){if(!e.intrinsics||!e.distortion)return;const r=e.intrinsics,t=e.distortion,i=t[0],o=t[1],n=t[2],a=r.cx,A=r.cy,c=r.fx,l=r.fy;return{k1:i,k2:o,k3:n,cx:a,cy:A,fx:c,fy:l,undistortNormalized(d,u){let h=d,f=u;for(let m=0;m<5;m++){const b=h*h+f*f,S=b*b,p=S*b,y=1+i*b+o*S+n*p,R=y!==0?1/y:1;h=d*R,f=u*R}return{x:h,y:f}},undistortCanvasPoint(d,u){const h=d.x+u,f=d.y+u,m=(h-(a+u))/c,b=(f-(A+u))/l,S=this.undistortNormalized(m,b),p=a+u+c*S.x,y=A+u+l*S.y;return{x:p-u,y:y-u}}}}pickCorners(e){const r=e.tgtCorners||e.block&&e.block.fenceVertices2D;return!r||r.length!==4?null:[r[0],r[1],r[2],r[3]]}getHinv(e,r){const t=[],i=[];for(let L=0;L<4;L++){const O=e[L].x,Z=e[L].y,Ce=r[L].x,N=r[L].y;t.push([O,Z,1,0,0,0,-O*Ce,-Z*Ce]),i.push(Ce),t.push([0,0,0,O,Z,1,-O*N,-Z*N]),i.push(N)}const o=8,n=t.map(L=>L.slice()),a=i.slice();for(let L=0;L<o;L++){let O=L;for(let N=L+1;N<o;N++)Math.abs(n[N][L])>Math.abs(n[O][L])&&(O=N);if(O!==L){const N=n[L];n[L]=n[O],n[O]=N;const We=a[L];a[L]=a[O],a[O]=We}const Ce=1/(n[L][L]||1e-12);for(let N=L;N<o;N++)n[L][N]*=Ce;a[L]*=Ce;for(let N=0;N<o;N++){if(N===L)continue;const We=n[N][L];if(We!==0){for(let bt=L;bt<o;bt++)n[N][bt]-=We*n[L][bt];a[N]-=We*a[L]}}}const A=a,c=[A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],1],[l,d,u,h,f,m,b,S,p]=[c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8]],y=f*p-m*S,R=-(h*p-m*b),C=h*S-f*b,P=-(d*p-u*S),E=l*p-u*b,w=-(l*S-d*b),B=d*m-u*f,W=-(l*m-u*h),J=l*f-d*h,Y=1/(l*y+d*R+u*C||1e-12);return[y*Y,P*Y,B*Y,R*Y,E*Y,W*Y,C*Y,w*Y,J*Y]}getCubesTransformationsToLiveImage(e){if(!e||!e.cubePlaceholders||!e.intrinsics||!e.referenceSize)return;const r=this.LED_PADDING,t=e.cubePlaceholders,i=t.length,o=new Float32Array(i*2),n=new Float32Array(i*2),a=new Float32Array(i*2),A=new Float32Array(i*2),c=new Float32Array(i*3),l=new Float32Array(i*3),d=new Float32Array(i*3),u=new Float32Array(i),h=new Float32Array(i);let f=0;const m=this.getDistortionCtx(e);if(!m)return;let b=0,S=0;for(let y=0;y<i;y++){const R=t[y],C=R.index;if(C<0||C>=this.ledCubes.length){b++;continue}const P=this.pickCorners(R);if(!P){S++;continue}const E=m.undistortCanvasPoint(P[0],r),w=m.undistortCanvasPoint(P[1],r),B=m.undistortCanvasPoint(P[2],r),W=m.undistortCanvasPoint(P[3],r);o.set([E.x,E.y],y*2),n.set([w.x,w.y],y*2),a.set([B.x,B.y],y*2),A.set([W.x,W.y],y*2);const J=this.ledCubes[C],ne=Math.max(1,J.sliceWidthPx),Y=[{x:0,y:this.ledArtH},{x:0,y:0},{x:ne,y:0},{x:ne,y:this.ledArtH}],L=[E,w,B,W],O=this.getHinv(Y,L);c.set([O[0],O[1],O[2]],y*3),l.set([O[3],O[4],O[5]],y*3),d.set([O[6],O[7],O[8]],y*3),u[y]=J.uOffsetPx/this.ledArtW,h[y]=ne,f++}f===0&&g(this.options,"Renderer")&&(b>0||S>0)&&console.log(`[LED] getCubesTransformations: 0 accepted from ${i} — skippedIdx: ${b} (ledCubes.length=${this.ledCubes.length}), skippedCorners: ${S}`);const p=this.gl;return p.bindBuffer(p.ARRAY_BUFFER,this.bDstTL),p.bufferData(p.ARRAY_BUFFER,o,p.DYNAMIC_DRAW),p.bindBuffer(p.ARRAY_BUFFER,this.bDstTR),p.bufferData(p.ARRAY_BUFFER,n,p.DYNAMIC_DRAW),p.bindBuffer(p.ARRAY_BUFFER,this.bDstBR),p.bufferData(p.ARRAY_BUFFER,a,p.DYNAMIC_DRAW),p.bindBuffer(p.ARRAY_BUFFER,this.bDstBL),p.bufferData(p.ARRAY_BUFFER,A,p.DYNAMIC_DRAW),p.bindBuffer(p.ARRAY_BUFFER,this.bH0),p.bufferData(p.ARRAY_BUFFER,c,p.DYNAMIC_DRAW),p.bindBuffer(p.ARRAY_BUFFER,this.bH1),p.bufferData(p.ARRAY_BUFFER,l,p.DYNAMIC_DRAW),p.bindBuffer(p.ARRAY_BUFFER,this.bH2),p.bufferData(p.ARRAY_BUFFER,d,p.DYNAMIC_DRAW),p.bindBuffer(p.ARRAY_BUFFER,this.bU0),p.bufferData(p.ARRAY_BUFFER,u,p.DYNAMIC_DRAW),p.bindBuffer(p.ARRAY_BUFFER,this.bSW),p.bufferData(p.ARRAY_BUFFER,h,p.DYNAMIC_DRAW),f}setLEDArtTexture(e){try{const r=this.gl;this.ledArtTex||(this.ledArtTex=r.createTexture()),r.bindTexture(r.TEXTURE_2D,this.ledArtTex),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e);const t=this.getDims(e);this.ledArtW=t.w||1,this.ledArtH=t.h||1;const i=this.isPowerOf2(this.ledArtW)&&this.isPowerOf2(this.ledArtH);if(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),i)r.generateMipmap(r.TEXTURE_2D),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);else{r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);const o=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(o){const n=r.getParameter(o.MAX_TEXTURE_MAX_ANISOTROPY_EXT);r.texParameteri(r.TEXTURE_2D,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,n))}}}catch(r){g(this.options,"Errors")&&console.error("[WebGL] setLEDArtTexture failed",r)}}clearLEDArtTexture(){try{this.ledArtTex&&this.gl.deleteTexture(this.ledArtTex)}catch{}this.ledArtTex=void 0,this.ledArtW=0,this.ledArtH=0}ensureLEDArtFromAds(){var e,r,t,i;try{if(this.ledArtTex)return!0;if((e=this.renderer.ads)!=null&&e.ledExplicitlyCleared)return!1;const o=(i=(t=(r=this.renderer.ads)==null?void 0:r.ledAds)==null?void 0:t[0])==null?void 0:i.image;if(!o)return g(this.options,"Errors")&&console.error("[LED Debug] No ad image found in ads object"),!1;if(!this.ledArtTex){const n=this.gl,a=n.createTexture();n.bindTexture(n.TEXTURE_2D,a),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,o),this.ledArtW=o.width||1,this.ledArtH=o.height||1;const A=this.isPowerOf2(this.ledArtW)&&this.isPowerOf2(this.ledArtH);if(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),A)n.generateMipmap(n.TEXTURE_2D),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR_MIPMAP_LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);else{n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);const c=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(c){const l=n.getParameter(c.MAX_TEXTURE_MAX_ANISOTROPY_EXT);n.texParameteri(n.TEXTURE_2D,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,l))}}this.ledArtTex=a}return!0}catch(o){return g(this.options,"Errors")&&console.error("[LED Debug] Error in ensureLEDArtFromAds:",o),!1}}ensureLedOverlay(e,r){const t=this.gl;this.ledOverlayTex&&this.ledOverlayW===e&&this.ledOverlayH===r||(this.ledOverlayTex&&t.deleteTexture(this.ledOverlayTex),this.ledOverlayFBO&&t.deleteFramebuffer(this.ledOverlayFBO),this.ledOverlayTex=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.ledOverlayTex),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,r,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.ledOverlayFBO=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.ledOverlayFBO),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.ledOverlayTex,0),t.bindFramebuffer(t.FRAMEBUFFER,null),this.ledOverlayW=e,this.ledOverlayH=r)}ensureCompositeFBO(e,r){const t=this.gl;this.compositeTex&&this.compositeFBO,this.compositeTex&&t.deleteTexture(this.compositeTex),this.compositeFBO&&t.deleteFramebuffer(this.compositeFBO),this.compositeTex=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.compositeTex),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,r,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),this.compositeFBO=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.compositeFBO),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.compositeTex,0);const i=t.checkFramebufferStatus(t.FRAMEBUFFER);i!==t.FRAMEBUFFER_COMPLETE&&console.error("[WebGL] Composite FBO incomplete:",i),t.bindFramebuffer(t.FRAMEBUFFER,null)}initBuffers(){const e=this.gl;this.posBuf=e.createBuffer(),this.uvBuf=e.createBuffer(),this.transformBuf=e.createBuffer(),this.fsPosBuf=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.fsPosBuf),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]),e.STATIC_DRAW),this.fsUvBuf=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.fsUvBuf),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]),e.STATIC_DRAW),this.options.RENDER_LED&&(this.quadVBO=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.quadVBO),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW),this.cornerVBO=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.cornerVBO),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,3,1,1,3,2]),e.STATIC_DRAW),this.bDstTL=e.createBuffer(),this.bDstTR=e.createBuffer(),this.bDstBR=e.createBuffer(),this.bDstBL=e.createBuffer(),this.bH0=e.createBuffer(),this.bH1=e.createBuffer(),this.bH2=e.createBuffer(),this.bU0=e.createBuffer(),this.bSW=e.createBuffer())}buildQuadData(e){const r=[],t=[],i=[];return Object.values(e).forEach(o=>{var c,l;const n=(l=(c=this.renderer.ads)==null?void 0:c.adMap.get(o.name))==null?void 0:l.name;if(!n)return;const a=this.logoToRegion.get(n);if(!a)return;const A=o.corners;r.push(A[0].x,A[0].y,A[1].x,A[1].y,A[2].x,A[2].y,A[0].x,A[0].y,A[2].x,A[2].y,A[3].x,A[3].y);for(let d=0;d<6;d++)t.push(a.u0,a.v0,a.u1,a.v1);for(let d=0;d<6;d++)i.push(...o.tranform)}),{pos:new Float32Array(r),uv:new Float32Array(t),transforms:new Float32Array(i),vertCount:r.length/2}}cleanGL(){this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}initAtlas(){this.atlasCanvas=new OffscreenCanvas(this.INITIAL_ATLAS_SIZE,this.INITIAL_ATLAS_SIZE),this.atlasCanvas.width=this.atlasCanvas.height=this.INITIAL_ATLAS_SIZE,this.atlasCtx=this.atlasCanvas.getContext("2d"),this.atlasTex=this.gl.createTexture(),this.atlasCtx.clearRect(0,0,this.INITIAL_ATLAS_SIZE,this.INITIAL_ATLAS_SIZE),this.syncAtlasGL()}getDims(e){if("width"in e&&"height"in e)return{w:e.width,h:e.height};const r=e;return{w:r.displayWidth??r.codedWidth,h:r.displayHeight??r.codedHeight}}isPowerOf2(e){return(e&e-1)===0}calculateRequiredAtlasSize(e,r){const t=this.ATLAS_PADDING*2;let i=(e+t)*(r+t);this.logoToRegion.forEach(a=>{const A=(a.u1-a.u0)*this.ATLAS_SIZE,c=(a.v1-a.v0)*this.ATLAS_SIZE;i+=(A+t)*(c+t)}),i*=1.3;let o=this.INITIAL_ATLAS_SIZE;for(;o*o<i;)o*=2;const n=Math.max(e,r);for(;o<n;)o*=2;return o}resizeAtlas(e,r){const t=this.calculateRequiredAtlasSize(e,r);if(t<=this.ATLAS_SIZE)return;const i=new OffscreenCanvas(t,t),o=i.getContext("2d");o.clearRect(0,0,t,t),o.drawImage(this.atlasCanvas,0,0);const n=this.ATLAS_SIZE/t;this.ATLAS_SIZE=t,this.atlasCanvas=i,this.atlasCtx=o,this.logoToRegion.forEach((a,A)=>{const c={u0:a.u0*n,v0:a.v0*n,u1:a.u1*n,v1:a.v1*n};this.logoToRegion.set(A,c)}),this.syncAtlasGL()}addToAtlas(e,r){if(this.logoToRegion.has(e))return this.logoToRegion.get(e);const{w:t,h:i}=this.getDims(r),o=this.ATLAS_PADDING,n=t+o*2,a=i+o*2;this.nextX+n>this.ATLAS_SIZE&&(this.nextX=0,this.nextY+=this.rowH,this.rowH=0),(this.nextY+a>this.ATLAS_SIZE||this.nextX+n>this.ATLAS_SIZE)&&this.resizeAtlas(n,a);const A=this.nextX+o,c=this.nextY+o;this.atlasCtx.drawImage(r,A,c,t,i);const l={u0:A/this.ATLAS_SIZE,v0:c/this.ATLAS_SIZE,u1:(A+t)/this.ATLAS_SIZE,v1:(c+i)/this.ATLAS_SIZE};return this.logoToRegion.set(e,l),this.atlasDirty=!0,this.nextX+=n,this.rowH=Math.max(this.rowH,a),l}syncAtlasGL(){if(!this.atlasDirty)return;const e=this.gl,r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.atlasCanvas),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),this.isPowerOf2(this.ATLAS_SIZE)?(e.generateMipmap(e.TEXTURE_2D),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR)):(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR));const i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(i){const n=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT);e.texParameteri(e.TEXTURE_2D,i.TEXTURE_MAX_ANISOTROPY_EXT,n)}const o=this.atlasTex;this.atlasTex=r,o&&e.deleteTexture(o),this.atlasDirty=!1}clearAtlas(){this.logoToRegion.clear(),this.nextX=this.nextY=this.rowH=0,this.atlasCtx.clearRect(0,0,this.ATLAS_SIZE,this.ATLAS_SIZE),this.atlasDirty=!0}generateAdTexture(e,r){U.setAttributes({asset:e}),this.addToAtlas(e,r)}measureLogoVisibility(e){const r=this.gl.canvas.width,t=this.gl.canvas.height,i=this.renderer.shot;if(!i)return;const{percentOfAd:o,percentOfScreen:n}=Ta(e,r,t);i.frameCount++,i.sumPercentOfAd+=o,i.sumPercentOfScreen+=n,i.lastProcessingTime=performance.now()}initTiming(){var e;(e=this.options.debug)!=null&&e.trackPerformance&&(this.timerExt=this.gl.getExtension("EXT_disjoint_timer_query"),this.timerExt||g(this.options,"Errors")&&console.error("EXT_disjoint_timer_query not supported"))}beginTimer(){!this.timerExt||this.queryInFlight||(this.query=this.timerExt.createQueryEXT(),this.timerExt.beginQueryEXT(this.timerExt.TIME_ELAPSED_EXT,this.query))}endTimer(){if(!this.timerExt||!this.query||this.queryInFlight)return;this.timerExt.endQueryEXT(this.timerExt.TIME_ELAPSED_EXT),this.queryInFlight=!0;const e=()=>{if(!this.queryInFlight)return;const r=this.timerExt.getQueryObjectEXT(this.query,this.timerExt.QUERY_RESULT_AVAILABLE_EXT),t=this.gl.getParameter(this.timerExt.GPU_DISJOINT_EXT);if(r&&!t){const o=this.timerExt.getQueryObjectEXT(this.query,this.timerExt.QUERY_RESULT_EXT)/1e6;this.GPUFrameTimeSum+=o,this.GPUFrameTimeCount++,this.avgGPUFrameTime=this.GPUFrameTimeSum/this.GPUFrameTimeCount,this.timerExt.deleteQueryEXT(this.query),this.query=null,this.queryInFlight=!1}else requestAnimationFrame(e)};requestAnimationFrame(e)}getAvgGPUFrameTime(){var e;if((e=this.options.debug)!=null&&e.trackPerformance){const r=this.avgGPUFrameTime;return this.GPUFrameTimeCount=0,this.GPUFrameTimeSum=0,this.avgGPUFrameTime=0,r}return 0}getAvgCPUFrameTime(){var e;if((e=this.options.debug)!=null&&e.trackPerformance){const r=this.avgCPUFrameTime;return this.CPUFrameTimeCount=0,this.CPUFrameTimeSum=0,this.avgCPUFrameTime=0,r}return 0}}const xa=["LeftTop","MidTopLeft","MidTopRight","RightTop","LeftBottom","MidBottomLeft","MidBottomRight","RightBottom"];class As{constructor(e,r){this.ledAds=[],this.overriddenPlaceholders=new Set,this.ledExplicitlyCleared=!1,this.periodsConfig=null,this.logoAssets=new Map,this.currentPeriod=null,this.getAds=async()=>{try{const t=this.options.adsBaseURL,i=await fetch(t+"/profiles/geo/",{method:"GET",redirect:"follow",cache:"no-store"});if(this.options&&g(this.options,"Ads")&&console.log("[ADS] adListResponse: ",i),!i.ok){U.error("[ADS] Failed to fetch ad list"),this.options&&g(this.options,"Errors")&&console.error("[ADS] Failed to fetch ad list");return}const o=await i.json();if(this.lastJson===JSON.stringify(o))return;if(this.lastJson=JSON.stringify(o),this.options&&g(this.options,"Ads")&&console.log("[ADS] Received new ad profile:",o),this.periodsConfig=o.periods,await this.loadAllLogos(o.logos),!this.currentPeriod&&this.periodsConfig){const n=Object.keys(this.periodsConfig)[0];n&&(this.currentPeriod=n,this.options&&g(this.options,"Ads")&&console.log(`[ADS] No period set, defaulting to first period: ${n}`))}this.currentPeriod&&this.applyPeriodMapping(this.currentPeriod)}catch(t){U.error("[ADS] Error fetching ads",{error:t}),this.options&&g(this.options,"Errors")&&console.error("[ADS] Error fetching ads:",t)}finally{this.refreshTimeoutId&&(clearTimeout(this.refreshTimeoutId),this.refreshTimeoutId=void 0),this.placeholderNames.some(i=>!this.overriddenPlaceholders.has(i))&&(this.refreshTimeoutId=setTimeout(this.getAds,1e4))}},this.loadAdvImage=async t=>{const i=`#${t.name}`,o=t.url;if(i.indexOf(".json")>-1)return;const a=await(await fetch(o)).blob();return await createImageBitmap(a)},this.uploadAdTextures=()=>{this.webgl.clearAtlas(),this.adMap.forEach((t,i)=>{!t||!t.image||this.webgl.generateAdTexture(t.name,t.image)}),this.webgl.syncAtlasGL()},this.overrideAdImage=async(t,i="",o=!1)=>{var c;this.options&&g(this.options,"Ads")&&console.log("[Ads] overrideAdImage called, clickUrl:",i,"isRestore:",o),o?this.options&&g(this.options,"Ads")&&console.log("[Ads] Restore mode - keeping overriddenPlaceholders:",Array.from(this.overriddenPlaceholders)):(this.overriddenPlaceholders.clear(),this.options&&g(this.options,"Ads")&&console.log("[Ads] Cleared overriddenPlaceholders for new global override"));let n;try{n=await this.computeImageBitmapHash(t)}catch{}const a={name:n?`asset_${n}`:"override_global",imageUrl:((c=this.defaultAd)==null?void 0:c.imageUrl)||"",image:t,adUrl:i||""};this.logoAssets.set(n||"override_global",a);let A=0;this.adMap.forEach((l,d)=>{this.overriddenPlaceholders.has(d)||(this.adMap.set(d,a),this.overriddenPlaceholders.add(d),A++)}),this.options&&g(this.options,"Ads")&&console.log("[Ads] overrideAdImage applied to",A,"placeholders"),this.uploadAdTextures()},this.overrideLEDImage=t=>{this.options&&g(this.options,"Ads")&&console.log("[ADS] overrideLEDImage called"),this.ledExplicitlyCleared=!1;const i=this.ledAds[0]||this.defaultAd,o={name:"override_led",imageUrl:(i==null?void 0:i.imageUrl)||"",image:t,adUrl:(i==null?void 0:i.adUrl)||""};this.ledAds=[o];try{this.webgl.setLEDArtTexture(t),this.options&&g(this.options,"Ads")&&console.log("[ADS] overrideLEDImage completed")}catch{this.options&&g(this.options,"Errors")&&console.error("[ADS] Failed to set LED art texture")}},this.overrideAdImageForPlaceholder=async(t,i,o="")=>{var c,l;if(this.options&&g(this.options,"Ads")&&console.log("[Ads] overrideAdImageForPlaceholder called:",{placeholder:i,clickUrl:o,placeholderNames:this.placeholderNames,placeholderNamesLength:(c=this.placeholderNames)==null?void 0:c.length}),this.placeholderNames.indexOf(i)===-1){this.options&&g(this.options,"Errors")&&console.error("[Ads] VALIDATION FAILED - placeholder not in placeholderNames!"),U.error(`[ADS] Unknown placeholder: ${i}`),this.options&&g(this.options,"Errors")&&console.error("[ADS] Unknown placeholder provided to overrideAdImageForPlaceholder:",i);try{t.close()}catch{}return}this.options&&g(this.options,"Ads")&&console.log("[Ads] Placeholder validation passed, proceeding with override"),this.overriddenPlaceholders.add(i);let n;try{n=await this.computeImageBitmapHash(t)}catch{}const a=n||`override_${i}_${Date.now()}`;let A=n?this.logoAssets.get(a):void 0;if(A&&(!A.image||A.image.width===0)&&(this.logoAssets.delete(a),A=void 0),!A)A={name:a,imageUrl:((l=this.defaultAd)==null?void 0:l.imageUrl)||"",image:t,adUrl:o||""},this.logoAssets.set(a,A);else try{t.close()}catch{}this.adMap.set(i,A);try{this.uploadAdTextures()}catch{this.options&&g(this.options,"Errors")&&console.error("[ADS] Failed to set ad texture")}},this.getAdURLAtCoord=(t,i,o)=>{let n;return this.options&&g(this.options,"Ads")&&console.log("[Ads] getAdURLAtCoord called"),this.options&&g(this.options,"Ads")&&console.log("[Ads] adMap keys:",Array.from(this.adMap.keys())),this.options&&g(this.options,"Ads")&&console.log("[Ads] placeholderNames:",this.placeholderNames),this.options&&g(this.options,"Ads")&&console.log("[Ads] click coord:",o),Object.keys(t).forEach(a=>{const A=t[a].corners.map(d=>({x:d.x/i.width,y:d.y/i.height})),c=t[a].name,l=this.isPointInPlaceholder(A,o);if(this.options&&g(this.options,"Ads")&&console.log(`[Ads] Placeholder "${a}" -> name="${c}", isInside=${l}`),l){const d=this.adMap.get(c);this.options&&g(this.options,"Ads")&&console.log(`[Ads] Looking up "${c}" in adMap:`,d),d?this.options&&g(this.options,"Ads")&&console.log("[Ads] ad.adUrl:",d.adUrl):this.options&&g(this.options,"Ads")&&console.log("[Ads] No ad found for placeholder name:",c),d&&(n=d.adUrl)}}),n},this.isPointInPlaceholder=(t,i)=>{let o=!1;const{x:n,y:a}=i,A=t.length;for(let c=0,l=A-1;c<A;l=c++){const d=t[c].x,u=t[c].y,h=t[l].x,f=t[l].y;u>a!=f>a&&n<(h-d)*(a-u)/(f-u)+d&&(o=!o)}return o},this.placeholderNames=r.OVERRIDE_PLACEHOLDER_NAMES||xa,this.webgl=e,this.options=r,this.adMap=new Map,this.placeholderNames.forEach(t=>{this.adMap.set(t,void 0)}),r.OVERRIDE_AD!==null&&this.getAds()}get ads(){return Array.from(this.logoAssets.values())}get defaultAd(){return this.logoAssets.values().next().value}get hasAds(){return this.logoAssets.size>0}async loadAllLogos(e){const r=[];for(const[t,i]of Object.entries(e)){if(this.logoAssets.has(t))continue;const o=(async()=>{try{const n=i.url.replace(/^http:\\/\\//i,"https://"),a=await fetch(n);if(!a.ok)throw new Error(`HTTP error! Status: ${a.status}`);const A=await a.blob(),c=await createImageBitmap(A),l={name:t,imageUrl:n,image:c,adUrl:i.link};this.logoAssets.set(t,l),this.options&&g(this.options,"Ads")&&console.log(`[ADS] Loaded logo: ${t} from ${n}`)}catch(n){U.error(`[ADS] Failed to load logo ${t}`,{error:n}),this.options&&g(this.options,"Errors")&&console.error(`[ADS] Failed to load logo ${t}:`,n)}})();r.push(o)}await Promise.all(r)}applyPeriodMapping(e){if(!this.periodsConfig||!this.periodsConfig[e]){U.warn(`[ADS] No configuration found for period ${e}`),this.options&&g(this.options,"Ads")&&console.warn(`[ADS] No configuration found for period ${e}`);return}const t=this.periodsConfig[e].logos;this.placeholderNames.forEach(i=>{this.overriddenPlaceholders.has(i)||this.adMap.set(i,void 0)});for(const[i,o]of Object.entries(t)){if(this.overriddenPlaceholders.has(i))continue;const n=this.logoAssets.get(o);n?this.adMap.set(i,n):(U.warn(`[ADS] Logo ${o} not found for placeholder ${i}`),this.options&&g(this.options,"Ads")&&console.warn(`[ADS] Logo ${o} not found for placeholder ${i}`))}this.uploadAdTextures(),this.options&&g(this.options,"Ads")&&console.log(`[ADS] Applied mapping for period ${e}`,t)}updatePeriod(e){this.currentPeriod!==e&&(this.options&&g(this.options,"Ads")&&console.log(`[ADS] Period changed: ${this.currentPeriod} -> ${e}`),this.currentPeriod=e,this.periodsConfig?this.applyPeriodMapping(e):this.options&&g(this.options,"Ads")&&console.log(`[ADS] Period updated to ${e}, but no config loaded yet`))}clearLED(){this.options&&g(this.options,"Ads")&&console.log("[ADS] clearLED called");for(const e of this.ledAds)if(e!=null&&e.image)try{e.image.close()}catch{}this.ledAds=[],this.ledExplicitlyCleared=!0,this.webgl.clearLEDArtTexture(),this.options&&g(this.options,"Ads")&&console.log("[ADS] clearLED completed")}resumeAutoRefresh(){this.overriddenPlaceholders.clear(),this.ledExplicitlyCleared=!1,this.logoAssets.clear(),this.ledAds=[],this.lastJson=void 0,this.getAds()}resetPlaceholderToDefault(e){if(this.placeholderNames.indexOf(e)===-1){this.options&&g(this.options,"Errors")&&console.error("[ADS] Unknown placeholder provided to resetPlaceholderToDefault:",e);return}this.overriddenPlaceholders.delete(e),this.defaultAd&&(this.adMap.set(e,this.defaultAd),this.uploadAdTextures(),this.options&&g(this.options,"Ads")&&console.log(`[ADS] Reset placeholder "${e}" to default ad`))}pause(){this.refreshTimeoutId&&(clearTimeout(this.refreshTimeoutId),this.refreshTimeoutId=void 0),this.options&&g(this.options,"Ads")&&console.log("[ADS] Paused ad refresh")}resume(){this.options&&g(this.options,"Ads")&&console.log("[ADS] Resuming ad refresh"),this.placeholderNames.some(r=>!this.overriddenPlaceholders.has(r))&&this.getAds()}async computeImageBitmapHash(e){const r=Math.max(1,e.width||0),t=Math.max(1,e.height||0),i=new OffscreenCanvas(r,t),o=i.getContext("2d");if(!o)throw new Error("2D context not available");o.drawImage(e,0,0,r,t);const a=await(await i.convertToBlob({type:"image/png"})).arrayBuffer(),A=await crypto.subtle.digest("SHA-256",a),c=new Uint8Array(A);let l="";for(let d=0;d<c.length;d++)l+=c[d].toString(16).padStart(2,"0");return l}clearPlaceholder(e){const r=this.adMap.get(e);if(r){let t=!1;if(this.adMap.forEach((i,o)=>{o!==e&&i===r&&(t=!0)}),!t&&r.image){try{r.image.close()}catch{}for(const[i,o]of this.logoAssets.entries())if(o===r){this.logoAssets.delete(i);break}}}this.adMap.set(e,void 0),this.overriddenPlaceholders.delete(e),this.uploadAdTextures()}clearAllPlaceholders(){const e=new Set;this.adMap.forEach((r,t)=>{if(r!=null&&r.image&&!e.has(r.image))try{r.image.close(),e.add(r.image)}catch{}this.adMap.set(t,void 0)}),this.logoAssets.clear(),this.overriddenPlaceholders.clear(),this.uploadAdTextures()}}class ls{constructor(e,r){this.renderDataMap=new Map,this.isRenderData=!1,this.videoFrameTexture=null,this.reusableAlphaTex=null,this.state="OFF",this.opacity=0,this.lastStateUpdate=0,this.stateUpdateInterval=500,this.lastPerformanceCheck=performance.now(),this.lastStatusUpdate=0,this.STATUS_UPDATE_INTERVAL=200,this.statusInitialized=!1,this.lastWebGLStatus={ready:!1,issue:""},this.lastRenderState="OFF",this.lastDataStatus={stream_data:!1,ads:!1,render_data:!1,alpha_mask:!1,placeholders:!1,processing_size:!1,isLive:!1},this.lastKillswitchStatus={web:!1,local:!1},this.lastZipBufferStatus=void 0,this.rendererStopped=!1,this.currentPeriod=null,this.selectedPlayerId=null,this.setWebGLEventListeners=()=>{const t=this.glContext.canvas;t.addEventListener("webglcontextlost",i=>{console.warn("Context lost:",i),i.preventDefault()}),t.addEventListener("webglcontextrestored",()=>{console.log("Context restored!"),this.webgl=new as(this,this.options),this.ads=new As(this.webgl,this.options),this.webgl.init(),this.reusableAlphaTex=null,this.videoFrameTexture=null,this.updateStatusOverlay()})},this.addMetadataBatch=t=>{if(this.rendererStopped){t.forEach(i=>{if(i.alphaMask)try{i.alphaMask.close()}catch{}});return}t.forEach(i=>{var a,A,c;const o=(A=(a=i.gameMetaData)==null?void 0:a.pointers)==null?void 0:A.players,n=o&&o.length>0;if(!(!i.alphaMask&&!n)){this.options&&g(this.options,"Renderer")&&console.log(`[RendererWorker] Storing bitmap for timeCode=${i.timecode}`);try{const l=i.timecode,d={width:i.processingWidth,height:i.processingHeight},u=i.placeholders??{},h={alphaMask:i.alphaMask,placeholders:u,processingSize:d,isLive:i.isLive,period:i.period,players:n?o:void 0},f=i.LED;if(f&&(h.led={cubePlaceholders:f.cubePlaceholders,intrinsics:f.intrinsics,distortion:f.distortion,referenceSize:f.referenceSize,modelVersion:f.modelVersion??((c=f.model)==null?void 0:c.version)},f.model&&(f.model.LedModelSPH||f.model.LedModel)))try{this.webgl.updateLEDCubesFromModel(f.model,h.led.modelVersion)}catch{}this.renderDataMap.set(l,h),U.setAttributes({last_webgl_uploaded_frame:l})}catch{if(i.alphaMask)try{i.alphaMask.close()}catch{}this.options&&g(this.options,"Errors")&&console.error(`[RendererWorker] Error storing bitmap for timeCode=${i.timecode}`)}}})},this.handleBurnedFrameRender=(t,i)=>{var o;if(!this.streamData||!((o=this.ads)!=null&&o.ads)){t.close();return}try{this.videoFrameTexture&&this.webgl.deleteTexture(this.videoFrameTexture),this.videoFrameTexture=this.webgl.createTextureFromImageBitmap(t);const n=this.renderDataMap.get(i);if(n&&n.period&&this.ads&&this.currentPeriod!==n.period&&(this.currentPeriod=n.period,this.ads.updatePeriod(n.period)),this.webgl.drawVideoFrameBase(this.videoFrameTexture),n){const a=n.alphaMask?this.uploadAlphaMask(n.alphaMask):void 0;a&&this.webgl.drawAugmentation(a,n.placeholders,n.processingSize,1,!1,this.options.DRAW_TIMESTAMP_WEBGL?i:void 0);const A=this.getSelectedPlayerCircle(n);if(A){const c=this.options.MASK_TYPE==="mp4";this.webgl.drawPlayerOverlay(a,A,n.processingSize,c)}this.shot&&(this.shot.frameCount++,this.shot.lastProcessingTime=performance.now())}this.deleteOldRenderData(i),U.setAttributes({last_rendered_frame:i,renderer_state:this.state,has_augmentation:!!n,burned_timecode_mode:!0})}catch(n){U.error(`[Renderer] Error rendering burned frame for timeCode=${i}`,{error:n}),this.options&&g(this.options,"Errors")&&console.error("[Renderer] Error rendering burned frame:",n)}finally{t.close()}},this.handleBurnedFrameRenderWithLED=(t,i)=>{var o;if(this.rendererStopped){try{t.close()}catch{}return}if(!this.streamData||!((o=this.ads)!=null&&o.ads)){t.close();return}try{this.videoFrameTexture&&this.webgl.deleteTexture(this.videoFrameTexture),this.videoFrameTexture=this.webgl.createTextureFromImageBitmap(t);const n=this.renderDataMap.get(i);if(n&&n.period&&this.ads&&this.currentPeriod!==n.period&&(this.currentPeriod=n.period,this.ads.updatePeriod(n.period)),this.webgl.drawVideoFrameBase(this.videoFrameTexture),n){const a=n.alphaMask?this.uploadAlphaMask(n.alphaMask):void 0;n.led&&a&&this.webgl.drawLEDOverlayOnTop(a,n.led,i),a&&(n.placeholders&&Object.keys(n.placeholders).length>0)&&this.webgl.drawAugmentation(a,n.placeholders,n.processingSize,1,!1,this.options.DRAW_TIMESTAMP_WEBGL?i:void 0);const A=this.getSelectedPlayerCircle(n);if(A){const c=this.options.MASK_TYPE==="mp4";this.webgl.drawPlayerOverlay(a,A,n.processingSize,c)}this.shot&&(this.shot.frameCount++,this.shot.lastProcessingTime=performance.now())}this.deleteOldRenderData(i),U.setAttributes({last_rendered_frame:i,renderer_state:this.state,has_augmentation:!!n,has_led:!!(n!=null&&n.led),burned_timecode_mode:!0})}catch(n){U.error(`[Renderer] Error rendering burned frame with LED for timeCode=${i}`,{error:n}),this.options&&g(this.options,"Errors")&&console.error("[Renderer] Error rendering burned frame with LED:",n)}finally{t.close()}},this.handleRenderDraw=(t,i)=>{var m,b,S,p,y,R,C,P;if(this.rendererStopped||!this.streamData||!((m=this.ads)!=null&&m.ads))return;const o=this.renderDataMap.get(t);o&&o.period&&this.ads&&this.currentPeriod!==o.period&&(this.currentPeriod=o.period,this.ads.updatePeriod(o.period)),!!o!==this.isRenderData&&(o?(this.shot&&this.finalizeShot(this.shot,t),this.shot={shotId:crypto.randomUUID(),adURL:((S=(b=this.ads)==null?void 0:b.defaultAd)==null?void 0:S.adUrl)||"",sumPercentOfScreen:0,sumPercentOfAd:0,frameCount:0,start:performance.now(),lastProcessingTime:performance.now()},U.info("didStartDrawingAugmentationMedia",{timecode:t,adID:this.shot.shotId,adURL:this.shot.adURL})):this.shot&&this.finalizeShot(this.shot,t),this.isRenderData=!!o);const n=o?o.isLive:!1,a=!this.zipBufferStatus||this.zipBufferStatus.isReady,A=((p=this.zipBufferStatus)==null?void 0:p.needsFadeout)||!1,c=n&&!A&&!!this.ottActions&&(this.ottActions.toggle[this.streamData.customerId]!==void 0?this.ottActions.toggle[this.streamData.customerId]&&this.ottActions.toggle.web:this.ottActions.toggle.web)&&(this.ottActions.toggle.local!==void 0?this.ottActions.toggle.local:!0),l=((y=this.ottActions)==null?void 0:y.benchmarkPassed)??!1;if(!c||A||!l?(this.state==="ON"||this.state==="FADE_IN")&&(this.state="FADE_OUT"):a&&l&&(this.state==="OFF"||this.state==="FADE_OUT")&&(this.state="FADE_IN"),this.state==="FADE_IN"?(this.opacity===0&&(this.lastStateUpdate=performance.now(),this.opacity=.001),this.opacity=Math.min(1,this.opacity+(performance.now()-this.lastStateUpdate)/this.stateUpdateInterval),this.lastStateUpdate=performance.now(),this.opacity===1&&(this.state="ON")):this.state==="FADE_OUT"&&(this.opacity===1&&(this.lastStateUpdate=performance.now(),this.opacity=.999),this.opacity=Math.max(0,this.opacity-(performance.now()-this.lastStateUpdate)/this.stateUpdateInterval),this.lastStateUpdate=performance.now(),this.opacity===0&&(this.state="OFF")),!o)return;const d=o.placeholders,u=o.processingSize;if(!u)return;if((this.glContext.canvas.width!==u.width||this.glContext.canvas.height!==u.height)&&(this.glContext.canvas.width=u.width,this.glContext.canvas.height=u.height),i!=0)if(i>0){const E=z.fromStr(t).addFrames(1,this.streamData.fps),w=(R=this.renderDataMap.get(z.toStr(E)))==null?void 0:R.placeholders;w&&Object.keys(w).forEach(B=>{B in d&&(d[B].tranform=d[B].tranform.map((W,J)=>W*(1-i)+w[B].tranform[J]*i))})}else{const E=Math.abs(i),w=z.fromStr(t).subtractFrames(1,this.streamData.fps),B=(C=this.renderDataMap.get(z.toStr(w)))==null?void 0:C.placeholders;B&&Object.keys(B).forEach(W=>{W in d&&(d[W].tranform=d[W].tranform.map((J,ne)=>B[W].tranform[ne]*(1-E)+J*E))})}this.options&&g(this.options,"Renderer")&&console.log(`[Renderer] Render logic: binding texture for ${t}`),U.setAttributes({last_rendered_frame:t,renderer_state:this.state}),this.updateStatusOverlay();const h=o.alphaMask?this.uploadAlphaMask(o.alphaMask):void 0;if(h)this.webgl.drawAugmentationWithLED(h,d,u,this.opacity,o.led,this.options.DRAW_TIMESTAMP_WEBGL?t:void 0);else{const E=this.glContext;E.bindFramebuffer(E.FRAMEBUFFER,null),E.viewport(0,0,E.canvas.width,E.canvas.height),E.clearColor(0,0,0,0),E.clear(E.COLOR_BUFFER_BIT)}const f=this.getSelectedPlayerCircle(o);if(f){const E=this.options.MASK_TYPE==="mp4";this.webgl.drawPlayerOverlay(h,f,u,E)}if(this.options&&((P=this.options.debug)!=null&&P.trackPerformance)){const E=performance.now();E-this.lastPerformanceCheck>=this.options.PERFORMANCE_TRACKING_INTERVAL&&(this.trackPerformance(),this.lastPerformanceCheck=E)}},this.handleRenderClear=()=>{this.rendererStopped||(console.log("handleRenderClear"),this.opacity=0,this.state="OFF")},this.handlePlayerClick=t=>{if(!this.streamData||!this.streamData.timeCode)return!1;const i=this.streamData.timeCode,o=this.renderDataMap.get(i);if(!o||!o.players||!o.processingSize)return!1;const n=Ca(t,o.players,o.processingSize);return n?(this.selectedPlayerId===n.id?this.selectedPlayerId=null:this.selectedPlayerId=n.id,!0):(this.selectedPlayerId=null,!1)},this.getAdURLByCoord=t=>{var A,c;if(!this.ads||!this.streamData||!this.streamData.timeCode||!this.renderDataMap)return null;const i=this.streamData.timeCode,o=(A=this.renderDataMap.get(i))==null?void 0:A.placeholders,n=(c=this.renderDataMap.get(i))==null?void 0:c.processingSize;if(!o||!n)return null;console.log("placeholders: ",o);const a=this.ads.getAdURLAtCoord(o,n,t);return console.log("url: ",a),a},this.deleteRenderData=t=>{const i=this.renderDataMap.get(t);if(i){if(i.alphaMask)try{i.alphaMask.close()}catch{}this.renderDataMap.delete(t)}},this.deleteOldRenderData=t=>{if(!this.streamData)return;const i=59.94,o=z.fromStr(t).totalMilliseconds(i);this.renderDataMap.forEach((n,a)=>{if(z.fromStr(a).totalMilliseconds(i)<o-100){if(this.options&&g(this.options,"Renderer")&&console.log(`[Renderer] Deleting old render data for timeCode=${a}`),n.alphaMask)try{n.alphaMask.close()}catch{}this.renderDataMap.delete(a)}})},this.deleteAllRenderData=()=>{this.renderDataMap.forEach(t=>{if(t.alphaMask)try{t.alphaMask.close()}catch{}}),this.renderDataMap.clear()},this.cleanGL=()=>{this.webgl.cleanGL()},this.updateStreamData=t=>{this.streamData=t,this.updateStatusOverlay()},this.finalizeShot=(t,i)=>{t.end=t.lastProcessingTime,t.duration=t.end-t.start,U.info("didEndDrawingAugmentationMedia",{timecode:i,adID:t.shotId,adURL:t.adURL}),t.avaragePercentOfAd=t.sumPercentOfAd/t.frameCount,t.avaragePercentOfScreen=t.sumPercentOfScreen/t.frameCount,U.info("didRegisterShot",{adID:t.shotId,adURL:t.adURL,avaragePercentOfScreen:t.avaragePercentOfScreen.toFixed(2),avaragePercentOfAd:t.avaragePercentOfAd.toFixed(2),frameCount:t.frameCount,duration:t.duration.toFixed(0)}),this.shot=void 0},this.trackPerformance=()=>{const t=this.webgl.getAvgGPUFrameTime(),i=this.webgl.getAvgCPUFrameTime();wa([{metric:"Rendering GPU time",value:t},{metric:"Rendering CPU time",value:i}],U.getMessagePort())},this.glContext=e,this.webgl=new as(this,r),this.options=r,this.ads=new As(this.webgl,r),this.rendererStopped=!1,this.webgl.init(),this.updateStatusOverlay()}isStopped(){return this.rendererStopped}uploadAlphaMask(e){return this.reusableAlphaTex?this.webgl.updateTextureFromImageBitmap(this.reusableAlphaTex,e):this.reusableAlphaTex=this.webgl.createTextureFromImageBitmap(e),this.reusableAlphaTex}setZipBufferStatus(e){this.zipBufferStatus=e,this.updateStatusOverlay()}updateStatusOverlay(){var A,c,l,d,u;const e=performance.now(),r=!this.statusInitialized;if(!r&&e-this.lastStatusUpdate<this.STATUS_UPDATE_INTERVAL)return;const t={ready:!!this.glContext&&!this.glContext.isContextLost()&&!!this.webgl,issue:(A=this.glContext)!=null&&A.isContextLost()?"Context Lost":""},i=(c=this.streamData)==null?void 0:c.timeCode,o=i?this.renderDataMap.get(i):void 0,n={stream_data:!!this.streamData,timecode:i||"",ads:((l=this.ads)==null?void 0:l.hasAds)??!1,render_data:!!o,alpha_mask:!!(o!=null&&o.alphaMask),placeholders:!!(o!=null&&o.placeholders),processing_size:!!(o!=null&&o.processingSize),isLive:(o==null?void 0:o.isLive)||!1},a={web:((d=this.ottActions)==null?void 0:d.toggle.web)!==!1,local:((u=this.ottActions)==null?void 0:u.toggle.local)!==!1};(r||JSON.stringify(t)!==JSON.stringify(this.lastWebGLStatus)||this.state!==this.lastRenderState||JSON.stringify(n)!==JSON.stringify(this.lastDataStatus)||JSON.stringify(a)!==JSON.stringify(this.lastKillswitchStatus)||JSON.stringify(this.zipBufferStatus)!==JSON.stringify(this.lastZipBufferStatus))&&(U.setAttributes({webgl_status:t,renderer_state:this.state,data_status:n,killswitch_status:a,zip_buffer_status:this.zipBufferStatus}),this.lastWebGLStatus=t,this.lastRenderState=this.state,this.lastDataStatus=n,this.lastKillswitchStatus=a,this.lastZipBufferStatus=this.zipBufferStatus,this.lastStatusUpdate=e,this.statusInitialized=!0)}getSelectedPlayerCircle(e){return this.selectedPlayerId===null||!e.players?null:e.players.find(r=>r.id===this.selectedPlayerId)??null}stop(){this.rendererStopped=!0,this.ads&&this.ads.pause(),this.cleanGL(),this.deleteAllRenderData(),this.videoFrameTexture&&(this.webgl.deleteTexture(this.videoFrameTexture),this.videoFrameTexture=null),this.reusableAlphaTex&&(this.webgl.deleteTexture(this.reusableAlphaTex),this.reusableAlphaTex=null)}}let ft=null,ht=null,cs=null,Te=null,oe=null,v=null,D,k,gt,ds=0,us=0,mt=null,pt,Et,Tt=null;self.onmessage=async s=>{var r,t,i,o,n,a,A,c,l,d,u,h,f,m,b,S,p,y;const{data:e}=s;if(e.type==="SET_LOGGER_PORT"&&(Te=e.port,U.setMessagePort(e.port)),e.type==="INIT_OFFSCREEN"){const R=e.offscreen;if(D=e.options,oe=R.getContext("webgl"),D&&g(D,"Renderer")&&console.log("[RendererWorker] Initializing OffscreenCanvas"),!oe||oe!=null&&oe.isContextLost()){U.error("[RendererWorker] Failed to acquire WebGL context"),D&&g(D,"Errors")&&console.error("[RendererWorker] Failed to acquire WebGL context");return}v=new ls(oe,D),D&&g(D,"Renderer")&&console.log("[RendererWorker] OffscreenCanvas initialized, gl context acquired"),Te?Te.postMessage({type:"RENDERER_READY"}):postMessage({type:"RENDERER_READY"}),(async()=>{var C,P,E,w;try{if(mt){const B=await createImageBitmap(mt);pt?(P=(C=v.ads)==null?void 0:C.overrideAdImageForPlaceholder)==null||P.call(C,B,pt,Et):(E=v.ads)==null||E.overrideAdImage(B,Et),mt=null,pt=void 0,Et=void 0}if(Tt){const B=await createImageBitmap(Tt);(w=v.ads)==null||w.overrideLEDImage(B),Tt=null}}catch(B){console.error("[RendererWorker] Failed to flush pending overrides",B)}})()}if(e.type==="SET_DOWNLOADER_PORT"&&(ft=e.port,ft.onmessage=Oa),e.type==="SET_DECODER_PORT"&&(ht=e.port,ht.onmessage=Ua),e.type==="SET_ADAPTER_PORT"&&(cs=e.port,cs.onmessage=Na),(e.type==="RENDERER_DRAW"||e.type==="RENDERER_CLEAR")&&fs(e),e.type==="BURNED_FRAME_RENDER"&&Pa(e),e.type==="VIDEO_CLICK"&&v&&!v.handlePlayerClick(e.clickData)){const C=v.getAdURLByCoord(e.clickData);postMessage({type:"OPEN_URL",url:C})}if(e.type==="STOP_WORKER"){v&&v.stop();return}if(e.type==="RESTART_WORKER"){if(!oe||!D)return;v&&v.stop(),v=new ls(oe,D),Te?Te.postMessage({type:"RENDERER_READY"}):postMessage({type:"RENDERER_READY"});return}if(e.type==="RESET_ADS"){if(!v)return;try{const R=e.placeholder;R?(D&&g(D,"Renderer")&&console.log(`[RendererWorker] RESET_ADS for placeholder: ${R}`),(r=v.ads)==null||r.resetPlaceholderToDefault(R)):(D&&g(D,"Renderer")&&console.log("[RendererWorker] RESET_ADS - resuming auto-refresh for all"),(t=v.ads)==null||t.resumeAutoRefresh())}catch(R){D&&g(D,"Errors")&&console.error("[RendererWorker] RESET_ADS failed",R)}return}if(e.type==="CLEAR_AD"){if(!v)return;try{const R=e.placeholder;D&&g(D,"Renderer")&&console.log("[RendererWorker] CLEAR_AD",R?`for ${R}`:"all"),R?(i=v.ads)==null||i.clearPlaceholder(R):(o=v.ads)==null||o.clearAllPlaceholders()}catch(R){D&&g(D,"Errors")&&console.error("[RendererWorker] CLEAR_AD failed",R)}return}if(e.type==="CLEAR_LED"){if(!v)return;try{D&&g(D,"Renderer")&&console.log("[RendererWorker] CLEAR_LED"),(n=v.ads)==null||n.clearLED()}catch(R){D&&g(D,"Errors")&&console.error("[RendererWorker] CLEAR_LED failed",R)}return}if(e.type==="SET_AD_IMAGE"){if(!v){try{(a=e.imageBitmap)==null||a.close()}catch{}return}try{e.placeholder?(c=(A=v.ads)==null?void 0:A.overrideAdImageForPlaceholder)==null||c.call(A,e.imageBitmap,e.placeholder,e.clickUrl):(l=v.ads)==null||l.overrideAdImage(e.imageBitmap,e.clickUrl)}catch{try{(d=e.imageBitmap)==null||d.close()}catch{}}return}if(e.type==="SET_LED_IMAGE"){if(!v){try{(u=e.imageBitmap)==null||u.close()}catch{}return}try{(h=v.ads)==null||h.overrideLEDImage(e.imageBitmap)}catch{try{(f=e.imageBitmap)==null||f.close()}catch{}}return}if(e.type==="SET_AD_BLOB"){if(!v){mt=e.blob,pt=e.placeholder,Et=e.clickUrl;return}try{const R=new Blob([await e.blob.arrayBuffer()],{type:e.blob.type||"image/png"}),C=await createImageBitmap(R);e.placeholder?(b=(m=v.ads)==null?void 0:m.overrideAdImageForPlaceholder)==null||b.call(m,C,e.placeholder,e.clickUrl):(S=v.ads)==null||S.overrideAdImage(C,e.clickUrl,e.isRestore)}catch(R){console.error("[RendererWorker] SET_AD_BLOB failed",R)}return}if(e.type==="SET_LED_BLOB"){if(!v){Tt=e.blob;return}try{D&&g(D,"Renderer")&&console.log("[RendererWorker] SET_LED_BLOB size",(p=e.blob)==null?void 0:p.size);const R=new Blob([await e.blob.arrayBuffer()],{type:e.blob.type||"image/png"}),C=await createImageBitmap(R);(y=v.ads)==null||y.overrideLEDImage(C)}catch(R){D&&g(D,"Errors")&&console.error("[RendererWorker] SET_LED_BLOB failed",R)}return}};function La(){!ft||!k||ft.postMessage({type:"DOWNLOADER_INPUT",streamData:k})}function Ba(){!ht||!k||ht.postMessage({type:"DECODER_REQUEST",timeCode:k.timeCode,fps:k.fps})}function wa(s,e){if(!Te&&!e)return;const r=Te||e,t={type:"TRACK_PERFORMANCE",data:s};r.postMessage(t)}function fs(s){!v||v.isStopped()||(k=s.streamData,v?(k&&(v.updateStreamData(k),k.ottActions&&(v.ottActions=k.ottActions)),v.cleanGL(),s.type==="RENDERER_CLEAR"&&v.handleRenderClear(),s.type==="RENDERER_DRAW"&&k&&(v.handleRenderDraw(k.timeCode,k.frameCorrection),v.deleteOldRenderData(k.timeCode)),hs()):D&&g(D,"Errors")&&console.error("[RendererWorker] WebGL context is not initialized."))}function Pa(s){if(!v||v.isStopped()){s.imageBitmap.close();return}k=s.streamData,v?(v.updateStreamData(k),k.ottActions&&(v.ottActions=k.ottActions),v.cleanGL(),v.handleBurnedFrameRenderWithLED(s.imageBitmap,s.timecode),hs()):(s.imageBitmap.close(),D&&g(D,"Errors")&&console.error("[RendererWorker] WebGL context not initialized for burned frame"))}function hs(){if(!D)return;const s=performance.now();s-ds>D.DOWNLOADER_UPDATE_FREQUENCY&&(La(),ds=s),s-us>D.DECODER_UPDATE_FREQUENCY&&(Ba(),us=s)}function Ua(s){if(!v||v.isStopped())return;const{data:e}=s;if(e.type==="RENDERER_INPUT"){const r=e.batch;D&&g(D,"Renderer")&&console.log(`[RendererWorker] Received a batch of ${r.length} frames`),v&&v.addMetadataBatch(r)}}function Oa(s){const{data:e}=s;if(e.type==="ZIP_BUFFER_STATUS"){gt=e.status,v&>&&v.setZipBufferStatus(gt),D&&g(D,"Renderer")&&console.log("[RendererWorker] Zip buffer status:",gt);return}k&&D&&g(D,"Renderer")&&console.log("[RendererWorker] Message from Downloader:",s.data)}function Na(s){const{data:e}=s;(e.type==="RENDERER_DRAW"||e.type==="RENDERER_CLEAR")&&fs(e)}self.onunhandledrejection=s=>{U.error("[RendererWorker] Unhandled rejection",{error:s.reason}),D&&(g(D,"Errors")&&console.error("[RendererWorker] Unhandled rejection:",s.reason),s.preventDefault())},self.onerror=s=>{U.error("[RendererWorker] Unhandled error",{error:s}),D&&(g(D,"Errors")&&console.error("[RendererWorker] Unhandled error:",s),s instanceof Event&&s.preventDefault())}})();\n',Yt=typeof self<"u"&&self.Blob&&new Blob([Qt],{type:"text/javascript;charset=utf-8"});function dn(t){let e;try{if(e=Yt&&(self.URL||self.webkitURL).createObjectURL(Yt),!e)throw"";const r=new Worker(e,{name:t==null?void 0:t.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Qt),{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const jt='(function(){"use strict";const x=(e,t)=>t==="Errors"?!0:!e.debug||!e.debug.on?!1:e.debug[`log${t}`],jn=e=>Math.abs(e-59.94005994005994)<20?59.94:Math.abs(e-29.97002997002997)<10?29.97:Math.abs(e-14.985014985014985)<8?14.98:0,w={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},I=console,z={};Object.keys(w).forEach(e=>{z[e]=I[e]});const fe="Datadog Browser SDK:",_={debug:z.debug.bind(I,fe),log:z.log.bind(I,fe),info:z.info.bind(I,fe),warn:z.warn.bind(I,fe),error:z.error.bind(I,fe)},Xe="https://docs.datadoghq.com",Lt=`${Xe}/real_user_monitoring/browser/troubleshooting`,Ce="More details:";function At(e,t){return(...n)=>{try{return e(...n)}catch(r){_.error(t,r)}}}function Oe(e){return e!==0&&Math.random()*100<=e}function Wn(e){return zn(e)&&e>=0&&e<=100}function zn(e){return typeof e=="number"}const pe=1e3,H=60*pe,kt=60*H,Hn=365*(24*kt);function me(){return new Date().getTime()}function $(){return me()}function Re(){return performance.now()}function U(){return{relative:Re(),timeStamp:$()}}function Kn(){return{relative:0,timeStamp:It()}}function Vn(e,t){return t-e}function qn(e,t){return e+t}function Yn(e){return e-It()}let Ze;function It(){return Ze===void 0&&(Ze=performance.timing.navigationStart),Ze}const M=1024,Mt=1024*M,Jn=/[^\\u0000-\\u007F]/;function Qe(e){return Jn.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function Xn(e){return{...e}}function Pt(e,t){return Object.keys(e).some(n=>e[n]===t)}function ge(e){return Object.keys(e).length===0}function B(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let e=_dd_temp_;return delete Object.prototype._dd_temp_,typeof e!="object"&&(typeof self=="object"?e=self:typeof window=="object"?e=window:e={}),e}function ne(e,t){const n=B();let r;return n.Zone&&typeof n.Zone.__symbol__=="function"&&(r=e[n.Zone.__symbol__(t)]),r||(r=e[t]),r}let xe,Dt=!1;function Zn(e){xe=e}function Qn(e){Dt=e}function er(e,t,n){const r=n.value;n.value=function(...o){return(xe?b(r):r).apply(this,o)}}function b(e){return function(){return he(e,this,arguments)}}function he(e,t,n){try{return e.apply(t,n)}catch(r){tr(r)}}function tr(e){if(et(e),xe)try{xe(e)}catch(t){et(t)}}function et(...e){Dt&&_.error("[MONITOR]",...e)}function Se(e,t){return ne(B(),"setTimeout")(b(e),t)}function Nt(e){ne(B(),"clearTimeout")(e)}function tt(e,t){return ne(B(),"setInterval")(b(e),t)}function Ft(e){ne(B(),"clearInterval")(e)}class v{constructor(t){this.onFirstSubscribe=t,this.observers=[]}subscribe(t){return this.observers.push(t),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(n=>t!==n),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(t){this.observers.forEach(n=>n(t))}}function $t(...e){return new v(t=>{const n=e.map(r=>r.subscribe(o=>t.notify(o)));return()=>n.forEach(r=>r.unsubscribe())})}function Ut(e,t,n){let r=!1,o,s;return{throttled:(...i)=>{if(r){o=i;return}e(...i),r=!0,s=Se(()=>{o&&e(...o),r=!1,o=void 0},t)},cancel:()=>{Nt(s),r=!1,o=void 0}}}function G(){}function j(e){return e?(parseInt(e,10)^Math.random()*16>>parseInt(e,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,j)}const Le=/([\\w-]+)\\s*=\\s*([^;]+)/g;function nr(e,t){for(Le.lastIndex=0;;){const n=Le.exec(e);if(n){if(n[1]===t)return n[2]}else break}}function rr(e){const t=new Map;for(Le.lastIndex=0;;){const n=Le.exec(e);if(n)t.set(n[1],n[2]);else break}return t}function or(e,t,n=""){const r=e.charCodeAt(t-1),s=r>=55296&&r<=56319?t+1:t;return e.length<=s?e:`${e.slice(0,s)}${n}`}function sr(){return ir()===0}let Ae;function ir(){return Ae??(Ae=ar())}function ar(e=window){var t;const n=e.navigator.userAgent;return e.chrome||/HeadlessChrome/.test(n)?0:((t=e.navigator.vendor)===null||t===void 0?void 0:t.indexOf("Apple"))===0||/safari/i.test(n)&&!/chrome|android/i.test(n)?1:2}function ye(e,t,n=0,r){const o=new Date;o.setTime(o.getTime()+n);const s=`expires=${o.toUTCString()}`,i=r&&r.crossSite?"none":"strict",a=r&&r.domain?`;domain=${r.domain}`:"",c=r&&r.secure?";secure":"",l=r&&r.partitioned?";partitioned":"";document.cookie=`${e}=${t};${s};path=/;samesite=${i}${a}${c}${l}`}function nt(e){return nr(document.cookie,e)}let rt;function K(e){return rt||(rt=rr(document.cookie)),rt.get(e)}function Bt(e,t){ye(e,"",0,t)}function cr(e){if(document.cookie===void 0||document.cookie===null)return!1;try{const t=`dd_cookie_test_${j()}`,n="test";ye(t,n,H,e);const r=nt(t)===n;return Bt(t,e),r}catch(t){return _.error(t),!1}}let ot;function ur(){if(ot===void 0){const e=`dd_site_test_${j()}`,t="test",n=window.location.hostname.split(".");let r=n.pop();for(;n.length&&!nt(e);)r=`${n.pop()}.${r}`,ye(e,t,pe,{domain:r});Bt(e,{domain:r}),ot=r}return ot}const re="_dd_s";function ke(e){return Object.values(e)}function lr(e){return Object.entries(e)}const st=4*kt,Gt=15*H,dr=Hn,be={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},jt=/^([a-zA-Z]+)=([a-z0-9-]+)$/,it="&";function fr(e){return!!e&&(e.indexOf(it)!==-1||jt.test(e))}const pr="1";function V(e,t){const n={isExpired:pr};return t.trackAnonymousUser&&(e!=null&&e.anonymousId?n.anonymousId=e==null?void 0:e.anonymousId:n.anonymousId=j()),n}function Ie(e){return ge(e)}function Wt(e){return!Ie(e)}function Me(e){return e.isExpired!==void 0||!mr(e)}function mr(e){return(e.created===void 0||me()-Number(e.created)<st)&&(e.expire===void 0||me()<Number(e.expire))}function zt(e){e.expire=String(me()+Gt)}function at(e){return lr(e).map(([t,n])=>t==="anonymousId"?`aid=${n}`:`${t}=${n}`).join(it)}function Ht(e){const t={};return fr(e)&&e.split(it).forEach(n=>{const r=jt.exec(n);if(r!==null){const[,o,s]=r;o==="aid"?t.anonymousId=s:t[o]=s}}),t}const gr="_dd",hr="_dd_r",Sr="_dd_l",yr="rum",br="logs";function Er(e){if(!K(re)){const n=K(gr),r=K(hr),o=K(Sr),s={};n&&(s.id=n),o&&/^[01]$/.test(o)&&(s[br]=o),r&&/^[012]$/.test(r)&&(s[yr]=r),Wt(s)&&(zt(s),e.persistSession(s))}}function Kt(e){const t=Cr(e);return cr(t)?{type:be.COOKIE,cookieOptions:t}:void 0}function Tr(e,t){const n={isLockEnabled:sr(),persistSession:wr(t),retrieveSession:vr,expireSession:r=>_r(t,r,e)};return Er(n),n}function wr(e){return t=>{ye(re,at(t),Gt,e)}}function _r(e,t,n){const r=V(t,n);ye(re,at(r),n.trackAnonymousUser?dr:st,e)}function vr(){const e=nt(re);return Ht(e)}function Cr(e){const t={};return t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=ur()),t}const Or="_dd_test_";function Vt(){try{const e=j(),t=`${Or}${e}`;localStorage.setItem(t,e);const n=localStorage.getItem(t);return localStorage.removeItem(t),e===n?{type:be.LOCAL_STORAGE}:void 0}catch{return}}function Rr(e){return{isLockEnabled:!1,persistSession:qt,retrieveSession:xr,expireSession:t=>Lr(t,e)}}function qt(e){localStorage.setItem(re,at(e))}function xr(){const e=localStorage.getItem(re);return Ht(e)}function Lr(e,t){qt(V(e,t))}const Ar=10,kr=100,Yt=[];let Pe;function q(e,t,n=0){var r;const{isLockEnabled:o,persistSession:s,expireSession:i}=t,a=f=>s({...f,lock:l}),c=()=>{const f=t.retrieveSession(),h=f.lock;return f.lock&&delete f.lock,{session:f,lock:h}};if(Pe||(Pe=e),e!==Pe){Yt.push(e);return}if(o&&n>=kr){Jt(t);return}let l,u=c();if(o){if(u.lock){De(e,t,n);return}if(l=j(),a(u.session),u=c(),u.lock!==l){De(e,t,n);return}}let d=e.process(u.session);if(o&&(u=c(),u.lock!==l)){De(e,t,n);return}if(d&&(Me(d)?i(d):(zt(d),o?a(d):s(d))),o&&!(d&&Me(d))){if(u=c(),u.lock!==l){De(e,t,n);return}s(u.session),d=u.session}(r=e.after)===null||r===void 0||r.call(e,d||u.session),Jt(t)}function De(e,t,n){Se(()=>{q(e,t,n+1)},Ar)}function Jt(e){Pe=void 0;const t=Yt.shift();t&&q(t,e)}const Xt=pe;function Ir(e){switch(e.sessionPersistence){case be.COOKIE:return Kt(e);case be.LOCAL_STORAGE:return Vt();case void 0:{let t=Kt(e);return!t&&e.allowFallbackToLocalStorage&&(t=Vt()),t}default:_.error(`Invalid session persistence \'${String(e.sessionPersistence)}\'`)}}function Mr(e,t,n,r){const o=new v,s=new v,i=new v,a=e.type===be.COOKIE?Tr(t,e.cookieOptions):Rr(t),{expireSession:c}=a,l=tt(g,Xt);let u;m();const{throttled:d,cancel:f}=Ut(()=>{q({process:y=>{if(Ie(y))return;const de=E(y);return O(de),de},after:y=>{Wt(y)&&!R()&&Bn(y),u=y}},a)},Xt);function h(){q({process:y=>R()?E(y):void 0},a)}function g(){q({process:y=>Me(y)?V(y,t):void 0,after:E},a)}function E(y){return Me(y)&&(y=V(y,t)),R()&&(F(y)?le():(i.notify({previousState:u,newState:y}),u=y)),y}function m(){q({process:y=>{if(Ie(y))return V(y,t)},after:y=>{u=y}},a)}function O(y){if(Ie(y))return!1;const{trackingType:de,isTracked:Gi}=r(y[n]);y[n]=de,delete y.isExpired,Gi&&!y.id&&(y.id=j(),y.created=String(me()))}function R(){return u[n]!==void 0}function F(y){return u.id!==y.id||u[n]!==y[n]}function le(){u=V(u,t),s.notify()}function Bn(y){u=y,o.notify()}function Gn(y){q({process:de=>({...de,...y}),after:E},a)}return{expandOrRenewSession:d,expandSession:h,getSession:()=>u,renewObservable:o,expireObservable:s,sessionStateUpdateObservable:i,restartSession:m,expire:()=>{f(),c(u),E(V(u,t))},stop:()=>{Ft(l)},updateSessionState:Gn}}const ct={GRANTED:"granted",NOT_GRANTED:"not-granted"};function Pr(e){const t=new v;return{tryToInit(n){e||(e=n)},update(n){e=n,t.notify()},isGranted(){return e===ct.GRANTED},observable:t}}function Y(e,t,n){if(typeof e!="object"||e===null)return JSON.stringify(e);const r=oe(Object.prototype),o=oe(Array.prototype),s=oe(Object.getPrototypeOf(e)),i=oe(e);try{return JSON.stringify(e,t,n)}catch{return"<error: unable to serialize object>"}finally{r(),o(),s(),i()}}function oe(e){const t=e,n=t.toJSON;return n?(delete t.toJSON,()=>{t.toJSON=n}):G}function ut(e){return Dr(e,location.href).href}function Dr(e,t){const n=Nr();if(n)try{return t!==void 0?new n(e,t):new n(e)}catch(s){throw new Error(`Failed to construct URL: ${String(s)} ${Y({url:e,base:t})}`)}if(t===void 0&&!/:/.test(e))throw new Error(`Invalid URL: \'${e}\'`);let r=document;const o=r.createElement("a");if(t!==void 0){r=document.implementation.createHTMLDocument("");const s=r.createElement("base");s.href=t,r.head.appendChild(s),r.body.appendChild(o)}return o.href=e,o}const Zt=URL;let Ne;function Nr(){if(Ne===void 0)try{Ne=new Zt("http://test/path").href==="http://test/path"}catch{Ne=!1}return Ne?Zt:void 0}const Fr="datad0g.com",$r="dd0g-gov.com",se="datadoghq.com",Ur="ddog-gov.com",Br="pci.browser-intake-datadoghq.com",Gr=["ddsource","ddtags"];function Ee(e,t,n){const r=jr(e,t);return{build(o,s){const i=zr(e,t,n,o,s);return r(i)},urlPrefix:r(""),trackType:t}}function jr(e,t){const n=`/api/v2/${t}`,r=e.proxy;if(typeof r=="string"){const s=ut(r);return i=>`${s}?ddforward=${encodeURIComponent(`${n}?${i}`)}`}if(typeof r=="function")return s=>r({path:n,parameters:s});const o=Wr(t,e);return s=>`https://${o}${n}?${s}`}function Wr(e,t){const{site:n=se,internalAnalyticsSubdomain:r}=t;if(e==="logs"&&t.usePciIntake&&n===se)return Br;if(r&&n===se)return`${r}.${se}`;if(n===$r)return`http-intake.logs.${n}`;const o=n.split("."),s=o.pop();return`browser-intake-${o.join("-")}.${s}`}function zr({clientToken:e,internalAnalyticsSubdomain:t},n,r,o,{retry:s,encoding:i}){const a=["sdk_version:6.5.0",`api:${o}`].concat(r);s&&a.push(`retry_count:${s.count}`,`retry_after:${s.lastFailureStatus}`);const c=["ddsource=browser",`ddtags=${encodeURIComponent(a.join(","))}`,`dd-api-key=${e}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${j()}`];return i&&c.push(`dd-evp-encoding=${i}`),n==="rum"&&c.push(`batch_time=${$()}`),t&&c.reverse(),c.join("&")}const Hr=200;function Kr(e){const{env:t,service:n,version:r,datacenter:o}=e,s=[];return t&&s.push(Fe("env",t)),n&&s.push(Fe("service",n)),r&&s.push(Fe("version",r)),o&&s.push(Fe("datacenter",o)),s}function Fe(e,t){const n=Hr-e.length-1;(t.length>n||Vr(t))&&_.warn(`${e} value doesn\'t meet tag requirements and will be sanitized. ${Ce} ${Xe}/getting_started/tagging/#defining-tags`);const r=t.replace(/,/g,"_");return`${e}:${r}`}function Vr(e){return qr()?new RegExp("[^\\\\p{Ll}\\\\p{Lo}0-9_:./-]","u").test(e):!1}function qr(){try{return new RegExp("[\\\\p{Ll}]","u"),!0}catch{return!1}}function Yr(e){const t=e.site||se,n=Kr(e),r=Jr(e,n);return{replica:Xr(e,n),site:t,...r}}function Jr(e,t){return{logsEndpointBuilder:Ee(e,"logs",t),rumEndpointBuilder:Ee(e,"rum",t),sessionReplayEndpointBuilder:Ee(e,"replay",t)}}function Xr(e,t){if(!e.replica)return;const n={...e,site:se,clientToken:e.replica.clientToken},r={logsEndpointBuilder:Ee(n,"logs",t),rumEndpointBuilder:Ee(n,"rum",t)};return{applicationId:e.replica.applicationId,...r}}function Zr(e){return Gr.every(t=>e.includes(t))}function lt(e,t){return e!=null&&typeof e!="string"?(_.error(`${t} must be defined as a string`),!1):!0}function Qr(e){return e&&typeof e=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(e)?(_.error(`Site should be a valid Datadog site. ${Ce} ${Xe}/getting_started/site/.`),!1):!0}function $e(e,t){return e!==void 0&&!Wn(e)?(_.error(`${t} Sample Rate should be a number between 0 and 100`),!1):!0}function eo(e){var t,n,r,o,s,i;if(!e||!e.clientToken){_.error("Client Token is not configured, we will not send any data.");return}if(!(!Qr(e.site)||!$e(e.sessionSampleRate,"Session")||!$e(e.telemetrySampleRate,"Telemetry")||!$e(e.telemetryConfigurationSampleRate,"Telemetry Configuration")||!$e(e.telemetryUsageSampleRate,"Telemetry Usage")||!lt(e.version,"Version")||!lt(e.env,"Env")||!lt(e.service,"Service"))){if(e.trackingConsent!==void 0&&!Pt(ct,e.trackingConsent)){_.error(\'Tracking Consent should be either "granted" or "not-granted"\');return}return{beforeSend:e.beforeSend&&At(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:Ir(e),sessionSampleRate:(t=e.sessionSampleRate)!==null&&t!==void 0?t:100,telemetrySampleRate:(n=e.telemetrySampleRate)!==null&&n!==void 0?n:20,telemetryConfigurationSampleRate:(r=e.telemetryConfigurationSampleRate)!==null&&r!==void 0?r:5,telemetryUsageSampleRate:(o=e.telemetryUsageSampleRate)!==null&&o!==void 0?o:5,service:e.service||void 0,silentMultipleInit:!!e.silentMultipleInit,allowUntrustedEvents:!!e.allowUntrustedEvents,trackingConsent:(s=e.trackingConsent)!==null&&s!==void 0?s:ct.GRANTED,trackAnonymousUser:(i=e.trackAnonymousUser)!==null&&i!==void 0?i:!0,storeContextsAcrossPages:!!e.storeContextsAcrossPages,batchBytesLimit:16*M,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*pe,batchMessagesLimit:50,messageBytesLimit:256*M,...Yr(e)}}}function to(e){return{session_sample_rate:e.sessionSampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:e.telemetryUsageSampleRate,use_before_send:!!e.beforeSend,use_partitioned_cross_site_session_cookie:e.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:!!e.proxy,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_anonymous_user:e.trackAnonymousUser,session_persistence:e.sessionPersistence,allow_fallback_to_local_storage:!!e.allowFallbackToLocalStorage,store_contexts_across_pages:!!e.storeContextsAcrossPages,allow_untrusted_events:!!e.allowUntrustedEvents,tracking_consent:e.trackingConsent}}var dt;(function(e){e.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",e.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(dt||(dt={}));const Qt=new Set;function no(e){Array.isArray(e)&&ro(e.filter(t=>Pt(dt,t)))}function ro(e){e.forEach(t=>{Qt.add(t)})}function oo(){return Qt}const Te="?";function P(e){const t=[];let n=ft(e,"stack");const r=String(e);return n&&n.startsWith(r)&&(n=n.slice(r.length)),n&&n.split(`\n`).forEach(o=>{const s=ao(o)||uo(o)||fo(o)||go(o);s&&(!s.func&&s.line&&(s.func=Te),t.push(s))}),{message:ft(e,"message"),name:ft(e,"name"),stack:t}}const en="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\\\w+\\\\.|\\\\/).*?)",ie="(?::(\\\\d+))",so=new RegExp(`^\\\\s*at (.*?) ?\\\\(${en}${ie}?${ie}?\\\\)?\\\\s*$`,"i"),io=new RegExp(`\\\\((\\\\S*)${ie}${ie}\\\\)`);function ao(e){const t=so.exec(e);if(!t)return;const n=t[2]&&t[2].indexOf("native")===0,r=t[2]&&t[2].indexOf("eval")===0,o=io.exec(t[2]);return r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]),{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||Te,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}const co=new RegExp(`^\\\\s*at ?${en}${ie}?${ie}??\\\\s*$`,"i");function uo(e){const t=co.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:Te,line:t[2]?+t[2]:void 0,url:t[1]}}const lo=/^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;function fo(e){const t=lo.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||Te,line:+t[3],url:t[2]}}const po=/^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i,mo=/(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;function go(e){const t=po.exec(e);if(!t)return;const n=t[3]&&t[3].indexOf(" > eval")>-1,r=mo.exec(t[3]);return n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0),{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||Te,line:t[4]?+t[4]:void 0,url:t[3]}}function ft(e,t){if(typeof e!="object"||!e||!(t in e))return;const n=e[t];return typeof n=="string"?n:void 0}function ho(e,t,n,r){const o=[{url:t,column:r,line:n}],{name:s,message:i}=yo(e);return{name:s,message:i,stack:o}}const So=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;function yo(e){let t,n;return{}.toString.call(e)==="[object String]"&&([,t,n]=So.exec(e)),{name:t,message:n}}function Ue(e){const n=new Error(e);n.name="HandlingStack";let r;return he(()=>{const o=P(n);o.stack=o.stack.slice(2),r=J(o)}),r}function J(e){let t=tn(e);return e.stack.forEach(n=>{const r=n.func==="?"?"<anonymous>":n.func,o=n.args&&n.args.length>0?`(${n.args.join(", ")})`:"",s=n.line?`:${n.line}`:"",i=n.line&&n.column?`:${n.column}`:"";t+=`\n at ${r}${o} @ ${n.url}${s}${i}`}),t}function tn(e){return`${e.name||"Error"}: ${e.message}`}function X(e,t,n,{computeHandlingStack:r}={}){let o=e[t];if(typeof o!="function")if(t in e&&t.startsWith("on"))o=G;else return{stop:G};let s=!1;const i=function(){if(s)return o.apply(this,arguments);const a=Array.from(arguments);let c;he(n,null,[{target:this,parameters:a,onPostCall:u=>{c=u},handlingStack:r?Ue("instrumented method"):void 0}]);const l=o.apply(this,a);return c&&he(c,null,[l]),l};return e[t]=i,{stop:()=>{s=!0,e[t]===i&&(e[t]=o)}}}const bo=220*M,Eo="$",To=3;function D(e,t=bo){const n=oe(Object.prototype),r=oe(Array.prototype),o=[],s=new WeakMap,i=pt(e,Eo,void 0,o,s),a=JSON.stringify(i);let c=a?a.length:0;if(c>t){gt(t,"discarded",e);return}for(;o.length>0&&c<t;){const l=o.shift();let u=0;if(Array.isArray(l.source))for(let d=0;d<l.source.length;d++){const f=pt(l.source[d],l.path,d,o,s);if(f!==void 0?c+=JSON.stringify(f).length:c+=4,c+=u,u=1,c>t){gt(t,"truncated",e);break}l.target[d]=f}else for(const d in l.source)if(Object.prototype.hasOwnProperty.call(l.source,d)){const f=pt(l.source[d],l.path,d,o,s);if(f!==void 0&&(c+=JSON.stringify(f).length+u+d.length+To,u=1),c>t){gt(t,"truncated",e);break}l.target[d]=f}}return n(),r(),i}function pt(e,t,n,r,o){const s=vo(e);if(!s||typeof s!="object")return wo(s);const i=mt(s);if(i!=="[Object]"&&i!=="[Array]"&&i!=="[Error]")return i;const a=e;if(o.has(a))return`[Reference seen at ${o.get(a)}]`;const c=n!==void 0?`${t}.${n}`:t,l=Array.isArray(s)?[]:{};return o.set(a,c),r.push({source:s,target:l,path:c}),l}function wo(e){return typeof e=="bigint"?`[BigInt] ${e.toString()}`:typeof e=="function"?`[Function] ${e.name||"unknown"}`:typeof e=="symbol"?`[Symbol] ${e.description||e.toString()}`:e}function mt(e){try{if(e instanceof Event)return _o(e);if(e instanceof RegExp)return`[RegExp] ${e.toString()}`;const n=Object.prototype.toString.call(e).match(/\\[object (.*)\\]/);if(n&&n[1])return`[${n[1]}]`}catch{}return"[Unserializable]"}function _o(e){return{type:e.type,isTrusted:e.isTrusted,currentTarget:e.currentTarget?mt(e.currentTarget):null,target:e.target?mt(e.target):null}}function vo(e){const t=e;if(t&&typeof t.toJSON=="function")try{return t.toJSON()}catch{}return e}function gt(e,t,n){_.warn(`The data provided has been ${t} as it is over the limit of ${e} characters:`,n)}const nn="No stack, consider using an instance of Error";function rn({stackTrace:e,originalError:t,handlingStack:n,componentStack:r,startClocks:o,nonErrorPrefix:s,source:i,handling:a}){const c=W(t),l=Co(e,c,s,t),u=Oo(c,e)?J(e):nn,d=c?an(t,i):void 0,f=e?e.name:void 0,h=on(t),g=sn(t);return{startClocks:o,source:i,handling:a,handlingStack:n,componentStack:r,originalError:t,type:f,message:l,stack:u,causes:d,fingerprint:h,context:g}}function Co(e,t,n,r){return e!=null&&e.message&&(e!=null&&e.name)?e.message:t?"Empty message":`${n} ${Y(D(r))}`}function Oo(e,t){return t===void 0?!1:e?!0:t.stack.length>0&&(t.stack.length>1||t.stack[0].url!==void 0)}function on(e){return W(e)&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function sn(e){if(e!==null&&typeof e=="object"&&"dd_context"in e)return e.dd_context}function Ro(e){var t;return(t=/@ (.+)/.exec(e))===null||t===void 0?void 0:t[1]}function W(e){return e instanceof Error||Object.prototype.toString.call(e)==="[object Error]"}function an(e,t){let n=e;const r=[];for(;W(n==null?void 0:n.cause)&&r.length<10;){const o=P(n.cause);r.push({message:n.cause.message,source:t,type:o==null?void 0:o.name,stack:J(o)}),n=n.cause}return r.length?r:void 0}const L={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function xo(e){const t=(o,s)=>{const i=rn({stackTrace:o,originalError:s,startClocks:U(),nonErrorPrefix:"Uncaught",source:L.SOURCE,handling:"unhandled"});e.notify(i)},{stop:n}=Lo(t),{stop:r}=Ao(t);return{stop:()=>{n(),r()}}}function Lo(e){return X(window,"onerror",({parameters:[t,n,r,o,s]})=>{let i;W(s)?i=P(s):i=ho(t,n,r,o),e(i,s??t)})}function Ao(e){return X(window,"onunhandledrejection",({parameters:[t]})=>{const n=t.reason||"Empty reason",r=P(n);e(r,n)})}function ko(e){const t={version:"6.5.0",onReady(n){n()},...e};return Object.defineProperty(t,"_setDebug",{get(){return Qn},enumerable:!1}),t}function Io(e,t,n){const r=e[t];r&&!r.q&&r.version&&_.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),e[t]=n,r&&r.q&&r.q.forEach(o=>At(o,"onReady callback threw an error:")())}function cn(e,t){t.silentMultipleInit||_.error(`${e} is already initialized.`)}function Z(e,t,n,r,o){return ht(e,t,[n],r,o)}function ht(e,t,n,r,{once:o,capture:s,passive:i}={}){const a=b(f=>{!f.isTrusted&&!f.__ddIsTrusted&&!e.allowUntrustedEvents||(o&&d(),r(f))}),c=i?{capture:s,passive:i}:s,l=window.EventTarget&&t instanceof EventTarget?window.EventTarget.prototype:t,u=ne(l,"addEventListener");n.forEach(f=>u.call(t,f,a,c));function d(){const f=ne(l,"removeEventListener");n.forEach(h=>f.call(t,h,a,c))}return{stop:d}}const Be={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function Mo(e,t){const n=[];t.includes(Be.cspViolation)&&n.push(Do(e));const r=t.filter(o=>o!==Be.cspViolation);return r.length&&n.push(Po(r)),$t(...n)}function Po(e){return new v(t=>{if(!window.ReportingObserver)return;const n=b((o,s)=>o.forEach(i=>t.notify(No(i)))),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),()=>{r.disconnect()}})}function Do(e){return new v(t=>{const{stop:n}=Z(e,document,"securitypolicyviolation",r=>{t.notify(Fo(r))});return n})}function No(e){const{type:t,body:n}=e;return un({type:n.id,message:`${t}: ${n.message}`,originalError:e,stack:ln(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)})}function Fo(e){const t=`\'${e.blockedURI}\' blocked by \'${e.effectiveDirective}\' directive`;return un({type:e.effectiveDirective,message:`${Be.cspViolation}: ${t}`,originalError:e,csp:{disposition:e.disposition},stack:ln(e.effectiveDirective,e.originalPolicy?`${t} of the policy "${or(e.originalPolicy,100,"...")}"`:"no policy",e.sourceFile,e.lineNumber,e.columnNumber)})}function un(e){return{startClocks:U(),source:L.REPORT,handling:"unhandled",...e}}function ln(e,t,n,r,o){return n?J({name:e,message:t,stack:[{func:"?",url:n,line:r??void 0,column:o??void 0}]}):void 0}function dn(e,t){const n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}function fn(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Ge(e,t,n=$o()){if(t===void 0)return e;if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,o)}if(n.hasAlreadyBeenSeen(t))return;if(Array.isArray(t)){const o=Array.isArray(e)?e:[];for(let s=0;s<t.length;++s)o[s]=Ge(o[s],t[s],n);return o}const r=fn(e)==="object"?e:{};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Ge(r[o],t[o],n));return r}function pn(e){return Ge(void 0,e)}function ae(...e){let t;for(const n of e)n!=null&&(t=Ge(t,n));return t}function $o(){if(typeof WeakSet<"u"){const t=new WeakSet;return{hasAlreadyBeenSeen(n){const r=t.has(n);return r||t.add(n),r}}}const e=[];return{hasAlreadyBeenSeen(t){const n=e.indexOf(t)>=0;return n||e.push(t),n}}}function Uo(){var e;const t=window.navigator;return{status:t.onLine?"connected":"not_connected",interfaces:t.connection&&t.connection.type?[t.connection.type]:void 0,effective_type:(e=t.connection)===null||e===void 0?void 0:e.effectiveType}}function Bo(e){const t=new Set;return e.forEach(n=>t.add(n)),Array.from(t)}function mn(e,t){const n=e.indexOf(t);n>=0&&e.splice(n,1)}const Go=500;function gn(){const e=[];return{add:o=>{e.push(o)>Go&&e.splice(0,1)},remove:o=>{mn(e,o)},drain:o=>{e.forEach(s=>s(o)),e.length=0}}}const Q={log:"log",configuration:"configuration",usage:"usage"},jo=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],Wo=[Ur];let hn=gn(),ce=e=>{hn.add(()=>ce(e))};function zo(e,t){let n;const r=new v,o=new Set,s=!Wo.includes(t.site)&&Oe(t.telemetrySampleRate),i={[Q.log]:s,[Q.configuration]:s&&Oe(t.telemetryConfigurationSampleRate),[Q.usage]:s&&Oe(t.telemetryUsageSampleRate)},a=Ho();ce=l=>{const u=Y(l);if(i[l.type]&&o.size<t.maxTelemetryEventsPerPage&&!o.has(u)){const d=c(e,l,a);r.notify(d),dn("telemetry",d),o.add(u)}},Zn(yn);function c(l,u,d){return ae({type:"telemetry",date:$(),service:l,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:ae(u,{runtime_env:d,connectivity:Uo(),sdk_setup:"npm"}),experimental_features:Array.from(oo())},n!==void 0?n():{})}return{setContextProvider:l=>{n=l},observable:r,enabled:s}}function Ho(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function Ko(){hn.drain()}function Vo(e){return e.site===Fr}function Sn(e,t){et(w.debug,e,t),ce({type:Q.log,message:e,status:"debug",...t})}function yn(e,t){ce({type:Q.log,status:"error",...Jo(e),...t})}function qo(e){ce({type:Q.configuration,configuration:e})}function Yo(e){ce({type:Q.usage,usage:e})}function Jo(e){if(W(e)){const t=P(e);return{error:{kind:t.name,stack:J(Xo(t))},message:t.message}}return{error:{stack:nn},message:`Uncaught ${Y(e)}`}}function Xo(e){return e.stack=e.stack.filter(t=>!t.url||jo.some(n=>t.url.startsWith(n))),e}const we=1/0,Zo=H;let _e=null;const je=new Set;function Qo(){je.forEach(e=>e())}function es({expireDelay:e,maxEntries:t}){let n=[];const r=[];_e||(_e=tt(()=>Qo(),Zo));const o=()=>{const h=Re()-e;for(;n.length>0&&n[n.length-1].endTime<h;){const g=n.pop();g&&r.push(g.startTime)}};je.add(o);function s(h,g){const E={value:h,startTime:g,endTime:we,remove:()=>{mn(n,E)},close:m=>{E.endTime=m}};return t&&n.length>=t&&n.pop(),n.unshift(E),E}function i(h=we,g={returnInactive:!1}){for(const E of n)if(E.startTime<=h){if(g.returnInactive||h<=E.endTime)return E.value;break}}function a(h){const g=n[0];g&&g.endTime===we&&g.close(h)}function c(h=we,g=0){const E=qn(h,g);return n.filter(m=>m.startTime<=E&&h<=m.endTime).map(m=>m.value)}function l(){return n.map(({startTime:h,endTime:g,value:E})=>({startTime:h,endTime:g===we?"Infinity":g,value:E}))}function u(){return r}function d(){n=[]}function f(){je.delete(o),je.size===0&&_e&&(Ft(_e),_e=null)}return{add:s,find:i,closeActive:a,findAll:c,reset:d,stop:f,getAllEntries:l,getDeletedEntries:u}}const ts=H,ns=st;function rs(e,t,n,r){const o=new v,s=new v,i=Mr(e.sessionStoreStrategyType,e,t,n),a=es({expireDelay:ns});i.renewObservable.subscribe(()=>{a.add(c(),Re()),o.notify()}),i.expireObservable.subscribe(()=>{s.notify(),a.closeActive(Re())}),i.expandOrRenewSession(),a.add(c(),Kn().relative),r.observable.subscribe(()=>{r.isGranted()?i.expandOrRenewSession():i.expire()}),os(e,()=>{r.isGranted()&&i.expandOrRenewSession()}),ss(e,()=>i.expandSession()),is(e,()=>i.restartSession());function c(){return{id:i.getSession().id,trackingType:i.getSession()[t],isReplayForced:!!i.getSession().forcedReplay,anonymousId:i.getSession().anonymousId}}return{findSession:(l,u)=>a.find(l,u),renewObservable:o,expireObservable:s,sessionStateUpdateObservable:i.sessionStateUpdateObservable,expire:i.expire,updateSessionState:i.updateSessionState}}function os(e,t){ht(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function ss(e,t){const n=()=>{document.visibilityState==="visible"&&t()};Z(e,document,"visibilitychange",n),tt(n,ts)}function is(e,t){Z(e,window,"resume",t,{capture:!0})}function bn(e){return e>=500}function as(e){try{return e.clone()}catch{return}}const cs=80*M,us=32,En=3*Mt,ls=H,Tn=pe;function wn(e,t,n,r,o){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?vn(e,t,n,{onSuccess:()=>Cn(0,t,n,r,o),onFailure:()=>{t.queuedPayloads.enqueue(e),_n(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function _n(e,t,n,r){e.transportStatus===2&&Se(()=>{const o=e.queuedPayloads.first();vn(o,e,t,{onSuccess:()=>{e.queuedPayloads.dequeue(),e.currentBackoffTime=Tn,Cn(1,e,t,n,r)},onFailure:()=>{e.currentBackoffTime=Math.min(ls,e.currentBackoffTime*2),_n(e,t,n,r)}})},e.currentBackoffTime)}function vn(e,t,n,{onSuccess:r,onFailure:o}){t.bandwidthMonitor.add(e),n(e,s=>{t.bandwidthMonitor.remove(e),ds(s)?(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:s.status},o()):(t.transportStatus=0,r())})}function Cn(e,t,n,r,o){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:`Reached max ${r} events size queued for upload: ${En/Mt}MiB`,source:L.AGENT,startClocks:U()}),t.queueFullReported=!0);const s=t.queuedPayloads;for(t.queuedPayloads=On();s.size()>0;)wn(s.dequeue(),t,n,r,o)}function ds(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||bn(e.status))}function fs(){return{transportStatus:0,currentBackoffTime:Tn,bandwidthMonitor:ps(),queuedPayloads:On(),queueFullReported:!1}}function On(){const e=[];return{bytesCount:0,enqueue(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first(){return e[0]},dequeue(){const t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size(){return e.length},isFull(){return this.bytesCount>=En}}}function ps(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=cs&&this.ongoingRequestCount<us},add(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}}}function ms(e,t,n){const r=fs(),o=(s,i)=>Ss(e,t,s,i);return{send:s=>{wn(s,r,o,e.trackType,n)},sendOnExit:s=>{gs(e,t,s)}}}function gs(e,t,n){if(!!navigator.sendBeacon&&n.bytesCount<t)try{const s=e.build("beacon",n);if(navigator.sendBeacon(s,n.data))return}catch(s){hs(s)}const o=e.build("xhr",n);St(o,n.data)}let Rn=!1;function hs(e){Rn||(Rn=!0,yn(e))}function Ss(e,t,n,r){if(ys()&&n.bytesCount<t){const s=e.build("fetch",n);fetch(s,{method:"POST",body:n.data,keepalive:!0,mode:"cors"}).then(b(i=>r==null?void 0:r({status:i.status,type:i.type})),b(()=>{const i=e.build("xhr",n);St(i,n.data,r)}))}else{const s=e.build("xhr",n);St(s,n.data,r)}}function ys(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function St(e,t,n){const r=new XMLHttpRequest;r.open("POST",e,!0),t instanceof Blob&&r.setRequestHeader("Content-Type",t.type),Z({allowUntrustedEvents:!0},r,"loadend",()=>{n==null||n({status:r.status})},{once:!0}),r.send(t)}function yt(){const e=bs();if(e)return{getCapabilities(){var t;return JSON.parse(((t=e.getCapabilities)===null||t===void 0?void 0:t.call(e))||"[]")},getPrivacyLevel(){var t;return(t=e.getPrivacyLevel)===null||t===void 0?void 0:t.call(e)},getAllowedWebViewHosts(){return JSON.parse(e.getAllowedWebViewHosts())},send(t,n,r){const o=r?{id:r}:void 0;e.send(JSON.stringify({eventType:t,event:n,view:o}))}}}function We(e){var t;e===void 0&&(e=(t=B().location)===null||t===void 0?void 0:t.hostname);const n=yt();return!!n&&n.getAllowedWebViewHosts().some(r=>e===r||e.endsWith(`.${r}`))}function bs(){return B().DatadogEventBridge}const ze={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function Es(e){return new v(t=>{const{stop:n}=ht(e,window,["visibilitychange","freeze"],o=>{o.type==="visibilitychange"&&document.visibilityState==="hidden"?t.notify({reason:ze.HIDDEN}):o.type==="freeze"&&t.notify({reason:ze.FROZEN})},{capture:!0}),r=Z(e,window,"beforeunload",()=>{t.notify({reason:ze.UNLOADING})}).stop;return()=>{n(),r()}})}function Ts(e){return ke(ze).includes(e)}function ws({encoder:e,request:t,flushController:n,messageBytesLimit:r}){let o={};const s=n.flushObservable.subscribe(d=>u(d));function i(d,f,h){n.notifyBeforeAddMessage(f),h!==void 0?(o[h]=d,n.notifyAfterAddMessage()):e.write(e.isEmpty?d:`\n${d}`,g=>{n.notifyAfterAddMessage(g-f)})}function a(d){return d!==void 0&&o[d]!==void 0}function c(d){const f=o[d];delete o[d];const h=e.estimateEncodedBytesCount(f);n.notifyAfterRemoveMessage(h)}function l(d,f){const h=Y(d),g=e.estimateEncodedBytesCount(h);if(g>=r){_.warn(`Discarded a message whose size was bigger than the maximum allowed size ${r}KB. ${Ce} ${Lt}/#technical-limitations`);return}a(f)&&c(f),i(h,g,f)}function u(d){const f=ke(o).join(`\n`);o={};const h=Ts(d.reason),g=h?t.sendOnExit:t.send;if(h&&e.isAsync){const E=e.finishSync();E.outputBytesCount&&g(xn(E));const m=[E.pendingData,f].filter(Boolean).join(`\n`);m&&g({data:m,bytesCount:Qe(m)})}else f&&e.write(e.isEmpty?f:`\n${f}`),e.finish(E=>{g(xn(E))})}return{flushController:n,add:l,upsert:l,stop:s.unsubscribe}}function xn(e){let t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}function _s({messagesLimit:e,bytesLimit:t,durationLimit:n,pageExitObservable:r,sessionExpireObservable:o}){const s=r.subscribe(g=>u(g.reason)),i=o.subscribe(()=>u("session_expire")),a=new v(()=>()=>{s.unsubscribe(),i.unsubscribe()});let c=0,l=0;function u(g){if(l===0)return;const E=l,m=c;l=0,c=0,h(),a.notify({reason:g,messagesCount:E,bytesCount:m})}let d;function f(){d===void 0&&(d=Se(()=>{u("duration_limit")},n))}function h(){Nt(d),d=void 0}return{flushObservable:a,get messagesCount(){return l},notifyBeforeAddMessage(g){c+g>=t&&u("bytes_limit"),l+=1,c+=g,f()},notifyAfterAddMessage(g=0){c+=g,l>=e?u("messages_limit"):c>=t&&u("bytes_limit")},notifyAfterRemoveMessage(g){c-=g,l-=1,l===0&&h()}}}function Ln(e,t,n,r,o,s,i=ws){const a=l(e,t),c=n&&l(e,n);function l(u,{endpoint:d,encoder:f}){return i({encoder:f,request:ms(d,u.batchBytesLimit,r),flushController:_s({messagesLimit:u.batchMessagesLimit,bytesLimit:u.batchBytesLimit,durationLimit:u.flushTimeout,pageExitObservable:o,sessionExpireObservable:s}),messageBytesLimit:u.messageBytesLimit})}return{flushObservable:a.flushController.flushObservable,add(u,d=!0){a.add(u),c&&d&&c.add(n.transformMessage?n.transformMessage(u):u)},upsert:(u,d)=>{a.upsert(u,d),c&&c.upsert(n.transformMessage?n.transformMessage(u):u,d)},stop:()=>{a.stop(),c&&c.stop()}}}function He(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(n,r){const o=Qe(n);t+=o,e+=n,r&&r(o)},finish(n){n(this.finishSync())},finishSync(){const n={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,n},estimateEncodedBytesCount(n){return n.length}}}class vs{constructor(){this.callbacks={}}notify(t,n){const r=this.callbacks[t];r&&r.forEach(o=>o(n))}subscribe(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),{unsubscribe:()=>{this.callbacks[t]=this.callbacks[t].filter(r=>n!==r)}}}}function Cs(e,t,n){let r=0,o=!1;return{isLimitReached(){if(r===0&&Se(()=>{r=0},H),r+=1,r<=t||o)return o=!1,!1;if(r===t+1){o=!0;try{n({message:`Reached max number of ${e}s by minute: ${t}`,source:L.AGENT,startClocks:U()})}finally{o=!1}}return!0}}}let bt;const Et=new WeakMap;function Os(e){return bt||(bt=Rs(e)),bt}function Rs(e){return new v(t=>{const{stop:n}=X(XMLHttpRequest.prototype,"open",xs),{stop:r}=X(XMLHttpRequest.prototype,"send",s=>{Ls(s,e,t)},{computeHandlingStack:!0}),{stop:o}=X(XMLHttpRequest.prototype,"abort",As);return()=>{n(),r(),o()}})}function xs({target:e,parameters:[t,n]}){Et.set(e,{state:"open",method:String(t).toUpperCase(),url:ut(String(n))})}function Ls({target:e,handlingStack:t},n,r){const o=Et.get(e);if(!o)return;const s=o;s.state="start",s.startClocks=U(),s.isAborted=!1,s.xhr=e,s.handlingStack=t;let i=!1;const{stop:a}=X(e,"onreadystatechange",()=>{e.readyState===XMLHttpRequest.DONE&&c()}),c=()=>{if(l(),a(),i)return;i=!0;const u=o;u.state="complete",u.duration=Vn(s.startClocks.timeStamp,$()),u.status=e.status,r.notify(Xn(u))},{stop:l}=Z(n,e,"loadend",c);r.notify(s)}function As({target:e}){const t=Et.get(e);t&&(t.isAborted=!0)}let Tt;function An(){return Tt||(Tt=ks()),Tt}function ks(){return new v(e=>{if(!window.fetch)return;const{stop:t}=X(window,"fetch",n=>Is(n,e),{computeHandlingStack:!0});return t})}function Is({parameters:e,onPostCall:t,handlingStack:n},r){const[o,s]=e;let i=s&&s.method;i===void 0&&o instanceof Request&&(i=o.method);const a=i!==void 0?String(i).toUpperCase():"GET",c=o instanceof Request?o.url:ut(String(o)),l=U(),u={state:"start",init:s,input:o,method:a,startClocks:l,url:c,handlingStack:n};r.notify(u),e[0]=u.input,e[1]=u.init,t(d=>Ms(r,d,u))}function Ms(e,t,n){const r=n;function o(s){r.state="resolve",Object.assign(r,s),e.notify(r)}t.then(b(s=>{o({response:s,responseType:s.type,status:s.status,isAborted:!1})}),b(s=>{var i,a;o({status:0,isAborted:((a=(i=r.init)===null||i===void 0?void 0:i.signal)===null||a===void 0?void 0:a.aborted)||s instanceof DOMException&&s.code===DOMException.ABORT_ERR,error:s})}))}let wt={};function Ps(e){const t=e.map(n=>(wt[n]||(wt[n]=Ds(n)),wt[n]));return $t(...t)}function Ds(e){return new v(t=>{const n=I[e];return I[e]=(...r)=>{n.apply(console,r);const o=Ue("console error");he(()=>{t.notify(Ns(r,e,o))})},()=>{I[e]=n}})}function Ns(e,t,n){const r=e.map(s=>Fs(s)).join(" ");let o;if(t===w.error){const s=e.find(W);o={stack:s?J(P(s)):void 0,fingerprint:on(s),causes:s?an(s,"console"):void 0,startClocks:U(),message:r,source:L.CONSOLE,handling:"handled",handlingStack:n,context:sn(s)}}return{api:t,message:r,error:o,handlingStack:n}}function Fs(e){return typeof e=="string"?D(e):W(e)?tn(P(e)):Y(D(e),void 0,2)}function $s(e){const t=fn(e)==="object";return t||_.error("Unsupported context:",e),t}function _t(e,t,n){const r={...e};for(const[o,{required:s,type:i}]of Object.entries(t))i==="string"&&o in r&&(r[o]=String(r[o])),s&&!(o in e)&&_.warn(`The property ${o} of ${n} is required; context will not be sent to the intake.`);return r}function Ke(e="",{customerDataTracker:t,propertiesConfig:n={}}={}){let r={};const o=new v,s={getContext:()=>pn(r),setContext:i=>{$s(i)?(r=D(_t(i,n,e)),t==null||t.updateCustomerData(r)):s.clearContext(),o.notify()},setContextProperty:(i,a)=>{r=D(_t({...r,[i]:a},n,e)),t==null||t.updateCustomerData(r),o.notify()},removeContextProperty:i=>{delete r[i],t==null||t.updateCustomerData(r),_t(r,n,e),o.notify()},clearContext:()=>{r={},t==null||t.resetCustomerData(),o.notify()},changeObservable:o};return s}const Us="_dd_c",Bs=[];function vt(e,t,n,r){const o=Gs(n,r);Bs.push(Z(e,window,"storage",({key:l})=>{o===l&&i()})),t.changeObservable.subscribe(a);const s=ae(c(),t.getContext());ge(s)||t.setContext(s);function i(){t.setContext(c())}function a(){localStorage.setItem(o,JSON.stringify(t.getContext()))}function c(){const l=localStorage.getItem(o);return l?JSON.parse(l):{}}}function Gs(e,t){return`${Us}_${e}_${t}`}const js=3*M,Ws=16*M,zs=200;function Hs(e=2){const t=new Map;let n=!1;function r(o=0){if(n||e===0)return;const s=e===2?js:Ws;let i=o;t.forEach(a=>{i+=a.getBytesCount()}),i>s&&(Ks(s),n=!0)}return{createDetachedTracker:()=>{const o=kn(()=>r(o.getBytesCount()));return o},getOrCreateTracker:o=>(t.has(o)||t.set(o,kn(r)),t.get(o)),setCompressionStatus:o=>{e===0&&(e=o,r())},getCompressionStatus:()=>e,stop:()=>{t.forEach(o=>o.stop()),t.clear()}}}function kn(e){let t=0;const{throttled:n,cancel:r}=Ut(s=>{t=Qe(Y(s)),e()},zs),o=()=>{r(),t=0};return{updateCustomerData:s=>{ge(s)?o():n(s)},resetCustomerData:o,getBytesCount:()=>t,stop:()=>{r()}}}function Ks(e){_.warn(`Customer data exceeds the recommended ${e/M}KiB threshold. ${Ce} ${Lt}/#customer-data-exceeds-the-recommended-threshold-warning`)}function Vs(e,t,n){const r=e.getReader(),o=[];let s=0;i();function i(){r.read().then(b(c=>{if(c.done){a();return}o.push(c.value),s+=c.value.length,s>n.bytesLimit?a():i()}),b(c=>t(c)))}function a(){r.cancel().catch(G);let c,l;{let u;if(o.length===1)u=o[0];else{u=new Uint8Array(s);let d=0;o.forEach(f=>{u.set(f,d),d+=f.length})}c=u.slice(0,n.bytesLimit),l=u.length>n.bytesLimit}t(void 0,c,l)}}const qs="datadog-synthetics-public-id",Ys="datadog-synthetics-result-id",Js="datadog-synthetics-injects-rum";function In(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||K(Js))}function Xs(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||K(qs);return typeof e=="string"?e:void 0}function Zs(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||K(Ys);return typeof e=="string"?e:void 0}function Ve(e,t,n){const r=n.getHandler(),o=Array.isArray(r)?r:[r];return Mn[e]>=Mn[n.getLevel()]&&o.includes(t)}const S={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},Mn={[S.ok]:0,[S.debug]:1,[S.info]:2,[S.notice]:4,[S.warn]:5,[S.error]:6,[S.critical]:7,[S.alert]:8,[S.emerg]:9};function qe(e,{includeMessage:t=!1}={}){return{stack:e.stack,kind:e.type,message:t?e.message:void 0,causes:e.causes,fingerprint:e.fingerprint,handling:e.handling}}var Qs=function(e,t,n,r){var o=arguments.length,s=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};const ve={console:"console",http:"http",silent:"silent"},ei=Object.keys(S);let k=class{constructor(t,n,r,o=ve.http,s=S.debug,i={}){this.handleLogStrategy=t,this.handlerType=o,this.level=s,this.contextManager=Ke("logger",{customerDataTracker:n}),this.contextManager.setContext(i),r&&this.contextManager.setContextProperty("logger",{name:r})}logImplementation(t,n,r=S.info,o,s){const i=D(n);let a;if(o!=null){const c=rn({stackTrace:W(o)?P(o):void 0,originalError:o,nonErrorPrefix:"Provided",source:L.LOGGER,handling:"handled",startClocks:U()});a=ae({error:qe(c,{includeMessage:!0})},i)}else a=i;this.handleLogStrategy({message:D(t),context:a,status:r},this,s)}log(t,n,r=S.info,o){let s;Ve(r,ve.http,this)&&(s=Ue("log")),this.logImplementation(t,n,r,o,s)}setContext(t){this.contextManager.setContext(t)}getContext(){return this.contextManager.getContext()}setContextProperty(t,n){this.contextManager.setContextProperty(t,n)}removeContextProperty(t){this.contextManager.removeContextProperty(t)}clearContext(){this.contextManager.clearContext()}setHandler(t){this.handlerType=t}getHandler(){return this.handlerType}setLevel(t){this.level=t}getLevel(){return this.level}};Qs([er],k.prototype,"logImplementation",null),k.prototype.ok=N(S.ok),k.prototype.debug=N(S.debug),k.prototype.info=N(S.info),k.prototype.notice=N(S.notice),k.prototype.warn=N(S.warn),k.prototype.error=N(S.error),k.prototype.critical=N(S.critical),k.prototype.alert=N(S.alert),k.prototype.emerg=N(S.emerg);function N(e){return function(t,n,r){let o;Ve(e,ve.http,this)&&(o=Ue("log")),this.logImplementation(t,n,e,r,o)}}function ti(e,t,n){return{view:{referrer:document.referrer,url:window.location.href},context:e.getContext(),user:t.getContext(),account:n.getContext()}}const ni=32*M;function ri(e){e.usePciIntake===!0&&e.site&&e.site!=="datadoghq.com"&&_.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const t=eo(e),n=Pn(e.forwardConsoleLogs,ke(w),"Forward Console Logs"),r=Pn(e.forwardReports,ke(Be),"Forward Reports");if(!(!t||!n||!r))return e.forwardErrorsToLogs&&!n.includes(w.error)&&n.push(w.error),{forwardErrorsToLogs:e.forwardErrorsToLogs!==!1,forwardConsoleLogs:n,forwardReports:r,requestErrorResponseLengthLimit:ni,...t}}function Pn(e,t,n){if(e===void 0)return[];if(!(e==="all"||Array.isArray(e)&&e.every(r=>t.includes(r)))){_.error(`${n} should be "all" or an array with allowed values "${t.join(\'", "\')}"`);return}return e==="all"?t:Bo(e)}function oi(e){const t=to(e);return{forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports,use_pci_intake:e.usePciIntake,...t}}function si(e,t,n){const r=gn();let o,s;const i=t.observable.subscribe(a);function a(){if(!s||!o||!t.isGranted())return;i.unsubscribe();const c=n(o,s);r.drain(c)}return{init(c){if(!c){_.error("Missing configuration");return}if(no(c.enableExperimentalFeatures),We()&&(c=ii(c)),o=c,s){cn("DD_LOGS",c);return}const l=ri(c);l&&(s=l,An().subscribe(G),t.tryToInit(l.trackingConsent),a())},get initConfiguration(){return o},getInternalContext:G,handleLog(c,l,u,d=e(),f=$()){r.add(h=>h.handleLog(c,l,u,d,f))}}}function ii(e){return{...e,clientToken:"empty"}}const Ct="logs";function ai(e){const t=Hs(),n=Ke("global context",{customerDataTracker:t.getOrCreateTracker(2)}),r=Ke("user",{customerDataTracker:t.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),o=Ke("account",{customerDataTracker:t.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),s=Pr();function i(){return ti(n,r,o)}let a=si(i,s,(u,d)=>{u.storeContextsAcrossPages&&(vt(d,n,Ct,2),vt(d,r,Ct,1),vt(d,o,Ct,4));const f=e(u,d,i,s);return a=ci(u,f),f});const c={},l=new k((...u)=>a.handleLog(...u),t.createDetachedTracker());return ko({logger:l,init:b(u=>a.init(u)),setTrackingConsent:b(u=>{s.update(u),Yo({feature:"set-tracking-consent",tracking_consent:u})}),getGlobalContext:b(()=>n.getContext()),setGlobalContext:b(u=>n.setContext(u)),setGlobalContextProperty:b((u,d)=>n.setContextProperty(u,d)),removeGlobalContextProperty:b(u=>n.removeContextProperty(u)),clearGlobalContext:b(()=>n.clearContext()),createLogger:b((u,d={})=>(c[u]=new k((...f)=>a.handleLog(...f),t.createDetachedTracker(),D(u),d.handler,d.level,D(d.context)),c[u])),getLogger:b(u=>c[u]),getInitConfiguration:b(()=>pn(a.initConfiguration)),getInternalContext:b(u=>a.getInternalContext(u)),setUser:b(r.setContext),getUser:b(r.getContext),setUserProperty:b(r.setContextProperty),removeUserProperty:b(r.removeContextProperty),clearUser:b(r.clearContext),setAccount:b(o.setContext),getAccount:b(o.getContext),setAccountProperty:b(o.setContextProperty),removeAccountProperty:b(o.removeContextProperty),clearAccount:b(o.clearContext)})}function ci(e,t){return{init:n=>{cn("DD_LOGS",n)},initConfiguration:e,...t}}const ui="logs";function li(e,t){const n=rs(e,ui,r=>fi(e,r),t);return{findTrackedSession:(r,o={returnInactive:!1})=>{const s=n.findSession(r,o);return s&&s.trackingType==="1"?{id:s.id,anonymousId:s.anonymousId}:void 0},expireObservable:n.expireObservable}}function di(e){const n=Dn(e)==="1"?{}:void 0;return{findTrackedSession:()=>n,expireObservable:new v}}function Dn(e){return Oe(e.sessionSampleRate)?"1":"0"}function fi(e,t){const n=pi(t)?t:Dn(e);return{trackingType:n,isTracked:n==="1"}}function pi(e){return e==="0"||e==="1"}let Nn=!1;function Ye(e){const t=window;if(In()){const r=n(t.DD_RUM_SYNTHETICS);return!r&&!Nn&&(Nn=!0,Sn("Logs sent before RUM is injected by the synthetics worker",{testId:Xs(),resultId:Zs()})),r}return n(t.DD_RUM);function n(r){if(r&&r.getInternalContext)return r.getInternalContext(e)}}function mi(e,t,n,r,o){const s=ei.concat(["custom"]),i={};s.forEach(a=>{i[a]=Cs(a,t.eventRateLimiterThreshold,o)}),n.subscribe(0,({rawLogsEvent:a,messageContext:c=void 0,savedCommonContext:l=void 0,domainContext:u})=>{var d,f;const h=Yn(a.date),g=e.findTrackedSession(h);if(!e.findTrackedSession(h,{returnInactive:!0}))return;const m=l||r();let O;!ge(m.account)&&m.account.id&&(O=m.account),g&&g.anonymousId&&!m.user.anonymous_id&&(m.user.anonymous_id=g.anonymousId);const R=ae({service:t.service,session_id:g?g.id:void 0,session:g?{id:g.id}:void 0,usr:ge(m.user)?void 0:m.user,account:O,view:m.view},m.context,Ye(h),a,c);((d=t.beforeSend)===null||d===void 0?void 0:d.call(t,R,u))===!1||R.origin!==L.AGENT&&((f=i[R.status])!==null&&f!==void 0?f:i.custom).isLimitReached()||n.notify(1,R)})}const gi={[w.log]:S.info,[w.debug]:S.debug,[w.info]:S.info,[w.warn]:S.warn,[w.error]:S.error};function hi(e,t){const n=Ps(e.forwardConsoleLogs).subscribe(r=>{var o;const s={rawLogsEvent:{date:$(),message:r.message,origin:L.CONSOLE,error:r.error&&qe(r.error),status:gi[r.api]},messageContext:(o=r.error)===null||o===void 0?void 0:o.context,domainContext:{handlingStack:r.handlingStack}};t.notify(0,s)});return{stop:()=>{n.unsubscribe()}}}function Si(e,t){const n=Mo(e,e.forwardReports).subscribe(r=>{let o=r.message,s;const i=r.originalError.type==="deprecation"?S.warn:S.error;i===S.error?s=qe(r):r.stack&&(o+=` Found in ${Ro(r.stack)}`),t.notify(0,{rawLogsEvent:{date:$(),message:o,origin:L.REPORT,error:s,status:i}})});return{stop:()=>{n.unsubscribe()}}}function yi(e,t){if(!e.forwardErrorsToLogs)return{stop:G};const n=Os(e).subscribe(s=>{s.state==="complete"&&o("xhr",s)}),r=An().subscribe(s=>{s.state==="resolve"&&o("fetch",s)});function o(s,i){!Zr(i.url)&&(wi(i)||bn(i.status))&&("xhr"in i?bi(i.xhr,e,a):i.response?Ti(i.response,e,a):i.error&&Ei(i.error,e,a));function a(c){const l={isAborted:i.isAborted,handlingStack:i.handlingStack};t.notify(0,{rawLogsEvent:{message:`${_i(s)} error ${i.method} ${i.url}`,date:i.startClocks.timeStamp,error:{stack:c||"Failed to load",handling:void 0},http:{method:i.method,status_code:i.status,url:i.url},status:S.error,origin:L.NETWORK},domainContext:l})}}return{stop:()=>{n.unsubscribe(),r.unsubscribe()}}}function bi(e,t,n){typeof e.response=="string"?n(Ot(e.response,t)):n(e.response)}function Ei(e,t,n){n(Ot(J(P(e)),t))}function Ti(e,t,n){const r=as(e);!r||!r.body?n():window.TextDecoder?vi(r.body,t.requestErrorResponseLengthLimit,(o,s)=>{n(o?`Unable to retrieve response: ${o}`:s)}):r.text().then(b(o=>n(Ot(o,t))),b(o=>n(`Unable to retrieve response: ${o}`)))}function wi(e){return e.status===0&&e.responseType!=="opaque"}function Ot(e,t){return e.length>t.requestErrorResponseLengthLimit?`${e.substring(0,t.requestErrorResponseLengthLimit)}...`:e}function _i(e){return e==="xhr"?"XHR":"Fetch"}function vi(e,t,n){Vs(e,(r,o,s)=>{if(r)n(r);else{let i=new TextDecoder().decode(o);s&&(i+="..."),n(void 0,i)}},{bytesLimit:t,collectStreamBody:!0})}function Ci(e,t){if(!e.forwardErrorsToLogs)return{stop:G};const n=new v,{stop:r}=xo(n),o=n.subscribe(s=>{t.notify(0,{rawLogsEvent:{message:s.message,date:s.startClocks.timeStamp,error:qe(s),origin:L.SOURCE,status:S.error},messageContext:s.context})});return{stop:()=>{r(),o.unsubscribe()}}}const Oi=vs;function Ri(e){function t(n,r,o,s,i){const a=ae(r.getContext(),n.context);if(Ve(n.status,ve.console,r)&&Li(n,a),Ve(n.status,ve.http,r)){const c={rawLogsEvent:{date:i||$(),message:n.message,status:n.status,origin:L.LOGGER},messageContext:a,savedCommonContext:s};o&&(c.domainContext={handlingStack:o}),e.notify(0,c)}}return{handleLog:t}}const xi={[S.ok]:w.debug,[S.debug]:w.debug,[S.info]:w.info,[S.notice]:w.info,[S.warn]:w.warn,[S.error]:w.error,[S.critical]:w.error,[S.alert]:w.error,[S.emerg]:w.error};function Li({status:e,message:t},n){z[xi[e]].call(I,t,n)}function Ai(e,t,n,r,o){const s=Ln(e,{endpoint:e.logsEndpointBuilder,encoder:He()},e.replica&&{endpoint:e.replica.logsEndpointBuilder,encoder:He()},n,r,o.expireObservable);return t.subscribe(1,i=>{s.add(i)}),s}function ki(e){const t=yt();e.subscribe(1,n=>{t.send("log",n)})}function Ii(e){return{get:t=>{const n=e.findTrackedSession(t);if(n)return{session_id:n.id}}}}function Mi(e){return t=>{e.notify(0,{rawLogsEvent:{message:t.message,date:t.startClocks.timeStamp,origin:L.AGENT,status:S.error}}),Sn("Error reported to customer",{"error.message":t.message})}}function Pi(e,t,n,r,o){const s=zo("browser-logs-sdk",t);s.setContextProvider(()=>{var a,c,l,u,d,f;return{application:{id:(a=Ye())===null||a===void 0?void 0:a.application_id},session:{id:(c=o.findTrackedSession())===null||c===void 0?void 0:c.id},view:{id:(u=(l=Ye())===null||l===void 0?void 0:l.view)===null||u===void 0?void 0:u.id},action:{id:(f=(d=Ye())===null||d===void 0?void 0:d.user_action)===null||f===void 0?void 0:f.id}}});const i=[];if(We()){const a=yt(),c=s.observable.subscribe(l=>a.send("internal_telemetry",l));i.push(()=>c.unsubscribe())}else{const a=Ln(t,{endpoint:t.rumEndpointBuilder,encoder:He()},t.replica&&{endpoint:t.replica.rumEndpointBuilder,encoder:He()},n,r,o.expireObservable);i.push(()=>a.stop());const c=s.observable.subscribe(l=>a.add(l,Vo(t)));i.push(()=>c.unsubscribe())}return Ko(),qo(oi(e)),{telemetry:s,stop:()=>{i.forEach(a=>a())}}}function Di(e,t,n,r){const o=new Oi,s=[];o.subscribe(1,f=>dn("logs",f));const i=Mi(o),a=Es(t),c=t.sessionStoreStrategyType&&!We()&&!In()?li(t,r):di(t),{stop:l}=Pi(e,t,i,a,c);s.push(()=>l()),yi(t,o),Ci(t,o),hi(t,o),Si(t,o);const{handleLog:u}=Ri(o);if(mi(c,t,o,n,i),We())ki(o);else{const{stop:f}=Ai(t,o,i,a,c);s.push(()=>f())}const d=Ii(c);return{handleLog:u,getInternalContext:d.get,stop:()=>{s.forEach(f=>f())}}}const ee=ai(Di);Io(B(),"DD_LOGS",ee);const C=class C{constructor(t,n,r,o,s){this.copy=()=>new C(this.h,this.m,this.s,this.f,this.field),this.print=()=>{const i=":";let a=("0"+this.h).slice(-2)+i+("0"+this.m).slice(-2)+i+("0"+this.s).slice(-2)+i+("0"+this.f).slice(-2);return a+="."+(this.field?"1":"2"),a},this.toZipTimeCodeString=()=>{const i=this.copy();return i.f=0,i.s=i.s%2===0?i.s:i.s-1,i.field=0,C.toStr(i)},this.toFrames=i=>{let a=60,c=0;Math.floor(i)==60?(a=60,c=0):Math.floor(i)==59?(a=60,c=4):Math.floor(i)==30?(a=30,c=0):Math.floor(i)==29&&(a=30,c=2);let l=this.h,u=this.m,d=this.s,f=this.f,h=this.field;const g=l*60+u,m=(g-Math.floor(g/10))*c;return l*(a*3600)+u*(a*60)+d*a+(f*2+h)-m},this.addSeconds=i=>{let a=this.copy();if(a.s+=i,a.s>=60){const c=Math.floor(a.s/60);if(a.s=a.s%60,a.m+=c,a.m>=60){const l=Math.floor(a.m/60);a.m=a.m%60,a.h+=l}}return a},this.addFrames=(i,a)=>{let c=this.toFrames(a);return c+=i,C.fromFrames(c,a)},this.subtractFrames=(i,a)=>this.addFrames(-i,a),this.h=t||0,this.m=n||0,this.s=r||0,this.f=o||0,this.field=s||0}static compare(t,n){return t.h!==n.h?t.h<n.h?-1:1:t.m!==n.m?t.m<n.m?-1:1:t.s!==n.s?t.s<n.s?-1:1:t.f!==n.f?t.f<n.f?-1:1:t.field!==n.field?t.field<n.field?-1:1:0}static generateTimecodeRange(t,n,r){const o=[];let s=t;for(;C.compare(s,n)<=0;)o.push(s),s=s.addSeconds(r);return o}totalSeconds(){return this.h*3600+this.m*60+this.s}totalMilliseconds(t){return this.toFrames(t)*1e3/t}};C.calculateCurrentTimeCode=t=>{var d;if(!t.video||!t.clocker||!t.gameParams)throw new Error("OTTPlayer is not initialized");const n=t.video,r=t.clocker,o=r.videoFPScalculator.getFPS(),a=(n.currentTime-r.syncPoint.playerTime)%(60*60*24)*o+r.syncPoint.frame;if(a===0||o===0)throw new Error("Current frame is 0 or fps is 0");const c=C.calculateCurrentOffset(a,(d=t.gameParams)==null?void 0:d.offsets);if(c===void 0)throw new Error("Offset is undefined");let l=Math.floor(a-c);return l<0&&(l+=5178816),l>=5178816&&(l-=5178816),C.fromFrames(l,o)},C.calculateCurrentOffset=(t,n)=>{for(let r=1;r<n.length;r++)if(t<n[r].frame)return n[r-1].offset;return Math.abs(n[n.length-1].offset)},C.fromFrames=(t,n)=>{let r=60,o=0;Math.floor(n)==60?(r=60,o=0):Math.floor(n)==59?(r=60,o=4):Math.floor(n)==30?(r=30,o=0):Math.floor(n)==29&&(r=30,o=2);let s=Math.floor(n*60),i=Math.floor(n*60*10),a=i*6,c=t,l=Math.floor(c/a);c-=l*a;let u=Math.floor(c/i);c-=u*i,c>=r*60&&(c+=o*(Math.floor((c-r*60)/s)+1));let d=Math.floor(c/(r*60));c-=d*(r*60);let f=Math.floor(c/r);c-=f*r;let h=c;d+=u*10;let g=0;return g=h%2,h=Math.floor(h/2),new C(l,d,f,h,g)},C.toStr=t=>{const n="_";let r=("0"+t.h).slice(-2)+n+("0"+t.m).slice(-2)+n+("0"+t.s).slice(-2)+n+("0"+t.f).slice(-2);return t.field&&(r+="_1"),r},C.fromStr=t=>{const r=t.split("_").map(Number);if(r.length==4){const[o,s,i,a]=r;return new C(o,s,i,a,0)}else if(r.length==5){const[o,s,i,a,c]=r;return new C(o,s,i,a,c)}else throw new Error("Invalid timecode format: "+t)},C.fromMetadata=t=>{const n=/^(\\d{2}):(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d))?$/,r=t.timecode.match(n);if(!r)throw new Error("Invalid timecode format: "+t.timecode);const[,o,s,i,a,c]=r,l=Number(o),u=Number(s),d=Number(i),f=Number(a),h=c?Number(c):0;return new C(l,u,d,f,h)};let te=C;const p=class p{constructor(t){this.listenerMap=new Map,p.options=t,this.isLoggingOn=t.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&ee.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const n="bb_logger_mac_uuid";let r=localStorage.getItem(n);r||(r=crypto.randomUUID(),localStorage.setItem(n,r)),p.tracking.mac=r,p.tracking.dev=`${t.platform}_${t.browserName}`,p.beatHandle||(p.options&&x(p.options,"Logger")&&console.log("[Logger] Starting tracking beat"),p.beatHandle=window.setInterval(p.flushTracking,15e3))}static setMessagePort(t){this.messagePort=t}static getMessagePort(){return this.messagePort}setLoggingOn(t){this.isLoggingOn=t}addEventListener(t,n){const r=o=>n(o);this.listenerMap.set(n,{eventName:t,wrappedListener:r}),this.eventTarget.addEventListener(t,r)}removeEventListener(t,n){const r=this.listenerMap.get(n);r&&r.eventName===t&&(this.eventTarget.removeEventListener(t,r.wrappedListener),this.listenerMap.delete(n))}removeAllEventListeners(){for(const[t,{eventName:n,wrappedListener:r}]of this.listenerMap)this.eventTarget.removeEventListener(n,r);this.listenerMap.clear()}setAttributes(t){p.processAttributes(t);for(const n in t)ee.logger.setContextProperty(n,t[n])}info(t,n){t==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(n==null?void 0:n.url)||""}),t==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(n==null?void 0:n.isEnabled)??!0}),t==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",n),t==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",n),t==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",n),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.info(t,n),p.options&&x(p.options,"Logger")&&console.log("[Logger] Sending info: ",t))}error(t,n){this.emit("mediaSessionDidError",{message:t,...n||{}}),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.error(t,n),p.tracking.err_time=Date.now().toFixed(0),p.tracking.err_desc=t+(n?` - ${JSON.stringify(n)}`:""),p.options&&x(p.options,"Logger")&&console.log("[Logger] Sending error: ",t))}criticalError(t,n){this.emit("mediaSessionDidFailOnError",{message:t,...n||{}}),n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.error(t,n),p.tracking.err_time=Date.now().toFixed(0),p.tracking.err_desc=t+(n?` - ${JSON.stringify(n)}`:""),p.options&&x(p.options,"Logger")&&console.log("[Logger] Sending critical error: ",t))}warn(t,n){n&&p.processAttributes(n),this.isLoggingOn&&(ee.logger.warn(t,n),p.options&&x(p.options,"Logger")&&console.log("[Logger] Sending warn: ",t))}handleMessageFromWorker(t){t.actionType==="INFO"?this.info(t.message,t.attributes):t.actionType==="ERROR"?this.error(t.message,t.attributes):t.actionType==="CRITICAL_ERROR"?this.criticalError(t.message,t.attributes):t.actionType==="WARN"?this.warn(t.message,t.attributes):t.actionType==="SET_ATTRIBUTES"&&t.attributes&&this.setAttributes(t.attributes)}static setAttributes(t){if(!p.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{p.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:t})}catch(n){console.error("[Logger] Error posting message:",n)}}static info(t,n){p.messagePort.postMessage({type:"LOG",actionType:"INFO",message:t,attributes:n})}static error(t,n){p.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:t,attributes:n})}static warn(t,n){p.messagePort.postMessage({type:"LOG",actionType:"WARN",message:t,attributes:n})}static criticalError(t,n){p.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:t,attributes:n})}static processAttributes(t){if(t.player_version&&(p.tracking.sdk=t.player_version),t.media_id&&(p.tracking.gid=t.media_id),t.game_id&&(p.tracking.buc=t.game_id),t.bb_session_id&&(p.tracking.sid=t.bb_session_id,p.options&&x(p.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",p.tracking.sid)),t.last_timecode){const r=te.fromStr(t.last_timecode);p.tracking.tc=r.print(),p.lastTimecodeMillis=r.totalMilliseconds(59.94),p.lastTimecodeMillis&&p.lastZipMillis&&(p.tracking.cache=(p.lastZipMillis-p.lastTimecodeMillis).toFixed(0))}t.last_offset&&(p.tracking.off=t.last_offset),t.last_loading_zip&&(p.tracking.zip=t.last_loading_zip+".zip",p.lastZipMillis=te.fromStr(t.last_loading_zip).totalMilliseconds(59.94),p.lastTimecodeMillis&&p.lastZipMillis&&(p.tracking.cache=(p.lastZipMillis-p.lastTimecodeMillis).toFixed(0))),t.last_rendered_frame&&(p.tracking.aug_time=Date.now().toFixed(0)),t.asset&&(p.tracking.asset=t.asset)}static objectToQuery(t){return Object.entries(t).filter(([n,r])=>r!==0&&r!=="").map(([n,r])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`).join("&")}emit(t,n){const r=new CustomEvent(t,{detail:n});this.eventTarget.dispatchEvent(r)}};p.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},p.lastTimecodeMillis=0,p.lastZipMillis=0,p.flushTracking=()=>{const t=Date.now().toFixed(0);p.tracking.now=t;const r=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${p.objectToQuery(p.tracking)}&platform=Web`;p.options&&x(p.options,"Logger")&&console.log("[Logger] Flushing tracking data:",r),fetch(r,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),p.tracking.err_desc="",p.tracking.err_time=""};let ue=p;const Fn=(()=>{const e=()=>{const m=navigator.userAgent;return/windows/i.test(m)?"Windows":/android/i.test(m)?"Android":/iphone|ipad|ipod/i.test(m)?"iOS":/mac/i.test(m)?"Mac":/ipad/i.test(m)?"iPad":"Something else"},t=()=>e()==="Mac",n=()=>e()==="iPad",r=()=>e()==="iOS",o=()=>{const m=e();return m==="iOS"||m==="Mac"||m==="iPad"},s=()=>e()==="Windows",i=()=>e()==="Android",a=()=>{switch(e()){case"Windows":return"a Windows PC";case"Android":return"an Android phone";case"iOS":return"an iPhone";case"Mac":return"a Mac";case"iPad":return"an iPad";default:return"an Unknown device"}},c=()=>({header:[navigator.platform,navigator.userAgent,navigator.appVersion,navigator.vendor,window.opera],dataos:[{name:"Windows Phone",value:"Windows Phone",version:"OS"},{name:"Windows",value:"Win",version:"NT"},{name:"iPhone",value:"iPhone",version:"OS"},{name:"iPad",value:"iPad",version:"OS"},{name:"Kindle",value:"Silk",version:"Silk"},{name:"Android",value:"Android",version:"Android"},{name:"PlayBook",value:"PlayBook",version:"OS"},{name:"BlackBerry",value:"BlackBerry",version:"/"},{name:"Macintosh",value:"Mac",version:"OS X"},{name:"Linux",value:"Linux",version:"rv"},{name:"Palm",value:"Palm",version:"PalmOS"}],databrowser:[{name:"Chrome",value:"Chrome",version:"Chrome"},{name:"Firefox",value:"Firefox",version:"Firefox"},{name:"Safari",value:"Safari",version:"Version"},{name:"Internet Explorer",value:"MSIE",version:"MSIE"},{name:"Opera",value:"Opera",version:"Opera"},{name:"BlackBerry",value:"CLDC",version:"CLDC"},{name:"Mozilla",value:"Mozilla",version:"Mozilla"}],init(){const R=this.header.join(" ");return this.matchItem(R,this.dataos)},matchItem(R,F){for(let le=0;le<F.length;le+=1)if(new RegExp(F[le].value,"i").test(R))return F[le].name;return"unknown"}}).init(),l=()=>{const m=navigator.userAgent;return m.indexOf("Chrome")>-1&&m.indexOf("Edge")===-1?"Chrome":m.indexOf("Safari")>-1&&m.indexOf("Chrome")===-1?"Safari":m.indexOf("Firefox")>-1?"Firefox":m.indexOf("MSIE")>-1||m.indexOf("Trident")>-1?"Internet Explorer":m.indexOf("Edge")>-1?"Edge":"Unknown"};return{getCurrentPlatform:e,isMac:t,isiPad:n,isiPhone:r,isApple:o,isWindows:s,isAndroid:i,getDeviceDescription:a,getDeviceName:c,getBrowserName:l,isSafariMac:()=>t()&&l()==="Safari",isChromeMac:()=>t()&&l()==="Chrome",isChromeWin:()=>s()&&l()==="Chrome",isFirefoxMac:()=>t()&&l()==="Firefox",isFirefoxWin:()=>s()&&l()==="Firefox"}})(),Rt={lastRendererFrameSent:0,isRAFSeen:!1,isRVFCSeen:!1,RVFCmissed:!1,RVFCframeExpected:0,compensationMode:!1,compensationCounter:0,frameCorrection:0,lastMessageSent:""};let Je=null,A,T;self.onmessage=async e=>{const{data:t}=e;t.type==="SET_LOGGER_PORT"&&ue.setMessagePort(t.port),t.type==="SET_RENDERER_PORT"&&(Je=t.port,Je.onmessage=Ni),t.type==="ADAPTER_UPDATE_DATA"&&(T=t.data,$n()),t.type==="SET_OPTIONS"&&(A=t.options,ue.setMessagePort(self))};function Ni(e){A&&x(A,"Adapter")&&console.log("[AdapterWorker] Message from Renderer:",e.data)}const $n=()=>{!T||T.siData.isVideoPaused||(Fn.isChromeMac()?Fi():Fn.isSafariMac()&&$i())},Fi=()=>{if(!T||T.siData.isVideoPaused||!T.vfcData.lastFrameMetadata)return;const{siData:e,vfcData:t,afData:n,debugControls:r}=T;if(!e.isRAFSeen){let o=4,s=-11,i=1,a=5;if(r){const m=parseInt(r["Window Start (ms)"],10);isNaN(m)||(o=m);const O=parseInt(r["Window End (ms)"],10);isNaN(O)||(s=O);const R=parseInt(r["Frame Correction"],10);isNaN(R)||(i=R);const F=parseInt(r["Timeout time"],10);isNaN(F)||(a=F)}const c=1e3/t.videoFPS;1e3/n.animationFPS;const l=n.lastTimestamp,u=t.storedMetadata.reduce((m,O)=>Math.abs(O.expectedDisplayTime-l)<Math.abs(m.expectedDisplayTime-l)?O:m),d=u.expectedDisplayTime-o,f=[];for(let m=-10;m<10;m++)f.push(d+m*c);const h=u.expectedDisplayTime-s,g=[];for(let m=-10;m<10;m++)g.push(h+m*c);let E=null;f.forEach((m,O)=>{l>m&&l<g[O]&&(E=O-10)}),E!==null?setTimeout(m=>xt(t.lastCalculatedMediaTimeVideoFrame+m*Math.round(60/t.videoFPS)+i),a,E):xt(Rt.lastRendererFrameSent)}},$i=()=>{if(!T||T.siData.isVideoPaused||!T.vfcData.lastFrameMetadata)return;const{siData:e,vfcData:t,afData:n}=T;let r=n.lastCalculatedPlayerTimeFraction;const o=n.previousCalculatedPlayerTimeFraction;r<.3&&r>.1&&o<.3&&o>.1&&(r=Math.min(r,o));let s=0;r<.1?s=0:r>.1&&r<.3?s=(r-.1)/(.3-.1):s=1;let i=n.lastCalculatedPlayerTimeVideoFrame;s==1&&(i++,s=0),xt(i,s)},xt=(e,t)=>{if(!T)return;Rt.lastRendererFrameSent=e,T.siData.workingFps;const n=te.fromFrames(e,6e4/1001),r=T.vfcData.videoFPS;if(r<=10||r>70){console.error("Video FPS is out of supported range: "+r),Bi(n);return}T.afData.animationFPS,Ui(n,t)},Ui=(e,t)=>{const n=te.toStr(e);Rt.lastMessageSent=n,A&&x(A,"Adapter")&&console.log(`[AdapterWorker] Rendering augmentation for timecode: ${n} , ${e}`),Un(n,t)},Bi=e=>{const t=te.toStr(e);A&&x(A,"Adapter")&&console.log("[AdapterWorker] Clearing augmentation"),Un(t,0,!0)},Un=(e,t,n)=>{if(!Je||!T)return;const r=e;A&&x(A,"Adapter")&&console.log(`[AdapterWorker] Sending current time code to the Renderer: ${r}`);const o={timeCode:r,frameCorrection:t||0,fps:jn(T.siData.workingFps),zipBaseURL:T.zipBaseURL,adsBaseURL:T.adsBaseURL,bucketName:T.bucketName,customerId:T.customerId,offsets:T.offsets},i={type:n?"RENDERER_CLEAR":"RENDERER_DRAW",streamData:o};Je.postMessage(i)};self.onunhandledrejection=e=>{ue.error("[AdapterWorker] Unhandled rejection",{error:e.reason}),A&&(x(A,"Errors")&&console.error("[AdapterWorker] Unhandled rejection:",e.reason),e.preventDefault())},self.onerror=e=>{ue.error("[AdapterWorker] Unhandled error",{error:e}),A&&(x(A,"Errors")&&console.error("[AdapterWorker] Unhandled error:",e),e instanceof Event&&e.preventDefault())},setInterval($n,2)})();\n',Xt=typeof self<"u"&&self.Blob&&new Blob([jt],{type:"text/javascript;charset=utf-8"});function un(t){let e;try{if(e=Xt&&(self.URL||self.webkitURL).createObjectURL(Xt),!e)throw"";const r=new Worker(e,{name:t==null?void 0:t.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jt),{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const O=class O{constructor(e){this.canPlayListner=()=>this.setupCanvas(),this.clickListner=n=>{this.clicker.click(n)},this.mediaTime=0,this.timecodeChecker=new on(0),this.rendererReady=!1,this.pendingAdBitmaps=[],this.lastAdBlobPerPlaceholder=new Map,this.lastClickUrlPerPlaceholder=new Map,this.logger=e.logger,this.OTTPlayer=e,this.options=e.options,this.debug=this.options.debug?this.options.debug.on:!1,this.downloaderWorker=new cn,this.decoderWorker=new ln,this.rendererWorker=new dn;const r=[this.downloaderWorker,this.decoderWorker,this.rendererWorker];this.options.ADAPTER_RUN_IN_WORKER&&(this.adapterWorker=new un,r.push(this.adapterWorker)),window.BB.workerInstances.push(...r),this.rendererToDownloader=new MessageChannel,this.rendererToMain=new MessageChannel,this.downloaderToDecoder=new MessageChannel,this.decoderToRenderer=new MessageChannel,this.options.ADAPTER_RUN_IN_WORKER&&(this.adapterToRenderer=new MessageChannel),this.setupWorkers(),this.canvas=document.createElement("canvas"),this.OTTPlayer.video.readyState>=3?this.setupCanvas():this.OTTPlayer.video.addEventListener("canplay",this.canPlayListner,{once:!0}),this.processedTimecodes=[],this.clicker=new an(this.OTTPlayer,this.rendererWorker),this.segmentFirstFrameTimecode=new L,this.syncPoint={frame:0,playerTime:0,stringTime:""},this.cacheStarted=!1,this.animationFPScalculator=new ot(20),this.videoFPScalculator=new ot(20),this.startAnimationFrameLoop(),this.startVideoFrameCallbackLoop()}startAnimationFrameLoop(){const e=()=>{this.animationFPScalculator.addTimestamp(performance.now()/1e3),this.OTTPlayer.RUN_PIXEL_TICKERS&&this.OTTPlayer.pixelTickers.forEach(r=>{r.update()}),this.animationFrameLoopId=requestAnimationFrame(e)};this.animationFrameLoopId=requestAnimationFrame(e)}startVideoFrameCallbackLoop(){const e=(r,n)=>{this.mediaTime=n.mediaTime,this.videoFPScalculator.addTimestamp(n.mediaTime),this.videoFrameCallbackLoopId=this.OTTPlayer.video.requestVideoFrameCallback(e)};this.videoFrameCallbackLoopId=this.OTTPlayer.video.requestVideoFrameCallback(e)}updateCanvasSize(){if(!this.canvasContainer)return;const e=this.canvasContainer,r=e.style.width,n=e.style.height;if(O.DEBUG_RESIZE&&console.log("[Clocker.updateCanvasSize] Called",{containerId:e.id||"no-id",containerInline:{w:r||"none",h:n||"none"},containerOffset:{w:e.offsetWidth,h:e.offsetHeight}}),r&&n){this.canvas.style.width=r,this.canvas.style.height=n,O.DEBUG_RESIZE&&console.log("[Clocker.updateCanvasSize] Using inline styles, disconnecting ResizeObserver"),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0);return}const s=window.getComputedStyle(e);O.DEBUG_RESIZE&&console.log("[Clocker.updateCanvasSize] Using computed styles",{w:s.width,h:s.height}),this.canvas.style.width=s.width,this.canvas.style.height=s.height,!this.resizeObserver&&typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(i=>{var l;O.resizeObserverCallCount++;const o=O.resizeObserverCallCount,a=window.getComputedStyle(e),c=this.canvas.style.width,d=this.canvas.style.height;O.DEBUG_RESIZE&&console.log(`[Clocker.ResizeObserver] #${o} Fired`,{timestamp:Date.now(),containerId:e.id||"no-id",entryContentRect:(l=i[0])!=null&&l.contentRect?{w:i[0].contentRect.width,h:i[0].contentRect.height}:null,containerOffset:{w:e.offsetWidth,h:e.offsetHeight},containerComputed:{w:a.width,h:a.height},canvasBefore:{w:c,h:d},canvasAfter:{w:a.width,h:a.height},changed:c!==a.width||d!==a.height}),this.canvas.style.width=a.width,this.canvas.style.height=a.height}),this.resizeObserver.observe(e),O.DEBUG_RESIZE&&console.log("[Clocker.updateCanvasSize] ResizeObserver created and observing"))}setupCanvas(){const e=this.OTTPlayer.video,r=this.options.CANVAS_CONTAINER||e.parentElement;if(!r){console.error("[Clocker] No container found for canvas placement"),this.logger.error("setupCanvas failed: no container found");return}this.canvasContainer=r,console.log("video.videoWidth: ",e.videoWidth),console.log("video.videoHeight: ",e.videoHeight),this.canvas.width=e.videoWidth,this.canvas.height=e.videoHeight,this.canvas.style.zIndex="3000",this.canvas.style.position="absolute",this.canvas.style.top="0%",this.canvas.style.left="0",console.log("container: ",r),console.log("[OTTPlayer] container sizes:"),console.log("container.style.width: ",r.style.width),console.log("container.style.height: ",r.style.height),this.updateCanvasSize(),this.canvas.style.pointerEvents="none",r.addEventListener("click",this.clickListner),r.style.position="relative",r.appendChild(this.canvas);const n=this.canvas.transferControlToOffscreen(),{CANVAS_CONTAINER:s,...i}=this.options,o={type:"INIT_OFFSCREEN",offscreen:n,options:i};this.rendererWorker.postMessage(o,[n]),e.onseeked=()=>{this.onVideoSeeked()},e.onseeking=()=>{this.onVideoSeeked()}}setupWorkers(){const{CANVAS_CONTAINER:e,...r}=this.options;this.downloaderWorker.onmessage=n=>{n.data.type==="LOG"?(n.data.actionType==="SET_ATTRIBUTES"&&n.data.attributes.last_loading_zip&&this.metrics&&this.metrics.updateMetric("Last Downloaded Zip",n.data.attributes.last_loading_zip),this.logger.handleMessageFromWorker(n.data)):n.data.type==="TRACK_PERFORMANCE"&&this.trackPerformance(n.data)},this.decoderWorker.onmessage=n=>{if(n.data.type==="LOG"){if(n.data.actionType==="SET_ATTRIBUTES"&&(n.data.attributes.last_decoded_frame&&this.metrics&&this.metrics.updateMetric("Last Decoded Frame",n.data.attributes.last_decoded_frame),this.OTTPlayer.statusOverlay)){const s=n.data.attributes;s.decoder_status&&this.OTTPlayer.statusOverlay.updateMetric("health","decoder",s.decoder_status.healthy,s.decoder_status.issue),s.timecode_status&&this.OTTPlayer.statusOverlay.updateMetric("timecode","consistency",s.timecode_status.consistent,s.timecode_status.errorCount>0?`Errors: ${s.timecode_status.errorCount}`:void 0)}this.logger.handleMessageFromWorker(n.data)}else n.data.type==="TRACK_PERFORMANCE"&&this.trackPerformance(n.data)},this.rendererWorker.onmessage=n=>{n.data.type==="LOG"?(n.data.actionType==="SET_ATTRIBUTES"&&this.metrics&&(n.data.attributes.last_webgl_uploaded_frame&&this.metrics.updateMetric("Last WebGL Uploaded Frame",n.data.attributes.last_webgl_uploaded_frame),n.data.attributes.last_rendered_frame&&this.metrics.updateMetric("Last Rendered Frame",n.data.attributes.last_rendered_frame),n.data.attributes.renderer_state&&this.metrics.updateMetric("Renderer State",n.data.attributes.renderer_state)),this.logger.handleMessageFromWorker(n.data)):n.data.type==="TRACK_PERFORMANCE"?this.trackPerformance(n.data):n.data.type==="RENDERER_READY"&&(this.rendererReady=!0,this.flushOverrides(!0))},this.adapterWorker&&(this.adapterWorker.onmessage=n=>{n.data.type==="LOG"?this.logger.handleMessageFromWorker(n.data):n.data.type==="TRACK_PERFORMANCE"&&this.trackPerformance(n.data)}),this.rendererWorker.postMessage({type:"SET_DOWNLOADER_PORT",port:this.rendererToDownloader.port1},[this.rendererToDownloader.port1]),this.downloaderWorker.postMessage({type:"SET_RENDERER_PORT",port:this.rendererToDownloader.port2},[this.rendererToDownloader.port2]),this.downloaderWorker.postMessage({type:"SET_DECODER_PORT",port:this.downloaderToDecoder.port1},[this.downloaderToDecoder.port1]),this.decoderWorker.postMessage({type:"SET_DOWNLOADER_PORT",port:this.downloaderToDecoder.port2},[this.downloaderToDecoder.port2]),this.decoderWorker.postMessage({type:"SET_RENDERER_PORT",port:this.decoderToRenderer.port1},[this.decoderToRenderer.port1]),this.rendererWorker.postMessage({type:"SET_DECODER_PORT",port:this.decoderToRenderer.port2},[this.decoderToRenderer.port2]),this.adapterWorker&&this.adapterToRenderer&&(this.adapterWorker.postMessage({type:"SET_RENDERER_PORT",port:this.adapterToRenderer.port1},[this.adapterToRenderer.port1]),this.rendererWorker.postMessage({type:"SET_ADAPTER_PORT",port:this.adapterToRenderer.port2},[this.adapterToRenderer.port2])),this.rendererWorker.postMessage({type:"SET_LOGGER_PORT",port:this.rendererToMain.port1},[this.rendererToMain.port1]),this.rendererToMain.port2.onmessage=n=>{var s,i;if(n.data.type==="LOG"){if(n.data.actionType==="SET_ATTRIBUTES"&&(this.metrics&&(n.data.attributes.last_webgl_uploaded_frame&&this.metrics.updateMetric("Last WebGL Uploaded Frame",n.data.attributes.last_webgl_uploaded_frame),n.data.attributes.last_rendered_frame&&this.metrics.updateMetric("Last Rendered Frame",n.data.attributes.last_rendered_frame),n.data.attributes.renderer_state&&this.metrics.updateMetric("Renderer State",n.data.attributes.renderer_state)),this.OTTPlayer.statusOverlay)){const o=n.data.attributes;if(o.webgl_status&&this.OTTPlayer.statusOverlay.updateMetric("health","webgl",o.webgl_status.ready,o.webgl_status.issue),o.renderer_state&&this.OTTPlayer.statusOverlay.updateMetric("switches","render_state",o.renderer_state),o.data_status){const a=o.data_status;this.OTTPlayer.statusOverlay.updateMetric("data","stream_data",a.stream_data,a.timecode||void 0),this.OTTPlayer.statusOverlay.updateMetric("data","ads",a.ads),this.OTTPlayer.statusOverlay.updateMetric("data","render_data",a.render_data),this.OTTPlayer.statusOverlay.updateMetric("data","alpha_mask",a.alpha_mask),this.OTTPlayer.statusOverlay.updateMetric("data","placeholders",a.placeholders),this.OTTPlayer.statusOverlay.updateMetric("data","processing_size",a.processing_size),this.OTTPlayer.statusOverlay.updateMetric("switches","isLive",a.isLive)}if(o.killswitch_status){const a=o.killswitch_status;this.OTTPlayer.statusOverlay.updateMetric("switches","killswitch_web",a.web),this.OTTPlayer.statusOverlay.updateMetric("switches","killswitch_local",a.local)}if(o.zip_buffer_status){const a=o.zip_buffer_status,c=((s=a.retryingTimecodes)==null?void 0:s.length)||0,d=((i=a.failedTimecodes)==null?void 0:i.length)||0;let l=`${a.continuousSeconds.toFixed(1)}s`;(c>0||d>0)&&(l+=` | Retrying: ${c}, Failed: ${d}`),this.OTTPlayer.statusOverlay.updateMetric("data","zip_buffer",!a.needsFadeout,l)}}this.logger.handleMessageFromWorker(n.data)}else n.data.type==="TRACK_PERFORMANCE"?this.trackPerformance(n.data):n.data.type==="RENDERER_READY"&&(this.rendererReady=!0,this.flushOverrides(!0))},this.downloaderWorker.postMessage({type:"SET_OPTIONS",options:r}),this.decoderWorker.postMessage({type:"SET_OPTIONS",options:r}),this.adapterWorker&&this.adapterWorker.postMessage({type:"SET_OPTIONS",options:r}),this.rendererWorker.postMessage({type:"SET_OPTIONS",options:r})}callAdapterWorker(e){this.adapterWorker&&this.adapterWorker.postMessage({type:"ADAPTER_UPDATE_DATA",data:e})}callRendererWorkerWithFrame(e,r){if(!this.OTTPlayer.gameParams||!this.OTTPlayer.gameParams.bucketName){e.close();return}const n={timeCode:r,frameCorrection:0,fps:de(this.videoFPScalculator.getFPS()),zipBaseURL:this.OTTPlayer.options.zipBaseURL,adsBaseURL:this.OTTPlayer.options.adsBaseURL,bucketName:this.OTTPlayer.gameParams.bucketName,offsets:this.OTTPlayer.gameParams.offsets,customerId:this.OTTPlayer.gameParams.customerId,ottActions:this.OTTPlayer.ottActions},s={type:"BURNED_FRAME_RENDER",imageBitmap:e,timecode:r,streamData:n};this.rendererWorker.postMessage(s,[e]),this.logger.setAttributes({last_timecode:r})}setAdImage(e,r,n){if(!this.rendererReady){this.pendingAdBitmaps.push({imageBitmap:e,placeholder:r,clickUrl:n});return}const s={type:"SET_AD_IMAGE",imageBitmap:e,placeholder:r,clickUrl:n};this.rendererWorker.postMessage(s,[e])}setLEDImage(e){if(!this.rendererReady){if(this.pendingLEDBitmap)try{this.pendingLEDBitmap.close()}catch{}this.pendingLEDBitmap=e;return}const r={type:"SET_LED_IMAGE",imageBitmap:e};this.rendererWorker.postMessage(r,[e])}setAdBlob(e,r,n){r?(this.lastAdBlobPerPlaceholder.set(r,e),n?this.lastClickUrlPerPlaceholder.set(r,n):this.lastClickUrlPerPlaceholder.delete(r)):(this.lastGlobalAdBlob=e,this.lastGlobalClickUrl=n);const s={type:"SET_AD_BLOB",blob:e,placeholder:r,clickUrl:n};this.rendererWorker.postMessage(s)}setLEDBlob(e){this.lastLEDBlob=e;const r={type:"SET_LED_BLOB",blob:e};this.rendererWorker.postMessage(r)}resetAds(e){e?(this.lastAdBlobPerPlaceholder.delete(e),this.lastClickUrlPerPlaceholder.delete(e)):(this.lastGlobalAdBlob=void 0,this.lastGlobalClickUrl=void 0),this.rendererWorker.postMessage({type:"RESET_ADS",placeholder:e})}clearAd(e){e?(this.lastAdBlobPerPlaceholder.delete(e),this.lastClickUrlPerPlaceholder.delete(e)):(this.lastGlobalAdBlob=void 0,this.lastGlobalClickUrl=void 0,this.lastAdBlobPerPlaceholder.clear(),this.lastClickUrlPerPlaceholder.clear());const r={type:"CLEAR_AD",placeholder:e};this.rendererWorker.postMessage(r)}clearLED(){this.lastLEDBlob=void 0;const e={type:"CLEAR_LED"};this.rendererWorker.postMessage(e)}callRendererWorker(e,r,n){var a,c;this.options&&y(this.options,"Clocker")&&console.log(`[Clocker] Sending current time code to the Renderer: ${e}`);const s=n?"RENDERER_CLEAR":"RENDERER_DRAW";if(!e||!this.OTTPlayer.gameParams||!this.OTTPlayer.gameParams.bucketName||!this.OTTPlayer.gameParams.offsets){const d={type:s};this.rendererWorker.postMessage(d);return}const i={timeCode:e,frameCorrection:r||0,fps:de(this.videoFPScalculator.getFPS()),zipBaseURL:this.OTTPlayer.options.zipBaseURL,adsBaseURL:this.OTTPlayer.options.adsBaseURL,bucketName:this.OTTPlayer.gameParams.bucketName,offsets:this.OTTPlayer.gameParams.offsets,customerId:this.OTTPlayer.gameParams.customerId,ottActions:this.OTTPlayer.ottActions?{...this.OTTPlayer.ottActions,benchmarkPassed:((c=(a=this.OTTPlayer.adapter)==null?void 0:a.benchmark)==null?void 0:c.hasPassed())??!1}:void 0},o={type:s,streamData:i};this.rendererWorker.postMessage(o),n||this.logger.setAttributes({last_timecode:e})}onVideoSeeked(){this.restartWorkers(),this.OTTPlayer.adapter&&this.OTTPlayer.adapter.onVideoSeeked(),this.logger.info("didSeek")}stopWorkers(){const e={type:"STOP_WORKER"};this.downloaderWorker.postMessage(e),this.decoderWorker.postMessage(e),this.rendererWorker.postMessage(e)}restartWorkers(){this.rendererReady=!1;const e={type:"RESTART_WORKER"};this.downloaderWorker.postMessage(e),this.decoderWorker.postMessage(e),this.rendererWorker.postMessage(e)}pause(){this.stopWorkers(),this.animationFrameLoopId&&(cancelAnimationFrame(this.animationFrameLoopId),this.animationFrameLoopId=void 0),this.videoFrameCallbackLoopId&&(this.OTTPlayer.video.cancelVideoFrameCallback(this.videoFrameCallbackLoopId),this.videoFrameCallbackLoopId=void 0)}resume(){this.restartWorkers(),this.animationFrameLoopId||this.startAnimationFrameLoop(),this.videoFrameCallbackLoopId||this.startVideoFrameCallbackLoop()}trackPerformance(e){var r;if((r=this.options.debug)!=null&&r.trackPerformance&&this.metrics)for(let n of e.data)this.metrics.updateMetric(n.metric,n.value.toFixed(2))}flushOverrides(e=!1){var r;if(this.options&&y(this.options,"Clocker")&&console.log("[Clocker] flushOverrides called, reapplyLast:",e),this.options&&y(this.options,"Clocker")&&console.log("[Clocker] lastGlobalAdBlob:",!!this.lastGlobalAdBlob,(r=this.lastGlobalAdBlob)==null?void 0:r.size),this.options&&y(this.options,"Clocker")&&console.log("[Clocker] lastAdBlobPerPlaceholder:",this.lastAdBlobPerPlaceholder.size,Array.from(this.lastAdBlobPerPlaceholder.keys())),e){if(this.lastGlobalAdBlob){this.options&&y(this.options,"Clocker")&&console.log("[Clocker] Re-applying global blob, size:",this.lastGlobalAdBlob.size,"clickUrl:",this.lastGlobalClickUrl);const n={type:"SET_AD_BLOB",blob:this.lastGlobalAdBlob,clickUrl:this.lastGlobalClickUrl,isRestore:!0};this.rendererWorker.postMessage(n)}this.lastAdBlobPerPlaceholder.size>0&&this.lastAdBlobPerPlaceholder.forEach((n,s)=>{const i=this.lastClickUrlPerPlaceholder.get(s);this.options&&y(this.options,"Clocker")&&console.log("[Clocker] Re-applying per-placeholder blob:",s,"size:",n==null?void 0:n.size,"clickUrl:",i);const o={type:"SET_AD_BLOB",blob:n,placeholder:s,clickUrl:i,isRestore:!0};this.rendererWorker.postMessage(o)})}if(this.pendingAdBitmaps.length>0){for(const n of this.pendingAdBitmaps){const s={type:"SET_AD_IMAGE",imageBitmap:n.imageBitmap,placeholder:n.placeholder,clickUrl:n.clickUrl};this.rendererWorker.postMessage(s,[n.imageBitmap])}this.pendingAdBitmaps=[]}if(this.pendingLEDBitmap){const n=this.pendingLEDBitmap;this.pendingLEDBitmap=void 0;const s={type:"SET_LED_IMAGE",imageBitmap:n};this.rendererWorker.postMessage(s,[n])}else if(e&&this.lastLEDBlob){const n={type:"SET_LED_BLOB",blob:this.lastLEDBlob};this.rendererWorker.postMessage(n)}}delete(){const e=this.OTTPlayer.video,r=this.canvasContainer||e.parentElement;if(this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),r&&this.canvas&&r.contains(this.canvas)&&r.removeChild(this.canvas),this.rendererWorker.terminate(),this.downloaderWorker.terminate(),this.decoderWorker.terminate(),this.adapterWorker&&this.adapterWorker.terminate(),this.metrics&&this.metrics.delete(),this.animationFrameLoopId&&cancelAnimationFrame(this.animationFrameLoopId),this.videoFrameCallbackLoopId&&e.cancelVideoFrameCallback(this.videoFrameCallbackLoopId),e.removeEventListener("canplay",this.canPlayListner),r&&r.removeEventListener("click",this.clickListner),this.pendingAdBitmaps&&this.pendingAdBitmaps.length>0){for(const n of this.pendingAdBitmaps)try{n.imageBitmap.close()}catch{}this.pendingAdBitmaps=[]}if(this.pendingLEDBitmap){try{this.pendingLEDBitmap.close()}catch{}this.pendingLEDBitmap=void 0}}};O.DEBUG_RESIZE=!0,O.resizeObserverCallCount=0;let at=O;class hn{constructor(){this.metrics=new Map,this.containers=[],this.createContainer=()=>{const e=document.createElement("div");e.style.display="flex",e.style.flexWrap="wrap",e.style.rowGap="2px",e.style.columnGap="30px",e.style.marginTop="2px",e.style.marginBottom="2px",e.style.fontSize="12px",e.style.fontFamily="monospace";const r={div:e,metrics:[]};return this.containers.push(r),document.body.appendChild(e),r},this.createMetric=(e,r)=>{const n=document.createElement("span");n.style.display="inline-flex",n.style.gap="4px",n.style.whiteSpace="nowrap",n.style.flexShrink="0";const s=document.createElement("span");s.textContent=`${e}:`,s.style.flexShrink="0",s.style.fontWeight="bold";const i=document.createElement("span");i.style.minWidth="0",i.style.textAlign="right",i.style.whiteSpace="nowrap",i.style.flexShrink="0",i.style.display="inline-block",i.textContent="",n.appendChild(s),n.appendChild(i);const o={name:e,value:"",span:n,valueSpan:i,maxWidth:0};return r.metrics.push(o),r.div.appendChild(n),this.metrics.set(e,o),o},this.updateMetric=(e,r)=>{const n=this.metrics.get(e);if(!n){console.error("Metric does not exist");return}typeof r=="boolean"?n.value=r?"true":"false":n.value=r,n.valueSpan.textContent=String(n.value);const s=n.valueSpan.offsetWidth;s>n.maxWidth&&(n.maxWidth=s,n.valueSpan.style.minWidth=`${s}px`)}}delete(){this.containers.forEach(e=>{e.div.remove()})}}const Le=t=>t.toString().padStart(2,"0"),ct=":",fn=(t,e,r=!1)=>{let n="";return Array.isArray(t)?(n=[Le(t[0]),Le(t[1]),Le(t[2]),Le(t[3])].join(":"),r==!0?t[4]==1&&e?n+=".2":n+=".1":t[4]==1&&e&&(n+=".1")):(n=("0"+t.h).slice(-2)+ct+("0"+t.m).slice(-2)+ct+("0"+t.s).slice(-2)+ct+("0"+t.f).slice(-2),n+="."+(t.field?"1":"2")),n},pn=(t,e,r)=>{let n=60,s=0;Math.floor(e)==60?(n=60,s=0):Math.floor(e)==59?(n=60,s=4):Math.floor(e)==30?(n=30,s=0):Math.floor(e)==29&&(n=30,s=2);let i=0,a=Math.floor(e*60*10)*6,c=t[0],d=t[1],l=t[2],u=t[3],h=t[4];return i+=c*a,i+=d*(n*60),i+=l*n,i+=u*2+h,i-=s*d,i+=s*Math.floor(d/10),i},W=(()=>{const t=()=>{const p=navigator.userAgent;return/windows/i.test(p)?"Windows":/android/i.test(p)?"Android":/iphone|ipad|ipod/i.test(p)?"iOS":/mac/i.test(p)?"Mac":/ipad/i.test(p)?"iPad":"Something else"},e=()=>t()==="Mac",r=()=>t()==="iPad",n=()=>t()==="iOS",s=()=>{const p=t();return p==="iOS"||p==="Mac"||p==="iPad"},i=()=>t()==="Windows",o=()=>t()==="Android",a=()=>{switch(t()){case"Windows":return"a Windows PC";case"Android":return"an Android phone";case"iOS":return"an iPhone";case"Mac":return"a Mac";case"iPad":return"an iPad";default:return"an Unknown device"}},c=()=>({header:[navigator.platform,navigator.userAgent,navigator.appVersion,navigator.vendor,window.opera],dataos:[{name:"Windows Phone",value:"Windows Phone",version:"OS"},{name:"Windows",value:"Win",version:"NT"},{name:"iPhone",value:"iPhone",version:"OS"},{name:"iPad",value:"iPad",version:"OS"},{name:"Kindle",value:"Silk",version:"Silk"},{name:"Android",value:"Android",version:"Android"},{name:"PlayBook",value:"PlayBook",version:"OS"},{name:"BlackBerry",value:"BlackBerry",version:"/"},{name:"Macintosh",value:"Mac",version:"OS X"},{name:"Linux",value:"Linux",version:"rv"},{name:"Palm",value:"Palm",version:"PalmOS"}],databrowser:[{name:"Chrome",value:"Chrome",version:"Chrome"},{name:"Firefox",value:"Firefox",version:"Firefox"},{name:"Safari",value:"Safari",version:"Version"},{name:"Internet Explorer",value:"MSIE",version:"MSIE"},{name:"Opera",value:"Opera",version:"Opera"},{name:"BlackBerry",value:"CLDC",version:"CLDC"},{name:"Mozilla",value:"Mozilla",version:"Mozilla"}],init(){const S=this.header.join(" ");return this.matchItem(S,this.dataos)},matchItem(S,w){for(let E=0;E<w.length;E+=1)if(new RegExp(w[E].value,"i").test(S))return w[E].name;return"unknown"}}).init(),d=()=>{const p=navigator.userAgent;return p.indexOf("Chrome")>-1&&p.indexOf("Edge")===-1?"Chrome":p.indexOf("Safari")>-1&&p.indexOf("Chrome")===-1?"Safari":p.indexOf("Firefox")>-1?"Firefox":p.indexOf("MSIE")>-1||p.indexOf("Trident")>-1?"Internet Explorer":p.indexOf("Edge")>-1?"Edge":"Unknown"};return{getCurrentPlatform:t,isMac:e,isiPad:r,isiPhone:n,isApple:s,isWindows:i,isAndroid:o,getDeviceDescription:a,getDeviceName:c,getBrowserName:d,isSafariMac:()=>e()&&d()==="Safari",isChromeMac:()=>e()&&d()==="Chrome",isChromeWin:()=>i()&&d()==="Chrome",isFirefoxMac:()=>e()&&d()==="Firefox",isFirefoxWin:()=>i()&&d()==="Firefox"}})();class mn{constructor(e=10){this.testStartTime=0,this.currentState="FAILED",this.previousState="FAILED",this.testDurationMs=e*1e3,this.lastConditions=this.getEmptyConditions()}test(e){const r=Object.values(e).every(s=>s===!0);if(this.previousState=this.currentState,!r){this.currentState="FAILED",this.testStartTime=0,this.lastConditions=e;const s=this.previousState==="PASSED"||this.previousState==="TESTING";return{state:"FAILED",failedConditions:this.getFailedConditions(e),shouldClear:s}}const n=performance.now();if(this.currentState==="FAILED"&&(this.currentState="TESTING",this.testStartTime=n),this.currentState==="TESTING"){const s=n-this.testStartTime,i=this.testDurationMs-s;return i<=0?(this.currentState="PASSED",{state:"PASSED"}):{state:"TESTING",remainingSeconds:Math.ceil(i/1e3)}}return this.lastConditions=e,{state:"PASSED"}}hasPassed(){return this.currentState==="PASSED"}forcePassed(){this.previousState=this.currentState,this.currentState="PASSED",this.lastConditions={gameParams:!0,browserSupported:!0,patternDetected:!0,fpsSupported:!0,noMKAdsPlaying:!0,syncPointSet:!0}}getStatus(){if(this.currentState==="FAILED")return{state:"FAILED",failedConditions:this.getFailedConditions(this.lastConditions)};if(this.currentState==="TESTING"){const r=performance.now()-this.testStartTime,n=this.testDurationMs-r;return{state:"TESTING",remainingSeconds:Math.ceil(n/1e3)}}return{state:"PASSED"}}reset(){this.currentState="FAILED",this.testStartTime=0}setDuration(e){this.testDurationMs=e*1e3}getFailedConditions(e){const r=[];return e.gameParams||r.push("game_params"),e.browserSupported||r.push("browser"),e.patternDetected||r.push("pattern"),e.fpsSupported||r.push("fps"),e.noMKAdsPlaying||r.push("mk_ads"),e.syncPointSet||r.push("sync_point"),r}getEmptyConditions(){return{gameParams:!1,browserSupported:!1,patternDetected:!1,fpsSupported:!1,noMKAdsPlaying:!0,syncPointSet:!1}}}class gn{constructor(){this.OUT_WIDTH=4,this.OUT_HEIGHT=1,this.canvas=document.createElement("canvas");const e=this.canvas.getContext("webgl2");if(!e)throw new Error("WebGL2 not supported");this.gl=e;const r=`#version 300 es
|
|
2
2
|
|
|
3
3
|
precision highp float;
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
`,
|
|
27
|
+
`,n=`#version 300 es
|
|
28
28
|
|
|
29
29
|
precision highp float;
|
|
30
30
|
|
|
@@ -96,10 +96,11 @@
|
|
|
96
96
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
`,i=this.createShader(this.gl.VERTEX_SHADER,t),n=this.createShader(this.gl.FRAGMENT_SHADER,s);this.program=this.createProgram(i,n),this.gl.useProgram(this.program),this.positionLoc=this.gl.getAttribLocation(this.program,"a_position"),this.texCoordLoc=this.gl.getAttribLocation(this.program,"a_texCoord"),this.resolutionLoc=this.gl.getUniformLocation(this.program,"u_resolution"),this.videoSizeLoc=this.gl.getUniformLocation(this.program,"u_videoSize"),this.textureLoc=this.gl.getUniformLocation(this.program,"u_image"),this.positionBuffer=this.gl.createBuffer(),this.texCoordBuffer=this.gl.createBuffer(),this.videoTexture=this.gl.createTexture(),this.fbo=this.gl.createFramebuffer(),this.outTex=this.gl.createTexture(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,this.OUT_WIDTH,0,0,this.OUT_HEIGHT,0,this.OUT_HEIGHT,this.OUT_WIDTH,0,this.OUT_WIDTH,this.OUT_HEIGHT]),this.gl.STATIC_DRAW),this.gl.enableVertexAttribArray(this.positionLoc),this.gl.vertexAttribPointer(this.positionLoc,2,this.gl.FLOAT,!1,0,0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texCoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.enableVertexAttribArray(this.texCoordLoc),this.gl.vertexAttribPointer(this.texCoordLoc,2,this.gl.FLOAT,!1,0,0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.outTex),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.OUT_WIDTH,this.OUT_HEIGHT,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this.outTex,0)}createShader(e,t){const s=this.gl.createShader(e);if(this.gl.shaderSource(s,t),this.gl.compileShader(s),!this.gl.getShaderParameter(s,this.gl.COMPILE_STATUS)){const i=this.gl.getShaderInfoLog(s);throw this.gl.deleteShader(s),new Error("Shader compile failed: "+i)}return s}createProgram(e,t){const s=this.gl.createProgram();if(this.gl.attachShader(s,e),this.gl.attachShader(s,t),this.gl.linkProgram(s),!this.gl.getProgramParameter(s,this.gl.LINK_STATUS)){const i=this.gl.getProgramInfoLog(s);throw this.gl.deleteProgram(s),new Error("Program link failed: "+i)}return this.gl.detachShader(s,e),this.gl.detachShader(s,t),this.gl.deleteShader(e),this.gl.deleteShader(t),s}decode(e){const t=e.videoWidth|0,s=e.videoHeight|0;if(t===0||s===0)return null;this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.videoTexture),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.canvas.width=this.OUT_WIDTH,this.canvas.height=this.OUT_HEIGHT,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.OUT_WIDTH,this.OUT_HEIGHT),this.gl.useProgram(this.program),this.resolutionLoc&&this.gl.uniform2f(this.resolutionLoc,this.OUT_WIDTH,this.OUT_HEIGHT),this.videoSizeLoc&&this.gl.uniform2f(this.videoSizeLoc,t,s),this.textureLoc&&this.gl.uniform1i(this.textureLoc,0),this.gl.drawArrays(this.gl.TRIANGLES,0,6);const i=new Uint8Array(this.OUT_WIDTH*this.OUT_HEIGHT*4);this.gl.readPixels(0,0,this.OUT_WIDTH,this.OUT_HEIGHT,this.gl.RGBA,this.gl.UNSIGNED_BYTE,i);const n=i[0],o=i[4],a=i[8],c=i[12],d=Math.floor(c/2),l=c%2===1?"_1":"",u=("0"+n).slice(-2),f=("0"+o).slice(-2),p=("0"+a).slice(-2),h=("0"+d).slice(-2);return`${u}_${f}_${p}_${h}${l}`}decodeFromImageBitmap(e){const t=e.width|0,s=e.height|0;if(t===0||s===0)return null;this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.videoTexture),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.canvas.width=this.OUT_WIDTH,this.canvas.height=this.OUT_HEIGHT,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.OUT_WIDTH,this.OUT_HEIGHT),this.gl.useProgram(this.program),this.resolutionLoc&&this.gl.uniform2f(this.resolutionLoc,this.OUT_WIDTH,this.OUT_HEIGHT),this.videoSizeLoc&&this.gl.uniform2f(this.videoSizeLoc,t,s),this.textureLoc&&this.gl.uniform1i(this.textureLoc,0),this.gl.drawArrays(this.gl.TRIANGLES,0,6);const i=new Uint8Array(this.OUT_WIDTH*this.OUT_HEIGHT*4);this.gl.readPixels(0,0,this.OUT_WIDTH,this.OUT_HEIGHT,this.gl.RGBA,this.gl.UNSIGNED_BYTE,i);const n=i[0],o=i[4],a=i[8],c=i[12],d=Math.floor(c/2),l=c%2===1?"_1":"",u=("0"+n).slice(-2),f=("0"+o).slice(-2),p=("0"+a).slice(-2),h=("0"+d).slice(-2);return`${u}_${f}_${p}_${h}${l}`}dispose(){this.videoTexture&&this.gl.deleteTexture(this.videoTexture),this.outTex&&this.gl.deleteTexture(this.outTex),this.fbo&&this.gl.deleteFramebuffer(this.fbo),this.positionBuffer&&this.gl.deleteBuffer(this.positionBuffer),this.texCoordBuffer&&this.gl.deleteBuffer(this.texCoordBuffer),this.program&&this.gl.deleteProgram(this.program)}}const q=class q{constructor(e){if(this.platformSupported=!0,this.firstFrameTimecodeSet=!1,this.firstFrameTimecode=[0,0,0,0,0],this.firstVideoFrameCallbackFired=!1,this.isMKAdPlaying=!1,this.loggerTimeoutStart=0,this.loggerTimeout=1e4,this.lastStatusUpdate=0,this.STATUS_UPDATE_INTERVAL=100,this.lastBenchmarkUpdate=0,this.BENCHMARK_UPDATE_INTERVAL=100,this.resumedAt=0,this.SKIP_PROCESSING_AFTER_RESUME_MS=1e3,this.afData={counter:0,lastTimestamp:0,previousTimestamp:0,lastMetadataNow:0,timeFromLastRVFC:0,animationFPS:0,playerTimeOffset:0,lastPlayerTimeFromSync:0,lastCalculatedPlayerTimeVideoFrame:0,lastCalculatedPlayerTimeFraction:0,previousCalculatedPlayerTimeFraction:2},this.vfcData={counter:0,lastTimestamp:0,previousTimestamp:0,timeFromLastRAF:0,videoFPS:0,lastFrameMetadata:null,lastFrameMetadataNow:0,storedMetadata:[],timePerformanceNowToExpectedDisplayTime:0,timeRVFCnowToExpectedDisplayTime:0,mediaTimeOffset:0,lastMediaTimeFromSync:0,lastCalculatedMediaTimeVideoFrame:0},this.siData={counter:0,lastTimestamp:0,lastOffset:0,timeFromLastRAF:0,timeFromLastRVFC:0,lastSeenRAFCount:0,lastSeenRVFCCount:0,isRAFSeen:!1,isRVFCSeen:!1,isVideoPaused:!0,workingFps:0,refreshRate:0,RVFCmissed:0,RVFCframeExpected:0,expectedRefreshRate:0,avgExpectedRefreshRate:0,newRefreshRateFrames:0,expectedFPS:0,newFPSFrames:0,RVFCpattern:[],isRVFCpatternDetected:!1,patternTracking:[],patternTrackingIndex:-1,patternNextValue:-1,possibilityTracking:[],previousPossibilityValue:-1,lastCallback:null,lastCalculatedFrame:0,lastRendererFrameSent:0,lastMessageSent:"",compensationMode:!1,compensationCounter:0,frameCorrection:0,determineFramesIntervals:[],determineAFIntervals:[],expectedDisplayTimeReminder:0,animationFramesToDisplayTime:0},this.tcTimeStamp=0,this.timecode_offset=0,this.burnedLastTcKey=-1,this.sampleBurnedFrame=async()=>{var t;if(!(!this.OTTPlayer||!this.video)&&!(this.video.videoWidth===0||this.video.videoHeight===0)&&this.gl2Decoder)try{let s=await createImageBitmap(this.video);const i=this.gl2Decoder.decodeFromImageBitmap(s);if(!i){try{s.close()}catch{}return}const n=this.parseTcKey(i);if(this.burnedLastTcKey!==-1&&n<this.burnedLastTcKey-q.BACKWARD_JUMP_THRESHOLD&&(this.logger.info(`[Adapter] Backward timecode jump detected (${this.burnedLastTcKey} -> ${n}), resetting duplicate detection`),this.burnedLastTcKey=-1),n<=this.burnedLastTcKey){try{s.close()}catch{}return}this.burnedLastTcKey=n,this.metrics&&this.metrics.updateMetric("Last sent timecode",i),(t=this.OTTPlayer.clocker)==null||t.callRendererWorkerWithFrame(s,i),s=void 0}catch(s){this.logger.error("[Adapter] sampleBurnedFrame error: "+s)}},this.onAnimationFrame=t=>{if(this.video.paused||!this.OTTPlayer.clocker||!this.OTTPlayer.gameParams||!this.syncPoint){this.animationFrameLoopId=window.requestAnimationFrame(this.onAnimationFrame);return}this.afData.counter++,this.afData.previousTimestamp=this.afData.lastTimestamp,this.afData.lastTimestamp=performance.now(),this.afData.lastMetadataNow=t,this.afData.timeFromLastRVFC=this.afData.lastTimestamp-this.vfcData.lastTimestamp,this.afData.animationFPS=this.OTTPlayer.clocker.animationFPScalculator.getPerciseFPS(),this.siData.lastCallback=="RAF"&&this.siData.RVFCmissed++,this.siData.lastCallback="RAF";const s=(this.video.currentTime-this.syncPoint.playerTime)*(6e4/1001);this.afData.lastPlayerTimeFromSync=s;const i=Math.floor(s)+this.syncPoint.frame;this.afData.playerTimeOffset=L.calculateCurrentOffset(i,this.OTTPlayer.gameParams.offsets);let n=i-this.afData.playerTimeOffset;if(n<0&&(n+=5178816),n++,this.afData.lastCalculatedPlayerTimeVideoFrame=n,this.afData.previousCalculatedPlayerTimeFraction=this.afData.lastCalculatedPlayerTimeFraction,this.afData.lastCalculatedPlayerTimeFraction=s-Math.floor(s),this.metrics)try{this.metrics.updateMetric("RAF calls",this.afData.counter),this.metrics.updateMetric("Last player time",this.video.currentTime.toFixed(4)),this.metrics.updateMetric("Last player time frame",this.afData.lastCalculatedPlayerTimeVideoFrame),this.metrics.updateMetric("Last player time fraction",this.afData.lastCalculatedPlayerTimeFraction.toFixed(4)),this.metrics.updateMetric("Last player time double frame",this.afData.lastPlayerTimeFromSync.toFixed(5)),this.metrics.updateMetric("AF metadata now - perf.now()",(this.afData.lastTimestamp-this.afData.lastMetadataNow).toFixed(3)),this.metrics.updateMetric("VF ExpDispTime - AF metadata now",(this.afData.lastTimestamp-this.vfcData.lastFrameMetadata.expectedDisplayTime).toFixed(3)),this.metrics.updateMetric("Last RAF call",this.afData.lastTimestamp.toFixed(2)),this.metrics.updateMetric("RAF - RVFC dif",this.afData.timeFromLastRVFC.toFixed(2))}catch(o){this.options&&y(this.options,"Adapter")&&console.error(o)}this.animationFrameLoopId=window.requestAnimationFrame(this.onAnimationFrame),this.determineFrameUpdate()},this.onVideoFrame=(t,s)=>{if(this.firstVideoFrameCallbackFired||(this.firstVideoFrameCallbackFired=!0,this.logger.info("[Adapter] First video frame callback fired"),console.log("[Adapter] First video frame callback fired")),this.video.paused||!this.OTTPlayer.clocker||!this.OTTPlayer.gameParams||!this.syncPoint){this.videoFrameCallbackLoopId=this.video.requestVideoFrameCallback(this.onVideoFrame);return}this.vfcData.counter++,this.vfcData.previousTimestamp=this.vfcData.lastTimestamp,this.vfcData.lastTimestamp=performance.now(),this.vfcData.timeFromLastRAF=this.vfcData.lastTimestamp-this.afData.lastTimestamp,this.siData.RVFCmissed=0,this.vfcData.videoFPS=this.OTTPlayer.clocker.videoFPScalculator.getPerciseFPS(),this.siData.lastCallback="RVFC";const i=(s.mediaTime-this.syncPoint.playerTime)*(6e4/1001);this.vfcData.lastMediaTimeFromSync=i;const n=Math.floor(i+.1)+this.syncPoint.frame;this.vfcData.mediaTimeOffset=L.calculateCurrentOffset(n,this.OTTPlayer.gameParams.offsets);let o=n-this.vfcData.mediaTimeOffset;o<0&&(o+=5178816),o++,this.vfcData.lastCalculatedMediaTimeVideoFrame=o,this.vfcData.lastFrameMetadata=s,this.vfcData.storedMetadata.push(s),this.vfcData.storedMetadata.length>10&&this.vfcData.storedMetadata.shift(),this.vfcData.timePerformanceNowToExpectedDisplayTime=s.expectedDisplayTime-this.vfcData.lastTimestamp,this.vfcData.timeRVFCnowToExpectedDisplayTime=s.expectedDisplayTime-t,this.vfcData.lastFrameMetadataNow=t,this.metrics&&(this.metrics.updateMetric("MediaTime",s.mediaTime),this.metrics.updateMetric("MediaTimeWithSync",n),this.metrics.updateMetric("RVFC calls",this.vfcData.counter),this.metrics.updateMetric("Last metadata media time",s.mediaTime.toFixed(4)),this.metrics.updateMetric("Last metadata media time frame",this.vfcData.lastCalculatedMediaTimeVideoFrame),this.metrics.updateMetric("Time to presentation time",(s.presentationTime-t).toFixed(4)),this.metrics.updateMetric("Metadata presented frames",s.presentedFrames),this.metrics.updateMetric("Metadata processing duration",s.processingDuration),this.metrics.updateMetric("Last media time double frame",this.vfcData.lastMediaTimeFromSync.toFixed(5)),this.metrics.updateMetric("VF metadata now - perf.now()",(this.afData.lastTimestamp-this.afData.lastMetadataNow).toFixed(3)),this.metrics.updateMetric("RVFC to expected display time",this.vfcData.timeRVFCnowToExpectedDisplayTime.toFixed(4)),this.metrics.updateMetric("Performance Now to expected display time",this.vfcData.timePerformanceNowToExpectedDisplayTime.toFixed(4)),this.metrics.updateMetric("Last RVFC call",this.vfcData.lastTimestamp.toFixed(2))),this.videoFrameCallbackLoopId=this.video.requestVideoFrameCallback(this.onVideoFrame),this.determineFrameUpdate()},this.determineFrameUpdate=()=>{var s,i,n,o;if(!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata)return;this.siData.counter===0&&this.logger.info("didStartAugmentation"),this.siData.counter++,this.siData.isVideoPaused=this.video.paused,this.siData.isRAFSeen=this.siData.lastSeenRAFCount==this.afData.counter,this.siData.isRVFCSeen=this.siData.lastSeenRVFCCount==this.vfcData.counter,this.siData.lastTimestamp=performance.now(),this.siData.timeFromLastRAF=this.siData.lastTimestamp-this.afData.lastTimestamp,this.siData.timeFromLastRVFC=this.siData.lastTimestamp-this.vfcData.lastTimestamp,this.siData.lastSeenRAFCount=this.afData.counter,this.siData.lastSeenRVFCCount=this.vfcData.counter,this.siData.workingFps=this.OTTPlayer.clocker.videoFPScalculator.getFPS(),this.siData.refreshRate=this.OTTPlayer.clocker.animationFPScalculator.getPerciseFPS();const t=this.siData.lastTimestamp;if(t-this.lastBenchmarkUpdate>this.BENCHMARK_UPDATE_INTERVAL&&(this.runBenchmarkTest(),this.lastBenchmarkUpdate=t),this.OTTPlayer.statusOverlay&&t-this.lastStatusUpdate>this.STATUS_UPDATE_INTERVAL&&(this.updateStatusOverlay(),this.lastStatusUpdate=t),!this.OTTPlayer.options.ADAPTER_RUN_IN_WORKER)this.platformSpecificFrameUpdate();else{const a={siData:this.siData,vfcData:this.vfcData,afData:this.afData,debugControls:(s=this.debugControls)==null?void 0:s.exportData(),zipBaseURL:this.OTTPlayer.options.zipBaseURL,adsBaseURL:this.OTTPlayer.options.adsBaseURL,bucketName:((i=this.OTTPlayer.gameParams)==null?void 0:i.bucketName)||"",offsets:((n=this.OTTPlayer.gameParams)==null?void 0:n.offsets)||[],customerId:((o=this.OTTPlayer.gameParams)==null?void 0:o.customerId)||""};this.OTTPlayer.clocker.callAdapterWorker(a)}},this.determineFrameUpdateChromeMac=()=>{if(this.resumedAt>0&&performance.now()-this.resumedAt<this.SKIP_PROCESSING_AFTER_RESUME_MS)return;const t=Math.round(1e3/this.vfcData.timeRVFCnowToExpectedDisplayTime);t>0&&t<500&&(this.expectedRefreshRateCalculator.addFrameDuration(this.vfcData.timeRVFCnowToExpectedDisplayTime/1e3),Math.abs(this.siData.expectedRefreshRate-t)>4?this.siData.newRefreshRateFrames++:(this.siData.expectedRefreshRate=t,this.siData.avgExpectedRefreshRate=this.expectedRefreshRateCalculator.getPerciseFPS(),this.siData.newRefreshRateFrames=0),this.siData.newRefreshRateFrames>10&&(this.siData.newRefreshRateFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedRefreshRate=t,this.siData.isRVFCpatternDetected=!1));const s=this.OTTPlayer.clocker.videoFPScalculator.getPerciseFPS();if(s>0&&s<500&&(Math.abs(this.siData.expectedFPS-s)>4?this.siData.newFPSFrames++:(this.siData.expectedFPS=s,this.siData.newFPSFrames=0),this.siData.newFPSFrames>10&&(this.siData.newFPSFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedFPS=s,this.siData.isRVFCpatternDetected=!1)),this.video.paused||!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata)return;const i=20,n=1e3;if(!this.siData.isRVFCSeen){const o=Math.round(this.vfcData.timeRVFCnowToExpectedDisplayTime/(1e3/this.afData.animationFPS));if(o<=0&&this.siData.patternTracking.length<=1-o){this.siData.patternTracking=[!0];for(let a=0;a<1-o;a++)this.siData.patternTracking.push(!1)}else o<=1&&(this.siData.patternTracking[this.siData.patternTracking.length-2+o]=!0)}if(this.siData.isRAFSeen||this.siData.patternTracking.push(!1),this.siData.patternTracking.length>n&&this.siData.patternTracking.shift(),!this.siData.isRVFCpatternDetected){const o=this.siData.patternTracking;for(let a=1;a*i<=o.length;a++){for(let c=0;c+a*i<=o.length;c++){let d=!0;for(let l=0;l<i-1;l++){const u=o.slice(c+l*a,c+(l+1)*a),f=o.slice(c+(l+1)*a,c+(l+2)*a);if(!u.every((p,h)=>p===f[h])){d=!1;break}}if(d){const l=o.slice(c,c+a),u=l.every(h=>!h),f=l.every(h=>h),p=this.afData.animationFPS-this.vfcData.videoFPS;if(u||f&&p>5)continue;this.siData.RVFCpattern=l,this.siData.isRVFCpatternDetected=!0;break}}if(this.siData.isRVFCpatternDetected)break}}if(this.siData.RVFCpattern.length>0){const o=this.siData.RVFCpattern,a=this.siData.patternTracking;let c=-1;for(let d=a.length-o.length;d>=0;d--){let l=!0;for(let u=0;u<o.length;u++)if(o[u]!==a[d+u]){l=!1;break}if(l){c=d;break}}if(c>=0){const d=(a.length-c)%o.length,l=o[d];this.siData.patternTrackingIndex=d,this.siData.patternNextValue=l?1:0}if(a.length>=o.length*5){a.slice(a.length-o.length*5);let d=0,l=0;for(let u=0;u+o.length<=a.length;u++)a.slice(u,u+o.length).every((p,h)=>p===o[h])?(d++,l=Math.max(l,d),u+=o.length-1):d=0;l<6&&(this.siData.isRVFCpatternDetected=!1)}Math.abs(this.siData.avgExpectedRefreshRate-this.siData.refreshRate)>3&&(this.siData.isRVFCpatternDetected=!1)}if(this.metrics){performance.now();const o=[this.afData.lastTimestamp,this.vfcData.lastTimestamp,this.afData.previousTimestamp,this.vfcData.previousTimestamp].sort((l,u)=>u-l),a=o[0],c=o[1],d=a-c;this.siData.determineFramesIntervals||(this.siData.determineFramesIntervals=[]),this.siData.determineFramesIntervals.push(d.toFixed(2)),this.siData.determineFramesIntervals.length>10&&this.siData.determineFramesIntervals.shift(),this.metrics.updateMetric("Determine frames intervals",this.siData.determineFramesIntervals.join(", ")),this.metrics.updateMetric("RVFC missed",this.siData.RVFCmissed),this.metrics.updateMetric("Pattern found",this.siData.isRVFCpatternDetected),this.metrics.updateMetric("Pattern array",this.siData.RVFCpattern.map(l=>l?1:0).join("")),this.metrics.updateMetric("Pattern next index",this.siData.patternTrackingIndex),this.metrics.updateMetric("Pattern tracking",this.siData.patternTracking.slice(this.siData.patternTracking.length>100?this.siData.patternTracking.length-100:0).map(l=>l?1:0).join("")),this.metrics.updateMetric("Pattern next value",this.siData.patternNextValue),this.metrics.updateMetric("Refresh rate",this.siData.refreshRate.toFixed(2)),this.metrics.updateMetric("Expected Refresh Rate",this.siData.expectedRefreshRate),this.metrics.updateMetric("Avg Expected Refresh Rate",this.siData.avgExpectedRefreshRate.toFixed(2)),this.metrics.updateMetric("New Refresh Rate Frames",this.siData.newRefreshRateFrames)}if(!this.siData.isRAFSeen&&this.siData.isRVFCpatternDetected){let o=0,a=1,c=5;if(this.debugControls){const d=parseInt(this.debugControls.getValue("Pattern offset"),10);isNaN(d)||(o=d);const l=parseInt(this.debugControls.getValue("Frame Correction"),10);isNaN(l)||(a=l);const u=parseInt(this.debugControls.getValue("Timeout time"),10);isNaN(u)||(c=u)}this.siData.lastOffset!=this.vfcData.mediaTimeOffset&&(this.siData.lastOffset=this.vfcData.mediaTimeOffset,this.logger.info("didChangeOffset",{offset:this.vfcData.mediaTimeOffset}),this.logger.setAttributes({last_offset:this.vfcData.mediaTimeOffset})),this.siData.RVFCpattern[(this.siData.patternTrackingIndex+this.siData.RVFCpattern.length-1+o)%this.siData.RVFCpattern.length]?setTimeout(()=>this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame+a),c):this.callRenderer(this.siData.lastRendererFrameSent)}},this.determineFrameUpdateChromeWin=()=>{if(this.resumedAt>0&&performance.now()-this.resumedAt<this.SKIP_PROCESSING_AFTER_RESUME_MS)return;const t=Math.round(1e3/this.vfcData.timeRVFCnowToExpectedDisplayTime);t>0&&t<500&&(this.expectedRefreshRateCalculator.addFrameDuration(this.vfcData.timeRVFCnowToExpectedDisplayTime/1e3),Math.abs(this.siData.expectedRefreshRate-t)>3?this.siData.newRefreshRateFrames++:(this.siData.expectedRefreshRate=t,this.siData.avgExpectedRefreshRate=this.expectedRefreshRateCalculator.getPerciseFPS()),this.siData.newRefreshRateFrames>10&&(this.siData.newRefreshRateFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedRefreshRate=t,this.siData.isRVFCpatternDetected=!1));const s=this.OTTPlayer.clocker.videoFPScalculator.getPerciseFPS();if(s>0&&s<500&&(Math.abs(this.siData.expectedFPS-s)>4?this.siData.newFPSFrames++:(this.siData.expectedFPS=s,this.siData.newFPSFrames=0),this.siData.newFPSFrames>10&&(this.siData.newFPSFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedFPS=s,this.siData.isRVFCpatternDetected=!1)),this.video.paused||!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata)return;const i=20,n=1e3;if(!this.siData.isRVFCSeen){const o=Math.round(this.vfcData.timeRVFCnowToExpectedDisplayTime/(1e3/this.afData.animationFPS));if(o<=0&&this.siData.patternTracking.length<=1-o){this.siData.patternTracking=[!0];for(let a=0;a<1-o;a++)this.siData.patternTracking.push(!1)}else o<=1&&(this.siData.patternTracking[this.siData.patternTracking.length-2+o]=!0)}if(this.siData.isRAFSeen||this.siData.patternTracking.push(!1),this.siData.patternTracking.length>n&&this.siData.patternTracking.shift(),!this.siData.isRVFCpatternDetected){const o=this.siData.patternTracking;for(let a=1;a*i<=o.length;a++){for(let c=0;c+a*i<=o.length;c++){let d=!0;for(let l=0;l<i-1;l++){const u=o.slice(c+l*a,c+(l+1)*a),f=o.slice(c+(l+1)*a,c+(l+2)*a);if(!u.every((p,h)=>p===f[h])){d=!1;break}}if(d){const l=o.slice(c,c+a),u=l.every(h=>!h),f=l.every(h=>h),p=this.afData.animationFPS-this.vfcData.videoFPS;if(u||f&&p>5)continue;this.siData.RVFCpattern=l,this.siData.isRVFCpatternDetected=!0;break}}if(this.siData.isRVFCpatternDetected)break}}if(this.siData.RVFCpattern.length>0){const o=this.siData.RVFCpattern,a=this.siData.patternTracking;let c=-1;for(let d=a.length-o.length;d>=0;d--){let l=!0;for(let u=0;u<o.length;u++)if(o[u]!==a[d+u]){l=!1;break}if(l){c=d;break}}if(c>=0){const d=(a.length-c)%o.length,l=o[d];this.siData.patternTrackingIndex=d,this.siData.patternNextValue=l?1:0}if(a.length>=o.length*5){a.slice(a.length-o.length*5);let d=0,l=0;for(let u=0;u+o.length<=a.length;u++)a.slice(u,u+o.length).every((p,h)=>p===o[h])?(d++,l=Math.max(l,d),u+=o.length-1):d=0;l<6&&(this.siData.isRVFCpatternDetected=!1)}Math.abs(this.siData.avgExpectedRefreshRate-this.siData.refreshRate)>3&&(this.siData.isRVFCpatternDetected=!1)}if(this.metrics){performance.now();const o=[this.afData.lastTimestamp,this.vfcData.lastTimestamp,this.afData.previousTimestamp,this.vfcData.previousTimestamp].sort((l,u)=>u-l),a=o[0],c=o[1],d=a-c;this.siData.determineFramesIntervals||(this.siData.determineFramesIntervals=[]),this.siData.determineFramesIntervals.push(d.toFixed(2)),this.siData.determineFramesIntervals.length>10&&this.siData.determineFramesIntervals.shift(),this.metrics.updateMetric("Determine frames intervals",this.siData.determineFramesIntervals.join(", ")),this.metrics.updateMetric("RVFC missed",this.siData.RVFCmissed),this.metrics.updateMetric("Pattern found",this.siData.isRVFCpatternDetected),this.metrics.updateMetric("Pattern array",this.siData.RVFCpattern.map(l=>l?1:0).join("")),this.metrics.updateMetric("Pattern next index",this.siData.patternTrackingIndex),this.metrics.updateMetric("Pattern tracking",this.siData.patternTracking.slice(this.siData.patternTracking.length>100?this.siData.patternTracking.length-100:0).map(l=>l?1:0).join("")),this.metrics.updateMetric("Pattern next value",this.siData.patternNextValue),this.metrics.updateMetric("Refresh rate",this.siData.refreshRate.toFixed(2)),this.metrics.updateMetric("Expected Refresh Rate",this.siData.expectedRefreshRate),this.metrics.updateMetric("Avg Expected Refresh Rate",this.siData.avgExpectedRefreshRate.toFixed(2)),this.metrics.updateMetric("New Refresh Rate Frames",this.siData.newRefreshRateFrames)}if(!this.siData.isRAFSeen&&this.siData.isRVFCpatternDetected){let o=0,a=2,c=!1;if(this.debugControls){const u=parseInt(this.debugControls.getValue("Pattern offset"),10);isNaN(u)||(o=u);const f=parseInt(this.debugControls.getValue("Frame Correction"),10);isNaN(f)||(a=f),parseInt(this.debugControls.getValue("Timeout time"),10),this.debugControls.getValue("Video Captur Card Mode")==="true"&&(c=!0)}this.siData.lastOffset!=this.vfcData.mediaTimeOffset&&(this.siData.lastOffset=this.vfcData.mediaTimeOffset,this.logger.info("didChangeOffset",{offset:this.vfcData.mediaTimeOffset}),this.logger.setAttributes({last_offset:this.vfcData.mediaTimeOffset})),c&&(o+=1);const d=(this.siData.patternTrackingIndex+this.siData.RVFCpattern.length-1+o)%this.siData.RVFCpattern.length,l=(d+this.siData.RVFCpattern.length-1)%this.siData.RVFCpattern.length;if(this.siData.RVFCpattern[d]){let u=0;c&&this.siData.lastRendererFrameSent==this.vfcData.lastCalculatedMediaTimeVideoFrame&&this.siData.RVFCpattern[l]&&(u=2),this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame+u+a)}}},this.determineFrameUpdateSifariMac=()=>{if(this.resumedAt>0&&performance.now()-this.resumedAt<this.SKIP_PROCESSING_AFTER_RESUME_MS||(this.siData.expectedRefreshRate&&this.siData.expectedFPS&&(this.expectedRefreshRateCalculator.addFrameDuration(1/this.siData.refreshRate),this.siData.avgExpectedRefreshRate=this.expectedRefreshRateCalculator.getPerciseFPS(),Math.abs(this.siData.expectedRefreshRate-this.siData.avgExpectedRefreshRate)>3&&this.siData.newRefreshRateFrames++,Math.abs(this.siData.expectedFPS-this.siData.workingFps)>3&&this.siData.newFPSFrames++,(this.siData.newRefreshRateFrames>10||this.siData.newFPSFrames>10)&&(this.siData.newRefreshRateFrames=0,this.siData.expectedRefreshRate=0,this.siData.newFPSFrames=0,this.siData.expectedFPS=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.isRVFCpatternDetected=!1)),this.video.paused||!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata))return;const t=Math.abs(this.siData.refreshRate-this.siData.workingFps)<2?8:20,s=1e3,i=[this.afData.lastTimestamp,this.vfcData.lastTimestamp,this.afData.previousTimestamp,this.vfcData.previousTimestamp].sort((h,m)=>m-h),n=2,o=i[0],a=i[1],c=o-a,d=1e3/this.afData.animationFPS,l=Math.round(d/4+.1),u=this.vfcData.timeRVFCnowToExpectedDisplayTime;if(this.siData.isRVFCSeen)this.metrics;else{const h=(-u-l)/d,m=Math.ceil(h),g=(Math.round(h)-h)*d,E=Math.abs(g)<=n,T=g<=0?m-1:m+1,C=Math.abs(-u-l)<=n;if(this.metrics&&(this.metrics.updateMetric("Is Smoothing Needed",E),this.metrics.updateMetric("Is More Than Border",m),this.metrics.updateMetric("Is Smoothed",T)),E&&!C){const w=Math.min(m,T),x=Math.max(m,T);this.metrics&&this.metrics.updateMetric("Pssblty next index",""+w+" "+x),this.siData.possibilityTracking[this.siData.possibilityTracking.length-w]=2,this.siData.possibilityTracking[this.siData.possibilityTracking.length-x]=1}else E&&C&&(this.metrics&&this.metrics.updateMetric("Pssblty next index","min"),this.siData.possibilityTracking[this.siData.possibilityTracking.length-1]=1,this.siData.possibilityTracking.push(2),this.siData.possibilityTracking.push(3));if(-u<l)this.siData.expectedDisplayTimeReminder=-u;else if(c>d&&-u-(c-d)<=l)this.siData.expectedDisplayTimeReminder=-u-(c-d);else{let w=-u-c,x=0,v=this.siData.determineFramesIntervals.length-1;for(let I=this.siData.determineAFIntervals.length-1;I>=0&&(v--,!(this.siData.determineAFIntervals[I]>d&&w-(this.siData.determineAFIntervals[I]-d)<=l||w<=l||this.siData.determineFramesIntervals[v].includes("vf")&&this.siData.workingFps<40));I--)w-=this.siData.determineAFIntervals[I],x+=1;if(this.siData.patternTracking.length<x+1){this.siData.patternTracking=[!0];for(let I=0;I<x;I++)this.siData.patternTracking.push(!1)}else this.siData.patternTracking[this.siData.patternTracking.length-1-x]=!0;this.siData.animationFramesToDisplayTime=x}}if(this.siData.isRAFSeen||(this.siData.expectedDisplayTimeReminder?(this.siData.expectedDisplayTimeReminder-l,this.siData.expectedDisplayTimeReminder+c<=l?(this.siData.patternTracking.push(!0),this.siData.animationFramesToDisplayTime=0):(this.siData.patternTracking[this.siData.patternTracking.length-1]=!0,this.siData.patternTracking.push(!1),this.siData.animationFramesToDisplayTime=1),this.siData.expectedDisplayTimeReminder=0):(this.siData.patternTracking.push(!1),this.siData.animationFramesToDisplayTime+=1),this.siData.possibilityTracking[this.siData.possibilityTracking.length-1]==3?this.siData.possibilityTracking.pop():this.siData.possibilityTracking.push(0)),this.siData.patternTracking.length>s&&this.siData.patternTracking.shift(),this.siData.possibilityTracking.length>s&&this.siData.possibilityTracking.shift(),!this.siData.isRVFCpatternDetected){const h=this.siData.patternTracking;for(let m=1;m*t<=h.length;m++){for(let g=0;g+m*t<=h.length;g++){let E=!0;for(let b=0;b<t-1;b++){const T=h.slice(g+b*m,g+(b+1)*m),C=h.slice(g+(b+1)*m,g+(b+2)*m);if(!T.every((w,x)=>w===C[x])){E=!1;break}}if(E){const b=h.slice(g,g+m),T=b.every(x=>!x),C=b.every(x=>x),w=this.afData.animationFPS-this.vfcData.videoFPS;if(T||C&&w>5)continue;this.siData.RVFCpattern=b,this.siData.isRVFCpatternDetected=!0;break}}if(this.siData.isRVFCpatternDetected){this.siData.expectedRefreshRate=this.siData.refreshRate,this.siData.expectedFPS=this.siData.workingFps;break}}}if(this.siData.RVFCpattern.length>0){const h=this.siData.RVFCpattern,m=this.siData.patternTracking;let g=-1;for(let E=m.length-h.length*5;E>=0;E--){let b=!0;for(let T=0;T<h.length*5;T++)if(h[T%h.length]!==m[E+T]){b=!1;break}if(b){g=E;break}}if(g>=0){const E=(m.length-g)%h.length,b=h[E];this.siData.patternTrackingIndex=E,this.siData.patternNextValue=b?1:0}if(m.length>=h.length*5){m.slice(m.length-h.length*5);let E=0,b=0;for(let T=0;T+h.length<=m.length;T++)m.slice(T,T+h.length).every((w,x)=>w===h[x])?(E++,b=Math.max(b,E),T+=h.length-1):E=0;b<6&&(this.siData.isRVFCpatternDetected=!1)}}const f=[];for(let h=1;h<=3;h++)f.push(this.siData.possibilityTracking[this.siData.possibilityTracking.length-this.siData.RVFCpattern.length*h]);const p=Math.max(...f);if(this.metrics){let h="";if(this.siData.isRAFSeen?h="vf: "+c.toFixed(0):h="af: "+c.toFixed(0),this.siData.determineFramesIntervals.push(h),this.siData.determineFramesIntervals.length>10&&this.siData.determineFramesIntervals.shift(),!this.siData.isRAFSeen){const m=this.afData.lastTimestamp-this.afData.previousTimestamp;this.siData.determineAFIntervals.push(m),this.siData.determineAFIntervals.length>10&&this.siData.determineAFIntervals.shift()}this.siData.isRVFCSeen||this.metrics.updateMetric("Last AF to VF time",(this.vfcData.lastTimestamp-this.afData.lastTimestamp).toFixed(0)),this.metrics.updateMetric("Determine frames intervals",this.siData.determineFramesIntervals.join(", ")),this.metrics.updateMetric("AF frames intervals",this.siData.determineAFIntervals.map(m=>m.toFixed(0)).join(", ")),this.metrics.updateMetric("RVFC missed",this.siData.RVFCmissed),this.metrics.updateMetric("Pattern found",this.siData.isRVFCpatternDetected),this.metrics.updateMetric("Pattern array",this.siData.RVFCpattern.map(m=>m?1:0).join("")),this.metrics.updateMetric("Pattern next index",this.siData.patternTrackingIndex),this.metrics.updateMetric("Pattern tracking",this.siData.patternTracking.map(m=>m?1:0).slice(this.siData.patternTracking.length>100?this.siData.patternTracking.length-100:0).join("")),this.metrics.updateMetric("Pattern next value",this.siData.patternNextValue),this.metrics.updateMetric("Pssblty found",this.siData.isRVFCpatternDetected),this.metrics.updateMetric("Pssblty array",this.siData.RVFCpattern.map(m=>m?1:0).join("")),this.metrics.updateMetric("Pssblty tracking",this.siData.possibilityTracking.slice(this.siData.possibilityTracking.length>100?this.siData.possibilityTracking.length-100:0).join("")),this.metrics.updateMetric("Pssblty next value",p),this.metrics.updateMetric("Refresh rate",this.siData.refreshRate.toFixed(2)),this.metrics.updateMetric("Expected Refresh Rate",this.siData.expectedRefreshRate.toFixed(5)),this.metrics.updateMetric("Avg Expected Refresh Rate",this.siData.avgExpectedRefreshRate.toFixed(5)),this.metrics.updateMetric("New Refresh Rate Frames",this.siData.newRefreshRateFrames),this.metrics.updateMetric("AF To Display Time",this.siData.animationFramesToDisplayTime),this.metrics.updateMetric("Call Renderer Reached",!1)}if(!this.siData.isRAFSeen&&this.siData.isRVFCpatternDetected){let h=0,m=0;if(this.debugControls){const E=parseInt(this.debugControls.getValue("Pattern offset"),10);isNaN(E)||(h=E);const b=parseInt(this.debugControls.getValue("Frame Correction"),10);isNaN(b)||(m=b),parseInt(this.debugControls.getValue("Timeout time"),10)}this.siData.lastOffset!=this.vfcData.mediaTimeOffset&&(this.siData.lastOffset=this.vfcData.mediaTimeOffset,this.logger.info("didChangeOffset",{offset:this.vfcData.mediaTimeOffset}),this.logger.setAttributes({last_offset:this.vfcData.mediaTimeOffset}));const g=(this.siData.patternTrackingIndex+this.siData.RVFCpattern.length+h)%this.siData.RVFCpattern.length;if(this.siData.RVFCpattern[g]||p){const E=Math.ceil(this.siData.animationFramesToDisplayTime/this.siData.RVFCpattern.length)+1,b=this.siData.RVFCpattern.map(Ue=>Ue?1:0).join("").repeat(E),T=(this.siData.RVFCpattern.length-this.siData.patternTrackingIndex)%this.siData.RVFCpattern.length,C=b.slice(0,T==0?-this.siData.RVFCpattern.length:-T);let w=0;const x=this.siData.possibilityTracking.length-1-this.siData.animationFramesToDisplayTime;C[C.length-1-this.siData.animationFramesToDisplayTime]=="0"&&this.siData.possibilityTracking[x]==1&&(w=-1);const v=this.siData.animationFramesToDisplayTime+w,I=v<=0?"":C.slice(-v);let ke=I.split("").filter(Ue=>Ue==="1").length*Math.round(60/this.siData.workingFps);this.siData.workingFps<40&&(ke+=1),this.siData.compensationMode&&!(p==2||this.siData.previousPossibilityValue==2)&&(this.siData.compensationCounter=1,this.siData.compensationMode=!1),this.siData.compensationCounter==1?this.siData.possibilityTracking.slice(-5).every(Ue=>Ue===0)&&(this.siData.compensationCounter-=.1):this.siData.compensationCounter>0&&this.siData.compensationCounter<1&&(this.siData.compensationCounter=Math.max(this.siData.compensationCounter-.1,0)),p==1?this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame+ke+m-1,this.siData.compensationCounter):p==2&&this.siData.previousPossibilityValue==1?this.callRenderer(this.siData.lastRendererFrameSent+1,this.siData.compensationCounter):this.siData.RVFCpattern[g]&&((p==2||this.siData.previousPossibilityValue==2)&&Math.abs(this.afData.animationFPS-this.siData.workingFps)<5&&this.siData.lastRendererFrameSent==this.vfcData.lastCalculatedMediaTimeVideoFrame+ke+m?(this.callRenderer(this.siData.lastRendererFrameSent+1,this.siData.compensationCounter),this.siData.compensationMode=!0):this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame+ke+m,this.siData.compensationCounter)),this.metrics&&(this.metrics.updateMetric("Call Renderer Reached",!0),this.metrics.updateMetric("Is Smoothing Needed",this.siData.compensationMode),this.metrics.updateMetric("Correction",ke),this.metrics.updateMetric("Compensation Counter",this.siData.compensationCounter),this.metrics.updateMetric("Repeated Pattern",b),this.metrics.updateMetric("Trimmed Pattern",C),this.metrics.updateMetric("Sliced Pattern",I),this.metrics.updateMetric("AF To Display Time Correction",w)),this.siData.previousPossibilityValue=p}else this.callRenderer(this.siData.lastRendererFrameSent)}},this.determineFrameUpdateFirefoxMac=()=>{if(this.resumedAt>0&&performance.now()-this.resumedAt<this.SKIP_PROCESSING_AFTER_RESUME_MS)return;const t=Math.round(1e3/this.vfcData.timeRVFCnowToExpectedDisplayTime);if(t>0&&t<500&&(this.expectedRefreshRateCalculator.addFrameDuration(this.vfcData.timeRVFCnowToExpectedDisplayTime/1e3),Math.abs(this.siData.expectedRefreshRate-t)>3?this.siData.newRefreshRateFrames++:(this.siData.expectedRefreshRate=t,this.siData.avgExpectedRefreshRate=this.expectedRefreshRateCalculator.getPerciseFPS()),this.siData.newRefreshRateFrames>10&&(this.siData.newRefreshRateFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedRefreshRate=t,this.siData.isRVFCpatternDetected=!1)),this.video.paused||!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata)return;const s=5,i=1e3;if(!this.siData.isRVFCSeen){const n=Math.round(this.vfcData.timeRVFCnowToExpectedDisplayTime/(1e3/this.afData.animationFPS));if(n<=0&&this.siData.patternTracking.length<=1-n){this.siData.patternTracking=[!0];for(let o=0;o<1-n;o++)this.siData.patternTracking.push(!1)}else n<=1&&(this.siData.patternTracking[this.siData.patternTracking.length-2+n]=!0)}if(this.siData.isRAFSeen||this.siData.patternTracking.push(!1),this.siData.patternTracking.length>i&&this.siData.patternTracking.shift(),!this.siData.isRVFCpatternDetected){const n=this.siData.patternTracking;for(let o=1;o*s<=n.length;o++){for(let a=0;a+o*s<=n.length;a++){let c=!0;for(let d=0;d<s-1;d++){const l=n.slice(a+d*o,a+(d+1)*o),u=n.slice(a+(d+1)*o,a+(d+2)*o);if(!l.every((f,p)=>f===u[p])){c=!1;break}}if(c){const d=n.slice(a,a+o),l=d.every(p=>!p),u=d.every(p=>p),f=this.afData.animationFPS-this.vfcData.videoFPS;if(l||u&&f>5)continue;this.siData.RVFCpattern=d,this.siData.isRVFCpatternDetected=!0;break}}if(this.siData.isRVFCpatternDetected)break}}if(this.siData.RVFCpattern.length>0){const n=this.siData.RVFCpattern,o=this.siData.patternTracking;let a=-1;for(let c=o.length-n.length;c>=0;c--){let d=!0;for(let l=0;l<n.length;l++)if(n[l]!==o[c+l]){d=!1;break}if(d){a=c;break}}if(a>=0){const c=(o.length-a)%n.length,d=n[c];this.siData.patternTrackingIndex=c,this.siData.patternNextValue=d?1:0}if(o.length>=n.length*5){o.slice(o.length-n.length*5);let c=0,d=0;for(let l=0;l+n.length<=o.length;l++)o.slice(l,l+n.length).every((f,p)=>f===n[p])?(c++,d=Math.max(d,c),l+=n.length-1):c=0;d<5&&(this.siData.isRVFCpatternDetected=!1)}Math.abs(this.siData.avgExpectedRefreshRate-this.siData.refreshRate)>3&&(this.siData.isRVFCpatternDetected=!1)}if(this.metrics){performance.now();const n=[this.afData.lastTimestamp,this.vfcData.lastTimestamp,this.afData.previousTimestamp,this.vfcData.previousTimestamp].sort((d,l)=>l-d),o=n[0],a=n[1],c=o-a;this.siData.determineFramesIntervals||(this.siData.determineFramesIntervals=[]),this.siData.determineFramesIntervals.push(c.toFixed(2)),this.siData.determineFramesIntervals.length>10&&this.siData.determineFramesIntervals.shift(),this.metrics.updateMetric("Determine frames intervals",this.siData.determineFramesIntervals.join(", ")),this.metrics.updateMetric("RVFC missed",this.siData.RVFCmissed),this.metrics.updateMetric("Pattern found",this.siData.isRVFCpatternDetected),this.metrics.updateMetric("Pattern array",this.siData.RVFCpattern.map(d=>d?1:0).join("")),this.metrics.updateMetric("Pattern next index",this.siData.patternTrackingIndex),this.metrics.updateMetric("Pattern tracking",this.siData.patternTracking.slice(this.siData.patternTracking.length>100?this.siData.patternTracking.length-100:0).map(d=>d?1:0).join("")),this.metrics.updateMetric("Pattern next value",this.siData.patternNextValue),this.metrics.updateMetric("Refresh rate",this.siData.refreshRate.toFixed(2)),this.metrics.updateMetric("Expected Refresh Rate",this.siData.expectedRefreshRate),this.metrics.updateMetric("Avg Expected Refresh Rate",this.siData.avgExpectedRefreshRate.toFixed(2)),this.metrics.updateMetric("New Refresh Rate Frames",this.siData.newRefreshRateFrames)}if(!this.siData.isRAFSeen&&this.siData.isRVFCpatternDetected){let n=0,o=1;if(this.debugControls){const a=parseInt(this.debugControls.getValue("Pattern offset"),10);isNaN(a)||(n=a);const c=parseInt(this.debugControls.getValue("Frame Correction"),10);isNaN(c)||(o=c),parseInt(this.debugControls.getValue("Timeout time"),10)}if(this.siData.lastOffset!=this.vfcData.mediaTimeOffset&&(this.siData.lastOffset=this.vfcData.mediaTimeOffset,this.logger.info("didChangeOffset",{offset:this.vfcData.mediaTimeOffset}),this.logger.setAttributes({last_offset:this.vfcData.mediaTimeOffset})),this.siData.RVFCpattern[(this.siData.patternTrackingIndex+this.siData.RVFCpattern.length-1+n)%this.siData.RVFCpattern.length]){let a=this.vfcData.lastCalculatedMediaTimeVideoFrame+o;a==this.siData.lastRendererFrameSent&&(a+=2),this.callRenderer(a)}else this.callRenderer(this.siData.lastRendererFrameSent)}},this.callRenderer=(t,s)=>{if(!this.OTTPlayer.clocker||!this.OTTPlayer)return;this.siData.lastRendererFrameSent=t,this.metrics&&this.metrics.updateMetric("Last sent frame",t);const i=this.OTTPlayer.clocker.videoFPScalculator.getFPS();this.metrics&&this.metrics.updateMetric("FPS",i.toFixed(2));const n=L.fromFrames(t,6e4/1001);this.renderAugmentation(n,s)},this.playbackTimeDelta=0,this.wallClockTimeDelta=0,this.dateTimeDelta=0,this.renderAugmentation=(t,s)=>{if(!this.OTTPlayer||!this.OTTPlayer.clocker)throw new Error("OTTPlayer is not initialized");const i=L.toStr(t);this.siData.lastMessageSent=i,this.options&&y(this.options,"Adapter")&&console.log(`Rendering augmentation for timecode: ${i} , ${t}`),this.metrics&&this.metrics.updateMetric("Last sent timecode",i),this.OTTPlayer.clocker.callRendererWorker(i,s)},this.onVideoSeeked=()=>{this.firstFrameTimecode=[0,0,0,0,0],this.firstFrameTimecodeSet=!1,this.burnedLastTcKey=-1,this.isMKAdPlaying&&(this.options&&y(this.options,"Adapter")&&console.log("[Adapter] Resetting MK ad state after seek/scrub"),this.isMKAdPlaying=!1)},this.clearAugmentation=t=>{if(!this.OTTPlayer||!this.OTTPlayer.clocker)throw new Error("OTTPlayer is not initialized");const s=t?L.toStr(t):void 0;this.options&&y(this.options,"Adapter")&&console.log("Clearing augmentation"),this.OTTPlayer.clocker.callRendererWorker(s,0,!0)},this.logger=e.logger,this.OTTPlayer=e,this.options=e.options,this.benchmark=new ps(e.options.BENCHMARK_DURATION_SECONDS),this.options&&y(this.options,"Adapter")&&console.log("Adapter is initialized",this.OTTPlayer),this.video=e.video,this.debug=this.options.debug?this.options.debug.on:!1,this.expectedRefreshRateCalculator=new it(20),B.isChromeMac())this.platformSpecificFrameUpdate=this.determineFrameUpdateChromeMac;else if(B.isChromeWin())this.platformSpecificFrameUpdate=this.determineFrameUpdateChromeWin;else{if(B.isSafariMac(),B.isFirefoxMac(),this.platformSpecificFrameUpdate=()=>{},!this.options.BURNED_TIMECODES_MODE){this.logger.criticalError("Unsupported platform",{platform:this.options.platform,browserName:this.options.browserName}),console.error("Unsupported platform: "+this.options.platform+" "+this.options.browserName),this.platformSupported=!1;return}this.platformSupported=!0}if(this.debug){this.metrics=new Xt;const t=this.metrics.createContainer(),s=this.metrics.createContainer(),i=this.metrics.createContainer(),n=this.metrics.createContainer(),o=this.metrics.createContainer(),a=this.metrics.createContainer(),c=this.metrics.createContainer(),d=this.metrics.createContainer(),l=this.metrics.createContainer(),u=this.metrics.createContainer(),f=this.metrics.createContainer(),p=this.metrics.createContainer(),h=this.metrics.createContainer(),m=this.metrics.createContainer(),g=this.metrics.createContainer(),E=this.metrics.createContainer();this.metrics.createMetric("tcTimeStamp",t),this.metrics.createMetric("timecodeOffset",t),this.metrics.createMetric("firstFrameTimecode",t),this.metrics.createMetric("frame",s),this.metrics.createMetric("playerTime",s),this.metrics.createMetric("stringTime",s),this.metrics.createMetric("lastUpdate",s),this.metrics.createMetric("MediaTime",i),this.metrics.createMetric("MediaTimeWithSync",i),this.metrics.createMetric("RAF calls",n),this.metrics.createMetric("RVFC calls",n),this.metrics.createMetric("RVFC missed",n),this.metrics.createMetric("Last sent frame",n),this.metrics.createMetric("Last sent timecode",n),this.metrics.createMetric("Last metadata media time",o),this.metrics.createMetric("Last player time",o),this.metrics.createMetric("RVFC to expected display time",o),this.metrics.createMetric("Performance Now to expected display time",o),this.metrics.createMetric("Last metadata media time frame",a),this.metrics.createMetric("Last player time frame",a),this.metrics.createMetric("Last player time fraction",a),this.metrics.createMetric("Last media time double frame",c),this.metrics.createMetric("Last player time double frame",c),this.metrics.createMetric("Compensation Counter",c),this.metrics.createMetric("AF metadata now - perf.now()",d),this.metrics.createMetric("VF metadata now - perf.now()",d),this.metrics.createMetric("VF ExpDispTime - AF metadata now",d),this.metrics.createMetric("Time to presentation time",l),this.metrics.createMetric("Metadata presented frames",l),this.metrics.createMetric("Metadata processing duration",l),this.metrics.createMetric("FPS",u),this.metrics.createMetric("Refresh rate",u),this.metrics.createMetric("Last RAF call",u),this.metrics.createMetric("Last RVFC call",u),this.metrics.createMetric("RAF - RVFC dif",u),this.metrics.createMetric("Determine frames intervals",f),this.metrics.createMetric("Last AF to VF time",p),this.metrics.createMetric("AF frames intervals",p),this.metrics.createMetric("Expected Refresh Rate",h),this.metrics.createMetric("Avg Expected Refresh Rate",h),this.metrics.createMetric("New Refresh Rate Frames",h),this.metrics.createMetric("AF To Display Time",h),this.metrics.createMetric("AF To Display Time Correction",h),this.metrics.createMetric("Call Renderer Reached",h),this.metrics.createMetric("Is Smoothing Needed",m),this.metrics.createMetric("Is More Than Border",m),this.metrics.createMetric("Is Smoothed",m),this.metrics.createMetric("Correction",m),this.metrics.createMetric("Repeated Pattern",m),this.metrics.createMetric("Trimmed Pattern",m),this.metrics.createMetric("Sliced Pattern",m),this.metrics.createMetric("Pattern found",g),this.metrics.createMetric("Pattern array",g),this.metrics.createMetric("Pattern tracking",g),this.metrics.createMetric("Pattern next index",g),this.metrics.createMetric("Pattern next value",g),this.metrics.createMetric("Pssblty found",E),this.metrics.createMetric("Pssblty array",E),this.metrics.createMetric("Pssblty tracking",E),this.metrics.createMetric("Pssblty next index",E),this.metrics.createMetric("Pssblty next value",E),this.debugControls=new us;const b=this.debugControls.createContainer(),T=this.debugControls.createContainer();this.debugControls.createInput("Window Start (ms)",4,b),this.debugControls.createInput("Window End (ms)",-11,b),this.debugControls.createSelect("Pattern offset",{"-5":-5,"-4":-4,"-3":-3,"-2":-2,"-1":-1,0:0,1:1,2:2,3:3,4:4,5:5},"0",b),this.debugControls.createCheckbox("Video Captur Card Mode",!1,b),B.isChromeWin()?this.debugControls.createSelect("Frame Correction",{"-4":-4,"-3":-3,"-2":-2,"-1":-1,0:0,1:1,2:2,3:3,4:4},"2",T):B.isSafariMac()?this.debugControls.createSelect("Frame Correction",{"-4":-4,"-3":-3,"-2":-2,"-1":-1,0:0,1:1,2:2,3:3,4:4},"0",T):this.debugControls.createSelect("Frame Correction",{"-4":-4,"-3":-3,"-2":-2,"-1":-1,0:0,1:1,2:2,3:3,4:4},"1",T),this.debugControls.createSelect("Timeout time",{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20},"5",T)}this.platformSupported&&(this.OTTPlayer.video.readyState>=3?this.setupAdapter():this.OTTPlayer.video.addEventListener("canplay",()=>this.setupAdapter(),{once:!0}))}isVideoFpsSupported(e){return e>q.MIN_SUPPORTED_FPS&&e<=q.MAX_SUPPORTED_FPS}setupAdapter(){const e=this.video;if(this.options.BURNED_TIMECODES_MODE){this.startBurnedPipeline();return}if(this.debug){const t=typeof wmcsdk<"u"?wmcsdk:wmcPlayer;console.log(t);const s=t.getAvailableVideoQualities(),i={};s.forEach(a=>{i[a.label]=a.id});const n=a=>{t.doSetVideoQuality(a.videoQuality)},o=this.debugControls.createContainer(n);this.debugControls.createSelect("videoQuality",i,s[0].id,o)}this.animationFrameLoopId=window.requestAnimationFrame(this.onAnimationFrame),this.videoFrameCallbackLoopId=e.requestVideoFrameCallback(this.onVideoFrame)}startBurnedPipeline(){this.gl2Decoder=new ms,this.burnedIntervalId=window.setInterval(this.sampleBurnedFrame,33)}stopBurnedPipeline(){this.burnedIntervalId&&(window.clearInterval(this.burnedIntervalId),this.burnedIntervalId=void 0),this.gl2Decoder&&(this.gl2Decoder.dispose(),this.gl2Decoder=void 0),this.burnedLastTcKey=-1}parseTcKey(e){const t=e.split("_");if(t.length<4)return-1;const s=parseInt(t[0],10)||0,i=parseInt(t[1],10)||0,n=parseInt(t[2],10)||0,o=parseInt(t[3],10)||0,a=t.length>=5&&t[4]==="1"?1:0;return((s*3600+i*60+n)*60+o)*2+a}runBenchmarkTest(){var i,n;const e=((i=this.OTTPlayer.clocker)==null?void 0:i.videoFPScalculator.getPerciseFPS())||0,t=this.isVideoFpsSupported(e),s=this.benchmark.test({gameParams:!!this.OTTPlayer.gameParams,browserSupported:this.platformSupported,patternDetected:this.siData.isRVFCpatternDetected,fpsSupported:t,noMKAdsPlaying:!this.isMKAdPlaying,syncPointSet:!!this.syncPoint});s.shouldClear&&(this.options&&y(this.options,"Adapter")&&console.log("[Benchmark] Failed - clearing augmentation. Reasons:",(n=s.failedConditions)==null?void 0:n.join(", ")),this.clearAugmentation())}updateStatusOverlay(){var n,o;const e=this.OTTPlayer.statusOverlay;e.updateMetric("support","browser",this.platformSupported,`${this.options.browserName} on ${this.options.platform}`),e.updateMetric("support","pattern",this.siData.isRVFCpatternDetected,this.siData.isRVFCpatternDetected?this.siData.RVFCpattern.map(a=>a?"1":"0").join("").slice(0,20):"Detecting...");const t=((n=this.OTTPlayer.clocker)==null?void 0:n.videoFPScalculator.getPerciseFPS())||0,s=this.isVideoFpsSupported(t);e.updateMetric("support","fps",s,t>0?`${t.toFixed(2)} fps`:"Detecting..."),e.updateMetric("support","game_params",!!this.OTTPlayer.gameParams),e.updateMetric("support","mk_ads",!this.isMKAdPlaying,this.isMKAdPlaying?"Ad in progress":"No ads"),this.syncPoint?e.updateMetric("timecode","sync_point",!0,this.syncPoint.stringTime):e.updateMetric("timecode","sync_point",!1,"Not set");const i=this.benchmark.getStatus();e.updateMetric("benchmark","status",i.state,i.state==="TESTING"?`Stability test: ${i.remainingSeconds}s`:i.state==="FAILED"?`Failed: ${(o=i.failedConditions)==null?void 0:o.join(", ")}`:"Stable")}onNewSegmentForMetadata(e){if(!this.firstFrameTimecodeSet){const a=performance.now();a-this.loggerTimeoutStart>this.loggerTimeout&&(this.loggerTimeoutStart=a,this.logger.error("[Adapter] First frame timecode of the recieved segment not set")),console.error("[Adapter] First frame timecode of the recieved segment not set");return}const t=fs(this.firstFrameTimecode,6e4/1001);if(!e.mimeType.includes("video"))return;const s=hs(this.firstFrameTimecode,!0,!0);this.options&&y(this.options,"Adapter")&&console.log("New segment ("+e.url+"): "+s+" ("+t+") playing at "+e.playbackTime);const i=e.playbackTime;i-this.playbackTimeDelta,this.playbackTimeDelta=i;const n=e.wallClockTime/1e3;if(n-this.wallClockTimeDelta,this.wallClockTimeDelta=n,e.dateTime instanceof Date){const a=e.dateTime.getTime()/1e3;a-this.dateTimeDelta,this.dateTimeDelta=a}const o={frame:t,playerTime:i,stringTime:s,lastUpdate:performance.now()};this.syncPoint=o,this.metrics&&(this.metrics.updateMetric("frame",o.frame),this.metrics.updateMetric("playerTime",o.playerTime),this.metrics.updateMetric("stringTime",o.stringTime),this.metrics.updateMetric("lastUpdate",o.lastUpdate)),this.options&&y(this.options,"Adapter")&&console.log("url: "+e.url)}onNewMetadata(e){if(e&&e.metadata&&e.metadata.id==0||B.isSafariMac()){console.log("onNewMetadata: ",e);let t=!1;if(e.metadata.messageData)t=this.processTimedMetadata(e.metadata.messageData,e.metadata.presentationTime);else if(e.metadata.frames&&e.metadata.frames.length&&e.metadata.frames[0].key&&e.metadata.frames[0].key.toLowerCase()==="priv"){const s=e.metadata.frames.filter(i=>i.info&&i.info.toLowerCase().includes("ntc"));if(s.length){const i=`${s[s.length-1].info}\0${String.fromCharCode(...s[s.length-1].data)}`;t=this.processTimedMetadata(i,e.metadata.presentationTime)}}if(t&&(e.metadata.id==0||B.isSafariMac()&&this.timecode_offset==0)){e.metadata.presentationTime*1e3,this.logger.setAttributes({id3_metadata:this.tcTimeStamp-this.timecode_offset});const s=new Date(this.tcTimeStamp-this.timecode_offset);let i=Math.round(s.getUTCMilliseconds()*30*2/1001)/2;const n=i%1;let o=1;n==.5&&(i=Math.floor(i),o=2),this.firstFrameTimecode=[s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),Math.floor(i),o==1?0:1],this.logger.setAttributes({segment_first_frame_timecode:this.firstFrameTimecode}),this.firstFrameTimecodeSet||this.logger.info(`[Adapter] Segment first frame timecode set: ${this.firstFrameTimecode}`),this.firstFrameTimecodeSet=!0,console.log("First frame timecode reciesved at: ",new Date().toISOString()),console.log("First frame timecode: ",this.firstFrameTimecode),console.log("video.currentTime: ",this.video.currentTime),console.log("video.currentTime to UTC: ",new Date(this.video.currentTime*1e3).toISOString()),this.metrics&&(this.metrics.updateMetric("tcTimeStamp",this.tcTimeStamp),this.metrics.updateMetric("timecodeOffset",this.timecode_offset),this.metrics.updateMetric("firstFrameTimecode",this.firstFrameTimecode.join(",")))}}}onAdEvent(e){this.options&&y(this.options,"Adapter")&&console.log(`MK Ad event: ${e}`),this.isMKAdPlaying=e==="start"}parseId3Tag(e,t){console.log("Parsing ID3 tag: ",t);const s=e.exec(t);return s&&s[1]?s[1]:null}processTimedMetadata(e,t){if(e&&e.includes("www.mediakind.com/NTC")){let s=!1;const i=/tc__[\s\S]{4}(\d+)/,n=this.parseId3Tag(i,e);n?(this.tcTimeStamp=new Date(parseInt(n)).getTime(),console.log(`NewTcTimeStamp: ${this.tcTimeStamp}`),s=!0):console.log("tcTimeStamp not found.");const o=/offs[\s\S]{4}(\d+)/,a=this.parseId3Tag(o,e);return a?(this.timecode_offset=parseInt(a)/90,console.log(`New Extracted offset: ${this.timecode_offset}`),s=!0):console.log("offset not found."),s}return!1}pause(){this.animationFrameLoopId&&(cancelAnimationFrame(this.animationFrameLoopId),this.animationFrameLoopId=void 0),this.videoFrameCallbackLoopId&&(this.video.cancelVideoFrameCallback(this.videoFrameCallbackLoopId),this.videoFrameCallbackLoopId=void 0),this.burnedIntervalId&&(clearInterval(this.burnedIntervalId),this.burnedIntervalId=void 0)}resume(){this.resumedAt=performance.now(),this.options&&y(this.options,"Adapter")&&console.log("[Adapter] Resumed - skipping expensive processing for",this.SKIP_PROCESSING_AFTER_RESUME_MS,"ms"),this.siData.patternTracking=[],this.siData.possibilityTracking=[],this.siData.determineFramesIntervals=[],this.siData.determineAFIntervals=[],this.siData.isRVFCpatternDetected=!1,this.siData.RVFCpattern=[],this.siData.expectedRefreshRate=0,this.siData.expectedFPS=0,this.siData.newRefreshRateFrames=0,this.siData.newFPSFrames=0,this.animationFrameLoopId||(this.animationFrameLoopId=window.requestAnimationFrame(this.onAnimationFrame)),this.videoFrameCallbackLoopId||(this.videoFrameCallbackLoopId=this.video.requestVideoFrameCallback(this.onVideoFrame)),this.options.BURNED_TIMECODES_MODE&&!this.burnedIntervalId&&(this.burnedIntervalId=window.setInterval(this.sampleBurnedFrame,33))}delete(){this.options.BURNED_TIMECODES_MODE&&this.stopBurnedPipeline(),this.animationFrameLoopId&&cancelAnimationFrame(this.animationFrameLoopId),this.videoFrameCallbackLoopId&&this.video.cancelVideoFrameCallback(this.videoFrameCallbackLoopId),this.intervalLoopId&&clearInterval(this.intervalLoopId),this.metrics&&this.metrics.delete(),this.debugControls&&this.debugControls.delete()}};q.MIN_SUPPORTED_FPS=20,q.MAX_SUPPORTED_FPS=40,q.BACKWARD_JUMP_THRESHOLD=600;let at=q;class Z{constructor(e,t){this.size=1,this.positionElement=()=>{let i=0,n=0;this.corner=="left-top"?(this.element.style.top=`${i}px`,this.element.style.left=`${n}px`):this.corner=="right-top"?(this.element.style.top=`${i}px`,this.element.style.left=`${n+this.video.offsetWidth-this.size}px`):this.corner=="right-bottom"?(this.element.style.top=`${i+this.video.offsetHeight-this.size}px`,this.element.style.left=`${n+this.video.offsetWidth-this.size}px`):this.corner=="left-bottom"&&(this.element.style.top=`${i+this.video.offsetHeight-this.size}px`,this.element.style.left=`${n}px`)},this.video=t,this.container=t.parentElement,this.corner=e;const s=document.createElement("div");s.style.position="absolute",s.style.width=`${this.size}px`,s.style.height=`${this.size}px`,s.style.transition="background-color 0s",s.style.zIndex="100000",this.element=s,this.container.appendChild(s),this.positionElement()}getRandomColor(){const s=Math.floor(Math.random()*11)+0;return`rgb(${s},${s},${s})`}update(){this.element.style.backgroundColor=this.getRandomColor(),this.positionElement()}delete(){this.container.removeChild(this.element)}static createInAllCorners(e){return[new Z("left-top",e),new Z("right-top",e),new Z("right-bottom",e),new Z("left-bottom",e)]}static updateAll(e){e.forEach(t=>t.update())}static deleteAll(e){e.forEach(t=>t.delete())}}const R={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},M=console,K={};Object.keys(R).forEach(r=>{K[r]=M[r]});const Ae="Datadog Browser SDK:",D={debug:K.debug.bind(M,Ae),log:K.log.bind(M,Ae),info:K.info.bind(M,Ae),warn:K.warn.bind(M,Ae),error:K.error.bind(M,Ae)},ct="https://docs.datadoghq.com",qt=`${ct}/real_user_monitoring/browser/troubleshooting`,Le="More details:";function Zt(r,e){return(...t)=>{try{return r(...t)}catch(s){D.error(e,s)}}}function Pe(r){return r!==0&&Math.random()*100<=r}function gs(r){return As(r)&&r>=0&&r<=100}function As(r){return typeof r=="number"}const ye=1e3,J=60*ye,Kt=60*J,ys=365*(24*Kt);function be(){return new Date().getTime()}function W(){return be()}function Fe(){return performance.now()}function H(){return{relative:Fe(),timeStamp:W()}}function bs(){return{relative:0,timeStamp:Jt()}}function vs(r,e){return e-r}function _s(r,e){return r+e}function Es(r){return r-Jt()}let lt;function Jt(){return lt===void 0&&(lt=performance.timing.navigationStart),lt}const N=1024,$t=1024*N,Ts=/[^\u0000-\u007F]/;function dt(r){return Ts.test(r)?window.TextEncoder!==void 0?new TextEncoder().encode(r).length:new Blob([r]).size:r.length}function Ss(r){return{...r}}function er(r,e){return Object.keys(r).some(t=>r[t]===e)}function ve(r){return Object.keys(r).length===0}function Q(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let r=_dd_temp_;return delete Object.prototype._dd_temp_,typeof r!="object"&&(typeof self=="object"?r=self:typeof window=="object"?r=window:r={}),r}function le(r,e){const t=Q();let s;return t.Zone&&typeof t.Zone.__symbol__=="function"&&(s=r[t.Zone.__symbol__(e)]),s||(s=r[e]),s}let Oe,tr=!1;function ws(r){Oe=r}function Cs(r){tr=r}function xs(r,e,t){const s=t.value;t.value=function(...i){return(Oe?S(s):s).apply(this,i)}}function S(r){return function(){return _e(r,this,arguments)}}function _e(r,e,t){try{return r.apply(e,t)}catch(s){Rs(s)}}function Rs(r){if(ut(r),Oe)try{Oe(r)}catch(e){ut(e)}}function ut(...r){tr&&D.error("[MONITOR]",...r)}function Ee(r,e){return le(Q(),"setTimeout")(S(r),e)}function rr(r){le(Q(),"clearTimeout")(r)}function ht(r,e){return le(Q(),"setInterval")(S(r),e)}function sr(r){le(Q(),"clearInterval")(r)}class k{constructor(e){this.onFirstSubscribe=e,this.observers=[]}subscribe(e){return this.observers.push(e),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(t=>e!==t),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(e){this.observers.forEach(t=>t(e))}}function ir(...r){return new k(e=>{const t=r.map(s=>s.subscribe(i=>e.notify(i)));return()=>t.forEach(s=>s.unsubscribe())})}function nr(r,e,t){let s=!1,i,n;return{throttled:(...o)=>{if(s){i=o;return}r(...o),s=!0,n=Ee(()=>{i&&r(...i),s=!1,i=void 0},e)},cancel:()=>{rr(n),s=!1,i=void 0}}}function j(){}function Y(r){return r?(parseInt(r,10)^Math.random()*16>>parseInt(r,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,Y)}const Be=/([\w-]+)\s*=\s*([^;]+)/g;function Ds(r,e){for(Be.lastIndex=0;;){const t=Be.exec(r);if(t){if(t[1]===e)return t[2]}else break}}function ks(r){const e=new Map;for(Be.lastIndex=0;;){const t=Be.exec(r);if(t)e.set(t[1],t[2]);else break}return e}function Us(r,e,t=""){const s=r.charCodeAt(e-1),n=s>=55296&&s<=56319?e+1:e;return r.length<=n?r:`${r.slice(0,n)}${t}`}function Is(){return Ls()===0}let Me;function Ls(){return Me??(Me=Ps())}function Ps(r=window){var e;const t=r.navigator.userAgent;return r.chrome||/HeadlessChrome/.test(t)?0:((e=r.navigator.vendor)===null||e===void 0?void 0:e.indexOf("Apple"))===0||/safari/i.test(t)&&!/chrome|android/i.test(t)?1:2}function Te(r,e,t=0,s){const i=new Date;i.setTime(i.getTime()+t);const n=`expires=${i.toUTCString()}`,o=s&&s.crossSite?"none":"strict",a=s&&s.domain?`;domain=${s.domain}`:"",c=s&&s.secure?";secure":"",d=s&&s.partitioned?";partitioned":"";document.cookie=`${r}=${e};${n};path=/;samesite=${o}${a}${c}${d}`}function ft(r){return Ds(document.cookie,r)}let pt;function $(r){return pt||(pt=ks(document.cookie)),pt.get(r)}function or(r,e){Te(r,"",0,e)}function Fs(r){if(document.cookie===void 0||document.cookie===null)return!1;try{const e=`dd_cookie_test_${Y()}`,t="test";Te(e,t,J,r);const s=ft(e)===t;return or(e,r),s}catch(e){return D.error(e),!1}}let mt;function Os(){if(mt===void 0){const r=`dd_site_test_${Y()}`,e="test",t=window.location.hostname.split(".");let s=t.pop();for(;t.length&&!ft(r);)s=`${t.pop()}.${s}`,Te(r,e,ye,{domain:s});or(r,{domain:s}),mt=s}return mt}const de="_dd_s";function Ne(r){return Object.values(r)}function Bs(r){return Object.entries(r)}const gt=4*Kt,ar=15*J,Ms=ys,Se={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},cr=/^([a-zA-Z]+)=([a-z0-9-]+)$/,At="&";function Ns(r){return!!r&&(r.indexOf(At)!==-1||cr.test(r))}const Gs="1";function ee(r,e){const t={isExpired:Gs};return e.trackAnonymousUser&&(r!=null&&r.anonymousId?t.anonymousId=r==null?void 0:r.anonymousId:t.anonymousId=Y()),t}function Ge(r){return ve(r)}function lr(r){return!Ge(r)}function ze(r){return r.isExpired!==void 0||!zs(r)}function zs(r){return(r.created===void 0||be()-Number(r.created)<gt)&&(r.expire===void 0||be()<Number(r.expire))}function dr(r){r.expire=String(be()+ar)}function yt(r){return Bs(r).map(([e,t])=>e==="anonymousId"?`aid=${t}`:`${e}=${t}`).join(At)}function ur(r){const e={};return Ns(r)&&r.split(At).forEach(t=>{const s=cr.exec(t);if(s!==null){const[,i,n]=s;i==="aid"?e.anonymousId=n:e[i]=n}}),e}const Vs="_dd",Ws="_dd_r",Hs="_dd_l",Qs="rum",js="logs";function Ys(r){if(!$(de)){const t=$(Vs),s=$(Ws),i=$(Hs),n={};t&&(n.id=t),i&&/^[01]$/.test(i)&&(n[js]=i),s&&/^[012]$/.test(s)&&(n[Qs]=s),lr(n)&&(dr(n),r.persistSession(n))}}function hr(r){const e=Js(r);return Fs(e)?{type:Se.COOKIE,cookieOptions:e}:void 0}function Xs(r,e){const t={isLockEnabled:Is(),persistSession:qs(e),retrieveSession:Ks,expireSession:s=>Zs(e,s,r)};return Ys(t),t}function qs(r){return e=>{Te(de,yt(e),ar,r)}}function Zs(r,e,t){const s=ee(e,t);Te(de,yt(s),t.trackAnonymousUser?Ms:gt,r)}function Ks(){const r=ft(de);return ur(r)}function Js(r){const e={};return e.secure=!!r.useSecureSessionCookie||!!r.usePartitionedCrossSiteSessionCookie,e.crossSite=!!r.usePartitionedCrossSiteSessionCookie,e.partitioned=!!r.usePartitionedCrossSiteSessionCookie,r.trackSessionAcrossSubdomains&&(e.domain=Os()),e}const $s="_dd_test_";function fr(){try{const r=Y(),e=`${$s}${r}`;localStorage.setItem(e,r);const t=localStorage.getItem(e);return localStorage.removeItem(e),r===t?{type:Se.LOCAL_STORAGE}:void 0}catch{return}}function ei(r){return{isLockEnabled:!1,persistSession:pr,retrieveSession:ti,expireSession:e=>ri(e,r)}}function pr(r){localStorage.setItem(de,yt(r))}function ti(){const r=localStorage.getItem(de);return ur(r)}function ri(r,e){pr(ee(r,e))}const si=10,ii=100,mr=[];let Ve;function te(r,e,t=0){var s;const{isLockEnabled:i,persistSession:n,expireSession:o}=e,a=f=>n({...f,lock:d}),c=()=>{const f=e.retrieveSession(),p=f.lock;return f.lock&&delete f.lock,{session:f,lock:p}};if(Ve||(Ve=r),r!==Ve){mr.push(r);return}if(i&&t>=ii){gr(e);return}let d,l=c();if(i){if(l.lock){We(r,e,t);return}if(d=Y(),a(l.session),l=c(),l.lock!==d){We(r,e,t);return}}let u=r.process(l.session);if(i&&(l=c(),l.lock!==d)){We(r,e,t);return}if(u&&(ze(u)?o(u):(dr(u),i?a(u):n(u))),i&&!(u&&ze(u))){if(l=c(),l.lock!==d){We(r,e,t);return}n(l.session),u=l.session}(s=r.after)===null||s===void 0||s.call(r,u||l.session),gr(e)}function We(r,e,t){Ee(()=>{te(r,e,t+1)},si)}function gr(r){Ve=void 0;const e=mr.shift();e&&te(e,r)}const Ar=ye;function ni(r){switch(r.sessionPersistence){case Se.COOKIE:return hr(r);case Se.LOCAL_STORAGE:return fr();case void 0:{let e=hr(r);return!e&&r.allowFallbackToLocalStorage&&(e=fr()),e}default:D.error(`Invalid session persistence '${String(r.sessionPersistence)}'`)}}function oi(r,e,t,s){const i=new k,n=new k,o=new k,a=r.type===Se.COOKIE?Xs(e,r.cookieOptions):ei(e),{expireSession:c}=a,d=ht(h,Ar);let l;g();const{throttled:u,cancel:f}=nr(()=>{te({process:v=>{if(Ge(v))return;const I=m(v);return E(I),I},after:v=>{lr(v)&&!b()&&w(v),l=v}},a)},Ar);function p(){te({process:v=>b()?m(v):void 0},a)}function h(){te({process:v=>ze(v)?ee(v,e):void 0,after:m},a)}function m(v){return ze(v)&&(v=ee(v,e)),b()&&(T(v)?C():(o.notify({previousState:l,newState:v}),l=v)),v}function g(){te({process:v=>{if(Ge(v))return ee(v,e)},after:v=>{l=v}},a)}function E(v){if(Ge(v))return!1;const{trackingType:I,isTracked:Nt}=s(v[t]);v[t]=I,delete v.isExpired,Nt&&!v.id&&(v.id=Y(),v.created=String(be()))}function b(){return l[t]!==void 0}function T(v){return l.id!==v.id||l[t]!==v[t]}function C(){l=ee(l,e),n.notify()}function w(v){l=v,i.notify()}function x(v){te({process:I=>({...I,...v}),after:m},a)}return{expandOrRenewSession:u,expandSession:p,getSession:()=>l,renewObservable:i,expireObservable:n,sessionStateUpdateObservable:o,restartSession:g,expire:()=>{f(),c(l),m(ee(l,e))},stop:()=>{sr(d)},updateSessionState:x}}const bt={GRANTED:"granted",NOT_GRANTED:"not-granted"};function ai(r){const e=new k;return{tryToInit(t){r||(r=t)},update(t){r=t,e.notify()},isGranted(){return r===bt.GRANTED},observable:e}}function re(r,e,t){if(typeof r!="object"||r===null)return JSON.stringify(r);const s=ue(Object.prototype),i=ue(Array.prototype),n=ue(Object.getPrototypeOf(r)),o=ue(r);try{return JSON.stringify(r,e,t)}catch{return"<error: unable to serialize object>"}finally{s(),i(),n(),o()}}function ue(r){const e=r,t=e.toJSON;return t?(delete e.toJSON,()=>{e.toJSON=t}):j}function vt(r){return ci(r,location.href).href}function ci(r,e){const t=li();if(t)try{return e!==void 0?new t(r,e):new t(r)}catch(n){throw new Error(`Failed to construct URL: ${String(n)} ${re({url:r,base:e})}`)}if(e===void 0&&!/:/.test(r))throw new Error(`Invalid URL: '${r}'`);let s=document;const i=s.createElement("a");if(e!==void 0){s=document.implementation.createHTMLDocument("");const n=s.createElement("base");n.href=e,s.head.appendChild(n),s.body.appendChild(i)}return i.href=r,i}const yr=URL;let He;function li(){if(He===void 0)try{He=new yr("http://test/path").href==="http://test/path"}catch{He=!1}return He?yr:void 0}const di="datad0g.com",ui="dd0g-gov.com",he="datadoghq.com",hi="ddog-gov.com",fi="pci.browser-intake-datadoghq.com",pi=["ddsource","ddtags"];function we(r,e,t){const s=mi(r,e);return{build(i,n){const o=Ai(r,e,t,i,n);return s(o)},urlPrefix:s(""),trackType:e}}function mi(r,e){const t=`/api/v2/${e}`,s=r.proxy;if(typeof s=="string"){const n=vt(s);return o=>`${n}?ddforward=${encodeURIComponent(`${t}?${o}`)}`}if(typeof s=="function")return n=>s({path:t,parameters:n});const i=gi(e,r);return n=>`https://${i}${t}?${n}`}function gi(r,e){const{site:t=he,internalAnalyticsSubdomain:s}=e;if(r==="logs"&&e.usePciIntake&&t===he)return fi;if(s&&t===he)return`${s}.${he}`;if(t===ui)return`http-intake.logs.${t}`;const i=t.split("."),n=i.pop();return`browser-intake-${i.join("-")}.${n}`}function Ai({clientToken:r,internalAnalyticsSubdomain:e},t,s,i,{retry:n,encoding:o}){const a=["sdk_version:6.5.0",`api:${i}`].concat(s);n&&a.push(`retry_count:${n.count}`,`retry_after:${n.lastFailureStatus}`);const c=["ddsource=browser",`ddtags=${encodeURIComponent(a.join(","))}`,`dd-api-key=${r}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${Y()}`];return o&&c.push(`dd-evp-encoding=${o}`),t==="rum"&&c.push(`batch_time=${W()}`),e&&c.reverse(),c.join("&")}const yi=200;function bi(r){const{env:e,service:t,version:s,datacenter:i}=r,n=[];return e&&n.push(Qe("env",e)),t&&n.push(Qe("service",t)),s&&n.push(Qe("version",s)),i&&n.push(Qe("datacenter",i)),n}function Qe(r,e){const t=yi-r.length-1;(e.length>t||vi(e))&&D.warn(`${r} value doesn't meet tag requirements and will be sanitized. ${Le} ${ct}/getting_started/tagging/#defining-tags`);const s=e.replace(/,/g,"_");return`${r}:${s}`}function vi(r){return _i()?new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]","u").test(r):!1}function _i(){try{return new RegExp("[\\p{Ll}]","u"),!0}catch{return!1}}function Ei(r){const e=r.site||he,t=bi(r),s=Ti(r,t);return{replica:Si(r,t),site:e,...s}}function Ti(r,e){return{logsEndpointBuilder:we(r,"logs",e),rumEndpointBuilder:we(r,"rum",e),sessionReplayEndpointBuilder:we(r,"replay",e)}}function Si(r,e){if(!r.replica)return;const t={...r,site:he,clientToken:r.replica.clientToken},s={logsEndpointBuilder:we(t,"logs",e),rumEndpointBuilder:we(t,"rum",e)};return{applicationId:r.replica.applicationId,...s}}function wi(r){return pi.every(e=>r.includes(e))}function _t(r,e){return r!=null&&typeof r!="string"?(D.error(`${e} must be defined as a string`),!1):!0}function Ci(r){return r&&typeof r=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(r)?(D.error(`Site should be a valid Datadog site. ${Le} ${ct}/getting_started/site/.`),!1):!0}function je(r,e){return r!==void 0&&!gs(r)?(D.error(`${e} Sample Rate should be a number between 0 and 100`),!1):!0}function xi(r){var e,t,s,i,n,o;if(!r||!r.clientToken){D.error("Client Token is not configured, we will not send any data.");return}if(!(!Ci(r.site)||!je(r.sessionSampleRate,"Session")||!je(r.telemetrySampleRate,"Telemetry")||!je(r.telemetryConfigurationSampleRate,"Telemetry Configuration")||!je(r.telemetryUsageSampleRate,"Telemetry Usage")||!_t(r.version,"Version")||!_t(r.env,"Env")||!_t(r.service,"Service"))){if(r.trackingConsent!==void 0&&!er(bt,r.trackingConsent)){D.error('Tracking Consent should be either "granted" or "not-granted"');return}return{beforeSend:r.beforeSend&&Zt(r.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:ni(r),sessionSampleRate:(e=r.sessionSampleRate)!==null&&e!==void 0?e:100,telemetrySampleRate:(t=r.telemetrySampleRate)!==null&&t!==void 0?t:20,telemetryConfigurationSampleRate:(s=r.telemetryConfigurationSampleRate)!==null&&s!==void 0?s:5,telemetryUsageSampleRate:(i=r.telemetryUsageSampleRate)!==null&&i!==void 0?i:5,service:r.service||void 0,silentMultipleInit:!!r.silentMultipleInit,allowUntrustedEvents:!!r.allowUntrustedEvents,trackingConsent:(n=r.trackingConsent)!==null&&n!==void 0?n:bt.GRANTED,trackAnonymousUser:(o=r.trackAnonymousUser)!==null&&o!==void 0?o:!0,storeContextsAcrossPages:!!r.storeContextsAcrossPages,batchBytesLimit:16*N,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*ye,batchMessagesLimit:50,messageBytesLimit:256*N,...Ei(r)}}}function Ri(r){return{session_sample_rate:r.sessionSampleRate,telemetry_sample_rate:r.telemetrySampleRate,telemetry_configuration_sample_rate:r.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:r.telemetryUsageSampleRate,use_before_send:!!r.beforeSend,use_partitioned_cross_site_session_cookie:r.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:r.useSecureSessionCookie,use_proxy:!!r.proxy,silent_multiple_init:r.silentMultipleInit,track_session_across_subdomains:r.trackSessionAcrossSubdomains,track_anonymous_user:r.trackAnonymousUser,session_persistence:r.sessionPersistence,allow_fallback_to_local_storage:!!r.allowFallbackToLocalStorage,store_contexts_across_pages:!!r.storeContextsAcrossPages,allow_untrusted_events:!!r.allowUntrustedEvents,tracking_consent:r.trackingConsent}}var Et;(function(r){r.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",r.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(Et||(Et={}));const br=new Set;function Di(r){Array.isArray(r)&&ki(r.filter(e=>er(Et,e)))}function ki(r){r.forEach(e=>{br.add(e)})}function Ui(){return br}const Ce="?";function G(r){const e=[];let t=Tt(r,"stack");const s=String(r);return t&&t.startsWith(s)&&(t=t.slice(s.length)),t&&t.split(`
|
|
100
|
-
`).forEach(i=>{const n=Pi(i)||Oi(i)||Mi(i)||zi(i);n&&(!n.func&&n.line&&(n.func=Ce),e.push(n))}),{message:Tt(r,"message"),name:Tt(r,"name"),stack:e}}const vr="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",fe="(?::(\\d+))",Ii=new RegExp(`^\\s*at (.*?) ?\\(${vr}${fe}?${fe}?\\)?\\s*$`,"i"),Li=new RegExp(`\\((\\S*)${fe}${fe}\\)`);function Pi(r){const e=Ii.exec(r);if(!e)return;const t=e[2]&&e[2].indexOf("native")===0,s=e[2]&&e[2].indexOf("eval")===0,i=Li.exec(e[2]);return s&&i&&(e[2]=i[1],e[3]=i[2],e[4]=i[3]),{args:t?[e[2]]:[],column:e[4]?+e[4]:void 0,func:e[1]||Ce,line:e[3]?+e[3]:void 0,url:t?void 0:e[2]}}const Fi=new RegExp(`^\\s*at ?${vr}${fe}?${fe}??\\s*$`,"i");function Oi(r){const e=Fi.exec(r);if(e)return{args:[],column:e[3]?+e[3]:void 0,func:Ce,line:e[2]?+e[2]:void 0,url:e[1]}}const Bi=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function Mi(r){const e=Bi.exec(r);if(e)return{args:[],column:e[4]?+e[4]:void 0,func:e[1]||Ce,line:+e[3],url:e[2]}}const Ni=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Gi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function zi(r){const e=Ni.exec(r);if(!e)return;const t=e[3]&&e[3].indexOf(" > eval")>-1,s=Gi.exec(e[3]);return t&&s&&(e[3]=s[1],e[4]=s[2],e[5]=void 0),{args:e[2]?e[2].split(","):[],column:e[5]?+e[5]:void 0,func:e[1]||Ce,line:e[4]?+e[4]:void 0,url:e[3]}}function Tt(r,e){if(typeof r!="object"||!r||!(e in r))return;const t=r[e];return typeof t=="string"?t:void 0}function Vi(r,e,t,s){const i=[{url:e,column:s,line:t}],{name:n,message:o}=Hi(r);return{name:n,message:o,stack:i}}const Wi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function Hi(r){let e,t;return{}.toString.call(r)==="[object String]"&&([,e,t]=Wi.exec(r)),{name:e,message:t}}function Ye(r){const t=new Error(r);t.name="HandlingStack";let s;return _e(()=>{const i=G(t);i.stack=i.stack.slice(2),s=se(i)}),s}function se(r){let e=_r(r);return r.stack.forEach(t=>{const s=t.func==="?"?"<anonymous>":t.func,i=t.args&&t.args.length>0?`(${t.args.join(", ")})`:"",n=t.line?`:${t.line}`:"",o=t.line&&t.column?`:${t.column}`:"";e+=`
|
|
101
|
-
at ${s}${i} @ ${t.url}${n}${o}`}),e}function _r(r){return`${r.name||"Error"}: ${r.message}`}function ie(r,e,t,{computeHandlingStack:s}={}){let i=r[e];if(typeof i!="function")if(e in r&&e.startsWith("on"))i=j;else return{stop:j};let n=!1;const o=function(){if(n)return i.apply(this,arguments);const a=Array.from(arguments);let c;_e(t,null,[{target:this,parameters:a,onPostCall:l=>{c=l},handlingStack:s?Ye("instrumented method"):void 0}]);const d=i.apply(this,a);return c&&_e(c,null,[d]),d};return r[e]=o,{stop:()=>{n=!0,r[e]===o&&(r[e]=i)}}}const Qi=220*N,ji="$",Yi=3;function z(r,e=Qi){const t=ue(Object.prototype),s=ue(Array.prototype),i=[],n=new WeakMap,o=St(r,ji,void 0,i,n),a=JSON.stringify(o);let c=a?a.length:0;if(c>e){Ct(e,"discarded",r);return}for(;i.length>0&&c<e;){const d=i.shift();let l=0;if(Array.isArray(d.source))for(let u=0;u<d.source.length;u++){const f=St(d.source[u],d.path,u,i,n);if(f!==void 0?c+=JSON.stringify(f).length:c+=4,c+=l,l=1,c>e){Ct(e,"truncated",r);break}d.target[u]=f}else for(const u in d.source)if(Object.prototype.hasOwnProperty.call(d.source,u)){const f=St(d.source[u],d.path,u,i,n);if(f!==void 0&&(c+=JSON.stringify(f).length+l+u.length+Yi,l=1),c>e){Ct(e,"truncated",r);break}d.target[u]=f}}return t(),s(),o}function St(r,e,t,s,i){const n=Zi(r);if(!n||typeof n!="object")return Xi(n);const o=wt(n);if(o!=="[Object]"&&o!=="[Array]"&&o!=="[Error]")return o;const a=r;if(i.has(a))return`[Reference seen at ${i.get(a)}]`;const c=t!==void 0?`${e}.${t}`:e,d=Array.isArray(n)?[]:{};return i.set(a,c),s.push({source:n,target:d,path:c}),d}function Xi(r){return typeof r=="bigint"?`[BigInt] ${r.toString()}`:typeof r=="function"?`[Function] ${r.name||"unknown"}`:typeof r=="symbol"?`[Symbol] ${r.description||r.toString()}`:r}function wt(r){try{if(r instanceof Event)return qi(r);if(r instanceof RegExp)return`[RegExp] ${r.toString()}`;const t=Object.prototype.toString.call(r).match(/\[object (.*)\]/);if(t&&t[1])return`[${t[1]}]`}catch{}return"[Unserializable]"}function qi(r){return{type:r.type,isTrusted:r.isTrusted,currentTarget:r.currentTarget?wt(r.currentTarget):null,target:r.target?wt(r.target):null}}function Zi(r){const e=r;if(e&&typeof e.toJSON=="function")try{return e.toJSON()}catch{}return r}function Ct(r,e,t){D.warn(`The data provided has been ${e} as it is over the limit of ${r} characters:`,t)}const Er="No stack, consider using an instance of Error";function Tr({stackTrace:r,originalError:e,handlingStack:t,componentStack:s,startClocks:i,nonErrorPrefix:n,source:o,handling:a}){const c=X(e),d=Ki(r,c,n,e),l=Ji(c,r)?se(r):Er,u=c?Cr(e,o):void 0,f=r?r.name:void 0,p=Sr(e),h=wr(e);return{startClocks:i,source:o,handling:a,handlingStack:t,componentStack:s,originalError:e,type:f,message:d,stack:l,causes:u,fingerprint:p,context:h}}function Ki(r,e,t,s){return r!=null&&r.message&&(r!=null&&r.name)?r.message:e?"Empty message":`${t} ${re(z(s))}`}function Ji(r,e){return e===void 0?!1:r?!0:e.stack.length>0&&(e.stack.length>1||e.stack[0].url!==void 0)}function Sr(r){return X(r)&&"dd_fingerprint"in r?String(r.dd_fingerprint):void 0}function wr(r){if(r!==null&&typeof r=="object"&&"dd_context"in r)return r.dd_context}function $i(r){var e;return(e=/@ (.+)/.exec(r))===null||e===void 0?void 0:e[1]}function X(r){return r instanceof Error||Object.prototype.toString.call(r)==="[object Error]"}function Cr(r,e){let t=r;const s=[];for(;X(t==null?void 0:t.cause)&&s.length<10;){const i=G(t.cause);s.push({message:t.cause.message,source:e,type:i==null?void 0:i.name,stack:se(i)}),t=t.cause}return s.length?s:void 0}const P={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function en(r){const e=(i,n)=>{const o=Tr({stackTrace:i,originalError:n,startClocks:H(),nonErrorPrefix:"Uncaught",source:P.SOURCE,handling:"unhandled"});r.notify(o)},{stop:t}=tn(e),{stop:s}=rn(e);return{stop:()=>{t(),s()}}}function tn(r){return ie(window,"onerror",({parameters:[e,t,s,i,n]})=>{let o;X(n)?o=G(n):o=Vi(e,t,s,i),r(o,n??e)})}function rn(r){return ie(window,"onunhandledrejection",({parameters:[e]})=>{const t=e.reason||"Empty reason",s=G(t);r(s,t)})}function sn(r){const e={version:"6.5.0",onReady(t){t()},...r};return Object.defineProperty(e,"_setDebug",{get(){return Cs},enumerable:!1}),e}function nn(r,e,t){const s=r[e];s&&!s.q&&s.version&&D.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),r[e]=t,s&&s.q&&s.q.forEach(i=>Zt(i,"onReady callback threw an error:")())}function xr(r,e){e.silentMultipleInit||D.error(`${r} is already initialized.`)}function ne(r,e,t,s,i){return xt(r,e,[t],s,i)}function xt(r,e,t,s,{once:i,capture:n,passive:o}={}){const a=S(f=>{!f.isTrusted&&!f.__ddIsTrusted&&!r.allowUntrustedEvents||(i&&u(),s(f))}),c=o?{capture:n,passive:o}:n,d=window.EventTarget&&e instanceof EventTarget?window.EventTarget.prototype:e,l=le(d,"addEventListener");t.forEach(f=>l.call(e,f,a,c));function u(){const f=le(d,"removeEventListener");t.forEach(p=>f.call(e,p,a,c))}return{stop:u}}const Xe={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function on(r,e){const t=[];e.includes(Xe.cspViolation)&&t.push(cn(r));const s=e.filter(i=>i!==Xe.cspViolation);return s.length&&t.push(an(s)),ir(...t)}function an(r){return new k(e=>{if(!window.ReportingObserver)return;const t=S((i,n)=>i.forEach(o=>e.notify(ln(o)))),s=new window.ReportingObserver(t,{types:r,buffered:!0});return s.observe(),()=>{s.disconnect()}})}function cn(r){return new k(e=>{const{stop:t}=ne(r,document,"securitypolicyviolation",s=>{e.notify(dn(s))});return t})}function ln(r){const{type:e,body:t}=r;return Rr({type:t.id,message:`${e}: ${t.message}`,originalError:r,stack:Dr(t.id,t.message,t.sourceFile,t.lineNumber,t.columnNumber)})}function dn(r){const e=`'${r.blockedURI}' blocked by '${r.effectiveDirective}' directive`;return Rr({type:r.effectiveDirective,message:`${Xe.cspViolation}: ${e}`,originalError:r,csp:{disposition:r.disposition},stack:Dr(r.effectiveDirective,r.originalPolicy?`${e} of the policy "${Us(r.originalPolicy,100,"...")}"`:"no policy",r.sourceFile,r.lineNumber,r.columnNumber)})}function Rr(r){return{startClocks:H(),source:P.REPORT,handling:"unhandled",...r}}function Dr(r,e,t,s,i){return t?se({name:r,message:e,stack:[{func:"?",url:t,line:s??void 0,column:i??void 0}]}):void 0}function kr(r,e){const t=window.__ddBrowserSdkExtensionCallback;t&&t({type:r,payload:e})}function Ur(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function qe(r,e,t=un()){if(e===void 0)return r;if(typeof e!="object"||e===null)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const i=e.flags||[e.global?"g":"",e.ignoreCase?"i":"",e.multiline?"m":"",e.sticky?"y":"",e.unicode?"u":""].join("");return new RegExp(e.source,i)}if(t.hasAlreadyBeenSeen(e))return;if(Array.isArray(e)){const i=Array.isArray(r)?r:[];for(let n=0;n<e.length;++n)i[n]=qe(i[n],e[n],t);return i}const s=Ur(r)==="object"?r:{};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=qe(s[i],e[i],t));return s}function Ir(r){return qe(void 0,r)}function pe(...r){let e;for(const t of r)t!=null&&(e=qe(e,t));return e}function un(){if(typeof WeakSet<"u"){const e=new WeakSet;return{hasAlreadyBeenSeen(t){const s=e.has(t);return s||e.add(t),s}}}const r=[];return{hasAlreadyBeenSeen(e){const t=r.indexOf(e)>=0;return t||r.push(e),t}}}function hn(){var r;const e=window.navigator;return{status:e.onLine?"connected":"not_connected",interfaces:e.connection&&e.connection.type?[e.connection.type]:void 0,effective_type:(r=e.connection)===null||r===void 0?void 0:r.effectiveType}}function fn(r){const e=new Set;return r.forEach(t=>e.add(t)),Array.from(e)}function Lr(r,e){const t=r.indexOf(e);t>=0&&r.splice(t,1)}const pn=500;function Pr(){const r=[];return{add:i=>{r.push(i)>pn&&r.splice(0,1)},remove:i=>{Lr(r,i)},drain:i=>{r.forEach(n=>n(i)),r.length=0}}}const oe={log:"log",configuration:"configuration",usage:"usage"},mn=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],gn=[hi];let Fr=Pr(),me=r=>{Fr.add(()=>me(r))};function An(r,e){let t;const s=new k,i=new Set,n=!gn.includes(e.site)&&Pe(e.telemetrySampleRate),o={[oe.log]:n,[oe.configuration]:n&&Pe(e.telemetryConfigurationSampleRate),[oe.usage]:n&&Pe(e.telemetryUsageSampleRate)},a=yn();me=d=>{const l=re(d);if(o[d.type]&&i.size<e.maxTelemetryEventsPerPage&&!i.has(l)){const u=c(r,d,a);s.notify(u),kr("telemetry",u),i.add(l)}},ws(Br);function c(d,l,u){return pe({type:"telemetry",date:W(),service:d,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:pe(l,{runtime_env:u,connectivity:hn(),sdk_setup:"npm"}),experimental_features:Array.from(Ui())},t!==void 0?t():{})}return{setContextProvider:d=>{t=d},observable:s,enabled:n}}function yn(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function bn(){Fr.drain()}function vn(r){return r.site===di}function Or(r,e){ut(R.debug,r,e),me({type:oe.log,message:r,status:"debug",...e})}function Br(r,e){me({type:oe.log,status:"error",...Tn(r),...e})}function _n(r){me({type:oe.configuration,configuration:r})}function En(r){me({type:oe.usage,usage:r})}function Tn(r){if(X(r)){const e=G(r);return{error:{kind:e.name,stack:se(Sn(e))},message:e.message}}return{error:{stack:Er},message:`Uncaught ${re(r)}`}}function Sn(r){return r.stack=r.stack.filter(e=>!e.url||mn.some(t=>e.url.startsWith(t))),r}const xe=1/0,wn=J;let Re=null;const Ze=new Set;function Cn(){Ze.forEach(r=>r())}function xn({expireDelay:r,maxEntries:e}){let t=[];const s=[];Re||(Re=ht(()=>Cn(),wn));const i=()=>{const p=Fe()-r;for(;t.length>0&&t[t.length-1].endTime<p;){const h=t.pop();h&&s.push(h.startTime)}};Ze.add(i);function n(p,h){const m={value:p,startTime:h,endTime:xe,remove:()=>{Lr(t,m)},close:g=>{m.endTime=g}};return e&&t.length>=e&&t.pop(),t.unshift(m),m}function o(p=xe,h={returnInactive:!1}){for(const m of t)if(m.startTime<=p){if(h.returnInactive||p<=m.endTime)return m.value;break}}function a(p){const h=t[0];h&&h.endTime===xe&&h.close(p)}function c(p=xe,h=0){const m=_s(p,h);return t.filter(g=>g.startTime<=m&&p<=g.endTime).map(g=>g.value)}function d(){return t.map(({startTime:p,endTime:h,value:m})=>({startTime:p,endTime:h===xe?"Infinity":h,value:m}))}function l(){return s}function u(){t=[]}function f(){Ze.delete(i),Ze.size===0&&Re&&(sr(Re),Re=null)}return{add:n,find:o,closeActive:a,findAll:c,reset:u,stop:f,getAllEntries:d,getDeletedEntries:l}}const Rn=J,Dn=gt;function kn(r,e,t,s){const i=new k,n=new k,o=oi(r.sessionStoreStrategyType,r,e,t),a=xn({expireDelay:Dn});o.renewObservable.subscribe(()=>{a.add(c(),Fe()),i.notify()}),o.expireObservable.subscribe(()=>{n.notify(),a.closeActive(Fe())}),o.expandOrRenewSession(),a.add(c(),bs().relative),s.observable.subscribe(()=>{s.isGranted()?o.expandOrRenewSession():o.expire()}),Un(r,()=>{s.isGranted()&&o.expandOrRenewSession()}),In(r,()=>o.expandSession()),Ln(r,()=>o.restartSession());function c(){return{id:o.getSession().id,trackingType:o.getSession()[e],isReplayForced:!!o.getSession().forcedReplay,anonymousId:o.getSession().anonymousId}}return{findSession:(d,l)=>a.find(d,l),renewObservable:i,expireObservable:n,sessionStateUpdateObservable:o.sessionStateUpdateObservable,expire:o.expire,updateSessionState:o.updateSessionState}}function Un(r,e){xt(r,window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0})}function In(r,e){const t=()=>{document.visibilityState==="visible"&&e()};ne(r,document,"visibilitychange",t),ht(t,Rn)}function Ln(r,e){ne(r,window,"resume",e,{capture:!0})}function Mr(r){return r>=500}function Pn(r){try{return r.clone()}catch{return}}const Fn=80*N,On=32,Nr=3*$t,Bn=J,Gr=ye;function zr(r,e,t,s,i){e.transportStatus===0&&e.queuedPayloads.size()===0&&e.bandwidthMonitor.canHandle(r)?Wr(r,e,t,{onSuccess:()=>Hr(0,e,t,s,i),onFailure:()=>{e.queuedPayloads.enqueue(r),Vr(e,t,s,i)}}):e.queuedPayloads.enqueue(r)}function Vr(r,e,t,s){r.transportStatus===2&&Ee(()=>{const i=r.queuedPayloads.first();Wr(i,r,e,{onSuccess:()=>{r.queuedPayloads.dequeue(),r.currentBackoffTime=Gr,Hr(1,r,e,t,s)},onFailure:()=>{r.currentBackoffTime=Math.min(Bn,r.currentBackoffTime*2),Vr(r,e,t,s)}})},r.currentBackoffTime)}function Wr(r,e,t,{onSuccess:s,onFailure:i}){e.bandwidthMonitor.add(r),t(r,n=>{e.bandwidthMonitor.remove(r),Mn(n)?(e.transportStatus=e.bandwidthMonitor.ongoingRequestCount>0?1:2,r.retry={count:r.retry?r.retry.count+1:1,lastFailureStatus:n.status},i()):(e.transportStatus=0,s())})}function Hr(r,e,t,s,i){r===0&&e.queuedPayloads.isFull()&&!e.queueFullReported&&(i({message:`Reached max ${s} events size queued for upload: ${Nr/$t}MiB`,source:P.AGENT,startClocks:H()}),e.queueFullReported=!0);const n=e.queuedPayloads;for(e.queuedPayloads=Qr();n.size()>0;)zr(n.dequeue(),e,t,s,i)}function Mn(r){return r.type!=="opaque"&&(r.status===0&&!navigator.onLine||r.status===408||r.status===429||Mr(r.status))}function Nn(){return{transportStatus:0,currentBackoffTime:Gr,bandwidthMonitor:Gn(),queuedPayloads:Qr(),queueFullReported:!1}}function Qr(){const r=[];return{bytesCount:0,enqueue(e){this.isFull()||(r.push(e),this.bytesCount+=e.bytesCount)},first(){return r[0]},dequeue(){const e=r.shift();return e&&(this.bytesCount-=e.bytesCount),e},size(){return r.length},isFull(){return this.bytesCount>=Nr}}}function Gn(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(r){return this.ongoingRequestCount===0||this.ongoingByteCount+r.bytesCount<=Fn&&this.ongoingRequestCount<On},add(r){this.ongoingRequestCount+=1,this.ongoingByteCount+=r.bytesCount},remove(r){this.ongoingRequestCount-=1,this.ongoingByteCount-=r.bytesCount}}}function zn(r,e,t){const s=Nn(),i=(n,o)=>Hn(r,e,n,o);return{send:n=>{zr(n,s,i,r.trackType,t)},sendOnExit:n=>{Vn(r,e,n)}}}function Vn(r,e,t){if(!!navigator.sendBeacon&&t.bytesCount<e)try{const n=r.build("beacon",t);if(navigator.sendBeacon(n,t.data))return}catch(n){Wn(n)}const i=r.build("xhr",t);Rt(i,t.data)}let jr=!1;function Wn(r){jr||(jr=!0,Br(r))}function Hn(r,e,t,s){if(Qn()&&t.bytesCount<e){const n=r.build("fetch",t);fetch(n,{method:"POST",body:t.data,keepalive:!0,mode:"cors"}).then(S(o=>s==null?void 0:s({status:o.status,type:o.type})),S(()=>{const o=r.build("xhr",t);Rt(o,t.data,s)}))}else{const n=r.build("xhr",t);Rt(n,t.data,s)}}function Qn(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function Rt(r,e,t){const s=new XMLHttpRequest;s.open("POST",r,!0),e instanceof Blob&&s.setRequestHeader("Content-Type",e.type),ne({allowUntrustedEvents:!0},s,"loadend",()=>{t==null||t({status:s.status})},{once:!0}),s.send(e)}function Dt(){const r=jn();if(r)return{getCapabilities(){var e;return JSON.parse(((e=r.getCapabilities)===null||e===void 0?void 0:e.call(r))||"[]")},getPrivacyLevel(){var e;return(e=r.getPrivacyLevel)===null||e===void 0?void 0:e.call(r)},getAllowedWebViewHosts(){return JSON.parse(r.getAllowedWebViewHosts())},send(e,t,s){const i=s?{id:s}:void 0;r.send(JSON.stringify({eventType:e,event:t,view:i}))}}}function Ke(r){var e;r===void 0&&(r=(e=Q().location)===null||e===void 0?void 0:e.hostname);const t=Dt();return!!t&&t.getAllowedWebViewHosts().some(s=>r===s||r.endsWith(`.${s}`))}function jn(){return Q().DatadogEventBridge}const Je={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function Yn(r){return new k(e=>{const{stop:t}=xt(r,window,["visibilitychange","freeze"],i=>{i.type==="visibilitychange"&&document.visibilityState==="hidden"?e.notify({reason:Je.HIDDEN}):i.type==="freeze"&&e.notify({reason:Je.FROZEN})},{capture:!0}),s=ne(r,window,"beforeunload",()=>{e.notify({reason:Je.UNLOADING})}).stop;return()=>{t(),s()}})}function Xn(r){return Ne(Je).includes(r)}function qn({encoder:r,request:e,flushController:t,messageBytesLimit:s}){let i={};const n=t.flushObservable.subscribe(u=>l(u));function o(u,f,p){t.notifyBeforeAddMessage(f),p!==void 0?(i[p]=u,t.notifyAfterAddMessage()):r.write(r.isEmpty?u:`
|
|
102
|
-
${u}`,h=>{t.notifyAfterAddMessage(h-f)})}function a(u){return u!==void 0&&i[u]!==void 0}function c(u){const f=i[u];delete i[u];const p=r.estimateEncodedBytesCount(f);t.notifyAfterRemoveMessage(p)}function d(u,f){const p=re(u),h=r.estimateEncodedBytesCount(p);if(h>=s){D.warn(`Discarded a message whose size was bigger than the maximum allowed size ${s}KB. ${Le} ${qt}/#technical-limitations`);return}a(f)&&c(f),o(p,h,f)}function l(u){const f=Ne(i).join(`
|
|
103
|
-
|
|
104
|
-
`);
|
|
105
|
-
${f}`),r.finish(m=>{h(Yr(m))})}return{flushController:t,add:d,upsert:d,stop:n.unsubscribe}}function Yr(r){let e;return typeof r.output=="string"?e=r.output:e=new Blob([r.output],{type:"text/plain"}),{data:e,bytesCount:r.outputBytesCount,encoding:r.encoding}}function Zn({messagesLimit:r,bytesLimit:e,durationLimit:t,pageExitObservable:s,sessionExpireObservable:i}){const n=s.subscribe(h=>l(h.reason)),o=i.subscribe(()=>l("session_expire")),a=new k(()=>()=>{n.unsubscribe(),o.unsubscribe()});let c=0,d=0;function l(h){if(d===0)return;const m=d,g=c;d=0,c=0,p(),a.notify({reason:h,messagesCount:m,bytesCount:g})}let u;function f(){u===void 0&&(u=Ee(()=>{l("duration_limit")},t))}function p(){rr(u),u=void 0}return{flushObservable:a,get messagesCount(){return d},notifyBeforeAddMessage(h){c+h>=e&&l("bytes_limit"),d+=1,c+=h,f()},notifyAfterAddMessage(h=0){c+=h,d>=r?l("messages_limit"):c>=e&&l("bytes_limit")},notifyAfterRemoveMessage(h){c-=h,d-=1,d===0&&p()}}}function Xr(r,e,t,s,i,n,o=qn){const a=d(r,e),c=t&&d(r,t);function d(l,{endpoint:u,encoder:f}){return o({encoder:f,request:zn(u,l.batchBytesLimit,s),flushController:Zn({messagesLimit:l.batchMessagesLimit,bytesLimit:l.batchBytesLimit,durationLimit:l.flushTimeout,pageExitObservable:i,sessionExpireObservable:n}),messageBytesLimit:l.messageBytesLimit})}return{flushObservable:a.flushController.flushObservable,add(l,u=!0){a.add(l),c&&u&&c.add(t.transformMessage?t.transformMessage(l):l)},upsert:(l,u)=>{a.upsert(l,u),c&&c.upsert(t.transformMessage?t.transformMessage(l):l,u)},stop:()=>{a.stop(),c&&c.stop()}}}function $e(){let r="",e=0;return{isAsync:!1,get isEmpty(){return!r},write(t,s){const i=dt(t);e+=i,r+=t,s&&s(i)},finish(t){t(this.finishSync())},finishSync(){const t={output:r,outputBytesCount:e,rawBytesCount:e,pendingData:""};return r="",e=0,t},estimateEncodedBytesCount(t){return t.length}}}class Kn{constructor(){this.callbacks={}}notify(e,t){const s=this.callbacks[e];s&&s.forEach(i=>i(t))}subscribe(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),{unsubscribe:()=>{this.callbacks[e]=this.callbacks[e].filter(s=>t!==s)}}}}function Jn(r,e,t){let s=0,i=!1;return{isLimitReached(){if(s===0&&Ee(()=>{s=0},J),s+=1,s<=e||i)return i=!1,!1;if(s===e+1){i=!0;try{t({message:`Reached max number of ${r}s by minute: ${e}`,source:P.AGENT,startClocks:H()})}finally{i=!1}}return!0}}}let kt;const Ut=new WeakMap;function $n(r){return kt||(kt=eo(r)),kt}function eo(r){return new k(e=>{const{stop:t}=ie(XMLHttpRequest.prototype,"open",to),{stop:s}=ie(XMLHttpRequest.prototype,"send",n=>{ro(n,r,e)},{computeHandlingStack:!0}),{stop:i}=ie(XMLHttpRequest.prototype,"abort",so);return()=>{t(),s(),i()}})}function to({target:r,parameters:[e,t]}){Ut.set(r,{state:"open",method:String(e).toUpperCase(),url:vt(String(t))})}function ro({target:r,handlingStack:e},t,s){const i=Ut.get(r);if(!i)return;const n=i;n.state="start",n.startClocks=H(),n.isAborted=!1,n.xhr=r,n.handlingStack=e;let o=!1;const{stop:a}=ie(r,"onreadystatechange",()=>{r.readyState===XMLHttpRequest.DONE&&c()}),c=()=>{if(d(),a(),o)return;o=!0;const l=i;l.state="complete",l.duration=vs(n.startClocks.timeStamp,W()),l.status=r.status,s.notify(Ss(l))},{stop:d}=ne(t,r,"loadend",c);s.notify(n)}function so({target:r}){const e=Ut.get(r);e&&(e.isAborted=!0)}let It;function qr(){return It||(It=io()),It}function io(){return new k(r=>{if(!window.fetch)return;const{stop:e}=ie(window,"fetch",t=>no(t,r),{computeHandlingStack:!0});return e})}function no({parameters:r,onPostCall:e,handlingStack:t},s){const[i,n]=r;let o=n&&n.method;o===void 0&&i instanceof Request&&(o=i.method);const a=o!==void 0?String(o).toUpperCase():"GET",c=i instanceof Request?i.url:vt(String(i)),d=H(),l={state:"start",init:n,input:i,method:a,startClocks:d,url:c,handlingStack:t};s.notify(l),r[0]=l.input,r[1]=l.init,e(u=>oo(s,u,l))}function oo(r,e,t){const s=t;function i(n){s.state="resolve",Object.assign(s,n),r.notify(s)}e.then(S(n=>{i({response:n,responseType:n.type,status:n.status,isAborted:!1})}),S(n=>{var o,a;i({status:0,isAborted:((a=(o=s.init)===null||o===void 0?void 0:o.signal)===null||a===void 0?void 0:a.aborted)||n instanceof DOMException&&n.code===DOMException.ABORT_ERR,error:n})}))}let Lt={};function ao(r){const e=r.map(t=>(Lt[t]||(Lt[t]=co(t)),Lt[t]));return ir(...e)}function co(r){return new k(e=>{const t=M[r];return M[r]=(...s)=>{t.apply(console,s);const i=Ye("console error");_e(()=>{e.notify(lo(s,r,i))})},()=>{M[r]=t}})}function lo(r,e,t){const s=r.map(n=>uo(n)).join(" ");let i;if(e===R.error){const n=r.find(X);i={stack:n?se(G(n)):void 0,fingerprint:Sr(n),causes:n?Cr(n,"console"):void 0,startClocks:H(),message:s,source:P.CONSOLE,handling:"handled",handlingStack:t,context:wr(n)}}return{api:e,message:s,error:i,handlingStack:t}}function uo(r){return typeof r=="string"?z(r):X(r)?_r(G(r)):re(z(r),void 0,2)}function ho(r){const e=Ur(r)==="object";return e||D.error("Unsupported context:",r),e}function Pt(r,e,t){const s={...r};for(const[i,{required:n,type:o}]of Object.entries(e))o==="string"&&i in s&&(s[i]=String(s[i])),n&&!(i in r)&&D.warn(`The property ${i} of ${t} is required; context will not be sent to the intake.`);return s}function et(r="",{customerDataTracker:e,propertiesConfig:t={}}={}){let s={};const i=new k,n={getContext:()=>Ir(s),setContext:o=>{ho(o)?(s=z(Pt(o,t,r)),e==null||e.updateCustomerData(s)):n.clearContext(),i.notify()},setContextProperty:(o,a)=>{s=z(Pt({...s,[o]:a},t,r)),e==null||e.updateCustomerData(s),i.notify()},removeContextProperty:o=>{delete s[o],e==null||e.updateCustomerData(s),Pt(s,t,r),i.notify()},clearContext:()=>{s={},e==null||e.resetCustomerData(),i.notify()},changeObservable:i};return n}const fo="_dd_c",po=[];function Ft(r,e,t,s){const i=mo(t,s);po.push(ne(r,window,"storage",({key:d})=>{i===d&&o()})),e.changeObservable.subscribe(a);const n=pe(c(),e.getContext());ve(n)||e.setContext(n);function o(){e.setContext(c())}function a(){localStorage.setItem(i,JSON.stringify(e.getContext()))}function c(){const d=localStorage.getItem(i);return d?JSON.parse(d):{}}}function mo(r,e){return`${fo}_${r}_${e}`}const go=3*N,Ao=16*N,yo=200;function bo(r=2){const e=new Map;let t=!1;function s(i=0){if(t||r===0)return;const n=r===2?go:Ao;let o=i;e.forEach(a=>{o+=a.getBytesCount()}),o>n&&(vo(n),t=!0)}return{createDetachedTracker:()=>{const i=Zr(()=>s(i.getBytesCount()));return i},getOrCreateTracker:i=>(e.has(i)||e.set(i,Zr(s)),e.get(i)),setCompressionStatus:i=>{r===0&&(r=i,s())},getCompressionStatus:()=>r,stop:()=>{e.forEach(i=>i.stop()),e.clear()}}}function Zr(r){let e=0;const{throttled:t,cancel:s}=nr(n=>{e=dt(re(n)),r()},yo),i=()=>{s(),e=0};return{updateCustomerData:n=>{ve(n)?i():t(n)},resetCustomerData:i,getBytesCount:()=>e,stop:()=>{s()}}}function vo(r){D.warn(`Customer data exceeds the recommended ${r/N}KiB threshold. ${Le} ${qt}/#customer-data-exceeds-the-recommended-threshold-warning`)}function _o(r,e,t){const s=r.getReader(),i=[];let n=0;o();function o(){s.read().then(S(c=>{if(c.done){a();return}i.push(c.value),n+=c.value.length,n>t.bytesLimit?a():o()}),S(c=>e(c)))}function a(){s.cancel().catch(j);let c,d;{let l;if(i.length===1)l=i[0];else{l=new Uint8Array(n);let u=0;i.forEach(f=>{l.set(f,u),u+=f.length})}c=l.slice(0,t.bytesLimit),d=l.length>t.bytesLimit}e(void 0,c,d)}}const Eo="datadog-synthetics-public-id",To="datadog-synthetics-result-id",So="datadog-synthetics-injects-rum";function Kr(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||$(So))}function wo(){const r=window._DATADOG_SYNTHETICS_PUBLIC_ID||$(Eo);return typeof r=="string"?r:void 0}function Co(){const r=window._DATADOG_SYNTHETICS_RESULT_ID||$(To);return typeof r=="string"?r:void 0}function tt(r,e,t){const s=t.getHandler(),i=Array.isArray(s)?s:[s];return Jr[r]>=Jr[t.getLevel()]&&i.includes(e)}const _={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},Jr={[_.ok]:0,[_.debug]:1,[_.info]:2,[_.notice]:4,[_.warn]:5,[_.error]:6,[_.critical]:7,[_.alert]:8,[_.emerg]:9};function rt(r,{includeMessage:e=!1}={}){return{stack:r.stack,kind:r.type,message:e?r.message:void 0,causes:r.causes,fingerprint:r.fingerprint,handling:r.handling}}var xo=function(r,e,t,s){var i=arguments.length,n=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,e,t,s);else for(var a=r.length-1;a>=0;a--)(o=r[a])&&(n=(i<3?o(n):i>3?o(e,t,n):o(e,t))||n);return i>3&&n&&Object.defineProperty(e,t,n),n};const De={console:"console",http:"http",silent:"silent"},Ro=Object.keys(_);let F=class{constructor(e,t,s,i=De.http,n=_.debug,o={}){this.handleLogStrategy=e,this.handlerType=i,this.level=n,this.contextManager=et("logger",{customerDataTracker:t}),this.contextManager.setContext(o),s&&this.contextManager.setContextProperty("logger",{name:s})}logImplementation(e,t,s=_.info,i,n){const o=z(t);let a;if(i!=null){const c=Tr({stackTrace:X(i)?G(i):void 0,originalError:i,nonErrorPrefix:"Provided",source:P.LOGGER,handling:"handled",startClocks:H()});a=pe({error:rt(c,{includeMessage:!0})},o)}else a=o;this.handleLogStrategy({message:z(e),context:a,status:s},this,n)}log(e,t,s=_.info,i){let n;tt(s,De.http,this)&&(n=Ye("log")),this.logImplementation(e,t,s,i,n)}setContext(e){this.contextManager.setContext(e)}getContext(){return this.contextManager.getContext()}setContextProperty(e,t){this.contextManager.setContextProperty(e,t)}removeContextProperty(e){this.contextManager.removeContextProperty(e)}clearContext(){this.contextManager.clearContext()}setHandler(e){this.handlerType=e}getHandler(){return this.handlerType}setLevel(e){this.level=e}getLevel(){return this.level}};xo([xs],F.prototype,"logImplementation",null),F.prototype.ok=V(_.ok),F.prototype.debug=V(_.debug),F.prototype.info=V(_.info),F.prototype.notice=V(_.notice),F.prototype.warn=V(_.warn),F.prototype.error=V(_.error),F.prototype.critical=V(_.critical),F.prototype.alert=V(_.alert),F.prototype.emerg=V(_.emerg);function V(r){return function(e,t,s){let i;tt(r,De.http,this)&&(i=Ye("log")),this.logImplementation(e,t,r,s,i)}}function Do(r,e,t){return{view:{referrer:document.referrer,url:window.location.href},context:r.getContext(),user:e.getContext(),account:t.getContext()}}const ko=32*N;function Uo(r){r.usePciIntake===!0&&r.site&&r.site!=="datadoghq.com"&&D.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const e=xi(r),t=$r(r.forwardConsoleLogs,Ne(R),"Forward Console Logs"),s=$r(r.forwardReports,Ne(Xe),"Forward Reports");if(!(!e||!t||!s))return r.forwardErrorsToLogs&&!t.includes(R.error)&&t.push(R.error),{forwardErrorsToLogs:r.forwardErrorsToLogs!==!1,forwardConsoleLogs:t,forwardReports:s,requestErrorResponseLengthLimit:ko,...e}}function $r(r,e,t){if(r===void 0)return[];if(!(r==="all"||Array.isArray(r)&&r.every(s=>e.includes(s)))){D.error(`${t} should be "all" or an array with allowed values "${e.join('", "')}"`);return}return r==="all"?e:fn(r)}function Io(r){const e=Ri(r);return{forward_errors_to_logs:r.forwardErrorsToLogs,forward_console_logs:r.forwardConsoleLogs,forward_reports:r.forwardReports,use_pci_intake:r.usePciIntake,...e}}function Lo(r,e,t){const s=Pr();let i,n;const o=e.observable.subscribe(a);function a(){if(!n||!i||!e.isGranted())return;o.unsubscribe();const c=t(i,n);s.drain(c)}return{init(c){if(!c){D.error("Missing configuration");return}if(Di(c.enableExperimentalFeatures),Ke()&&(c=Po(c)),i=c,n){xr("DD_LOGS",c);return}const d=Uo(c);d&&(n=d,qr().subscribe(j),e.tryToInit(d.trackingConsent),a())},get initConfiguration(){return i},getInternalContext:j,handleLog(c,d,l,u=r(),f=W()){s.add(p=>p.handleLog(c,d,l,u,f))}}}function Po(r){return{...r,clientToken:"empty"}}const Ot="logs";function Fo(r){const e=bo(),t=et("global context",{customerDataTracker:e.getOrCreateTracker(2)}),s=et("user",{customerDataTracker:e.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),i=et("account",{customerDataTracker:e.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),n=ai();function o(){return Do(t,s,i)}let a=Lo(o,n,(l,u)=>{l.storeContextsAcrossPages&&(Ft(u,t,Ot,2),Ft(u,s,Ot,1),Ft(u,i,Ot,4));const f=r(l,u,o,n);return a=Oo(l,f),f});const c={},d=new F((...l)=>a.handleLog(...l),e.createDetachedTracker());return sn({logger:d,init:S(l=>a.init(l)),setTrackingConsent:S(l=>{n.update(l),En({feature:"set-tracking-consent",tracking_consent:l})}),getGlobalContext:S(()=>t.getContext()),setGlobalContext:S(l=>t.setContext(l)),setGlobalContextProperty:S((l,u)=>t.setContextProperty(l,u)),removeGlobalContextProperty:S(l=>t.removeContextProperty(l)),clearGlobalContext:S(()=>t.clearContext()),createLogger:S((l,u={})=>(c[l]=new F((...f)=>a.handleLog(...f),e.createDetachedTracker(),z(l),u.handler,u.level,z(u.context)),c[l])),getLogger:S(l=>c[l]),getInitConfiguration:S(()=>Ir(a.initConfiguration)),getInternalContext:S(l=>a.getInternalContext(l)),setUser:S(s.setContext),getUser:S(s.getContext),setUserProperty:S(s.setContextProperty),removeUserProperty:S(s.removeContextProperty),clearUser:S(s.clearContext),setAccount:S(i.setContext),getAccount:S(i.getContext),setAccountProperty:S(i.setContextProperty),removeAccountProperty:S(i.removeContextProperty),clearAccount:S(i.clearContext)})}function Oo(r,e){return{init:t=>{xr("DD_LOGS",t)},initConfiguration:r,...e}}const Bo="logs";function Mo(r,e){const t=kn(r,Bo,s=>Go(r,s),e);return{findTrackedSession:(s,i={returnInactive:!1})=>{const n=t.findSession(s,i);return n&&n.trackingType==="1"?{id:n.id,anonymousId:n.anonymousId}:void 0},expireObservable:t.expireObservable}}function No(r){const t=es(r)==="1"?{}:void 0;return{findTrackedSession:()=>t,expireObservable:new k}}function es(r){return Pe(r.sessionSampleRate)?"1":"0"}function Go(r,e){const t=zo(e)?e:es(r);return{trackingType:t,isTracked:t==="1"}}function zo(r){return r==="0"||r==="1"}let ts=!1;function st(r){const e=window;if(Kr()){const s=t(e.DD_RUM_SYNTHETICS);return!s&&!ts&&(ts=!0,Or("Logs sent before RUM is injected by the synthetics worker",{testId:wo(),resultId:Co()})),s}return t(e.DD_RUM);function t(s){if(s&&s.getInternalContext)return s.getInternalContext(r)}}function Vo(r,e,t,s,i){const n=Ro.concat(["custom"]),o={};n.forEach(a=>{o[a]=Jn(a,e.eventRateLimiterThreshold,i)}),t.subscribe(0,({rawLogsEvent:a,messageContext:c=void 0,savedCommonContext:d=void 0,domainContext:l})=>{var u,f;const p=Es(a.date),h=r.findTrackedSession(p);if(!r.findTrackedSession(p,{returnInactive:!0}))return;const g=d||s();let E;!ve(g.account)&&g.account.id&&(E=g.account),h&&h.anonymousId&&!g.user.anonymous_id&&(g.user.anonymous_id=h.anonymousId);const b=pe({service:e.service,session_id:h?h.id:void 0,session:h?{id:h.id}:void 0,usr:ve(g.user)?void 0:g.user,account:E,view:g.view},g.context,st(p),a,c);((u=e.beforeSend)===null||u===void 0?void 0:u.call(e,b,l))===!1||b.origin!==P.AGENT&&((f=o[b.status])!==null&&f!==void 0?f:o.custom).isLimitReached()||t.notify(1,b)})}const Wo={[R.log]:_.info,[R.debug]:_.debug,[R.info]:_.info,[R.warn]:_.warn,[R.error]:_.error};function Ho(r,e){const t=ao(r.forwardConsoleLogs).subscribe(s=>{var i;const n={rawLogsEvent:{date:W(),message:s.message,origin:P.CONSOLE,error:s.error&&rt(s.error),status:Wo[s.api]},messageContext:(i=s.error)===null||i===void 0?void 0:i.context,domainContext:{handlingStack:s.handlingStack}};e.notify(0,n)});return{stop:()=>{t.unsubscribe()}}}function Qo(r,e){const t=on(r,r.forwardReports).subscribe(s=>{let i=s.message,n;const o=s.originalError.type==="deprecation"?_.warn:_.error;o===_.error?n=rt(s):s.stack&&(i+=` Found in ${$i(s.stack)}`),e.notify(0,{rawLogsEvent:{date:W(),message:i,origin:P.REPORT,error:n,status:o}})});return{stop:()=>{t.unsubscribe()}}}function jo(r,e){if(!r.forwardErrorsToLogs)return{stop:j};const t=$n(r).subscribe(n=>{n.state==="complete"&&i("xhr",n)}),s=qr().subscribe(n=>{n.state==="resolve"&&i("fetch",n)});function i(n,o){!wi(o.url)&&(Zo(o)||Mr(o.status))&&("xhr"in o?Yo(o.xhr,r,a):o.response?qo(o.response,r,a):o.error&&Xo(o.error,r,a));function a(c){const d={isAborted:o.isAborted,handlingStack:o.handlingStack};e.notify(0,{rawLogsEvent:{message:`${Ko(n)} error ${o.method} ${o.url}`,date:o.startClocks.timeStamp,error:{stack:c||"Failed to load",handling:void 0},http:{method:o.method,status_code:o.status,url:o.url},status:_.error,origin:P.NETWORK},domainContext:d})}}return{stop:()=>{t.unsubscribe(),s.unsubscribe()}}}function Yo(r,e,t){typeof r.response=="string"?t(Bt(r.response,e)):t(r.response)}function Xo(r,e,t){t(Bt(se(G(r)),e))}function qo(r,e,t){const s=Pn(r);!s||!s.body?t():window.TextDecoder?Jo(s.body,e.requestErrorResponseLengthLimit,(i,n)=>{t(i?`Unable to retrieve response: ${i}`:n)}):s.text().then(S(i=>t(Bt(i,e))),S(i=>t(`Unable to retrieve response: ${i}`)))}function Zo(r){return r.status===0&&r.responseType!=="opaque"}function Bt(r,e){return r.length>e.requestErrorResponseLengthLimit?`${r.substring(0,e.requestErrorResponseLengthLimit)}...`:r}function Ko(r){return r==="xhr"?"XHR":"Fetch"}function Jo(r,e,t){_o(r,(s,i,n)=>{if(s)t(s);else{let o=new TextDecoder().decode(i);n&&(o+="..."),t(void 0,o)}},{bytesLimit:e,collectStreamBody:!0})}function $o(r,e){if(!r.forwardErrorsToLogs)return{stop:j};const t=new k,{stop:s}=en(t),i=t.subscribe(n=>{e.notify(0,{rawLogsEvent:{message:n.message,date:n.startClocks.timeStamp,error:rt(n),origin:P.SOURCE,status:_.error},messageContext:n.context})});return{stop:()=>{s(),i.unsubscribe()}}}const ea=Kn;function ta(r){function e(t,s,i,n,o){const a=pe(s.getContext(),t.context);if(tt(t.status,De.console,s)&&sa(t,a),tt(t.status,De.http,s)){const c={rawLogsEvent:{date:o||W(),message:t.message,status:t.status,origin:P.LOGGER},messageContext:a,savedCommonContext:n};i&&(c.domainContext={handlingStack:i}),r.notify(0,c)}}return{handleLog:e}}const ra={[_.ok]:R.debug,[_.debug]:R.debug,[_.info]:R.info,[_.notice]:R.info,[_.warn]:R.warn,[_.error]:R.error,[_.critical]:R.error,[_.alert]:R.error,[_.emerg]:R.error};function sa({status:r,message:e},t){K[ra[r]].call(M,e,t)}function ia(r,e,t,s,i){const n=Xr(r,{endpoint:r.logsEndpointBuilder,encoder:$e()},r.replica&&{endpoint:r.replica.logsEndpointBuilder,encoder:$e()},t,s,i.expireObservable);return e.subscribe(1,o=>{n.add(o)}),n}function na(r){const e=Dt();r.subscribe(1,t=>{e.send("log",t)})}function oa(r){return{get:e=>{const t=r.findTrackedSession(e);if(t)return{session_id:t.id}}}}function aa(r){return e=>{r.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,origin:P.AGENT,status:_.error}}),Or("Error reported to customer",{"error.message":e.message})}}function ca(r,e,t,s,i){const n=An("browser-logs-sdk",e);n.setContextProvider(()=>{var a,c,d,l,u,f;return{application:{id:(a=st())===null||a===void 0?void 0:a.application_id},session:{id:(c=i.findTrackedSession())===null||c===void 0?void 0:c.id},view:{id:(l=(d=st())===null||d===void 0?void 0:d.view)===null||l===void 0?void 0:l.id},action:{id:(f=(u=st())===null||u===void 0?void 0:u.user_action)===null||f===void 0?void 0:f.id}}});const o=[];if(Ke()){const a=Dt(),c=n.observable.subscribe(d=>a.send("internal_telemetry",d));o.push(()=>c.unsubscribe())}else{const a=Xr(e,{endpoint:e.rumEndpointBuilder,encoder:$e()},e.replica&&{endpoint:e.replica.rumEndpointBuilder,encoder:$e()},t,s,i.expireObservable);o.push(()=>a.stop());const c=n.observable.subscribe(d=>a.add(d,vn(e)));o.push(()=>c.unsubscribe())}return bn(),_n(Io(r)),{telemetry:n,stop:()=>{o.forEach(a=>a())}}}function la(r,e,t,s){const i=new ea,n=[];i.subscribe(1,f=>kr("logs",f));const o=aa(i),a=Yn(e),c=e.sessionStoreStrategyType&&!Ke()&&!Kr()?Mo(e,s):No(e),{stop:d}=ca(r,e,o,a,c);n.push(()=>d()),jo(e,i),$o(e,i),Ho(e,i),Qo(e,i);const{handleLog:l}=ta(i);if(Vo(c,e,i,t,o),Ke())na(i);else{const{stop:f}=ia(e,i,o,a,c);n.push(()=>f())}const u=oa(c);return{handleLog:l,getInternalContext:u.get,stop:()=>{n.forEach(f=>f())}}}const ae=Fo(la);nn(Q(),"DD_LOGS",ae);const A=class A{constructor(e){this.listenerMap=new Map,A.options=e,this.isLoggingOn=e.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&ae.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const t="bb_logger_mac_uuid";let s=localStorage.getItem(t);s||(s=crypto.randomUUID(),localStorage.setItem(t,s)),A.tracking.mac=s,A.tracking.dev=`${e.platform}_${e.browserName}`,A.beatHandle||(A.options&&y(A.options,"Logger")&&console.log("[Logger] Starting tracking beat"),A.beatHandle=window.setInterval(A.flushTracking,15e3))}static setMessagePort(e){this.messagePort=e}static getMessagePort(){return this.messagePort}setLoggingOn(e){this.isLoggingOn=e}addEventListener(e,t){const s=i=>t(i);this.listenerMap.set(t,{eventName:e,wrappedListener:s}),this.eventTarget.addEventListener(e,s)}removeEventListener(e,t){const s=this.listenerMap.get(t);s&&s.eventName===e&&(this.eventTarget.removeEventListener(e,s.wrappedListener),this.listenerMap.delete(t))}removeAllEventListeners(){for(const[e,{eventName:t,wrappedListener:s}]of this.listenerMap)this.eventTarget.removeEventListener(t,s);this.listenerMap.clear()}setAttributes(e){A.processAttributes(e);for(const t in e)ae.logger.setContextProperty(t,e[t])}info(e,t){e==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(t==null?void 0:t.url)||""}),e==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(t==null?void 0:t.isEnabled)??!0}),e==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",t),e==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",t),e==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",t),t&&A.processAttributes(t),this.isLoggingOn&&(ae.logger.info(e,t),A.options&&y(A.options,"Logger")&&console.log("[Logger] Sending info: ",e))}error(e,t){this.emit("mediaSessionDidError",{message:e,...t||{}}),t&&A.processAttributes(t),this.isLoggingOn&&(ae.logger.error(e,t),A.tracking.err_time=Date.now().toFixed(0),A.tracking.err_desc=e+(t?` - ${JSON.stringify(t)}`:""),A.options&&y(A.options,"Logger")&&console.log("[Logger] Sending error: ",e))}criticalError(e,t){this.emit("mediaSessionDidFailOnError",{message:e,...t||{}}),t&&A.processAttributes(t),this.isLoggingOn&&(ae.logger.error(e,t),A.tracking.err_time=Date.now().toFixed(0),A.tracking.err_desc=e+(t?` - ${JSON.stringify(t)}`:""),A.options&&y(A.options,"Logger")&&console.log("[Logger] Sending critical error: ",e))}warn(e,t){t&&A.processAttributes(t),this.isLoggingOn&&(ae.logger.warn(e,t),A.options&&y(A.options,"Logger")&&console.log("[Logger] Sending warn: ",e))}handleMessageFromWorker(e){e.actionType==="INFO"?this.info(e.message,e.attributes):e.actionType==="ERROR"?this.error(e.message,e.attributes):e.actionType==="CRITICAL_ERROR"?this.criticalError(e.message,e.attributes):e.actionType==="WARN"?this.warn(e.message,e.attributes):e.actionType==="SET_ATTRIBUTES"&&e.attributes&&this.setAttributes(e.attributes)}static setAttributes(e){if(!A.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{A.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:e})}catch(t){console.error("[Logger] Error posting message:",t)}}static info(e,t){A.messagePort.postMessage({type:"LOG",actionType:"INFO",message:e,attributes:t})}static error(e,t){A.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:e,attributes:t})}static warn(e,t){A.messagePort.postMessage({type:"LOG",actionType:"WARN",message:e,attributes:t})}static criticalError(e,t){A.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:e,attributes:t})}static processAttributes(e){if(e.player_version&&(A.tracking.sdk=e.player_version),e.media_id&&(A.tracking.gid=e.media_id),e.game_id&&(A.tracking.buc=e.game_id),e.bb_session_id&&(A.tracking.sid=e.bb_session_id,A.options&&y(A.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",A.tracking.sid)),e.last_timecode){const s=L.fromStr(e.last_timecode);A.tracking.tc=s.print(),A.lastTimecodeMillis=s.totalMilliseconds(59.94),A.lastTimecodeMillis&&A.lastZipMillis&&(A.tracking.cache=(A.lastZipMillis-A.lastTimecodeMillis).toFixed(0))}e.last_offset&&(A.tracking.off=e.last_offset),e.last_loading_zip&&(A.tracking.zip=e.last_loading_zip+".zip",A.lastZipMillis=L.fromStr(e.last_loading_zip).totalMilliseconds(59.94),A.lastTimecodeMillis&&A.lastZipMillis&&(A.tracking.cache=(A.lastZipMillis-A.lastTimecodeMillis).toFixed(0))),e.last_rendered_frame&&(A.tracking.aug_time=Date.now().toFixed(0)),e.asset&&(A.tracking.asset=e.asset)}static objectToQuery(e){return Object.entries(e).filter(([t,s])=>s!==0&&s!=="").map(([t,s])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(s))}`).join("&")}emit(e,t){const s=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(s)}};A.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},A.lastTimecodeMillis=0,A.lastZipMillis=0,A.flushTracking=()=>{const e=Date.now().toFixed(0);A.tracking.now=e;const s=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${A.objectToQuery(A.tracking)}&platform=Web`;A.options&&y(A.options,"Logger")&&console.log("[Logger] Flushing tracking data:",s),fetch(s,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),A.tracking.err_desc="",A.tracking.err_time=""};let Mt=A;const da={env:"prod",urlConfigURL:"https://db8igqxlbvayn.cloudfront.net/url_config.json",gameBaseURL:"https://db8igqxlbvayn.cloudfront.net",zipBaseURL:"https://db8igqxlbvayn.cloudfront.net",adsBaseURL:"https://dwu3k7rrxk5s3.cloudfront.net",LOG_TO_DATADOG:!0,SEND_METRICS:!0,BURNED_TIMECODES_MODE:!1,RENDER_LED:!0,DRAW_TIMESTAMP_WEBGL:!1,ADAPTER_RUN_IN_WORKER:!1,DOWNLOADER_UPDATE_FREQUENCY:1e3,DOWNLOADER_ZIP_START_OFFSET:2,DOWNLOADER_ZIP_END_OFFSET:10,DOWNLOADER_ZIP_LENGTH_SECONDS:2,ZIP_BUFFER_READY_THRESHOLD:5,ZIP_BUFFER_FADEOUT_THRESHOLD:1,BENCHMARK_DURATION_SECONDS:10,DECODER_UPDATE_FREQUENCY:30,DECODER_FRAME_BATCH_SIZE:3,DECODER_LEAD_TIME_MILLIS:180,PERFORMANCE_TRACKING_INTERVAL:1e3,BUCKET_SUBFOLDER_PATH:"manifests/59.94/",MASK_TYPE:"mp4",debug:{on:!1,showAugmentationStatus:!1,logOTTPlayer:!1,logClocker:!1,logDownloader:!1,logDecoder:!1,logRenderer:!1,logFetcher:!1,logAdapter:!1,logAds:!1,logLogger:!1,logErrors:!1,trackPerformance:!1}},ua="https://identity-qa.nba.com/qa/auth";class ha{constructor(e){this.cookies=[],this.xToken=null,this.authInProgress=!1,this.OTTPlayer=e,this.options=e.options,this.logger=e.logger}async fetchNBAToken(e,t){const s=this.options.authIdentityUrl||ua;y(this.options,"OTTPlayer")&&console.log(`[CloudFrontAuth] Fetching JWT from: ${s}`);const i=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t})});if(!i.ok){const o=await i.text().catch(()=>"");throw new Error(`NBA auth request failed: ${i.status} ${i.statusText} - ${o}`)}const n=await i.json().catch(()=>null);if(!n||!n.data||!n.data.jwt)throw new Error("NBA auth response was invalid or missing JWT token");return n.data.jwt}async loginAndGetCookies(e){try{const t=this.options.authNbaToken,s=this.options.authEmail,i=this.options.authPassword;if(!t&&(!s||!i))return y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] No credentials or NBA token provided, skipping authentication"),[];const n=this.options.zipBaseURL;if(!n)return console.warn("[CloudFrontAuth] No zipBaseURL configured, cannot authenticate"),[];if(this.lastGameId===e&&this.cookies.length>0)return y(this.options,"OTTPlayer")&&console.log(`[CloudFrontAuth] ✓ Using cached cookies for gameId=${e}`),this.cookies;if(this.authInProgress)return y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ⏳ Auth already in progress, waiting..."),await this.waitForAuth(),this.cookies;this.authInProgress=!0,this.lastGameId=e,console.log(`[CloudFrontAuth] 🔐 Starting authentication for gameId=${e}`),console.log(`[CloudFrontAuth] CloudFront URL: ${n}`);let o;t?(o=t,y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ✓ Using provided NBA token")):this.xToken?(o=this.xToken,y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ✓ Using existing x-token")):(o=await this.fetchNBAToken(s,i),y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ✓ Got JWT token from NBA Identity"));const a=`${n}/auth/${encodeURIComponent(e)}`;console.log(`[CloudFrontAuth] Fetching cookies from: ${a}`);const c=await fetch(a,{method:"GET",credentials:"include",headers:{Authorization:`Bearer ${o}`}});if(!c.ok&&c.status!==204)throw new Error(`Failed to fetch cookies: ${c.status} ${c.statusText}`);y(this.options,"OTTPlayer")&&console.log(`[CloudFrontAuth] Auth endpoint status: ${c.status}`);const d=c.headers.get("x-token");d&&(this.xToken=d,y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ✓ Received fresh x-token"));const l=c.headers.get("set-cookie");return l?this.cookies=l.split(",").map(u=>u.trim()):this.cookies=["browser-managed-httponly-cookies"],console.log("[CloudFrontAuth] ✅ Successfully authenticated"),console.log("[CloudFrontAuth] Note: Cookies are HttpOnly and managed by browser automatically"),this.logger.info("didAuthenticateCloudFront",{gameId:e,cookieCount:this.cookies.length,hasXToken:!!this.xToken}),this.scheduleCookieRefresh(e),this.cookies}catch(t){return console.error("[CloudFrontAuth] ❌ Authentication failed:",t),this.logger.criticalError("[CloudFrontAuth] Required authentication failed",{error:t.message||t,gameId:e,hasNbaToken:!!this.options.authNbaToken,hasEmailPassword:!!(this.options.authEmail&&this.options.authPassword)}),this.xToken=null,[]}finally{this.authInProgress=!1}}async waitForAuth(){return new Promise(e=>{const t=setInterval(()=>{this.authInProgress||(clearInterval(t),e())},100)})}scheduleCookieRefresh(e){this.cookieRefreshTimer&&window.clearTimeout(this.cookieRefreshTimer),this.cookieRefreshTimer=window.setTimeout(()=>{y(this.options,"OTTPlayer")&&console.log(`[CloudFrontAuth] Auto-refreshing cookies and x-token for gameId=${e}`),this.loginAndGetCookies(e)},7*60*60*1e3)}getCookies(){return this.cookies}getXToken(){return this.xToken}isAuthenticated(){return this.cookies.length>0}destroy(){this.cookies=[],this.xToken=null,this.lastGameId=void 0,this.cookieRefreshTimer&&(window.clearTimeout(this.cookieRefreshTimer),this.cookieRefreshTimer=void 0)}}class fa{constructor(e){this.groups=new Map,this.isVisible=!0,this.lastFrameTime=0,this.TARGET_FPS=60,this.FRAME_INTERVAL=1e3/this.TARGET_FPS,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.pointerEvents="none",this.canvas.style.zIndex="3001",this.canvas.width=e.clientWidth,this.canvas.height=e.clientHeight,this.canvas.style.width="100%",this.canvas.style.height="100%",this.ctx=this.canvas.getContext("2d"),e.appendChild(this.canvas),this.initializeGroups(),this.startRenderLoop(),this.setupResizeObserver(e)}initializeGroups(){this.groups.set("support",{title:"Basic Augmentation Support",metrics:new Map([["game_params",{value:!1}],["browser",{value:!1,detail:""}],["pattern",{value:!1,detail:""}],["fps",{value:!1,detail:""}],["mk_ads",{value:!1,detail:""}]])}),this.groups.set("timecode",{title:"TimeCode Status",metrics:new Map([["sync_point",{value:!1,detail:""}],["consistency",{value:!1,detail:""}]])}),this.groups.set("benchmark",{title:"",metrics:new Map([["status",{value:"FAILED",detail:""}]])}),this.groups.set("switches",{title:"Augmentation Switches",metrics:new Map([["killswitch_web",{value:!1}],["killswitch_local",{value:!1}],["isLive",{value:!1}],["render_state",{value:"OFF"}]])}),this.groups.set("data",{title:"Augmentation Data Presence",metrics:new Map([["zip_buffer",{value:!1,detail:"0.0s"}],["stream_data",{value:!1}],["ads",{value:!1}],["render_data",{value:!1}],["alpha_mask",{value:!1}],["placeholders",{value:!1}],["processing_size",{value:!1}]])}),this.groups.set("health",{title:"Player Components Health",metrics:new Map([["decoder",{value:!1,detail:""}],["webgl",{value:!1,detail:""}]])})}updateMetric(e,t,s,i){const n=this.groups.get(e);n&&n.metrics.set(t,{value:s,detail:i})}startRenderLoop(){const e=t=>{t-this.lastFrameTime>=this.FRAME_INTERVAL&&(this.isVisible&&this.draw(),this.lastFrameTime=t),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}setupResizeObserver(e){typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.canvas.width=e.clientWidth,this.canvas.height=e.clientHeight}),this.resizeObserver.observe(e))}draw(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);const e=12,t=e+3,s=10,i=15,n=10;this.ctx.font=`${e}px monospace`,this.ctx.textBaseline="top";let o=n;this.groups.forEach((c,d)=>{var l;if(d==="benchmark"){const u=c.metrics.get("status");if(u){const f=u.value;let p,h;f==="PASSED"?(p="rgba(0,255,136,0.8)",h="STABILITY TEST: PASSED"):f==="TESTING"?(p="rgba(255,170,0,0.8)",h=`STABILITY TEST: TESTING${u.detail?" ("+((l=u.detail.split(":")[1])==null?void 0:l.trim())+")":""}`):(p="rgba(255,51,51,0.8)",h="STABILITY TEST: FAILED"),this.ctx.fillStyle=p,this.ctx.fillRect(n,o,250,20),this.ctx.fillStyle="#000",this.ctx.font=`bold ${e}px monospace`,this.ctx.fillText(h,n+5,o+4),this.ctx.font=`${e}px monospace`,o+=25}return}this.ctx.fillStyle="rgba(0,0,0,0.7)",this.ctx.fillRect(n,o,300,t+2),this.ctx.fillStyle="#fff",this.ctx.font=`bold ${e}px monospace`,this.ctx.fillText(c.title,n+5,o+1),this.ctx.font=`${e}px monospace`,o+=t+4,c.metrics.forEach((u,f)=>{const p=this.getColorForValue(u.value),h=this.formatValue(u.value);this.ctx.fillStyle="rgba(0,0,0,0.5)",this.ctx.fillRect(n+i,o,285-i,t),this.ctx.fillStyle=p,this.ctx.beginPath(),this.ctx.arc(n+i+5,o+t/2,3,0,Math.PI*2),this.ctx.fill(),this.ctx.fillStyle="#fff";const m=f.replace(/_/g," ");this.ctx.fillText(`${m}: ${h}`,n+i+15,o+1),o+=t,u.detail&&(this.ctx.fillStyle="rgba(0,0,0,0.4)",this.ctx.fillRect(n+i,o,285-i,t),this.ctx.fillStyle="#aaa",this.ctx.fillText(` ${u.detail}`,n+i+15,o+1),o+=t)}),o+=s});const a=this.isAugmentationReady();this.ctx.fillStyle=a?"rgba(0,255,136,0.8)":"rgba(255,51,51,0.8)",this.ctx.fillRect(n,o,250,20),this.ctx.fillStyle="#000",this.ctx.font=`bold ${e}px monospace`,this.ctx.fillText(`AUGMENTATION: ${a?"READY":"NOT READY"}`,n+5,o+4),this.ctx.font=`${e}px monospace`}formatValue(e){return typeof e=="boolean"?e?"OK":"NO":e==="PASSED"?"PASSED":e==="TESTING"?"TESTING":e==="FAILED"?"FAILED":e}getColorForValue(e){return typeof e=="boolean"?e?"#00ff88":"#ff3333":e==="ON"||e==="FADE_IN"?"#00ff88":e==="FADE_OUT"?"#ffaa00":e==="PASSED"?"#00ff88":e==="TESTING"?"#ffaa00":"#ff3333"}isAugmentationReady(){var u,f,p,h,m,g,E,b,T,C;const e=this.groups.get("support"),t=this.groups.get("switches"),s=this.groups.get("data"),i=this.groups.get("health"),n=this.groups.get("benchmark");if(!e||!t||!s||!i||!n)return!1;const o=((u=e.metrics.get("game_params"))==null?void 0:u.value)===!0&&((f=e.metrics.get("browser"))==null?void 0:f.value)===!0&&((p=e.metrics.get("pattern"))==null?void 0:p.value)===!0&&((h=e.metrics.get("fps"))==null?void 0:h.value)===!0&&((m=e.metrics.get("mk_ads"))==null?void 0:m.value)===!0,a=((g=t.metrics.get("killswitch_web"))==null?void 0:g.value)===!0&&((E=t.metrics.get("killswitch_local"))==null?void 0:E.value)===!0&&(((b=t.metrics.get("render_state"))==null?void 0:b.value)==="ON"||((T=t.metrics.get("render_state"))==null?void 0:T.value)==="FADE_IN"),c=Array.from(s.metrics.values()).every(w=>w.value===!0),d=Array.from(i.metrics.values()).every(w=>w.value===!0),l=((C=n.metrics.get("status"))==null?void 0:C.value)==="PASSED";return o&&a&&c&&d&&l}toggle(){this.isVisible=!this.isVisible,this.isVisible||this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}pause(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}resume(){this.animationFrameId||this.startRenderLoop()}delete(){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.resizeObserver&&this.resizeObserver.disconnect(),this.canvas.remove()}}class rs{constructor(e,t,s,i){this.RUN_PIXEL_TICKERS=!0,this.pixelTickers=[],this.handleVisibilityChange=()=>{document.hidden?this.onTabHidden():this.onTabVisible()},this.fetchGameParams=async()=>{try{if(y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] GameId: ",this.options.gameId),this.options.OVERRIDE_GAME_PARAMS){y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Using OVERRIDE_GAME_PARAMS from configuration");const l=this.options.OVERRIDE_GAME_PARAMS;if(this.options.BURNED_TIMECODES_MODE){this.gameParams=l;return}if(l.hasOwnProperty("bucketName")&&l.hasOwnProperty("offsets")){if(this.logger.setAttributes({game_id:l.bucketName,customer_name:l.customerName,customer_id:l.customerId}),this.gameParams){const u=JSON.stringify(this.gameParams),f=JSON.stringify(l);u!==f&&this.logger.info("didChangeGameParams",{oldParams:this.gameParams,newParams:l})}else this.logger.info("didFetchGameInfo",l);this.gameParams=l,this.cloudFrontAuth&&l.bucketName&&this.cloudFrontAuth.loginAndGetCookies(l.bucketName).then(()=>{y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] CloudFront authentication completed for bucketName:",l.bucketName)}).catch(u=>{y(this.options,"Errors")&&console.error("[OTTPlayer] CloudFront authentication failed:",u)});return}else throw new Error(`OVERRIDE_GAME_PARAMS for ${this.options.gameId} is missing required properties (bucketName or offsets)`)}let o;const a=`${this.options.gameBaseURL}/${this.options.gameId}.json`,c=this.options.SEND_METRICS?`${a}?platform=Web`:a;if(y(this.options,"OTTPlayer")&&console.log(`Fetching GameParams from ${c}`),o=await fetch(c,{cache:"no-store"}),!o.ok){const l=`Unable to fetch game params for ${this.options.gameId}. HTTP error. Status: ${o.status}`;this.logger.criticalError("[OTTPlayer] Failed to fetch game params",{status:o.status,gameId:this.options.gameId,url:c}),y(this.options,"Errors")&&console.error(`[OTTPlayer] ${l}`),this.destroy();return}const d=await o.json();if(this.options.BURNED_TIMECODES_MODE){this.gameParams=d;return}if(this.handleOttActions(o,d),d.hasOwnProperty("bucketName")&&d.hasOwnProperty("offsets"))o=d;else throw new Error(`Game params for ${this.options.gameId} not found in JSON`);if(this.logger.setAttributes({game_id:o.bucketName,customer_name:o.customerName,customer_id:o.customerId}),this.gameParams){const l=JSON.stringify(this.gameParams),u=JSON.stringify(o);l!==u&&this.logger.info("didChangeGameParams",{oldParams:this.gameParams,newParams:o})}else this.logger.info("didFetchGameInfo",this.gameParams);this.gameParams=o,this.cloudFrontAuth&&o.bucketName&&this.cloudFrontAuth.loginAndGetCookies(o.bucketName).then(()=>{y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] CloudFront authentication completed for bucketName:",o.bucketName)}).catch(l=>{y(this.options,"Errors")&&console.error("[OTTPlayer] CloudFront authentication failed:",l)})}catch(o){this.logger.error("[OTTPlayer] Error fetching game params",{error:o}),y(this.options,"Errors")&&console.error("[OTTPlayer] Error fetching game params:",o)}this.fetchGameParamsTimeoutId=window.setTimeout(()=>this.fetchGameParams(),1e4)},this.setGameParams=o=>{try{if(y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Overriding game params"),this.fetchGameParamsTimeoutId&&(window.clearTimeout(this.fetchGameParamsTimeoutId),this.fetchGameParamsTimeoutId=void 0),this.options.BURNED_TIMECODES_MODE){this.gameParams=o;return}if(o.hasOwnProperty("bucketName")&&o.hasOwnProperty("offsets")){if(this.logger.setAttributes({game_id:o.bucketName,customer_name:o.customerName,customer_id:o.customerId}),this.gameParams){const a=JSON.stringify(this.gameParams),c=JSON.stringify(o);a!==c&&this.logger.info("didChangeGameParams",{oldParams:this.gameParams,newParams:o})}else this.logger.info("didFetchGameInfo",o);this.gameParams=o,this.cloudFrontAuth&&o.bucketName&&this.cloudFrontAuth.loginAndGetCookies(o.bucketName).then(()=>{y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] CloudFront authentication completed for bucketName:",o.bucketName)}).catch(a=>{y(this.options,"Errors")&&console.error("[OTTPlayer] CloudFront authentication failed:",a)});return}else throw new Error(`Game params for ${this.options.gameId} is missing required properties (bucketName or offsets)`)}catch(a){this.logger.error("[OTTPlayer] Error overriding game params",{error:a}),y(this.options,"Errors")&&console.error("[OTTPlayer] Error overriding game params:",a)}};const n="OTTPlayer_v1.1.3";console.log(`%c${n}`,"font-size: 16px; font-weight: bold; color: blue;"),this.video=e,this.options={...s,...da,platform:B.getCurrentPlatform(),browserName:B.getBrowserName(),augmentation:{channelName:"nba"}},this.options.browserName==="Firefox"&&(this.options.DECODER_LEAD_TIME_MILLIS=300),y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Starting fetchUrlConfig"),this.fetchUrlConfig(i),this.logger=new Mt(this.options),this.logger.setAttributes({player_version:n,bb_session_id:crypto.randomUUID()}),this.logger.info("didGetConfiguration",{...s,fps:t}),ss(this.options,i).then(()=>{var o;if(this.logger.setAttributes({media_id:this.options.gameId}),window.BB.playerInstances.length>0&&window.BB.playerInstances.forEach(a=>{a.destroy()}),window.BB.workerInstances.length>0&&window.BB.workerInstances.forEach(a=>{a.terminate()}),this.cloudFrontAuth=new ha(this),this.clocker=new nt(this),this.adapter=new at(this),this.ottActions={toggle:{ios:!0,android:!0,web:!0,local:this.options.enabled}},(o=this.options.debug)!=null&&o.showAugmentationStatus){const a=this.options.CANVAS_CONTAINER||this.video.parentElement;a&&(this.statusOverlay=new fa(a))}this.RUN_PIXEL_TICKERS&&(this.pixelTickers=Z.createInAllCorners(this.video)),this.applyImageOverridesFromOptions(),this.flushPendingOverrides(),this.fetchGameParams(),window.BB.playerInstances.push(this),document.addEventListener("visibilitychange",this.handleVisibilityChange)})}onNewMetadata(e){!this.adapter||this.options.BURNED_TIMECODES_MODE||this.adapter.onNewMetadata(e)}onNewSegment(e){!this.adapter||this.options.BURNED_TIMECODES_MODE||this.adapter.onNewSegmentForMetadata(e)}onAdEvent(e){console.log(`[OTTPlayer] onAdEvent: ${e}`),!(!this.adapter||this.options.BURNED_TIMECODES_MODE)&&this.adapter.onAdEvent(e)}async fetchUrlConfig(e){try{if(!this.options.urlConfigURL){y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] No urlConfigURL provided, skipping URL config fetch");return}y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Fetching URL config from:",this.options.urlConfigURL);const t=await fetch(this.options.urlConfigURL);if(!t.ok)throw new Error(`Failed to fetch URL config: ${t.status} ${t.statusText}`);const s=await t.json();if(!s||typeof s!="object")throw new Error("Invalid URL config structure: not an object");const i=this.options.env;if(!s[i])throw new Error(`Environment '${i}' not found in URL config`);const n=s[i];if(!n.gameBaseUrl||!n.zipBaseUrl||!n.adsBaseUrl)throw new Error(`Missing required URLs in environment '${i}' config`);e!=null&&e.gameBaseURL||(this.options.gameBaseURL=n.gameBaseUrl),e!=null&&e.zipBaseURL||(this.options.zipBaseURL=n.zipBaseUrl),e!=null&&e.adsBaseURL||(this.options.adsBaseURL=n.adsBaseUrl),y(this.options,"OTTPlayer")&&(console.log("[OTTPlayer] URL config loaded successfully for environment:",i),console.log("[OTTPlayer] Updated URLs:",{gameBaseURL:this.options.gameBaseURL,zipBaseURL:this.options.zipBaseURL,adsBaseURL:this.options.adsBaseURL}))}catch(t){y(this.options,"OTTPlayer")&&(console.warn("[OTTPlayer] Failed to fetch URL config:",t),console.log("[OTTPlayer] Using default URLs from options"))}}handleOttActions(e,t){if(!this.clocker||this.options.BURNED_TIMECODES_MODE)return;const s=e.headers.get("x-tgi-ott-actions");let i;if(s?i=JSON.parse(s):i={toggle:{ios:!0,android:!0,web:!0}},!this.ottActions||this.ottActions.toggle.web!==i.toggle.web||i.toggle[t.customerId]!==void 0&&(this.ottActions.toggle[t.customerId]===void 0||this.ottActions.toggle[t.customerId]!==i.toggle[t.customerId])||i.toggle[t.customerId]===void 0&&this.ottActions.toggle[t.customerId]!==void 0){const o=i.toggle[t.customerId]!==void 0?i.toggle[t.customerId]&&i.toggle.web:i.toggle.web;this.ottActions&&this.logger.info("didToggleGlobalAugmentationDrawing",{isEnabled:o}),i.toggle.local=this.options.enabled,this.ottActions=i,console.warn("[OTTPlayer] ottActions",i)}}toggle(e){this.options.enabled=e,this.ottActions&&(this.ottActions.toggle.local=e,this.logger.info("didToggleGlobalAugmentationDrawing",{isEnabled:e}))}setFps(e){this.fps=e}setMediaInfo(e){e.fps&&this.setFps(e.fps),e.bitrate&&(this.bitrate=e.bitrate)}setAd(e,t,s=""){if(e===void 0){if(!this.clocker){this.pendingAdBlob=void 0,this.pendingAdBitmap=void 0,this.pendingAdPlaceholder=void 0,this.pendingAdClickUrl=void 0;return}this.clocker.resetAds(t);return}if(e===null){if(!this.clocker){this.pendingAdBlob=void 0,this.pendingAdBitmap=void 0,this.pendingAdPlaceholder=void 0,this.pendingAdClickUrl=void 0;return}this.clocker.clearAd(t);return}if(typeof e=="string"){let i;try{i=new URL(e,document.baseURI).toString()}catch(n){y(this.options,"Errors")&&console.error("[OTTPlayer] Invalid ad URL passed to setAd",e,n);return}fetch(i,{cache:"no-store"}).then(n=>n.blob()).then(async n=>{if(!this.clocker){this.pendingAdBlob=n,this.pendingAdPlaceholder=t,this.pendingAdClickUrl=s;return}this.clocker.setAdBlob(n,t,s)}).catch(n=>{y(this.options,"Errors")&&console.error("[OTTPlayer] Failed to fetch ad image from URL in setAd",i,n)});return}if(!this.clocker){if(e instanceof Blob)this.pendingAdBlob=e;else{if(this.pendingAdBitmap)try{this.pendingAdBitmap.close()}catch{}this.pendingAdBitmap=e}this.pendingAdPlaceholder=t,this.pendingAdClickUrl=s;return}if(e instanceof Blob){this.clocker.setAdBlob(e,t,s);return}else this.clocker.setAdImage(e,t,s)}setLED(e){if(e===null){if(!this.clocker){this.pendingLEDBlob=void 0,this.pendingLEDBitmap=void 0;return}this.clocker.clearLED();return}if(typeof e=="string"){let t;try{t=new URL(e,document.baseURI).toString()}catch(s){y(this.options,"Errors")&&console.error("[OTTPlayer] Invalid LED URL passed to setLED",e,s);return}fetch(t,{cache:"no-store"}).then(s=>s.blob()).then(s=>{if(!this.clocker){this.pendingLEDBlob=s;return}this.clocker.setLEDBlob(s)}).catch(s=>{y(this.options,"Errors")&&console.error("[OTTPlayer] Failed to fetch LED image from URL in setLED",t,s)});return}if(!this.clocker){if(e instanceof Blob)this.pendingLEDBlob=e;else if(e){if(this.pendingLEDBitmap)try{this.pendingLEDBitmap.close()}catch{}this.pendingLEDBitmap=e}return}e instanceof Blob?this.clocker.setLEDBlob(e):e&&this.clocker.setLEDImage(e)}async applyImageOverridesFromOptions(){try{const e=[];this.options.OVERRIDE_AD&&e.push(this.applySingleOverride(this.options.OVERRIDE_AD,"ad")),this.options.OVERRIDE_LED&&e.push(this.applySingleOverride(this.options.OVERRIDE_LED,"led")),await Promise.all(e)}catch(e){y(this.options,"Errors")&&console.error("[OTTPlayer] Failed to apply image overrides",e)}}async applySingleOverride(e,t){let s;if(typeof e=="string")try{const i=new URL(e,document.baseURI).toString();s=await(await fetch(i,{cache:"no-store"})).blob()}catch(i){y(this.options,"Errors")&&console.error(`[OTTPlayer] Failed to fetch override ${t} from URL`,e,i);return}else s=e;if(s){if(!this.clocker){t==="ad"?this.pendingAdBlob=s:this.pendingLEDBlob=s;return}t==="ad"?this.clocker.setAdBlob(s):this.clocker.setLEDBlob(s)}}flushPendingOverrides(){if(this.clocker){if(this.pendingAdBitmap){const e=this.pendingAdBitmap;this.pendingAdBitmap=void 0;const t=this.pendingAdClickUrl;this.pendingAdClickUrl=void 0,this.clocker.setAdImage(e,this.pendingAdPlaceholder,t),this.pendingAdPlaceholder=void 0}else if(this.pendingAdBlob){const e=this.pendingAdBlob;this.pendingAdBlob=void 0;const t=this.pendingAdClickUrl;this.pendingAdClickUrl=void 0,this.clocker.setAdBlob(e,this.pendingAdPlaceholder,t),this.pendingAdPlaceholder=void 0}if(this.pendingLEDBitmap){const e=this.pendingLEDBitmap;this.pendingLEDBitmap=void 0,this.clocker.setLEDImage(e)}else if(this.pendingLEDBlob){const e=this.pendingLEDBlob;this.pendingLEDBlob=void 0,this.clocker.setLEDBlob(e)}}}onTabHidden(){var e,t,s;y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Tab hidden - pausing all components"),this.fetchGameParamsTimeoutId&&(window.clearTimeout(this.fetchGameParamsTimeoutId),this.fetchGameParamsTimeoutId=void 0),(e=this.clocker)==null||e.pause(),(t=this.adapter)==null||t.pause(),(s=this.statusOverlay)==null||s.pause()}onTabVisible(){var e,t,s;y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Tab visible - resuming all components"),(e=this.clocker)==null||e.resume(),(t=this.adapter)==null||t.resume(),(s=this.statusOverlay)==null||s.resume(),this.fetchGameParams()}on(e,t){this.logger.addEventListener(e,t)}off(e,t){this.logger.removeEventListener(e,t)}destroy(){var t;document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.fetchGameParamsTimeoutId&&(window.clearTimeout(this.fetchGameParamsTimeoutId),this.fetchGameParamsTimeoutId=void 0),(t=this.clocker)==null||t.delete(),this.clocker=void 0,this.adapter&&(this.adapter.delete(),this.adapter=void 0),this.cloudFrontAuth&&(this.cloudFrontAuth.destroy(),this.cloudFrontAuth=void 0),this.statusOverlay&&(this.statusOverlay.delete(),this.statusOverlay=void 0),Z.deleteAll(this.pixelTickers),this.pixelTickers=[],this.logger.removeAllEventListeners();const e=window.BB.playerInstances.indexOf(this);e>=0&&window.BB.playerInstances.splice(e,1)}}return window.BB={OTTPlayer:rs,playerInstances:[],workerInstances:[]},rs});
|
|
99
|
+
`,s=this.createShader(this.gl.VERTEX_SHADER,r),i=this.createShader(this.gl.FRAGMENT_SHADER,n);this.program=this.createProgram(s,i),this.gl.useProgram(this.program),this.positionLoc=this.gl.getAttribLocation(this.program,"a_position"),this.texCoordLoc=this.gl.getAttribLocation(this.program,"a_texCoord"),this.resolutionLoc=this.gl.getUniformLocation(this.program,"u_resolution"),this.videoSizeLoc=this.gl.getUniformLocation(this.program,"u_videoSize"),this.textureLoc=this.gl.getUniformLocation(this.program,"u_image"),this.positionBuffer=this.gl.createBuffer(),this.texCoordBuffer=this.gl.createBuffer(),this.videoTexture=this.gl.createTexture(),this.fbo=this.gl.createFramebuffer(),this.outTex=this.gl.createTexture(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,this.OUT_WIDTH,0,0,this.OUT_HEIGHT,0,this.OUT_HEIGHT,this.OUT_WIDTH,0,this.OUT_WIDTH,this.OUT_HEIGHT]),this.gl.STATIC_DRAW),this.gl.enableVertexAttribArray(this.positionLoc),this.gl.vertexAttribPointer(this.positionLoc,2,this.gl.FLOAT,!1,0,0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texCoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.enableVertexAttribArray(this.texCoordLoc),this.gl.vertexAttribPointer(this.texCoordLoc,2,this.gl.FLOAT,!1,0,0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.outTex),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.OUT_WIDTH,this.OUT_HEIGHT,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this.outTex,0)}createShader(e,r){const n=this.gl.createShader(e);if(this.gl.shaderSource(n,r),this.gl.compileShader(n),!this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS)){const s=this.gl.getShaderInfoLog(n);throw this.gl.deleteShader(n),new Error("Shader compile failed: "+s)}return n}createProgram(e,r){const n=this.gl.createProgram();if(this.gl.attachShader(n,e),this.gl.attachShader(n,r),this.gl.linkProgram(n),!this.gl.getProgramParameter(n,this.gl.LINK_STATUS)){const s=this.gl.getProgramInfoLog(n);throw this.gl.deleteProgram(n),new Error("Program link failed: "+s)}return this.gl.detachShader(n,e),this.gl.detachShader(n,r),this.gl.deleteShader(e),this.gl.deleteShader(r),n}decode(e){const r=e.videoWidth|0,n=e.videoHeight|0;if(r===0||n===0)return null;this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.videoTexture),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.canvas.width=this.OUT_WIDTH,this.canvas.height=this.OUT_HEIGHT,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.OUT_WIDTH,this.OUT_HEIGHT),this.gl.useProgram(this.program),this.resolutionLoc&&this.gl.uniform2f(this.resolutionLoc,this.OUT_WIDTH,this.OUT_HEIGHT),this.videoSizeLoc&&this.gl.uniform2f(this.videoSizeLoc,r,n),this.textureLoc&&this.gl.uniform1i(this.textureLoc,0),this.gl.drawArrays(this.gl.TRIANGLES,0,6);const s=new Uint8Array(this.OUT_WIDTH*this.OUT_HEIGHT*4);this.gl.readPixels(0,0,this.OUT_WIDTH,this.OUT_HEIGHT,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s);const i=s[0],o=s[4],a=s[8],c=s[12],d=Math.floor(c/2),l=c%2===1?"_1":"",u=("0"+i).slice(-2),h=("0"+o).slice(-2),f=("0"+a).slice(-2),m=("0"+d).slice(-2);return`${u}_${h}_${f}_${m}${l}`}decodeFromImageBitmap(e){const r=e.width|0,n=e.height|0;if(r===0||n===0)return null;this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.videoTexture),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.canvas.width=this.OUT_WIDTH,this.canvas.height=this.OUT_HEIGHT,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.OUT_WIDTH,this.OUT_HEIGHT),this.gl.useProgram(this.program),this.resolutionLoc&&this.gl.uniform2f(this.resolutionLoc,this.OUT_WIDTH,this.OUT_HEIGHT),this.videoSizeLoc&&this.gl.uniform2f(this.videoSizeLoc,r,n),this.textureLoc&&this.gl.uniform1i(this.textureLoc,0),this.gl.drawArrays(this.gl.TRIANGLES,0,6);const s=new Uint8Array(this.OUT_WIDTH*this.OUT_HEIGHT*4);this.gl.readPixels(0,0,this.OUT_WIDTH,this.OUT_HEIGHT,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s);const i=s[0],o=s[4],a=s[8],c=s[12],d=Math.floor(c/2),l=c%2===1?"_1":"",u=("0"+i).slice(-2),h=("0"+o).slice(-2),f=("0"+a).slice(-2),m=("0"+d).slice(-2);return`${u}_${h}_${f}_${m}${l}`}dispose(){this.videoTexture&&this.gl.deleteTexture(this.videoTexture),this.outTex&&this.gl.deleteTexture(this.outTex),this.fbo&&this.gl.deleteFramebuffer(this.fbo),this.positionBuffer&&this.gl.deleteBuffer(this.positionBuffer),this.texCoordBuffer&&this.gl.deleteBuffer(this.texCoordBuffer),this.program&&this.gl.deleteProgram(this.program)}}const Z=class Z{constructor(e){var r;if(this.platformSupported=!0,this.firstFrameTimecodeSet=!1,this.firstFrameTimecode=[0,0,0,0,0],this.firstVideoFrameCallbackFired=!1,this.isMKAdPlaying=!1,this.loggerTimeoutStart=0,this.loggerTimeout=1e4,this.lastStatusUpdate=0,this.STATUS_UPDATE_INTERVAL=100,this.lastBenchmarkUpdate=0,this.BENCHMARK_UPDATE_INTERVAL=100,this.resumedAt=0,this.SKIP_PROCESSING_AFTER_RESUME_MS=1e3,this.afData={counter:0,lastTimestamp:0,previousTimestamp:0,lastMetadataNow:0,timeFromLastRVFC:0,animationFPS:0,playerTimeOffset:0,lastPlayerTimeFromSync:0,lastCalculatedPlayerTimeVideoFrame:0,lastCalculatedPlayerTimeFraction:0,previousCalculatedPlayerTimeFraction:2},this.vfcData={counter:0,lastTimestamp:0,previousTimestamp:0,timeFromLastRAF:0,videoFPS:0,lastFrameMetadata:null,lastFrameMetadataNow:0,storedMetadata:[],timePerformanceNowToExpectedDisplayTime:0,timeRVFCnowToExpectedDisplayTime:0,mediaTimeOffset:0,lastMediaTimeFromSync:0,lastCalculatedMediaTimeVideoFrame:0},this.siData={counter:0,lastTimestamp:0,lastOffset:0,timeFromLastRAF:0,timeFromLastRVFC:0,lastSeenRAFCount:0,lastSeenRVFCCount:0,isRAFSeen:!1,isRVFCSeen:!1,isVideoPaused:!0,workingFps:0,refreshRate:0,RVFCmissed:0,RVFCframeExpected:0,expectedRefreshRate:0,avgExpectedRefreshRate:0,newRefreshRateFrames:0,expectedFPS:0,newFPSFrames:0,RVFCpattern:[],isRVFCpatternDetected:!1,patternTracking:[],patternTrackingIndex:-1,patternNextValue:-1,possibilityTracking:[],previousPossibilityValue:-1,lastCallback:null,lastCalculatedFrame:0,lastRendererFrameSent:0,lastMessageSent:"",compensationMode:!1,compensationCounter:0,frameCorrection:0,determineFramesIntervals:[],determineAFIntervals:[],expectedDisplayTimeReminder:0,animationFramesToDisplayTime:0},this.tcTimeStamp=0,this.timecode_offset=0,this.burnedLastTcKey=-1,this.sampleBurnedFrame=async()=>{var n;if(!(!this.OTTPlayer||!this.video)&&!(this.video.videoWidth===0||this.video.videoHeight===0)&&this.gl2Decoder)try{let s=await createImageBitmap(this.video);const i=this.gl2Decoder.decodeFromImageBitmap(s);if(!i){try{s.close()}catch{}return}const o=this.parseTcKey(i);if(this.burnedLastTcKey!==-1&&o<this.burnedLastTcKey-Z.BACKWARD_JUMP_THRESHOLD&&(this.logger.info(`[Adapter] Backward timecode jump detected (${this.burnedLastTcKey} -> ${o}), resetting duplicate detection`),this.burnedLastTcKey=-1),o<=this.burnedLastTcKey){try{s.close()}catch{}return}this.burnedLastTcKey=o,this.metrics&&this.metrics.updateMetric("Last sent timecode",i),(n=this.OTTPlayer.clocker)==null||n.callRendererWorkerWithFrame(s,i),s=void 0}catch(s){this.logger.error("[Adapter] sampleBurnedFrame error: "+s)}},this.onAnimationFrame=n=>{if(this.video.paused||!this.OTTPlayer.clocker||!this.OTTPlayer.gameParams||!this.syncPoint){this.animationFrameLoopId=window.requestAnimationFrame(this.onAnimationFrame);return}this.afData.counter++,this.afData.previousTimestamp=this.afData.lastTimestamp,this.afData.lastTimestamp=performance.now(),this.afData.lastMetadataNow=n,this.afData.timeFromLastRVFC=this.afData.lastTimestamp-this.vfcData.lastTimestamp,this.afData.animationFPS=this.OTTPlayer.clocker.animationFPScalculator.getPerciseFPS(),this.siData.lastCallback=="RAF"&&this.siData.RVFCmissed++,this.siData.lastCallback="RAF";const s=(this.video.currentTime-this.syncPoint.playerTime)*(6e4/1001);this.afData.lastPlayerTimeFromSync=s;const i=Math.floor(s)+this.syncPoint.frame;this.afData.playerTimeOffset=L.calculateCurrentOffset(i,this.OTTPlayer.gameParams.offsets);let o=i-this.afData.playerTimeOffset;o<0&&(o+=5178816),o++,this.afData.lastCalculatedPlayerTimeVideoFrame=o,this.afData.previousCalculatedPlayerTimeFraction=this.afData.lastCalculatedPlayerTimeFraction,this.afData.lastCalculatedPlayerTimeFraction=s-Math.floor(s),this.metrics&&(this.metrics.updateMetric("RAF timestamp",n),this.metrics.updateMetric("AnimationFrame MediaTime",this.afData.lastCalculatedPlayerTimeVideoFrame)),this.animationFrameLoopId=window.requestAnimationFrame(this.onAnimationFrame),this.determineFrameUpdate("RAF")},this.onVideoFrame=(n,s)=>{if(this.firstVideoFrameCallbackFired||(this.firstVideoFrameCallbackFired=!0,this.logger.info("[Adapter] First video frame callback fired"),console.log("[Adapter] First video frame callback fired")),this.video.paused||!this.OTTPlayer.clocker||!this.OTTPlayer.gameParams||!this.syncPoint){this.videoFrameCallbackLoopId=this.video.requestVideoFrameCallback(this.onVideoFrame);return}this.vfcData.counter++,this.vfcData.previousTimestamp=this.vfcData.lastTimestamp,this.vfcData.lastTimestamp=performance.now(),this.vfcData.timeFromLastRAF=this.vfcData.lastTimestamp-this.afData.lastTimestamp,this.siData.RVFCmissed=0,this.vfcData.videoFPS=this.OTTPlayer.clocker.videoFPScalculator.getPerciseFPS(),this.siData.lastCallback="RVFC";const i=(s.mediaTime-this.syncPoint.playerTime)*(6e4/1001);this.vfcData.lastMediaTimeFromSync=i;const o=Math.floor(i+.1)+this.syncPoint.frame;this.vfcData.mediaTimeOffset=L.calculateCurrentOffset(o,this.OTTPlayer.gameParams.offsets);let a=o-this.vfcData.mediaTimeOffset;a<0&&(a+=5178816),a++,this.vfcData.lastCalculatedMediaTimeVideoFrame=a,this.vfcData.lastFrameMetadata=s,this.vfcData.storedMetadata.push(s),this.vfcData.storedMetadata.length>10&&this.vfcData.storedMetadata.shift(),this.vfcData.timePerformanceNowToExpectedDisplayTime=s.expectedDisplayTime-this.vfcData.lastTimestamp,this.vfcData.timeRVFCnowToExpectedDisplayTime=s.expectedDisplayTime-n,this.vfcData.lastFrameMetadataNow=n,this.metrics&&(this.metrics.updateMetric("RVFC now",n),this.metrics.updateMetric("RVFC metadata.expectedDisplayTime",s.expectedDisplayTime),this.metrics.updateMetric("RVFC metadata.height",s.height),this.metrics.updateMetric("RVFC metadata.mediaTime",s.mediaTime),this.metrics.updateMetric("RVFC metadata.presentationTime",s.presentationTime),this.metrics.updateMetric("RVFC metadata.presentedFrames",s.presentedFrames),this.metrics.updateMetric("RVFC metadata.processingDuration",s.processingDuration||0),this.metrics.updateMetric("RVFC metadata.width",s.width),this.metrics.updateMetric("VideoFrame MediaTime",this.vfcData.lastCalculatedMediaTimeVideoFrame)),this.videoFrameCallbackLoopId=this.video.requestVideoFrameCallback(this.onVideoFrame),this.determineFrameUpdate("RVFC")},this.determineFrameUpdate=n=>{var i,o,a,c;if(!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata)return;this.siData.counter===0&&this.logger.info("didStartAugmentation"),this.siData.counter++,this.siData.isVideoPaused=this.video.paused,this.siData.isRAFSeen=this.siData.lastSeenRAFCount==this.afData.counter,this.siData.isRVFCSeen=this.siData.lastSeenRVFCCount==this.vfcData.counter,this.siData.lastTimestamp=performance.now(),this.siData.timeFromLastRAF=this.siData.lastTimestamp-this.afData.lastTimestamp,this.siData.timeFromLastRVFC=this.siData.lastTimestamp-this.vfcData.lastTimestamp,this.siData.lastSeenRAFCount=this.afData.counter,this.siData.lastSeenRVFCCount=this.vfcData.counter,this.siData.workingFps=this.OTTPlayer.clocker.videoFPScalculator.getFPS(),this.siData.refreshRate=this.OTTPlayer.clocker.animationFPScalculator.getPerciseFPS();const s=this.siData.lastTimestamp;if(s-this.lastBenchmarkUpdate>this.BENCHMARK_UPDATE_INTERVAL&&(this.runBenchmarkTest(),this.lastBenchmarkUpdate=s),this.OTTPlayer.statusOverlay&&s-this.lastStatusUpdate>this.STATUS_UPDATE_INTERVAL&&(this.updateStatusOverlay(),this.lastStatusUpdate=s),!this.OTTPlayer.options.ADAPTER_RUN_IN_WORKER)this.platformSpecificFrameUpdate(n);else{const d={siData:this.siData,vfcData:this.vfcData,afData:this.afData,debugControls:(i=this.debugControls)==null?void 0:i.exportData(),zipBaseURL:this.OTTPlayer.options.zipBaseURL,adsBaseURL:this.OTTPlayer.options.adsBaseURL,bucketName:((o=this.OTTPlayer.gameParams)==null?void 0:o.bucketName)||"",offsets:((a=this.OTTPlayer.gameParams)==null?void 0:a.offsets)||[],customerId:((c=this.OTTPlayer.gameParams)==null?void 0:c.customerId)||""};this.OTTPlayer.clocker.callAdapterWorker(d)}},this.determineFrameUpdateAdapterDebug=n=>{n==="RVFC"&&(this.metrics&&this.metrics.updateMetric("Last sent frame",this.vfcData.lastCalculatedMediaTimeVideoFrame),this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame))},this.determineFrameUpdateChromeMac=n=>{if(this.resumedAt>0&&performance.now()-this.resumedAt<this.SKIP_PROCESSING_AFTER_RESUME_MS)return;const s=Math.round(1e3/this.vfcData.timeRVFCnowToExpectedDisplayTime);s>0&&s<500&&(this.expectedRefreshRateCalculator.addFrameDuration(this.vfcData.timeRVFCnowToExpectedDisplayTime/1e3),Math.abs(this.siData.expectedRefreshRate-s)>4?this.siData.newRefreshRateFrames++:(this.siData.expectedRefreshRate=s,this.siData.avgExpectedRefreshRate=this.expectedRefreshRateCalculator.getPerciseFPS(),this.siData.newRefreshRateFrames=0),this.siData.newRefreshRateFrames>10&&(this.siData.newRefreshRateFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedRefreshRate=s,this.siData.isRVFCpatternDetected=!1));const i=this.OTTPlayer.clocker.videoFPScalculator.getPerciseFPS();if(i>0&&i<500&&(Math.abs(this.siData.expectedFPS-i)>4?this.siData.newFPSFrames++:(this.siData.expectedFPS=i,this.siData.newFPSFrames=0),this.siData.newFPSFrames>10&&(this.siData.newFPSFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedFPS=i,this.siData.isRVFCpatternDetected=!1)),this.video.paused||!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata)return;const o=20,a=1e3;if(!this.siData.isRVFCSeen){const c=Math.round(this.vfcData.timeRVFCnowToExpectedDisplayTime/(1e3/this.afData.animationFPS));if(c<=0&&this.siData.patternTracking.length<=1-c){this.siData.patternTracking=[!0];for(let d=0;d<1-c;d++)this.siData.patternTracking.push(!1)}else c<=1&&(this.siData.patternTracking[this.siData.patternTracking.length-2+c]=!0)}if(this.siData.isRAFSeen||this.siData.patternTracking.push(!1),this.siData.patternTracking.length>a&&this.siData.patternTracking.shift(),!this.siData.isRVFCpatternDetected){const c=this.siData.patternTracking;for(let d=1;d*o<=c.length;d++){for(let l=0;l+d*o<=c.length;l++){let u=!0;for(let h=0;h<o-1;h++){const f=c.slice(l+h*d,l+(h+1)*d),m=c.slice(l+(h+1)*d,l+(h+2)*d);if(!f.every((A,p)=>A===m[p])){u=!1;break}}if(u){const h=c.slice(l,l+d),f=h.every(p=>!p),m=h.every(p=>p),A=this.afData.animationFPS-this.vfcData.videoFPS;if(f||m&&A>5)continue;this.siData.RVFCpattern=h,this.siData.isRVFCpatternDetected=!0;break}}if(this.siData.isRVFCpatternDetected)break}}if(this.siData.RVFCpattern.length>0){const c=this.siData.RVFCpattern,d=this.siData.patternTracking;let l=-1;for(let u=d.length-c.length;u>=0;u--){let h=!0;for(let f=0;f<c.length;f++)if(c[f]!==d[u+f]){h=!1;break}if(h){l=u;break}}if(l>=0){const u=(d.length-l)%c.length,h=c[u];this.siData.patternTrackingIndex=u,this.siData.patternNextValue=h?1:0}if(d.length>=c.length*5){d.slice(d.length-c.length*5);let u=0,h=0;for(let f=0;f+c.length<=d.length;f++)d.slice(f,f+c.length).every((A,p)=>A===c[p])?(u++,h=Math.max(h,u),f+=c.length-1):u=0;h<6&&(this.siData.isRVFCpatternDetected=!1)}Math.abs(this.siData.avgExpectedRefreshRate-this.siData.refreshRate)>3&&(this.siData.isRVFCpatternDetected=!1)}if(!this.siData.isRAFSeen&&this.siData.isRVFCpatternDetected){let c=0,d=1,l=5;if(this.debugControls){const u=parseInt(this.debugControls.getValue("Pattern offset"),10);isNaN(u)||(c=u);const h=parseInt(this.debugControls.getValue("Frame Correction"),10);isNaN(h)||(d=h);const f=parseInt(this.debugControls.getValue("Timeout time"),10);isNaN(f)||(l=f)}this.siData.lastOffset!=this.vfcData.mediaTimeOffset&&(this.siData.lastOffset=this.vfcData.mediaTimeOffset,this.logger.info("didChangeOffset",{offset:this.vfcData.mediaTimeOffset}),this.logger.setAttributes({last_offset:this.vfcData.mediaTimeOffset})),this.siData.RVFCpattern[(this.siData.patternTrackingIndex+this.siData.RVFCpattern.length-1+c)%this.siData.RVFCpattern.length]?setTimeout(()=>this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame+d),l):this.callRenderer(this.siData.lastRendererFrameSent)}},this.determineFrameUpdateChromeWin=n=>{if(this.resumedAt>0&&performance.now()-this.resumedAt<this.SKIP_PROCESSING_AFTER_RESUME_MS)return;const s=Math.round(1e3/this.vfcData.timeRVFCnowToExpectedDisplayTime);s>0&&s<500&&(this.expectedRefreshRateCalculator.addFrameDuration(this.vfcData.timeRVFCnowToExpectedDisplayTime/1e3),Math.abs(this.siData.expectedRefreshRate-s)>3?this.siData.newRefreshRateFrames++:(this.siData.expectedRefreshRate=s,this.siData.avgExpectedRefreshRate=this.expectedRefreshRateCalculator.getPerciseFPS()),this.siData.newRefreshRateFrames>10&&(this.siData.newRefreshRateFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedRefreshRate=s,this.siData.isRVFCpatternDetected=!1));const i=this.OTTPlayer.clocker.videoFPScalculator.getPerciseFPS();if(i>0&&i<500&&(Math.abs(this.siData.expectedFPS-i)>4?this.siData.newFPSFrames++:(this.siData.expectedFPS=i,this.siData.newFPSFrames=0),this.siData.newFPSFrames>10&&(this.siData.newFPSFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedFPS=i,this.siData.isRVFCpatternDetected=!1)),this.video.paused||!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata)return;const o=20,a=1e3;if(!this.siData.isRVFCSeen){const c=Math.round(this.vfcData.timeRVFCnowToExpectedDisplayTime/(1e3/this.afData.animationFPS));if(c<=0&&this.siData.patternTracking.length<=1-c){this.siData.patternTracking=[!0];for(let d=0;d<1-c;d++)this.siData.patternTracking.push(!1)}else c<=1&&(this.siData.patternTracking[this.siData.patternTracking.length-2+c]=!0)}if(this.siData.isRAFSeen||this.siData.patternTracking.push(!1),this.siData.patternTracking.length>a&&this.siData.patternTracking.shift(),!this.siData.isRVFCpatternDetected){const c=this.siData.patternTracking;for(let d=1;d*o<=c.length;d++){for(let l=0;l+d*o<=c.length;l++){let u=!0;for(let h=0;h<o-1;h++){const f=c.slice(l+h*d,l+(h+1)*d),m=c.slice(l+(h+1)*d,l+(h+2)*d);if(!f.every((A,p)=>A===m[p])){u=!1;break}}if(u){const h=c.slice(l,l+d),f=h.every(p=>!p),m=h.every(p=>p),A=this.afData.animationFPS-this.vfcData.videoFPS;if(f||m&&A>5)continue;this.siData.RVFCpattern=h,this.siData.isRVFCpatternDetected=!0;break}}if(this.siData.isRVFCpatternDetected)break}}if(this.siData.RVFCpattern.length>0){const c=this.siData.RVFCpattern,d=this.siData.patternTracking;let l=-1;for(let u=d.length-c.length;u>=0;u--){let h=!0;for(let f=0;f<c.length;f++)if(c[f]!==d[u+f]){h=!1;break}if(h){l=u;break}}if(l>=0){const u=(d.length-l)%c.length,h=c[u];this.siData.patternTrackingIndex=u,this.siData.patternNextValue=h?1:0}if(d.length>=c.length*5){d.slice(d.length-c.length*5);let u=0,h=0;for(let f=0;f+c.length<=d.length;f++)d.slice(f,f+c.length).every((A,p)=>A===c[p])?(u++,h=Math.max(h,u),f+=c.length-1):u=0;h<6&&(this.siData.isRVFCpatternDetected=!1)}Math.abs(this.siData.avgExpectedRefreshRate-this.siData.refreshRate)>3&&(this.siData.isRVFCpatternDetected=!1)}if(!this.siData.isRAFSeen&&this.siData.isRVFCpatternDetected){let c=0,d=2,l=!1;if(this.debugControls){const f=parseInt(this.debugControls.getValue("Pattern offset"),10);isNaN(f)||(c=f);const m=parseInt(this.debugControls.getValue("Frame Correction"),10);isNaN(m)||(d=m),parseInt(this.debugControls.getValue("Timeout time"),10),this.debugControls.getValue("Video Captur Card Mode")==="true"&&(l=!0)}this.siData.lastOffset!=this.vfcData.mediaTimeOffset&&(this.siData.lastOffset=this.vfcData.mediaTimeOffset,this.logger.info("didChangeOffset",{offset:this.vfcData.mediaTimeOffset}),this.logger.setAttributes({last_offset:this.vfcData.mediaTimeOffset})),l&&(c+=1);const u=(this.siData.patternTrackingIndex+this.siData.RVFCpattern.length-1+c)%this.siData.RVFCpattern.length,h=(u+this.siData.RVFCpattern.length-1)%this.siData.RVFCpattern.length;if(this.siData.RVFCpattern[u]){let f=0;l&&this.siData.lastRendererFrameSent==this.vfcData.lastCalculatedMediaTimeVideoFrame&&this.siData.RVFCpattern[h]&&(f=2),this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame+f+d)}}},this.determineFrameUpdateSifariMac=n=>{if(this.resumedAt>0&&performance.now()-this.resumedAt<this.SKIP_PROCESSING_AFTER_RESUME_MS||(this.siData.expectedRefreshRate&&this.siData.expectedFPS&&(this.expectedRefreshRateCalculator.addFrameDuration(1/this.siData.refreshRate),this.siData.avgExpectedRefreshRate=this.expectedRefreshRateCalculator.getPerciseFPS(),Math.abs(this.siData.expectedRefreshRate-this.siData.avgExpectedRefreshRate)>3&&this.siData.newRefreshRateFrames++,Math.abs(this.siData.expectedFPS-this.siData.workingFps)>3&&this.siData.newFPSFrames++,(this.siData.newRefreshRateFrames>10||this.siData.newFPSFrames>10)&&(this.siData.newRefreshRateFrames=0,this.siData.expectedRefreshRate=0,this.siData.newFPSFrames=0,this.siData.expectedFPS=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.isRVFCpatternDetected=!1)),this.video.paused||!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata))return;const s=Math.abs(this.siData.refreshRate-this.siData.workingFps)<2?8:20,i=1e3,o=[this.afData.lastTimestamp,this.vfcData.lastTimestamp,this.afData.previousTimestamp,this.vfcData.previousTimestamp].sort((p,_)=>_-p),a=2,c=o[0],d=o[1],l=c-d,u=1e3/this.afData.animationFPS,h=Math.round(u/4+.1),f=this.vfcData.timeRVFCnowToExpectedDisplayTime;if(!this.siData.isRVFCSeen){const p=(-f-h)/u,_=Math.ceil(p),S=(Math.round(p)-p)*u,w=Math.abs(S)<=a,C=S<=0?_-1:_+1,I=Math.abs(-f-h)<=a;if(w&&!I){const b=Math.min(_,C),x=Math.max(_,C);this.siData.possibilityTracking[this.siData.possibilityTracking.length-b]=2,this.siData.possibilityTracking[this.siData.possibilityTracking.length-x]=1}else w&&I&&(this.siData.possibilityTracking[this.siData.possibilityTracking.length-1]=1,this.siData.possibilityTracking.push(2),this.siData.possibilityTracking.push(3));if(-f<h)this.siData.expectedDisplayTimeReminder=-f;else if(l>u&&-f-(l-u)<=h)this.siData.expectedDisplayTimeReminder=-f-(l-u);else{let b=-f-l,x=0,le=this.siData.determineFramesIntervals.length-1;for(let V=this.siData.determineAFIntervals.length-1;V>=0&&(le--,!(this.siData.determineAFIntervals[V]>u&&b-(this.siData.determineAFIntervals[V]-u)<=h||b<=h||this.siData.determineFramesIntervals[le].includes("vf")&&this.siData.workingFps<40));V--)b-=this.siData.determineAFIntervals[V],x+=1;if(this.siData.patternTracking.length<x+1){this.siData.patternTracking=[!0];for(let V=0;V<x;V++)this.siData.patternTracking.push(!1)}else this.siData.patternTracking[this.siData.patternTracking.length-1-x]=!0;this.siData.animationFramesToDisplayTime=x}}if(this.siData.isRAFSeen||(this.siData.expectedDisplayTimeReminder?(this.siData.expectedDisplayTimeReminder-h,this.siData.expectedDisplayTimeReminder+l<=h?(this.siData.patternTracking.push(!0),this.siData.animationFramesToDisplayTime=0):(this.siData.patternTracking[this.siData.patternTracking.length-1]=!0,this.siData.patternTracking.push(!1),this.siData.animationFramesToDisplayTime=1),this.siData.expectedDisplayTimeReminder=0):(this.siData.patternTracking.push(!1),this.siData.animationFramesToDisplayTime+=1),this.siData.possibilityTracking[this.siData.possibilityTracking.length-1]==3?this.siData.possibilityTracking.pop():this.siData.possibilityTracking.push(0)),this.siData.patternTracking.length>i&&this.siData.patternTracking.shift(),this.siData.possibilityTracking.length>i&&this.siData.possibilityTracking.shift(),!this.siData.isRVFCpatternDetected){const p=this.siData.patternTracking;for(let _=1;_*s<=p.length;_++){for(let S=0;S+_*s<=p.length;S++){let w=!0;for(let E=0;E<s-1;E++){const C=p.slice(S+E*_,S+(E+1)*_),I=p.slice(S+(E+1)*_,S+(E+2)*_);if(!C.every((b,x)=>b===I[x])){w=!1;break}}if(w){const E=p.slice(S,S+_),C=E.every(x=>!x),I=E.every(x=>x),b=this.afData.animationFPS-this.vfcData.videoFPS;if(C||I&&b>5)continue;this.siData.RVFCpattern=E,this.siData.isRVFCpatternDetected=!0;break}}if(this.siData.isRVFCpatternDetected){this.siData.expectedRefreshRate=this.siData.refreshRate,this.siData.expectedFPS=this.siData.workingFps;break}}}if(this.siData.RVFCpattern.length>0){const p=this.siData.RVFCpattern,_=this.siData.patternTracking;let S=-1;for(let w=_.length-p.length*5;w>=0;w--){let E=!0;for(let C=0;C<p.length*5;C++)if(p[C%p.length]!==_[w+C]){E=!1;break}if(E){S=w;break}}if(S>=0){const w=(_.length-S)%p.length,E=p[w];this.siData.patternTrackingIndex=w,this.siData.patternNextValue=E?1:0}if(_.length>=p.length*5){_.slice(_.length-p.length*5);let w=0,E=0;for(let C=0;C+p.length<=_.length;C++)_.slice(C,C+p.length).every((b,x)=>b===p[x])?(w++,E=Math.max(E,w),C+=p.length-1):w=0;E<6&&(this.siData.isRVFCpatternDetected=!1)}}const m=[];for(let p=1;p<=3;p++)m.push(this.siData.possibilityTracking[this.siData.possibilityTracking.length-this.siData.RVFCpattern.length*p]);const A=Math.max(...m);if(!this.siData.isRAFSeen&&this.siData.isRVFCpatternDetected){let p=0,_=0;if(this.debugControls){const w=parseInt(this.debugControls.getValue("Pattern offset"),10);isNaN(w)||(p=w);const E=parseInt(this.debugControls.getValue("Frame Correction"),10);isNaN(E)||(_=E),parseInt(this.debugControls.getValue("Timeout time"),10)}this.siData.lastOffset!=this.vfcData.mediaTimeOffset&&(this.siData.lastOffset=this.vfcData.mediaTimeOffset,this.logger.info("didChangeOffset",{offset:this.vfcData.mediaTimeOffset}),this.logger.setAttributes({last_offset:this.vfcData.mediaTimeOffset}));const S=(this.siData.patternTrackingIndex+this.siData.RVFCpattern.length+p)%this.siData.RVFCpattern.length;if(this.siData.RVFCpattern[S]||A){const w=Math.ceil(this.siData.animationFramesToDisplayTime/this.siData.RVFCpattern.length)+1,E=this.siData.RVFCpattern.map(Ie=>Ie?1:0).join("").repeat(w),C=(this.siData.RVFCpattern.length-this.siData.patternTrackingIndex)%this.siData.RVFCpattern.length,I=E.slice(0,C==0?-this.siData.RVFCpattern.length:-C);let b=0;const x=this.siData.possibilityTracking.length-1-this.siData.animationFramesToDisplayTime;I[I.length-1-this.siData.animationFramesToDisplayTime]=="0"&&this.siData.possibilityTracking[x]==1&&(b=-1);const le=this.siData.animationFramesToDisplayTime+b;let it=(le<=0?"":I.slice(-le)).split("").filter(Ie=>Ie==="1").length*Math.round(60/this.siData.workingFps);this.siData.workingFps<40&&(it+=1),this.siData.compensationMode&&!(A==2||this.siData.previousPossibilityValue==2)&&(this.siData.compensationCounter=1,this.siData.compensationMode=!1),this.siData.compensationCounter==1?this.siData.possibilityTracking.slice(-5).every(Ie=>Ie===0)&&(this.siData.compensationCounter-=.1):this.siData.compensationCounter>0&&this.siData.compensationCounter<1&&(this.siData.compensationCounter=Math.max(this.siData.compensationCounter-.1,0)),A==1?this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame+it+_-1,this.siData.compensationCounter):A==2&&this.siData.previousPossibilityValue==1?this.callRenderer(this.siData.lastRendererFrameSent+1,this.siData.compensationCounter):this.siData.RVFCpattern[S]&&((A==2||this.siData.previousPossibilityValue==2)&&Math.abs(this.afData.animationFPS-this.siData.workingFps)<5&&this.siData.lastRendererFrameSent==this.vfcData.lastCalculatedMediaTimeVideoFrame+it+_?(this.callRenderer(this.siData.lastRendererFrameSent+1,this.siData.compensationCounter),this.siData.compensationMode=!0):this.callRenderer(this.vfcData.lastCalculatedMediaTimeVideoFrame+it+_,this.siData.compensationCounter)),this.siData.previousPossibilityValue=A}else this.callRenderer(this.siData.lastRendererFrameSent)}},this.determineFrameUpdateFirefoxMac=n=>{if(this.resumedAt>0&&performance.now()-this.resumedAt<this.SKIP_PROCESSING_AFTER_RESUME_MS)return;const s=Math.round(1e3/this.vfcData.timeRVFCnowToExpectedDisplayTime);if(s>0&&s<500&&(this.expectedRefreshRateCalculator.addFrameDuration(this.vfcData.timeRVFCnowToExpectedDisplayTime/1e3),Math.abs(this.siData.expectedRefreshRate-s)>3?this.siData.newRefreshRateFrames++:(this.siData.expectedRefreshRate=s,this.siData.avgExpectedRefreshRate=this.expectedRefreshRateCalculator.getPerciseFPS()),this.siData.newRefreshRateFrames>10&&(this.siData.newRefreshRateFrames=0,this.siData.RVFCpattern=[],this.siData.patternTracking=[],this.siData.expectedRefreshRate=s,this.siData.isRVFCpatternDetected=!1)),this.video.paused||!this.OTTPlayer.clocker||!this.vfcData.lastFrameMetadata)return;const i=5,o=1e3;if(!this.siData.isRVFCSeen){const a=Math.round(this.vfcData.timeRVFCnowToExpectedDisplayTime/(1e3/this.afData.animationFPS));if(a<=0&&this.siData.patternTracking.length<=1-a){this.siData.patternTracking=[!0];for(let c=0;c<1-a;c++)this.siData.patternTracking.push(!1)}else a<=1&&(this.siData.patternTracking[this.siData.patternTracking.length-2+a]=!0)}if(this.siData.isRAFSeen||this.siData.patternTracking.push(!1),this.siData.patternTracking.length>o&&this.siData.patternTracking.shift(),!this.siData.isRVFCpatternDetected){const a=this.siData.patternTracking;for(let c=1;c*i<=a.length;c++){for(let d=0;d+c*i<=a.length;d++){let l=!0;for(let u=0;u<i-1;u++){const h=a.slice(d+u*c,d+(u+1)*c),f=a.slice(d+(u+1)*c,d+(u+2)*c);if(!h.every((m,A)=>m===f[A])){l=!1;break}}if(l){const u=a.slice(d,d+c),h=u.every(A=>!A),f=u.every(A=>A),m=this.afData.animationFPS-this.vfcData.videoFPS;if(h||f&&m>5)continue;this.siData.RVFCpattern=u,this.siData.isRVFCpatternDetected=!0;break}}if(this.siData.isRVFCpatternDetected)break}}if(this.siData.RVFCpattern.length>0){const a=this.siData.RVFCpattern,c=this.siData.patternTracking;let d=-1;for(let l=c.length-a.length;l>=0;l--){let u=!0;for(let h=0;h<a.length;h++)if(a[h]!==c[l+h]){u=!1;break}if(u){d=l;break}}if(d>=0){const l=(c.length-d)%a.length,u=a[l];this.siData.patternTrackingIndex=l,this.siData.patternNextValue=u?1:0}if(c.length>=a.length*5){c.slice(c.length-a.length*5);let l=0,u=0;for(let h=0;h+a.length<=c.length;h++)c.slice(h,h+a.length).every((m,A)=>m===a[A])?(l++,u=Math.max(u,l),h+=a.length-1):l=0;u<5&&(this.siData.isRVFCpatternDetected=!1)}Math.abs(this.siData.avgExpectedRefreshRate-this.siData.refreshRate)>3&&(this.siData.isRVFCpatternDetected=!1)}if(!this.siData.isRAFSeen&&this.siData.isRVFCpatternDetected){let a=0,c=1;if(this.debugControls){const d=parseInt(this.debugControls.getValue("Pattern offset"),10);isNaN(d)||(a=d);const l=parseInt(this.debugControls.getValue("Frame Correction"),10);isNaN(l)||(c=l),parseInt(this.debugControls.getValue("Timeout time"),10)}if(this.siData.lastOffset!=this.vfcData.mediaTimeOffset&&(this.siData.lastOffset=this.vfcData.mediaTimeOffset,this.logger.info("didChangeOffset",{offset:this.vfcData.mediaTimeOffset}),this.logger.setAttributes({last_offset:this.vfcData.mediaTimeOffset})),this.siData.RVFCpattern[(this.siData.patternTrackingIndex+this.siData.RVFCpattern.length-1+a)%this.siData.RVFCpattern.length]){let d=this.vfcData.lastCalculatedMediaTimeVideoFrame+c;d==this.siData.lastRendererFrameSent&&(d+=2),this.callRenderer(d)}else this.callRenderer(this.siData.lastRendererFrameSent)}},this.callRenderer=(n,s)=>{if(!this.OTTPlayer.clocker||!this.OTTPlayer)return;this.siData.lastRendererFrameSent=n,this.metrics&&this.metrics.updateMetric("Last sent frame",n),this.OTTPlayer.clocker.videoFPScalculator.getFPS();const i=L.fromFrames(n,6e4/1001);this.renderAugmentation(i,s)},this.playbackTimeDelta=0,this.wallClockTimeDelta=0,this.dateTimeDelta=0,this.renderAugmentation=(n,s)=>{if(!this.OTTPlayer||!this.OTTPlayer.clocker)throw new Error("OTTPlayer is not initialized");const i=L.toStr(n);this.siData.lastMessageSent=i,this.options&&y(this.options,"Adapter")&&console.log(`Rendering augmentation for timecode: ${i} , ${n}`),this.metrics&&this.metrics.updateMetric("Last sent timecode",i),this.OTTPlayer.clocker.callRendererWorker(i,s)},this.onVideoSeeked=()=>{this.firstFrameTimecode=[0,0,0,0,0],this.firstFrameTimecodeSet=!1,this.burnedLastTcKey=-1,this.isMKAdPlaying&&(this.options&&y(this.options,"Adapter")&&console.log("[Adapter] Resetting MK ad state after seek/scrub"),this.isMKAdPlaying=!1)},this.clearAugmentation=n=>{if(!this.OTTPlayer||!this.OTTPlayer.clocker)throw new Error("OTTPlayer is not initialized");const s=n?L.toStr(n):void 0;this.options&&y(this.options,"Adapter")&&console.log("Clearing augmentation"),this.OTTPlayer.clocker.callRendererWorker(s,0,!0)},this.logger=e.logger,this.OTTPlayer=e,this.options=e.options,this.benchmark=new mn(e.options.BENCHMARK_DURATION_SECONDS),this.options&&y(this.options,"Adapter")&&console.log("Adapter is initialized",this.OTTPlayer),this.video=e.video,this.debug=this.options.debug?this.options.debug.on:!1,this.expectedRefreshRateCalculator=new ot(20),(r=this.options.debug)!=null&&r.adapterDebugMode)this.platformSpecificFrameUpdate=this.determineFrameUpdateAdapterDebug;else if(W.isChromeMac())this.platformSpecificFrameUpdate=this.determineFrameUpdateChromeMac;else if(W.isChromeWin())this.platformSpecificFrameUpdate=this.determineFrameUpdateChromeWin;else if(W.isSafariMac())this.platformSpecificFrameUpdate=this.determineFrameUpdateSifariMac;else if(W.isFirefoxMac())this.platformSpecificFrameUpdate=this.determineFrameUpdateFirefoxMac;else{if(this.platformSpecificFrameUpdate=n=>{},!this.options.BURNED_TIMECODES_MODE){this.logger.criticalError("Unsupported platform",{platform:this.options.platform,browserName:this.options.browserName}),console.error("Unsupported platform: "+this.options.platform+" "+this.options.browserName),this.platformSupported=!1;return}this.platformSupported=!0}if(this.debug){this.metrics=new hn;const n=this.metrics.createContainer(),s=this.metrics.createContainer(),i=this.metrics.createContainer();this.metrics.createMetric("RAF timestamp",n),this.metrics.createMetric("AnimationFrame MediaTime",n),this.metrics.createMetric("RVFC now",s),this.metrics.createMetric("RVFC metadata.expectedDisplayTime",s),this.metrics.createMetric("RVFC metadata.height",s),this.metrics.createMetric("RVFC metadata.mediaTime",s),this.metrics.createMetric("RVFC metadata.presentationTime",s),this.metrics.createMetric("RVFC metadata.presentedFrames",s),this.metrics.createMetric("RVFC metadata.processingDuration",s),this.metrics.createMetric("RVFC metadata.width",s),this.metrics.createMetric("VideoFrame MediaTime",s),this.metrics.createMetric("Last sent frame",i),this.metrics.createMetric("Last sent timecode",i)}this.platformSupported&&(this.OTTPlayer.video.readyState>=3?this.setupAdapter():this.OTTPlayer.video.addEventListener("canplay",()=>this.setupAdapter(),{once:!0}))}isVideoFpsSupported(e){return e>Z.MIN_SUPPORTED_FPS&&e<=Z.MAX_SUPPORTED_FPS}setupAdapter(){const e=this.video;if(this.options.BURNED_TIMECODES_MODE){this.startBurnedPipeline();return}if(this.debug){const r=typeof wmcsdk<"u"?wmcsdk:wmcPlayer;console.log(r);const n=r.getAvailableVideoQualities(),s={};n.forEach(i=>{s[i.label]=i.id})}this.animationFrameLoopId=window.requestAnimationFrame(this.onAnimationFrame),this.videoFrameCallbackLoopId=e.requestVideoFrameCallback(this.onVideoFrame)}startBurnedPipeline(){this.gl2Decoder=new gn,this.burnedIntervalId=window.setInterval(this.sampleBurnedFrame,33)}stopBurnedPipeline(){this.burnedIntervalId&&(window.clearInterval(this.burnedIntervalId),this.burnedIntervalId=void 0),this.gl2Decoder&&(this.gl2Decoder.dispose(),this.gl2Decoder=void 0),this.burnedLastTcKey=-1}parseTcKey(e){const r=e.split("_");if(r.length<4)return-1;const n=parseInt(r[0],10)||0,s=parseInt(r[1],10)||0,i=parseInt(r[2],10)||0,o=parseInt(r[3],10)||0,a=r.length>=5&&r[4]==="1"?1:0;return((n*3600+s*60+i)*60+o)*2+a}runBenchmarkTest(){var s,i,o,a;const e=((s=this.OTTPlayer.clocker)==null?void 0:s.videoFPScalculator.getPerciseFPS())||0,r=this.isVideoFpsSupported(e),n=this.benchmark.test({gameParams:!!this.OTTPlayer.gameParams,browserSupported:this.platformSupported,patternDetected:this.siData.isRVFCpatternDetected,fpsSupported:r,noMKAdsPlaying:!this.isMKAdPlaying,syncPointSet:!!this.syncPoint});(i=this.options.debug)!=null&&i.adapterDebugMode&&this.benchmark.forcePassed(),n.shouldClear&&!((o=this.options.debug)!=null&&o.adapterDebugMode)&&(this.options&&y(this.options,"Adapter")&&console.log("[Benchmark] Failed - clearing augmentation. Reasons:",(a=n.failedConditions)==null?void 0:a.join(", ")),this.clearAugmentation())}updateStatusOverlay(){var i,o;const e=this.OTTPlayer.statusOverlay;e.updateMetric("support","browser",this.platformSupported,`${this.options.browserName} on ${this.options.platform}`),e.updateMetric("support","pattern",this.siData.isRVFCpatternDetected,this.siData.isRVFCpatternDetected?this.siData.RVFCpattern.map(a=>a?"1":"0").join("").slice(0,20):"Detecting...");const r=((i=this.OTTPlayer.clocker)==null?void 0:i.videoFPScalculator.getPerciseFPS())||0,n=this.isVideoFpsSupported(r);e.updateMetric("support","fps",n,r>0?`${r.toFixed(2)} fps`:"Detecting..."),e.updateMetric("support","game_params",!!this.OTTPlayer.gameParams),e.updateMetric("support","mk_ads",!this.isMKAdPlaying,this.isMKAdPlaying?"Ad in progress":"No ads"),this.syncPoint?e.updateMetric("timecode","sync_point",!0,this.syncPoint.stringTime):e.updateMetric("timecode","sync_point",!1,"Not set");const s=this.benchmark.getStatus();e.updateMetric("benchmark","status",s.state,s.state==="TESTING"?`Stability test: ${s.remainingSeconds}s`:s.state==="FAILED"?`Failed: ${(o=s.failedConditions)==null?void 0:o.join(", ")}`:"Stable")}onNewSegmentForMetadata(e){if(console.log("onNewSegmentForMetadata: ",e),!this.firstFrameTimecodeSet){const a=performance.now();a-this.loggerTimeoutStart>this.loggerTimeout&&(this.loggerTimeoutStart=a,this.logger.error("[Adapter] First frame timecode of the recieved segment not set")),console.error("[Adapter] First frame timecode of the recieved segment not set");return}const r=pn(this.firstFrameTimecode,6e4/1001);if(!e.mimeType.includes("video"))return;const n=fn(this.firstFrameTimecode,!0,!0);this.options&&y(this.options,"Adapter")&&console.log("New segment ("+e.url+"): "+n+" ("+r+") playing at "+e.playbackTime);const s=e.playbackTime;s-this.playbackTimeDelta,this.playbackTimeDelta=s;const i=e.wallClockTime/1e3;if(i-this.wallClockTimeDelta,this.wallClockTimeDelta=i,e.dateTime instanceof Date){const a=e.dateTime.getTime()/1e3;a-this.dateTimeDelta,this.dateTimeDelta=a}const o={frame:r,playerTime:s,stringTime:n,lastUpdate:performance.now()};this.syncPoint=o,console.log("[SyncPoint] Set from segment — playbackTime:",s,"video.currentTime:",this.video.currentTime,"frame:",r,"stringTime:",n),this.options&&y(this.options,"Adapter")&&console.log("url: "+e.url)}onNewMetadata(e){if(console.log(`onSegmentPlaybackEvent (Metadata):
|
|
100
|
+
`,e),e&&e.metadata&&e.metadata.id==0||W.isSafariMac()){console.log("onNewMetadata: ",e);let r=!1;if(e.metadata.messageData)r=this.processTimedMetadata(e.metadata.messageData,e.metadata.presentationTime);else if(e.metadata.frames&&e.metadata.frames.length&&e.metadata.frames[0].key&&e.metadata.frames[0].key.toLowerCase()==="priv"){const n=e.metadata.frames.filter(s=>s.info&&s.info.toLowerCase().includes("ntc"));if(n.length){const s=`${n[n.length-1].info}\0${String.fromCharCode(...n[n.length-1].data)}`;r=this.processTimedMetadata(s,e.metadata.presentationTime)}}if(r&&(e.metadata.id==0||W.isSafariMac()&&this.timecode_offset==0)){e.metadata.presentationTime*1e3,this.logger.setAttributes({id3_metadata:this.tcTimeStamp-this.timecode_offset});const n=new Date(this.tcTimeStamp-this.timecode_offset);let s=Math.round(n.getUTCMilliseconds()*30*2/1001)/2;const i=s%1;let o=1;i==.5&&(s=Math.floor(s),o=2),this.firstFrameTimecode=[n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),Math.floor(s),o==1?0:1],this.logger.setAttributes({segment_first_frame_timecode:this.firstFrameTimecode}),this.firstFrameTimecodeSet||this.logger.info(`[Adapter] Segment first frame timecode set: ${this.firstFrameTimecode}`),this.firstFrameTimecodeSet=!0,console.log("First frame timecode reciesved at: ",new Date().toISOString()),console.log("First frame timecode: ",this.firstFrameTimecode),console.log("video.currentTime: ",this.video.currentTime),console.log("video.currentTime to UTC: ",new Date(this.video.currentTime*1e3).toISOString()),console.log("metadata.presentationTime: ",e.metadata.presentationTime),console.log("syncPoint: ",this.syncPoint)}}}onAdEvent(e){this.options&&y(this.options,"Adapter")&&console.log(`MK Ad event: ${e}`),this.isMKAdPlaying=e==="start"}parseId3Tag(e,r){console.log("Parsing ID3 tag: ",r);const n=e.exec(r);return n&&n[1]?n[1]:null}processTimedMetadata(e,r){if(e&&e.includes("www.mediakind.com/NTC")){let n=!1;const s=/tc__[\s\S]{4}(\d+)/,i=this.parseId3Tag(s,e);i?(this.tcTimeStamp=new Date(parseInt(i)).getTime(),console.log(`NewTcTimeStamp: ${this.tcTimeStamp}`),n=!0):console.log("tcTimeStamp not found.");const o=/offs[\s\S]{4}(\d+)/,a=this.parseId3Tag(o,e);return a?(this.timecode_offset=parseInt(a)/90,console.log(`New Extracted offset: ${this.timecode_offset}`),n=!0):console.log("offset not found."),n}return!1}pause(){this.animationFrameLoopId&&(cancelAnimationFrame(this.animationFrameLoopId),this.animationFrameLoopId=void 0),this.videoFrameCallbackLoopId&&(this.video.cancelVideoFrameCallback(this.videoFrameCallbackLoopId),this.videoFrameCallbackLoopId=void 0),this.burnedIntervalId&&(clearInterval(this.burnedIntervalId),this.burnedIntervalId=void 0)}resume(){this.resumedAt=performance.now(),this.options&&y(this.options,"Adapter")&&console.log("[Adapter] Resumed - skipping expensive processing for",this.SKIP_PROCESSING_AFTER_RESUME_MS,"ms"),this.siData.patternTracking=[],this.siData.possibilityTracking=[],this.siData.determineFramesIntervals=[],this.siData.determineAFIntervals=[],this.siData.isRVFCpatternDetected=!1,this.siData.RVFCpattern=[],this.siData.expectedRefreshRate=0,this.siData.expectedFPS=0,this.siData.newRefreshRateFrames=0,this.siData.newFPSFrames=0,this.animationFrameLoopId||(this.animationFrameLoopId=window.requestAnimationFrame(this.onAnimationFrame)),this.videoFrameCallbackLoopId||(this.videoFrameCallbackLoopId=this.video.requestVideoFrameCallback(this.onVideoFrame)),this.options.BURNED_TIMECODES_MODE&&!this.burnedIntervalId&&(this.burnedIntervalId=window.setInterval(this.sampleBurnedFrame,33))}delete(){this.options.BURNED_TIMECODES_MODE&&this.stopBurnedPipeline(),this.animationFrameLoopId&&cancelAnimationFrame(this.animationFrameLoopId),this.videoFrameCallbackLoopId&&this.video.cancelVideoFrameCallback(this.videoFrameCallbackLoopId),this.intervalLoopId&&clearInterval(this.intervalLoopId),this.metrics&&this.metrics.delete(),this.debugControls&&this.debugControls.delete()}};Z.MIN_SUPPORTED_FPS=20,Z.MAX_SUPPORTED_FPS=40,Z.BACKWARD_JUMP_THRESHOLD=600;let lt=Z;class K{constructor(e,r){this.size=1,this.positionElement=()=>{let s=0,i=0;this.corner=="left-top"?(this.element.style.top=`${s}px`,this.element.style.left=`${i}px`):this.corner=="right-top"?(this.element.style.top=`${s}px`,this.element.style.left=`${i+this.video.offsetWidth-this.size}px`):this.corner=="right-bottom"?(this.element.style.top=`${s+this.video.offsetHeight-this.size}px`,this.element.style.left=`${i+this.video.offsetWidth-this.size}px`):this.corner=="left-bottom"&&(this.element.style.top=`${s+this.video.offsetHeight-this.size}px`,this.element.style.left=`${i}px`)},this.video=r,this.container=r.parentElement,this.corner=e;const n=document.createElement("div");n.style.position="absolute",n.style.width=`${this.size}px`,n.style.height=`${this.size}px`,n.style.transition="background-color 0s",n.style.zIndex="100000",this.element=n,this.container.appendChild(n),this.positionElement()}getRandomColor(){const n=Math.floor(Math.random()*11)+0;return`rgb(${n},${n},${n})`}update(){this.element.style.backgroundColor=this.getRandomColor(),this.positionElement()}delete(){this.container.removeChild(this.element)}static createInAllCorners(e){return[new K("left-top",e),new K("right-top",e),new K("right-bottom",e),new K("left-bottom",e)]}static updateAll(e){e.forEach(r=>r.update())}static deleteAll(e){e.forEach(r=>r.delete())}}const R={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},B=console,J={};Object.keys(R).forEach(t=>{J[t]=B[t]});const be="Datadog Browser SDK:",D={debug:J.debug.bind(B,be),log:J.log.bind(B,be),info:J.info.bind(B,be),warn:J.warn.bind(B,be),error:J.error.bind(B,be)},dt="https://docs.datadoghq.com",qt=`${dt}/real_user_monitoring/browser/troubleshooting`,Pe="More details:";function Zt(t,e){return(...r)=>{try{return t(...r)}catch(n){D.error(e,n)}}}function Fe(t){return t!==0&&Math.random()*100<=t}function An(t){return yn(t)&&t>=0&&t<=100}function yn(t){return typeof t=="number"}const ve=1e3,$=60*ve,Kt=60*$,bn=365*(24*Kt);function _e(){return new Date().getTime()}function H(){return _e()}function Oe(){return performance.now()}function Q(){return{relative:Oe(),timeStamp:H()}}function vn(){return{relative:0,timeStamp:Jt()}}function _n(t,e){return e-t}function En(t,e){return t+e}function Tn(t){return t-Jt()}let ut;function Jt(){return ut===void 0&&(ut=performance.timing.navigationStart),ut}const M=1024,$t=1024*M,Sn=/[^\u0000-\u007F]/;function ht(t){return Sn.test(t)?window.TextEncoder!==void 0?new TextEncoder().encode(t).length:new Blob([t]).size:t.length}function wn(t){return{...t}}function er(t,e){return Object.keys(t).some(r=>t[r]===e)}function Ee(t){return Object.keys(t).length===0}function Y(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let t=_dd_temp_;return delete Object.prototype._dd_temp_,typeof t!="object"&&(typeof self=="object"?t=self:typeof window=="object"?t=window:t={}),t}function ue(t,e){const r=Y();let n;return r.Zone&&typeof r.Zone.__symbol__=="function"&&(n=t[r.Zone.__symbol__(e)]),n||(n=t[e]),n}let Be,tr=!1;function Cn(t){Be=t}function xn(t){tr=t}function Rn(t,e,r){const n=r.value;r.value=function(...s){return(Be?T(n):n).apply(this,s)}}function T(t){return function(){return Te(t,this,arguments)}}function Te(t,e,r){try{return t.apply(e,r)}catch(n){Dn(n)}}function Dn(t){if(ft(t),Be)try{Be(t)}catch(e){ft(e)}}function ft(...t){tr&&D.error("[MONITOR]",...t)}function Se(t,e){return ue(Y(),"setTimeout")(T(t),e)}function rr(t){ue(Y(),"clearTimeout")(t)}function pt(t,e){return ue(Y(),"setInterval")(T(t),e)}function nr(t){ue(Y(),"clearInterval")(t)}class k{constructor(e){this.onFirstSubscribe=e,this.observers=[]}subscribe(e){return this.observers.push(e),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(r=>e!==r),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(e){this.observers.forEach(r=>r(e))}}function sr(...t){return new k(e=>{const r=t.map(n=>n.subscribe(s=>e.notify(s)));return()=>r.forEach(n=>n.unsubscribe())})}function ir(t,e,r){let n=!1,s,i;return{throttled:(...o)=>{if(n){s=o;return}t(...o),n=!0,i=Se(()=>{s&&t(...s),n=!1,s=void 0},e)},cancel:()=>{rr(i),n=!1,s=void 0}}}function j(){}function X(t){return t?(parseInt(t,10)^Math.random()*16>>parseInt(t,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,X)}const Me=/([\w-]+)\s*=\s*([^;]+)/g;function kn(t,e){for(Me.lastIndex=0;;){const r=Me.exec(t);if(r){if(r[1]===e)return r[2]}else break}}function Un(t){const e=new Map;for(Me.lastIndex=0;;){const r=Me.exec(t);if(r)e.set(r[1],r[2]);else break}return e}function In(t,e,r=""){const n=t.charCodeAt(e-1),i=n>=55296&&n<=56319?e+1:e;return t.length<=i?t:`${t.slice(0,i)}${r}`}function Ln(){return Pn()===0}let Ne;function Pn(){return Ne??(Ne=Fn())}function Fn(t=window){var e;const r=t.navigator.userAgent;return t.chrome||/HeadlessChrome/.test(r)?0:((e=t.navigator.vendor)===null||e===void 0?void 0:e.indexOf("Apple"))===0||/safari/i.test(r)&&!/chrome|android/i.test(r)?1:2}function we(t,e,r=0,n){const s=new Date;s.setTime(s.getTime()+r);const i=`expires=${s.toUTCString()}`,o=n&&n.crossSite?"none":"strict",a=n&&n.domain?`;domain=${n.domain}`:"",c=n&&n.secure?";secure":"",d=n&&n.partitioned?";partitioned":"";document.cookie=`${t}=${e};${i};path=/;samesite=${o}${a}${c}${d}`}function mt(t){return kn(document.cookie,t)}let gt;function ee(t){return gt||(gt=Un(document.cookie)),gt.get(t)}function or(t,e){we(t,"",0,e)}function On(t){if(document.cookie===void 0||document.cookie===null)return!1;try{const e=`dd_cookie_test_${X()}`,r="test";we(e,r,$,t);const n=mt(e)===r;return or(e,t),n}catch(e){return D.error(e),!1}}let At;function Bn(){if(At===void 0){const t=`dd_site_test_${X()}`,e="test",r=window.location.hostname.split(".");let n=r.pop();for(;r.length&&!mt(t);)n=`${r.pop()}.${n}`,we(t,e,ve,{domain:n});or(t,{domain:n}),At=n}return At}const he="_dd_s";function Ge(t){return Object.values(t)}function Mn(t){return Object.entries(t)}const yt=4*Kt,ar=15*$,Nn=bn,Ce={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},cr=/^([a-zA-Z]+)=([a-z0-9-]+)$/,bt="&";function Gn(t){return!!t&&(t.indexOf(bt)!==-1||cr.test(t))}const zn="1";function te(t,e){const r={isExpired:zn};return e.trackAnonymousUser&&(t!=null&&t.anonymousId?r.anonymousId=t==null?void 0:t.anonymousId:r.anonymousId=X()),r}function ze(t){return Ee(t)}function lr(t){return!ze(t)}function Ve(t){return t.isExpired!==void 0||!Vn(t)}function Vn(t){return(t.created===void 0||_e()-Number(t.created)<yt)&&(t.expire===void 0||_e()<Number(t.expire))}function dr(t){t.expire=String(_e()+ar)}function vt(t){return Mn(t).map(([e,r])=>e==="anonymousId"?`aid=${r}`:`${e}=${r}`).join(bt)}function ur(t){const e={};return Gn(t)&&t.split(bt).forEach(r=>{const n=cr.exec(r);if(n!==null){const[,s,i]=n;s==="aid"?e.anonymousId=i:e[s]=i}}),e}const Wn="_dd",Hn="_dd_r",Qn="_dd_l",Yn="rum",jn="logs";function Xn(t){if(!ee(he)){const r=ee(Wn),n=ee(Hn),s=ee(Qn),i={};r&&(i.id=r),s&&/^[01]$/.test(s)&&(i[jn]=s),n&&/^[012]$/.test(n)&&(i[Yn]=n),lr(i)&&(dr(i),t.persistSession(i))}}function hr(t){const e=$n(t);return On(e)?{type:Ce.COOKIE,cookieOptions:e}:void 0}function qn(t,e){const r={isLockEnabled:Ln(),persistSession:Zn(e),retrieveSession:Jn,expireSession:n=>Kn(e,n,t)};return Xn(r),r}function Zn(t){return e=>{we(he,vt(e),ar,t)}}function Kn(t,e,r){const n=te(e,r);we(he,vt(n),r.trackAnonymousUser?Nn:yt,t)}function Jn(){const t=mt(he);return ur(t)}function $n(t){const e={};return e.secure=!!t.useSecureSessionCookie||!!t.usePartitionedCrossSiteSessionCookie,e.crossSite=!!t.usePartitionedCrossSiteSessionCookie,e.partitioned=!!t.usePartitionedCrossSiteSessionCookie,t.trackSessionAcrossSubdomains&&(e.domain=Bn()),e}const es="_dd_test_";function fr(){try{const t=X(),e=`${es}${t}`;localStorage.setItem(e,t);const r=localStorage.getItem(e);return localStorage.removeItem(e),t===r?{type:Ce.LOCAL_STORAGE}:void 0}catch{return}}function ts(t){return{isLockEnabled:!1,persistSession:pr,retrieveSession:rs,expireSession:e=>ns(e,t)}}function pr(t){localStorage.setItem(he,vt(t))}function rs(){const t=localStorage.getItem(he);return ur(t)}function ns(t,e){pr(te(t,e))}const ss=10,is=100,mr=[];let We;function re(t,e,r=0){var n;const{isLockEnabled:s,persistSession:i,expireSession:o}=e,a=h=>i({...h,lock:d}),c=()=>{const h=e.retrieveSession(),f=h.lock;return h.lock&&delete h.lock,{session:h,lock:f}};if(We||(We=t),t!==We){mr.push(t);return}if(s&&r>=is){gr(e);return}let d,l=c();if(s){if(l.lock){He(t,e,r);return}if(d=X(),a(l.session),l=c(),l.lock!==d){He(t,e,r);return}}let u=t.process(l.session);if(s&&(l=c(),l.lock!==d)){He(t,e,r);return}if(u&&(Ve(u)?o(u):(dr(u),s?a(u):i(u))),s&&!(u&&Ve(u))){if(l=c(),l.lock!==d){He(t,e,r);return}i(l.session),u=l.session}(n=t.after)===null||n===void 0||n.call(t,u||l.session),gr(e)}function He(t,e,r){Se(()=>{re(t,e,r+1)},ss)}function gr(t){We=void 0;const e=mr.shift();e&&re(e,t)}const Ar=ve;function os(t){switch(t.sessionPersistence){case Ce.COOKIE:return hr(t);case Ce.LOCAL_STORAGE:return fr();case void 0:{let e=hr(t);return!e&&t.allowFallbackToLocalStorage&&(e=fr()),e}default:D.error(`Invalid session persistence '${String(t.sessionPersistence)}'`)}}function as(t,e,r,n){const s=new k,i=new k,o=new k,a=t.type===Ce.COOKIE?qn(e,t.cookieOptions):ts(e),{expireSession:c}=a,d=pt(m,Ar);let l;p();const{throttled:u,cancel:h}=ir(()=>{re({process:b=>{if(ze(b))return;const x=A(b);return _(x),x},after:b=>{lr(b)&&!S()&&C(b),l=b}},a)},Ar);function f(){re({process:b=>S()?A(b):void 0},a)}function m(){re({process:b=>Ve(b)?te(b,e):void 0,after:A},a)}function A(b){return Ve(b)&&(b=te(b,e)),S()&&(w(b)?E():(o.notify({previousState:l,newState:b}),l=b)),b}function p(){re({process:b=>{if(ze(b))return te(b,e)},after:b=>{l=b}},a)}function _(b){if(ze(b))return!1;const{trackingType:x,isTracked:le}=n(b[r]);b[r]=x,delete b.isExpired,le&&!b.id&&(b.id=X(),b.created=String(_e()))}function S(){return l[r]!==void 0}function w(b){return l.id!==b.id||l[r]!==b[r]}function E(){l=te(l,e),i.notify()}function C(b){l=b,s.notify()}function I(b){re({process:x=>({...x,...b}),after:A},a)}return{expandOrRenewSession:u,expandSession:f,getSession:()=>l,renewObservable:s,expireObservable:i,sessionStateUpdateObservable:o,restartSession:p,expire:()=>{h(),c(l),A(te(l,e))},stop:()=>{nr(d)},updateSessionState:I}}const _t={GRANTED:"granted",NOT_GRANTED:"not-granted"};function cs(t){const e=new k;return{tryToInit(r){t||(t=r)},update(r){t=r,e.notify()},isGranted(){return t===_t.GRANTED},observable:e}}function ne(t,e,r){if(typeof t!="object"||t===null)return JSON.stringify(t);const n=fe(Object.prototype),s=fe(Array.prototype),i=fe(Object.getPrototypeOf(t)),o=fe(t);try{return JSON.stringify(t,e,r)}catch{return"<error: unable to serialize object>"}finally{n(),s(),i(),o()}}function fe(t){const e=t,r=e.toJSON;return r?(delete e.toJSON,()=>{e.toJSON=r}):j}function Et(t){return ls(t,location.href).href}function ls(t,e){const r=ds();if(r)try{return e!==void 0?new r(t,e):new r(t)}catch(i){throw new Error(`Failed to construct URL: ${String(i)} ${ne({url:t,base:e})}`)}if(e===void 0&&!/:/.test(t))throw new Error(`Invalid URL: '${t}'`);let n=document;const s=n.createElement("a");if(e!==void 0){n=document.implementation.createHTMLDocument("");const i=n.createElement("base");i.href=e,n.head.appendChild(i),n.body.appendChild(s)}return s.href=t,s}const yr=URL;let Qe;function ds(){if(Qe===void 0)try{Qe=new yr("http://test/path").href==="http://test/path"}catch{Qe=!1}return Qe?yr:void 0}const us="datad0g.com",hs="dd0g-gov.com",pe="datadoghq.com",fs="ddog-gov.com",ps="pci.browser-intake-datadoghq.com",ms=["ddsource","ddtags"];function xe(t,e,r){const n=gs(t,e);return{build(s,i){const o=ys(t,e,r,s,i);return n(o)},urlPrefix:n(""),trackType:e}}function gs(t,e){const r=`/api/v2/${e}`,n=t.proxy;if(typeof n=="string"){const i=Et(n);return o=>`${i}?ddforward=${encodeURIComponent(`${r}?${o}`)}`}if(typeof n=="function")return i=>n({path:r,parameters:i});const s=As(e,t);return i=>`https://${s}${r}?${i}`}function As(t,e){const{site:r=pe,internalAnalyticsSubdomain:n}=e;if(t==="logs"&&e.usePciIntake&&r===pe)return ps;if(n&&r===pe)return`${n}.${pe}`;if(r===hs)return`http-intake.logs.${r}`;const s=r.split("."),i=s.pop();return`browser-intake-${s.join("-")}.${i}`}function ys({clientToken:t,internalAnalyticsSubdomain:e},r,n,s,{retry:i,encoding:o}){const a=["sdk_version:6.5.0",`api:${s}`].concat(n);i&&a.push(`retry_count:${i.count}`,`retry_after:${i.lastFailureStatus}`);const c=["ddsource=browser",`ddtags=${encodeURIComponent(a.join(","))}`,`dd-api-key=${t}`,`dd-evp-origin-version=${encodeURIComponent("6.5.0")}`,"dd-evp-origin=browser",`dd-request-id=${X()}`];return o&&c.push(`dd-evp-encoding=${o}`),r==="rum"&&c.push(`batch_time=${H()}`),e&&c.reverse(),c.join("&")}const bs=200;function vs(t){const{env:e,service:r,version:n,datacenter:s}=t,i=[];return e&&i.push(Ye("env",e)),r&&i.push(Ye("service",r)),n&&i.push(Ye("version",n)),s&&i.push(Ye("datacenter",s)),i}function Ye(t,e){const r=bs-t.length-1;(e.length>r||_s(e))&&D.warn(`${t} value doesn't meet tag requirements and will be sanitized. ${Pe} ${dt}/getting_started/tagging/#defining-tags`);const n=e.replace(/,/g,"_");return`${t}:${n}`}function _s(t){return Es()?new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]","u").test(t):!1}function Es(){try{return new RegExp("[\\p{Ll}]","u"),!0}catch{return!1}}function Ts(t){const e=t.site||pe,r=vs(t),n=Ss(t,r);return{replica:ws(t,r),site:e,...n}}function Ss(t,e){return{logsEndpointBuilder:xe(t,"logs",e),rumEndpointBuilder:xe(t,"rum",e),sessionReplayEndpointBuilder:xe(t,"replay",e)}}function ws(t,e){if(!t.replica)return;const r={...t,site:pe,clientToken:t.replica.clientToken},n={logsEndpointBuilder:xe(r,"logs",e),rumEndpointBuilder:xe(r,"rum",e)};return{applicationId:t.replica.applicationId,...n}}function Cs(t){return ms.every(e=>t.includes(e))}function Tt(t,e){return t!=null&&typeof t!="string"?(D.error(`${e} must be defined as a string`),!1):!0}function xs(t){return t&&typeof t=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(t)?(D.error(`Site should be a valid Datadog site. ${Pe} ${dt}/getting_started/site/.`),!1):!0}function je(t,e){return t!==void 0&&!An(t)?(D.error(`${e} Sample Rate should be a number between 0 and 100`),!1):!0}function Rs(t){var e,r,n,s,i,o;if(!t||!t.clientToken){D.error("Client Token is not configured, we will not send any data.");return}if(!(!xs(t.site)||!je(t.sessionSampleRate,"Session")||!je(t.telemetrySampleRate,"Telemetry")||!je(t.telemetryConfigurationSampleRate,"Telemetry Configuration")||!je(t.telemetryUsageSampleRate,"Telemetry Usage")||!Tt(t.version,"Version")||!Tt(t.env,"Env")||!Tt(t.service,"Service"))){if(t.trackingConsent!==void 0&&!er(_t,t.trackingConsent)){D.error('Tracking Consent should be either "granted" or "not-granted"');return}return{beforeSend:t.beforeSend&&Zt(t.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:os(t),sessionSampleRate:(e=t.sessionSampleRate)!==null&&e!==void 0?e:100,telemetrySampleRate:(r=t.telemetrySampleRate)!==null&&r!==void 0?r:20,telemetryConfigurationSampleRate:(n=t.telemetryConfigurationSampleRate)!==null&&n!==void 0?n:5,telemetryUsageSampleRate:(s=t.telemetryUsageSampleRate)!==null&&s!==void 0?s:5,service:t.service||void 0,silentMultipleInit:!!t.silentMultipleInit,allowUntrustedEvents:!!t.allowUntrustedEvents,trackingConsent:(i=t.trackingConsent)!==null&&i!==void 0?i:_t.GRANTED,trackAnonymousUser:(o=t.trackAnonymousUser)!==null&&o!==void 0?o:!0,storeContextsAcrossPages:!!t.storeContextsAcrossPages,batchBytesLimit:16*M,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*ve,batchMessagesLimit:50,messageBytesLimit:256*M,...Ts(t)}}}function Ds(t){return{session_sample_rate:t.sessionSampleRate,telemetry_sample_rate:t.telemetrySampleRate,telemetry_configuration_sample_rate:t.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:t.telemetryUsageSampleRate,use_before_send:!!t.beforeSend,use_partitioned_cross_site_session_cookie:t.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:t.useSecureSessionCookie,use_proxy:!!t.proxy,silent_multiple_init:t.silentMultipleInit,track_session_across_subdomains:t.trackSessionAcrossSubdomains,track_anonymous_user:t.trackAnonymousUser,session_persistence:t.sessionPersistence,allow_fallback_to_local_storage:!!t.allowFallbackToLocalStorage,store_contexts_across_pages:!!t.storeContextsAcrossPages,allow_untrusted_events:!!t.allowUntrustedEvents,tracking_consent:t.trackingConsent}}var St;(function(t){t.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",t.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry"})(St||(St={}));const br=new Set;function ks(t){Array.isArray(t)&&Us(t.filter(e=>er(St,e)))}function Us(t){t.forEach(e=>{br.add(e)})}function Is(){return br}const Re="?";function N(t){const e=[];let r=wt(t,"stack");const n=String(t);return r&&r.startsWith(n)&&(r=r.slice(n.length)),r&&r.split(`
|
|
101
|
+
`).forEach(s=>{const i=Fs(s)||Bs(s)||Ns(s)||Vs(s);i&&(!i.func&&i.line&&(i.func=Re),e.push(i))}),{message:wt(t,"message"),name:wt(t,"name"),stack:e}}const vr="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",me="(?::(\\d+))",Ls=new RegExp(`^\\s*at (.*?) ?\\(${vr}${me}?${me}?\\)?\\s*$`,"i"),Ps=new RegExp(`\\((\\S*)${me}${me}\\)`);function Fs(t){const e=Ls.exec(t);if(!e)return;const r=e[2]&&e[2].indexOf("native")===0,n=e[2]&&e[2].indexOf("eval")===0,s=Ps.exec(e[2]);return n&&s&&(e[2]=s[1],e[3]=s[2],e[4]=s[3]),{args:r?[e[2]]:[],column:e[4]?+e[4]:void 0,func:e[1]||Re,line:e[3]?+e[3]:void 0,url:r?void 0:e[2]}}const Os=new RegExp(`^\\s*at ?${vr}${me}?${me}??\\s*$`,"i");function Bs(t){const e=Os.exec(t);if(e)return{args:[],column:e[3]?+e[3]:void 0,func:Re,line:e[2]?+e[2]:void 0,url:e[1]}}const Ms=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function Ns(t){const e=Ms.exec(t);if(e)return{args:[],column:e[4]?+e[4]:void 0,func:e[1]||Re,line:+e[3],url:e[2]}}const Gs=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,zs=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Vs(t){const e=Gs.exec(t);if(!e)return;const r=e[3]&&e[3].indexOf(" > eval")>-1,n=zs.exec(e[3]);return r&&n&&(e[3]=n[1],e[4]=n[2],e[5]=void 0),{args:e[2]?e[2].split(","):[],column:e[5]?+e[5]:void 0,func:e[1]||Re,line:e[4]?+e[4]:void 0,url:e[3]}}function wt(t,e){if(typeof t!="object"||!t||!(e in t))return;const r=t[e];return typeof r=="string"?r:void 0}function Ws(t,e,r,n){const s=[{url:e,column:n,line:r}],{name:i,message:o}=Qs(t);return{name:i,message:o,stack:s}}const Hs=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function Qs(t){let e,r;return{}.toString.call(t)==="[object String]"&&([,e,r]=Hs.exec(t)),{name:e,message:r}}function Xe(t){const r=new Error(t);r.name="HandlingStack";let n;return Te(()=>{const s=N(r);s.stack=s.stack.slice(2),n=se(s)}),n}function se(t){let e=_r(t);return t.stack.forEach(r=>{const n=r.func==="?"?"<anonymous>":r.func,s=r.args&&r.args.length>0?`(${r.args.join(", ")})`:"",i=r.line?`:${r.line}`:"",o=r.line&&r.column?`:${r.column}`:"";e+=`
|
|
102
|
+
at ${n}${s} @ ${r.url}${i}${o}`}),e}function _r(t){return`${t.name||"Error"}: ${t.message}`}function ie(t,e,r,{computeHandlingStack:n}={}){let s=t[e];if(typeof s!="function")if(e in t&&e.startsWith("on"))s=j;else return{stop:j};let i=!1;const o=function(){if(i)return s.apply(this,arguments);const a=Array.from(arguments);let c;Te(r,null,[{target:this,parameters:a,onPostCall:l=>{c=l},handlingStack:n?Xe("instrumented method"):void 0}]);const d=s.apply(this,a);return c&&Te(c,null,[d]),d};return t[e]=o,{stop:()=>{i=!0,t[e]===o&&(t[e]=s)}}}const Ys=220*M,js="$",Xs=3;function G(t,e=Ys){const r=fe(Object.prototype),n=fe(Array.prototype),s=[],i=new WeakMap,o=Ct(t,js,void 0,s,i),a=JSON.stringify(o);let c=a?a.length:0;if(c>e){Rt(e,"discarded",t);return}for(;s.length>0&&c<e;){const d=s.shift();let l=0;if(Array.isArray(d.source))for(let u=0;u<d.source.length;u++){const h=Ct(d.source[u],d.path,u,s,i);if(h!==void 0?c+=JSON.stringify(h).length:c+=4,c+=l,l=1,c>e){Rt(e,"truncated",t);break}d.target[u]=h}else for(const u in d.source)if(Object.prototype.hasOwnProperty.call(d.source,u)){const h=Ct(d.source[u],d.path,u,s,i);if(h!==void 0&&(c+=JSON.stringify(h).length+l+u.length+Xs,l=1),c>e){Rt(e,"truncated",t);break}d.target[u]=h}}return r(),n(),o}function Ct(t,e,r,n,s){const i=Ks(t);if(!i||typeof i!="object")return qs(i);const o=xt(i);if(o!=="[Object]"&&o!=="[Array]"&&o!=="[Error]")return o;const a=t;if(s.has(a))return`[Reference seen at ${s.get(a)}]`;const c=r!==void 0?`${e}.${r}`:e,d=Array.isArray(i)?[]:{};return s.set(a,c),n.push({source:i,target:d,path:c}),d}function qs(t){return typeof t=="bigint"?`[BigInt] ${t.toString()}`:typeof t=="function"?`[Function] ${t.name||"unknown"}`:typeof t=="symbol"?`[Symbol] ${t.description||t.toString()}`:t}function xt(t){try{if(t instanceof Event)return Zs(t);if(t instanceof RegExp)return`[RegExp] ${t.toString()}`;const r=Object.prototype.toString.call(t).match(/\[object (.*)\]/);if(r&&r[1])return`[${r[1]}]`}catch{}return"[Unserializable]"}function Zs(t){return{type:t.type,isTrusted:t.isTrusted,currentTarget:t.currentTarget?xt(t.currentTarget):null,target:t.target?xt(t.target):null}}function Ks(t){const e=t;if(e&&typeof e.toJSON=="function")try{return e.toJSON()}catch{}return t}function Rt(t,e,r){D.warn(`The data provided has been ${e} as it is over the limit of ${t} characters:`,r)}const Er="No stack, consider using an instance of Error";function Tr({stackTrace:t,originalError:e,handlingStack:r,componentStack:n,startClocks:s,nonErrorPrefix:i,source:o,handling:a}){const c=q(e),d=Js(t,c,i,e),l=$s(c,t)?se(t):Er,u=c?Cr(e,o):void 0,h=t?t.name:void 0,f=Sr(e),m=wr(e);return{startClocks:s,source:o,handling:a,handlingStack:r,componentStack:n,originalError:e,type:h,message:d,stack:l,causes:u,fingerprint:f,context:m}}function Js(t,e,r,n){return t!=null&&t.message&&(t!=null&&t.name)?t.message:e?"Empty message":`${r} ${ne(G(n))}`}function $s(t,e){return e===void 0?!1:t?!0:e.stack.length>0&&(e.stack.length>1||e.stack[0].url!==void 0)}function Sr(t){return q(t)&&"dd_fingerprint"in t?String(t.dd_fingerprint):void 0}function wr(t){if(t!==null&&typeof t=="object"&&"dd_context"in t)return t.dd_context}function ei(t){var e;return(e=/@ (.+)/.exec(t))===null||e===void 0?void 0:e[1]}function q(t){return t instanceof Error||Object.prototype.toString.call(t)==="[object Error]"}function Cr(t,e){let r=t;const n=[];for(;q(r==null?void 0:r.cause)&&n.length<10;){const s=N(r.cause);n.push({message:r.cause.message,source:e,type:s==null?void 0:s.name,stack:se(s)}),r=r.cause}return n.length?n:void 0}const P={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function ti(t){const e=(s,i)=>{const o=Tr({stackTrace:s,originalError:i,startClocks:Q(),nonErrorPrefix:"Uncaught",source:P.SOURCE,handling:"unhandled"});t.notify(o)},{stop:r}=ri(e),{stop:n}=ni(e);return{stop:()=>{r(),n()}}}function ri(t){return ie(window,"onerror",({parameters:[e,r,n,s,i]})=>{let o;q(i)?o=N(i):o=Ws(e,r,n,s),t(o,i??e)})}function ni(t){return ie(window,"onunhandledrejection",({parameters:[e]})=>{const r=e.reason||"Empty reason",n=N(r);t(n,r)})}function si(t){const e={version:"6.5.0",onReady(r){r()},...t};return Object.defineProperty(e,"_setDebug",{get(){return xn},enumerable:!1}),e}function ii(t,e,r){const n=t[e];n&&!n.q&&n.version&&D.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),t[e]=r,n&&n.q&&n.q.forEach(s=>Zt(s,"onReady callback threw an error:")())}function xr(t,e){e.silentMultipleInit||D.error(`${t} is already initialized.`)}function oe(t,e,r,n,s){return Dt(t,e,[r],n,s)}function Dt(t,e,r,n,{once:s,capture:i,passive:o}={}){const a=T(h=>{!h.isTrusted&&!h.__ddIsTrusted&&!t.allowUntrustedEvents||(s&&u(),n(h))}),c=o?{capture:i,passive:o}:i,d=window.EventTarget&&e instanceof EventTarget?window.EventTarget.prototype:e,l=ue(d,"addEventListener");r.forEach(h=>l.call(e,h,a,c));function u(){const h=ue(d,"removeEventListener");r.forEach(f=>h.call(e,f,a,c))}return{stop:u}}const qe={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function oi(t,e){const r=[];e.includes(qe.cspViolation)&&r.push(ci(t));const n=e.filter(s=>s!==qe.cspViolation);return n.length&&r.push(ai(n)),sr(...r)}function ai(t){return new k(e=>{if(!window.ReportingObserver)return;const r=T((s,i)=>s.forEach(o=>e.notify(li(o)))),n=new window.ReportingObserver(r,{types:t,buffered:!0});return n.observe(),()=>{n.disconnect()}})}function ci(t){return new k(e=>{const{stop:r}=oe(t,document,"securitypolicyviolation",n=>{e.notify(di(n))});return r})}function li(t){const{type:e,body:r}=t;return Rr({type:r.id,message:`${e}: ${r.message}`,originalError:t,stack:Dr(r.id,r.message,r.sourceFile,r.lineNumber,r.columnNumber)})}function di(t){const e=`'${t.blockedURI}' blocked by '${t.effectiveDirective}' directive`;return Rr({type:t.effectiveDirective,message:`${qe.cspViolation}: ${e}`,originalError:t,csp:{disposition:t.disposition},stack:Dr(t.effectiveDirective,t.originalPolicy?`${e} of the policy "${In(t.originalPolicy,100,"...")}"`:"no policy",t.sourceFile,t.lineNumber,t.columnNumber)})}function Rr(t){return{startClocks:Q(),source:P.REPORT,handling:"unhandled",...t}}function Dr(t,e,r,n,s){return r?se({name:t,message:e,stack:[{func:"?",url:r,line:n??void 0,column:s??void 0}]}):void 0}function kr(t,e){const r=window.__ddBrowserSdkExtensionCallback;r&&r({type:t,payload:e})}function Ur(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function Ze(t,e,r=ui()){if(e===void 0)return t;if(typeof e!="object"||e===null)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const s=e.flags||[e.global?"g":"",e.ignoreCase?"i":"",e.multiline?"m":"",e.sticky?"y":"",e.unicode?"u":""].join("");return new RegExp(e.source,s)}if(r.hasAlreadyBeenSeen(e))return;if(Array.isArray(e)){const s=Array.isArray(t)?t:[];for(let i=0;i<e.length;++i)s[i]=Ze(s[i],e[i],r);return s}const n=Ur(t)==="object"?t:{};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ze(n[s],e[s],r));return n}function Ir(t){return Ze(void 0,t)}function ge(...t){let e;for(const r of t)r!=null&&(e=Ze(e,r));return e}function ui(){if(typeof WeakSet<"u"){const e=new WeakSet;return{hasAlreadyBeenSeen(r){const n=e.has(r);return n||e.add(r),n}}}const t=[];return{hasAlreadyBeenSeen(e){const r=t.indexOf(e)>=0;return r||t.push(e),r}}}function hi(){var t;const e=window.navigator;return{status:e.onLine?"connected":"not_connected",interfaces:e.connection&&e.connection.type?[e.connection.type]:void 0,effective_type:(t=e.connection)===null||t===void 0?void 0:t.effectiveType}}function fi(t){const e=new Set;return t.forEach(r=>e.add(r)),Array.from(e)}function Lr(t,e){const r=t.indexOf(e);r>=0&&t.splice(r,1)}const pi=500;function Pr(){const t=[];return{add:s=>{t.push(s)>pi&&t.splice(0,1)},remove:s=>{Lr(t,s)},drain:s=>{t.forEach(i=>i(s)),t.length=0}}}const ae={log:"log",configuration:"configuration",usage:"usage"},mi=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],gi=[fs];let Fr=Pr(),Ae=t=>{Fr.add(()=>Ae(t))};function Ai(t,e){let r;const n=new k,s=new Set,i=!gi.includes(e.site)&&Fe(e.telemetrySampleRate),o={[ae.log]:i,[ae.configuration]:i&&Fe(e.telemetryConfigurationSampleRate),[ae.usage]:i&&Fe(e.telemetryUsageSampleRate)},a=yi();Ae=d=>{const l=ne(d);if(o[d.type]&&s.size<e.maxTelemetryEventsPerPage&&!s.has(l)){const u=c(t,d,a);n.notify(u),kr("telemetry",u),s.add(l)}},Cn(Br);function c(d,l,u){return ge({type:"telemetry",date:H(),service:d,version:"6.5.0",source:"browser",_dd:{format_version:2},telemetry:ge(l,{runtime_env:u,connectivity:hi(),sdk_setup:"npm"}),experimental_features:Array.from(Is())},r!==void 0?r():{})}return{setContextProvider:d=>{r=d},observable:n,enabled:i}}function yi(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function bi(){Fr.drain()}function vi(t){return t.site===us}function Or(t,e){ft(R.debug,t,e),Ae({type:ae.log,message:t,status:"debug",...e})}function Br(t,e){Ae({type:ae.log,status:"error",...Ti(t),...e})}function _i(t){Ae({type:ae.configuration,configuration:t})}function Ei(t){Ae({type:ae.usage,usage:t})}function Ti(t){if(q(t)){const e=N(t);return{error:{kind:e.name,stack:se(Si(e))},message:e.message}}return{error:{stack:Er},message:`Uncaught ${ne(t)}`}}function Si(t){return t.stack=t.stack.filter(e=>!e.url||mi.some(r=>e.url.startsWith(r))),t}const De=1/0,wi=$;let ke=null;const Ke=new Set;function Ci(){Ke.forEach(t=>t())}function xi({expireDelay:t,maxEntries:e}){let r=[];const n=[];ke||(ke=pt(()=>Ci(),wi));const s=()=>{const f=Oe()-t;for(;r.length>0&&r[r.length-1].endTime<f;){const m=r.pop();m&&n.push(m.startTime)}};Ke.add(s);function i(f,m){const A={value:f,startTime:m,endTime:De,remove:()=>{Lr(r,A)},close:p=>{A.endTime=p}};return e&&r.length>=e&&r.pop(),r.unshift(A),A}function o(f=De,m={returnInactive:!1}){for(const A of r)if(A.startTime<=f){if(m.returnInactive||f<=A.endTime)return A.value;break}}function a(f){const m=r[0];m&&m.endTime===De&&m.close(f)}function c(f=De,m=0){const A=En(f,m);return r.filter(p=>p.startTime<=A&&f<=p.endTime).map(p=>p.value)}function d(){return r.map(({startTime:f,endTime:m,value:A})=>({startTime:f,endTime:m===De?"Infinity":m,value:A}))}function l(){return n}function u(){r=[]}function h(){Ke.delete(s),Ke.size===0&&ke&&(nr(ke),ke=null)}return{add:i,find:o,closeActive:a,findAll:c,reset:u,stop:h,getAllEntries:d,getDeletedEntries:l}}const Ri=$,Di=yt;function ki(t,e,r,n){const s=new k,i=new k,o=as(t.sessionStoreStrategyType,t,e,r),a=xi({expireDelay:Di});o.renewObservable.subscribe(()=>{a.add(c(),Oe()),s.notify()}),o.expireObservable.subscribe(()=>{i.notify(),a.closeActive(Oe())}),o.expandOrRenewSession(),a.add(c(),vn().relative),n.observable.subscribe(()=>{n.isGranted()?o.expandOrRenewSession():o.expire()}),Ui(t,()=>{n.isGranted()&&o.expandOrRenewSession()}),Ii(t,()=>o.expandSession()),Li(t,()=>o.restartSession());function c(){return{id:o.getSession().id,trackingType:o.getSession()[e],isReplayForced:!!o.getSession().forcedReplay,anonymousId:o.getSession().anonymousId}}return{findSession:(d,l)=>a.find(d,l),renewObservable:s,expireObservable:i,sessionStateUpdateObservable:o.sessionStateUpdateObservable,expire:o.expire,updateSessionState:o.updateSessionState}}function Ui(t,e){Dt(t,window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0})}function Ii(t,e){const r=()=>{document.visibilityState==="visible"&&e()};oe(t,document,"visibilitychange",r),pt(r,Ri)}function Li(t,e){oe(t,window,"resume",e,{capture:!0})}function Mr(t){return t>=500}function Pi(t){try{return t.clone()}catch{return}}const Fi=80*M,Oi=32,Nr=3*$t,Bi=$,Gr=ve;function zr(t,e,r,n,s){e.transportStatus===0&&e.queuedPayloads.size()===0&&e.bandwidthMonitor.canHandle(t)?Wr(t,e,r,{onSuccess:()=>Hr(0,e,r,n,s),onFailure:()=>{e.queuedPayloads.enqueue(t),Vr(e,r,n,s)}}):e.queuedPayloads.enqueue(t)}function Vr(t,e,r,n){t.transportStatus===2&&Se(()=>{const s=t.queuedPayloads.first();Wr(s,t,e,{onSuccess:()=>{t.queuedPayloads.dequeue(),t.currentBackoffTime=Gr,Hr(1,t,e,r,n)},onFailure:()=>{t.currentBackoffTime=Math.min(Bi,t.currentBackoffTime*2),Vr(t,e,r,n)}})},t.currentBackoffTime)}function Wr(t,e,r,{onSuccess:n,onFailure:s}){e.bandwidthMonitor.add(t),r(t,i=>{e.bandwidthMonitor.remove(t),Mi(i)?(e.transportStatus=e.bandwidthMonitor.ongoingRequestCount>0?1:2,t.retry={count:t.retry?t.retry.count+1:1,lastFailureStatus:i.status},s()):(e.transportStatus=0,n())})}function Hr(t,e,r,n,s){t===0&&e.queuedPayloads.isFull()&&!e.queueFullReported&&(s({message:`Reached max ${n} events size queued for upload: ${Nr/$t}MiB`,source:P.AGENT,startClocks:Q()}),e.queueFullReported=!0);const i=e.queuedPayloads;for(e.queuedPayloads=Qr();i.size()>0;)zr(i.dequeue(),e,r,n,s)}function Mi(t){return t.type!=="opaque"&&(t.status===0&&!navigator.onLine||t.status===408||t.status===429||Mr(t.status))}function Ni(){return{transportStatus:0,currentBackoffTime:Gr,bandwidthMonitor:Gi(),queuedPayloads:Qr(),queueFullReported:!1}}function Qr(){const t=[];return{bytesCount:0,enqueue(e){this.isFull()||(t.push(e),this.bytesCount+=e.bytesCount)},first(){return t[0]},dequeue(){const e=t.shift();return e&&(this.bytesCount-=e.bytesCount),e},size(){return t.length},isFull(){return this.bytesCount>=Nr}}}function Gi(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(t){return this.ongoingRequestCount===0||this.ongoingByteCount+t.bytesCount<=Fi&&this.ongoingRequestCount<Oi},add(t){this.ongoingRequestCount+=1,this.ongoingByteCount+=t.bytesCount},remove(t){this.ongoingRequestCount-=1,this.ongoingByteCount-=t.bytesCount}}}function zi(t,e,r){const n=Ni(),s=(i,o)=>Hi(t,e,i,o);return{send:i=>{zr(i,n,s,t.trackType,r)},sendOnExit:i=>{Vi(t,e,i)}}}function Vi(t,e,r){if(!!navigator.sendBeacon&&r.bytesCount<e)try{const i=t.build("beacon",r);if(navigator.sendBeacon(i,r.data))return}catch(i){Wi(i)}const s=t.build("xhr",r);kt(s,r.data)}let Yr=!1;function Wi(t){Yr||(Yr=!0,Br(t))}function Hi(t,e,r,n){if(Qi()&&r.bytesCount<e){const i=t.build("fetch",r);fetch(i,{method:"POST",body:r.data,keepalive:!0,mode:"cors"}).then(T(o=>n==null?void 0:n({status:o.status,type:o.type})),T(()=>{const o=t.build("xhr",r);kt(o,r.data,n)}))}else{const i=t.build("xhr",r);kt(i,r.data,n)}}function Qi(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function kt(t,e,r){const n=new XMLHttpRequest;n.open("POST",t,!0),e instanceof Blob&&n.setRequestHeader("Content-Type",e.type),oe({allowUntrustedEvents:!0},n,"loadend",()=>{r==null||r({status:n.status})},{once:!0}),n.send(e)}function Ut(){const t=Yi();if(t)return{getCapabilities(){var e;return JSON.parse(((e=t.getCapabilities)===null||e===void 0?void 0:e.call(t))||"[]")},getPrivacyLevel(){var e;return(e=t.getPrivacyLevel)===null||e===void 0?void 0:e.call(t)},getAllowedWebViewHosts(){return JSON.parse(t.getAllowedWebViewHosts())},send(e,r,n){const s=n?{id:n}:void 0;t.send(JSON.stringify({eventType:e,event:r,view:s}))}}}function Je(t){var e;t===void 0&&(t=(e=Y().location)===null||e===void 0?void 0:e.hostname);const r=Ut();return!!r&&r.getAllowedWebViewHosts().some(n=>t===n||t.endsWith(`.${n}`))}function Yi(){return Y().DatadogEventBridge}const $e={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function ji(t){return new k(e=>{const{stop:r}=Dt(t,window,["visibilitychange","freeze"],s=>{s.type==="visibilitychange"&&document.visibilityState==="hidden"?e.notify({reason:$e.HIDDEN}):s.type==="freeze"&&e.notify({reason:$e.FROZEN})},{capture:!0}),n=oe(t,window,"beforeunload",()=>{e.notify({reason:$e.UNLOADING})}).stop;return()=>{r(),n()}})}function Xi(t){return Ge($e).includes(t)}function qi({encoder:t,request:e,flushController:r,messageBytesLimit:n}){let s={};const i=r.flushObservable.subscribe(u=>l(u));function o(u,h,f){r.notifyBeforeAddMessage(h),f!==void 0?(s[f]=u,r.notifyAfterAddMessage()):t.write(t.isEmpty?u:`
|
|
103
|
+
${u}`,m=>{r.notifyAfterAddMessage(m-h)})}function a(u){return u!==void 0&&s[u]!==void 0}function c(u){const h=s[u];delete s[u];const f=t.estimateEncodedBytesCount(h);r.notifyAfterRemoveMessage(f)}function d(u,h){const f=ne(u),m=t.estimateEncodedBytesCount(f);if(m>=n){D.warn(`Discarded a message whose size was bigger than the maximum allowed size ${n}KB. ${Pe} ${qt}/#technical-limitations`);return}a(h)&&c(h),o(f,m,h)}function l(u){const h=Ge(s).join(`
|
|
104
|
+
`);s={};const f=Xi(u.reason),m=f?e.sendOnExit:e.send;if(f&&t.isAsync){const A=t.finishSync();A.outputBytesCount&&m(jr(A));const p=[A.pendingData,h].filter(Boolean).join(`
|
|
105
|
+
`);p&&m({data:p,bytesCount:ht(p)})}else h&&t.write(t.isEmpty?h:`
|
|
106
|
+
${h}`),t.finish(A=>{m(jr(A))})}return{flushController:r,add:d,upsert:d,stop:i.unsubscribe}}function jr(t){let e;return typeof t.output=="string"?e=t.output:e=new Blob([t.output],{type:"text/plain"}),{data:e,bytesCount:t.outputBytesCount,encoding:t.encoding}}function Zi({messagesLimit:t,bytesLimit:e,durationLimit:r,pageExitObservable:n,sessionExpireObservable:s}){const i=n.subscribe(m=>l(m.reason)),o=s.subscribe(()=>l("session_expire")),a=new k(()=>()=>{i.unsubscribe(),o.unsubscribe()});let c=0,d=0;function l(m){if(d===0)return;const A=d,p=c;d=0,c=0,f(),a.notify({reason:m,messagesCount:A,bytesCount:p})}let u;function h(){u===void 0&&(u=Se(()=>{l("duration_limit")},r))}function f(){rr(u),u=void 0}return{flushObservable:a,get messagesCount(){return d},notifyBeforeAddMessage(m){c+m>=e&&l("bytes_limit"),d+=1,c+=m,h()},notifyAfterAddMessage(m=0){c+=m,d>=t?l("messages_limit"):c>=e&&l("bytes_limit")},notifyAfterRemoveMessage(m){c-=m,d-=1,d===0&&f()}}}function Xr(t,e,r,n,s,i,o=qi){const a=d(t,e),c=r&&d(t,r);function d(l,{endpoint:u,encoder:h}){return o({encoder:h,request:zi(u,l.batchBytesLimit,n),flushController:Zi({messagesLimit:l.batchMessagesLimit,bytesLimit:l.batchBytesLimit,durationLimit:l.flushTimeout,pageExitObservable:s,sessionExpireObservable:i}),messageBytesLimit:l.messageBytesLimit})}return{flushObservable:a.flushController.flushObservable,add(l,u=!0){a.add(l),c&&u&&c.add(r.transformMessage?r.transformMessage(l):l)},upsert:(l,u)=>{a.upsert(l,u),c&&c.upsert(r.transformMessage?r.transformMessage(l):l,u)},stop:()=>{a.stop(),c&&c.stop()}}}function et(){let t="",e=0;return{isAsync:!1,get isEmpty(){return!t},write(r,n){const s=ht(r);e+=s,t+=r,n&&n(s)},finish(r){r(this.finishSync())},finishSync(){const r={output:t,outputBytesCount:e,rawBytesCount:e,pendingData:""};return t="",e=0,r},estimateEncodedBytesCount(r){return r.length}}}class Ki{constructor(){this.callbacks={}}notify(e,r){const n=this.callbacks[e];n&&n.forEach(s=>s(r))}subscribe(e,r){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(r),{unsubscribe:()=>{this.callbacks[e]=this.callbacks[e].filter(n=>r!==n)}}}}function Ji(t,e,r){let n=0,s=!1;return{isLimitReached(){if(n===0&&Se(()=>{n=0},$),n+=1,n<=e||s)return s=!1,!1;if(n===e+1){s=!0;try{r({message:`Reached max number of ${t}s by minute: ${e}`,source:P.AGENT,startClocks:Q()})}finally{s=!1}}return!0}}}let It;const Lt=new WeakMap;function $i(t){return It||(It=eo(t)),It}function eo(t){return new k(e=>{const{stop:r}=ie(XMLHttpRequest.prototype,"open",to),{stop:n}=ie(XMLHttpRequest.prototype,"send",i=>{ro(i,t,e)},{computeHandlingStack:!0}),{stop:s}=ie(XMLHttpRequest.prototype,"abort",no);return()=>{r(),n(),s()}})}function to({target:t,parameters:[e,r]}){Lt.set(t,{state:"open",method:String(e).toUpperCase(),url:Et(String(r))})}function ro({target:t,handlingStack:e},r,n){const s=Lt.get(t);if(!s)return;const i=s;i.state="start",i.startClocks=Q(),i.isAborted=!1,i.xhr=t,i.handlingStack=e;let o=!1;const{stop:a}=ie(t,"onreadystatechange",()=>{t.readyState===XMLHttpRequest.DONE&&c()}),c=()=>{if(d(),a(),o)return;o=!0;const l=s;l.state="complete",l.duration=_n(i.startClocks.timeStamp,H()),l.status=t.status,n.notify(wn(l))},{stop:d}=oe(r,t,"loadend",c);n.notify(i)}function no({target:t}){const e=Lt.get(t);e&&(e.isAborted=!0)}let Pt;function qr(){return Pt||(Pt=so()),Pt}function so(){return new k(t=>{if(!window.fetch)return;const{stop:e}=ie(window,"fetch",r=>io(r,t),{computeHandlingStack:!0});return e})}function io({parameters:t,onPostCall:e,handlingStack:r},n){const[s,i]=t;let o=i&&i.method;o===void 0&&s instanceof Request&&(o=s.method);const a=o!==void 0?String(o).toUpperCase():"GET",c=s instanceof Request?s.url:Et(String(s)),d=Q(),l={state:"start",init:i,input:s,method:a,startClocks:d,url:c,handlingStack:r};n.notify(l),t[0]=l.input,t[1]=l.init,e(u=>oo(n,u,l))}function oo(t,e,r){const n=r;function s(i){n.state="resolve",Object.assign(n,i),t.notify(n)}e.then(T(i=>{s({response:i,responseType:i.type,status:i.status,isAborted:!1})}),T(i=>{var o,a;s({status:0,isAborted:((a=(o=n.init)===null||o===void 0?void 0:o.signal)===null||a===void 0?void 0:a.aborted)||i instanceof DOMException&&i.code===DOMException.ABORT_ERR,error:i})}))}let Ft={};function ao(t){const e=t.map(r=>(Ft[r]||(Ft[r]=co(r)),Ft[r]));return sr(...e)}function co(t){return new k(e=>{const r=B[t];return B[t]=(...n)=>{r.apply(console,n);const s=Xe("console error");Te(()=>{e.notify(lo(n,t,s))})},()=>{B[t]=r}})}function lo(t,e,r){const n=t.map(i=>uo(i)).join(" ");let s;if(e===R.error){const i=t.find(q);s={stack:i?se(N(i)):void 0,fingerprint:Sr(i),causes:i?Cr(i,"console"):void 0,startClocks:Q(),message:n,source:P.CONSOLE,handling:"handled",handlingStack:r,context:wr(i)}}return{api:e,message:n,error:s,handlingStack:r}}function uo(t){return typeof t=="string"?G(t):q(t)?_r(N(t)):ne(G(t),void 0,2)}function ho(t){const e=Ur(t)==="object";return e||D.error("Unsupported context:",t),e}function Ot(t,e,r){const n={...t};for(const[s,{required:i,type:o}]of Object.entries(e))o==="string"&&s in n&&(n[s]=String(n[s])),i&&!(s in t)&&D.warn(`The property ${s} of ${r} is required; context will not be sent to the intake.`);return n}function tt(t="",{customerDataTracker:e,propertiesConfig:r={}}={}){let n={};const s=new k,i={getContext:()=>Ir(n),setContext:o=>{ho(o)?(n=G(Ot(o,r,t)),e==null||e.updateCustomerData(n)):i.clearContext(),s.notify()},setContextProperty:(o,a)=>{n=G(Ot({...n,[o]:a},r,t)),e==null||e.updateCustomerData(n),s.notify()},removeContextProperty:o=>{delete n[o],e==null||e.updateCustomerData(n),Ot(n,r,t),s.notify()},clearContext:()=>{n={},e==null||e.resetCustomerData(),s.notify()},changeObservable:s};return i}const fo="_dd_c",po=[];function Bt(t,e,r,n){const s=mo(r,n);po.push(oe(t,window,"storage",({key:d})=>{s===d&&o()})),e.changeObservable.subscribe(a);const i=ge(c(),e.getContext());Ee(i)||e.setContext(i);function o(){e.setContext(c())}function a(){localStorage.setItem(s,JSON.stringify(e.getContext()))}function c(){const d=localStorage.getItem(s);return d?JSON.parse(d):{}}}function mo(t,e){return`${fo}_${t}_${e}`}const go=3*M,Ao=16*M,yo=200;function bo(t=2){const e=new Map;let r=!1;function n(s=0){if(r||t===0)return;const i=t===2?go:Ao;let o=s;e.forEach(a=>{o+=a.getBytesCount()}),o>i&&(vo(i),r=!0)}return{createDetachedTracker:()=>{const s=Zr(()=>n(s.getBytesCount()));return s},getOrCreateTracker:s=>(e.has(s)||e.set(s,Zr(n)),e.get(s)),setCompressionStatus:s=>{t===0&&(t=s,n())},getCompressionStatus:()=>t,stop:()=>{e.forEach(s=>s.stop()),e.clear()}}}function Zr(t){let e=0;const{throttled:r,cancel:n}=ir(i=>{e=ht(ne(i)),t()},yo),s=()=>{n(),e=0};return{updateCustomerData:i=>{Ee(i)?s():r(i)},resetCustomerData:s,getBytesCount:()=>e,stop:()=>{n()}}}function vo(t){D.warn(`Customer data exceeds the recommended ${t/M}KiB threshold. ${Pe} ${qt}/#customer-data-exceeds-the-recommended-threshold-warning`)}function _o(t,e,r){const n=t.getReader(),s=[];let i=0;o();function o(){n.read().then(T(c=>{if(c.done){a();return}s.push(c.value),i+=c.value.length,i>r.bytesLimit?a():o()}),T(c=>e(c)))}function a(){n.cancel().catch(j);let c,d;{let l;if(s.length===1)l=s[0];else{l=new Uint8Array(i);let u=0;s.forEach(h=>{l.set(h,u),u+=h.length})}c=l.slice(0,r.bytesLimit),d=l.length>r.bytesLimit}e(void 0,c,d)}}const Eo="datadog-synthetics-public-id",To="datadog-synthetics-result-id",So="datadog-synthetics-injects-rum";function Kr(){return!!(window._DATADOG_SYNTHETICS_INJECTS_RUM||ee(So))}function wo(){const t=window._DATADOG_SYNTHETICS_PUBLIC_ID||ee(Eo);return typeof t=="string"?t:void 0}function Co(){const t=window._DATADOG_SYNTHETICS_RESULT_ID||ee(To);return typeof t=="string"?t:void 0}function rt(t,e,r){const n=r.getHandler(),s=Array.isArray(n)?n:[n];return Jr[t]>=Jr[r.getLevel()]&&s.includes(e)}const v={ok:"ok",debug:"debug",info:"info",notice:"notice",warn:"warn",error:"error",critical:"critical",alert:"alert",emerg:"emerg"},Jr={[v.ok]:0,[v.debug]:1,[v.info]:2,[v.notice]:4,[v.warn]:5,[v.error]:6,[v.critical]:7,[v.alert]:8,[v.emerg]:9};function nt(t,{includeMessage:e=!1}={}){return{stack:t.stack,kind:t.type,message:e?t.message:void 0,causes:t.causes,fingerprint:t.fingerprint,handling:t.handling}}var xo=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i};const Ue={console:"console",http:"http",silent:"silent"},Ro=Object.keys(v);let F=class{constructor(e,r,n,s=Ue.http,i=v.debug,o={}){this.handleLogStrategy=e,this.handlerType=s,this.level=i,this.contextManager=tt("logger",{customerDataTracker:r}),this.contextManager.setContext(o),n&&this.contextManager.setContextProperty("logger",{name:n})}logImplementation(e,r,n=v.info,s,i){const o=G(r);let a;if(s!=null){const c=Tr({stackTrace:q(s)?N(s):void 0,originalError:s,nonErrorPrefix:"Provided",source:P.LOGGER,handling:"handled",startClocks:Q()});a=ge({error:nt(c,{includeMessage:!0})},o)}else a=o;this.handleLogStrategy({message:G(e),context:a,status:n},this,i)}log(e,r,n=v.info,s){let i;rt(n,Ue.http,this)&&(i=Xe("log")),this.logImplementation(e,r,n,s,i)}setContext(e){this.contextManager.setContext(e)}getContext(){return this.contextManager.getContext()}setContextProperty(e,r){this.contextManager.setContextProperty(e,r)}removeContextProperty(e){this.contextManager.removeContextProperty(e)}clearContext(){this.contextManager.clearContext()}setHandler(e){this.handlerType=e}getHandler(){return this.handlerType}setLevel(e){this.level=e}getLevel(){return this.level}};xo([Rn],F.prototype,"logImplementation",null),F.prototype.ok=z(v.ok),F.prototype.debug=z(v.debug),F.prototype.info=z(v.info),F.prototype.notice=z(v.notice),F.prototype.warn=z(v.warn),F.prototype.error=z(v.error),F.prototype.critical=z(v.critical),F.prototype.alert=z(v.alert),F.prototype.emerg=z(v.emerg);function z(t){return function(e,r,n){let s;rt(t,Ue.http,this)&&(s=Xe("log")),this.logImplementation(e,r,t,n,s)}}function Do(t,e,r){return{view:{referrer:document.referrer,url:window.location.href},context:t.getContext(),user:e.getContext(),account:r.getContext()}}const ko=32*M;function Uo(t){t.usePciIntake===!0&&t.site&&t.site!=="datadoghq.com"&&D.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");const e=Rs(t),r=$r(t.forwardConsoleLogs,Ge(R),"Forward Console Logs"),n=$r(t.forwardReports,Ge(qe),"Forward Reports");if(!(!e||!r||!n))return t.forwardErrorsToLogs&&!r.includes(R.error)&&r.push(R.error),{forwardErrorsToLogs:t.forwardErrorsToLogs!==!1,forwardConsoleLogs:r,forwardReports:n,requestErrorResponseLengthLimit:ko,...e}}function $r(t,e,r){if(t===void 0)return[];if(!(t==="all"||Array.isArray(t)&&t.every(n=>e.includes(n)))){D.error(`${r} should be "all" or an array with allowed values "${e.join('", "')}"`);return}return t==="all"?e:fi(t)}function Io(t){const e=Ds(t);return{forward_errors_to_logs:t.forwardErrorsToLogs,forward_console_logs:t.forwardConsoleLogs,forward_reports:t.forwardReports,use_pci_intake:t.usePciIntake,...e}}function Lo(t,e,r){const n=Pr();let s,i;const o=e.observable.subscribe(a);function a(){if(!i||!s||!e.isGranted())return;o.unsubscribe();const c=r(s,i);n.drain(c)}return{init(c){if(!c){D.error("Missing configuration");return}if(ks(c.enableExperimentalFeatures),Je()&&(c=Po(c)),s=c,i){xr("DD_LOGS",c);return}const d=Uo(c);d&&(i=d,qr().subscribe(j),e.tryToInit(d.trackingConsent),a())},get initConfiguration(){return s},getInternalContext:j,handleLog(c,d,l,u=t(),h=H()){n.add(f=>f.handleLog(c,d,l,u,h))}}}function Po(t){return{...t,clientToken:"empty"}}const Mt="logs";function Fo(t){const e=bo(),r=tt("global context",{customerDataTracker:e.getOrCreateTracker(2)}),n=tt("user",{customerDataTracker:e.getOrCreateTracker(1),propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}}),s=tt("account",{customerDataTracker:e.getOrCreateTracker(1),propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}}),i=cs();function o(){return Do(r,n,s)}let a=Lo(o,i,(l,u)=>{l.storeContextsAcrossPages&&(Bt(u,r,Mt,2),Bt(u,n,Mt,1),Bt(u,s,Mt,4));const h=t(l,u,o,i);return a=Oo(l,h),h});const c={},d=new F((...l)=>a.handleLog(...l),e.createDetachedTracker());return si({logger:d,init:T(l=>a.init(l)),setTrackingConsent:T(l=>{i.update(l),Ei({feature:"set-tracking-consent",tracking_consent:l})}),getGlobalContext:T(()=>r.getContext()),setGlobalContext:T(l=>r.setContext(l)),setGlobalContextProperty:T((l,u)=>r.setContextProperty(l,u)),removeGlobalContextProperty:T(l=>r.removeContextProperty(l)),clearGlobalContext:T(()=>r.clearContext()),createLogger:T((l,u={})=>(c[l]=new F((...h)=>a.handleLog(...h),e.createDetachedTracker(),G(l),u.handler,u.level,G(u.context)),c[l])),getLogger:T(l=>c[l]),getInitConfiguration:T(()=>Ir(a.initConfiguration)),getInternalContext:T(l=>a.getInternalContext(l)),setUser:T(n.setContext),getUser:T(n.getContext),setUserProperty:T(n.setContextProperty),removeUserProperty:T(n.removeContextProperty),clearUser:T(n.clearContext),setAccount:T(s.setContext),getAccount:T(s.getContext),setAccountProperty:T(s.setContextProperty),removeAccountProperty:T(s.removeContextProperty),clearAccount:T(s.clearContext)})}function Oo(t,e){return{init:r=>{xr("DD_LOGS",r)},initConfiguration:t,...e}}const Bo="logs";function Mo(t,e){const r=ki(t,Bo,n=>Go(t,n),e);return{findTrackedSession:(n,s={returnInactive:!1})=>{const i=r.findSession(n,s);return i&&i.trackingType==="1"?{id:i.id,anonymousId:i.anonymousId}:void 0},expireObservable:r.expireObservable}}function No(t){const r=en(t)==="1"?{}:void 0;return{findTrackedSession:()=>r,expireObservable:new k}}function en(t){return Fe(t.sessionSampleRate)?"1":"0"}function Go(t,e){const r=zo(e)?e:en(t);return{trackingType:r,isTracked:r==="1"}}function zo(t){return t==="0"||t==="1"}let tn=!1;function st(t){const e=window;if(Kr()){const n=r(e.DD_RUM_SYNTHETICS);return!n&&!tn&&(tn=!0,Or("Logs sent before RUM is injected by the synthetics worker",{testId:wo(),resultId:Co()})),n}return r(e.DD_RUM);function r(n){if(n&&n.getInternalContext)return n.getInternalContext(t)}}function Vo(t,e,r,n,s){const i=Ro.concat(["custom"]),o={};i.forEach(a=>{o[a]=Ji(a,e.eventRateLimiterThreshold,s)}),r.subscribe(0,({rawLogsEvent:a,messageContext:c=void 0,savedCommonContext:d=void 0,domainContext:l})=>{var u,h;const f=Tn(a.date),m=t.findTrackedSession(f);if(!t.findTrackedSession(f,{returnInactive:!0}))return;const p=d||n();let _;!Ee(p.account)&&p.account.id&&(_=p.account),m&&m.anonymousId&&!p.user.anonymous_id&&(p.user.anonymous_id=m.anonymousId);const S=ge({service:e.service,session_id:m?m.id:void 0,session:m?{id:m.id}:void 0,usr:Ee(p.user)?void 0:p.user,account:_,view:p.view},p.context,st(f),a,c);((u=e.beforeSend)===null||u===void 0?void 0:u.call(e,S,l))===!1||S.origin!==P.AGENT&&((h=o[S.status])!==null&&h!==void 0?h:o.custom).isLimitReached()||r.notify(1,S)})}const Wo={[R.log]:v.info,[R.debug]:v.debug,[R.info]:v.info,[R.warn]:v.warn,[R.error]:v.error};function Ho(t,e){const r=ao(t.forwardConsoleLogs).subscribe(n=>{var s;const i={rawLogsEvent:{date:H(),message:n.message,origin:P.CONSOLE,error:n.error&&nt(n.error),status:Wo[n.api]},messageContext:(s=n.error)===null||s===void 0?void 0:s.context,domainContext:{handlingStack:n.handlingStack}};e.notify(0,i)});return{stop:()=>{r.unsubscribe()}}}function Qo(t,e){const r=oi(t,t.forwardReports).subscribe(n=>{let s=n.message,i;const o=n.originalError.type==="deprecation"?v.warn:v.error;o===v.error?i=nt(n):n.stack&&(s+=` Found in ${ei(n.stack)}`),e.notify(0,{rawLogsEvent:{date:H(),message:s,origin:P.REPORT,error:i,status:o}})});return{stop:()=>{r.unsubscribe()}}}function Yo(t,e){if(!t.forwardErrorsToLogs)return{stop:j};const r=$i(t).subscribe(i=>{i.state==="complete"&&s("xhr",i)}),n=qr().subscribe(i=>{i.state==="resolve"&&s("fetch",i)});function s(i,o){!Cs(o.url)&&(Zo(o)||Mr(o.status))&&("xhr"in o?jo(o.xhr,t,a):o.response?qo(o.response,t,a):o.error&&Xo(o.error,t,a));function a(c){const d={isAborted:o.isAborted,handlingStack:o.handlingStack};e.notify(0,{rawLogsEvent:{message:`${Ko(i)} error ${o.method} ${o.url}`,date:o.startClocks.timeStamp,error:{stack:c||"Failed to load",handling:void 0},http:{method:o.method,status_code:o.status,url:o.url},status:v.error,origin:P.NETWORK},domainContext:d})}}return{stop:()=>{r.unsubscribe(),n.unsubscribe()}}}function jo(t,e,r){typeof t.response=="string"?r(Nt(t.response,e)):r(t.response)}function Xo(t,e,r){r(Nt(se(N(t)),e))}function qo(t,e,r){const n=Pi(t);!n||!n.body?r():window.TextDecoder?Jo(n.body,e.requestErrorResponseLengthLimit,(s,i)=>{r(s?`Unable to retrieve response: ${s}`:i)}):n.text().then(T(s=>r(Nt(s,e))),T(s=>r(`Unable to retrieve response: ${s}`)))}function Zo(t){return t.status===0&&t.responseType!=="opaque"}function Nt(t,e){return t.length>e.requestErrorResponseLengthLimit?`${t.substring(0,e.requestErrorResponseLengthLimit)}...`:t}function Ko(t){return t==="xhr"?"XHR":"Fetch"}function Jo(t,e,r){_o(t,(n,s,i)=>{if(n)r(n);else{let o=new TextDecoder().decode(s);i&&(o+="..."),r(void 0,o)}},{bytesLimit:e,collectStreamBody:!0})}function $o(t,e){if(!t.forwardErrorsToLogs)return{stop:j};const r=new k,{stop:n}=ti(r),s=r.subscribe(i=>{e.notify(0,{rawLogsEvent:{message:i.message,date:i.startClocks.timeStamp,error:nt(i),origin:P.SOURCE,status:v.error},messageContext:i.context})});return{stop:()=>{n(),s.unsubscribe()}}}const ea=Ki;function ta(t){function e(r,n,s,i,o){const a=ge(n.getContext(),r.context);if(rt(r.status,Ue.console,n)&&na(r,a),rt(r.status,Ue.http,n)){const c={rawLogsEvent:{date:o||H(),message:r.message,status:r.status,origin:P.LOGGER},messageContext:a,savedCommonContext:i};s&&(c.domainContext={handlingStack:s}),t.notify(0,c)}}return{handleLog:e}}const ra={[v.ok]:R.debug,[v.debug]:R.debug,[v.info]:R.info,[v.notice]:R.info,[v.warn]:R.warn,[v.error]:R.error,[v.critical]:R.error,[v.alert]:R.error,[v.emerg]:R.error};function na({status:t,message:e},r){J[ra[t]].call(B,e,r)}function sa(t,e,r,n,s){const i=Xr(t,{endpoint:t.logsEndpointBuilder,encoder:et()},t.replica&&{endpoint:t.replica.logsEndpointBuilder,encoder:et()},r,n,s.expireObservable);return e.subscribe(1,o=>{i.add(o)}),i}function ia(t){const e=Ut();t.subscribe(1,r=>{e.send("log",r)})}function oa(t){return{get:e=>{const r=t.findTrackedSession(e);if(r)return{session_id:r.id}}}}function aa(t){return e=>{t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,origin:P.AGENT,status:v.error}}),Or("Error reported to customer",{"error.message":e.message})}}function ca(t,e,r,n,s){const i=Ai("browser-logs-sdk",e);i.setContextProvider(()=>{var a,c,d,l,u,h;return{application:{id:(a=st())===null||a===void 0?void 0:a.application_id},session:{id:(c=s.findTrackedSession())===null||c===void 0?void 0:c.id},view:{id:(l=(d=st())===null||d===void 0?void 0:d.view)===null||l===void 0?void 0:l.id},action:{id:(h=(u=st())===null||u===void 0?void 0:u.user_action)===null||h===void 0?void 0:h.id}}});const o=[];if(Je()){const a=Ut(),c=i.observable.subscribe(d=>a.send("internal_telemetry",d));o.push(()=>c.unsubscribe())}else{const a=Xr(e,{endpoint:e.rumEndpointBuilder,encoder:et()},e.replica&&{endpoint:e.replica.rumEndpointBuilder,encoder:et()},r,n,s.expireObservable);o.push(()=>a.stop());const c=i.observable.subscribe(d=>a.add(d,vi(e)));o.push(()=>c.unsubscribe())}return bi(),_i(Io(t)),{telemetry:i,stop:()=>{o.forEach(a=>a())}}}function la(t,e,r,n){const s=new ea,i=[];s.subscribe(1,h=>kr("logs",h));const o=aa(s),a=ji(e),c=e.sessionStoreStrategyType&&!Je()&&!Kr()?Mo(e,n):No(e),{stop:d}=ca(t,e,o,a,c);i.push(()=>d()),Yo(e,s),$o(e,s),Ho(e,s),Qo(e,s);const{handleLog:l}=ta(s);if(Vo(c,e,s,r,o),Je())ia(s);else{const{stop:h}=sa(e,s,o,a,c);i.push(()=>h())}const u=oa(c);return{handleLog:l,getInternalContext:u.get,stop:()=>{i.forEach(h=>h())}}}const ce=Fo(la);ii(Y(),"DD_LOGS",ce);const g=class g{constructor(e){this.listenerMap=new Map,g.options=e,this.isLoggingOn=e.LOG_TO_DATADOG,this.eventTarget=new EventTarget,this.isLoggingOn&&ce.init({clientToken:"pub86577b481b35700b8fcfe3b4993f007a",service:"BBMediaKitDemoWeb",site:"us3.datadoghq.com",forwardErrorsToLogs:!1,sessionSampleRate:100});const r="bb_logger_mac_uuid";let n=localStorage.getItem(r);n||(n=crypto.randomUUID(),localStorage.setItem(r,n)),g.tracking.mac=n,g.tracking.dev=`${e.platform}_${e.browserName}`,g.beatHandle||(g.options&&y(g.options,"Logger")&&console.log("[Logger] Starting tracking beat"),g.beatHandle=window.setInterval(g.flushTracking,15e3))}static setMessagePort(e){this.messagePort=e}static getMessagePort(){return this.messagePort}setLoggingOn(e){this.isLoggingOn=e}addEventListener(e,r){const n=s=>r(s);this.listenerMap.set(r,{eventName:e,wrappedListener:n}),this.eventTarget.addEventListener(e,n)}removeEventListener(e,r){const n=this.listenerMap.get(r);n&&n.eventName===e&&(this.eventTarget.removeEventListener(e,n.wrappedListener),this.listenerMap.delete(r))}removeAllEventListeners(){for(const[e,{eventName:r,wrappedListener:n}]of this.listenerMap)this.eventTarget.removeEventListener(r,n);this.listenerMap.clear()}setAttributes(e){g.processAttributes(e);for(const r in e)ce.logger.setContextProperty(r,e[r])}info(e,r){e==="didClickAd"&&this.emit("mediaSessionDidRegisterClick",{url:(r==null?void 0:r.url)||""}),e==="didToggleGlobalAugmentationDrawing"&&this.emit("mediaSessionDidUpdateGlobalAugmentationState",{isGlobalAugmentationEnabled:(r==null?void 0:r.isEnabled)??!0}),e==="didStartDrawingAugmentationMedia"&&this.emit("mediaSessionDidBeginShotRendering",r),e==="didEndDrawingAugmentationMedia"&&this.emit("mediaSessionDidEndShotRendering",r),e==="didRegisterShot"&&this.emit("mediaSessionDidRegisterShot",r),r&&g.processAttributes(r),this.isLoggingOn&&(ce.logger.info(e,r),g.options&&y(g.options,"Logger")&&console.log("[Logger] Sending info: ",e))}error(e,r){this.emit("mediaSessionDidError",{message:e,...r||{}}),r&&g.processAttributes(r),this.isLoggingOn&&(ce.logger.error(e,r),g.tracking.err_time=Date.now().toFixed(0),g.tracking.err_desc=e+(r?` - ${JSON.stringify(r)}`:""),g.options&&y(g.options,"Logger")&&console.log("[Logger] Sending error: ",e))}criticalError(e,r){this.emit("mediaSessionDidFailOnError",{message:e,...r||{}}),r&&g.processAttributes(r),this.isLoggingOn&&(ce.logger.error(e,r),g.tracking.err_time=Date.now().toFixed(0),g.tracking.err_desc=e+(r?` - ${JSON.stringify(r)}`:""),g.options&&y(g.options,"Logger")&&console.log("[Logger] Sending critical error: ",e))}warn(e,r){r&&g.processAttributes(r),this.isLoggingOn&&(ce.logger.warn(e,r),g.options&&y(g.options,"Logger")&&console.log("[Logger] Sending warn: ",e))}handleMessageFromWorker(e){e.actionType==="INFO"?this.info(e.message,e.attributes):e.actionType==="ERROR"?this.error(e.message,e.attributes):e.actionType==="CRITICAL_ERROR"?this.criticalError(e.message,e.attributes):e.actionType==="WARN"?this.warn(e.message,e.attributes):e.actionType==="SET_ATTRIBUTES"&&e.attributes&&this.setAttributes(e.attributes)}static setAttributes(e){if(!g.messagePort){console.error("[Logger] messagePort is not set! Cannot send attributes.");return}try{g.messagePort.postMessage({type:"LOG",actionType:"SET_ATTRIBUTES",attributes:e})}catch(r){console.error("[Logger] Error posting message:",r)}}static info(e,r){g.messagePort.postMessage({type:"LOG",actionType:"INFO",message:e,attributes:r})}static error(e,r){g.messagePort.postMessage({type:"LOG",actionType:"ERROR",message:e,attributes:r})}static warn(e,r){g.messagePort.postMessage({type:"LOG",actionType:"WARN",message:e,attributes:r})}static criticalError(e,r){g.messagePort.postMessage({type:"LOG",actionType:"CRITICAL_ERROR",message:e,attributes:r})}static processAttributes(e){if(e.player_version&&(g.tracking.sdk=e.player_version),e.media_id&&(g.tracking.gid=e.media_id),e.game_id&&(g.tracking.buc=e.game_id),e.bb_session_id&&(g.tracking.sid=e.bb_session_id,g.options&&y(g.options,"Logger")&&console.log("[Logger] Setting bb_session_id:",g.tracking.sid)),e.last_timecode){const n=L.fromStr(e.last_timecode);g.tracking.tc=n.print(),g.lastTimecodeMillis=n.totalMilliseconds(59.94),g.lastTimecodeMillis&&g.lastZipMillis&&(g.tracking.cache=(g.lastZipMillis-g.lastTimecodeMillis).toFixed(0))}e.last_offset&&(g.tracking.off=e.last_offset),e.last_loading_zip&&(g.tracking.zip=e.last_loading_zip+".zip",g.lastZipMillis=L.fromStr(e.last_loading_zip).totalMilliseconds(59.94),g.lastTimecodeMillis&&g.lastZipMillis&&(g.tracking.cache=(g.lastZipMillis-g.lastTimecodeMillis).toFixed(0))),e.last_rendered_frame&&(g.tracking.aug_time=Date.now().toFixed(0)),e.asset&&(g.tracking.asset=e.asset)}static objectToQuery(e){return Object.entries(e).filter(([r,n])=>n!==0&&n!=="").map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(String(n))}`).join("&")}emit(e,r){const n=new CustomEvent(e,{detail:r});this.eventTarget.dispatchEvent(n)}};g.tracking={start:Date.now().toFixed(0),dev:"",sdk:"",mac:"",gid:"",sid:"",off:"",zip:"",aug_time:"",err_time:"",err_desc:"",tc:"",asset:"",cache:"",buc:""},g.lastTimecodeMillis=0,g.lastZipMillis=0,g.flushTracking=()=>{const e=Date.now().toFixed(0);g.tracking.now=e;const n=`https://dwu3k7rrxk5s3.cloudfront.net/metrics/1.gif?${g.objectToQuery(g.tracking)}&platform=Web`;g.options&&y(g.options,"Logger")&&console.log("[Logger] Flushing tracking data:",n),fetch(n,{method:"GET",mode:"no-cors",keepalive:!0}).catch(()=>{}),g.tracking.err_desc="",g.tracking.err_time=""};let Gt=g;const da={env:"prod",urlConfigURL:"https://db8igqxlbvayn.cloudfront.net/url_config.json",gameBaseURL:"https://db8igqxlbvayn.cloudfront.net",zipBaseURL:"https://db8igqxlbvayn.cloudfront.net",adsBaseURL:"https://dwu3k7rrxk5s3.cloudfront.net",LOG_TO_DATADOG:!0,SEND_METRICS:!0,BURNED_TIMECODES_MODE:!1,RENDER_LED:!0,DRAW_TIMESTAMP_WEBGL:!1,ADAPTER_RUN_IN_WORKER:!1,DOWNLOADER_UPDATE_FREQUENCY:1e3,DOWNLOADER_ZIP_START_OFFSET:2,DOWNLOADER_ZIP_END_OFFSET:10,DOWNLOADER_ZIP_LENGTH_SECONDS:2,ZIP_BUFFER_READY_THRESHOLD:5,ZIP_BUFFER_FADEOUT_THRESHOLD:1,BENCHMARK_DURATION_SECONDS:10,DECODER_UPDATE_FREQUENCY:30,DECODER_FRAME_BATCH_SIZE:3,DECODER_LEAD_TIME_MILLIS:180,PERFORMANCE_TRACKING_INTERVAL:1e3,BUCKET_SUBFOLDER_PATH:"manifests/59.94/",MASK_TYPE:"mp4",debug:{on:!1,showAugmentationStatus:!1,adapterDebugMode:!1,logOTTPlayer:!1,logClocker:!1,logDownloader:!1,logDecoder:!1,logRenderer:!1,logFetcher:!1,logAdapter:!1,logAds:!1,logLogger:!1,logErrors:!1,trackPerformance:!1}},ua="https://identity-qa.nba.com/qa/auth";class ha{constructor(e){this.cookies=[],this.xToken=null,this.authInProgress=!1,this.OTTPlayer=e,this.options=e.options,this.logger=e.logger}async fetchNBAToken(e,r){const n=this.options.authIdentityUrl||ua;y(this.options,"OTTPlayer")&&console.log(`[CloudFrontAuth] Fetching JWT from: ${n}`);const s=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:r})});if(!s.ok){const o=await s.text().catch(()=>"");throw new Error(`NBA auth request failed: ${s.status} ${s.statusText} - ${o}`)}const i=await s.json().catch(()=>null);if(!i||!i.data||!i.data.jwt)throw new Error("NBA auth response was invalid or missing JWT token");return i.data.jwt}async loginAndGetCookies(e){try{const r=this.options.authNbaToken,n=this.options.authEmail,s=this.options.authPassword;if(!r&&(!n||!s))return y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] No credentials or NBA token provided, skipping authentication"),[];const i=this.options.zipBaseURL;if(!i)return console.warn("[CloudFrontAuth] No zipBaseURL configured, cannot authenticate"),[];if(this.lastGameId===e&&this.cookies.length>0)return y(this.options,"OTTPlayer")&&console.log(`[CloudFrontAuth] ✓ Using cached cookies for gameId=${e}`),this.cookies;if(this.authInProgress)return y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ⏳ Auth already in progress, waiting..."),await this.waitForAuth(),this.cookies;this.authInProgress=!0,this.lastGameId=e,console.log(`[CloudFrontAuth] 🔐 Starting authentication for gameId=${e}`),console.log(`[CloudFrontAuth] CloudFront URL: ${i}`);let o;r?(o=r,y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ✓ Using provided NBA token")):this.xToken?(o=this.xToken,y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ✓ Using existing x-token")):(o=await this.fetchNBAToken(n,s),y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ✓ Got JWT token from NBA Identity"));const a=`${i}/auth/${encodeURIComponent(e)}`;console.log(`[CloudFrontAuth] Fetching cookies from: ${a}`);const c=await fetch(a,{method:"GET",credentials:"include",headers:{Authorization:`Bearer ${o}`}});if(!c.ok&&c.status!==204)throw new Error(`Failed to fetch cookies: ${c.status} ${c.statusText}`);y(this.options,"OTTPlayer")&&console.log(`[CloudFrontAuth] Auth endpoint status: ${c.status}`);const d=c.headers.get("x-token");d&&(this.xToken=d,y(this.options,"OTTPlayer")&&console.log("[CloudFrontAuth] ✓ Received fresh x-token"));const l=c.headers.get("set-cookie");return l?this.cookies=l.split(",").map(u=>u.trim()):this.cookies=["browser-managed-httponly-cookies"],console.log("[CloudFrontAuth] ✅ Successfully authenticated"),console.log("[CloudFrontAuth] Note: Cookies are HttpOnly and managed by browser automatically"),this.logger.info("didAuthenticateCloudFront",{gameId:e,cookieCount:this.cookies.length,hasXToken:!!this.xToken}),this.scheduleCookieRefresh(e),this.cookies}catch(r){return console.error("[CloudFrontAuth] ❌ Authentication failed:",r),this.logger.criticalError("[CloudFrontAuth] Required authentication failed",{error:r.message||r,gameId:e,hasNbaToken:!!this.options.authNbaToken,hasEmailPassword:!!(this.options.authEmail&&this.options.authPassword)}),this.xToken=null,[]}finally{this.authInProgress=!1}}async waitForAuth(){return new Promise(e=>{const r=setInterval(()=>{this.authInProgress||(clearInterval(r),e())},100)})}scheduleCookieRefresh(e){this.cookieRefreshTimer&&window.clearTimeout(this.cookieRefreshTimer),this.cookieRefreshTimer=window.setTimeout(()=>{y(this.options,"OTTPlayer")&&console.log(`[CloudFrontAuth] Auto-refreshing cookies and x-token for gameId=${e}`),this.loginAndGetCookies(e)},7*60*60*1e3)}getCookies(){return this.cookies}getXToken(){return this.xToken}isAuthenticated(){return this.cookies.length>0}destroy(){this.cookies=[],this.xToken=null,this.lastGameId=void 0,this.cookieRefreshTimer&&(window.clearTimeout(this.cookieRefreshTimer),this.cookieRefreshTimer=void 0)}}class fa{constructor(e){this.groups=new Map,this.isVisible=!0,this.lastFrameTime=0,this.TARGET_FPS=60,this.FRAME_INTERVAL=1e3/this.TARGET_FPS,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.pointerEvents="none",this.canvas.style.zIndex="3001",this.canvas.width=e.clientWidth,this.canvas.height=e.clientHeight,this.canvas.style.width="100%",this.canvas.style.height="100%",this.ctx=this.canvas.getContext("2d"),e.appendChild(this.canvas),this.initializeGroups(),this.startRenderLoop(),this.setupResizeObserver(e)}initializeGroups(){this.groups.set("support",{title:"Basic Augmentation Support",metrics:new Map([["game_params",{value:!1}],["browser",{value:!1,detail:""}],["pattern",{value:!1,detail:""}],["fps",{value:!1,detail:""}],["mk_ads",{value:!1,detail:""}]])}),this.groups.set("timecode",{title:"TimeCode Status",metrics:new Map([["sync_point",{value:!1,detail:""}],["consistency",{value:!1,detail:""}]])}),this.groups.set("benchmark",{title:"",metrics:new Map([["status",{value:"FAILED",detail:""}]])}),this.groups.set("switches",{title:"Augmentation Switches",metrics:new Map([["killswitch_web",{value:!1}],["killswitch_local",{value:!1}],["isLive",{value:!1}],["render_state",{value:"OFF"}]])}),this.groups.set("data",{title:"Augmentation Data Presence",metrics:new Map([["zip_buffer",{value:!1,detail:"0.0s"}],["stream_data",{value:!1}],["ads",{value:!1}],["render_data",{value:!1}],["alpha_mask",{value:!1}],["placeholders",{value:!1}],["processing_size",{value:!1}]])}),this.groups.set("health",{title:"Player Components Health",metrics:new Map([["decoder",{value:!1,detail:""}],["webgl",{value:!1,detail:""}]])})}updateMetric(e,r,n,s){const i=this.groups.get(e);i&&i.metrics.set(r,{value:n,detail:s})}startRenderLoop(){const e=r=>{r-this.lastFrameTime>=this.FRAME_INTERVAL&&(this.isVisible&&this.draw(),this.lastFrameTime=r),this.animationFrameId=requestAnimationFrame(e)};this.animationFrameId=requestAnimationFrame(e)}setupResizeObserver(e){typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.canvas.width=e.clientWidth,this.canvas.height=e.clientHeight}),this.resizeObserver.observe(e))}draw(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);const e=12,r=e+3,n=10,s=15,i=10;this.ctx.font=`${e}px monospace`,this.ctx.textBaseline="top";let o=i;this.groups.forEach((c,d)=>{var l;if(d==="benchmark"){const u=c.metrics.get("status");if(u){const h=u.value;let f,m;h==="PASSED"?(f="rgba(0,255,136,0.8)",m="STABILITY TEST: PASSED"):h==="TESTING"?(f="rgba(255,170,0,0.8)",m=`STABILITY TEST: TESTING${u.detail?" ("+((l=u.detail.split(":")[1])==null?void 0:l.trim())+")":""}`):(f="rgba(255,51,51,0.8)",m="STABILITY TEST: FAILED"),this.ctx.fillStyle=f,this.ctx.fillRect(i,o,250,20),this.ctx.fillStyle="#000",this.ctx.font=`bold ${e}px monospace`,this.ctx.fillText(m,i+5,o+4),this.ctx.font=`${e}px monospace`,o+=25}return}this.ctx.fillStyle="rgba(0,0,0,0.7)",this.ctx.fillRect(i,o,300,r+2),this.ctx.fillStyle="#fff",this.ctx.font=`bold ${e}px monospace`,this.ctx.fillText(c.title,i+5,o+1),this.ctx.font=`${e}px monospace`,o+=r+4,c.metrics.forEach((u,h)=>{const f=this.getColorForValue(u.value),m=this.formatValue(u.value);this.ctx.fillStyle="rgba(0,0,0,0.5)",this.ctx.fillRect(i+s,o,285-s,r),this.ctx.fillStyle=f,this.ctx.beginPath(),this.ctx.arc(i+s+5,o+r/2,3,0,Math.PI*2),this.ctx.fill(),this.ctx.fillStyle="#fff";const A=h.replace(/_/g," ");this.ctx.fillText(`${A}: ${m}`,i+s+15,o+1),o+=r,u.detail&&(this.ctx.fillStyle="rgba(0,0,0,0.4)",this.ctx.fillRect(i+s,o,285-s,r),this.ctx.fillStyle="#aaa",this.ctx.fillText(` ${u.detail}`,i+s+15,o+1),o+=r)}),o+=n});const a=this.isAugmentationReady();this.ctx.fillStyle=a?"rgba(0,255,136,0.8)":"rgba(255,51,51,0.8)",this.ctx.fillRect(i,o,250,20),this.ctx.fillStyle="#000",this.ctx.font=`bold ${e}px monospace`,this.ctx.fillText(`AUGMENTATION: ${a?"READY":"NOT READY"}`,i+5,o+4),this.ctx.font=`${e}px monospace`}formatValue(e){return typeof e=="boolean"?e?"OK":"NO":e==="PASSED"?"PASSED":e==="TESTING"?"TESTING":e==="FAILED"?"FAILED":e}getColorForValue(e){return typeof e=="boolean"?e?"#00ff88":"#ff3333":e==="ON"||e==="FADE_IN"?"#00ff88":e==="FADE_OUT"?"#ffaa00":e==="PASSED"?"#00ff88":e==="TESTING"?"#ffaa00":"#ff3333"}isAugmentationReady(){var u,h,f,m,A,p,_,S,w,E;const e=this.groups.get("support"),r=this.groups.get("switches"),n=this.groups.get("data"),s=this.groups.get("health"),i=this.groups.get("benchmark");if(!e||!r||!n||!s||!i)return!1;const o=((u=e.metrics.get("game_params"))==null?void 0:u.value)===!0&&((h=e.metrics.get("browser"))==null?void 0:h.value)===!0&&((f=e.metrics.get("pattern"))==null?void 0:f.value)===!0&&((m=e.metrics.get("fps"))==null?void 0:m.value)===!0&&((A=e.metrics.get("mk_ads"))==null?void 0:A.value)===!0,a=((p=r.metrics.get("killswitch_web"))==null?void 0:p.value)===!0&&((_=r.metrics.get("killswitch_local"))==null?void 0:_.value)===!0&&(((S=r.metrics.get("render_state"))==null?void 0:S.value)==="ON"||((w=r.metrics.get("render_state"))==null?void 0:w.value)==="FADE_IN"),c=Array.from(n.metrics.values()).every(C=>C.value===!0),d=Array.from(s.metrics.values()).every(C=>C.value===!0),l=((E=i.metrics.get("status"))==null?void 0:E.value)==="PASSED";return o&&a&&c&&d&&l}toggle(){this.isVisible=!this.isVisible,this.isVisible||this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}pause(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}resume(){this.animationFrameId||this.startRenderLoop()}delete(){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.resizeObserver&&this.resizeObserver.disconnect(),this.canvas.remove()}}class rn{constructor(e,r,n,s){this.RUN_PIXEL_TICKERS=!0,this.pixelTickers=[],this.handleVisibilityChange=()=>{document.hidden?this.onTabHidden():this.onTabVisible()},this.fetchGameParams=async()=>{try{if(y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] GameId: ",this.options.gameId),this.options.OVERRIDE_GAME_PARAMS){y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Using OVERRIDE_GAME_PARAMS from configuration");const l=this.options.OVERRIDE_GAME_PARAMS;if(this.options.BURNED_TIMECODES_MODE){this.gameParams=l;return}if(l.hasOwnProperty("bucketName")&&l.hasOwnProperty("offsets")){if(this.logger.setAttributes({game_id:l.bucketName,customer_name:l.customerName,customer_id:l.customerId}),this.gameParams){const u=JSON.stringify(this.gameParams),h=JSON.stringify(l);u!==h&&this.logger.info("didChangeGameParams",{oldParams:this.gameParams,newParams:l})}else this.logger.info("didFetchGameInfo",l);this.gameParams=l,this.cloudFrontAuth&&l.bucketName&&this.cloudFrontAuth.loginAndGetCookies(l.bucketName).then(()=>{y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] CloudFront authentication completed for bucketName:",l.bucketName)}).catch(u=>{y(this.options,"Errors")&&console.error("[OTTPlayer] CloudFront authentication failed:",u)});return}else throw new Error(`OVERRIDE_GAME_PARAMS for ${this.options.gameId} is missing required properties (bucketName or offsets)`)}let o;const a=`${this.options.gameBaseURL}/${this.options.gameId}.json`,c=this.options.SEND_METRICS?`${a}?platform=Web`:a;if(y(this.options,"OTTPlayer")&&console.log(`Fetching GameParams from ${c}`),o=await fetch(c,{cache:"no-store"}),!o.ok){const l=`Unable to fetch game params for ${this.options.gameId}. HTTP error. Status: ${o.status}`;this.logger.criticalError("[OTTPlayer] Failed to fetch game params",{status:o.status,gameId:this.options.gameId,url:c}),y(this.options,"Errors")&&console.error(`[OTTPlayer] ${l}`),this.destroy();return}const d=await o.json();if(this.options.BURNED_TIMECODES_MODE){this.gameParams=d;return}if(this.handleOttActions(o,d),d.hasOwnProperty("bucketName")&&d.hasOwnProperty("offsets"))o=d;else throw new Error(`Game params for ${this.options.gameId} not found in JSON`);if(this.logger.setAttributes({game_id:o.bucketName,customer_name:o.customerName,customer_id:o.customerId}),this.gameParams){const l=JSON.stringify(this.gameParams),u=JSON.stringify(o);l!==u&&this.logger.info("didChangeGameParams",{oldParams:this.gameParams,newParams:o})}else this.logger.info("didFetchGameInfo",this.gameParams);this.gameParams=o,this.cloudFrontAuth&&o.bucketName&&this.cloudFrontAuth.loginAndGetCookies(o.bucketName).then(()=>{y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] CloudFront authentication completed for bucketName:",o.bucketName)}).catch(l=>{y(this.options,"Errors")&&console.error("[OTTPlayer] CloudFront authentication failed:",l)})}catch(o){this.logger.error("[OTTPlayer] Error fetching game params",{error:o}),y(this.options,"Errors")&&console.error("[OTTPlayer] Error fetching game params:",o)}this.fetchGameParamsTimeoutId=window.setTimeout(()=>this.fetchGameParams(),1e4)},this.setGameParams=o=>{try{if(y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Overriding game params"),this.fetchGameParamsTimeoutId&&(window.clearTimeout(this.fetchGameParamsTimeoutId),this.fetchGameParamsTimeoutId=void 0),this.options.BURNED_TIMECODES_MODE){this.gameParams=o;return}if(o.hasOwnProperty("bucketName")&&o.hasOwnProperty("offsets")){if(this.logger.setAttributes({game_id:o.bucketName,customer_name:o.customerName,customer_id:o.customerId}),this.gameParams){const a=JSON.stringify(this.gameParams),c=JSON.stringify(o);a!==c&&this.logger.info("didChangeGameParams",{oldParams:this.gameParams,newParams:o})}else this.logger.info("didFetchGameInfo",o);this.gameParams=o,this.cloudFrontAuth&&o.bucketName&&this.cloudFrontAuth.loginAndGetCookies(o.bucketName).then(()=>{y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] CloudFront authentication completed for bucketName:",o.bucketName)}).catch(a=>{y(this.options,"Errors")&&console.error("[OTTPlayer] CloudFront authentication failed:",a)});return}else throw new Error(`Game params for ${this.options.gameId} is missing required properties (bucketName or offsets)`)}catch(a){this.logger.error("[OTTPlayer] Error overriding game params",{error:a}),y(this.options,"Errors")&&console.error("[OTTPlayer] Error overriding game params:",a)}};const i="OTTPlayer_v1.1.3";console.log(`%c${i}`,"font-size: 16px; font-weight: bold; color: blue;"),this.video=e,this.options={...n,...da,platform:W.getCurrentPlatform(),browserName:W.getBrowserName(),augmentation:{channelName:"nba"}},this.options.browserName==="Firefox"&&(this.options.DECODER_LEAD_TIME_MILLIS=300),y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Starting fetchUrlConfig"),this.fetchUrlConfig(s),this.logger=new Gt(this.options),this.logger.setAttributes({player_version:i,bb_session_id:crypto.randomUUID()}),this.logger.info("didGetConfiguration",{...n,fps:r}),nn(this.options,s).then(()=>{var o;if(this.logger.setAttributes({media_id:this.options.gameId}),window.BB.playerInstances.length>0&&window.BB.playerInstances.forEach(a=>{a.destroy()}),window.BB.workerInstances.length>0&&window.BB.workerInstances.forEach(a=>{a.terminate()}),this.cloudFrontAuth=new ha(this),this.clocker=new at(this),this.adapter=new lt(this),this.ottActions={toggle:{ios:!0,android:!0,web:!0,local:this.options.enabled}},(o=this.options.debug)!=null&&o.showAugmentationStatus){const a=this.options.CANVAS_CONTAINER||this.video.parentElement;a&&(this.statusOverlay=new fa(a))}this.RUN_PIXEL_TICKERS&&(this.pixelTickers=K.createInAllCorners(this.video)),this.applyImageOverridesFromOptions(),this.flushPendingOverrides(),this.fetchGameParams(),window.BB.playerInstances.push(this),document.addEventListener("visibilitychange",this.handleVisibilityChange)})}onNewMetadata(e){!this.adapter||this.options.BURNED_TIMECODES_MODE||this.adapter.onNewMetadata(e)}onNewSegment(e){!this.adapter||this.options.BURNED_TIMECODES_MODE||this.adapter.onNewSegmentForMetadata(e)}onAdEvent(e){console.log(`[OTTPlayer] onAdEvent: ${e}`),!(!this.adapter||this.options.BURNED_TIMECODES_MODE)&&this.adapter.onAdEvent(e)}async fetchUrlConfig(e){try{if(!this.options.urlConfigURL){y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] No urlConfigURL provided, skipping URL config fetch");return}y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Fetching URL config from:",this.options.urlConfigURL);const r=await fetch(this.options.urlConfigURL);if(!r.ok)throw new Error(`Failed to fetch URL config: ${r.status} ${r.statusText}`);const n=await r.json();if(!n||typeof n!="object")throw new Error("Invalid URL config structure: not an object");const s=this.options.env;if(!n[s])throw new Error(`Environment '${s}' not found in URL config`);const i=n[s];if(!i.gameBaseUrl||!i.zipBaseUrl||!i.adsBaseUrl)throw new Error(`Missing required URLs in environment '${s}' config`);e!=null&&e.gameBaseURL||(this.options.gameBaseURL=i.gameBaseUrl),e!=null&&e.zipBaseURL||(this.options.zipBaseURL=i.zipBaseUrl),e!=null&&e.adsBaseURL||(this.options.adsBaseURL=i.adsBaseUrl),y(this.options,"OTTPlayer")&&(console.log("[OTTPlayer] URL config loaded successfully for environment:",s),console.log("[OTTPlayer] Updated URLs:",{gameBaseURL:this.options.gameBaseURL,zipBaseURL:this.options.zipBaseURL,adsBaseURL:this.options.adsBaseURL}))}catch(r){y(this.options,"OTTPlayer")&&(console.warn("[OTTPlayer] Failed to fetch URL config:",r),console.log("[OTTPlayer] Using default URLs from options"))}}handleOttActions(e,r){if(!this.clocker||this.options.BURNED_TIMECODES_MODE)return;const n=e.headers.get("x-tgi-ott-actions");let s;if(n?s=JSON.parse(n):s={toggle:{ios:!0,android:!0,web:!0}},!this.ottActions||this.ottActions.toggle.web!==s.toggle.web||s.toggle[r.customerId]!==void 0&&(this.ottActions.toggle[r.customerId]===void 0||this.ottActions.toggle[r.customerId]!==s.toggle[r.customerId])||s.toggle[r.customerId]===void 0&&this.ottActions.toggle[r.customerId]!==void 0){const o=s.toggle[r.customerId]!==void 0?s.toggle[r.customerId]&&s.toggle.web:s.toggle.web;this.ottActions&&this.logger.info("didToggleGlobalAugmentationDrawing",{isEnabled:o}),s.toggle.local=this.options.enabled,this.ottActions=s,console.warn("[OTTPlayer] ottActions",s)}}toggle(e){this.options.enabled=e,this.ottActions&&(this.ottActions.toggle.local=e,this.logger.info("didToggleGlobalAugmentationDrawing",{isEnabled:e}))}setFps(e){this.fps=e}setMediaInfo(e){e.fps&&this.setFps(e.fps),e.bitrate&&(this.bitrate=e.bitrate)}setAd(e,r,n=""){if(e===void 0){if(!this.clocker){this.pendingAdBlob=void 0,this.pendingAdBitmap=void 0,this.pendingAdPlaceholder=void 0,this.pendingAdClickUrl=void 0;return}this.clocker.resetAds(r);return}if(e===null){if(!this.clocker){this.pendingAdBlob=void 0,this.pendingAdBitmap=void 0,this.pendingAdPlaceholder=void 0,this.pendingAdClickUrl=void 0;return}this.clocker.clearAd(r);return}if(typeof e=="string"){let s;try{s=new URL(e,document.baseURI).toString()}catch(i){y(this.options,"Errors")&&console.error("[OTTPlayer] Invalid ad URL passed to setAd",e,i);return}fetch(s,{cache:"no-store"}).then(i=>i.blob()).then(async i=>{if(!this.clocker){this.pendingAdBlob=i,this.pendingAdPlaceholder=r,this.pendingAdClickUrl=n;return}this.clocker.setAdBlob(i,r,n)}).catch(i=>{y(this.options,"Errors")&&console.error("[OTTPlayer] Failed to fetch ad image from URL in setAd",s,i)});return}if(!this.clocker){if(e instanceof Blob)this.pendingAdBlob=e;else{if(this.pendingAdBitmap)try{this.pendingAdBitmap.close()}catch{}this.pendingAdBitmap=e}this.pendingAdPlaceholder=r,this.pendingAdClickUrl=n;return}if(e instanceof Blob){this.clocker.setAdBlob(e,r,n);return}else this.clocker.setAdImage(e,r,n)}setLED(e){if(e===null){if(!this.clocker){this.pendingLEDBlob=void 0,this.pendingLEDBitmap=void 0;return}this.clocker.clearLED();return}if(typeof e=="string"){let r;try{r=new URL(e,document.baseURI).toString()}catch(n){y(this.options,"Errors")&&console.error("[OTTPlayer] Invalid LED URL passed to setLED",e,n);return}fetch(r,{cache:"no-store"}).then(n=>n.blob()).then(n=>{if(!this.clocker){this.pendingLEDBlob=n;return}this.clocker.setLEDBlob(n)}).catch(n=>{y(this.options,"Errors")&&console.error("[OTTPlayer] Failed to fetch LED image from URL in setLED",r,n)});return}if(!this.clocker){if(e instanceof Blob)this.pendingLEDBlob=e;else if(e){if(this.pendingLEDBitmap)try{this.pendingLEDBitmap.close()}catch{}this.pendingLEDBitmap=e}return}e instanceof Blob?this.clocker.setLEDBlob(e):e&&this.clocker.setLEDImage(e)}async applyImageOverridesFromOptions(){try{const e=[];this.options.OVERRIDE_AD&&e.push(this.applySingleOverride(this.options.OVERRIDE_AD,"ad")),this.options.OVERRIDE_LED&&e.push(this.applySingleOverride(this.options.OVERRIDE_LED,"led")),await Promise.all(e)}catch(e){y(this.options,"Errors")&&console.error("[OTTPlayer] Failed to apply image overrides",e)}}async applySingleOverride(e,r){let n;if(typeof e=="string")try{const s=new URL(e,document.baseURI).toString();n=await(await fetch(s,{cache:"no-store"})).blob()}catch(s){y(this.options,"Errors")&&console.error(`[OTTPlayer] Failed to fetch override ${r} from URL`,e,s);return}else n=e;if(n){if(!this.clocker){r==="ad"?this.pendingAdBlob=n:this.pendingLEDBlob=n;return}r==="ad"?this.clocker.setAdBlob(n):this.clocker.setLEDBlob(n)}}flushPendingOverrides(){if(this.clocker){if(this.pendingAdBitmap){const e=this.pendingAdBitmap;this.pendingAdBitmap=void 0;const r=this.pendingAdClickUrl;this.pendingAdClickUrl=void 0,this.clocker.setAdImage(e,this.pendingAdPlaceholder,r),this.pendingAdPlaceholder=void 0}else if(this.pendingAdBlob){const e=this.pendingAdBlob;this.pendingAdBlob=void 0;const r=this.pendingAdClickUrl;this.pendingAdClickUrl=void 0,this.clocker.setAdBlob(e,this.pendingAdPlaceholder,r),this.pendingAdPlaceholder=void 0}if(this.pendingLEDBitmap){const e=this.pendingLEDBitmap;this.pendingLEDBitmap=void 0,this.clocker.setLEDImage(e)}else if(this.pendingLEDBlob){const e=this.pendingLEDBlob;this.pendingLEDBlob=void 0,this.clocker.setLEDBlob(e)}}}onTabHidden(){var e,r,n;y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Tab hidden - pausing all components"),this.fetchGameParamsTimeoutId&&(window.clearTimeout(this.fetchGameParamsTimeoutId),this.fetchGameParamsTimeoutId=void 0),(e=this.clocker)==null||e.pause(),(r=this.adapter)==null||r.pause(),(n=this.statusOverlay)==null||n.pause()}onTabVisible(){var e,r,n;y(this.options,"OTTPlayer")&&console.log("[OTTPlayer] Tab visible - resuming all components"),(e=this.clocker)==null||e.resume(),(r=this.adapter)==null||r.resume(),(n=this.statusOverlay)==null||n.resume(),this.fetchGameParams()}on(e,r){this.logger.addEventListener(e,r)}off(e,r){this.logger.removeEventListener(e,r)}destroy(){var r;document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.fetchGameParamsTimeoutId&&(window.clearTimeout(this.fetchGameParamsTimeoutId),this.fetchGameParamsTimeoutId=void 0),(r=this.clocker)==null||r.delete(),this.clocker=void 0,this.adapter&&(this.adapter.delete(),this.adapter=void 0),this.cloudFrontAuth&&(this.cloudFrontAuth.destroy(),this.cloudFrontAuth=void 0),this.statusOverlay&&(this.statusOverlay.delete(),this.statusOverlay=void 0),K.deleteAll(this.pixelTickers),this.pixelTickers=[],this.logger.removeAllEventListeners();const e=window.BB.playerInstances.indexOf(this);e>=0&&window.BB.playerInstances.splice(e,1)}}return window.BB={OTTPlayer:rn,playerInstances:[],workerInstances:[]},rn});
|