vendor: 5,492 bytes, lines 1-9
1var HD=Object.defineProperty;var VD=(n,e,t)=>e in n?HD(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var we=(n,e,t)=>VD(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();function Hb(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vb={exports:{}},Jf={},Wb={exports:{}},Ae={};/** 2 * @license React 3 * react.production.min.js 4 * 5 * Copyright (c) Facebook, Inc. and its affiliates. 6 * 7 * This source code is licensed under the MIT license found in the 8 * LICENSE file in the root directory of this source tree. 9 */var bu=Symbol.for("react.element"),WD=Symbol.for("react.portal"),zD=Symbol.for("react.fragment"),KD=Symbol.for("react.strict_mode"),qD=Symbol.for("react.profiler"),YD=Symbol.for("react.provider"),XD=Symbol.for("react.context"),QD=Symbol.for("react.forward_ref"),JD=Symbol.for("react.suspense"),ZD=Symbol.for("react.memo"),eP=Symbol.for("react.lazy"),CS=Symbol.iterator;function tP(n){return n===null||typeof n!="object"?null:(n=CS&&n[CS]||n["@@iterator"],typeof n=="function"?n:null)}var zb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Kb=Object.assign,qb={};function yo(n,e,t){this.props=n,this.context=e,this.refs=qb,this.updater=t||zb}yo.prototype.isReactComponent={};yo.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};yo.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Yb(){}Yb.prototype=yo.prototype;function J0(n,e,t){this.props=n,this.context=e,this.refs=qb,this.updater=t||zb}var Z0=J0.prototype=new Yb;Z0.constructor=J0;Kb(Z0,yo.prototype);Z0.isPureReactComponent=!0;var kS=Array.isArray,Xb=Object.prototype.hasOwnProperty,ey={current:null},Qb={key:!0,ref:!0,__self:!0,__source:!0};function Jb(n,e,t){var r,i={},s=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)Xb.call(e,r)&&!Qb.hasOwnProperty(r)&&(i[r]=e[r]);var o=arguments.length-2;if(o===1)i.children=t;else if(1<o){for(var l=Array(o),u=0;u<o;u++)l[u]=arguments[u+2];i.children=l}if(n&&n.defaultProps)for(r in o=n.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return{$$typeof:bu,type:n,key:s,ref:a,props:i,_owner:ey.current}}function nP(n,e){return{$$typeof:bu,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function ty(n){return typeof n=="object"&&n!==null&&n.$$typeof===bu}function rP(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var DS=/\/+/g;function ip(n,e){return typeof n=="object"&&n!==null&&n.key!=null?rP(""+n.key):e.toString(36)}function Zc(n,e,t,r,i){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var a=!1;if(n===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(n.$$typeof){case bu:case WD:a=!0}}if(a)return a=n,i=i(a),n=r===""?"."+ip(a,0):r,kS(i)?(t="",n!=null&&(t=n.replace(DS,"$&/")+"/"),Zc(i,e,t,"",function(u){return u})):i!=null&&(ty(i)&&(i=nP(i,t+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(DS,"$&/")+"/")+n)),e.push(i)),1;if(a=0,r=r===""?".":r+":",kS(n))for(var o=0;o<n.length;o++){s=n[o];var l=r+ip(s,o);a+=Zc(s,e,t,l,i)}else if(l=tP(n),typeof l=="function")for(n=l.call(n),o=0;!(s=n.next()).done;)s=s.value,l=r+ip(s,o++),a+=Zc(s,e,t,l,i);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function Yu(n,e,t){if(n==null)return n;var r=[],i=0;return Zc(n,r,"","",function(s){return e.call(t,s,i++)}),r}function iP(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var nn={current:null},ed={transition:null},sP={ReactCurrentDispatcher:nn,ReactCurrentBatchConfig:ed,ReactCurrentOwner:ey};function Zb(){throw Error("act(...) is not supported in production builds of React.")}Ae.Children={map:Yu,forEach:function(n,e,t){Yu(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return Yu(n,function(){e++}),e},toArray:function(n){return Yu(n,function(e){return e})||[]},only:function(n){if(!ty(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Ae.Component=yo;Ae.Fragment=zD;Ae.Profiler=qD;Ae.PureComponent=J0;Ae.StrictMode=KD;Ae.Suspense=JD;
9Ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sP;Ae.act=Zb;Ae.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var r=Kb({},n.props),i=n.key,s=n.ref,a=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=ey.current),e.key!==void 0&&(i=""+e.key),n.type&&n.type.defaultProps)var o=n.type.defaultProps;for(l in e)Xb.call(e,l)&&!Qb.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=t;else if(1<l){o=Array(l);for(var u=0;u<l;u++)o[u]=arguments[u+2];r.children=o}return{$$typeof:bu,type:n.type,key:i,ref:s,props:r,_owner:a}};Ae.createContext=function(n){return n={$$typeof:XD,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:YD,_context:n},n.Consumer=n};Ae.createElement=Jb;Ae.createFactory=function(n){var e=Jb.bind(null,n);return e.type=n,e};Ae.createRef=function(){return{current:null}};Ae.forwardRef=function(n){return{$$typeof:QD,render:n}};Ae.isValidElement=ty;Ae.lazy=function(n){return{$$typeof:eP,_payload:{_status:-1,_result:n},_init:iP}};Ae.memo=function(n,e){return{$$typeof:ZD,type:n,compare:e===void 0?null:e}};Ae.startTransition=function(n){var e=ed.transition;ed.transition={};try{n()}finally{ed.transition=e}};Ae.unstable_act=Zb;Ae.useCallback=function(n,e){return nn.current.useCallback(n,e)};Ae.useContext=function(n){return nn.current.useContext(n)};Ae.useDebugValue=function(){};Ae.useDeferredValue=function(n){return nn.current.useDeferredValue(n)};Ae.useEffect=function(n,e){return nn.current.useEffect(n,e)};Ae.useId=function(){return nn.current.useId()};Ae.useImperativeHandle=function(n,e,t){return nn.current.useImperativeHandle(n,e,t)};Ae.useInsertionEffect=function(n,e){return nn.current.useInsertionEffect(n,e)};Ae.useLayoutEffect=function(n,e){return nn.current.useLayoutEffect(n,e)};Ae.useMemo=function(n,e){return nn.current.useMemo(n,e)};Ae.useReducer=function(n,e,t){return nn.current.useReducer(n,e,t)};Ae.useRef=function(n){return nn.current.useRef(n)};Ae.useState=function(n){return nn.current.useState(n)};Ae.useSyncExternalStore=function(n,e,t){return nn.current.useSyncExternalStore(n,e,t)};Ae.useTransition=function(){return nn.current.useTransition()};Ae.version="18.3.1";Wb.exports=Ae;var P=Wb.exports;const aP=Hb(P);/** 10 * @license React 11 * react-jsx-runtime.production.min.js 12 * 13 * Copyright (c) Facebook, Inc. and its affiliates. 14 * 15 * This source code is licensed under the MIT license found in the 16 * LICENSE file in the root directory of this source tree. 17 */var oP=P,lP=Symbol.for("react.element"),uP=Symbol.for("react.fragment"),cP=Object.prototype.hasOwnProperty,dP=oP.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fP={key:!0,ref:!0,__self:!0,__source:!0};function eI(n,e,t){var r,i={},s=null,a=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(a=e.ref);for(r in e)cP.call(e,r)&&!fP.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:lP,type:n,key:s,ref:a,props:i,_owner:dP.current}}Jf.Fragment=uP;Jf.jsx=eI;Jf.jsxs=eI;Vb.exports=Jf;var _=Vb.exports;const se=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ie=globalThis,Ps="10.75.0";function as(){return Iu(Ie),Ie}function Iu(n){const e=n.__SENTRY__=n.__SENTRY__||{};return e.version=e.version||Ps,e[Ps]=e[Ps]||{}}function vo(n,e,t=Ie){const r=t.__SENTRY__=t.__SENTRY__||{},i=r[Ps]=r[Ps]||{};return i[n]||(i[n]=e())}const hP=["debug","info","warn","error","log","assert","trace"],pP="Sentry Logger ",kd={};function mi(n){if(!("console"in Ie))return n();const e=Ie.console,t={},r=Object.keys(kd);r.forEach(i=>{const s=kd[i];t[i]=e[i],e[i]=s});try{return n()}finally{r.forEach(i=>{e[i]=t[i]})}}function mP(){ry().enabled=!0}function gP(){ry().enabled=!1}function tI(){return ry().enabled}function yP(...n){ny("log",...n)}function vP(...n){ny("warn",...n)}function SP(...n){ny("error",...n)}function ny(n,...e){se&&tI()&&mi(()=>{Ie.console[n](`${pP}[${n}]:`,...e)})}function ry(){return se?vo("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const K={enable:mP,disable:gP,isEnabled:tI,log:yP,warn:vP,error:SP},nI=50,Gs="?",PS=/\(error: (.*)\)/,OS=/captureMessage|captureException/;function rI(...n){const e=n.sort((t,r)=>t[0]-r[0]).map(t=>t[1]);return(t,r=0,i=0)=>{const s=[],a=t.split(` 18`);for(let o=r;o<a.length;o++){let l=a[o];l.length>1024&&(l=l.slice(0,1024));const u=PS.test(l)?l.replace(PS,"$1"):l;if(!u.includes("Error: ")){for(const c of e){const d=c(u);if(d){s.push(d);break}}if(s.length>=nI+i)break}}return xP(s.slice(i))}}function EP(n){return Array.isArray(n)?rI(...n):n}function xP(n){if(!n.length)return[];const e=Array.from(n);return/sentryWrapped/.test(Xu(e).function||"")&&e.pop(),e.reverse(),OS.test(Xu(e).function||"")&&(e.pop(),OS.test(Xu(e).function||"")&&e.pop()),e.slice(0,nI).map(t=>({...t,filename:t.filename||Xu(e).filename,function:t.function||Gs}))}function Xu(n){return n[n.length-1]||{}}const sp="<anonymous>";function ui(n){try{return!n||typeof n!="function"?sp:n.name||sp}catch{return sp}}function MS(n){const e=n.exception;if(e){const t=[];
18try{return e.values.forEach(r=>{r.stacktrace.frames&&t.push(...r.stacktrace.frames)}),t}catch{return}}}const Zo={},FS={};function os(n,e){return Zo[n]=Zo[n]||[],Zo[n].push(e),()=>{const t=Zo[n];if(t){const r=t.indexOf(e);r!==-1&&t.splice(r,1)}}}function ls(n,e){if(!FS[n]){FS[n]=!0;try{e()}catch(t){se&&K.error(`Error while instrumenting ${n}`,t)}}}function Gn(n,e){const t=n&&Zo[n];if(t)for(const r of t)try{r(e)}catch(i){se&&K.error(`Error while triggering instrumentation handler. 19Type: ${n} 20Name: ${ui(r)} 21Error:`,i)}}let ap=null;function iI(n){const e="error";os(e,n),ls(e,TP)}function TP(){ap=Ie.onerror,Ie.onerror=function(n,e,t,r,i){return Gn("error",{column:r,error:i,line:t,msg:n,url:e}),ap?ap.apply(this,arguments):!1},Ie.onerror.__SENTRY_INSTRUMENTED__=!0}let op=null;function sI(n){const e="unhandledrejection";os(e,n),ls(e,_P)}function _P(){op=Ie.onunhandledrejection,Ie.onunhandledrejection=function(n){return Gn("unhandledrejection",n),op?op.apply(this,arguments):!0},Ie.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const aI=Object.prototype.toString;function Br(n){switch(aI.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return th(n,Error)}}function So(n,e){return aI.call(n)===`[object ${e}]`}function oI(n){return So(n,"ErrorEvent")}function NS(n){return So(n,"DOMError")}function bP(n){return So(n,"DOMException")}function ri(n){return So(n,"String")}function Zf(n){return typeof n=="object"&&n!==null&&"__sentry_template_string__"in n&&"__sentry_template_values__"in n}function js(n){return n===null||Zf(n)||typeof n!="object"&&typeof n!="function"}function kl(n){return So(n,"Object")}function Zs(n){return typeof n=="object"&&n!==null}function eh(n){return typeof Event<"u"&&th(n,Event)}function IP(n){return So(n,"RegExp")}function wu(n){return!!(n?.then&&typeof n.then=="function")}function th(n,e){try{return n instanceof e}catch{return!1}}function iy(n){return typeof Request<"u"&&th(n,Request)}function cn(n,e,t){if(!(e in n))return;const r=n[e];if(typeof r!="function")return;const i=t(r);typeof i=="function"&&lI(i,r);try{n[e]=i}catch{se&&K.log(`Failed to replace method "${e}" in object`,n)}}function Kt(n,e,t){try{Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0})}catch{se&&K.log(`Failed to add non-enumerable property "${String(e)}" to object`,n)}}function lI(n,e){try{const t=e.prototype||{};n.prototype=e.prototype=t,Kt(n,"__sentry_original__",e)}catch{}}function sy(n){return n.__sentry_original__}function uI(n){if(Br(n))return{message:n.message,name:n.name,stack:n.stack,...US(n)};if(eh(n)){const{type:e,target:t,currentTarget:r,detail:i}=n;return{type:e,target:t,currentTarget:r,...i?{detail:i}:{},...US(n)}}return n}function US(n){return Zs(n)?Object.fromEntries(Object.entries(n)):{}}function wP(n){const e=Object.keys(uI(n));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}let sa;function Ru(n){if(sa!==void 0)return sa?sa(n):n();const e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),t=Ie;return e in t&&typeof t[e]=="function"?(sa=t[e],sa(n)):(sa=null,n())}function Bi(){return Ru(()=>Math.random())}function us(){return Ru(()=>Date.now())}const RP=Symbol.for("sentry.skipNormalization"),AP=Symbol.for("sentry.overrideNormalizationDepth");function LP(n){return!!n[RP]}function CP(n){const e=n[AP];return typeof e=="number"?e:void 0}let Wm;function cI(n){Wm=n}function ar(n,e=100,t=1/0){try{return zm("",n,e,t)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function dI(n,e=3,t=100*1024){const r=ar(n,e);return PP(r)>t?dI(n,e-1,t):r}function zm(n,e,t=1/0,r=1/0,i=OP()){const[s,a]=i;
21if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const o=fI(n,e);if(!o.startsWith("[object "))return o;if(LP(e))return e;const l=CP(e),u=l!==void 0?l:t;if(u===0)return o.replace("object ","");if(s(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{const p=c.toJSON();return zm("",p,u-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let f=0;const h=uI(e);for(const p in h){if(!Object.prototype.hasOwnProperty.call(h,p))continue;if(f>=r){d[p]="[MaxProperties ~]";break}const m=h[p];d[p]=zm(p,m,u-1,r,i),f++}return a(e),d}function fI(n,e){try{if(Wm){const r=Wm(e);if(r)return r}return typeof global<"u"&&e===global?"[Global]":typeof e=="number"&&!Number.isFinite(e)?`[${e}]`:typeof e=="function"?`[Function: ${ui(e)}]`:typeof e=="symbol"?`[${String(e)}]`:typeof e=="bigint"?`[BigInt: ${String(e)}]`:`[object ${kP(e)}]`}catch(t){return`**non-serializable** (${t})`}}function kP(n){const e=Object.getPrototypeOf(n);return e?.constructor?e.constructor.name:"null prototype"}function DP(n){return~-encodeURI(n).split(/%..|./).length}function PP(n){return DP(JSON.stringify(n))}function OP(){const n=new WeakSet;function e(r){return n.has(r)?!0:(n.add(r),!1)}function t(r){n.delete(r)}return[e,t]}function Km(n,e=0){return typeof n!="string"||e===0||n.length<=e?n:`${n.slice(0,e)}...`}function BS(n,e){if(!Array.isArray(n))return"";const t=[];for(let r=0;r<n.length;r++){const i=n[r];js(i)?t.push(String(i)):i instanceof Error?t.push(i.message?`${i.name}: ${i.message}`:i.name):t.push(fI(void 0,i))}return t.join(e)}function ul(n,e,t=!1){return ri(n)?IP(e)?e.test(n):ri(e)?t?n===e:n.includes(e):typeof e=="function"?e(n):!1:!1}function Fr(n,e=[],t=!1){for(const r of e)if(ul(n,r,t))return!0;return!1}function MP(){const n=Ie;return n.crypto||n.msCrypto}let lp;function FP(){return Bi()*16}function _n(n=MP()){try{if(n?.randomUUID)return Ru(()=>n.randomUUID()).replace(/-/g,"")}catch{}return lp||(lp="10000000100040008000"+1e11),lp.replace(/[018]/g,e=>(e^(FP()&15)>>e/4).toString(16))}function hI(n){return n.exception?.values?.[0]}function ws(n){const{message:e,event_id:t}=n;if(e)return e;const r=hI(n);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||t||"<unknown>":t||"<unknown>"}function qm(n,e,t){const r=n.exception=n.exception||{},i=r.values=r.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type="Error")}function Os(n,e){const t=hI(n);if(!t)return;const r={type:"generic",handled:!0},i=t.mechanism;if(t.mechanism={...r,...i,...e},e&&"data"in e){const s={...i?.data,...e.data};t.mechanism.data=s}}function $S(n){if(NP(n))return!0;try{Kt(n,"__sentry_captured__",!0)}catch{}return!1}function NP(n){try{return n.__sentry_captured__}catch{}}const pI=1e3;function ea(){return us()/pI}function UP(){const{performance:n}=Ie;if(!n?.now||!n.timeOrigin)return ea;const e=n.timeOrigin;return()=>(e+Ru(()=>n.now()))/pI}let GS;function Tt(){return(GS??(GS=UP()))()}let up=null;function BP(){const{performance:n}=Ie;if(!n?.now)return;const e=3e5,t=Ru(()=>n.now()),r=us(),i=n.timeOrigin;if(typeof i=="number"&&Math.abs(i+t-r)<e)return i;const s=n.timing?.navigationStart;return typeof s=="number"&&Math.abs(s+t-r)<e?s:r-t}function Dt(){return up===null&&(up=BP()),up}function $P(n){const e=Tt(),t={sid:_n(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>jP(t)};return n&&qa(t,n),t}function qa(n,e={}){if(e.user&&(!n.ipAddress&&e.user.ip_address&&(n.ipAddress=e.user.ip_address),!n.did&&!e.did&&(n.did=e.user.id||e.user.email||e.user.username)),n.timestamp=e.timestamp||Tt(),e.abnormal_mechanism&&(n.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(n.ignoreDuration=e.ignoreDuration),e.sid&&(n.sid=e.sid.length===32?e.sid:_n()),e.init!==void 0&&(n.init=e.init),!n.did&&e.did&&(n.did=`${e.did}`),typeof e.started=="number"&&(n.started=e.started),n.ignoreDuration)n.duration=void 0;else if(typeof e.duration=="number")n.duration=e.duration;else{const t=n.timestamp-n.started;n.duration=t>=0?t:0}e.release&&(n.release=e.release),e.environment&&(n.environment=e.environment),!n.ipAddress&&e.ipAddress&&(n.ipAddress=e.ipAddress),!n.userAgent&&e.userAgent&&(n.userAgent=e.userAgent),t
21ypeof e.errors=="number"&&(n.errors=e.errors),e.status&&(n.status=e.status)}function GP(n,e){let t={};n.status==="ok"&&(t={status:"exited"}),qa(n,t)}function jP(n){return{sid:`${n.sid}`,init:n.init,started:new Date(n.started*1e3).toISOString(),timestamp:new Date(n.timestamp*1e3).toISOString(),status:n.status,errors:n.errors,did:typeof n.did=="number"||typeof n.did=="string"?`${n.did}`:void 0,duration:n.duration,abnormal_mechanism:n.abnormal_mechanism,attrs:{release:n.release,environment:n.environment,ip_address:n.ipAddress,user_agent:n.userAgent}}}function Au(n,e,t=2){if(!e||typeof e!="object"||t<=0)return e;if(n&&Object.keys(e).length===0)return n;const r={...n};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=Au(r[i],e[i],t-1));return r}function Ji(){return _n()}function Zi(){return _n().substring(16)}function mI(n){try{const e=Ie.WeakRef;if(typeof e=="function")return new e(n)}catch{}return n}function gI(n){if(n){if(typeof n=="object"&&"deref"in n&&typeof n.deref=="function")try{return n.deref()}catch{return}return n}}const Ym="_sentrySpan";function Dl(n,e){e?Kt(n,Ym,mI(e)):delete n[Ym]}function Pl(n){return gI(n[Ym])}const HP=100;class $r{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ji(),sampleRand:Bi()}}clone(){const e=new $r;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,Dl(e,Pl(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&qa(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t=typeof e=="function"?e(this):e,r=t instanceof $r?t.getScopeData():kl(t)?e:void 0,{tags:i,attributes:s,extra:a,user:o,contexts:l,level:u,fingerprint:c=[],propagationContext:d,conversationId:f}=r||{};return this._tags={...this._tags,...i},this._attributes={...this._attributes,...s},this._extra={...this._extra,...a},this._contexts={...this._contexts,...l},o&&Object.keys(o).length&&(this._user=o),u&&(this._level=u),c.length&&(this._fingerprint=c),d&&(this._propagationContext=d),f&&(this._conversationId=f),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Dl(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ji(),sampleRand:Bi()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const r=typeof t=="number"?t:HP;if(r<=0)return this;const i={timestamp:ea(),...e,message:e.message?Km(e.message,2048):e.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Pl(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Au(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t?.event_id||_n();if(!this._client)return se&&K.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...t,event_id:r},this),r}captureMessage(e,t,r){const i=r?.event_id||_n();if(!this._client)return se&&K.warn("No client configured on scope - will not capture message!"),i;const s=r?.syntheticException??new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:s,...r,event_id:i},this),i}captureEvent(e,t){const r=e.event_id||t?.event_id||_n();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(se&&K.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEac
21h(e=>{e(this)}),this._notifyingListeners=!1)}}function VP(){return vo("defaultCurrentScope",()=>new $r)}function WP(){return vo("defaultIsolationScope",()=>new $r)}const jS=n=>n instanceof Promise&&!n[yI],yI=Symbol("chained PromiseLike"),zP=(n,e,t)=>{const r=n.then(i=>(e(i),i),i=>{throw t(i),i});return jS(r)&&jS(n)?r:KP(n,r)},KP=(n,e)=>{if(!e)return n;let t=!1;for(const r in n){if(r in e)continue;t=!0;const i=n[r];typeof i=="function"?Object.defineProperty(e,r,{value:(...s)=>i.apply(n,s),enumerable:!0,configurable:!0,writable:!0}):e[r]=i}return t&&Object.assign(e,{[yI]:!0}),e};class qP{constructor(e,t){let r;e?r=e:r=new $r;let i;t?i=t:i=new $r,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(i){throw this._popScope(),i}return wu(r)?zP(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Ya(){const n=as(),e=Iu(n);return e.stack=e.stack||new qP(VP(),WP())}function YP(n){return Ya().withScope(n)}function XP(n,e){const t=Ya();return t.withScope(()=>(t.getStackTop().scope=n,e(n)))}function HS(n){return Ya().withScope(()=>n(Ya().getIsolationScope()))}function QP(){return{withIsolationScope:HS,withScope:YP,withSetScope:XP,withSetIsolationScope:(n,e)=>HS(e),getCurrentScope:()=>Ya().getScope(),getIsolationScope:()=>Ya().getIsolationScope()}}function Eo(n){const e=Iu(n);return e.acs?e.acs:QP()}function JP(n){return typeof n=="object"&&n!=null&&!Array.isArray(n)&&Object.keys(n).includes("value")}function ZP(n,e){const{value:t,unit:r}=JP(n)?n:{value:n,unit:void 0},i=eO(t),s=r&&typeof r=="string"?{unit:r}:{};if(i)return{...i,...s};if(!e||e==="skip-undefined"&&t===void 0)return;let a="";try{a=JSON.stringify(t)??""}catch{}return{value:a,type:"string",...s}}function Dd(n,e=!1){const t={};for(const[r,i]of Object.entries(n??{})){const s=ZP(i,e);s&&(t[r]=s)}return t}function eO(n){if(Array.isArray(n))return{value:n,type:"array"};const e=typeof n=="string"?"string":typeof n=="boolean"?"boolean":typeof n=="number"&&!Number.isNaN(n)?Number.isInteger(n)?"integer":"double":null;if(e)return{value:n,type:e}}function Le(){const n=as();return Eo(n).getCurrentScope()}function rn(){const n=as();return Eo(n).getIsolationScope()}function tO(){return vo("globalScope",()=>new $r)}function Lu(...n){const e=as(),t=Eo(e);if(n.length===2){const[r,i]=n;return r?t.withSetScope(r,i):t.withScope(i)}return t.withScope(n[0])}function Se(){return Le().getClient()}function vI(n){const e=n.getPropagationContext(),{traceId:t,parentSpanId:r,propagationSpanId:i}=e,s={trace_id:t,span_id:i||Zi()};return r&&(s.parent_span_id=r),s}const Bn="sentry.source",ay="sentry.sample_rate",SI="sentry.previous_trace_sample_rate",wn="sentry.op",gt="sentry.origin",nO="sentry.status.message",Ol="sentry.idle_span_finish_reason",Cu="sentry.measurement_unit",ku="sentry.measurement_value",VS="sentry.custom_span_name",oy="sentry.profile_id",cs="sentry.exclusive_time",rO="sentry.link.type",iO="gen_ai.conversation.id",EI=0,nh=1,Lt=2;function sO(n){if(n<400&&n>=100)return{code:nh};if(n>=400&&n<500)switch(n){case 401:return{code:Lt,message:"unauthenticated"};case 403:return{code:Lt,message:"permission_denied"};case 404:return{code:Lt,message:"not_found"};case 409:return{code:Lt,message:"already_exists"};case 413:return{code:Lt,message:"failed_precondition"};case 429:return{code:Lt,message:"resource_exhausted"};case 499:return{code:Lt,message:"cancelled"};default:return{code:Lt,message:"invalid_argument"}}if(n>=500&&n<600)switch(n){case 501:return{code:Lt,message:"unimplemented"};case 503:return{code:Lt,message:"unavailable"};case 504:return{code:Lt,message:"deadline_exceeded"};default:return{code:Lt,message:"internal_error"}}return{code:Lt,message:"internal_error"}}function xI(n,e){n.setAttribute("http.response.status_code",e);const t=sO(e);t.message!=="unknown_error"&&n.setStatus(t)}const TI="_sentryScope",_I="_sentryIsolationScope",aO=Symbol.for("sentry.otelSourceInference"),oO=Symbol.for("sentry.otelSourceExplicitlySet"),lO=Symbol.for("sentry.tracerProviderSpan");function Xa(n,e,t){n&&(Kt(n,_I,mI(t)),Kt(n,TI,e))}function Fa(n){const e=n;return{scope:e[TI],isolationScope:gI(e[_I])}}function WS(n){return n[aO]===!0}function uO(n){Kt(n,oO,!0)}function zS(n){return n[lO]===!0}const Pd="sentry-",cO=8192;function bI(n){const e=fO(n);if(!e)return;const t=Object.entries(e).reduce((r,[i,s])=>{if(i.startsWith(Pd)){const a=i.slice(Pd.length);r[a]=s}return r},{});if(Object.keys(t).length>0)return t}function dO(n){if(!n)return;const e=Object.entries(n).reduce((t,[r,i])=>(i&&(t[`${Pd}${r}`]=i),t),{});return hO(e)}function fO(n){if(!(!n||!ri(n)&&!Array.isArray(n)))return Array.isArray(n)?n.reduce((e,t)=>
21{const r=KS(t);return Object.entries(r).forEach(([i,s])=>{e[i]=s}),e},{}):KS(n)}function KS(n){return n.split(",").map(e=>{const t=e.indexOf("=");if(t===-1)return[];const r=e.slice(0,t),i=e.slice(t+1);return[r,i].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[t,r])=>(t&&r&&(e[t]=r),e),{})}function hO(n){if(Object.keys(n).length!==0)return Object.entries(n).reduce((e,[t,r],i)=>{const s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`,a=i===0?s:`${e},${s}`;return a.length>cO?(se&&K.warn(`Not adding key: ${t} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):a},"")}const pO=/^o(\d+)\./,mO=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function gO(n){return n==="http"||n==="https"}function ta(n,e=!1){const{host:t,path:r,pass:i,port:s,projectId:a,protocol:o,publicKey:l}=n;return`${o}://${l}${e&&i?`:${i}`:""}@${t}${s?`:${s}`:""}/${r&&`${r}/`}${a}`}function yO(n){const e=mO.exec(n);if(!e){mi(()=>{console.error(`Invalid Sentry Dsn: ${n}`)});return}const[t,r,i="",s="",a="",o=""]=e.slice(1);let l="",u=o;const c=u.split("/");if(c.length>1&&(l=c.slice(0,-1).join("/"),u=c.pop()),u){const d=u.match(/^\d+/);d&&(u=d[0])}return II({host:s,pass:i,path:l,projectId:u,port:a,protocol:t,publicKey:r})}function II(n){return{protocol:n.protocol,publicKey:n.publicKey||"",pass:n.pass||"",host:n.host,port:n.port||"",path:n.path||"",projectId:n.projectId}}function vO(n){if(!se)return!0;const{port:e,projectId:t,protocol:r}=n;return["protocol","publicKey","host","projectId"].find(a=>n[a]?!1:(K.error(`Invalid Sentry Dsn: ${a} missing`),!0))?!1:t.match(/^\d+$/)?gO(r)?e&&isNaN(parseInt(e,10))?(K.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(K.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(K.error(`Invalid Sentry Dsn: Invalid projectId ${t}`),!1)}function SO(n){return n.match(pO)?.[1]}function EO(n){const e=n.getOptions(),{host:t}=n.getDsn()||{};let r;return e.orgId?r=String(e.orgId):t&&(r=SO(t)),r}function wI(n){const e=typeof n=="string"?yO(n):II(n);if(!(!e||!vO(e)))return e}function Hs(n){if(typeof n=="boolean")return Number(n);const e=typeof n=="string"?parseFloat(n):n;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const RI=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function xO(n){if(!n)return;const e=n.match(RI);if(!e)return;let t;return e[3]==="1"?t=!0:e[3]==="0"&&(t=!1),{traceId:e[1],parentSampled:t,parentSpanId:e[2]}}function TO(n,e){const t=xO(n),r=bI(e);if(!t?.traceId)return{traceId:Ji(),sampleRand:Bi()};const i=_O(t,r);r&&(r.sample_rand=i.toString());const{traceId:s,parentSpanId:a,parentSampled:o}=t;return{traceId:s,parentSpanId:a,sampled:o,dsc:r||{},sampleRand:i}}function AI(n=Ji(),e=Zi(),t){let r="";return t!==void 0&&(r=t?"-1":"-0"),`${n}-${e}${r}`}function LI(n=Ji(),e=Zi(),t){return`00-${n}-${e}-${t?"01":"00"}`}function _O(n,e){const t=Hs(e?.sample_rand);if(t!==void 0)return t;const r=Hs(e?.sample_rate);return r&&n?.parentSampled!==void 0?n.parentSampled?Bi()*r:r+Bi()*(1-r):Bi()}const CI=0,rh=1;let qS=!1;function bO(n){const{spanId:e,traceId:t}=n.spanContext(),{data:r,op:i,parent_span_id:s,status:a,origin:o,links:l}=ke(n);return{parent_span_id:s,span_id:e,trace_id:t,data:r,op:i,status:a,origin:o,links:l}}function kI(n){const{spanId:e,traceId:t,isRemote:r}=n.spanContext(),i=r?e:ke(n).parent_span_id,s=Fa(n).scope,a=r?s?.getPropagationContext().propagationSpanId||Zi():e;return{parent_span_id:i,span_id:a,trace_id:t}}function IO(n){const{traceId:e,spanId:t}=n.spanContext(),r=gi(n);return AI(e,t,r)}function wO(n){const{traceId:e,spanId:t}=n.spanContext(),r=gi(n);return LI(e,t,r)}function DI(n){if(n&&n.length>0)return n.map(({context:{spanId:e,traceId:t,traceFlags:r,...i},attributes:s})=>({span_id:e,trace_id:t,sampled:r===rh,attributes:s,...i}))}function PI(n){if(n?.length)return n.map(({context:{spanId:e,traceId:t,traceFlags:r},attributes:i})=>({span_id:e,trace_id:t,sampled:r===rh,attributes:i}))}function ii(n){return typeof n=="number"?YS(n):Array.isArray(n)?n[0]+n[1]/1e9:n instanceof Date?YS(n.getTime()):Tt()}function YS(n){return n>9999999999?n/1e3:n}function ke(n){if(NI(n))return n.getSpanJSON();const{spanId:e,traceId:t}=n.spanContext();if(FI(n)){const{attributes:r,startTime:i,name:s,endTime:a,status:o,links:l}=n;return{span_id:e,trace_id:t,data:r,description:s,parent_span_id:M
21I(n),start_timestamp:ii(i),timestamp:ii(a)||void 0,status:UI(o),op:r[wn],origin:r[gt],links:DI(l)}}return{span_id:e,trace_id:t,start_timestamp:0,data:{}}}function OI(n){if(NI(n))return n.getStreamedSpanJSON();const{spanId:e,traceId:t}=n.spanContext();if(FI(n)){const{attributes:r,startTime:i,name:s,endTime:a,status:o,links:l}=n;return{name:s,span_id:e,trace_id:t,parent_span_id:MI(n),start_timestamp:ii(i),end_timestamp:ii(a),is_segment:n===Qm(n),status:ly(o),attributes:BI(r,o),links:PI(l)}}return{span_id:e,trace_id:t,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:n===Qm(n)}}function MI(n){return"parentSpanId"in n?n.parentSpanId:"parentSpanContext"in n?n.parentSpanContext?.spanId:void 0}function RO(n){return{...n,attributes:Dd(n.attributes),links:n.links?.map(e=>({...e,attributes:Dd(e.attributes)}))}}function FI(n){const e=n;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function NI(n){return typeof n.getSpanJSON=="function"}function gi(n){const{traceFlags:e}=n.spanContext();return e===rh}function UI(n){if(!(!n||n.code===EI))return n.code===nh?"ok":n.message||"internal_error"}function ly(n){return!n||n.code===nh||n.code===EI||n.message==="cancelled"?"ok":"error"}function BI(n,e){const t=ly(e)==="error"?e?.message:void 0;return{...t&&{[nO]:t},...n}}const Ms="_sentryChildSpans",Xm="_sentryRootSpan";function td(n,e){const t=n[Xm]||n;Kt(e,Xm,t),gi(n)&&(!n.isRecording()&&!t.isRecording()||(n[Ms]?n[Ms].add(e):Kt(n,Ms,new Set([e]))))}function AO(n,e){n[Ms]&&n[Ms].delete(e)}function nd(n){const e=new Set;function t(r){if(!e.has(r)&&gi(r)){e.add(r);const i=r[Ms]?Array.from(r[Ms]):[];for(const s of i)t(s)}}return t(n),Array.from(e)}const Ut=Qm;function Qm(n){return n[Xm]||n}function Gt(){const n=as(),e=Eo(n);return e.getActiveSpan?e.getActiveSpan():Pl(Le())}function Jm(){qS||(mi(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),qS=!0)}let XS=!1;function LO(){if(XS)return;function n(){const e=Gt(),t=e&&Ut(e);if(t){const r="internal_error";se&&K.log(`[Tracing] Root span: ${r} -> Global error occurred`),t.setStatus({code:Lt,message:r})}}XS=!0,iI(n),sI(n)}function Vn(n){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=n||Se()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function QS(n){K.log(`Ignoring span ${n.op} - ${n.description} because it matches \`ignoreSpans\`.`)}function Ml(n,e){if(!e?.length)return!1;for(const t of e){if(DO(t)){if(n.description&&ul(n.description,t))return se&&QS(n),!0;continue}const r=!!t.attributes&&Object.keys(t.attributes).length>0;if(!t.name&&!t.op&&!r)continue;const i=t.name?n.description&&ul(n.description,t.name):!0,s=t.op?n.op&&ul(n.op,t.op):!0,a=t.attributes?Object.entries(t.attributes).every(([o,l])=>CO(n.attributes?.[o],l)):!0;if(i&&s&&a)return se&&QS(n),!0}return!1}function CO(n,e){return typeof n=="string"&&(typeof e=="string"||e instanceof RegExp)?ul(n,e):Array.isArray(n)&&Array.isArray(e)?n.length===e.length&&n.every((t,r)=>t===e[r]):n===e}function kO(n,e){const t=e.parent_span_id,r=e.span_id;if(t)for(const i of n)i.parent_span_id===r&&(i.parent_span_id=t)}function DO(n){return typeof n=="string"||n instanceof RegExp}const $I=Symbol.for("sentry.nonRecordingSpan");class Vs{constructor(e={}){this._traceId=e.traceId||Ji(),this._spanId=e.spanId||Zi(),this.dropReason=e.dropReason,Kt(this,$I,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:CI}}end(e){}setAttribute(e,t){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,t,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,t){}}function Qa(n){return!!n&&n[$I]===!0}const uy="production",GI="_frozenDsc";function JS(n,e){Kt(n,GI,e)}function jI(n,e){const t=e.getOptions(),{publicKey:r}=e.getDsn()||{},i={environment:t.environment||uy,release:t.release,public_key:r,trace_id:n,org_id:EO(e)};return e.emit("createDsc",i),i}function ih(n,e){const t=e.getPropagationContext();return t.dsc||jI(t.traceId,n)}function yi(n){const e=Se();if(!e)return{};const t=Ut(n),r=ke(t),i=r.data,s=t.spanContext().traceState,a=s?.get("sentry.sample_rate")??i[ay]??i[SI];
21function o(g){return(typeof a=="number"||typeof a=="string")&&(g.sample_rate=`${a}`),g}const l=t[GI];if(l)return o(l);const u=Qa(t),c=u&&t.dropReason==="ignored";if(u&&(!Vn(e.getOptions())||c)){const g=Fa(t).scope;if(g){const y={...ih(e,g)};return c&&(y.sampled="false"),o(y)}}const d=s?.get("sentry.dsc"),f=d&&bI(d);if(f)return o(f);const h=jI(n.spanContext().traceId,e),p=i[Bn]??i["sentry.segment.name.source"],m=r.description;return p!=="url"&&m&&(h.transaction=m),Vn()&&(h.sampled=String(gi(t)),h.sample_rand=s?.get("sentry.sample_rand")??Fa(t).scope?.getPropagationContext().sampleRand.toString()),o(h),e.emit("createDsc",h,t),h}function HI(n){return!!n&&typeof n=="function"&&"_streamed"in n&&!!n._streamed}function ds(n,e=[]){return[n,e]}function ZS(n,e){const[t,r]=n;return[t,[...r,e]]}function Zm(n,e){const t=n[1];for(const r of t){const i=r[0].type;if(e(r,i))return!0}return!1}function PO(n,e){return Zm(n,(t,r)=>e.includes(r))}function eg(n){const e=Iu(Ie);return e.encodePolyfill?e.encodePolyfill(n):new TextEncoder().encode(n)}function OO(n){const[e,t]=n;let r=JSON.stringify(e);function i(s){typeof r=="string"?r=typeof s=="string"?r+s:[eg(r),s]:r.push(typeof s=="string"?eg(s):s)}for(const s of t){const[a,o]=s;if(i(` 22${JSON.stringify(a)} 23`),typeof o=="string"||o instanceof Uint8Array)i(o);else{let l;try{l=JSON.stringify(o)}catch{l=JSON.stringify(ar(o))}i(l)}}return typeof r=="string"?r:MO(r)}function MO(n){const e=n.reduce((i,s)=>i+s.length,0),t=new Uint8Array(e);let r=0;for(const i of n)t.set(i,r),r+=i.length;return t}function FO(n){return[{type:"span"},n]}
23function NO(n){const e=typeof n.data=="string"?eg(n.data):n.data;return[{type:"attachment",length:e.length,filename:n.filename,content_type:n.contentType,attachment_type:n.attachmentType},e]}const VI={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function UO(n){return n in VI}function eE(n){return UO(n)?VI[n]:n}function cy(n){if(!n?.sdk)return;const{name:e,version:t}=n.sdk;return{name:e,version:t}}function WI(n,e,t,r){const i=n.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:n.event_id,sent_at:new Date(us()).toISOString(),...e&&{sdk:e},...!!t&&r&&{dsn:ta(r)},...i&&{trace:i}}}function BO(n,e){if(!e)return n;const t=n.sdk||{};return n.sdk={...t,name:t.name||e.name,version:t.version||e.version,integrations:[...n.sdk?.integrations||[],...e.integrations||[]],packages:[...n.sdk?.packages||[],...e.packages||[]],settings:n.sdk?.settings||e.settings?{...n.sdk?.settings,...e.settings}:void 0},n}function $O(n,e,t,r){const i=cy(t),s={sent_at:new Date(us()).toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:ta(e)}},a="aggregates"in n?[{type:"sessions"},n]:[{type:"session"},n.toJSON()];return ds(s,[a])}function GO(n,e,t,r){const i=cy(t),s=n.type&&n.type!=="replay_event"?n.type:"event";BO(n,t?.sdk);const a=WI(n,i,r,e);return delete n.sdkProcessingMetadata,ds(a,[[{type:s},n]])}function jO(n,e){function t(h){return!!h.trace_id&&!!h.public_key}const r=yi(n[0]),i=e?.getDsn(),s=e?.getOptions().tunnel,a={sent_at:new Date(us()).toISOString(),...t(r)&&{trace:r},...!!s&&i&&{dsn:ta(i)}},{beforeSendSpan:o,ignoreSpans:l}=e?.getOptions()||{},u=l?.length?n.filter(h=>{const p=ke(h);return!Ml({description:p.description,op:p.op,attributes:p.data},l)}):n,c=n.length-u.length;c&&e?.recordDroppedEvent("before_send","span",c);const d=o?h=>{const p=ke(h),m=HI(o)?p:o(p);return m||(Jm(),p)}:ke,f=[];for(const h of u){const p=d(h);p&&f.push(FO(p))}return ds(a,f)}function HO(n){if(!se)return;const{description:e="< unknown name >",op:t="< unknown op >",parent_span_id:r}=ke(n),{spanId:i}=n.spanContext(),s=gi(n),a=Ut(n),o=a===n,l=`[Tracing] Starting ${s?"sampled":"unsampled"} ${o?"root ":""}span`,u=[`op: ${t}`,`name: ${e}`,`ID: ${i}`];if(r&&u.push(`parent ID: ${r}`),!o){const{op:c,description:d}=ke(a);u.push(`root ID: ${a.spanContext().spanId}`),c&&u.push(`root op: ${c}`),d&&u.push(`root description: ${d}`)}K.log(`${l} 24 ${u.join(` 25 `)}`)}function VO(n){if(!se)return;const{description:e="< unknown name >",op:t="< unknown op >"}=ke(n),{spanId:r}=n.spanContext(),s=Ut(n)===n,a=`[Tracing] Finishing "${t}" ${s?"root ":""}span "${e}" with ID ${r}`;K.log(a)}function zI(n,e,t,r=Gt()){const i=r&&Ut(r);i&&(se&&K.log(`[Measurement] Setting measurement on root span: ${n} = ${e} ${t}`),i.addEvent(n,{[ku]:e,[Cu]:t}))}function tE(n){if(!n||n.length===0)return;const e={};return n.forEach(t=>{const r=t.attributes||{},i=r[Cu],s=r[ku];typeof i=="string"&&typeof s=="number"&&(e[t.name]={value:s,unit:i})}),e}function nE(){return Iu(as()).segmentSpanCaptureStrategy}function Hr(n){return n.getOptions().traceLifecycle==="stream"}const rE=1e3;class sh{constructor(e={}){this._traceId=e.traceId||Ji(),this._spanId=e.spanId||Zi(),this._startTime=e.startTimestamp||Tt(),this._links=e.links,this._attributes={},this.setAttributes({[gt]:"manual",[wn]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._frozen?this:(this._links?this._links.push(e):this._links=[e],this)}addLinks(e){return this._frozen?this:(this._links?this._links.push(...e):this._links=e,this)}recordException(e,t){}spanContext(){const{_spanId:e,_traceId:t,_sampled:r}=this;return{spanId:e,traceId:t,traceFlags:r?rh:CI}}setAttribute(e,t){return this._frozen?this:(t===void 0?delete this._attributes[e]:this._attributes[e]=t,e===Bn&&t!==void 0&&WS(this)&&uO(this),this)}setAttributes(e){return Object.keys(e).forEach(t=>this.setAttribute(t,e[t])),this}updateStartTime(e){this._frozen||(this._startTime=ii(e))}setStatus(e){return this._frozen?this:(this._status=e,this)}updateName(e){return this._frozen?this:(this._name=e,WS(this)||this.setAttribute(Bn,"custom"),this)}end(e){if(this._endTime){this._frozen=zS(this);return}this._endTime=ii(e),VO(this),this._onSpanEnded(),this._frozen=zS(this)}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[wn],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:UI(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[gt],profile_id:this._attributes[oy],exclusive_time:this._attributes[cs],measurements:tE(this._events),is_segment:this._isStandaloneSpan&&Ut(this)===this||void 0,segment_id:this._isStandaloneSpan?Ut(this).spanContext().spanId:void 0,links:DI(this._links)}}getStreamedSpanJSON(){return{name:this._name??"",span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:this._endTime??this._startTime,is_segment:this._isStandaloneSpan||this===Ut(this),status:ly(this._status),attributes:BI(this._attributes,this._status),links:PI(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,t,r){if(this._frozen)return this;se&&K.log("[Tracing] Adding an event to span:",e);const i=iE(t)?t:r||Tt(),s=iE(t)?{}:t||{},a={name:e,time:ii(i),attributes:s};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=Se();e&&(e.emit("spanEnd",this),this._isStandaloneSpan||e.emit("afterSpanEnd",this));const t=Ut(this),r=this._isStandaloneSpan||this===t;if(this._isStandaloneSpan){this._sampled?zO(jO([this],e)):(se&&K.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}if(!r){const a=nE();if(a){const o=Fa(this).scope||Le();a.onChildSpanEnded(this,t,l=>this._convertSpanToTransaction(l),o)}return}if(e&&Hr(e)){e.emit("afterSegmentSpanEnd",this);return}const i=Fa(this).scope||Le(),s=nE();if(s)s.onSegmentSpanEnded(a=>this._convertSpanToTransaction(a),i);else{const a=this._convertSpanToTransaction();a&&i.captureEvent(a)}}_convertSpanToTransaction(e={}){if(!sE(ke(this)))return;this._name||(se&&K.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:t,isolationScope:r}=Fa(this),i=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;e.onSpanCaptured?.(this);const s=[];for(const d of nd(this)){if(d===this||WO(d)||e.isSpanAlreadyCaptured?.(d))continue;const f=ke(d);sE(f)&&(e.onSpanCaptured?.(d),s.push(f))}const a=this._attributes[Bn];delete this._attributes[VS];let o=!1;
25s.forEach(d=>{delete d.data[VS],d.op?.startsWith("gen_ai.")&&(o=!0)});const l={contexts:{trace:bO(this)},spans:s.length>rE?s.sort((d,f)=>d.start_timestamp-f.start_timestamp).slice(0,rE):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:r,dynamicSamplingContext:yi(this),hasGenAiSpans:o},request:i,...a&&{transaction_info:{source:a}}},u=tE(this._events);return u&&Object.keys(u).length&&(se&&K.log("[Measurements] Adding measurements to transaction event",JSON.stringify(u,void 0,2)),l.measurements=u),l}}function iE(n){return n&&typeof n=="number"||n instanceof Date||Array.isArray(n)}function sE(n){return!!n.start_timestamp&&!!n.timestamp&&!!n.span_id&&!!n.trace_id}function WO(n){return n instanceof sh&&n.isStandaloneSpan()}function zO(n){const e=Se();if(!e)return;const t=n[1];if(!t||t.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(n)}function KO(n,e,t){if(!Vn(n))return[!1];let r,i;typeof n.tracesSampler=="function"?(i=n.tracesSampler({...e,inheritOrSampleWith:o=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):o}),r=!0):e.parentSampled!==void 0?i=e.parentSampled:typeof n.tracesSampleRate<"u"&&(i=n.tracesSampleRate,r=!0);const s=Hs(i);if(s===void 0)return se&&K.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!s)return se&&K.log(`[Tracing] Discarding transaction because ${typeof n.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];const a=t<s;return a||se&&K.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[a,s,r]}const qO="__SENTRY_SUPPRESS_TRACING__";function fs(n){const e=fy();return e.startInactiveSpan?e.startInactiveSpan(n):YO(n)}function YO(n){const e=JO(n),{forceTransaction:t,parentSpan:r}=n;return(n.scope?s=>Lu(n.scope,s):r!==void 0?s=>KI(r,s):s=>s())(()=>{const s=Le(),a=eM(s,r),o=Se();return n.onlyIfParent&&!a?XO(s,o):QO({parentSpan:a,spanArguments:e,forceTransaction:t,scope:s})})}function KI(n,e){const t=fy();return t.withActiveSpan?t.withActiveSpan(n,e):Lu(r=>(Dl(r,n||void 0),e(r)))}function dy(n=Le()){const e=fy();return e.isTracingSuppressed?e.isTracingSuppressed(n):n.getScopeData().sdkProcessingMetadata[qO]===!0}function XO(n,e){e?.recordDroppedEvent("no_parent_span","span");const t=new Vs({traceId:n.getPropagationContext().traceId});return Xa(t,n,rn()),t}function QO({parentSpan:n,spanArguments:e,forceTransaction:t,scope:r}){const i=rn();if(!Vn()){const o=r.getPropagationContext(),l=n?n.spanContext().traceId:o.traceId,u=new Vs({traceId:l});return n&&!t&&td(n,u),Xa(u,r,i),u}const s=Se();if(tM(s,e)){dy(r)||s?.recordDroppedEvent("ignored","span");const o=new Vs({dropReason:"ignored",traceId:n?.spanContext().traceId??r.getPropagationContext().traceId});return n&&!t&&td(n,o),Xa(o,r,i),o}let a;if(n&&!t)a=ZO(n,r,e,i),td(n,a);else if(n){const o=yi(n),{traceId:l,spanId:u}=n.spanContext(),c=gi(n);a=aE({traceId:l,parentSpanId:u,...e},r,i,c),JS(a,o)}else{const{traceId:o,dsc:l,parentSpanId:u,sampled:c}=r.getPropagationContext();a=aE({traceId:o,parentSpanId:u,...e},r,i,c),l&&JS(a,l)}return HO(a),a}function JO(n){const t={isStandalone:(n.experimental||{}).standalone,...n};if(n.startTime){const r={...t};return r.startTimestamp=ii(n.startTime),delete r.startTime,r}return t}function fy(){const n=as();return Eo(n)}function aE(n,e,t,r){const i=Se(),s=i?.getOptions()||{},{name:a=""}=n,o={spanAttributes:{...n.attributes},spanName:a,parentSampled:r};i?.emit("beforeSampling",o,{decision:!1});const l=o.parentSampled??r,u=o.spanAttributes,c=e.getPropagationContext(),d=dy(e),[f,h,p]=d?[!1]:KO(s,{name:a,parentSampled:l,attributes:u,normalizedRequest:t.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:Hs(c.dsc?.sample_rate)},c.sampleRand),m=new sh({...n,attributes:{[Bn]:"custom",[ay]:h!==void 0&&p?h:void 0,...u},sampled:f});return!f&&i&&!d&&(se&&K.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),i.recordDroppedEvent("sample_rate",Hr(i)?"span":"transaction")),Xa(m,e,t),i&&i.emit("spanStart",m),m}function ZO(n,e,t,r){const{spanId:i,traceId:s}=n.spanContext(),a=dy(e),o=a?!1:gi(n),l=o?new sh({...t,parentSpanId:i,traceId:s,sampled:o}):new Vs({traceId:s});td(n,l),Xa(l,e,r);const u=Se();return u&&(Hr(u)&&Qa(l)&&(Qa(n)&&n.dropReason?(l.dropReason=n.dropReason,u.recordDroppedEvent(n.dropReason,"span")):a||(l.dropReason="sample_rate",u.recordDroppedEvent("sample_rate","span"))),u.emit("spanStart",l),t.endTimestamp&&(u.emit("spanEnd",l),u.emit("afterSpanEnd",l))),l}function eM(n,e){if(e)return e;if(e===null)return;const t=Pl(n);if(!t)return;const r=Se();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Ut(t):t}function tM(n,e){const t=n?.getOptions().ignoreSpans;return!n||!Hr(n)||!t?.length?!1:Ml({description:e.name||"",op:e.attributes?.[wn]||e.op,attributes:e.attributes},t)}function qI(n){return Qa(n)&&n.dropReason==="ignored"}const rd={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},nM="heartbeatFailed",rM="idleTimeout",iM="finalTimeout",sM="externalFinish";function YI(n,e={}){const t=new Map;let r=!1,i,s,a=sM,o=!e.disableAutoFinish;const l=[],{idleTimeout:u=rd.idleTimeout,finalTimeout:c=rd.finalTimeout,childSpanTimeout:d=rd.childSpanTimeout,beforeSpanEnd:f,trimIdleSpanEndTimestamp:h=!0}=e,p=Se(),m=Le();if(!p||!Vn()){const A=new Vs({traceId:m.getPropagationContext().traceId});return Xa(A,m,rn()),A}const g=Gt(),y=aM(n);y.end=new Proxy(y.end,{apply(A,b,C){if(f&&f(y),Qa(b))return;const[k,...$]=C,U=k||Tt(),N=ii(U),D=nd(y).filter(j=>j!==y),M=ke(y);if(!D.length||!h)return R(N),Reflect.apply(A,b,[N,...$]);const L=p.getOptions().ignoreSpans,O=D?.reduce((j,W)=>{const z=ke(W);return!z.timestamp||L&&Ml({description:z.description,op:z.op,attributes:z.data},L)?j:j?Math.max(j,z.timestamp):z.timestamp},void 0),B=M.start_timestamp,G=Math.min(B?B+c/1e3:1/0,Math.max(B||-1/0,Math.min(N,O||1/0)));return R(G),Reflect.apply(A,b,[G,...$])}});function v(){i&&(clearTimeout(i),i=void 0)}function S(){s&&(clearTimeout(s),s=void 0)}function x(A){v(),i=setTimeout(()=>{!r&&t.size===0&&o&&(a=rM,y.end(A))},u)}function T(A){S(),s=setTimeout(()=>{!r&&o&&(a=nM,y.end(A))},d)}function w(A){v(),t.set(A,!0);const b=Tt();T(b+d/1e3)}function I(A){if(t.has(A)&&t.delete(A),t.size===0){const b=Tt();x(b+u/1e3),S()}}function R(A){r=!0,t.clear(),l.forEach(D=>D()),Dl(m,g);const b=ke(y),{start_timestamp:C}=b;if(!C)return;b.data[Ol]||y.setAttribute(Ol,a);
25const $=b.status;(!$||$==="unknown")&&y.setStatus({code:nh}),K.log(`[Tracing] Idle span "${b.op}" finished`);const U=nd(y).filter(D=>D!==y);let N=0;U.forEach(D=>{D.isRecording()&&(D.setStatus({code:Lt,message:"cancelled"}),D.end(A),se&&K.log("[Tracing] Cancelling span since span ended early",JSON.stringify(D,void 0,2)));const M=ke(D),{timestamp:L=0,start_timestamp:O=0}=M,B=O<=A,G=(c+u)/1e3,j=L-O<=G;if(se){const W=JSON.stringify(D,void 0,2);B?j||K.log("[Tracing] Discarding span since it finished after idle span final timeout",W):K.log("[Tracing] Discarding span since it happened after idle span was finished",W)}(!j||!B)&&(AO(y,D),N++)}),N>0&&y.setAttribute("sentry.idle_span_discarded_spans",N)}return l.push(p.on("spanStart",A=>{if(r||A===y||ke(A).timestamp||A instanceof sh&&A.isStandaloneSpan())return;nd(y).includes(A)&&w(A.spanContext().spanId)})),l.push(p.on("spanEnd",A=>{r||I(A.spanContext().spanId)})),l.push(p.on("idleSpanEnableAutoFinish",A=>{A===y&&(o=!0,x(),t.size&&T())})),e.disableAutoFinish||x(),setTimeout(()=>{r||(y.setStatus({code:Lt,message:"deadline_exceeded"}),a=iM,y.end())},c),y}function aM(n){const e=fs(n);return Dl(Le(),e),se&&K.log("[Tracing] Started span is an idle span"),e}function oM(n,e,t){let r,i,s;const a=t?.maxWait?Math.max(t.maxWait,e):0,o=t?.setTimeoutImpl||setTimeout;function l(){return u(),r=n(),r}function u(){i!==void 0&&clearTimeout(i),s!==void 0&&clearTimeout(s),i=s=void 0}function c(){return i!==void 0||s!==void 0?l():r}function d(){return i&&clearTimeout(i),i=o(l,e),a&&s===void 0&&(s=o(l,a)),r}return d.cancel=u,d.flush=c,d}function lM(n,e){const{fingerprint:t,span:r,breadcrumbs:i,sdkProcessingMetadata:s}=e;uM(n,e),r&&fM(n,r),hM(n,t),cM(n,i),dM(n,s)}function oE(n,e){const{extra:t,tags:r,attributes:i,user:s,contexts:a,level:o,sdkProcessingMetadata:l,breadcrumbs:u,fingerprint:c,eventProcessors:d,attachments:f,propagationContext:h,transactionName:p,span:m}=e;Do(n,"extra",t),Do(n,"tags",r),Do(n,"attributes",i),Do(n,"user",s),Do(n,"contexts",a),n.sdkProcessingMetadata=Au(n.sdkProcessingMetadata,l,2),o&&(n.level=o),p&&(n.transactionName=p),m&&(n.span=m),u.length&&(n.breadcrumbs=[...n.breadcrumbs,...u]),c.length&&(n.fingerprint=[...n.fingerprint,...c]),d.length&&(n.eventProcessors=[...n.eventProcessors,...d]),f.length&&(n.attachments=[...n.attachments,...f]),n.propagationContext={...n.propagationContext,...h}}function Do(n,e,t){n[e]=Au(n[e],t,1)}function hy(n,e){const t=tO().getScopeData();return n&&oE(t,n.getScopeData()),e&&oE(t,e.getScopeData()),t}function uM(n,e){const{extra:t,tags:r,user:i,contexts:s,level:a,transactionName:o}=e;Object.keys(t).length&&(n.extra={...t,...n.extra}),Object.keys(r).length&&(n.tags={...r,...n.tags}),Object.keys(i).length&&(n.user={...i,...n.user}),Object.keys(s).length&&(n.contexts={...s,...n.contexts}),a&&(n.level=a),o&&n.type!=="transaction"&&(n.transaction=o)}function cM(n,e){const t=[...n.breadcrumbs||[],...e];n.breadcrumbs=t.length?t:void 0}function dM(n,e){n.sdkProcessingMetadata={...n.sdkProcessingMetadata,...e}}function fM(n,e){n.contexts={trace:kI(e),...n.contexts},n.sdkProcessingMetadata={dynamicSamplingContext:yi(e),...n.sdkProcessingMetadata};const t=Ut(e),r=ke(t).description;r&&!n.transaction&&n.type==="transaction"&&(n.transaction=r)}function hM(n,e){n.fingerprint=n.fingerprint?Array.isArray(n.fingerprint)?n.fingerprint:[n.fingerprint]:[],e&&(n.fingerprint=n.fingerprint.concat(e)),n.fingerprint.length||delete n.fingerprint}const pM="http.request.header",XI="http.url",mM="sentry.op",QI="sentry.segment.name",JI="sentry.transaction",xo="url.full",gM="url.path",yM="user_agent.original";function Od(n,e){const t=n.attributes??(n.attributes={});Object.entries(e).forEach(([r,i])=>{i!=null&&!(r in t)&&(t[r]=i)})}const cp=0,lE=1,uE=2;function Du(n){return new Fl(e=>{e(n)})}function ZI(n){return new Fl((e,t)=>{t(n)})}class Fl{constructor(e){this._state=cp,this._handlers=[],this._runExecutor(e)}then(e,t){return new Fl((r,i)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(a){i(a)}},s=>{if(!t)i(s);else try{r(t(s))}catch(a){i(a)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new Fl((t,r)=>{let i,s;return this.then(a=>{s=!1,i=a,e&&e()},a=>{s=!0,i=a,e&&e()}).then(()=>
25{if(s){r(i);return}t(i)})})}_executeHandlers(){if(this._state===cp)return;const e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===lE&&t[1](this._value),this._state===uE&&t[2](this._value),t[0]=!0)})}_runExecutor(e){const t=(s,a)=>{if(this._state===cp){if(wu(a)){a.then(r,i);return}this._state=s,this._value=a,this._executeHandlers()}},r=s=>{t(lE,s)},i=s=>{t(uE,s)};try{e(r,i)}catch(s){i(s)}}}function vM(n,e,t,r=0){try{const i=tg(e,t,n,r);return wu(i)?i:Du(i)}catch(i){return ZI(i)}}function tg(n,e,t,r){const i=t[r];if(!n||!i)return n;const s=i({...n},e);return se&&s===null&&K.log(`Event processor "${i.id||"?"}" dropped event`),wu(s)?s.then(a=>tg(a,e,t,r+1)):tg(s,e,t,r+1)}let ys,cE,dE,xi;function SM(n){const e=Ie._sentryDebugIds,t=Ie._debugIds;if(!e&&!t)return{};const r=e?Object.keys(e):[],i=t?Object.keys(t):[];if(xi&&r.length===cE&&i.length===dE)return xi;cE=r.length,dE=i.length,xi={},ys||(ys={});const s=(a,o)=>{for(const l of a){const u=o[l],c=ys?.[l];if(c&&xi&&u)xi[c[0]]=u,ys&&(ys[l]=[c[0],u]);else if(u){const d=n(l);for(let f=d.length-1;f>=0;f--){const p=d[f]?.filename;if(p&&xi&&ys){xi[p]=u,ys[l]=[p,u];break}}}}};return e&&s(r,e),t&&s(i,t),xi}function e1(n,e,t,r,i,s){const{normalizeDepth:a=3,normalizeMaxBreadth:o=1e3}=n,l={...e,event_id:e.event_id||t.event_id||_n(),timestamp:e.timestamp||ea()},u=t.integrations||n.integrations.map(y=>y.name);EM(l,n),_M(l,u),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&xM(l,n.stackParser);const c=IM(r,t.captureContext);t.mechanism&&Os(l,t.mechanism);const d=i?i.getEventProcessors():[],f=hy(s,c),h=[...t.attachments||[],...f.attachments];h.length&&(t.attachments=h),lM(l,f);const p=[...d,...f.eventProcessors];return(t.data&&t.data.__sentry__===!0?Du(l):vM(p,l,t)).then(y=>(y&&TM(y),typeof a=="number"&&a>0?bM(y,a,o):y))}function EM(n,e){const{environment:t,release:r,dist:i,maxValueLength:s}=e;n.environment=n.environment||t||uy,!n.release&&r&&(n.release=r),!n.dist&&i&&(n.dist=i);const a=n.request;a?.url&&s&&(a.url=Km(a.url,s)),s&&n.exception?.values?.forEach(o=>{o.value&&(o.value=Km(o.value,s))})}function xM(n,e){const t=SM(e);n.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=t[i.filename])})})}function TM(n){const e={};if(n.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;n.debug_meta=n.debug_meta||{},n.debug_meta.images=n.debug_meta.images||[];const t=n.debug_meta.images;Object.entries(e).forEach(([r,i])=>{t.push({type:"sourcemap",code_file:r,debug_id:i})})}function _M(n,e){e.length>0&&(n.sdk=n.sdk||{},n.sdk.integrations=[...n.sdk.integrations||[],...e])}function bM(n,e,t){if(!n)return null;const r={...n,...n.breadcrumbs&&{breadcrumbs:n.breadcrumbs.map(i=>({...i,...i.data&&{data:ar(i.data,e,t)}}))},...n.user&&{user:ar(n.user,e,t)},...n.contexts&&{contexts:ar(n.contexts,e,t)},...n.extra&&{extra:ar(n.extra,e,t)}};return n.contexts?.trace&&r.contexts&&(r.contexts.trace=n.contexts.trace,n.contexts.trace.data&&(r.contexts.trace.data=ar(n.contexts.trace.data,e,t))),n.spans&&(r.spans=n.spans.map(i=>({...i,...i.data&&{data:ar(i.data,e,t)}}))),n.contexts?.flags&&r.contexts&&(r.contexts.flags=ar(n.contexts.flags,3,t)),r}function IM(n,e){if(!e)return n;const t=n?n.clone():new $r;return t.update(e),t}function wM(n){if(n)return RM(n)?{captureContext:n}:LM(n)?{captureContext:n}:n}function RM(n){return n instanceof $r||typeof n=="function"}const AM=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function LM(n){return Object.keys(n).some(e=>AM.includes(e))}function kr(n,e){return Le().captureException(n,wM(e))}function t1(n,e){return Le().captureEvent(n,e)}function n1(n,e){rn().setContext(n,e)}function CM(){return rn().lastEventId()}function kM(){const n=Se();return n?.getOptions().enabled!==!1&&!!n?.getTransport()}function DM(n){rn().addEventProcessor(n)}function fE(n){const e=rn(),{user:t}=hy(e,Le()),{userAgent:r}=Ie.navigator||{},i=$P({user:t,...r&&{userAgent:r},...n}),s=e.getSession();return s?.status==="ok"&&qa(s,{status:"exited"}),r1(),e.setSession(i),i}function r1(){const n=rn(),t=Le().getSession()||n.getSession();t&&GP(t),i1(),n.setSession()}function i1(){const n=rn(),e=Se(),t=n.getSession();t&&e&&e.captureSession(t)}function dp(n=!1){if(n){r1();return}i1()}function s1(n){return typeof n=="object"&&typeof n.unref=="function"&&n.unref(),n}const PM="7";function a1(n){const e=n.protocol?`${n.protocol}
25:`:"",t=n.port?`:${n.port}`:"";return`${e}//${n.host}${t}${n.path?`/${n.path}`:""}/api/`}function OM(n){return`${a1(n)}${n.projectId}/envelope/`}function MM(n,e){const t={sentry_version:PM};return n.publicKey&&(t.sentry_key=n.publicKey),e&&(t.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(t).toString()}function FM(n,e,t){return e||`${OM(n)}?${MM(n,t)}`}function NM(n,e){const t=wI(n);if(!t)return"";const r=`${a1(t)}embed/error-page/`;let i=`dsn=${ta(t)}`;for(const s in e)if(s!=="dsn"&&s!=="onClose")if(s==="user"){const a=e.user;if(!a)continue;a.name&&(i+=`&name=${encodeURIComponent(a.name)}`),a.email&&(i+=`&email=${encodeURIComponent(a.email)}`)}else i+=`&${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`;return`${r}?${i}`}const hE=[];function UM(n){const e={};return n.forEach(t=>{const{name:r}=t,i=e[r];i&&!i.isDefaultInstance&&t.isDefaultInstance||(e[r]=t)}),Object.values(e)}function BM(n){const e=n.defaultIntegrations||[],t=n.integrations;e.forEach(i=>{i.isDefaultInstance=!0});let r;if(Array.isArray(t))r=[...e,...t];else if(typeof t=="function"){const i=t(e);r=Array.isArray(i)?i:[i]}else r=e;return UM(r)}function $M(n,e){const t={};return e.forEach(r=>{r?.beforeSetup&&r.beforeSetup(n)}),e.forEach(r=>{r&&o1(n,r,t)}),t}function pE(n,e){for(const t of e)t?.afterAllSetup&&t.afterAllSetup(n)}function o1(n,e,t){if(t[e.name]){se&&K.log(`Integration skipped because it was already installed: ${e.name}`);return}if(t[e.name]=e,!hE.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),hE.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(n),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);n.on("preprocessEvent",(i,s)=>r(i,s,n))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((s,a)=>r(s,a,n),{id:e.name});n.addEventProcessor(i)}["processSpan","processSegmentSpan"].forEach(r=>{const i=e[r];typeof i=="function"&&n.on(r,s=>i.call(e,s,n))}),se&&K.log(`Integration installed: ${e.name}`)}const GM="sentry.timestamp.sequence";let fp=0,hp;function jM(n){const e=Math.floor(n*1e3);hp!==void 0&&e!==hp&&(fp=0);const t=fp;return fp++,hp=e,{key:GM,value:{value:t,type:"integer"}}}function HM(n,e){return e?Lu(e,()=>{const t=Gt(),r=t?kI(t):vI(e);return[t?yi(t):ih(n,e),r]}):[void 0,void 0]}const VM={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function WM(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function zM(){/*! __SENTRY_SDK_SOURCE__ */return"npm"}function KM(){return!WM()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Ja(){return typeof window<"u"&&(!KM()||qM())}function qM(){return Ie.process?.type==="renderer"}function YM(n,e){const t=e?"auto":"never";return[{type:"log",item_count:n.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...Ja()&&{ingest_settings:{infer_ip:t,infer_user_agent:t}},items:n}]}function XM(n,e,t,r,i){const s={};return e?.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),t&&r&&(s.dsn=ta(r)),ds(s,[YM(n,i)])}const QM=100;function Er(n,e,t,r=!0){t&&(!n[e]||r)&&(n[e]=t)}function JM(n,e){const t=py(),r=u1(n);r===void 0?t.set(n,[e]):r.length>=QM?(l1(n,r),t.set(n,[e])):t.set(n,[...r,e])}function ZM(n,e=Le(),t=JM){const r=e?.getClient()??Se();if(!r){se&&K.warn("No client available to capture log.");return}const{release:i,environment:s,enableLogs:a=!0,beforeSendLog:o}=r.getOptions();if(!a){se&&K.warn("logging option not enabled, log will not be captured.");return}const[,l]=HM(r,e),u={...n.attributes},{user:{id:c,email:d,username:f},attributes:h={}}=hy(rn(),e);Er(u,"user.id",c,!1),Er(u,"user.email",d,!1),Er(u,"user.name",f,!1),Er(u,"sentry.release",i),Er(u,"sentry.environment",s);const{name:p,version:m}=r.getSdkMetadata()?.sdk??{};Er(u,"sentry.sdk.name",p),Er(u,"sentry.sdk.version",m);const g=r.getIntegrationByName("Replay"),y=g?.getReplayId(!0);Er(u,"sentry.replay_id",y),y&&g?.getRecordingMode()==="buffer"&&Er(u,"sentry._internal.replay_is_buffering",!0);const v=n.message;if(Zf(v)){const{__sentry_template_string__:$,__sentry_template_values__:U=[]}=v;
25U?.length&&(u["sentry.message.template"]=$),U.forEach((N,D)=>{u[`sentry.message.parameter.${D}`]=N})}const S=Pl(e);Er(u,"sentry.trace.parent_span_id",S?.spanContext().spanId);const x={...n,attributes:u};r.emit("beforeCaptureLog",x);const T=o?mi(()=>o(x)):x;if(!T){r.recordDroppedEvent("before_send","log_item",1),se&&K.warn("beforeSendLog returned null, log will not be captured.");return}const{level:w,message:I,attributes:R={},severityNumber:A}=T,b=Tt(),C=jM(b),k={timestamp:b,level:w,body:ng(String(I)),trace_id:l?.trace_id,severity_number:A??VM[w],attributes:eF({...Dd(h),...Dd(R,!0),[C.key]:C.value})};t(r,k),r.emit("afterCaptureLog",T)}function l1(n,e){const t=e??u1(n)??[];if(t.length===0)return;const r=n.getOptions(),i=XM(t,r._metadata,r.tunnel,n.getDsn(),n.getDataCollectionOptions().userInfo);py().set(n,[]),n.emit("flushLogs"),n.sendEnvelope(i)}function u1(n){return py().get(n)}function py(){return vo("clientToLogBufferMap",()=>new WeakMap)}function eF(n){const e={};for(const[t,r]of Object.entries(n)){const i=ng(t);r.type==="string"?e[i]={...r,value:ng(r.value)}:e[i]=r}return e}function ng(n){const e=Object(n),t=e.isWellFormed,r=e.toWellFormed;return typeof t=="function"&&typeof r=="function"?t.call(n)?n:r.call(n):n}function tF(n,e){const t=e?"auto":"never";return[{type:"trace_metric",item_count:n.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{version:2,...Ja()&&{ingest_settings:{infer_ip:t,infer_user_agent:t}},items:n}]}function nF(n,e,t,r,i){const s={};return e?.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),t&&r&&(s.dsn=ta(r)),ds(s,[tF(n,i)])}function rF(n,e){const t=e??iF(n)??[];if(t.length===0)return;const r=n.getOptions(),i=nF(t,r._metadata,r.tunnel,n.getDsn(),n.getDataCollectionOptions().userInfo);c1().set(n,[]),n.emit("flushMetrics"),n.sendEnvelope(i)}function iF(n){return c1().get(n)}function c1(){return vo("clientToMetricBufferMap",()=>new WeakMap)}function sF(n){const e={trace_id:n.trace_id,span_id:n.span_id,parent_span_id:n.parent_span_id,name:n.description||"",start_timestamp:n.start_timestamp,end_timestamp:n.timestamp||n.start_timestamp,status:!n.status||n.status==="ok"||n.status==="cancelled"?"ok":"error",is_segment:!1,attributes:{...n.data},links:n.links};return RO(e)}function aF(n,e){if(n.type!=="transaction"||!n.spans?.length||!n.sdkProcessingMetadata?.hasGenAiSpans||e.getOptions().streamGenAiSpans===!1||Hr(e))return;const t=[],r=[];for(const s of n.spans)s.op?.startsWith("gen_ai.")?t.push(sF(s)):r.push(s);if(t.length===0)return;n.spans=r;const i=e.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:t.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Ja()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:t}]}const my=Symbol.for("SentryBufferFullError");function gy(n=100){const e=new Set;function t(){return e.size<n}function r(a){e.delete(a)}function i(a){if(!t())return ZI(my);const o=a();return e.add(o),o.then(()=>r(o),()=>r(o)),o}function s(a){if(!e.size)return Du(!0);const o=Promise.allSettled(Array.from(e)).then(()=>!0);if(!a)return o;const l=[o,new Promise(u=>s1(setTimeout(()=>u(!1),a)))];return Promise.race(l)}return{get $(){return Array.from(e)},add:i,drain:s}}const oF=60*1e3;function lF(n,e=us()){const t=parseInt(`${n}`,10);if(!isNaN(t))return t*1e3;const r=Date.parse(`${n}`);return isNaN(r)?oF:r-e}function uF(n,e){return n[e]||n.all||0}function d1(n,e,t=us()){return uF(n,e)>t}function f1(n,{statusCode:e,headers:t},r=us()){const i={...n},s=t?.["x-sentry-rate-limits"],a=t?.["retry-after"];if(s)for(const o of s.trim().split(",")){const[l,u,,,c]=o.split(":",5),d=parseInt(l,10),f=(isNaN(d)?60:d)*1e3;if(!u)i.all=r+f;else for(const h of u.split(";"))h==="metric_bucket"?(!c||c.split(";").includes("custom"))&&(i[h]=r+f):i[h]=r+f}else a?i.all=r+lF(a,r):e===429&&(i.all=r+60*1e3);return i}const h1=64;function cF(n,e,t=gy(n.bufferSize||h1)){let r={};const i=a=>t.drain(a);function s(a){const o=[];if(Zm(a,(d,f)=>{const h=eE(f);d1(r,h)?n.recordDroppedEvent("ratelimit_backoff",h):o.push(d)}),o.length===0)return Promise.resolve({});const l=ds(a[0],o),u=d=>{if(PO(l,["client_report"])){se&&K.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}Zm(l,(f,h)=>{n.recordDroppedEvent(d,eE(h))})},c=()=>e({body:OO(l)}).then(d=>d.statusCode===413?(se&&K.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),u("send_error"),d):(se&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&K.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=f1(r,d),d),d=>{throw u("network_error"),se&&K.error("Encountered error running transport request:",d),d});return t.add(c).then(d=>d,d=>{if(d===my)return se&&K.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw d})}return{send:s,flush:i}}function dF(n,e,t){const r=[{type:"client_report"},{timestamp:ea(),discarded_events:n}];return ds(e?{dsn:e}:{},[r])}function p1(n){const e=[];n.message&&e.push(n.message);try{const t=n.exception.values[n.exception.values.length-1];t?.value&&(e.push(t.value),t.type&&e.push(`${t.type}: ${t.value}`))}catch{}return e}function fF(n){const{trace_id:e,parent_span_id:t,span_id:r,status:i,origin:s,data:a,op:o}=n.contexts?.trace??{};return{data:a??{},description:n.transaction,op:o,parent_span_id:t,span_id:r??"",start_timestamp:n.start_timestamp??0,status:i,timestamp:n.timestamp,trace_id:e??"",origin:s,profile_id:a?.[oy],exclusive_time:a?.[cs],measurements:n.measurements,is_segment:!0}}function hF(n){return{type:"transaction",timestamp:n.timestamp,start_timestamp:n.start_timestamp,transaction:n.description,contexts:{trace:{trace_id:n.trace_id,span_id:n.span_id,parent_span_id:n.parent_span_id,op:n.op,status:n.status,origin:n.origin,data:{...n.data,...n.profile_id&&{[oy]:n.profile_id},...n.exclusive_time&&{[cs]:n.exclusive_time}}}},measurements:n.measurements}}const Qu=["forwarded","-ip","remote-","via","-user"];function pF(n){return n===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0}
25,databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:Qu},httpHeaders:{request:{deny:Qu},response:{deny:Qu}},httpBodies:[],urlQueryParams:{deny:Qu},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}const mF={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:5};function gF(n){return typeof n=="boolean"||"allow"in n||"deny"in n}function yF(n,e){return n===void 0?{...e.httpHeaders}:gF(n)?{request:n,response:n}:{request:n.request??e.httpHeaders.request,response:n.response??e.httpHeaders.response}}function vF(n){const e=n.dataCollection!=null?mF:pF(n.sendDefaultPii),t=n.dataCollection??{};return{userInfo:t.userInfo??e.userInfo,cookies:t.cookies??e.cookies,httpHeaders:yF(t.httpHeaders,e),httpBodies:t.httpBodies??e.httpBodies,urlQueryParams:t.urlQueryParams??t.queryParams??e.urlQueryParams,graphQL:{document:t.graphQL?.document??e.graphQL.document,variables:t.graphQL?.variables??e.graphQL.variables},genAI:{inputs:t.genAI?.inputs??e.genAI.inputs,outputs:t.genAI?.outputs??e.genAI.outputs},databaseQueryData:t.databaseQueryData??e.databaseQueryData,stackFrameVariables:t.stackFrame
25Variables??e.stackFrameVariables,frameContextLines:t.frameContextLines??e.frameContextLines}}const mE="Not capturing exception because it's already been captured.",gE="Discarded session because of missing or non-string release",m1=Symbol.for("SentryInternalError"),g1=Symbol.for("SentryDoNotSendEventError"),SF=5e3;function id(n){return{message:n,[m1]:!0}}function pp(n){return{message:n,[g1]:!0}}function yE(n){return Zs(n)&&m1 in n}function vE(n){return Zs(n)&&g1 in n}function SE(n,e,t,r,i){let s=0,a,o=!1;n.on(t,()=>{s=0,clearTimeout(a),o=!1}),n.on(e,l=>{if(s+=r(l),s>=8e5)i(n);else if(!o){const u=n.getOptions()._flushInterval??SF;u>0&&(o=!0,a=s1(setTimeout(()=>{i(n)},u)))}}),n.on("flush",()=>{i(n)})}class EF{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=gy(e.transportOptions?.bufferSize??h1),this._dataCollection=vF(e),e.dsn?this._dsn=wI(e.dsn):se&&K.warn("No DSN provided, client will not send events."),this._dsn){const r=FM(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs??!0,this._options.enableLogs&&SE(this,"afterCaptureLog","flushLogs",bF,l1),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&SE(this,"afterCaptureMetric","flushMetrics",_F,rF)}captureException(e,t,r){const i=_n();if($S(e))return se&&K.log(mE),i;const s={event_id:i,...t};return this._process(()=>this.eventFromException(e,s).then(a=>this._captureEvent(a,s,r)).then(a=>a),"error"),s.event_id}captureMessage(e,t,r,i){const s={event_id:_n(),...r},a=Zf(e)?e:String(e),o=js(e),l=o?this.eventFromMessage(a,t,s):this.eventFromException(e,s);return this._process(()=>l.then(u=>this._captureEvent(u,s,i)),o?"unknown":"error"),s.event_id}captureEvent(e,t,r){const i=_n();if(t?.originalException&&$S(t.originalException))return se&&K.log(mE),i;const s={event_id:i,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,l=a.capturedSpanIsolationScope,u=EE(e.type);return this._process(()=>this._captureEvent(e,s,o||r,l),u),s.event_id}captureSession(e){this.sendSession(e),qa(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){const t=this._transport;if(this.emit("flush"),!t)return!0;const r=await this._isClientDoneProcessing(e),i=await t.flush(e);return r&&i}async close(e){const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){const t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),o1(this,e,this._integrations),t||pE(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);const r=aF(e,this);let i=GO(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of t.attachments||[])i=ZS(i,NO(s));r&&(i=ZS(i,r)),this.sendEnvelope(i).then(s=>this.emit("afterSendEvent",e,s))}sendSession(e){const{release:t,environment:r=uy}=this._options;if("aggregates"in e){const s=e.attrs||{};if(!s.release&&!t){se&&K.warn(gE);return}s.release=s.release||t,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!t){se&&K.warn(gE);return}e.release=e.release||t,e.environment=e.environment||r}this.emit("beforeSendSession",e);const i=$O(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,t,r=1){if(this._options.sendClientReports){const i=`${e}:${t}`;se&&K.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(e,t){const r=this._hooks[e]=this._hooks[e]||new Set,i=(...s)=>t(...s);return r.add(i),()=>{r.delete(i)}}emit(e,...t){const r=this._hooks[e];r&&r.forEach(i=>
25i(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(t){return se&&K.error("Error while sending envelope:",t),{}}return se&&K.error("Transport disabled"),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=$M(this,e),pE(this,e)}_updateSessionFromEvent(e,t){let r=t.level==="fatal",i=!1;const s=t.exception?.values;if(s){i=!0,r=!1;for(const l of s)if(l.mechanism?.handled===!1){r=!0;break}}const a=e.status==="ok";(a&&e.errors===0||a&&r)&&(qa(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,r,i){const s=this.getOptions(),a=this.getIntegrationNames();return!t.integrations&&a.length&&(t.integrations=a),this.emit("preprocessEvent",e,t),e.type||i.setLastEventId(e.event_id||t.event_id),e1(s,e,t,r,this,i).then(o=>{if(o===null)return o;this.emit("postprocessEvent",o,t),o.contexts={trace:{...o.contexts?.trace,...vI(r)},...o.contexts};const l=ih(this,r);return o.sdkProcessingMetadata={dynamicSamplingContext:l,...o.sdkProcessingMetadata},o})}_captureEvent(e,t={},r=Le(),i=rn()){return se&&rg(e)&&K.log(`Captured error event \`${p1(e)[0]||"<unknown>"}\``),this._processEvent(e,t,r,i).then(s=>s.event_id,s=>{se&&(vE(s)?K.log(s.message):yE(s)?K.warn(s.message):K.warn(s))})}_processEvent(e,t,r,i){const s=this.getOptions(),{sampleRate:a}=s,o=y1(e),l=rg(e),c=`before send for type \`${e.type||"error"}\``,d=typeof a>"u"?void 0:Hs(a),f=EE(e.type);return this._prepareEvent(e,t,r,i).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",f),pp("An event processor returned `null`, will not send event.");if(t.data?.__sentry__===!0)return h;const m=TF(this,s,h,t);return xF(m,c)}).then(h=>{if(h===null){if(this.recordDroppedEvent("before_send",f),o){const y=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",y)}throw pp(`${c} returned \`null\`, will not send event.`)}const p=r.getSession()||i.getSession();if(l&&p&&this._updateSessionFromEvent(p,h),l&&typeof d=="number"&&Bi()>d)throw this.recordDroppedEvent("sample_rate","error"),pp(`Discarding event because it's not included in the random sample (sampling rate = ${a})`);if(o){const g=h.sdkProcessingMetadata?.spanCountBeforeProcessing||0,y=h.spans?h.spans.length:0,v=g-y;v>0&&this.recordDroppedEvent("before_send","span",v)}const m=h.transaction_info;if(o&&m&&h.transaction!==e.transaction){const g="custom";h.transaction_info={...m,source:g}}return this.sendEvent(h,t),h}).then(null,h=>{throw vE(h)||yE(h)?h:(this.captureException(h,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:h}),id(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. 26Reason: ${h}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===my&&this.recordDroppedEvent("queue_overflow",t),r))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([t,r])=>{const[i,s]=t.split(":");return{reason:i,category:s,quantity:r}})}_flushOutcomes(){se&&K.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){se&&K.log("No outcomes to send");return}if(!this._dsn){se&&K.log("No dsn provided, will not send outcomes");return}se&&K.log("Sending outcomes:",e);const t=dF(e,this._options.tunnel&&ta(this._dsn));this.sendEnvelope(t)}}function EE(n){return n==="replay_event"?"replay":n||"error"}function xF(n,e){const t=`${e} must return \`null\` or a valid event.`;if(wu(n))return n.then(r=>{if(!kl(r)&&r!==null)throw id(t);return r},r=>{throw id(`${e} rejected with ${r}`)});if(!kl(n)&&n!==null)throw id(t);return n}function TF(n,e,t,r){const{beforeSend:i,beforeSendTransaction:s,ignoreSpans:a}=e,o=!HI(e.beforeSendSpan)&&e.beforeSendSpan;let l=t;if(rg(l)&&i)return i(l,r);
26if(y1(l)){if(o||a){const u=fF(l);if(a?.length&&Ml({description:u.description,op:u.op,attributes:u.data},a))return null;if(o){const c=o(u);c?l=Au(t,hF(c)):Jm()}if(l.spans){const c=[],d=l.spans;for(const h of d){if(a?.length&&Ml({description:h.description,op:h.op,attributes:h.data},a)){kO(d,h);continue}if(o){const p=o(h);p?c.push(p):(Jm(),c.push(h))}else c.push(h)}const f=l.spans.length-c.length;f&&n.recordDroppedEvent("before_send","span",f),l.spans=c}}if(s){if(l.spans){const u=l.spans.length;l.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:u}}return s(l,r)}}return l}function rg(n){return n.type===void 0}function y1(n){return n.type==="transaction"}function _F(n){let e=0;return n.name&&(e+=n.name.length*2),e+=8,e+v1(n.attributes)}function bF(n){let e=0;return n.message&&(e+=n.message.length*2),e+v1(n.attributes)}function v1(n){if(!n)return 0;let e=0;return Object.values(n).forEach(t=>{Array.isArray(t)?e+=t.length*xE(t[0]):js(t)?e+=xE(t):e+=100}),e}function xE(n){return typeof n=="string"?n.length*2:typeof n=="number"?8:typeof n=="boolean"?4:0}function IF(n,e){e.debug===!0&&(se?K.enable():mi(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Le().update(e.initialScope);const r=new n(e);return wF(r),r.init(),r}function wF(n){Le().setClient(n)}const RF="thismessage:/";function ah(n){return"isRelative"in n}function Nl(n,e){const t=n.indexOf("://")<=0&&n.indexOf("//")!==0,r=t?RF:void 0;try{if("canParse"in URL&&!URL.canParse(n,r))return;const i=new URL(n,r);return t?{isRelative:t,pathname:i.pathname,search:i.search,hash:i.hash}:i}catch{}}function S1(n){if(ah(n))return n.pathname;const e=new URL(n);return e.search="",e.hash="",["80","443"].includes(e.port)&&(e.port=""),e.password&&(e.password="%filtered%"),e.username&&(e.username="%filtered%"),e.toString()}function Fs(n){if(!n)return{};const e=n.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const t=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:t,hash:r,relative:e[5]+t+r}}function AF(n){return n.split(/[?#]/,1)[0]}function fr(n,e=!0){if(n.startsWith("data:")){const t=n.match(/^data:([^;,]+)/),r=t?t[1]:"text/plain",i=n.includes(";base64,"),s=n.indexOf(",");let a="";if(e&&s!==-1){const o=n.slice(s+1);a=o.length>10?`${o.slice(0,10)}... [truncated]`:o}return`data:${r}${i?",base64":""}${a?`,${a}`:""}`}return n}function LF(n,e){const t=e?.getDsn(),r=e?.getOptions().tunnel;return kF(n,t)||CF(n,r)}function CF(n,e){return e?TE(n)===TE(e):!1}function kF(n,e){const t=Nl(n);return!t||ah(t)||!e?!1:DF(t.hostname,e.host)&&/(^|&|\?)sentry_key=/.test(t.search)}function DF(n,e){return n===e||e.length>0&&n.endsWith(`.${e}`)}function TE(n){return n[n.length-1]==="/"?n.slice(0,-1):n}function PF(n){"aggregates"in n?n.attrs?.ip_address===void 0&&(n.attrs={...n.attrs,ip_address:"{{auto}}"}):n.ipAddress===void 0&&(n.ipAddress="{{auto}}")}function E1(n,e,t=[e],r="npm"){const i=(n._metadata=n._metadata||{}).sdk=n._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${e}`,i.packages=t.map(s=>({name:`${r}:@sentry/${s}`,version:Ps})),i.version=Ps)}function x1(n={}){const e=n.client||Se();if(!kM()||!e)return{};const t=as(),r=Eo(t);if(r.getTraceData)return r.getTraceData(n);const i=n.scope||Le(),s=n.span||Gt(),a=Qa(s)&&!Vn(e.getOptions()),o=s&&!a?IO(s):OF(i),l=s?yi(s):ih(e,i),u=dO(l);if(!RI.test(o))return K.warn("Invalid sentry-trace data. Cannot generate trace data"),{};const d={"sentry-trace":o,baggage:u};return n.propagateTraceparent&&(d.traceparent=s&&!a?wO(s):MF(i)),d}function OF(n){const{traceId:e,sampled:t,propagationSpanId:r}=n.getPropagationContext();return AI(e,r,t)}function MF(n){const{traceId:e,sampled:t,propagationSpanId:r}=n.getPropagationContext();return LI(e,r,t)}const FF=100;function es(n,e){const t=Se(),r=rn();if(!t)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:s=FF}=t.getOptions();if(s<=0)return;const o={timestamp:ea(),...n},l=i?mi(()=>i(o,e)):o;l!==null&&(t.emit&&t.emit("beforeAddBreadcrumb",l,e),r.addBreadcrumb(l,s))}const NF="FunctionToString",_E=new WeakMap,UF=()=>({name:NF,setupOnce(){const n=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=sy(this);let r;try{_E.has(Se())&&t!==void 0&&(r=t)}catch{}return n.apply(r??this,e)}}catch{}},setup(n){_E.set(n,!0)}}),BF=UF,$F=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/Java exception was raised during method invocation$/,/Java object is gone$/],GF="EventFilters",jF=(n={})=>{let e;return{name:GF,setup(t){const r=t.getOptions();e=bE(n,r)},processEvent(t,r,i){if(!e){const s=i.getOptions();e=bE(n,s)}return VF(t,e)?null:t}}},HF=(n={})=>({...jF(n),name:"InboundFilters"});function bE(n={},e={}){return{allowUrls:[...n.allowUrls||[],...e.allowUrls||[]],denyUrls:[...n.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...n.ignoreErrors||[],...e.ignoreErrors||[],...n.disableErrorDefaults?[]:$F],ignoreTransactions:[...n.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function VF(n,e){if(n.type){if(n.type==="transaction"&&zF(n,e.ignoreTransactions))return se&&K.warn(`Event dropped due to being matched by \`ignoreTransactions\` option. 27Event: ${ws(n)}`),!0}else{if(WF(n,e.ignoreErrors))return se&&K.warn(`Event dropped due to being matched by \`ignoreErrors\` option. 28Event: ${ws(n)}`),!0;if(XF(n))return se&&K.warn(`Event dropped due to not having an error message, error type or stacktrace. 29Event: ${ws(n)}`),!0;if(KF(n,e.denyUrls))return se&&K.warn(`Event dropped due to being matched by \`denyUrls\` option. 30Event: ${ws(n)}. 31Url: ${Md(n)}`),!0;if(!qF(n,e.allowUrls))return se&&K.warn(`Event dropped due to not being matched by \`allowUrls\` option. 32Event: ${ws(n)}. 33Url: ${Md(n)}`),!0}return!1}function WF(n,e){return e?.length?p1(n).some(t=>Fr(t,e)):!1}function zF(n,e){if(!e?.length)return!1;const t=n.transaction;return t?Fr(t,e):!1}function KF(n,e){if(!e?.length)return!1;const t=Md(n);return t?Fr(t,e):!1}function qF(n,e){if(!e?.length)return!0;const t=Md(n);return t?Fr(t,e):!0}function YF(n=[]){for(let e=n.length-1;e>=0;e--){const t=n[e];if(t&&t.filename!=="<anonymous>"&&t.filename!=="[native code]")return t.filename||null}return null}function Md(n){try{const t=[...n.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return t?YF(t):null}catch{return se&&K.error(`Cannot extract url for event ${ws(n)}`),null}}function XF(n){return n.exception?.values?.length?!n.message&&!n.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function QF(n,e,t,r,i,s){if(!i.exception?.values||!s||!Br(s.originalException))return;const a=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;a&&(i.exception.values=ig(n,e,r,s.originalException,t,i.exception.values,a,0))}function ig(n,e,t,r,i,s,a,o){if(s.length>=t+1)return s;let l=[...s];if(Br(r[i])){IE(a,o,r);const u=n(e,r[i]),c=l.length;wE(u,i,c,o),l=ig(n,e,t,r[i],i,[u,...l],u,c)}
33return T1(r)&&r.errors.forEach((u,c)=>{if(Br(u)){IE(a,o,r);const d=n(e,u),f=l.length;wE(d,`errors[${c}]`,f,o),l=ig(n,e,t,u,i,[d,...l],d,f)}}),l}function T1(n){return Array.isArray(n.errors)}function IE(n,e,t){n.mechanism={handled:!0,type:"auto.core.linked_errors",...T1(t)&&{is_exception_group:!0},...n.mechanism,exception_id:e}}function wE(n,e,t,r){n.mechanism={handled:!0,...n.mechanism,type:"chained",source:e,exception_id:t,parent_id:r}}function JF(n){return Br(n)&&"__sentry_fetch_url_host__"in n&&typeof n.__sentry_fetch_url_host__=="string"}function RE(n){return JF(n)?`${n.message} (${n.__sentry_fetch_url_host__})`:n.message}const AE=new Set([]);function ZF(n){const e="console",t=os(e,n);return ls(e,eN),t}const LE=new Set;function eN(){"console"in Ie&&hP.forEach(function(n){LE.has(n)||!(n in Ie.console)||(LE.add(n),cn(Ie.console,n,function(e){return kd[n]=e,function(...t){const r=t[0],i=kd[n],s=AE.size&&typeof r=="string"&&Fr(r,AE);s||Gn("console",{args:t,level:n}),(!s||se&&K.isEnabled())&&i?.apply(Ie.console,t)}}))})}function _1(n){return n==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(n)?n:"log"}const tN="Dedupe",nN=()=>{let n;return{name:tN,processEvent(e){if(e.type)return e;try{if(iN(e,n))return se&&K.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return n=e}}},rN=nN;function iN(n,e){return e?!!(sN(n,e)||aN(n,e)):!1}function sN(n,e){const t=n.message,r=e.message;return!(!t&&!r||t&&!r||!t&&r||t!==r||!I1(n,e)||!b1(n,e))}function aN(n,e){const t=CE(e),r=CE(n);return!(!t||!r||t.type!==r.type||t.value!==r.value||!I1(n,e)||!b1(n,e))}function b1(n,e){let t=MS(n),r=MS(e);if(!t&&!r)return!0;if(t&&!r||!t&&r||(t=t,r=r,r.length!==t.length))return!1;for(let i=0;i<r.length;i++){const s=r[i],a=t[i];if(s.filename!==a.filename||s.lineno!==a.lineno||s.colno!==a.colno||s.function!==a.function)return!1}return!0}function I1(n,e){let t=n.fingerprint,r=e.fingerprint;if(!t&&!r)return!0;if(t&&!r||!t&&r)return!1;t=t,r=r;try{return t.join("")===r.join("")}catch{return!1}}function CE(n){return n.exception?.values?.[0]}const oN="ConversationId",lN=()=>({name:oN,setup(n){n.on("spanStart",e=>{const t=Le().getScopeData(),r=rn().getScopeData(),i=t.conversationId||r.conversationId;if(i){const{op:s,data:a,description:o}=ke(e);if(!s?.startsWith("gen_ai.")&&!a["ai.operationId"]&&!o?.startsWith("ai."))return;e.setAttribute(iO,i)}})}}),uN=lN;function cN(n,e,t,r,i){if(!n.fetchData)return;const{method:s,url:a}=n.fetchData,o=Vn()&&e(a);if(n.endTimestamp){const m=n.fetchData.__span;if(!m)return;const g=r[m];g&&(o&&(hN(g,n),dN(g,n,i)),delete r[m]);return}const{spanOrigin:l="auto.http.browser",propagateTraceparent:u=!1}=typeof i=="object"?i:{spanOrigin:i},c=Se(),d=!!Gt(),f=d||!!c&&Hr(c),h=o&&f?fs(gN(a,s,l)):new Vs,p=qI(h)&&d?void 0:h;if(o&&!f&&c?.recordDroppedEvent("no_parent_span","span"),n.fetchData.__span=h.spanContext().spanId,r[h.spanContext().spanId]=h,t(n.fetchData.url)){const m=n.args[0],g={...n.args[1]||{}},y=fN(m,g,Vn()&&f?p:void 0,u);y&&(n.args[1]=g,g.headers=y)}if(c){const m={input:n.args,response:n.response,startTimestamp:n.startTimestamp,endTimestamp:n.endTimestamp};c.emit("beforeOutgoingRequestSpan",h,m)}return h}function dN(n,e,t){(typeof t=="object"&&t!==null?t.onRequestSpanEnd:void 0)?.(n,{headers:e.response?.headers,error:e.error})}function fN(n,e,t,r){const i=x1({span:t,propagateTraceparent:r}),s=i["sentry-trace"],a=i.baggage,o=i.traceparent;if(!s)return;const l=e.headers||(iy(n)?n.headers:void 0);if(l)if(pN(l)){const u=new Headers(l);if(u.get("sentry-trace")||u.set("sentry-trace",s),r&&o&&!u.get("traceparent")&&u.set("traceparent",o),a){const c=u.get("baggage");c?Ju(c)||u.set("baggage",`${c},${a}`):u.set("baggage",a)}return u}else if(mN(l)){const u=[...l];u.find(d=>d[0]==="sentry-trace")||u.push(["sentry-trace",s]),r&&o&&!u.find(d=>d[0]==="traceparent")&&u.push(["traceparent",o]);const c=l.find(d=>d[0]==="baggage"&&typeof d[1]=="string"&&Ju(d[1]));return a&&!c&&u.push(["baggage",a]),u}else{const u="sentry-trace"in l?l["sentry-trace"]:void 0,c="traceparent"in l?l.traceparent:void 0,d="baggage"in l?l.baggage:void 0,f=d?Array.isArray(d)?[...d]:[d]:[],h=d&&(Array.isArray(d)?d.find(m=>Ju(m)):Ju(d));a&&!h&&f.push(a);const p=Object.assign({},l,{"sentry-trace":u??s,...f.length>0&&{baggage:f.join(",")}});return r&&o&&!c&&(p.traceparent=o),p}else return{"sentry-trace":s,...a&&{baggage:a},...o&&{traceparent:o}}}function hN(n,e){if(e.response){xI(n,e.response.status);const t=e.response?.headers?.get("content-length");if(t){const r=parseInt(t);r>0&&n.setAttribute("http.response_content_length",r)}}else e.error&&n.setStatus({code:Lt,message:"internal_error"});n.end()}
33function Ju(n){return typeof n!="string"?!1:n.split(",").some(e=>e.trim().startsWith(Pd))}function pN(n){return typeof Headers<"u"&&th(n,Headers)}function mN(n){return Array.isArray(n)?n.every(e=>Array.isArray(e)&&e.length===2&&typeof e[0]=="string"):!1}function gN(n,e,t){if(n.startsWith("data:")){const s=fr(n);return{name:`${e} ${s}`,attributes:kE(n,void 0,e,t)}}const r=Nl(n),i=r?S1(r):n;return{name:`${e} ${i}`,attributes:kE(n,r,e,t)}}function kE(n,e,t,r){const i={url:fr(n),type:"fetch","http.method":t,[gt]:r,[wn]:"http.client"};return e&&(ah(e)||(i[XI]=fr(e.href),i[xo]=fr(e.href),i["server.address"]=e.host),e.search&&(i["http.query"]=e.search),e.hash&&(i["http.fragment"]=e.hash)),i}function yy(n,e,t,r,i){ZM({level:n,message:e,attributes:t,severityNumber:i},r)}function Na(n,e,{scope:t}={}){yy("info",n,e,t)}function pa(n,e,{scope:t}={}){yy("warn",n,e,t)}function Rs(n,e,{scope:t}={}){yy("error",n,e,t)}function w1(n){if(n!==void 0)return n>=400&&n<500?"warning":n>=500?"error":void 0}const Ul=Ie;function yN(){return"history"in Ul&&!!Ul.history}function vN(){if(!("fetch"in Ul))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function sg(n){return n&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(n.toString())}function SN(){if(typeof EdgeRuntime=="string")return!0;if(!vN())return!1;if(sg(Ul.fetch))return!0;let n=!1;const e=Ul.document;if(e&&typeof e.createElement=="function")try{const t=e.createElement("iframe");t.hidden=!0,e.head.appendChild(t),t.contentWindow?.fetch&&(n=sg(t.contentWindow.fetch)),e.head.removeChild(t)}catch(t){se&&K.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return n}function vy(n,e){const t="fetch",r=os(t,n);return ls(t,()=>R1(void 0,e)),r}function EN(n){const e="fetch-body-resolved",t=os(e,n);return ls(e,()=>R1(TN)),t}function R1(n,e=!1){e&&!SN()||cn(Ie,"fetch",function(t){return function(...r){const i=new Error,{method:s,url:a}=_N(r),o={args:r,fetchData:{method:s,url:a},startTimestamp:Tt()*1e3,virtualError:i,headers:bN(r)};return n||Gn("fetch",{...o}),t.apply(Ie,r).then(async l=>(n?n(l):Gn("fetch",{...o,endTimestamp:Tt()*1e3,response:l}),l),l=>{Gn("fetch",{...o,endTimestamp:Tt()*1e3,error:l}),Br(l)&&l.stack===void 0&&(l.stack=i.stack,Kt(l,"framesToPop",1));const c=Se()?.getOptions().enhanceFetchErrorMessages??"always";if(c!==!1&&Br(l)&&l.name==="TypeError"&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{const h=new URL(o.fetchData.url).host;c==="always"?l.message=`${l.message} (${h})`:Kt(l,"__sentry_fetch_url_host__",h)}catch{}throw l})}})}async function xN(n,e){if(n?.body){const t=n.body,r=t.getReader(),i=setTimeout(()=>{t.cancel().then(null,()=>{})},90*1e3);let s=!0;for(;s;){let a;try{a=setTimeout(()=>{t.cancel().then(null,()=>{})},5e3);const{done:o}=await r.read();clearTimeout(a),o&&(e(),s=!1)}catch{s=!1}finally{clearTimeout(a)}}clearTimeout(i),r.releaseLock(),t.cancel().then(null,()=>{})}}function TN(n){let e;try{e=n.clone()}catch{return}xN(e,()=>{Gn("fetch-body-resolved",{endTimestamp:Tt()*1e3,response:n})})}function sd(n,e){return Zs(n)&&!!n[e]}function DE(n){return typeof n=="string"?n:n?sd(n,"url")?n.url:n.toString?n.toString():"":""}function _N(n){if(n.length===0)return{method:"GET",url:""};if(n.length===2){const[t,r]=n;return{url:DE(t),method:sd(r,"method")?String(r.method).toUpperCase():iy(t)&&sd(t,"method")?String(t.method).toUpperCase():"GET"}}const e=n[0];return{url:DE(e),method:sd(e,"method")?String(e.method).toUpperCase():"GET"}}function bN(n){const[e,t]=n;try{if(typeof t=="object"&&t!==null&&"headers"in t&&t.headers)return new Headers(t.headers);if(iy(e))return new Headers(e.headers)}catch{}}const A1=Ie;function Ws(){try{return A1.document.location.href}catch{return""}}function L1(n,e=5){if(!A1.HTMLElement)return null;let t=n;for(let r=0;r<e;r++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}const ge=Ie;let ag=0;function C1(){return ag>0}function IN(){ag++,setTimeout(()=>{ag--})}function Za(n,e={}){function t(i){return typeof i=="function"}if(!t(n))return n;try{if(Object.prototype.hasOwnProperty.call(n,"__sentry_wrapped__")){const s=n.__sentry_wrapped__;return typeof s=="function"?s:n}if(sy(n))return n}catch{return n}const r=function(...i){Ie._sentryWrappedDepth=(Ie._sentryWrappedDepth||0)+1;try{const s=i.map(a=>Za(a,e));return n.apply(this,s)}catch(s){throw IN(),Lu(a=>{a.addEventProcessor(o=>(e.mechanism&&(qm(o,void 0),Os(o,e.mechanism)),o.extra={...o.extra,arguments:i},o)),kr(s)}),s}finally{Ie._sentryWrappedDepth=(Ie._sentryWrappedDepth||0)-1}};try{for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])}catch{}lI(r,n),Kt(n,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return n.name}})}catch{}return r}function Fd(){const n=Ws(),{referrer:e}=ge.document||{},{userAgent:t}=ge.navigator||{},r={...e&&{Referer:e},...t&&{"User-Agent":t}};return{url:n,headers:r}}function Sy(n,e){const t=oh(n,e),r={type:CN(e),value:kN(e)};return t.length&&(r.stacktrace={frames:t}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function wN(n,e,t,r){const s=Se()?.getOptions().normalizeDepth,a=FN(e),o={__serialized__:dI(e,s)};if(a)return{exception:{values:[Sy(n,a)]},extra:o};const l={exception:{values:[{type:eh(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:ON(e,{isUnhandledRejection:r})}]},extra:o};if(t){const u=oh(n,t);u.length&&(l.exception.values[0].stacktrace={frames:u})}return l}function mp(n,e){return{exception:{values:[Sy(n,e)]}}}function oh(n,e){const t=e.stacktrace||e.stack||"",r=AN(e),i=LN(e);try{return n(t,r,i)}catch{}return[]}const RN=/Minified React error #\d+;/i;function AN(n){return n&&RN.test(n.message)?1:0}function LN(n){return typeof n.framesToPop=="number"?n.framesToPop:0}function k1(n){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?n instanceof WebAssembly.Exception:!1}function CN(n){const e=n?.name;return!e&&k1(n)?n.message&&Array.isArray(n.message)&&n.message.length==2?n.message[0]:"WebAssembly.Exception":e}function kN(n){const e=n?.message;return k1(n)?Array.isArray(n.message)&&n.message.length==2?n.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?RE(e.error):RE(n):"No error message"}function DN(n,e,t,r){const i=t?.syntheticException||void 0,s=Ey(n,e,i,r);return Os(s),s.level="error",t?.event_id&&(s.event_id=t.event_id),Du(s)}function PN(n,e,t="info",r,i){const s=r?.syntheticException||void 0,a=og(n,e,s,i);return a.level=t,r?.event_id&&(a.event_id=r.event_id),Du(a)}function Ey(n,e,t,r,i){let s;if(oI(e)&&e.error)return mp(n,e.error);if(NS(e)||bP(e)){const a=e;if("stack"in e){s=mp(n,e);const o=s.exception?.values?.[0];if(r&&t&&o&&!o.stacktrace){const l=oh(n,t);l.length&&(o.stacktrace={frames:l},Os(s,{synthetic:!0}))}}else{const o=a.name||(NS(a)?"DOMError":"DOMException"),l=a.message?`${o}: ${a.message}`:o;s=og(n,l,t,r),qm(s,l)}return"code"in a&&(s.tags={...s.tags,"DOMException.code":`${a.code}`}),s}return Br(e)?mp(n,e):kl(e)||eh(e)?(s=wN(n,e,t,i),Os(s,{synthetic:!0}),s):(s=og(n,e,t,r),qm(s,`${e}`),Os(s,{synthetic:!0}),s)}function og(n,e,t,r){const i={};if(r&&t){const s=oh(n,t);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]}),Os(i,{synthetic:!0})}
33if(Zf(e)){const{__sentry_template_string__:s,__sentry_template_values__:a}=e;return i.logentry={message:s,params:a},i}return i.message=e,i}function ON(n,{isUnhandledRejection:e}){const t=wP(n),r=e?"promise rejection":"exception";return oI(n)?`Event \`ErrorEvent\` captured as ${r} with message \`${n.message}\``:eh(n)?`Event \`${MN(n)}\` (type=${n.type}) captured as ${r}`:`Object captured as ${r} with keys: ${t}`}function MN(n){try{const e=Object.getPrototypeOf(n);return e?e.constructor.name:void 0}catch{}}function FN(n){return Object.values(n).find(Br)}class NN extends EF{constructor(e){const t=UN(e),r=ge.SENTRY_SDK_SOURCE||zM();E1(t,"browser",["browser"],r),super(t);const{userInfo:i}=this.getDataCollectionOptions();t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:i?"auto":"never",...t._metadata.sdk.settings});const{sendClientReports:s}=this._options;ge.document&&ge.document.addEventListener("visibilitychange",()=>{ge.document.visibilityState==="hidden"&&(s&&this._flushOutcomes(),queueMicrotask(()=>{this.flush()}))}),i&&this.on("beforeSendSession",PF)}eventFromException(e,t){return DN(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return PN(this._options.stackParser,e,t,r,this._options.attachStacktrace)}_prepareEvent(e,t,r,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,r,i)}}function UN(n){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:ge.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n}}const vr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ye=Ie,BN=(n,e)=>n>e[1]?"poor":n>e[0]?"needs-improvement":"good",Pu=(n,e,t,r)=>{let i,s;return a=>{e.value>=0&&(a||r)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=BN(e.value,t),n(e)))}},Ou=(n=!0)=>{const e=ye.performance?.getEntriesByType?.("navigation")[0];if(!n||e&&e.responseStart>0&&e.responseStart<performance.now())return e},To=()=>Ou()?.activationStart??0;function $i(n,e,t){ye.document&&ye.addEventListener(n,e,t)}function Nd(n,e,t){ye.document&&ye.removeEventListener(n,e,t)}let Ua=-1;const D1=new Set,$N=()=>ye.document?.visibilityState==="hidden"&&!ye.document?.prerendering?0:1/0,ad=n=>{if(GN(n)&&Ua>-1){if(n.type==="visibilitychange"||n.type==="pagehide")for(const e of D1)e();isFinite(Ua)||(Ua=n.type==="visibilitychange"?n.timeStamp:0,Nd("prerenderingchange",ad,!0))}},Mu=()=>{if(ye.document&&Ua<0){const n=To();Ua=(ye.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>t.name==="hidden"&&t.startTime>n)[0]?.startTime)??$N(),$i("visibilitychange",ad,!0),$i("pagehide",ad,!0),$i("prerenderingchange",ad,!0)}return{get firstHiddenTime(){return Ua},onHidden(n){D1.add(n)}}};function GN(n){return n.type==="pagehide"||ye.document?.visibilityState==="hidden"}const jN=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,Fu=(n,e=-1)=>{const t=Ou();let r="navigate";return t&&(ye.document?.prerendering||To()>0?r="prerender":ye.document?.wasDiscarded?r="restore":t.type&&(r=t.type.replace(/_/g,"-"))),{name:n,value:e,rating:"good",delta:0,entries:[],id:jN(),navigationType:r}},gp=new WeakMap;function xy(n,e){try{return gp.get(n)||gp.set(n,new e),gp.get(n)}catch{return new e}}class HN{constructor(){this._sessionValue=0,this._sessionEntries=[]}_processEntry(e){if(e.hadRecentInput)return;const t=this._sessionEntries[0],r=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this._sessionValue+=e.value,this._sessionEntries.push(e)):(this._sessionValue=e.value,this._sessionEntries=[e]),this._onAfterProcessingUnexpectedShift?.(e)}}const _o=(n,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(n)){const r=new PerformanceObserver(i=>{Promise.resolve().then(()=>{e(i.getEntries())})});return r.observe({type:n,buffered:!0,...t}),r}}catch{}},Ty=n=>{let e=!1;return()=>{e||(n(),e=!0)}},lh=n=>{ye.document?.prerendering?addEventListener("prerenderingchange",()=>n(),!0):n()},VN=[1800,3e3],WN=(n,e={})=>{lh(()=>{const t=Mu(),r=Fu("FCP");let i;const a=_o("paint",o=>
33{for(const l of o)l.name==="first-contentful-paint"&&(a.disconnect(),l.startTime<t.firstHiddenTime&&(r.value=Math.max(l.startTime-To(),0),r.entries.push(l),i(!0)))});a&&(i=Pu(n,r,VN,e.reportAllChanges))})},zN=[.1,.25],KN=(n,e={})=>{WN(Ty(()=>{const t=Fu("CLS",0);let r;const i=Mu(),s=xy(e,HN),a=l=>{for(const u of l)s._processEntry(u);s._sessionValue>t.value&&(t.value=s._sessionValue,t.entries=s._sessionEntries,r())},o=_o("layout-shift",a);o&&(r=Pu(n,t,zN,e.reportAllChanges),i.onHidden(()=>{a(o.takeRecords()),r(!0)}),ye?.setTimeout?.(r))}))};let P1=0,yp=1/0,Zu=0;const qN=n=>{n.forEach(e=>{e.interactionId&&(yp=Math.min(yp,e.interactionId),Zu=Math.max(Zu,e.interactionId),P1=Zu?(Zu-yp)/7+1:0)})};let lg;const O1=()=>lg?P1:performance.interactionCount||0,YN=()=>{"interactionCount"in performance||lg||(lg=_o("event",qN,{type:"event",buffered:!0,durationThreshold:0}))},vp=10;let M1=0;const XN=()=>O1()-M1;class QN{constructor(){this._longestInteractionList=[],this._longestInteractionMap=new Map}_resetInteractions(){M1=O1(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const e=Math.min(this._longestInteractionList.length-1,Math.floor(XN()/50));return this._longestInteractionList[e]}_processEntry(e){if(this._onBeforeProcessingEntry?.(e),!(e.interactionId||e.entryType==="first-input"))return;const t=this._longestInteractionList.at(-1);let r=this._longestInteractionMap.get(e.interactionId);if(r||this._longestInteractionList.length<vp||e.duration>t._latency){if(r?e.duration>r._latency?(r.entries=[e],r._latency=e.duration):e.duration===r._latency&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],_latency:e.duration},this._longestInteractionMap.set(r.id,r),this._longestInteractionList.push(r)),this._longestInteractionList.sort((i,s)=>s._latency-i._latency),this._longestInteractionList.length>vp){const i=this._longestInteractionList.splice(vp);for(const s of i)this._longestInteractionMap.delete(s.id)}this._onAfterProcessingINPCandidate?.(r)}}}const _y=n=>{const e=ye.requestIdleCallback||ye.setTimeout;ye.document?.visibilityState==="hidden"?n():(n=Ty(n),$i("visibilitychange",n,{once:!0,capture:!0}),$i("pagehide",n,{once:!0,capture:!0}),e(()=>{n(),Nd("visibilitychange",n,{capture:!0}),Nd("pagehide",n,{capture:!0})}))},JN=[200,500],ZN=40,e2=(n,e={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const t=Mu();lh(()=>{YN();const r=Fu("INP");let i;const s=xy(e,QN),a=l=>{_y(()=>{for(const c of l)s._processEntry(c);const u=s._estimateP98LongestInteraction();u&&u._latency!==r.value&&(r.value=u._latency,r.entries=u.entries,i())})},o=_o("event",a,{durationThreshold:e.durationThreshold??ZN});i=Pu(n,r,JN,e.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),t.onHidden(()=>{a(o.takeRecords()),i(!0)}))})};class t2{_processEntry(e){this._onBeforeProcessingEntry?.(e)}}const n2=[2500,4e3],r2=(n,e={})=>{lh(()=>{const t=Mu(),r=Fu("LCP");let i;const s=xy(e,t2),a=l=>{e.reportAllChanges||(l=l.slice(-1));for(const u of l)u&&(s._processEntry(u),u.startTime<t.firstHiddenTime&&(r.value=Math.max(u.startTime-To(),0),r.entries=[u],i()))},o=_o("largest-contentful-paint",a);if(o){i=Pu(n,r,n2,e.reportAllChanges);const l=Ty(()=>{a(o.takeRecords()),o.disconnect(),i(!0)}),u=c=>{c.isTrusted&&(_y(l),Nd(c.type,u,{capture:!0}))};for(const c of["keydown","click","visibilitychange"])$i(c,u,{capture:!0})}})},i2=[800,1800],ug=n=>{ye.document?.prerendering?lh(()=>ug(n)):ye.document?.readyState!=="complete"?addEventListener("load",()=>ug(n),!0):setTimeout(n)},s2=(n,e={})=>{const t=Fu("TTFB"),r=Pu(n,t,i2,e.reportAllChanges);ug(()=>{const i=Ou();i&&(t.value=Math.max(i.responseStart-To(),0),t.entries=[i],r(!0))})},cl={},Ud={};let F1,N1,U1,B1;function uh(n,e=!1){return dh("cls",n,o2,F1,e)}function ch(n,e=!1){return dh("lcp",n,l2,N1,e)}function a2(n){return dh("ttfb",n,u2,U1)}function by(n){return dh("inp",n,c2,B1)}function zs(n,e){return $1(n,e),Ud[n]||(d2(n),Ud[n]=!0),G1(n,e)}function Nu(n,e){const t=cl[n];if(t?.length)for(const r of t)try{r(e)}catch(i){vr&&K.error(`Error while triggering instrumentation handler. 34Type: ${n} 35Name: ${ui(r)} 36Error:`,i)}}function o2(){return KN(n=>{Nu("cls",{metric:n}),F1=n},{reportAllChanges:!0})}function l2(){return r2(n=>{Nu("lcp",{metric:n}),N1=n},{reportAllChanges:!0})}function u2(){return s2(n=>{Nu("ttfb",{metric:n}),U1=n})}function c2(){return e2(n=>{Nu("inp",{metric:n}),B1=n})}function dh(n,e,t,r,i=!1){$1(n,e);let s;return Ud[n]||(s=t(),Ud[n]=!0),r&&e({metric:r}),G1(n,e,i?s:void 0)}function d2(n){const e={};n==="event"&&(e.durationThreshold=0),_o(n,t=>{Nu(n,{entries:t})},e)}function $1(n,e){cl[n]=cl[n]||[],cl[n].push(e)}function G1(n,e,t){return()=>{t&&t();const r=cl[n];if(!r)return;const i=r.indexOf(e);i!==-1&&r.splice(i,1)}}function f2(n){return"duration"in n}const h2=80,xs={};try{typeof Node<"u"&&(xs.parentNode=Object.getOwnPropertyDescriptor(Node.prototype,"parentNode").get),typeof Element<"u"&&(xs.tagName=Object.getOwnPropertyDescriptor(Element.prototype,"tagName").get,xs.id=Object.getOwnPropertyDescriptor(Element.prototype,"id").get,xs.className=Object.getOwnPropertyDescriptor(Element.prototype,"className").get,xs.getAttribute=Element.prototype.getAttribute),typeof HTMLElement<"u"&&(xs.dataset=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"dataset").get)}catch{}function Ri(n,e,t){const r=xs[e];if(r)try{return r.call(n,t)}catch{}const i=n[e];return typeof i=="function"?i.call(n,t):i}function wt(n,e={}){if(!n)return"<unknown>";try{let t=n;const r=5,i=[];let s=0,a=0;const o=" > ",l=o.length;let u;const c=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||h2;for(;t&&s++<r&&(u=p2(t,c),!(u==="html"||s>1&&a+i.length*l+u.length>=d));)i.push(u),a+=u.length,t=Ri(t,"parentNode");return i.reverse().join(o)}catch{return"<unknown>"}}function p2(n,e){const t=[],r=Ri(n,"tagName");if(!r)return"";if(typeof HTMLElement<"u"&&n instanceof HTMLElement){const s=Ri(n,"dataset");if(s){if(s.sentryComponent)return s.sentryComponent;if(s.sentryElement)return s.sentryElement}}t.push(r.toLowerCase());const i=e?.length?e.filter(s=>Ri(n,"getAttribute",s)).map(s=>[s,Ri(n,"getAttribute",s)]):null;if(i?.length)i.forEach(s=>{t.push(`[${s[0]}="${s[1]}"]`)});else{const s=Ri(n,"id");
36s&&t.push(`#${s}`);const a=Ri(n,"className");if(a&&ri(a)){const o=a.split(/\s+/);for(const l of o)t.push(`.${l}`)}}for(const s of["aria-label","type","name","title","alt"]){const a=Ri(n,"getAttribute",s);a&&t.push(`[${s}="${a}"]`)}return t.join("")}const m2=n=>{const e=t=>{(t.type==="pagehide"||ye.document?.visibilityState==="hidden")&&n(t)};$i("visibilitychange",e,{capture:!0,once:!0}),$i("pagehide",e,{capture:!0,once:!0})};function Sp(n){return typeof n=="number"&&isFinite(n)}function ts(n,e,t,{...r}){const i=ke(n).start_timestamp;return i&&i>e&&typeof n.updateStartTime=="function"&&n.updateStartTime(e),KI(n,()=>{const s=fs({startTime:e,...r});return s&&s.end(t),s})}function Iy(n){const e=Se();if(!e)return;const{name:t,transaction:r,attributes:i,startTime:s}=n,{release:a,environment:o}=e.getOptions(),{userInfo:l}=e.getDataCollectionOptions(),c=e.getIntegrationByName("Replay")?.getReplayId(),d=Le(),f=d.getUser(),h=f!==void 0?f.email||f.id||f.ip_address:void 0;let p;try{p=d.getScopeData().contexts.profile.profile_id}catch{}const m={release:a,environment:o,user:h||void 0,profile_id:p||void 0,replay_id:c||void 0,transaction:r,"user_agent.original":ye.navigator?.userAgent,"client.address":l?"{{auto}}":void 0,...i};return fs({name:t,attributes:m,startTime:s,experimental:{standalone:!0}})}function bo(){return ye.addEventListener&&ye.performance}function Ye(n){return n/1e3}function g2(n){let e="unknown",t="unknown",r="";for(const i of n){if(i==="/"){[e,t]=n.split("/");break}if(!isNaN(Number(i))){e=r==="h"?"http":r,t=n.split(r)[1];break}r+=i}return r===n&&(e=r),{name:e,version:t}}function fh(n){try{return PerformanceObserver.supportedEntryTypes.includes(n)}catch{return!1}}function hh(n,e){let t,r=!1;function i(o){!r&&t&&e(o,t.spanContext().spanId,t),r=!0}m2(()=>{i("pagehide")});const s=n.on("beforeStartNavigationSpan",(o,l)=>{l?.isRedirect||(i("navigation"),s(),a())}),a=n.on("afterStartPageLoadSpan",o=>{t=o,a()})}function y2(n){let e=0,t;if(!fh("layout-shift"))return;const r=uh(({metric:i})=>{const s=i.entries[i.entries.length-1];s&&(e=i.value,t=s)},!0);hh(n,(i,s)=>{v2(e,t,s,i),r()})}function v2(n,e,t,r){vr&&K.log(`Sending CLS span (${n})`);const i=e?Ye((Dt()||0)+e.startTime):Tt(),s=Le().getScopeData().transactionName,a=e?wt(e.sources[0]?.node):"Layout shift",o={[gt]:"auto.http.browser.cls",[wn]:"ui.webvital.cls",[cs]:0,"sentry.pageload.span_id":t,"sentry.report_event":r};e?.sources&&e.sources.forEach((u,c)=>{o[`cls.source.${c+1}`]=wt(u.node)});const l=Iy({name:a,transaction:s,attributes:o,startTime:i});l&&(l.addEvent("cls",{[Cu]:"",[ku]:n}),l.end(i))}const S2=6e4;function Uu(n){return n!=null&&n>0&&n<=S2}function E2(n){let e=0,t;if(!fh("largest-contentful-paint"))return;const r=ch(({metric:i})=>{const s=i.entries[i.entries.length-1];!s||!Uu(i.value)||(e=i.value,t=s)},!0);hh(n,(i,s)=>{x2(e,t,s,i),r()})}function x2(n,e,t,r){if(!Uu(n))return;vr&&K.log(`Sending LCP span (${n})`);const i=Ye((Dt()||0)+(e?.startTime||0)),s=Le().getScopeData().transactionName,a=e?wt(e.element):"Largest contentful paint",o={[gt]:"auto.http.browser.lcp",[wn]:"ui.webvital.lcp",[cs]:0,"sentry.pageload.span_id":t,"sentry.report_event":r};e&&(e.element&&(o["lcp.element"]=wt(e.element)),e.id&&(o["lcp.id"]=e.id),e.url&&(o["lcp.url"]=e.url),e.loadTime!=null&&(o["lcp.loadTime"]=e.loadTime),e.renderTime!=null&&(o["lcp.renderTime"]=e.renderTime),e.size!=null&&(o["lcp.size"]=e.size));const l=Iy({name:a,transaction:s,attributes:o,startTime:i});l&&(l.addEvent("lcp",{[Cu]:"millisecond",[ku]:n}),l.end(i))}function On(n){return n&&((Dt()||performance.timeOrigin)+n)/1e3}function j1(n){const e={};if(n.nextHopProtocol!=null){const{name:t,version:r}=g2(n.nextHopProtocol);e["network.protocol.version"]=r,e["network.protocol.name"]=t}return Dt()||bo()?.timeOrigin?T2({...e,"http.request.redirect_start":On(n.redirectStart),"http.request.redirect_end":On(n.redirectEnd),"http.request.worker_start":On(n.workerStart),"http.request.fetch_start":On(n.fetchStart),"http.request.domain_lookup_start":On(n.domainLookupStart),"http.request.domain_lookup_end":On(n.domainLookupEnd),"http.request.connect_start":On(n.connectStart),"http.request.secure_connection_start":On(n.secureConnectionStart),"http.request.connection_end":On(n.connectEnd),"http.request.request_start":On(n.requestStart),"http.request.response_start":On(n.responseStart),"http.request.response_end":On(n.responseEnd),"http.request.time_to_first_byte":n.responseStart!=null?n.responseStart/1e3:void 0}):e}function T2(n){return Object.fromEntries(Object.entries(n).filter(([,e])=>e!=null))}const _2=2147483647;let PE=0,ln={},on,Bd;function b2({recordClsStandaloneSpans:n,recordLcpStandaloneSpans:e,client:t}){const r=bo();if(r&&Dt()){r.mark&&ye.performance.mark("sentry-tracing-init");const i=e?E2(t):e===!1?L2():void 0,s=n?y2(t):n===!1?A2():void 0,a=C2(),o=k2();return()=>{a(),o(),i?.(),s?.()}}return()=>{}}function I2(){zs("longtask",({entries:n})=>{const e=Gt();if(!e)return;const{op:t,start_timestamp:r}=ke(e);for(const i of n){const s=Ye(Dt()+i.startTime),a=Ye(i.duration);t==="navigation"&&r&&s<r||ts(e,s,s+a,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[gt]:"auto.ui.browser.metrics"}})}})}function w2(){new PerformanceObserver(e=>{const t=Gt();if(t)for(const r of e.getEntries()){if(!r.scripts[0])continue;const i=Ye(Dt()+r.startTime),{start_timestamp:s,op:a}=ke(t);if(a==="navigation"&&s&&i<s)continue;const o=Ye(r.duration),l={[gt]:"auto.ui.browser.metrics"},u=r.scripts[0],{invoker:c,invokerType:d,sourceURL:f,sourceFunctionName:h,sourceCharPosition:p}=u;l["browser.script.invoker"]=c,l["browser.script.invoker_type"]=d,f&&(l["code.filepath"]=f),h&&(l["code.function"]=h),p!==-1&&(l["browser.script.source_char_position"]=p),ts(t,i,i+o,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:l})}}).observe({type:"long-animation-frame",buffered:!0})}function R2(){zs("event",({entries:n})=>{const e=Gt();if(e){for(const t of n)if(t.name==="click"){const r=Ye(Dt()+t.startTime),i=Ye(t.duration),s={name:wt(t.target),op:`ui.interaction.${t.name}`,startTime:r,attributes:{[gt]:"auto.ui.browser.metrics"}},a=L1(t.target);a&&(s.attributes["ui.component_name"]=a),ts(e,r,r+i,s)}}})}function A2(){return uh(({metric:n})=>{const e=n.entries[n.entries.length-1];e&&(ln.cls={value:n.value,unit:""},Bd=e)},!0)}function L2(){return ch(({metric:n})=>{const e=n.entries[n.entries.length-1];!e||!Uu(n.value)||(ln.lcp={value:n.value,unit:"millisecond"},on=e)},!0)}function C2(){return a2(({metric:n})=>
36{n.entries[n.entries.length-1]&&(ln.ttfb={value:n.value,unit:"millisecond"})})}function k2(){return zs("paint",({entries:n})=>{const e=Mu();for(const t of n){const r=t.startTime<e.firstHiddenTime;t.name==="first-paint"&&r&&(ln.fp={value:t.startTime,unit:"millisecond"}),t.name==="first-contentful-paint"&&r&&(ln.fcp={value:t.startTime,unit:"millisecond"})}})}function D2(n,e){const t=bo(),r=Dt();if(!t?.getEntries||!r)return;const{spanStreamingEnabled:i,ignorePerformanceApiSpans:s,ignoreResourceSpans:a}=e,o=Ye(r),l=t.getEntries(),{op:u,start_timestamp:c}=ke(n);l.slice(PE).forEach(d=>{const f=Ye(d.startTime),h=Ye(Math.max(0,d.duration));if(!(u==="navigation"&&c&&o+f<c))switch(d.entryType){case"navigation":{N2(n,d,o);break}case"mark":case"paint":case"measure":{M2(n,d,f,h,o,s);break}case"resource":{$2(n,d,d.name,f,h,o,a);break}}}),PE=Math.max(l.length-1,0),G2(n,i)}function P2(n,e){const t=Dt();if(!bo()?.getEntries||!t){OE();return}const{spanStreamingEnabled:r,recordClsOnPageloadSpan:i,recordLcpOnPageloadSpan:s}=e,a=Ye(t);if(ke(n).op==="pageload"){if(V2(ln),r){const o=(l,u,c)=>{const d=c??`browser.web_vital.${l}.value`;n.setAttribute(d,u),vr&&K.log("Setting web vital attribute",{[d]:u},"on pageload span")};["ttfb","fp","fcp"].forEach(l=>{ln[l]&&o(l,ln[l].value)}),ln["ttfb.requestTime"]&&o("ttfb.requestTime",ln["ttfb.requestTime"].value,"browser.web_vital.ttfb.request_time")}else i||delete ln.cls,s||delete ln.lcp,Object.entries(ln).forEach(([o,l])=>{zI(o,l.value,l.unit,n)}),j2(n,e);n.setAttribute(r?"browser.performance.time_origin":"performance.timeOrigin",a),n.setAttribute(r?"browser.performance.navigation.activation_start":"performance.activationStart",To())}OE()}function OE(){on=void 0,Bd=void 0,ln={}}function O2(n){if(n?.entryType==="measure")try{return n.detail.devtools.track==="Components â"}catch{return}}function M2(n,e,t,r,i,s){if(O2(e)||["mark","measure"].includes(e.entryType)&&Fr(e.name,s))return;const a=Ou(!1),o=Ye(a?a.requestStart:0),l=i+Math.max(t,o),u=i+t,c=u+r,d={[gt]:"auto.resource.browser.metrics"};l!==u&&(d["sentry.browser.measure_happened_before_request"]=!0,d["sentry.browser.measure_start_time"]=l),F2(d,e),l<=c&&ts(n,l,c,{name:e.name,op:e.entryType,attributes:d})}function F2(n,e){try{const t=e.detail;if(!t)return;if(typeof t=="object"){for(const[r,i]of Object.entries(t))if(i&&js(i))n[`sentry.browser.measure.detail.${r}`]=i;else if(i!==void 0)try{n[`sentry.browser.measure.detail.${r}`]=JSON.stringify(i)}catch{}return}if(js(t)){n["sentry.browser.measure.detail"]=t;return}try{n["sentry.browser.measure.detail"]=JSON.stringify(t)}catch{}}catch{}}function N2(n,e,t){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{ec(n,e,r,t)}),ec(n,e,"secureConnection",t,"TLS/SSL"),ec(n,e,"fetch",t,"cache"),ec(n,e,"domainLookup",t,"DNS"),B2(n,e,t)}function ec(n,e,t,r,i=t){const s=U2(t),a=e[s],o=e[`${t}Start`];!o||!a||ts(n,r+Ye(o),r+Ye(a),{op:`browser.${i}`,name:e.name,attributes:{[gt]:"auto.ui.browser.metrics",...t==="redirect"&&e.redirectCount!=null?{"http.redirect_count":e.redirectCount}:{}}})}function U2(n){return n==="secureConnection"?"connectEnd":n==="fetch"?"domainLookupStart":`${n}End`}function B2(n,e,t){const r=t+Ye(e.requestStart),i=t+Ye(e.responseEnd),s=t+Ye(e.responseStart);e.responseEnd&&(ts(n,r,i,{op:"browser.request",name:e.name,attributes:{[gt]:"auto.ui.browser.metrics"}}),ts(n,s,i,{op:"browser.response",name:e.name,attributes:{[gt]:"auto.ui.browser.metrics"}}))}function $2(n,e,t,r,i,s,a){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const o=e.initiatorType?`resource.${e.initiatorType}`:"resource.other";if(a?.includes(o))return;const l={[gt]:"auto.resource.browser.metrics"},u=Fs(t);u.protocol&&(l["url.scheme"]=u.protocol.split(":").pop()),u.host&&(l["server.address"]=u.host),l["url.same_origin"]=t.includes(ye.location.origin),l[xo]=t,H2(e,l,[["responseStatus","http.response.status_code"],["transferSize","http.response_transfer_size"],["encodedBodySize","http.response_content_length"],["decodedBodySize","http.decoded_response_content_length"],["renderBlockingStatus","resource.render_blocking_status"],["deliveryType","http.response_delivery_type"]]);const c={...l,...j1(e)},d=s+r,f=d+i;ts(n,d,f,{name:t.replace(ye.location.origin,""),op:o,attributes:c})}function G2(n,e){const t=ye.navigator;if(!t)return;const r=t.connection;r&&(r.effectiveType&&n.setAttribute(e?"network.connection.effective_type":"effectiveConnectionType",r.effectiveType),r.type&&n.setAttribute(e?"network.connection.type":"connectionType",r.type),Sp(r.rtt)&&(e?n.setAttribute("network.connection.rtt",r.rtt):ke(n).op==="pageload"&&zI("connection.rtt",r.rtt,"millisecond"))),Sp(t.deviceMemory)&&(e?n.setAttribute("device.memory.estimated_capacity",t.deviceMemory):n.setAttribute("deviceMemory",`${t.deviceMemory} GB`)),Sp(t.hardwareConcurrency)&&(e?n.setAttribute("device.processor_count",t.hardwareConcurrency):n.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency)))}function j2(n,e){on&&e.recordLcpOnPageloadSpan&&(on.element&&n.setAttribute("lcp.element",wt(on.element)),on.id&&n.setAttribute("lcp.id",on.id
36),on.url&&n.setAttribute("lcp.url",on.url.trim().slice(0,200)),on.loadTime!=null&&n.setAttribute("lcp.loadTime",on.loadTime),on.renderTime!=null&&n.setAttribute("lcp.renderTime",on.renderTime),n.setAttribute("lcp.size",on.size)),Bd?.sources&&e.recordClsOnPageloadSpan&&Bd.sources.forEach((t,r)=>n.setAttribute(`cls.source.${r+1}`,wt(t.node)))}function H2(n,e,t){t.forEach(([r,i])=>{const s=n[r];s!=null&&(typeof s=="number"&&s<_2||typeof s=="string")&&(e[i]=s)})}function V2(n){const e=Ou(!1);if(!e)return;const{responseStart:t,requestStart:r}=e;r<=t&&(n["ttfb.requestTime"]={value:t-r,unit:"millisecond"})}const Ep=[],dl=new Map,aa=new Map,H1=60;function W2(){if(bo()&&Dt()){const e=z2();return()=>{e()}}return()=>{}}const Bl={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function z2(){return by(K2)}const K2=({metric:n})=>{if(n.value==null)return;const e=Ye(n.value);if(e>H1)return;const t=n.entries.find(p=>p.duration===n.value&&Bl[p.name]);if(!t)return;const{interactionId:r}=t,i=Bl[t.name],s=Ye(Dt()+t.startTime),a=Gt(),o=a?Ut(a):void 0,l=r!=null?dl.get(r):void 0,u=l?.span||o,c=u?ke(u).description:Le().getScopeData().transactionName,d=l?.elementName||wt(t.target),f={[gt]:"auto.http.browser.inp",[wn]:`ui.interaction.${i}`,[cs]:t.duration},h=Iy({name:d,transaction:c,attributes:f,startTime:s});h&&(h.addEvent("inp",{[Cu]:"millisecond",[ku]:n.value}),h.end(s+e))};function q2(n){return n!=null?dl.get(n):void 0}function Y2(){const n=Object.keys(Bl);Ja()&&n.forEach(i=>{ye.addEventListener(i,e,{capture:!0,passive:!0})});function e(i){const s=i.target;if(!s)return;const a=wt(s),o=Math.round(i.timeStamp);if(aa.set(o,a),aa.size>50){const l=aa.keys().next().value;l!==void 0&&aa.delete(l)}}function t(i){const s=Math.round(i.startTime);let a=aa.get(s);if(!a)for(let o=-5;o<=5;o++){const l=aa.get(s+o);if(l){a=l;break}}return a||"<unknown>"}const r=({entries:i})=>{const s=Gt(),a=s&&Ut(s);i.forEach(o=>{if(!f2(o))return;const l=o.interactionId;if(l==null||dl.has(l))return;const u=o.target?wt(o.target):t(o);if(Ep.length>10){const c=Ep.shift();dl.delete(c)}Ep.push(l),dl.set(l,{span:a,elementName:u})})};zs("event",r),zs("first-input",r)}function wy(n){const{name:e,op:t,origin:r,metricName:i,value:s,attributes:a,parentSpan:o,reportEvent:l,startTime:u,endTime:c}=n,d=Le().getScopeData().transactionName,f={[gt]:r,[wn]:t,[cs]:0,[`browser.web_vital.${i}.value`]:s,[JI]:d,[QI]:d,"user_agent.original":ye.navigator?.userAgent,...a};o&&OI(o).attributes?.[wn]==="pageload"&&(f["sentry.pageload.span_id"]=o.spanContext().spanId),l&&(f[`browser.web_vital.${i}.report_event`]=l);const h=fs({name:e,attributes:f,startTime:u,parentSpan:o});h&&h.end(c??u)}function X2(n){let e=0,t;if(!fh("largest-contentful-paint"))return;const r=ch(({metric:i})=>{const s=i.entries[i.entries.length-1];!s||!Uu(i.value)||(e=i.value,t=s)},!0);hh(n,(i,s,a)=>{Q2(e,t,a,i),r()})}function Q2(n,e,t,r){if(!Uu(n))return;vr&&K.log(`Sending LCP span (${n})`);const i=Dt()||0,s=Ye(i),a=Ye(i+(e?.startTime||0)),o=e?wt(e.element):"Largest contentful paint",l={};e?.element&&(l["browser.web_vital.lcp.element"]=wt(e.element)),e?.id&&(l["browser.web_vital.lcp.id"]=e.id),e?.url&&(l["browser.web_vital.lcp.url"]=e.url),e?.loadTime!=null&&(l["browser.web_vital.lcp.load_time"]=e.loadTime),e?.renderTime!=null&&(l["browser.web_vital.lcp.render_time"]=e.renderTime),e?.size!=null&&(l["browser.web_vital.lcp.size"]=e.size),wy({name:o,op:"ui.webvital.lcp",origin:"auto.http.browser.lcp",metricName:"lcp",value:n,attributes:l,parentSpan:t,reportEvent:r,startTime:s,endTime:a})}function J2(n){let e=0,t;if(!fh("layout-shift"))return;const r=uh(({metric:i})=>{const s=i.entries[i.entries.length-1];s&&(e=i.value,t=s)},!0);hh(n,(i,s,a)=>{Z2(e,t,a,i),r()})}function Z2(n,e,t,r){vr&&K.log(`Sending CLS span (${n})`);const i=e?Ye((Dt()||0)+e.startTime):Tt(),s=e?wt(e.sources[0]?.node):"Layout shift",a={};
36e?.sources&&e.sources.forEach((o,l)=>{a[`browser.web_vital.cls.source.${l+1}`]=wt(o.node)}),wy({name:s,op:"ui.webvital.cls",origin:"auto.http.browser.cls",metricName:"cls",value:n,attributes:a,parentSpan:t,reportEvent:r,startTime:i})}function eU(){if(!bo()||!Dt())return;by(({metric:t})=>{if(t.value==null||Ye(t.value)>H1)return;const i=t.entries.find(s=>s.duration===t.value&&Bl[s.name]);i&&tU(t.value,i)})}function tU(n,e){vr&&K.log(`Sending INP span (${n})`);const t=Ye(Dt()+e.startTime),r=Ye(n),i=Bl[e.name],s=q2(e.interactionId),a=Gt(),o=a?Ut(a):void 0,l=s?.span||o,u=l?OI(l).name:Le().getScopeData().transactionName,c=s?.elementName||wt(e.target);wy({name:c,op:`ui.interaction.${i}`,origin:"auto.http.browser.inp",metricName:"inp",value:n,attributes:{[cs]:e.duration,[JI]:u,[QI]:u},startTime:t,endTime:t+r,parentSpan:l})}const nU=1e3;let ME,cg,dg;function V1(n){const e="dom";os(e,n),ls(e,rU)}function rU(){if(!ye.document)return;const n=Gn.bind(null,"dom"),e=FE(n,!0);ye.document.addEventListener("click",e,!1),ye.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(t=>{const i=ye[t]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(cn(i,"addEventListener",function(s){return function(a,o,l){if(a==="click"||a=="keypress")try{const u=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},c=u[a]=u[a]||{refCount:0};if(!c.handler){const d=FE(n);c.handler=d,s.call(this,a,d,l)}c.refCount++}catch{}return s.call(this,a,o,l)}}),cn(i,"removeEventListener",function(s){return function(a,o,l){if(a==="click"||a=="keypress")try{const u=this.__sentry_instrumentation_handlers__||{},c=u[a];c&&(c.refCount--,c.refCount<=0&&(s.call(this,a,c.handler,l),c.handler=void 0,delete u[a]),Object.keys(u).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return s.call(this,a,o,l)}}))})}function iU(n){if(n.type!==cg)return!1;try{if(!n.target||n.target._sentryId!==dg)return!1}catch{}return!0}function sU(n,e){return n!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function FE(n,e=!1){return t=>{if(!t||t._sentryCaptured)return;const r=aU(t);if(sU(t.type,r))return;Kt(t,"_sentryCaptured",!0),r&&!r._sentryId&&Kt(r,"_sentryId",_n());const i=t.type==="keypress"?"input":t.type;iU(t)||(n({event:t,name:i,global:e}),cg=t.type,dg=r?r._sentryId:void 0),clearTimeout(ME),ME=ye.setTimeout(()=>{dg=void 0,cg=void 0},nU)}}function aU(n){try{return n.target}catch{return null}}let tc;function ph(n){const e="history";os(e,n),ls(e,oU)}function oU(){if(ye.addEventListener("popstate",()=>{const e=ye.location.href,t=tc;if(tc=e,t===e)return;Gn("history",{from:t,to:e})}),!yN())return;function n(e){return function(...t){const r=t.length>2?t[2]:void 0;if(r){const i=tc,s=lU(String(r));if(tc=s,i===s)return e.apply(this,t);Gn("history",{from:i,to:s})}return e.apply(this,t)}}cn(ye.history,"pushState",n),cn(ye.history,"replaceState",n)}function lU(n){try{return new URL(n,ye.location.origin).toString()}catch{return n}}const od={};function W1(n){const e=od[n];if(e)return e;let t=ye[n];if(sg(t))return od[n]=t.bind(ye);const r=ye.document;if(r&&typeof r.createElement=="function")try{const i=r.createElement("iframe");i.hidden=!0,r.head.appendChild(i);const s=i.contentWindow;s?.[n]&&(t=s[n]),r.head.removeChild(i)}catch(i){vr&&K.warn(`Could not create sandbox iframe for ${n} check, bailing to window.${n}: `,i)}return t&&(od[n]=t.bind(ye))}function uU(n){od[n]=void 0}function Bu(...n){return W1("setTimeout")(...n)}const As="__sentry_xhr_v3__";function z1(n){const e="xhr";os(e,n),ls(e,cU)}function cU(){if(!ye.XMLHttpRequest)return;const n=XMLHttpRequest.prototype;n.open=new Proxy(n.open,{apply(e,t,r){let i=new Error;const s=Tt()*1e3,a=ri(r[0])?r[0].toUpperCase():void 0,o=dU(r[1]);if(!a||!o)return e.apply(t,r);t[As]={method:a,url:o,request_headers:{}},a==="POST"&&o.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const l=()=>{const u=t[As];if(u&&t.readyState===4){try{u.status_code=t.status}catch{}const c={endTimestamp:Tt()*1e3,startTimestamp:s,xhr:t,virtualError:i};Gn("xhr",c),i=void 0,t.removeEventListener("readystatechange",l)}};return"onreadystatechange"in t&&typeof t.onreadystatechange=="function"?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(u,c,d){return l(),u.apply(c,d)}}):t.addEventListener("readystatechange",l),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(u,c,d){const[f,h]=d,p=c[As];
36return p&&ri(f)&&ri(h)&&(p.request_headers[f.toLowerCase()]=h),u.apply(c,d)}}),e.apply(t,r)}}),n.send=new Proxy(n.send,{apply(e,t,r){const i=t[As];if(!i)return e.apply(t,r);r[0]!==void 0&&(i.body=r[0]);const s={startTimestamp:Tt()*1e3,xhr:t};return Gn("xhr",s),e.apply(t,r)}})}function dU(n){if(ri(n))return n;try{return n.toString()}catch{}}const fU=Symbol.for("sentry__originalRequestBody");function K1(n){return new URLSearchParams(n).toString()}function q1(n,e=K){try{if(typeof n=="string")return[n];if(n instanceof URLSearchParams)return[n.toString()];if(n instanceof FormData)return[K1(n)];if(!n)return[void 0]}catch(t){return vr&&e.error(t,"Failed to serialize body",n),[void 0,"BODY_PARSE_ERROR"]}return vr&&e.log("Skipping network body because of body type",n),[void 0,"UNPARSEABLE_BODY_TYPE"]}function Y1(n=[]){if(n.length>=2&&n[1]&&typeof n[1]=="object"&&"body"in n[1])return n[1].body;if(n.length>=1&&n[0]instanceof Request){const t=n[0][fU];return t!==void 0?t:void 0}}function X1(n){let e;try{e=n.getAllResponseHeaders()}catch(t){return vr&&K.error(t,"Failed to get xhr response headers",n),{}}return e?e.split(`\r 37`).reduce((t,r)=>{const[i,s]=r.split(": ");return s&&(t[i.toLowerCase()]=s),t},{}):{}}function hU(n){if(typeof Element>"u")return!1;try{return n instanceof Element}catch{return!1}}const pU=40;function mU(n,e=W1("fetch")){let t=0,r=0;async function i(s){const a=s.body.length;t+=a,r++;const o={body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:n.headers,keepalive:t<=6e4&&r<15,...n.fetchOptions};try{const l=await e(n.url,o);return{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}}catch(l){throw uU("fetch"),l}finally{t-=a,r--}}return cF(n,i,gy(n.bufferSize||pU))}const en=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,gU=30,yU=50;function fg(n,e,t,r){const i={filename:n,function:e==="<anonymous>"?Gs:e,in_app:!0};return t!==void 0&&(i.lineno=t),r!==void 0&&(i.colno=r),i}const vU=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,SU=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,EU=/\((\S*)(?::(\d+))(?::(\d+))\)/,xU=/at (.+?) ?\(data:(.+?),/,TU=n=>{const e=n.match(xU);if(e)return{filename:`<data:${e[2]}>`,function:e[1]};const t=vU.exec(n);if(t){const[,i,s,a]=t;return fg(i,Gs,+s,+a)}const r=SU.exec(n);if(r){if(r[2]?.indexOf("eval")===0){const o=EU.exec(r[2]);o&&(r[2]=o[1],r[3]=o[2],r[4]=o[3])}const[s,a]=Q1(r[1]||Gs,r[2]);return fg(a,s,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},_U=[gU,TU],bU=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,IU=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wU=n=>{const e=bU.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const s=IU.exec(e[3]);s&&(e[1]=e[1]||"eval",e[3]=s[1],e[4]=s[2],e[5]="")}let r=e[3],i=e[1]||Gs;return[i,r]=Q1(i,r),fg(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},RU=[yU,wU],AU=[_U,RU],LU=rI(...AU),Q1=(n,e)=>{const t=n.indexOf("safari-extension")!==-1,r=n.indexOf("safari-web-extension")!==-1;return t||r?[n.indexOf("@")!==-1?n.split("@")[0]:Gs,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[n,e]},nc=1024,CU="Breadcrumbs",kU=(n={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...n};return{name:CU,setup(t){e.console&&ZF(MU(t)),e.dom&&V1(OU(t,e.dom)),e.xhr&&z1(FU(t)),e.fetch&&vy(NU(t)),e.history&&ph(UU(t)),e.sentry&&t.on("beforeSendEvent",PU(t))}}},DU=kU;function PU(n){return function(t){Se()===n&&es({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:ws(t)},{event:t})}}function OU(n,e){return function(r){if(Se()!==n)return;let i,s,a=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>nc&&(en&&K.warn(`\`dom.maxStringLength\` cannot exceed ${nc}, but a value of ${o} was configured. Sentry will use ${nc} instead.`),o=nc),typeof a=="string"&&(a=[a]);try{const u=r.event,c=BU(u)?u.target:u;i=wt(c,{keyAttrs:a,maxStringLength:o}),s=L1(c)}catch{i="<unknown>"}if(i.length===0)return;const l={category:`ui.${r.name}`,message:i};s&&(l.data={"ui.component_name":s}),es(l,{event:r.event,name:r.name,global:r.global})}}function MU(n){return function(t){if(Se()!==n)return;const r={category:"console",data:{arguments:t.args,logger:"console"},level:_1(t.level),message:BS(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)r.message=`Assertion failed: ${BS(t.args.slice(1)," ")||"console.assert"}`,r.data.arguments=t.args.slice(1);else return;es(r,{input:t.args,level:t.level})}}function FU(n){return function(t){if(Se()!==n)return;const{startTimestamp:r,endTimestamp:i}=t,s=t.xhr[As];if(!r||!i||!s)return;const{method:a,url:o,status_code:l,body:u}=s,c={method:a,url:o,status_code:l},d={xhr:t.xhr,input:u,startTimestamp:r,endTimestamp:i},f={category:"xhr",data:c,type:"http",level:w1(l)};n.emit("beforeOutgoingRequestBreadcrumb",f,d),es(f,d)}}function NU(n){return function(t){if(Se()!==n)return;const{startTimestamp:r,endTimestamp:i}=t;
37if(i&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.error){const s={data:t.error,input:t.args,startTimestamp:r,endTimestamp:i},a={category:"fetch",data:t.fetchData,level:"error",type:"http"};n.emit("beforeOutgoingRequestBreadcrumb",a,s),es(a,s)}else{const s=t.response,a={...t.fetchData,status_code:s?.status},o={input:t.args,response:s,startTimestamp:r,endTimestamp:i},l={category:"fetch",data:a,type:"http",level:w1(a.status_code)};n.emit("beforeOutgoingRequestBreadcrumb",l,o),es(l,o)}}}function UU(n){return function(t){if(Se()!==n)return;let r=t.from,i=t.to;const s=Fs(ge.location.href);let a=r?Fs(r):void 0;const o=Fs(i);a?.path||(a=s),s.protocol===o.protocol&&s.host===o.host&&(i=o.relative),s.protocol===a.protocol&&s.host===a.host&&(r=a.relative),es({category:"navigation",data:{from:r,to:i}})}}function BU(n){return!!n&&!!n.target}const $U="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),GU="BrowserApiErrors",jU=(n={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...n};return{name:GU,setupOnce(){e.setTimeout&&cn(ge,"setTimeout",NE),e.setInterval&&cn(ge,"setInterval",NE),e.requestAnimationFrame&&cn(ge,"requestAnimationFrame",VU),e.XMLHttpRequest&&"XMLHttpRequest"in ge&&cn(XMLHttpRequest.prototype,"send",WU);const t=e.eventTarget;t&&(Array.isArray(t)?t:$U).forEach(i=>zU(i,e))}}},HU=jU;function NE(n){return function(...e){const t=e[0];return e[0]=Za(t,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ui(n)}`}}),n.apply(this,e)}}function VU(n){return function(e){return n.apply(this,[Za(e,{mechanism:{data:{handler:ui(n)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function WU(n){return function(...e){const t=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in t&&typeof t[i]=="function"&&cn(t,i,function(s){const a={mechanism:{data:{handler:ui(s)},handled:!1,type:`auto.browser.browserapierrors.xhr.${i}`}},o=sy(s);return o&&(a.mechanism.data.handler=ui(o)),Za(s,a)})}),n.apply(this,e)}}function zU(n,e){const r=ge[n]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(cn(r,"addEventListener",function(i){return function(s,a,o){try{KU(a)&&(a.handleEvent=Za(a.handleEvent,{mechanism:{data:{handler:ui(a),target:n},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&qU(this,s,a),i.apply(this,[s,Za(a,{mechanism:{data:{handler:ui(a),target:n},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),cn(r,"removeEventListener",function(i){return function(s,a,o){try{if(Object.prototype.hasOwnProperty.call(a,"__sentry_wrapped__")){const l=a.__sentry_wrapped__;l&&i.call(this,s,l,o)}}catch{}return i.call(this,s,a,o)}}))}function KU(n){return typeof n.handleEvent=="function"}function qU(n,e,t){n&&typeof n=="object"&&"removeEventListener"in n&&typeof n.removeEventListener=="function"&&n.removeEventListener(e,t)}const YU=(n={})=>{const e=n.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof ge.document>"u"){en&&K.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}fE({ignoreDuration:!0});let t=!1;_y(()=>{t||(dp(),t=!0)});const r=rn();let i=r.getUser();r.addScopeListener(s=>{const a=s.getUser();(i?.id!==a?.id||i?.ip_address!==a?.ip_address)&&(i=a,t&&dp())}),e==="route"&&ph(({from:s,to:a})=>{s!==a&&(fE({ignoreDuration:!0}),dp(),t=!0)})}}},XU="CultureContext",QU=()=>({name:XU,preprocessEvent(n){const e=UE();e&&(n.contexts={...n.contexts,culture:{...e,...n.contexts?.culture}})},processSegmentSpan(n){const e=UE();e&&Od(n,{"culture.locale":e.locale,"culture.timezone":e.timezone,"culture.calendar":e.calendar})}}),JU=QU;function UE(){try{const n=ge.Intl;if(!n)return;const e=n.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone,calendar:e.calendar}}catch{return}}const ZU="GlobalHandlers",eB=(n={})=>{const e={onerror:!0,onunhandledrejection:!0,...n};return{name:ZU,setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(nB(t),BE("onerror")),e.onunhandledrejection&&(rB(t),BE("onunhandledrejection"))}}},tB=eB;function nB(n){iI(e=>{const{stackParser:t,attachStacktrace:r}=J1();if(Se()!==n||C1())return;const{msg:i,url:s,line:a,column:o,error:l}=e,u=aB(Ey(t,l||i,void 0,r,!1),s,a,o);u.level="error",t1(u,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function rB(n){sI(e=>{const{stackParser:t,attachStacktrace:r}=J1();if(Se()!==n||C1())return;const i=iB(e),s=js(i)?sB(i):Ey(t,i,void 0,r,!0);s.level="error",t1(s,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function iB(n){if(js(n))return n;try{if("reason"in n)return n.reason;if("detail"in n&&"reason"in n.detail)return n.detail.reason}catch{}return n}function sB(n){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`}]}}}function aB(n,e,t,r){const i=n.exception=n.exception||{},s=i.values=i.values||[],a=s[0]=s[0]||{},o=a.stacktrace=a.stacktrace||{},l=o.frames=o.frames||[];return l.length===0&&l.push({colno:r,lineno:t,filename:oB(e)??Ws(),function:Gs,in_app:!0}),n}function BE(n){en&&K.log(`Global Handler attached: ${n}`)}function J1(){return Se()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function oB(n){if(!(!ri(n)||n.length===0))return n.startsWith("data:")?`<${fr(n,!1)}>`:n}const lB=()=>({name:"HttpContext",preprocessEvent(n){if(!ge.navigator&&!ge.location&&!ge.document)return;const e=Fd(),t={...e.headers,...n.request?.headers};n.request={...e,...n.request,headers:t}},processSpan(n){if(!ge.navigator&&!ge.location&&!ge.document)return;const e=Fd();Od(n,{[yM]:e.headers["User-Agent"],...n.is_segment&&{[xo]:n.attributes?.[mM]!=="http.client"?e.url:void 0,[`${pM}.referer`]:e.headers.Referer}})}}),uB="cause",cB=5,dB="LinkedErrors",fB=(n={})=>{const e=n.limit||cB,t=n.key||uB;return{name:dB,preprocessEvent(r,i,s){const a=s.getOptions();QF(Sy,a.stackParser,t,e,r,i)}}},hB=fB,pB=/^HTML(\w*)Element$/;function Z1(n){if(typeof window<"u"&&n===window)return"[Window]";if(typeof document<"u"&&n===document)return"[Document]";if(hU(n)){const e=mB(n);if(pB.test(e))return`[HTMLElement: ${wt(n)}]`}}function mB(n){const e=Object.getPrototypeOf(n);return e?.constructor?e.constructor.name:"null prototype"}function gB(){return yB()?(en&&mi(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function yB(){if(typeof ge.window>"u")return!1;const n=ge;if(n.nw||!(n.chrome||n.browser)?.runtime?.id)return!1;const t=Ws();return!(ge===ge.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(t))}function vB(n){return[HF(),BF(),uN(),HU(),DU(),tB(),hB(),rN(),lB(),JU(),YU()]}function SB(n={}){const e=!n.skipBrowserExtensionCheck&&gB();let t=n.defaultIntegrations==null?vB():n.defaultIntegrations;const r={...n,enabled:e?!1:n.enabled,stackParser:EP(n.stackParser||LU),integrations:BM({integrations:n.integrations,defaultIntegrations:t}),transport:n.transport||mU};return cI(Z1),IF(NN,r)}function $E(n={}){const e=ge.document,t=e?.head||e?.body;if(!t){en&&K.error("[showReportDialog] Global document not defined");return}const r=Le(),s=Se()?.getDsn();if(!s){en&&K.error("[showReportDialog] DSN not configured");return}const a={...n,user:{...r.getUser(),...n.user},eventId:n.eventId||CM()},o=ge.document.createElement("script");o.async=!0,o.crossOrigin="anonymous",o.src=NM(s,a);const{onLoad:l,onClose:u}=a;if(l&&(o.onload=l),u){const c=d=>
37{if(d.data==="__sentry_reportdialog_closed__")try{u()}finally{ge.removeEventListener("message",c)}};ge.addEventListener("message",c)}t.appendChild(o)}const Ke=Ie,Ry="sentryReplaySession",EB="replay_event",Ay="Unable to send Replay",xB=3e5,TB=9e5,_B=5e3,bB=5500,IB=6e4,wB=5e3,RB=3,GE=15e4,rc=5e3,AB=3e3,LB=300,Ly=2e7,CB=4999,kB=5e4,jE=36e5;var DB=Object.defineProperty,PB=(n,e,t)=>e in n?DB(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,HE=(n,e,t)=>PB(n,typeof e!="symbol"?e+"":e,t),Et=(n=>(n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment",n))(Et||{});function OB(n){return n.nodeType===n.ELEMENT_NODE}function fl(n){return n?.host?.shadowRoot===n}function hl(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function MB(n){return n.includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),n}function FB(n){const{cssText:e}=n;if(e.split('"').length<3)return e;const t=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?t.push("layer"):n.layerName&&t.push(`layer(${n.layerName})`),n.supportsText&&t.push(`supports(${n.supportsText})`),n.media.length&&t.push(n.media.mediaText),t.join(" ")+";"}function $d(n){try{const e=n.rules||n.cssRules;return e?MB(Array.from(e,ew).join("")):null}catch{return null}}function NB(n){let e="";for(let t=0;t<n.style.length;t++){const r=n.style,i=r[t],s=r.getPropertyPriority(i);e+=`${i}:${r.getPropertyValue(i)}${s?" !important":""};`}return`${n.selectorText} { ${e} }`}function ew(n){let e;if(BB(n))try{e=$d(n.styleSheet)||FB(n)}catch{}else if($B(n)){let t=n.cssText;const r=n.selectorText.includes(":"),i=typeof n.style.all=="string"&&n.style.all;if(i&&(t=NB(n)),r&&(t=UB(t)),r||i)return t}return e||n.cssText}function UB(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function BB(n){return"styleSheet"in n}function $B(n){return"selectorText"in n}class tw{constructor(){HE(this,"idNodeMap",new Map),HE(this,"nodeMetaMap",new WeakMap)}getId(e){return e?this.getMeta(e)?.id??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function GB(){return new tw}function mh({maskInputOptions:n,tagName:e,type:t}){return e==="OPTION"&&(e="SELECT"),!!(n[e.toLowerCase()]||t&&n[t]||t==="password"||e==="INPUT"&&!t&&n.text)}function $l({isMasked:n,element:e,value:t,maskInputFn:r}){let i=t||"";return n?(r&&(i=r(i,e)),"*".repeat(i.length)):i}function eo(n){return n.toLowerCase()}function hg(n){return n.toUpperCase()}const VE="__rrweb_original__";function jB(n){const e=n.getContext("2d");if(!e)return!0;const t=50;for(let r=0;r<n.width;r+=t)for(let i=0;i<n.height;i+=t){const s=e.getImageData,a=VE in s?s[VE]:s;if(new Uint32Array(a.call(e,r,i,Math.min(t,n.width-r),Math.min(t,n.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function Cy(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?eo(e):null}function Gd(n,e,t){return e==="INPUT"&&(t==="radio"||t==="checkbox")?n.getAttribute("value")||"":n.value}function nw(n,e){let t;try{t=new URL(n,e??window.location.href)}catch{return null}const r=/\.([0-9a-z]+)(?:$)/i;return t.pathname.match(r)?.[1]??null}const WE={};function rw(n){const e=WE[n];if(e)return e;const t=window.document;let r=window[n];if(t&&typeof t.createElement=="function")try{const i=t.createElement("iframe");i.hidden=!0,t.head.appendChild(i);
37const s=i.contentWindow;s&&s[n]&&(r=s[n]),t.head.removeChild(i)}catch{}return WE[n]=r.bind(window)}function pg(...n){return rw("setTimeout")(...n)}function iw(...n){return rw("clearTimeout")(...n)}function sw(n){try{return n.contentDocument}catch{}}function HB(n){try{return n.contentWindow}catch{}}let VB=1;const WB=new RegExp("[^a-z0-9-_:]"),Gl=-2;function ky(){return VB++}function zB(n){if(n instanceof HTMLFormElement)return"form";const e=eo(n.tagName);return WB.test(e)?"div":e}function KB(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let oa,zE;const qB=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,YB=/^(?:[a-z+]+:)?\/\//i,XB=/^www\..*/i,QB=/^(data:)([^,]*),(.*)/i;function JB(n,e){if(!n||e.size===0)return n;try{const t=n.split(";"),r=[];for(let i of t){if(i=i.trim(),!i)continue;const s=i.indexOf(":");if(s===-1){r.push(i);continue}const a=i.slice(0,s).trim();e.has(a)||r.push(i)}return r.join("; ")+(r.length>0&&n.endsWith(";")?";":"")}catch(t){return console.warn("Error filtering CSS properties:",t),n}}function jd(n,e){return(n||"").replace(qB,(t,r,i,s,a,o)=>{const l=i||a||o,u=r||s||"";if(!l)return t;if(YB.test(l)||XB.test(l))return`url(${u}${l}${u})`;if(QB.test(l))return`url(${u}${l}${u})`;if(l[0]==="/")return`url(${u}${KB(e)+l}${u})`;const c=e.split("/"),d=l.split("/");c.pop();for(const f of d)f!=="."&&(f===".."?c.pop():c.push(f));return`url(${u}${c.join("/")}${u})`})}const ZB=/^[^ \t\n\r\u000c]+/,e$=/^[, \t\n\r\u000c]+/;function t$(n,e){if(e.trim()==="")return e;let t=0;function r(s){let a;const o=s.exec(e.substring(t));return o?(a=o[0],t+=a.length,a):""}const i=[];for(;r(e$),!(t>=e.length);){let s=r(ZB);if(s.slice(-1)===",")s=Ea(n,s.substring(0,s.length-1)),i.push(s);else{let a="";s=Ea(n,s);let o=!1;for(;;){const l=e.charAt(t);if(l===""){i.push((s+a).trim());break}else if(o)l===")"&&(o=!1);else if(l===","){t+=1,i.push((s+a).trim());break}else l==="("&&(o=!0);a+=l,t+=1}}}return i.join(", ")}const KE=new WeakMap;function Ea(n,e){return!e||e.trim()===""?e:gh(n,e)}function n$(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function gh(n,e){let t=KE.get(n);if(t||(t=n.createElement("a"),KE.set(n,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function aw(n,e,t,r,i,s,a){if(!r)return r;if(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#"))return Ea(n,r);if(t==="xlink:href"&&r[0]!=="#")return Ea(n,r);if(t==="background"&&(e==="table"||e==="td"||e==="th"))return Ea(n,r);if(t==="srcset")return t$(n,r);if(t==="style"){let o=jd(r,gh(n));return a&&a.size>0&&(o=JB(o,a)),o}else if(e==="object"&&t==="data")return Ea(n,r);return typeof s=="function"?s(t,r,i):r}function ow(n,e,t){return(n==="video"||n==="audio")&&e==="autoplay"}function r$(n,e,t,r){try{if(r&&n.matches(r))return!1;if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(let i=n.classList.length;i--;){const s=n.classList[i];if(e.test(s))return!0}if(t)return n.matches(t)}catch{}return!1}function i$(n,e){for(let t=n.classList.length;t--;){const r=n.classList[t];if(e.test(r))return!0}return!1}function Ls(n,e,t=1/0,r=0){return!n||n.nodeType!==n.ELEMENT_NODE||r>t?-1:e(n)?r:Ls(n.parentNode,e,t,r+1)}function xa(n,e){return t=>{const r=t;if(r===null)return!1;try{if(n){if(typeof n=="string"){if(r.matches(`.${n}`))return!0}else if(i$(r,n))return!0}return!!(e&&r.matches(e))}catch{return!1}}}function to(n,e,t,r,i,s){try{const a=n.nodeType===n.ELEMENT_NODE?n:n.parentElement;if(a===null)return!1;if(a.tagName==="INPUT"){const u=a.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(u))return!0}let o=-1,l=-1;if(s){if(l=Ls(a,xa(r,i)),l<0)return!0;o=Ls(a,xa(e,t),l>=0?l:1/0)}else{if(o=Ls(a,xa(e,t)),o<0)return!1;l=Ls(a,xa(r,i),o>=0?o:1/0)}return o>=0?l>=0?o<=l:!0:l>=0?!1:!!s}catch{}return!!s}function s$(n,e,t){const r=HB(n);if(!r)return;let i=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){const o=pg(()=>{i||(e(),i=!0)},t);n.addEventListener("load",()=>{iw(o),i=!0,e()});return}const a="about:blank";if(r.location.href!==a||n.src===a||n.src==="")return pg(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function a$(n,e,t){let r=!1,i;try{i=n.sheet}catch{i=null}if(i)return;const s=pg(()=>{r||(e(),r=!0)},t);n.addEventListener("load",()=>{iw(s),r=!0,e()})}function o$(n,e){const{doc:t,mirror:r,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:o,maskAttributeFn:l,maskTextClass:u,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:f,inlineStylesheet:h,maskInputOptions:p={},maskTextFn:m,maskInputFn:g,dataURLOptions:y={}
37,inlineImages:v,recordCanvas:S,keepIframeSrcFn:x,newlyAddedElement:T=!1,ignoreCSSAttributes:w}=e,I=l$(t,r);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:Et.Document,childNodes:[],compatMode:n.compatMode}:{type:Et.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:Et.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:I};case n.ELEMENT_NODE:return c$(n,{doc:t,blockClass:i,blockSelector:s,unblockSelector:a,inlineStylesheet:h,maskAttributeFn:l,maskInputOptions:p,maskInputFn:g,dataURLOptions:y,inlineImages:v,recordCanvas:S,keepIframeSrcFn:x,newlyAddedElement:T,rootId:I,maskTextClass:u,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:f,ignoreCSSAttributes:w});case n.TEXT_NODE:return u$(n,{doc:t,maskAllText:o,maskTextClass:u,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:f,maskTextFn:m,maskInputOptions:p,maskInputFn:g,rootId:I});case n.CDATA_SECTION_NODE:return{type:Et.CDATA,textContent:"",rootId:I};case n.COMMENT_NODE:return{type:Et.Comment,textContent:n.textContent||"",rootId:I};default:return!1}}function l$(n,e){if(!e.hasNode(n))return;const t=e.getId(n);return t===1?void 0:t}function u$(n,e){const{maskAllText:t,maskTextClass:r,unmaskTextClass:i,maskTextSelector:s,unmaskTextSelector:a,maskTextFn:o,maskInputOptions:l,maskInputFn:u,rootId:c}=e,d=n.parentNode&&n.parentNode.tagName;let f=n.textContent;const h=d==="STYLE"?!0:void 0,p=d==="SCRIPT"?!0:void 0,m=d==="TEXTAREA"?!0:void 0;if(h&&f){try{n.nextSibling||n.previousSibling||n.parentNode.sheet?.cssRules&&(f=$d(n.parentNode.sheet))}catch(y){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${y}`,n)}f=jd(f,gh(e.doc))}p&&(f="SCRIPT_PLACEHOLDER");const g=to(n,r,s,i,a,t);if(!h&&!p&&!m&&f&&g&&(f=o?o(f,n.parentElement):f.replace(/[\S]/g,"*")),m&&f&&(l.textarea||g)&&(f=u?u(f,n.parentNode):f.replace(/[\S]/g,"*")),d==="OPTION"&&f){const y=mh({type:null,tagName:d,maskInputOptions:l});f=$l({isMasked:to(n,r,s,i,a,y),element:n,value:f,maskInputFn:u})}return{type:Et.Text,textContent:f||"",isStyle:h,rootId:c}}function c$(n,e){const{doc:t,blockClass:r,blockSelector:i,unblockSelector:s,inlineStylesheet:a,maskInputOptions:o={},maskAttributeFn:l,maskInputFn:u,dataURLOptions:c={},inlineImages:d,recordCanvas:f,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:m,maskTextClass:g,unmaskTextClass:y,maskTextSelector:v,unmaskTextSelector:S,ignoreCSSAttributes:x}=e,T=r$(n,r,i,s),w=zB(n);let I={};const R=n.attributes.length;for(let b=0;b<R;b++){const C=n.attributes[b];C.name&&!ow(w,C.name,C.value)&&(I[C.name]=aw(t,w,eo(C.name),C.value,n,l,x))}if(w==="link"&&a){const b=Array.from(t.styleSheets).find(k=>k.href===n.href);let C=null;b&&(C=$d(b)),C&&(I.rel=null,I.href=null,I.crossorigin=null,I._cssText=jd(C,b.href))}if(w==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const b=$d(n.sheet);b&&(I._cssText=jd(b,gh(t)))}if(w==="input"||w==="textarea"||w==="select"||w==="option"){const b=n,C=Cy(b),k=Gd(b,hg(w),C),$=b.checked;if(C!=="submit"&&C!=="button"&&k){const U=to(b,g,v,y,S,mh({type:C,tagName:hg(w),maskInputOptions:o}));I.value=$l({isMasked:U,element:b,value:k,maskInputFn:u})}$&&(I.checked=$)}if(w==="option"&&(n.selected&&!o.select?I.selected=!0:delete I.selected),w==="canvas"&&f){if(n.__context==="2d")jB(n)||(I.rr_dataURL=n.toDataURL(c.type,c.quality));else if(!("__context"in n)){const b=n.toDataURL(c.type,c.quality),C=t.createElement("canvas");C.width=n.width,C.height=n.height;const k=C.toDataURL(c.type,c.quality);b!==k&&(I.rr_dataURL=b)}}if(w==="img"&&d){oa||(oa=t.createElement("canvas"),zE=oa.getContext("2d"));const b=n,C=b.currentSrc||b.getAttribute("src")||"<unknown-src>",k=b.crossOrigin,$=()=>{b.removeEventListener("load",$);try{oa.width=b.naturalWidth,oa.height=b.naturalHeight,zE.drawImage(b,0,0),I.rr_dataURL=oa.toDataURL(c.type,c.quality)}catch(U){if(b.crossOrigin!=="anonymous"){b.crossOrigin="anonymous",b.complete&&b.naturalWidth!==0?$():b.addEventListener("load",$);return}else console.warn(`Cannot inline img src=${C}! Error: ${U}`)}b.crossOrigin==="anonymous"&&(k?I.crossOrigin=k:b.removeAttribute("crossorigin"))};
37b.complete&&b.naturalWidth!==0?$():b.addEventListener("load",$)}if((w==="audio"||w==="video")&&(I.rr_mediaState=n.paused?"paused":"played",I.rr_mediaCurrentTime=n.currentTime),p||(n.scrollLeft&&(I.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(I.rr_scrollTop=n.scrollTop)),T){const{width:b,height:C}=n.getBoundingClientRect();I={class:I.class,rr_width:`${b}px`,rr_height:`${C}px`}}w==="iframe"&&!h(I.src)&&(!T&&!sw(n)&&(I.rr_src=I.src),delete I.src);let A;try{customElements.get(w)&&(A=!0)}catch{}return{type:Et.Element,tagName:w,attributes:I,childNodes:[],isSVG:n$(n)||void 0,needBlock:T,rootId:m,isCustom:A}}function ze(n){return n==null?"":n.toLowerCase()}function d$(n,e){if(e.comment&&n.type===Et.Comment)return!0;if(n.type===Et.Element){if(e.script&&(n.tagName==="script"||n.tagName==="link"&&(n.attributes.rel==="preload"||n.attributes.rel==="modulepreload")||n.tagName==="link"&&n.attributes.rel==="prefetch"&&typeof n.attributes.href=="string"&&nw(n.attributes.href)==="js"))return!0;if(e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(ze(n.attributes.name).match(/^msapplication-tile(image|color)$/)||ze(n.attributes.name)==="application-name"||ze(n.attributes.rel)==="icon"||ze(n.attributes.rel)==="apple-touch-icon"||ze(n.attributes.rel)==="shortcut icon")))return!0;if(n.tagName==="meta"){if(e.headMetaDescKeywords&&ze(n.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ze(n.attributes.property).match(/^(og|twitter|fb):/)||ze(n.attributes.name).match(/^(og|twitter):/)||ze(n.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ze(n.attributes.name)==="robots"||ze(n.attributes.name)==="googlebot"||ze(n.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ze(n.attributes.name)==="author"||ze(n.attributes.name)==="generator"||ze(n.attributes.name)==="framework"||ze(n.attributes.name)==="publisher"||ze(n.attributes.name)==="progid"||ze(n.attributes.property).match(/^article:/)||ze(n.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ze(n.attributes.name)==="google-site-verification"||ze(n.attributes.name)==="yandex-verification"||ze(n.attributes.name)==="csrf-token"||ze(n.attributes.name)==="p:domain_verify"||ze(n.attributes.name)==="verify-v1"||ze(n.attributes.name)==="verification"||ze(n.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ta(n,e){const{doc:t,mirror:r,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:d,skipChild:f=!1,inlineStylesheet:h=!0,maskInputOptions:p={},maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v,dataURLOptions:S={},inlineImages:x=!1,recordCanvas:T=!1,onSerialize:w,onIframeLoad:I,iframeLoadTimeout:R=5e3,onBlockedImageLoad:A,onStylesheetLoad:b,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:$=!1,ignoreCSSAttributes:U}=e;let{preserveWhiteSpace:N=!0}=e;const D=o$(n,{doc:t,mirror:r,blockClass:i,blockSelector:s,maskAllText:o,unblockSelector:a,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:d,inlineStylesheet:h,maskInputOptions:p,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,dataURLOptions:S,inlineImages:x,recordCanvas:T,keepIframeSrcFn:k,newlyAddedElement:$,ignoreCSSAttributes:U});if(!D)return console.warn(n,"not serialized"),null;let M;r.hasNode(n)?M=r.getId(n):d$(D,v)||!N&&D.type===Et.Text&&!D.isStyle&&!D.textContent.trim().length?M=Gl:M=ky();const L=Object.assign(D,{id:M});if(r.add(n,L),M===Gl)return null;w&&w(n);let O=!f;if(L.type===Et.Element){O=O&&!L.needBlock;const B=n.shadowRoot;B&&hl(B)&&(L.isShadowHost=!0)}if((L.type===Et.Document||L.type===Et.Element)&&O){v.headWhitespace&&L.type===Et.Element&&L.tagName==="head"&&(N=!1);const B={doc:t,mirror:r,blockClass:i,blockSelector:s,maskAllText:o,unblockSelector:a,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:d,skipChild:f,inlineStylesheet:h,maskInputOptions:p,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v,dataURLOptions:S,inlineImages:x,recordCanvas:T,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:I,iframeLoadTimeout:R,onBlockedImageLoad:A,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:k,ignoreCSSAttributes:U},G=n.childNodes?Array.from(n.childNodes):[];for(const j of G){const W=Ta(j,B);W&&L.childNodes.push(W)}if(OB(n)&&n.shadowRoot)for(const j of Array.from(n.shadowRoot.childNodes)){const W=Ta(j,B);W&&(hl(n.shadowRoot)&&(W.isShadow=!0),L.childNodes.push(W))}}if(n.parentNode&&fl(n.parentNode)&&hl(n.parentNode)&&(L.isShadow=!0),L.type===Et.Element&&L.tagName==="iframe"&&!L.needBlock&&s$(n,()=>{const B=sw(n);if(B&&I){const G=Ta(B,{doc:B,mirror:r,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:h,maskInputOptions:p,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v,dataURLOptions:S,inlineImages:x,recordCanvas:T,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:k,ignoreCSSAttributes:U});G&&I(n,G)}},R),L.type===Et.Element&&L.tagName==="img"&&!n.complete&&L.needBlock){const B=n,G=()=>{if(B.isConnected&&!B.complete&&A)try{const j=B.getBoundingClientRect();j.width>0&&j.height>0&&A(B,L,j)}catch{}B.removeEventListener("load",G)};B.isConnected&&B.addEventListener("load",G)}return L.type===Et.Element&&L.tagName==="link"&&typeof L.attributes.rel=="string"&&(L.attributes.rel==="stylesheet"||L.attributes.rel==="preload"&&typeof L.attributes.href=="string"&&nw(L.attributes.href)==="css")&&a$(n,()=>{if(b){const B=Ta(n,{doc:t,mirror:r,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:h,maskInputOptions:p,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v,dataURLOptions:S,inlineImages:x,recordCanvas:T,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:b,stylesheetLoadTimeout:C,keepIframeSrcFn:k,ignoreCSSAttributes:U});B&&b(n,B)}},C),L.type===Et.Element&&delete L.needBlock,L}function f$(n,e){const{mirror:t=new tw,blockClass:r="rr-block",blockSelector:i=null,unblockSelector:s=null,maskAllText:a=!1,maskTextClass:o="rr-mask",unmaskTextClass:l=null,maskTextSelector:u=null,unmaskTextSelector:c=null,inlineStylesheet:d=!0,inl
37ineImages:f=!1,recordCanvas:h=!1,maskAllInputs:p=!1,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOM:v=!1,dataURLOptions:S,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:w,iframeLoadTimeout:I,onBlockedImageLoad:R,onStylesheetLoad:A,stylesheetLoadTimeout:b,keepIframeSrcFn:C=()=>!1,ignoreCSSAttributes:k=new Set([])}=e||{};return Ta(n,{doc:n,mirror:t,blockClass:r,blockSelector:i,unblockSelector:s,maskAllText:a,maskTextClass:o,unmaskTextClass:l,maskTextSelector:u,unmaskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:p===!1?{}:p,maskAttributeFn:m,maskTextFn:g,maskInputFn:y,slimDOMOptions:v===!0||v==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:v==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:v===!1?{}:v,dataURLOptions:S,inlineImages:f,recordCanvas:h,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:w,iframeLoadTimeout:I,onBlockedImageLoad:R,onStylesheetLoad:A,stylesheetLoadTimeout:b,keepIframeSrcFn:C,newlyAddedElement:!1,ignoreCSSAttributes:k})}function Zt(n,e,t=document){const r={capture:!0,passive:!0};return t.addEventListener(n,e,r),()=>t.removeEventListener(n,e,r)}const ma=`Please stop import mirror directly. Instead of that,\r 38now you can use replayer.getMirror() to access the mirror instance of a replayer,\r 39or you can use record.mirror to access the mirror instance during recording.`;let qE={map:{},getId(){return console.error(ma),-1},getNode(){return console.error(ma),null},removeNodeFromMap(){console.error(ma)},has(){return console.error(ma),!1},reset(){console.error(ma)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(qE=new Proxy(qE,{get(n,e,t){return e==="map"&&console.error(ma),Reflect.get(n,e,t)}}));function jl(n,e,t={}){let r=null,i=0;return function(...s){const a=Date.now();!i&&t.leading===!1&&(i=a);const o=e-(a-i),l=this;o<=0||o>e?(r&&(S$(r),r=null),i=a,n.apply(l,s)):!r&&t.trailing!==!1&&(r=yh(()=>{i=t.leading===!1?0:Date.now(),r=null,n.apply(l,s)},o))}}function lw(n,e,t,r,i=window){const s=i.Object.getOwnPropertyDescriptor(n,e);return i.Object.defineProperty(n,e,r?t:{set(a){yh(()=>{t.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>lw(n,e,s||{},!0)}function Dy(n,e,t){try{if(!(e in n))return()=>{};const r=n[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),n[e]=i,()=>{n[e]=r}}catch{return()=>{}}}let Hd=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Hd=()=>new Date().getTime());function uw(n){const e=n.document;return{left:e.scrollingElement?e.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:e?.documentElement.scrollLeft||e?.body?.parentElement?.scrollLeft||e?.body?.scrollLeft||0,top:e.scrollingElement?e.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:e?.documentElement.scrollTop||e?.body?.parentElement?.scrollTop||e?.body?.scrollTop||0}}function cw(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function dw(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function fw(n){if(!n)return null;try{return n.nodeType===n.ELEMENT_NODE?n:n.parentElement}catch{return null}}function En(n,e,t,r,i){if(!n)return!1;const s=fw(n);if(!s)return!1;const a=xa(e,t);if(!i){const u=r&&s.matches(r);return a(s)&&!u}const o=Ls(s,a);let l=-1;return o<0?!1:(r&&(l=Ls(s,xa(null,r))),o>-1&&l<0?!0:o<l)}function h$(n,e){return e.getId(n)!==-1}function xp(n,e){return e.getId(n)===Gl}function hw(n,e){if(fl(n))return!1;const t=e.getId(n);return e.has(t)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?hw(n.parentNode,e):!0:!0}function mg(n){return!!n.changedTouches}function p$(n=window){"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===t)return!0;while(t=t&&t.parentNode);return!1})}function pw(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function mw(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function gg(n){return!!n?.shadowRoot}class m${constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function gw(n){let e=null;return n.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(e=n.getRootNode().host),e}function g$(n){let e=n,t;for(;t=gw(e);)e=t;return e}function y$(n){const e=n.ownerDocument;if(!e)return!1;const t=g$(n);return e.contains(t)}function yw(n){const e=n.ownerDocument;return e?e.contains(n)||y$(n):!1}const YE={};function Py(n){const e=YE[n];if(e)return e;const t=window.document;let r=window[n];if(t&&typeof t.createElement=="function")try{const i=t.createElement("iframe");i.hidden=!0,t.head.appendChild(i);
39const s=i.contentWindow;s&&s[n]&&(r=s[n]),t.head.removeChild(i)}catch{}return YE[n]=r.bind(window)}function v$(...n){return Py("requestAnimationFrame")(...n)}function yh(...n){return Py("setTimeout")(...n)}function S$(...n){return Py("clearTimeout")(...n)}var be=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(be||{}),me=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(me||{}),Yt=(n=>(n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n))(Yt||{}),Xr=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Xr||{}),ga=(n=>(n[n.Play=0]="Play",n[n.Pause=1]="Pause",n[n.Seeked=2]="Seeked",n[n.VolumeChange=3]="VolumeChange",n[n.RateChange=4]="RateChange",n))(ga||{});let pl;function E$(n){pl=n}function x$(){pl=void 0}const Ce=n=>pl?(...t)=>{try{return n(...t)}catch(r){if(pl&&pl(r)===!0)return()=>{};throw r}}:n;var XE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",T$=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var ic=0;ic<XE.length;ic++)T$[XE.charCodeAt(ic)]=ic;class QE{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}function Oy(n){try{return n.contentDocument}catch{}}function Hl(n){try{return n.contentWindow}catch{}}class _${constructor(e){this.doc=e,this.unattachedDoc=null}parse(e){return this.parseWithConstructableStylesheet(e)||this.parseWithDetachedElement(e)}parseWithConstructableStylesheet(e){if(typeof CSSStyleSheet>"u"||typeof CSSStyleSheet.prototype.replaceSync!="function")return null;try{const t=new CSSStyleSheet;t.replaceSync(`x { ${e} }`);const r=t.cssRules[0];return!r||r.type!==CSSRule.STYLE_RULE?null:r.style}catch{return null}}parseWithDetachedElement(e){const t=this.getUnattachedDoc().createElement("span");return t.setAttribute("style",e),t.style}getUnattachedDoc(){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}return this.unattachedDoc}}function JE(n){return"__ln"in n}class b${constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&JE(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&JE(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const ZE=(n,e)=>`${n}@${e}`;class I${constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>
39{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new b$,i=l=>{let u=l,c=Gl;for(;c===Gl;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},s=l=>{if(!l.parentNode||!yw(l))return;const u=fl(l.parentNode)?this.mirror.getId(gw(l)):this.mirror.getId(l.parentNode),c=i(l);if(u===-1||c===-1)return r.addNode(l);const d=Ta(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{pw(f,this.mirror)&&!En(f,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(f),mw(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),gg(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(f,h)=>{if(En(f,this.blockClass,this.blockSelector,this.unblockSelector,!1))return;this.iframeManager.attachIframe(f,h);const p=Hl(f);p&&this.canvasManager.addWindow(p),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,h)=>{this.stylesheetManager.attachLinkElement(f,h)},onBlockedImageLoad:(f,h,{width:p,height:m})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:h.id,attributes:{style:{width:`${p}px`,height:`${m}px`}}}]})},ignoreCSSAttributes:this.ignoreCSSAttributes});d&&(e.push({parentId:u,nextId:c,node:d}),t.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)ex(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||s(l);for(const l of this.addedSet)!tx(this.droppedSet,l)&&!ex(this.removes,l,this.mirror)||tx(this.movedSet,l)?s(l):this.droppedSet.add(l);let a=null;for(;r.length;){let l=null;if(a){const u=this.mirror.getId(a.value.parentNode),c=i(a.value);u!==-1&&c!==-1&&(l=a)}if(!l){let u=r.tail;for(;u;){const c=u;if(u=u.previous,c){const d=this.mirror.getId(c.value.parentNode);if(i(c.value)===-1)continue;if(d!==-1){l=c;break}else{const h=c.value;if(h.parentNode&&h.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const p=h.parentNode.host;if(this.mirror.getId(p)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),s(l.value)}const o={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!t.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{const{attributes:u}=l;if(typeof u.style=="string"){const c=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+d).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!t.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:e};!o.texts.length&&!o.attributes.length&&!o.removes.length&&!o.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(o))},this.processMutation=e=>{if(!xp(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;!En(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:to(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&t?this.maskTextFn?this.maskTextFn(t,fw(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const a=Cy(t),o=t.tagName;i=Gd(t,o,a);const l=mh({maskInputOptions:this.maskInputOptions,tagName:o,type:a}),u=to(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,l);i=$l({isMasked:u,element:t,value:i,maskInputFn:this.maskInputFn})}if(En(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||i===e.oldValue)return;let s=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!Oy(t))r="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!ow(t.tagName,r)&&(s.attributes[r]=aw(this.doc,eo(t.tagName),eo(r),i,t,this.maskAttributeFn),r==="style")){const a=e.oldValue?this.styleDeclarationParser.parse(e.oldValue):null;for(const o of Array.from(t.style)){const l=t.style.getPropertyValue(o),u=t.style.getPropertyPriority(o);l!==(a?.getPropertyValue(o)||"")||u!==(a?.getPropertyPriority(o)||"")?u===""?s.styleDiff[o]=l:s.styleDiff[o]=[l,u]:s._unchangedStyles[o]=[l,u]}if(a)for(const o of Array.from(a))t.style.getPropertyValue(o)===""&&(s.styleDiff[o]=!1)}break}
39case"childList":{if(En(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),i=fl(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);En(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||xp(t,this.mirror)||!h$(t,this.mirror)||(this.addedSet.has(t)?(yg(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||hw(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[ZE(r,i)]?yg(this.movedSet,t):this.removes.push({parentId:i,id:r,isShadow:fl(e.target)&&hl(e.target)?!0:void 0})),this.mapRemoves.push(t))});break}}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(xp(e,this.mirror))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[ZE(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);En(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes&&e.childNodes.forEach(r=>this.genAdds(r)),gg(e)&&e.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager","ignoreCSSAttributes"].forEach(t=>{this[t]=e[t]}),this.styleDeclarationParser=new _$(this.doc)}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function yg(n,e){n.delete(e),e.childNodes?.forEach(t=>yg(n,t))}function ex(n,e,t){return n.length===0?!1:w$(n,e,t)}function w$(n,e,t){let r=e.parentNode;for(;r;){const i=t.getId(r);if(n.some(s=>s.id===i))return!0;r=r.parentNode}return!1}function tx(n,e){return n.size===0?!1:vw(n,e)}function vw(n,e){const{parentNode:t}=e;return t?n.has(t)?!0:vw(n,t):!1}const _a=[];function $u(n){try{if("composedPath"in n){const e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function Sw(n,e){const t=new I$;_a.push(t),t.init(n);let r=window.MutationObserver||window.__rrMutationObserver;const i=window?.Zone?.__symbol__?.("MutationObserver");i&&window[i]&&(r=window[i]);const s=new r(Ce(a=>{n.onMutation&&n.onMutation(a)===!1||t.processMutations.bind(t)(a)}));return s.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function R$({mousemoveCb:n,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],o;const l=jl(Ce(d=>{const f=Date.now()-o;n(a.map(h=>(h.timeOffset-=f,h)),d),a=[],o=null}),s),u=Ce(jl(Ce(d=>{const f=$u(d),{clientX:h,clientY:p}=mg(d)?d.changedTouches[0]:d;o||(o=Hd()),a.push({x:h,y:p,id:r.getId(f),timeOffset:Hd()-o}),l(typeof DragEvent<"u"&&d instanceof DragEvent?me.Drag:d instanceof MouseEvent?me.MouseMove:me.TouchMove)}),i,{trailing:!1})),c=[Zt("mousemove",u,t),Zt("touchmove",u,t),Zt("drag",u,t)];return Ce(()=>{c.forEach(d=>d())})}function A$({mouseInteractionCb:n,doc:e,mirror:t,blockClass:r,blockSelector:i,unblockSelector:s,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const o=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,l=[];let u=null;const c=d=>f=>{const h=$u(f);if(En(h,r,i,s,!0))return;let p=null,m=d;if("pointerType"in f){switch(f.pointerType){case"mouse":p=Xr.Mouse;break;case"touch":p=Xr.Touch;break;case"pen":p=Xr.Pen;break}p===Xr.Touch?Yt[d]===Yt.MouseDown?m="TouchStart":Yt[d]===Yt.MouseUp&&(m="TouchEnd"):Xr.Pen}else mg(f)&&(p=Xr.Touch);p!==null?(u=p,(m.startsWith("Touch")&&p===Xr.Touch||m.startsWith("Mouse")&&p===Xr.Mouse)&&(p=null)):Yt[d]===Yt.Click&&(p=u,u=null);const g=mg(f)?f.changedTouches[0]:f;if(!g)return;const y=t.getId(h),{clientX:v,clientY:S}=g;Ce(n)({type:Yt[m],id:y,x:v,y:S,...p!==null&&{pointerType:p}})};return Object.keys(Yt).filter(d=>Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&o[d]!==!1).forEac
vendor: 10,583 bytes, line 39
39h(d=>{let f=eo(d);const h=c(d);if(window.PointerEvent)switch(Yt[d]){case Yt.MouseDown:case Yt.MouseUp:f=f.replace("mouse","pointer");break;case Yt.TouchStart:case Yt.TouchEnd:return}l.push(Zt(f,h,e))}),Ce(()=>{l.forEach(d=>d())})}function Ew({scrollCb:n,doc:e,mirror:t,blockClass:r,blockSelector:i,unblockSelector:s,sampling:a}){const o=Ce(jl(Ce(l=>{const u=$u(l);if(!u||En(u,r,i,s,!0))return;const c=t.getId(u);if(u===e&&e.defaultView){const d=uw(e.defaultView);n({id:c,x:d.left,y:d.top})}else n({id:c,x:u.scrollLeft,y:u.scrollTop})}),a.scroll||100));return Zt("scroll",o,e)}function L$({viewportResizeCb:n},{win:e}){let t=-1,r=-1;const i=Ce(jl(Ce(()=>{const s=cw(),a=dw();(t!==s||r!==a)&&(n({width:Number(a),height:Number(s)}),t=s,r=a)}),200));return Zt("resize",i,e)}const C$=["INPUT","TEXTAREA","SELECT"],nx=new WeakMap;function k$({inputCb:n,doc:e,mirror:t,blockClass:r,blockSelector:i,unblockSelector:s,ignoreClass:a,ignoreSelector:o,maskInputOptions:l,maskInputFn:u,sampling:c,userTriggeredOnInput:d,maskTextClass:f,unmaskTextClass:h,maskTextSelector:p,unmaskTextSelector:m}){function g(I){let R=$u(I);const A=I.isTrusted,b=R&&hg(R.tagName);if(b==="OPTION"&&(R=R.parentElement),!R||!b||C$.indexOf(b)<0||En(R,r,i,s,!0))return;const C=R;if(C.classList.contains(a)||o&&C.matches(o))return;const k=Cy(R);let $=Gd(C,b,k),U=!1;const N=mh({maskInputOptions:l,tagName:b,type:k}),D=to(R,f,p,h,m,N);(k==="radio"||k==="checkbox")&&(U=R.checked),$=$l({isMasked:D,element:R,value:$,maskInputFn:u}),y(R,d?{text:$,isChecked:U,userTriggered:A}:{text:$,isChecked:U});const M=R.name;k==="radio"&&M&&U&&e.querySelectorAll(`input[type="radio"][name="${M}"]`).forEach(L=>{if(L!==R){const O=$l({isMasked:D,element:L,value:Gd(L,b,k),maskInputFn:u});y(L,d?{text:O,isChecked:!U,userTriggered:!1}:{text:O,isChecked:!U})}})}function y(I,R){const A=nx.get(I);if(!A||A.text!==R.text||A.isChecked!==R.isChecked){nx.set(I,R);const b=t.getId(I);Ce(n)({...R,id:b})}}const S=(c.input==="last"?["change"]:["input","change"]).map(I=>Zt(I,Ce(g),e)),x=e.defaultView;if(!x)return()=>{S.forEach(I=>I())};const T=x.Object.getOwnPropertyDescriptor(x.HTMLInputElement.prototype,"value"),w=[[x.HTMLInputElement.prototype,"value"],[x.HTMLInputElement.prototype,"checked"],[x.HTMLSelectElement.prototype,"value"],[x.HTMLTextAreaElement.prototype,"value"],[x.HTMLSelectElement.prototype,"selectedIndex"],[x.HTMLOptionElement.prototype,"selected"]];return T&&T.set&&S.push(...w.map(I=>lw(I[0],I[1],{set(){Ce(g)({target:this,isTrusted:!1})}},!1,x))),Ce(()=>{S.forEach(I=>I())})}function Vd(n){const e=[];function t(r,i){if(sc("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||sc("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||sc("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||sc("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const a=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(a)}else if(r.parentStyleSheet){const a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(a)}return i}return t(n,e)}function Ai(n,e,t){let r,i;return n?(n.ownerNode?r=e.getId(n.ownerNode):i=t.getId(n),{styleId:i,id:r}):{}}function D$({styleSheetRuleCb:n,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Ce((c,d,f)=>{const[h,p]=f,{id:m,styleId:g}=Ai(d,e,t.styleMirror);return(m&&m!==-1||g&&g!==-1)&&n({id:m,styleId:g,adds:[{rule:h,index:p}]}),c.apply(d,f)})});const s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:Ce((c,d,f)=>{const[h]=f,{id:p,styleId:m}=Ai(d,e,t.styleMirror);return(p&&p!==-1||m&&m!==-1)&&n({id:p,styleId:m,removes:[{index:h}]}),c.apply(d,f)})});let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Ce((c,d,f)=>{const[h]=f,{id:p,styleId:m}=Ai(d,e,t.styleMirror);return(p&&p!==-1||m&&m!==-1)&&n({id:p,styleId:m,replace:h}),c.apply(d,f)})}));let o;r.CSSStyleSheet.prototype.replaceSync&&(o=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(o,{apply:Ce((c,d,f)=>{const[h]=f,{id:p,styleId:m}=Ai(d,e,t.styleMirror);return(p&&p!==-1||m&&m!==-1)&&n({id:p,styleId:m,replaceSync:h}),c.apply(d,f)})}));const l={};ac("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(ac("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),ac("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),ac("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(u[c].insertRule,{apply:Ce((f,h,p)=>{const[m,g]=p,{id:y,styleId:v}=Ai(h.parentStyleSheet,e,t.styleMirror);return(y&&y!==-1||v&&v!==-1)&&n({id:y,styleId:v,adds:[{rule:m,index:[...Vd(h),g||0]}]}),f.apply(h,p)})}),d.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:Ce((f,h,p)=>{const[m]=p,{id:g,styleId:y}=Ai(h.parentStyleSheet,e,t.styleMirror);return(g&&g!==-1||y&&y!==-1)&&n({id:g,styleId:y,removes:[{index:[...Vd(h),m]}]}),f.apply(h,p)})})}),Ce(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=s,a&&(r.CSSStyleSheet.prototype.replace=a),o&&(r.CSSStyleSheet.prototype.replaceSync=o),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})})}function xw({mirror:n,stylesheetManager:e},t){let r=null;t.nodeName==="#document"?r=n.getId(t):r=n.getId(t.host);const i=t.nodeName==="#document"?t.defaultView?.Document:t.ownerDocument?.defaultView?.ShadowRoot,s=i?.prototype?Object.getOwnPropertyDescriptor(i?.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!i||!s?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){return s.get?.call(this)},set(a){const o=s.set?.call(this,a);if(r!==null&&r!==-1)try{e.adoptStyleSheets(a,r)}catch{}return o}}),Ce(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function P$({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:Ce((o,l,u)=>{const[c,d,f]=u;if(t.has(c))return s.apply(l,[c,d,f]);const{id:h,styleId:p}=Ai(l.parentRule?.parentStyleSheet,e,r.styleMirror);return(h&&h!==-1||p&&p!==-1)&&n({id:h,styleId:p,set:{property:c,value:d,priority:f},index:Vd(l.parentRule)}),o.apply(l,u)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Ce((o,l,u)=>{const[c]=u;if(t.has(c))return a.apply(l,[c]);const{id:d,styleId:f}=Ai(l.parentRule?.parentStyleSheet,e,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&n({id:d,styleId:f,remove:{property:c},index:Vd(l.parentRule)}),o.apply(l,u)})}),Ce(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=a})}function O$({mediaInteractionCb:n,blockClass:e,blockSelector:t,unblockSelector:r,mirror:i,sampling:s,doc:a}){const o=Ce(u=>jl(Ce(c=>{const d=$u(c);if(!d||En(d,e,t,r,!0))return;const{currentTime:f,volume:h,muted:p,playbackRate:m}=d;n({type:u,id:i.getId(d),currentTime:f,volume:h,muted:p,playbackRate:m})}),s.media||500)),l=[Zt("play",o(ga.Play),a),Zt("pause",o(ga.Pause),a),Zt("seeked",o(ga.Seeked),a),Zt("volumechange",o(ga.VolumeChange),a),Zt("ratechange",o(ga.RateChange),a)];return Ce(()=>{l.forEach(u=>u())})}function M$({fontCb:n,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,s=t.FontFace;t.FontFace=function(l,u,c){const d=new s(l,u,c);return i.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};const a=Dy(e.fonts,"add",function(o){return function(l){return yh(Ce(()=>{const u=i.get(l);u&&(n(u),i.delete(l))}),0),o.apply(this,[l])}});return r.push(()=>{t.FontFace=s}),r.push(a),Ce(()=>{r.forEach(o=>o())})}function F$(n){const{doc:e,mirror:t,blockClass:r,blockSelector:i,unblockSelector:s,selectionCb:a}=n;let o=!0;const l=Ce(()=>{const u=e.getSelection();if(!u||o&&u?.isCollapsed)return;o=u.isCollapsed||!1;const c=[],d=u.rangeCount||0;for(let f=0;f<d;f++){const h=u.getRangeAt(f),{startContainer:p,startOffset:m,endContainer:g,endOffset:y}=h;En(p,r,i,s,!0)||En(g,r,i,s,!0)||c.push({start:t.getId(p),startOffset:m,end:t.getId(g),endOffset:y})}a({ranges:c})});return l(),Zt("selectionchange",l)}function N$({doc:n,customElementCb:e}){const t=n.defaultView;return!t||!t.customElements?()=>{}:Dy(t.customElements,"define",function(i){return function(s,a,o){try{e({define:{name:s}})}catch{}return i.apply(this,[s,a,o])}})}function U$(n,e={}){const t=n.doc.defaultView;if(!t)return()=>{};let r;n.recordDOM&&(r=Sw(n,n.doc));const i=R$(n),s=A$(n),a=Ew(n),o=L$(n,{win:t}),l=k$(n),u=O$(n);let c=()=>{},d=()=>{},f=()=>{},h=()=>{};n.recordDOM&&(c=D$(n,{win:t}),d=xw(n,n.doc),f=P$(n,{win:t}),n.collectFonts&&(h=M$(n)));const p=F$(n),m=N$(n),g=[];for(const y of n.plugins)g.push(y.observer(y.callback,t,y.options));return Ce(()=>{_a.forEach(y=>y.reset()),r?.disconnect(),i(),s(),a(),o(),l(),u(),c(),d(),f(),h(),p(),m(),g.forEach(y=>y())})}function sc(n){return typeof window[n]<"u"}function ac(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class vg{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,r,i){const s=r||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let o=s.get(t);return o||(o=this.generateIdFn(),s.set(t,o),a.set(o,t)),o}getIds(e,t){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(s=>this.getId(e,s,r,i))}getRemoteId(e,t,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const s=i.get(t);return s||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}
39class B${constructor(){this.crossOriginIframeMirror=new vg(ky),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class $${constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new vg(ky),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new vg(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0);const t=Hl(e);t&&this.crossOriginIframeMap.set(t,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&Hl(e)?.addEventListener("message",this.handleMessage.bind(this)),this.loadListener?.(e);const r=Oy(e);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(e){const t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,t.data.event);s&&this.wrappedEmit(s,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case be.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const r=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(t.data.node,r),{timestamp:t.timestamp,type:be.IncrementalSnapshot,data:{source:me.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case be.Meta:case be.Load:case be.DomContentLoaded:return!1;case be.Plugin:return t;case be.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case be.IncrementalSnapshot:switch(t.data.source){case me.Mutation:return t.data.adds.forEach(r=>{this.replaceIds(r,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(r.node,i)}),t.data.removes.forEach(r=>{this.replaceIds(r,e,["parentId","id"])}),t.data.attributes.forEach(r=>{this.replaceIds(r,e,["id"])}),t.data.texts.forEach(r=>{this.replaceIds(r,e,["id"])}),t;case me.Drag:case me.TouchMove:case me.MouseMove:return t.data.positions.forEach(r=>{this.replaceIds(r,e,["id"])}),t;case me.ViewportResize:return!1;case me.MediaInteraction:case me.MouseInteraction:case me.Scroll:case me.CanvasMutation:case me.Input:return this.replaceIds(t.data,e,["id"]),t;case me.StyleSheetRule:case me.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case me.Font:return t;case me.Selection:return t.data.ranges.forEach(r=>{this.replaceIds(r,e,["start","end"])}),t;case me.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),t.data.styles?.forEach(r=>{this.replaceStyleIds(r,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(const s of i)!Array.isArray(t[s])&&typeof t[s]!="number"||(Array.isArray(t[s])?t[s]=e.getIds(r,t[s]):t[s]=e.getId(r,t[s]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==Et.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}class G${init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class j${constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!hl(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),this.bypassOptions.canvasManager.addShadowRoot(e);const r=Sw({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Ew({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),yh(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(xw({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){const t=Oy(e),r=Hl(e);!t||!r||this.patchAttachShadow(r.Element,t)}patchAttachShadow(e,t){const r=this;this.restoreHandlers.push(Dy(e.prototype,"attachShadow",function(i){return function(s){const a=i.call(this,s);return this.shadowRoot&&yw(this)&&r.addShadowRoot(this.shadowRoot,t),a}}))}
39reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}class H${constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new m$,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;const r={id:t,styleIds:[]},i=[];for(const s of e){let a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),i.push({styleId:a,rules:Array.from(s.rules||CSSRule,(o,l)=>({rule:ew(o),index:l}))})),r.styleIds.push(a)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class V${constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,v$(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let dt,Wd;try{if(Array.from([1],n=>n*2)[0]!==2){const n=document.createElement("iframe");document.body.appendChild(n),Array.from=n.contentWindow?.Array.from||Array.from,document.body.removeChild(n)}}catch(n){console.debug("Unable to override Array.from",n)}const tr=GB();function jn(n={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:s=null,unblockSelector:a=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskAllText:u=!1,maskTextClass:c="rr-mask",unmaskTextClass:d=null,maskTextSelector:f=null,unmaskTextSelector:h=null,inlineStylesheet:p=!0,maskAllInputs:m,maskInputOptions:g,slimDOMOptions:y,maskAttributeFn:v,maskInputFn:S,maskTextFn:x,maxCanvasSize:T=null,packFn:w,sampling:I={},dataURLOptions:R={},mousemoveWait:A,recordDOM:b=!0,recordCanvas:C=!1,recordCrossOriginIframes:k=!1,recordAfter:$=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:U=!1,collectFonts:N=!1,inlineImages:D=!1,plugins:M,keepIframeSrcFn:L=()=>!1,ignoreCSSAttributes:O=new Set([]),errorHandler:B,onMutation:G,getCanvasManager:j}=n;E$(B);const W=k?window.parent===window:!0;let z=!1;if(!W)try{window.parent.document&&(z=!1)}catch{z=!0}if(W&&!e)throw new Error("emit function is required");if(!W&&!z)return()=>{};A!==void 0&&I.mousemove===void 0&&(I.mousemove=A),tr.reset();const Y=m===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:g!==void 0?g:{},V=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};p$();let J,ae=0;const _e=oe=>{for(const Ve of M||[])Ve.eventProcessor&&(oe=Ve.eventProcessor(oe));return w&&!z&&(oe=w(oe)),oe};dt=(oe,Ve)=>{const pe=oe;if(pe.timestamp=Hd(),_a[0]?.isFrozen()&&pe.type!==be.FullSnapshot&&!(pe.type===be.IncrementalSnapshot&&pe.data.source===me.Mutation)&&_a.forEach(Qe=>Qe.unfreeze()),W)e?.(_e(pe),Ve);else if(z){const Qe={type:"rrweb",event:_e(pe),origin:window.location.origin,isCheckout:Ve};window.parent.postMessage(Qe,"*")}if(pe.type===be.FullSnapshot)J=pe,ae=0;else if(pe.type===be.IncrementalSnapshot){if(pe.data.source===me.Mutation&&pe.data.isAttachIframe)return;ae++;const Qe=r&&ae>=r,ue=t&&J&&pe.timestamp-J.timestamp>t;(Qe||ue)&&tt(!0)}};const Ge=oe=>{dt({type:be.IncrementalSnapshot,data:{source:me.Mutation,...oe}})},Pt=oe=>dt({type:be.IncrementalSnapshot,data:{source:me.Scroll,...oe}}),Yn=oe=>dt({type:be.IncrementalSnapshot,data:{source:me.CanvasMutation,...oe}}),je=oe=>dt({type:be.IncrementalSnapshot,data:{source:me.AdoptedStyleSheet,...oe}}
39),yt=new H$({mutationCb:Ge,adoptedStyleSheetCb:je}),Rt=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new B$:new $$({mirror:tr,mutationCb:Ge,stylesheetManager:yt,recordCrossOriginIframes:k,wrappedEmit:dt});for(const oe of M||[])oe.getMirror&&oe.getMirror({nodeMirror:tr,crossOriginIframeMirror:Rt.crossOriginIframeMirror,crossOriginIframeStyleMirror:Rt.crossOriginIframeStyleMirror});const ee=new V$,Ee=z$(j,{mirror:tr,win:window,mutationCb:oe=>dt({type:be.IncrementalSnapshot,data:{source:me.CanvasMutation,...oe}}),recordCanvas:C,blockClass:i,blockSelector:s,unblockSelector:a,maxCanvasSize:T,sampling:I.canvas,dataURLOptions:R,errorHandler:B}),xe=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new G$:new j$({mutationCb:Ge,scrollCb:Pt,bypassOptions:{onMutation:G,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:u,maskTextClass:c,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:p,maskInputOptions:Y,dataURLOptions:R,maskAttributeFn:v,maskTextFn:x,maskInputFn:S,recordCanvas:C,inlineImages:D,sampling:I,slimDOMOptions:V,iframeManager:Rt,stylesheetManager:yt,canvasManager:Ee,keepIframeSrcFn:L,processedNodeManager:ee,ignoreCSSAttributes:O},mirror:tr}),tt=(oe=!1)=>{if(!b)return;dt({type:be.Meta,data:{href:window.location.href,width:dw(),height:cw()}},oe),yt.reset(),xe.init(),_a.forEach(pe=>pe.lock());const Ve=f$(document,{mirror:tr,blockClass:i,blockSelector:s,unblockSelector:a,maskAllText:u,maskTextClass:c,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:p,maskAllInputs:Y,maskAttributeFn:v,maskInputFn:S,maskTextFn:x,slimDOM:V,dataURLOptions:R,recordCanvas:C,inlineImages:D,onSerialize:pe=>{pw(pe,tr)&&Rt.addIframe(pe),mw(pe,tr)&&yt.trackLinkElement(pe),gg(pe)&&xe.addShadowRoot(pe.shadowRoot,document)},onIframeLoad:(pe,Qe)=>{Rt.attachIframe(pe,Qe);const ue=Hl(pe);ue&&Ee.addWindow(ue),xe.observeAttachShadow(pe)},onStylesheetLoad:(pe,Qe)=>{yt.attachLinkElement(pe,Qe)},onBlockedImageLoad:(pe,Qe,{width:ue,height:ht})=>{Ge({adds:[],removes:[],texts:[],attributes:[{id:Qe.id,attributes:{style:{width:`${ue}px`,height:`${ht}px`}}}]})},keepIframeSrcFn:L,ignoreCSSAttributes:O});if(!Ve)return console.warn("Failed to snapshot the document");dt({type:be.FullSnapshot,data:{node:Ve,initialOffset:uw(window)}}),_a.forEach(pe=>pe.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&yt.adoptStyleSheets(document.adoptedStyleSheets,tr.getId(document))};Wd=tt;try{const oe=[],Ve=Qe=>Ce(U$)({onMutation:G,mutationCb:Ge,mousemoveCb:(ue,ht)=>dt({type:be.IncrementalSnapshot,data:{source:ht,positions:ue}}),mouseInteractionCb:ue=>dt({type:be.IncrementalSnapshot,data:{source:me.MouseInteraction,...ue}}),scrollCb:Pt,viewportResizeCb:ue=>dt({type:be.IncrementalSnapshot,data:{source:me.ViewportResize,...ue}}),inputCb:ue=>dt({type:be.IncrementalSnapshot,data:{source:me.Input,...ue}}),mediaInteractionCb:ue=>dt({type:be.IncrementalSnapshot,data:{source:me.MediaInteraction,...ue}}),styleSheetRuleCb:ue=>dt({type:be.IncrementalSnapshot,data:{source:me.StyleSheetRule,...ue}}),styleDeclarationCb:ue=>dt({type:be.IncrementalSnapshot,data:{source:me.StyleDeclaration,...ue}}),canvasMutationCb:Yn,fontCb:ue=>dt({type:be.IncrementalSnapshot,data:{source:me.Font,...ue}}),selectionCb:ue=>{dt({type:be.IncrementalSnapshot,data:{source:me.Selection,...ue}})},customElementCb:ue=>{dt({type:be.IncrementalSnapshot,data:{source:me.CustomElement,...ue}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskAllText:u,maskTextClass:c,unmaskTextClass:d,maskTextSelector:f,unmaskTextSelector:h,maskInputOptions:Y,inlineStylesheet:p,sampling:I,recordDOM:b,recordCanvas:C,inlineImages:D,userTriggeredOnInput:U,collectFonts:N,doc:Qe,maskAttributeFn:v,maskInputFn:S,maskTextFn:x,keepIframeSrcFn:L,blockSelector:s,unblockSelector:a,slimDOMOptions:V,dataURLOptions:R,mirror:tr,iframeManager:Rt,stylesheetManager:yt,shadowDomManager:xe,processedNodeManager:ee,canvasManager:Ee,ignoreCSSAttributes:O,plugins:M?.filter(ue=>ue.observer)?.map(ue=>({observer:ue.observer,options:ue.options,callback:ht=>dt({type:be.Plugin,data:{plugin:ue.name,payload:ht}})}))||[]},{});Rt.addLoadListener(Qe=>{try{oe.push(Ve(Qe.contentDocument))}catch(ue){console.warn(ue)}});const pe=()=>{tt(),oe.push(Ve(document))};return document.readyState==="interactive"||document.readyState==="complete"?pe():(oe.push(Zt("DOMContentLoaded",()=>{dt({type:be.DomContentLoaded,data:{}}),$==="DOMContentLoaded"&&pe()})),oe.push(Zt("load",()=>{dt({type:be.Load,data:{}}),$==="load"&&pe()}
39,window))),()=>{oe.forEach(Qe=>Qe()),ee.destroy(),Wd=void 0,x$()}}catch(oe){console.warn(oe)}}function W$(n){if(!Wd)throw new Error("please take full snapshot after start recording");Wd(n)}jn.mirror=tr;jn.takeFullSnapshot=W$;function z$(n,e){try{return n?n(e):new QE}catch{return console.warn("Unable to initialize CanvasManager"),new QE}}var rx;(function(n){n[n.NotStarted=0]="NotStarted",n[n.Running=1]="Running",n[n.Stopped=2]="Stopped"})(rx||(rx={}));const K$=3,q$=5;function My(n){return n>9999999999?n:n*1e3}function Tp(n){return n>9999999999?n/1e3:n}function Gu(n,e){e.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(e.category)?n.triggerUserActivity():n.checkAndHandleExpiredSession(),n.addUpdate(()=>(n.throttledAddEvent({type:be.Custom,timestamp:(e.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:ar(e,10,1e3)}}),e.category==="console")))}const Y$="button,a";function Tw(n){return n.closest(Y$)||n}function _w(n){const e=bw(n);return!e||!(e instanceof Element)?e:Tw(e)}function bw(n){return X$(n)?n.target:n}function X$(n){return Zs(n)&&"target"in n}let Li;function Q$(n){return Li||(Li=[],J$()),Li.push(n),()=>{const e=Li?Li.indexOf(n):-1;e>-1&&Li.splice(e,1)}}function J$(){cn(Ke,"open",function(n){return function(...e){if(Li)try{Li.forEach(t=>t())}catch{}return n.apply(Ke,e)}})}const Z$=new Set([me.Mutation,me.StyleSheetRule,me.StyleDeclaration,me.AdoptedStyleSheet,me.CanvasMutation,me.Selection,me.MediaInteraction]);function e3(n,e,t){n.handleClick(e,t)}class t3{constructor(e,t,r=Gu){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=t.timeout/1e3,this._threshold=t.threshold/1e3,this._scrollTimeout=t.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=t.ignoreSelector,this._addBreadcrumbEvent=r}addListeners(){const e=Q$(()=>{this._lastMutation=ix()});this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,t){if(r3(t,this._ignoreSelector)||!i3(e))return;const r={timestamp:Tp(e.timestamp),clickBreadcrumb:e,clickCount:0,node:t};this._clicks.some(i=>i.node===r.node&&Math.abs(i.timestamp-r.timestamp)<1)||(this._clicks.push(r),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(e=Date.now()){this._lastMutation=Tp(e)}registerScroll(e=Date.now()){this._lastScroll=Tp(e)}registerClick(e){const t=Tw(e);this._handleMultiClick(t)}_handleMultiClick(e){this._getClicks(e).forEach(t=>{t.clickCount++})}_getClicks(e){return this._clicks.filter(t=>t.node===e)}_checkClicks(){const e=[],t=ix();this._clicks.forEach(r=>{!r.mutationAfter&&this._lastMutation&&(r.mutationAfter=r.timestamp<=this._lastMutation?this._lastMutation-r.timestamp:void 0),!r.scrollAfter&&this._lastScroll&&(r.scrollAfter=r.timestamp<=this._lastScroll?this._lastScroll-r.timestamp:void 0),r.timestamp+this._timeout<=t&&e.push(r)});for(const r of e){const i=this._clicks.indexOf(r);i>-1&&(this._generateBreadcrumbs(r),this._clicks.splice(i,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(e){const t=this._replay,r=e.scrollAfter&&e.scrollAfter<=this._scrollTimeout,i=e.mutationAfter&&e.mutationAfter<=this._threshold,s=!r&&!i,{clickCount:a,clickBreadcrumb:o}=e;if(s){const l=Math.min(e.mutationAfter||this._timeout,this._timeout)*1e3,u=l<this._timeout*1e3?"mutation":"timeout",c={type:"default",message:o.message,timestamp:o.timestamp,category:"ui.slowClickDetected",data:{...o.data,url:Ke.location.href,route:t.getCurrentRoute(),timeAfterClickMs:l,endReason:u,clickCount:a||1}};this._addBreadcrumbEvent(t,c);return}if(a>1){const l={type:"default",message:o.message,timestamp:o.timestamp,category:"ui.multiClick",data:{...o.data,url:Ke.location.href,route:t.getCurrentRoute(),clickCount:a,metric:!0}};this._addBreadcrumbEvent(t,l)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=Bu(()=>this._checkClicks(),1e3)}}const n3=["A","BUTTON","INPUT"];function r3(n,e){return!!(!n3.includes(n.tagName)||n.tagName==="INPUT"&&!["submit","button"].includes(n.getAttribute("type")||"")||n.tagName==="A"&&(n.hasAttribute("download")||n.hasAttribute("target")&&n.getAttribute("target")!=="_self")||e&&n.matches(e))}function i3(n){return!!(n.data&&typeof n.data.nodeId=="number"&&n.timestamp)}function ix(){return Date.now()/1e3}function s3(n,e){try{if(!a3(e))return;const{source:t}=e.data;if(Z$.has(t)&&n.registerMutation(e.timestamp),t===me.Scroll&&n.registerScroll(e.timestamp),o3(e)){const{type:r,id:i}=e.data,s=jn.mirror.getNode(i);s instanceof HTMLElement&&r===Yt.Click&&n.registerClick(s)}}catch{}}function a3(n){return n.type===K$}function o3(n){return n.data.source===me.MouseInteraction}function Dr(n){return{timestamp:Date.now()/1e3,type:"default",...n}}var vh=(n=>(n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment",n))(vh||{});const Iw=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]),l3=new Set([...Iw,"data-sentry-element"]);function u3(n){const e={};for(const t in n)if(Iw.has(t)){let r=t;(t==="data-testid"||t==="data-test-id")&&(r="testId"),e[r]=n[t]}return!e["data-sentry-component"]&&n["data-sentry-element"]&&(e["data-sentry-component"]=n["data-sentry-element"]),e}const c3=n=>e=>{if(!n.isEnabled())return;const t=d3(e);if(!t)return;const r=e.name==="click",i=r?e.event:void 0;r&&n.clickDetector&&i?.target&&!i.altKey&&!i.metaKey&&!i.ctrlKey&&!i.shiftKey&&e3(n.clickDetector,t,_w(e.event)),Gu(n,t)};function ww(n,e){const t=jn.mirror.getId(n),r=t&&jn.mirror.getNode(t),i=r&&jn.mirror.getMeta(r),s=i&&h3(i)?i:null;return{message:e,data:s?{nodeId:t,node:{id:t,tagName:s.tagName,textContent:Array.from(s.childNodes).map(a=>
39a.type===vh.Text&&a.textContent).filter(Boolean).map(a=>a.trim()).join(""),attributes:u3(s.attributes)}}:{}}}function d3(n){const{target:e,message:t}=f3(n);return Dr({category:`ui.${n.name}`,...ww(e,t)})}function f3(n){const e=n.name==="click";let t,r=null;try{r=e?_w(n.event):bw(n.event),t=wt(r,{maxStringLength:200})||"<unknown>"}catch{t="<unknown>"}return{target:r,message:t}}function h3(n){return n.type===vh.Element}function p3(n,e){if(!n.isEnabled())return;n.updateUserActivity();const t=m3(e);t&&Gu(n,t)}function m3(n){const{metaKey:e,shiftKey:t,ctrlKey:r,altKey:i,key:s,target:a}=n;if(!a||g3(a)||!s)return null;const o=e||r||i,l=s.length===1;if(!o&&l)return null;const u=wt(a,{maxStringLength:200})||"<unknown>",c=ww(a,u);return Dr({category:"ui.keyDown",message:u,data:{...c.data,metaKey:e,shiftKey:t,ctrlKey:r,altKey:i,key:s}})}function g3(n){return n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable}const y3={resource:T3,paint:E3,navigation:x3};function _p(n,e){return({metric:t})=>void e.replayPerformanceEntries.push(n(t))}function v3(n){return n.map(S3).filter(Boolean)}function S3(n){const e=y3[n.entryType];return e?e(n):null}function no(n){return((Dt()||Ke.performance.timeOrigin)+n)/1e3}function E3(n){const{duration:e,entryType:t,name:r,startTime:i}=n,s=no(i);return{type:t,name:r,start:s,end:s+e,data:void 0}}function x3(n){const{entryType:e,name:t,decodedBodySize:r,duration:i,domComplete:s,encodedBodySize:a,domContentLoadedEventStart:o,domContentLoadedEventEnd:l,domInteractive:u,loadEventStart:c,loadEventEnd:d,redirectCount:f,startTime:h,transferSize:p,type:m}=n;return i===0?null:{type:`${e}.${m}`,start:no(h),end:no(s),name:t,data:{size:p,decodedBodySize:r,encodedBodySize:a,duration:i,domInteractive:u,domContentLoadedEventStart:o,domContentLoadedEventEnd:l,loadEventStart:c,loadEventEnd:d,domComplete:s,redirectCount:f}}}function T3(n){const{entryType:e,initiatorType:t,name:r,responseEnd:i,startTime:s,decodedBodySize:a,encodedBodySize:o,responseStatus:l,transferSize:u}=n;return["fetch","xmlhttprequest"].includes(t)?null:{type:`${e}.${t}`,start:no(s),end:no(i),name:r,data:{size:u,statusCode:l,decodedBodySize:a,encodedBodySize:o}}}function _3(n){const e=n.entries[n.entries.length-1],t=e?.element?[e.element]:void 0;return Fy(n,"largest-contentful-paint",t)}function b3(n){return n.sources!==void 0}function I3(n){const e=[],t=[];for(const r of n.entries)if(b3(r)){const i=[];for(const s of r.sources)if(s.node){t.push(s.node);const a=jn.mirror.getId(s.node);a&&i.push(a)}e.push({value:r.value,nodeIds:i.length?i:void 0})}return Fy(n,"cumulative-layout-shift",t,e)}function w3(n){const e=n.entries[n.entries.length-1],t=e?.target?[e.target]:void 0;return Fy(n,"interaction-to-next-paint",t)}function Fy(n,e,t,r){const i=n.value,s=n.rating,a=no(i);return{type:"web-vital",name:e,start:a,end:a,data:{value:i,size:i,rating:s,nodeIds:t?t.map(o=>jn.mirror.getId(o)):void 0,attributions:r}}}function R3(n){function e(i){n.performanceEntries.includes(i)||n.performanceEntries.push(i)}function t({entries:i}){i.forEach(e)}const r=[];return["navigation","paint","resource"].forEach(i=>{r.push(zs(i,t))}),r.push(ch(_p(_3,n)),uh(_p(I3,n)),by(_p(w3,n))),()=>{r.forEach(i=>i())}}const fe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,A3='
vendor: 10,329 bytes, line 39
39var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([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]),i=new t([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]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,e){for(var i=new n(31),s=0;s<31;++s)i[s]=e+=1<<t[s-1];var a=new r(i[30]);for(s=1;s<30;++s)for(var o=i[s];o<i[s+1];++o)a[o]=o-i[s]<<5|s;return{b:i,r:a}},o=a(e,2),h=o.b,f=o.r;h[28]=258,f[258]=28;for(var l=a(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,s=0,a=new n(r);s<i;++s)t[s]&&++a[t[s]-1];var o,h=new n(r);for(s=1;s<r;++s)h[s]=h[s-1]+a[s-1]<<1;if(e){o=new n(1<<r);var f=15-r;for(s=0;s<i;++s)if(t[s])for(var l=s<<4|t[s],c=r-t[s],v=h[t[s]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>f]=l}else for(o=new n(i),s=0;s<i;++s)t[s]&&(o[s]=u[h[t[s]-1]++]>>15-t[s]);return o},p=new t(288);for(c=0;c<144;++c)p[c]=8;for(c=144;c<256;++c)p[c]=9;for(c=256;c<280;++c)p[c]=7;for(c=280;c<288;++c)p[c]=8;var g=new t(32);for(c=0;c<32;++c)g[c]=5;var w=d(p,9,0),y=d(g,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],s=0;s<r.length;++s)r[s]&&i.push({s:s,f:r[s]});var a=i.length,o=i.slice();if(!a)return{t:F,l:0};if(1==a){var h=new t(i[0].s+1);return h[i[0].s]=1,{t:h,l:1}}i.sort(function(t,n){return t.f-n.f}),i.push({s:-1,f:25001});var f=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:f.f+l.f,l:f,r:l};c!=a-1;)f=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:f.f+l.f,l:f,r:l};var d=o[0].s;for(s=1;s<a;++s)o[s].s>d&&(d=o[s].s);var p=new n(d+1),g=A(i[c-1],p,0);if(g>e){s=0;var w=0,y=g-e,m=1<<y;for(o.sort(function(t,n){return p[n.s]-p[t.s]||t.f-n.f});s<a;++s){var b=o[s].s;if(!(p[b]>e))break;w+=m-(1<<g-p[b]),p[b]=e}for(w>>=y;w>0;){var M=o[s].s;p[M]<e?w-=1<<e-p[M]++-1:++s}for(;s>=0&&w;--s){var E=o[s].s;p[E]==e&&(--p[E],++w)}g=e}return{t:new t(p),l:g}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,s=t[0],a=1,o=function(t){e[i++]=t},h=1;h<=r;++h)if(t[h]==s&&h!=r)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[h]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<e;++s)t[i+s+4]=r[s];return 8*(i+4+e)},U=function(t,r,a,o,h,f,l,u,c,v,m){z(r,m++,a),++h[256];for(var b=x(h,15),M=b.t,E=b.l,A=x(f,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[s[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(h,p)+T(f,g)+l,X=T(h,M)+T(f,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[s[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=w,P=p,Q=y,R=g;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,s=0|r.length,a=0;a!=s;){for(var o=Math.min(a+2655,s);a<o;++a)i+=e+=r[a];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(s,a,o,h,u){if(!u&&(u={l:1},a.dictionary)){var c=a.dictionary.subarray(-32768),v=new t(c.length+s.length);v.set(c),v.set(s,c.length),s=v,u.w=c.length}return function(s,a,o,h,u,c){var v=c.z||s.length,d=new t(h+v+5*(1+Math.ceil(v/7e3))+u),p=d.subarray(h,d.length-u),g=c.l,w=7&(c.r||0);if(a){w&&(p[0]=c.r>>3);for(var y=C[a-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(s[t]^s[t+1]<<A^s[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!g)){w=U(s,p,0,F,I,S,O,q,G,j-G,w),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(s[j+Q]==s[j+Q-W]){for(var $=0;$<Z&&s[j+$]==s[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|f[Q]<<18|l[R];var it=31&f[Q],st=31&l[R];O+=e[it]+i[st],++I[257+it],++S[st],B=j+Q,++L}else F[q++]=s[j],++I[s[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=s[j],++I[s[j]];w=U(s,p,g,F,I,S,O,q,G,j-G,w),g||(c.r=7&w|p[w/8|0]<<3,w-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+g;j+=65535){var at=j+65535;at>=v&&(p[w/8|0]=g,at=v),w=k(p,w+1,s.subarray(j,at))}c.i=v}return b(d,0,h+m(w)+u)}(s,null==a.level?6:a.level,null==a.mem?u.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+a.mem,o,h,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;this.b.set(n.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(s),32768),this.s.z=n.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||E(5),this.s.l&&E(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,s=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),a=s.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(s,n),O(s,a-8,r.d()),O(s,a-4,e),s}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t.prototype.flush=function(){j.prototype.flush.call(this)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(G)return G.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),s=0,a=function(t){i[s++]=t},o=0;o<e;++o){if(s+5>i.length){var h=new t(s+8+(e-o<<1));h.set(i),i=h}var f=n.charCodeAt(o);f<128||r?a(f):f<2048?(a(192|f>>6),a(128|63&f)):f>55295&&f<57344?(a(240|(f=65536+(1047552&f)|1023&n.charCodeAt(++o))>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|63&f)):(a(224|f>>12),a(128|f>>6&63),a(128|63&f))}return b(i,0,s)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new B,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new J((t,n)=>{this.deflate.push(t,n)}),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}}),postMessage({id:void 0,method:"init",success:!0,response:void 0});
39';function L3(){const n=new Blob([A3],{type:"text/javascript"});return URL.createObjectURL(n)}const sx=["log","warn","error"],ld="[Replay] ";function bp(n,e="info"){es({category:"console",data:{logger:"replay"},level:e,message:`${ld}${n}`},{level:e})}function C3(){let n=!1,e=!1;const t={exception:()=>{},infoTick:()=>{},setConfig:r=>{n=!!r.captureExceptions,e=!!r.traceInternals}};return fe?(sx.forEach(r=>{t[r]=(...i)=>{K[r](ld,...i),e&&bp(i.join(""),_1(r))}}),t.exception=(r,...i)=>{i.length&&t.error&&t.error(...i),K.error(ld,r),n?kr(r,{mechanism:{handled:!0,type:"auto.function.replay.debug"}}):e&&bp(r,"error")},t.infoTick=(...r)=>{K.log(ld,...r),e&&setTimeout(()=>bp(r[0]),0)}):sx.forEach(r=>{t[r]=()=>{}}),t}const he=C3();class Ny extends Error{constructor(){super(`Event buffer exceeded maximum size of ${Ly}.`)}}class Rw extends Error{constructor(){super("Worker destroyed")}}class Aw{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(e){const t=JSON.stringify(e).length;if(this._totalSize+=t,this._totalSize>Ly)throw new Ny;this.events.push(e)}finish(){return new Promise(e=>{const t=this.events;this.clear(),e(JSON.stringify(t))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){let e=null;for(const{timestamp:t}of this.events)(e===null||t<e)&&(e=t);return e===null?e:My(e)}}class k3{constructor(e){this._onMessage=({data:t})=>{const r=t;if(typeof r.id!="number")return;const i=this._pending.get(r.id);if(!(!i||i.method!==r.method)){if(this._pending.delete(r.id),!r.success){fe&&he.error("Error in compression worker: ",r.response),i.reject(new Error("Error in compression worker"));return}i.resolve(r.response)}},this._worker=e,this._id=0,this._pending=new Map,this._worker.addEventListener("message",this._onMessage)}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((e,t)=>{this._worker.addEventListener("message",({data:r})=>{r.success?e():(fe&&he.warn("Received worker message with unsuccessful status",r),t(new Error("Received worker message with unsuccessful status")))},{once:!0}),this._worker.addEventListener("error",r=>{fe&&he.warn("Failed to load Replay compression worker",r),t(new Error(`Failed to load Replay compression worker: ${r instanceof ErrorEvent&&r.message?r.message:"Unknown error. This can happen due to CSP policy restrictions, network issues, or the worker script failing to load."}`))},{once:!0})}),this._ensureReadyPromise)}destroy(){fe&&he.log("Destroying compression worker"),this._worker.removeEventListener("message",this._onMessage),this._pending.forEach(e=>e.reject(new Rw)),this._pending.clear(),this._worker.terminate()}postMessage(e,t){const r=this._getAndIncrementId();return new Promise((i,s)=>{this._pending.set(r,{method:e,resolve:i,reject:s});try{this._worker.postMessage({id:r,method:e,arg:t})}catch(a){this._pending.delete(r),s(a)}})}_getAndIncrementId(){return this._id++}}class D3{constructor(e){this._worker=new k3(e),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(e){const t=My(e.timestamp);(!this._earliestTimestamp||t<this._earliestTimestamp)&&(this._earliestTimestamp=t);const r=JSON.stringify(e);return this._totalSize+=r.length,this._totalSize>Ly?Promise.reject(new Ny):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{fe&&he.exception(e,'Sending "clear" message to worker failed',e)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(e){return this._worker.postMessage("addEvent",e)}async _finishRequest(){const e=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,e}}class P3{constructor(e){this._fallback=new Aw,this._compression=new D3(e),this._used=this._fallback,this._ensureWorkerIsLoadedProm
39ise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(e){this._used.hasCheckout=e}set waitForCheckout(e){this._used.waitForCheckout=e}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(e){return this._used.addEvent(e)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(e){fe&&he.exception(e,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:e,hasCheckout:t,waitForCheckout:r}=this._fallback,i=[];for(const s of e)i.push(this._compression.addEvent(s));this._compression.hasCheckout=t,this._compression.waitForCheckout=r,this._used=this._compression;try{await Promise.all(i),this._fallback.clear()}catch(s){if(s instanceof Rw)return;fe&&he.exception(s,"Failed to add events when switching buffers.")}}}function O3({useCompression:n,workerUrl:e}){if(n&&window.Worker){const t=M3(e);if(t)return t}return fe&&he.log("Using simple buffer"),new Aw}function M3(n){try{const e=n||F3();if(!e)return;fe&&he.log(`Using compression worker${n?` from ${n}`:""}`);const t=new Worker(e);return new P3(t)}catch(e){fe&&he.exception(e,"Failed to create compression worker")}}function F3(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?L3():""}function Uy(){try{return"sessionStorage"in Ke&&!!Ke.sessionStorage}catch{return!1}}function N3(n){U3(),n.session=void 0}function U3(){if(Uy())try{Ke.sessionStorage.removeItem(Ry)}catch{}}function Lw(n){return n===void 0?!1:Math.random()<n}function Sh(n){if(Uy())try{Ke.sessionStorage.setItem(Ry,JSON.stringify(n))}catch{}}function Cw(n){const e=Date.now(),t=n.id||_n(),r=n.started||e,i=n.lastActivity||e,s=n.segmentId||0,a=n.sampled,o=n.previousSessionId,l=n.dirty||!1;return{id:t,started:r,lastActivity:i,segmentId:s,sampled:a,previousSessionId:o,dirty:l}}function B3(n,e){return Lw(n)?"session":e?"buffer":!1}function ax({sessionSampleRate:n,allowBuffering:e,stickySession:t=!1},{previousSessionId:r}={}){const i=B3(n,e),s=Cw({sampled:i,previousSessionId:r});return t&&Sh(s),s}function $3(){if(!Uy())return null;try{const n=Ke.sessionStorage.getItem(Ry);if(!n)return null;const e=JSON.parse(n);return fe&&he.infoTick("Loading existing session"),Cw(e)}catch{return null}}function Sg(n,e,t=+new Date){return n===null||e===void 0||e<0?!0:e===0?!1:n+e<=t}function G3(n,{maxReplayDuration:e,sessionIdleExpire:t,targetTime:r=Date.now()}){return Sg(n.started,e,r)||Sg(n.lastActivity,t,r)}function zd(n,{sessionIdleExpire:e,maxReplayDuration:t}){return!(!G3(n,{sessionIdleExpire:e,maxReplayDuration:t})||n.sampled==="buffer"&&n.segmentId===0)}function Ip({sessionIdleExpire:n,maxReplayDuration:e,previousSessionId:t},r){const i=r.stickySession&&$3();return i?zd(i,{sessionIdleExpire:n,maxReplayDuration:e})?(fe&&he.infoTick("Session in sessionStorage is expired, creating new one..."),ax(r,{previousSessionId:i.id})):i:(fe&&he.infoTick("Creating new session"),ax(r,{previousSessionId:t}))}function j3(n){return n.type===be.Custom}function By(n,e,t){return Dw(n,e)?(kw(n,e,t),!0):!1}function H3(n,e,t){return Dw(n,e)?kw(n,e,t):Promise.resolve(null)}async function kw(n,e,t){const{eventBuffer:r}=n;if(!r||r.waitForCheckout&&!t)return null;const i=n.recordingMode==="buffer";try{t&&i&&r.clear(),t&&(r.hasCheckout=!0,r.waitForCheckout=!1);const s=n.getOptions(),a=V3(e,s.beforeAddRecordingEvent);return a?await r.addEvent(a):void 0}catch(s){if(!n.isEnabled())return n.handleException(s),null;const a=s&&s instanceof Ny,o=a?"eventBufferOverflow":"eventBufferError",l=Se();if(l){const u=a?"buffer_overflow":"internal_sdk_error";l.recordDroppedEvent(u,"replay")}if(a&&i)return r.clear(),r.waitForCheckout=!0,null;n.handleException(s),await n.stop({reason:o})}}function Dw(n,e){if(!n.eventBuffer||n.isPaused()||!n.isEnabled())return!1;const t=My(e.timestamp);return t+n.timeouts.sessionIdlePause<Date.now()?!1:t>n.getContext().initialTimestamp+n.getOptions().maxReplayDuration?(fe&&he.infoTick(`Skipping event with timestamp ${t} because it is after maxReplayDuration`),!1):!0}function V3(n,e){try{if(typeof e=="function"&&j3(n))return e(n)}catch(t){return fe&&he.exception(t,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return n}const ox=100;function Pw(n,e,t){const r=n.getContext();e&&r.traceIds.size<ox&&r.traceIds.add(e),t&&r.segmentNames.size<ox&&r.segmentNames.add(t)}function W3(n){return e=>{n.isEnabled()&&Pw(n,e.trace_id,e.name||void 0)}}function $y(n){return!n.type}function Eg(n){return n.type==="transaction"}function z3(n){return n.type==="replay_event"}function lx(n){return n.type==="feedback"}function K3(n){return(e,t)=>{if(!n.isEnabled()||!$y(e)&&!Eg(e))return;const r=t.statusCode;if(!(!r||r<200||r>=300)){if(Eg(e)){q3(n,e);return}Y3(n,e)}}}function q3(n,e){Pw(n,e.contexts?.trace?.trace_id,e.transaction)}function Y3(n,e){const t=n.getContext();if(e.event_id&&t.errorIds.size<100&&t.errorIds.add(e.event_id),n.recordingMode!=="buffer"||!e.tags?.replayId)return;const{beforeErrorSampling:r}=n.getOptions();typeof r=="function"&&!r(e)||Bu(async()=>{try{await n.sendBufferedReplayOrFlush()}catch(i){n.handleException(i)}})}function X3(n){return e=>{!n.isEnabled()||!$y(e)||Q3(n,e)}}function Q3(n,e){const t=e.exception?.values?.[0]?.value;if(typeof t=="string"&&(t.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||t.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const r=Dr({category:"replay.hydrate-error",data:{url:Ws()}});Gu(n,r)}}function J3(n){const e=Se();e&&e.on("beforeAddBreadcrumb",t=>Z3(n,t))}function Z3(n,e){if(!n.isEnabled()||!Ow(e))return;const t=e8(e);t&&Gu(n,t)}function e8(n){return!Ow(n)||["fetch","xhr","sentry.event","sentry.transaction"].includes(n.category)||n.category.startsWith("ui.")?null:n.category==="console"?t8(n):Dr(n)}function t8(n){const e=n.data?.arguments;if(!Array.isArray(e)||e.length===0)return Dr(n);let t=!1;const r=e.map(i=>{if(!i)return i;if(typeof i=="string")return i.length>rc?(t=!0,`${i.slice(0,rc)}â¦`):i;if(typeof i=="object")try{const s=ar(i,7);return JSON.stringify(s).length>rc?(t=!0,`${JSON.stringify(s,null,2).slice(0,rc)}â¦`):s}catch{}return i});return Dr({...n,data:{...n.data,arguments:r,...t?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function Ow(n){return!!n.category}function n8(n,e){return n.type||!n.exception?.values?.length?!1:!!e.originalException?.__rrweb__}function Kd(){const n=Le().getPropagationContext().dsc;n&&delete n.replay_id;const e=Gt();if(e){const t=yi(e);delete t.replay_id}}function ux(n){const e=Le().getPropagationContext().dsc;e&&(e.replay_id=n);const t=Gt();if(t){const r=yi(t);r.replay_id=n}}function r8(n,e){n.triggerUserActivity(),n.addUpdate(()=>e.timestamp?(n.throttledAddEvent({type:be.Custom,timestamp:e.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:e.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:e.event_id}}}}),!1):!0)}function i8(n,e){return n.recordingMode!=="buffer"||e.message===Ay||!e.exception||e.type?!1:Lw(n.getOptions().errorSampleRate)}function s8(n){return Object.assign((e,t)=>{if(n.session&&zd(n.session,{maxReplayDuration:n.getOptions().maxReplayDuration,sessionIdleExpire:n.timeouts.sessionIdleExpire})&&Kd(),!n.isEnabled()||n.isPaused())return e;if(z3(e))return delete e.breadcrumbs,e;if(!$y(e)&&!Eg(e)&&!lx(e))return e;if(!n.checkAndHandleExpiredSession())return Kd(),e;if(lx(e))return n.flush(),e.contexts.feedback.replay_id=n.getSessionId(),r8(n,e),e;if(n8(e,t)&&!n.getOptions()._experiments.captureExceptions)return fe&&he.log("Ignoring error from rrweb internals",e),null;const i=i8(n,e);if((i||n.recordingMode==="session")&&(e.tags={...e.tags,replayId:n.getSessionId()}),i&&n.recordingMode==="buffer"&&n.session?.sampled==="buffer"){const a=n.session;a.dirty=!0,n.getOptions().stickySession&&Sh(a)}return e},{id:"Replay"})}function Eh(n,e){return e.map(({type:t,start:r,end:i,name:s,data:a})=>{const o=n.throttledAddEvent({type:be.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:t,description:s,startTimestamp:r,endTimestamp:i,data:a}}});
39return typeof o=="string"?Promise.resolve(null):o})}function a8(n){const{from:e,to:t}=n,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:t,data:{previous:e}}}function o8(n){return e=>{if(!n.isEnabled())return;const t=a8(e);t!==null&&(n.getContext().urls.push(t.name),n.triggerUserActivity(),n.addUpdate(()=>(Eh(n,[t]),!1)))}}function l8(n,e){return fe&&n.getOptions()._experiments.traceInternals?!1:LF(e,Se())}function Mw(n,e){n.isEnabled()&&e!==null&&(l8(n,e.name)||n.addUpdate(()=>(Eh(n,[e]),!0)))}function xh(n){if(!n)return;const e=new TextEncoder;try{if(typeof n=="string")return e.encode(n).length;if(n instanceof URLSearchParams)return e.encode(n.toString()).length;if(n instanceof FormData){const t=K1(n);return e.encode(t).length}if(n instanceof Blob)return n.size;if(n instanceof ArrayBuffer)return n.byteLength}catch{}}function Fw(n){if(!n)return;const e=parseInt(n,10);return isNaN(e)?void 0:e}function qd(n,e){if(!n)return{headers:{},size:void 0,_meta:{warnings:[e]}};const t={...n._meta},r=t.warnings||[];return t.warnings=[...r,e],n._meta=t,n}function Nw(n,e){if(!e)return null;const{startTimestamp:t,endTimestamp:r,url:i,method:s,statusCode:a,request:o,response:l}=e;return{type:n,start:t/1e3,end:r/1e3,name:i,data:{method:s,statusCode:a,request:o,response:l}}}function Vl(n){return{headers:{},size:n,_meta:{warnings:["URL_SKIPPED"]}}}function Gi(n,e,t){if(!e&&Object.keys(n).length===0)return;if(!e)return{headers:n};if(!t)return{headers:n,size:e};const r={headers:n,size:e},{body:i,warnings:s}=u8(t);return r.body=i,s?.length&&(r._meta={warnings:s}),r}function xg(n,e){return Object.entries(n).reduce((t,[r,i])=>{const s=r.toLowerCase();return e.includes(s)&&n[r]&&(t[s]=i),t},{})}function u8(n){if(!n||typeof n!="string")return{body:n};const e=n.length>GE,t=c8(n);if(e){const r=n.slice(0,GE);return t?{body:r,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${r}â¦`,warnings:["TEXT_TRUNCATED"]}}if(t)try{return{body:JSON.parse(n)}}catch{}return{body:n}}function c8(n){const e=n[0],t=n[n.length-1];return e==="["&&t==="]"||e==="{"&&t==="}"}function Yd(n,e){const t=d8(n);return Fr(t,e)}function d8(n,e=Ke.document.baseURI){if(n.startsWith("http://")||n.startsWith("https://")||n.startsWith(Ke.location.origin))return n;const t=new URL(n,e);if(t.origin!==new URL(e).origin)return n;const r=t.href;return!n.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}async function f8(n,e,t){try{const r=await p8(n,e,t),i=Nw("resource.fetch",r);Mw(t.replay,i)}catch(r){fe&&he.exception(r,"Failed to capture fetch breadcrumb")}}function h8(n,e){const{input:t,response:r}=e,i=t?Y1(t):void 0,s=xh(i),a=r?Fw(r.headers.get("content-length")):void 0;s!==void 0&&(n.data.request_body_size=s),a!==void 0&&(n.data.response_body_size=a)}async function p8(n,e,t){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r}=e,{url:a,method:o,status_code:l=0,request_body_size:u,response_body_size:c}=n.data,d=Yd(a,t.networkDetailAllowUrls)&&!Yd(a,t.networkDetailDenyUrls),f=d?m8(t,e.input,u):Vl(u),h=await g8(d,t,e.response,c);return{startTimestamp:i,endTimestamp:s,url:a,method:o,statusCode:l,request:f,response:h}}function m8({networkCaptureBodies:n,networkRequestHeaders:e},t,r){const i=t?S8(t,e):{};if(!n)return Gi(i,r,void 0);const s=Y1(t),[a,o]=q1(s,he),l=Gi(i,r,a);return o?qd(l,o):l}async function g8(n,{networkCaptureBodies:e,networkResponseHeaders:t},r,i){if(!n&&i!==void 0)return Vl(i);const s=r?Uw(r.headers,t):{};if(!r||!e&&i!==void 0)return Gi(s,i,void 0);const[a,o]=await v8(r),l=y8(a,{networkCaptureBodies:e,responseBodySize:i,captureDetails:n,headers:s});return o?qd(l,o):l}function y8(n,{networkCaptureBodies:e,responseBodySize:t,captureDetails:r,headers:i}){try{const s=n?.length&&t===void 0?xh(n):t;return r?e?Gi(i,s,n):Gi(i,s,void 0):Vl(s)}catch(s){return fe&&he.exception(s,"Failed to serialize response body"),Gi(i,t,void 0)}}async function v8(n){const e=E8(n);if(!e)return[void 0,"BODY_PARSE_ERROR"];try{return[await x8(e)]}catch(t){return t instanceof Error&&t.message.indexOf("Timeout")>-1?(fe&&he.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(fe&&he.exception(t,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function Uw(n,e){const t={};return e.forEach(r=>{n.get(r)&&(t[r]=n.get(r))}),t}
39function S8(n,e){return n.length===1&&typeof n[0]!="string"?cx(n[0],e):n.length===2?cx(n[1],e):{}}function cx(n,e){if(!n)return{};const t=n.headers;return t?t instanceof Headers?Uw(t,e):Array.isArray(t)?{}:xg(t,e):{}}function E8(n){try{return n.clone()}catch(e){fe&&he.exception(e,"Failed to clone response body")}}function x8(n){return new Promise((e,t)=>{const r=Bu(()=>t(new Error("Timeout while trying to read response body")),500);T8(n).then(i=>e(i),i=>t(i)).finally(()=>clearTimeout(r))})}async function T8(n){return await n.text()}async function _8(n,e,t){try{const r=I8(n,e,t),i=Nw("resource.xhr",r);Mw(t.replay,i)}catch(r){fe&&he.exception(r,"Failed to capture xhr breadcrumb")}}function b8(n,e){const{xhr:t,input:r}=e;if(!t)return;const i=xh(r),s=t.getResponseHeader("content-length")?Fw(t.getResponseHeader("content-length")):A8(t.response,t.responseType);i!==void 0&&(n.data.request_body_size=i),s!==void 0&&(n.data.response_body_size=s)}function I8(n,e,t){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r,input:a,xhr:o}=e,{url:l,method:u,status_code:c=0,request_body_size:d,response_body_size:f}=n.data;if(!l)return null;if(!o||!Yd(l,t.networkDetailAllowUrls)||Yd(l,t.networkDetailDenyUrls)){const w=Vl(d),I=Vl(f);return{startTimestamp:i,endTimestamp:s,url:l,method:u,statusCode:c,request:w,response:I}}const h=o[As],p=h?xg(h.request_headers,t.networkRequestHeaders):{}
39,m=xg(X1(o),t.networkResponseHeaders),[g,y]=t.networkCaptureBodies?q1(a,he):[void 0],[v,S]=t.networkCaptureBodies?w8(o):[void 0],x=Gi(p,d,g),T=Gi(m,f,v);return{startTimestamp:i,endTimestamp:s,url:l,method:u,statusCode:c,request:y?qd(x,y):x,response:S?qd(T,S):T}}function w8(n){const e=[];try{return[n.responseText]}catch(t){e.push(t)}try{return R8(n.response,n.responseType)}catch(t){e.push(t)}return fe&&he.warn("Failed to get xhr response body",...e),[void 0]}function R8(n,e){try{if(typeof n=="string")return[n];if(n instanceof Document)return[n.body.outerHTML];if(e==="json"&&Zs(n))return[JSON.stringify(n)];if(!n)return[void 0]}catch(t){return fe&&he.exception(t,"Failed to serialize body",n),[void 0,"BODY_PARSE_ERROR"]}return fe&&he.log("Skipping network body because of body type",n),[void 0,"UNPARSEABLE_BODY_TYPE"]}function A8(n,e){try{const t=e==="json"&&Zs(n)?JSON.stringify(n):n;return xh(t)}catch{return}}function L8(n){const e=Se();try{const{networkDetailAllowUrls:t,networkDetailDenyUrls:r,networkCaptureBodies:i,networkRequestHeaders:s,networkResponseHeaders:a}=n.getOptions(),o={replay:n,networkDetailAllowUrls:t,networkDetailDenyUrls:r,networkCaptureBodies:i,networkRequestHeaders:s,networkResponseHeaders:a};e&&e.on("beforeAddBreadcrumb",(l,u)=>C8(o,l,u))}catch{}}function C8(n,e,t){if(e.data)try{k8(e)&&P8(t)&&(b8(e,t),_8(e,t,n)),D8(e)&&O8(t)&&(h8(e,t),f8(e,t,n))}catch(r){fe&&he.exception(r,"Error when enriching network breadcrumb")}}function k8(n){return n.category==="xhr"}function D8(n){return n.category==="fetch"}function P8(n){return n?.xhr}function O8(n){return n?.input!==void 0}function M8(n){const e=Se();V1(c3(n)),ph(o8(n)),J3(n),L8(n);const t=s8(n);DM(t),e&&(e.on("beforeSendEvent",X3(n)),e.on("afterSendEvent",K3(n)),e.on("createDsc",r=>{const i=n.getSessionId();i&&n.isEnabled()&&n.recordingMode==="session"&&n.checkAndHandleExpiredSession()&&(r.replay_id=i)}),e.on("processSegmentSpan",W3(n)),e.on("spanStart",r=>{n.lastActiveSpan=r}),e.on("spanEnd",r=>{n.lastActiveSpan=r}),e.on("beforeSendFeedback",async(r,i)=>{const s=n.getSessionId();i?.includeReplay&&n.isEnabled()&&s&&r.contexts?.feedback&&(r.contexts.feedback.source==="api"&&await n.sendBufferedReplayOrFlush(),r.contexts.feedback.replay_id=s)}),e.on("openFeedbackWidget",async()=>{await n.sendBufferedReplayOrFlush()}))}async function F8(n){try{return Promise.all(Eh(n,[N8(Ke.performance.memory)]))}catch{return[]}}function N8(n){const{jsHeapSizeLimit:e,totalJSHeapSize:t,usedJSHeapSize:r}=n,i=Date.now()/1e3;return{type:"memory",name:"memory",start:i,end:i,data:{memory:{jsHeapSizeLimit:e,totalJSHeapSize:t,usedJSHeapSize:r}}}}function U8(n,e,t){return oM(n,e,{...t,setTimeoutImpl:Bu})}const oc=Ie.navigator;function B8(){return/iPhone|iPad|iPod/i.test(oc?.userAgent??"")||/Macintosh/i.test(oc?.userAgent??"")&&oc?.maxTouchPoints&&oc?.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function $8(n){let e=!1;return(t,r)=>{try{if(!n.checkAndHandleExpiredSession()){fe&&he.warn("Received replay event after session expired.");return}const i=r||!e;e=!0,G8(t),n.clickDetector&&s3(n.clickDetector,t),n.addUpdate(()=>{if(n.recordingMode==="buffer"&&i&&n.setInitialState(),!By(n,t,i))return!0;if(!i)return!1;const s=n.session;if(H8(n,i),n.recordingMode==="buffer"&&s&&n.eventBuffer&&!s.dirty){const a=n.eventBuffer.getEarliestTimestamp();a&&(fe&&he.log(`Updating session start time to earliest event in buffer to ${new Date(a)}`),s.started=a,n.getOptions().stickySession&&Sh(s))}return s?.previousSessionId||n.recordingMode==="session"&&n.flush(),!0})}catch(i){n.handleException(i)}}}function G8(n){const e=n.data;if(!(n.type!==be.IncrementalSnapshot||!e||typeof e!="object"||!("source"in e)||e.source!==me.Mutation||!("attributes"in e)||!Array.isArray(e.attributes)))for(const t of e.attributes){const r=jn.mirror.getNode(t.id),i=r&&jn.mirror.getMeta(r);if(!r||i?.type!==vh.Element)continue;const s={...i.attributes};let a=!1;for(const[o,l]of Object.entries(t.attributes))l3.has(o)&&(l===null?delete s[o]:s[o]=l,a=!0);a&&jn.mirror.add(r,{...i,attributes:s})}}function j8(n){const e=n.getOptions();return{type:be.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:n.isRecordingCanvas(),sessionSampleRate:e.sessionSampleRate,errorSampleRate:e.errorSampleRate,useCompressionOption:e.useCompression,blockAllMedia:e.blockAllMedia,maskAllText:e.maskAllText,maskAllInputs:e.maskAllInputs,useCompression:n.eventBuffer?n.eventBuffer.type==="worker":!1,networkDetailHasUrls:e.networkDetailAllowUrls.length>0,networkCaptureBodies:e.networkCaptureBodies,networkRequestHasHeaders:e.networkRequestHeaders.length>0,networkResponseHasHeaders:e.networkResponseHeaders.length>0}}}}function H8(n,e){!e||n.session?.segmentId!==0||By(n,j8(n),!1)}function V8(n){if(!n)return null;try{return n.nodeType===n.ELEMENT_NODE?n:n.parentElement}catch{return null}}function W8(n,e,t,r){return ds(WI(n,cy(n),r,t),[[{type:"replay_event"},n],[{type:"replay_recording",length:typeof e=="string"?new TextEncoder().encode(e).length:e.length},e]])}function z8({recordingData:n,headers:e}){let t;const r=`${JSON.stringify(e)} 40`;if(typeof n=="string")t=`${r}${n}`;else{const s=new TextEncoder().encode(r);t=new Uint8Array(s.length+n.length),t.set(s),t.set(n,s.length)}return t}async function K8({client:n,scope:e,replayId:t,event:r}){const i=typeof n._integrations=="object"&&n._integrations!==null&&!Array.isArray(n._integrations)?Object.keys(n._integrations):void 0,s={event_id:t,integrations:i};n.emit("preprocessEvent",r,s);const a=await e1(n.getOptions(),r,s,e,n,rn());if(!a)return null;n.emit("postprocessEvent",a,s),a.platform=a.platform||"javascript";
40const o=n.getSdkMetadata(),{name:l,version:u,settings:c}=o?.sdk||{};return a.sdk={...a.sdk,name:l||"sentry.javascript.unknown",version:u||"0.0.0",settings:c},a}async function q8({recordingData:n,replayId:e,segmentId:t,eventContext:r,timestamp:i,session:s}){const a=z8({recordingData:n,headers:{segment_id:t}}),{urls:o,errorIds:l,traceIds:u,segmentNames:c,initialTimestamp:d}=r,f=Se(),h=Le(),p=f?.getTransport(),m=f?.getDsn();if(!f||!p||!m||!s.sampled)return Promise.resolve({});const g={type:EB,replay_start_timestamp:d/1e3,timestamp:i/1e3,error_ids:l,trace_ids:u,segment_names:c,urls:o,replay_id:e,segment_id:t,replay_type:s.sampled},y=await K8({scope:h,client:f,replayId:e,event:g});if(!y)return f.recordDroppedEvent("event_processor","replay"),fe&&he.log("An event processor returned `null`, will not send event."),Promise.resolve({});delete y.sdkProcessingMetadata;const v=W8(y,a,m,f.getOptions().tunnel);let S;try{S=await p.send(v)}catch(T){const w=new Error(Ay);try{w.cause=T}catch{}throw w}const x=f1({},S);if(d1(x,"replay"))throw new Gy(x);if(typeof S.statusCode=="number"&&(S.statusCode<200||S.statusCode>=300))throw new Bw(S.statusCode);return S}class Bw extends Error{constructor(e){super(`Transport returned status code ${e}`)}}class Gy extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}}class dx extends Error{constructor(){super("Session is too long, not sending replay")}}async function $w(n,e={count:0,interval:wB}){const{recordingData:t,onError:r}=n;if(t.length)try{return await q8(n),!0}catch(i){if(i instanceof Bw||i instanceof Gy)throw i;if(n1("Replays",{_retryCount:e.count}),r&&r(i),e.count>=RB){const s=new Error(`${Ay} - max retries exceeded`);try{s.cause=i}catch{}throw s}return e.interval*=++e.count,new Promise((s,a)=>{Bu(async()=>{try{await $w(n,e),s(!0)}catch(o){a(o)}},e.interval)})}}const Gw="__THROTTLED",Y8="__SKIPPED";function X8(n,e,t){const r=new Map,i=o=>{const l=o-t;r.forEach((u,c)=>{c<l&&r.delete(c)})},s=()=>[...r.values()].reduce((o,l)=>o+l,0);let a=!1;return(...o)=>{const l=Math.floor(Date.now()/1e3);if(i(l),s()>=e){const c=a;return a=!0,c?Y8:Gw}a=!1;const u=r.get(l)||0;return r.set(l,u+1),n(...o)}}class Q8{constructor({options:e,recordingOptions:t}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:xB,sessionIdleExpire:TB},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,segmentNames:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=t,this._options=e,this._debouncedFlush=U8(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=X8((a,o)=>H3(this,a,o),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:i}=this.getOptions(),s=r?{threshold:Math.min(AB,r),timeout:r,scrollTimeout:LB,ignoreSelector:i?i.join(","):""}:void 0;if(s&&(this.clickDetector=new t3(this,s)),fe){const a=e._experiments;he.setConfig({captureExceptions:!!a.captureExceptions,traceInternals:!!a.traceInternals})}this._handleVisibilityChange=()=>{Ke.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{const a=Dr({category:"ui.blur"});this._doChangeToBackgroundTasks(a)},this._handleWindowFocus=()=>{const a=Dr({category:"ui.focus"});this._doChangeToForegroundTasks(a)},this._handleKeyboardEvent=a=>{p3(this,a)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(e){fe&&he.exception(e),this._options.onError&&this._options.onError(e)}initializeSampling(e){const{errorSampleRate:t,sessionSampleRate:r}=this._options,i=t<=0&&r<=0;if(this._requiresManualStart=i,!i){if(this._initializeSessionForSampling(e),!this.session){fe&&he.exception(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",fe&&he.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}
40start(){if(this._isEnabled&&this.recordingMode==="session"){fe&&he.log("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){fe&&he.log("Buffering is in progress, call `flush()` to save the replay");return}fe&&he.infoTick("Starting replay in session mode"),this._updateUserActivity();const e=Ip({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=e,this.recordingMode="session",this._initializeRecording()}startBuffering(){if(this._isEnabled){fe&&he.log("Buffering is in progress, call `flush()` to save the replay");return}fe&&he.infoTick("Starting replay in buffer mode");const e=Ip({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=e,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const e=this._canvas;this._stopRecording=jn({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:IB}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:$8(this),...B8(),onMutation:this._onMutationHandler.bind(this),...e?{recordCanvas:e.recordCanvas,getCanvasManager:e.getCanvasManager,sampling:e.sampling,dataURLOptions:e.dataURLOptions}:{}})}catch(e){this.handleException(e)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(e){return this.handleException(e),!1}}async stop({forceFlush:e=!1,reason:t}={}){if(!this._isEnabled)return;this._isEnabled=!1,this.recordingMode="buffer";const r=t??"manual";Se()?.emit("replayEnd",{sessionId:this.session?.id,reason:r});try{fe&&he.log(`Stopping Replay triggered by ${r}`),Kd(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&await this._flush({force:!0}),this.eventBuffer?.destroy(),this.eventBuffer=null,N3(this)}catch(i){this.handleException(i)}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),fe&&he.log("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),fe&&he.log("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:e=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const t=Date.now();fe&&he.log("Converting buffer to session"),await this.flushImmediate();const r=this.stopRecording();!e||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this.session.dirty=!1,this._updateUserActivity(t),this._updateSessionActivity(t),this._maybeSaveSession(),ux(this.session.id)),this.startRecording())}addUpdate(e){const t=e();this.recordingMode==="buffer"||!this._isEnabled||t!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(e){if(!(e&&this.session?.sampled===!1))return this.session?.id}checkAndHandleExpiredSession(){if(this._lastActivity&&Sg(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session?.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const e=`${Ke.location.pathname}${Ke.location.hash}${Ke.location.search}`,t=`${Ke.location.origin}${e}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=t,this._context.initialTimestamp=Date.now(),this._context.urls.push(t)}throttledAddEvent(e,t){const r=this._throttledAddEvent(e,t);if(r===Gw){const i=Dr({category:"replay.throttled"});this.addUpdate(()=>!By(this,{type:q$,timestamp:i.timestamp||0,data:{tag:"breadcrumb",payload:i,metric:!0}}))}return r}getCurrentRoute(){const e=this.lastActiveSpan||Gt(),t=e&&Ut(e),i=(t&&ke(t).data||{})[Bn];if(!(!t||!i||!["route","custom"].includes(i)))return ke(t).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=O3({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.session&&Se()?.emit("replayStart",{sessionId:this.session.id,recordingMode:this.recordingMode}),this.startRecording(),this.recordingMode==="session"&&this.session&&ux(this.session.id)}_initializeSessionForSampling(e){const t=this._options.errorSampleRate>0,r=Ip({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:t});this.session=r}_checkSession(){if(!this.session)return!1;const e=this.session;return zd(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(e),!1):!0}async _refreshSession(e){this._isEnabled&&(await this.stop({reason:"sessionExpired"}),this.initializeSampling(e.id))}_addListeners(){try{Ke.document.addEventListener("visibilitychange",this._handleVisibilityChange),Ke.addEventListener("blur",this._handleWindowBlur),Ke.addEventListener("focus",this._handleWindowFocus),Ke.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(M8(this),this._hasInitializedCoreListeners=!0)}catch(e){this.handleException(e)}this._performanceCleanupCallback=R3(this)}_removeListeners(){try{Ke.document.removeEventListener("visibilitychange",this._handleVisibilityChange),Ke.removeEventListener("blur",this._handleWindowBlur),Ke.removeEventListener("focus",this._handleWindowFocus),Ke.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(e){this.handleException(e)}}
40_doChangeToBackgroundTasks(e){if(!this.session)return;if(zd(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})){Kd();return}e&&this._createCustomBreadcrumb(e),this.conditionalFlush()}_doChangeToForegroundTasks(e){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){fe&&he.log("Document has become active, but session has expired");return}e&&this._createCustomBreadcrumb(e)}_updateUserActivity(e=Date.now()){this._lastActivity=e}_updateSessionActivity(e=Date.now()){this.session&&(this.session.lastActivity=e,this._maybeSaveSession())}_createCustomBreadcrumb(e){this.addUpdate(()=>{this.throttledAddEvent({type:be.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){let e=v3(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const t=this._context.initialTimestamp/1e3;e=e.filter(r=>r.start>=t)}return Promise.all(Eh(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.segmentNames.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:e,eventBuffer:t}=this;if(!e||!t||this._requiresManualStart||e.segmentId)return;const r=t.getEarliestTimestamp();r&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}_popEventContext(){const e={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),segmentNames:Array.from(this._context.segmentNames),urls:this._context.urls};return this._clearContext(),e}async _runFlush(){const e=this.getSessionId();if(!this.session||!this.eventBuffer||!e){fe&&he.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!!this.eventBuffer?.hasEvents&&(await F8(this),!!this.eventBuffer&&e===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const t=Date.now();if(t-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new dx;const r=this._popEventContext(),i=this.session.segmentId++;this._maybeSaveSession();const s=await this.eventBuffer.finish();await $w({replayId:e,recordingData:s,segmentId:i,eventContext:r,session:this.session,timestamp:t,onError:a=>this.handleException(a)})}catch(t){this.handleException(t),this.stop({reason:"sendError"});const r=Se();if(r){let i;t instanceof Gy?i="ratelimit_backoff":t instanceof dx?i="invalid":i="send_error",r.recordDroppedEvent(i,"replay")}}}async _flush({force:e=!1}={}){if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession()){fe&&he.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const t=this.session.started,i=Date.now()-t;this._debouncedFlush.cancel();const s=i<this._options.minReplayDuration,a=i>this._options.maxReplayDuration+5e3;if(s||a){fe&&he.log(`Session duration (${Math.floor(i/1e3)}s) is too ${s?"short":"long"}, not sending replay.`),s&&this._debouncedFlush();return}const o=this.eventBuffer;o&&this.session.segmentId===0&&!o.hasCheckout&&fe&&he.log("Flushing initial segment without checkout.");const l=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(u){this.handleException(u)}finally{this._flushLock=void 0,l&&this._debouncedFlush()}}_maybeSaveSession(){this.session&&this._options.stickySession&&Sh(this.session)}_onMutationHandler(e){const{ignoreMutations:t}=this._options._experiments;if(t?.length&&e.some(o=>{const l=V8(o.target),u=t.join(",");return l?.matches(u)}))return!1;const r=e.length,i=this._options.mutationLimit,s=this._options.mutationBreadcrumbLimit,a=i&&r>i;
40if(r>s||a){const o=Dr({category:"replay.mutations",data:{count:r,limit:a}});this._createCustomBreadcrumb(o)}return a?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}function Po(n,e){return[...n,...e].join(",")}function J8({mask:n,unmask:e,block:t,unblock:r,ignore:i}){const s=["base","iframe[srcdoc]:not([src])"],a=Po(n,[".sentry-mask","[data-sentry-mask]"]),o=Po(e,[]);return{maskTextSelector:a,unmaskTextSelector:o,blockSelector:Po(t,[".sentry-block","[data-sentry-block]",...s]),unblockSelector:Po(r,[]),ignoreSelector:Po(i,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function Z8({el:n,key:e,maskAttributes:t,maskAllText:r,privacyOptions:i,value:s}){if(i.unmaskTextSelector&&n.matches(i.unmaskTextSelector))return s;const a=t.includes(e),o=r&&e==="value"&&n.tagName==="INPUT"&&["submit","button"].includes(n.getAttribute("type")||"");return a||o?s.replace(/[\S]/g,"*"):s}const fx='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',e4=["content-length","content-type","accept"],t4=Symbol.for("sentry__originalRequestBody");let hx=!1,px=!1;function n4(){if(typeof Request>"u"||px)return;const n=Request;try{const e=function(t,r){const i=new n(t,r);return r?.body!=null&&(i[t4]=r.body),i};e.prototype=n.prototype,Ie.Request=e,px=!0}catch{}}const r4=n=>new i4(n);class i4{constructor({flushMinDelay:e=_B,flushMaxDelay:t=bB,minReplayDuration:r=CB,maxReplayDuration:i=jE,stickySession:s=!0,useCompression:a=!0,workerUrl:o,_experiments:l={},maskAllText:u=!0,maskAllInputs:c=!0,blockAllMedia:d=!0,mutationBreadcrumbLimit:f=750,mutationLimit:h=1e4,slowClickTimeout:p=7e3,slowClickIgnoreSelectors:m=[],networkDetailAllowUrls:g=[],networkDetailDenyUrls:y=[],networkCaptureBodies:v=!0,networkRequestHeaders:S=[],networkResponseHeaders:x=[],mask:T=[],maskAttributes:w=["title","placeholder","aria-label"],unmask:I=[],block:R=[],unblock:A=[],ignore:b=[],maskFn:C,beforeAddRecordingEvent:k,beforeErrorSampling:$,onError:U,attachRawBodyFromRequest:N=!1}={}){this.name="Replay";const D=J8({mask:T,unmask:I,block:R,unblock:A,ignore:b});if(this._recordingOptions={maskAllInputs:c,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:C,maskInputFn:C,maskAttributeFn:(M,L,O)=>Z8({maskAttributes:w,maskAllText:u,privacyOptions:D,key:M,value:L,el:O}),...D,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:M=>{try{M.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!l.recordCrossOriginIframes},this._initialOptions={flushMinDelay:e,flushMaxDelay:t,minReplayDuration:Math.min(r,kB),maxReplayDuration:Math.min(i,jE),stickySession:s,useCompression:a,workerUrl:o,blockAllMedia:d,maskAllInputs:c,maskAllText:u,mutationBreadcrumbLimit:f,mutationLimit:h,slowClickTimeout:p,slowClickIgnoreSelectors:m,networkDetailAllowUrls:g,networkDetailDenyUrls:y,networkCaptureBodies:v,networkRequestHeaders:mx(S),networkResponseHeaders:mx(x),beforeAddRecordingEvent:k,beforeErrorSampling:$,onError:U,attachRawBodyFromRequest:N,_experiments:l},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${fx}`:fx,this._recordingOptions.ignoreCSSAttributes=new Set(["background-image"])),this._isInitialized&&Ja())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return hx}set _isInitialized(e){hx=e}afterAllSetup(e){!Ja()||this._replay||(this._initialOptions.attachRawBodyFromRequest&&n4(),this._setup(e),this._initialize(e))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(e){return this._replay?this._replay.stop({forceFlush:e?.flush??this._replay.recordingMode==="session",reason:"manual"}):Promise.resolve()}flush(e){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(e):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(e){if(this._replay?.isEnabled())return this._replay.getSessionId(e)}getRecordingMode(){if(this._replay?.isEnabled())return this._replay.recordingMode}processSpan(e){const t=this.getReplayId(!0);t&&(Od(e,{"sentry.replay_id":t}),this.getRecordingMode()==="buffer"&&Od(e,{"sentry._internal.replay_is_buffering":!0}))}_initialize(e){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(e),this._replay.initializeSampling())}_setup(e){const t=s4(this._initialOptions,e);this._replay=new Q8({options:t,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(e){try{const t=e.getIntegrationByName("ReplayCanvas");if(!t)return;this._replay._canvas=t.getOptions()}catch{}}}function s4(n,e){const t=e.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...n},i=Hs(t.replaysSessionSampleRate),s=Hs(t.replaysOnErrorSampleRate);return i==null&&s==null&&mi(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),i!=null&&(r.sessionSampleRate=i),s!=null&&(r.errorSampleRate=s),r}function mx(n){return[...e4,...n.map(e=>e.toLowerCase())]}function a4(n){return n.split(",").some(e=>e.trim().startsWith("sentry-"))}function jw(n){try{return new URL(n,ge.location.origin).href}catch{return}}function o4(n){return n.entryType==="resource"&&"initiatorType"in n&&typeof n.nextHopProtocol=="string"&&(n.initiatorType==="fetch"||n.initiatorType==="xmlhttprequest")}function Hw(n){try{return new Headers(n)}catch{return}}const Vw={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function l4(n,e){const{traceFetch:t,traceXHR:r,shouldCreateSpanForRequest:i,enableHTTPTimings:s,tracePropagationTargets:a,onRequestSpanStart:o,onRequestSpanEnd:l}={...Vw,...e},u=typeof i=="function"?i:h=>!0,c=h=>c4(h,a),d={},f=n.getOptions().propagateTraceparent;t&&vy(h=>{const p=cN(h,u,c,d,{propagateTraceparent:f,onRequestSpanEnd:l});if(p){const m=jw(h.fetchData.url),g=m?Fs(m).host:void 0,y=m?fr(m):void 0;p.setAttributes({[XI]:y,[xo]:y,"server.address":g}),s&&gx(p,n),o?.(p,{headers:h.headers})}}),r&&z1(h=>{const p=d4(h,u,c,d,f,l);p&&(s&&gx(p,n),o?.(p,{headers:Hw(h.xhr.__sentry_xhr_v3__?.request_headers)}))})}const u4=300;function gx(n,e){const{url:t}=ke(n).data;if(!t||typeof t!="string")return;let r=()=>void setTimeout(i);if(Hr(e)){const s=n.end.bind(n);n.end=a=>{const o=a??Tt();let l=!1;const u=()=>{l||(l=!0,setTimeout(i),s(o),clearTimeout(c))};r=u;const c=setTimeout(u,u4)}}const i=zs("resource",({entries:s})=>
40{s.forEach(a=>{o4(a)&&a.name.endsWith(t)&&(n.setAttributes(j1(a)),r())})})}function c4(n,e){const t=Ws();if(t){let r,i;try{r=new URL(n,t),i=new URL(t).origin}catch{return!1}const s=r.origin===i;return e?Fr(r.toString(),e)||s&&Fr(r.pathname,e):s}else{const r=!!n.match(/^\/(?!\/)/);return e?Fr(n,e):r}}function d4(n,e,t,r,i,s){const a=n.xhr,o=a?.[As];if(!a||a.__sentry_own_request__||!o)return;const{url:l,method:u}=o,c=Vn()&&e(l);if(n.endTimestamp){const x=a.__sentry_xhr_span_id__;if(!x)return;const T=r[x];T&&(c&&o.status_code!==void 0&&(xI(T,o.status_code),T.end(),s?.(T,{headers:Hw(X1(a)),error:n.error})),delete r[x]);return}const d=jw(l),f=Fs(d||l),h=d?fr(d):void 0,p=fr(AF(l)),m=Se(),g=!!Gt(),y=g||!!m&&Hr(m),v=c&&y?fs({name:`${u} ${p}`,attributes:{url:fr(l),type:"xhr","http.method":u,"http.url":h,[xo]:h,"server.address":f?.host,[gt]:"auto.http.browser",[wn]:"http.client",...f?.search&&{"http.query":f?.search},...f?.hash&&{"http.fragment":f?.hash}}}):new Vs,S=qI(v)&&g?void 0:v;return c&&!y&&m?.recordDroppedEvent("no_parent_span","span"),a.__sentry_xhr_span_id__=v.spanContext().spanId,r[a.__sentry_xhr_span_id__]=v,t(l)&&f4(a,Vn()&&y?S:void 0,i),m&&m.emit("beforeOutgoingRequestSpan",v,n),v}function f4(n,e,t){const{"sentry-trace":r,baggage:i,traceparent:s}=x1({span:e,propagateTraceparent:t});r&&h4(n,r,i,s)}function h4(n,e,t,r){const i=n.__sentry_xhr_v3__?.request_headers;if(!(i?.["sentry-trace"]||!n.setRequestHeader))try{if(n.setRequestHeader("sentry-trace",e),r&&!i?.traceparent&&n.setRequestHeader("traceparent",r),t){const s=i?.baggage;(!s||!a4(s))&&n.setRequestHeader("baggage",t)}}catch{}}const yx=new WeakMap,vx=new WeakMap,p4=9e4,m4=["text/event-stream","application/x-ndjson","application/stream+json"],g4=()=>({name:"FetchStreamPerformance",setup(){EN(n=>{if(n.response){const e=yx.get(n.response);if(e&&n.endTimestamp){e.end(n.endTimestamp);const t=vx.get(n.response);t&&clearTimeout(t)}}}),vy(n=>{if(n.endTimestamp&&n.response){const e=n.response.headers?.get("content-type")||"";if(n.response.headers?.get("content-length")||!m4.some(l=>e.startsWith(l)))return;const t=n.fetchData?.url||"",r=n.fetchData?.method||"GET",i=Nl(t),s=t.startsWith("data:")?fr(t):i?S1(i):t,a=fs({name:`${r} ${s}`,startTime:n.endTimestamp,attributes:{url:fr(t),"http.method":r,type:"fetch",[wn]:"http.client.stream",[gt]:"auto.http.browser.stream"}});yx.set(n.response,a);const o=setTimeout(()=>{a.isRecording()&&a.end()},p4);vx.set(n.response,o)}})}}),Ww="WebVitals",y4=(n={})=>{const e=new Set(n.ignore??[]);return{name:Ww,setup(t){const r=Hr(t),{enableStandaloneClsSpans:i,enableStandaloneLcpSpans:s}=n._experiments??{},a=r||e.has("cls")?void 0:i||!1,o=r||e.has("lcp")?void 0:s||!1,l=b2({recordClsStandaloneSpans:a,recordLcpStandaloneSpans:o,client:t}),u=new WeakSet;t.on("afterStartPageLoadSpan",c=>{u.add(c)}),t.on("spanEnd",c=>{u.delete(c)&&(l(),P2(c,{recordClsOnPageloadSpan:a===!1,recordLcpOnPageloadSpan:o===!1,spanStreamingEnabled:r}))}),r?(e.has("lcp")||X2(t),e.has("cls")||J2(t),e.has("inp")||eU()):e.has("inp")||W2()},afterAllSetup(){e.has("inp")||Y2()}}};function v4(){ge.document?ge.document.addEventListener("visibilitychange",()=>{const n=Gt();if(!n)return;const e=Ut(n);if(ge.document.hidden&&e){const t="cancelled",{op:r,status:i}=ke(e);en&&K.log(`[Tracing] Transaction: ${t} -> since tab moved to the background, op: ${r}`),i||e.setStatus({code:Lt,message:t}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):en&&K.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const S4=3600,zw="sentry_previous_trace",E4="sentry.previous_trace";function x4(n,{linkPreviousTrace:e,consistentTraceSampling:t}){const r=e==="session-storage";let i=r?b4():void 0;n.on("spanStart",a=>{if(Ut(a)!==a)return;const o=Le().getPropagationContext();i=T4(i,a,o),r&&_4(i)});let s=!0;t&&n.on("beforeSampling",a=>{if(!i)return;const o=Le(),l=o.getPropagationContext();if(s&&l.parentSpanId){s=!1;return}o.setPropagationContext({...l,dsc:{...l.dsc,sample_rate:String(i.sampleRate),sampled:String(Tg(i.spanContext))},sampleRand:i.sampleRand}),a.parentSampled=Tg(i.spanContext),a.parentSampleRate=i.sampleRate,a.spanAttributes={...a.spanAttributes,[SI]:i.sampleRate}})}function T4(n,e,t){const r=ke(e);function i(){try{const o=Number(r.data?.[ay]??t.dsc?.sample_rate);return Number.isNaN(o)?0:o}catch{return 0}}const s={spanContext:e.spanContext(),startTimestamp:r.start_timestamp,sampleRate:i(),sampleRand:t.sampleRand};if(!n)return s;const a=n.spanContext;return a.traceId===r.trace_id?n:(Date.now()/1e3-n.startTimestamp<=S4&&(en&&K.log(`Adding previous_trace \`${JSON.stringify(a)}\` link to span \`${JSON.stringify({op:r.op,...e.spanContext()})}\``),e.addLink({context:a,attributes:{[rO]:"previous_trace"}}),e.setAttribute(E4,`${a.traceId}-${a.spanId}-${Tg(a)?1:0}`)),s)}function _4(n){try{ge.sessionStorage.setItem(zw,JSON.stringify(n))}catch(e){en&&K.warn("Could not store previous trace in sessionStorage",e)}}function b4(){try{const n=ge.sessionStorage?.getItem(zw);return JSON.parse(n)}catch{return}}function Tg(n){return n.traceFlags===1}const I4="BrowserTracing",w4=/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Facebot|facebookexternalhit|LinkedInBot|Twitterbot|Applebot/i;function R4(){const n=ge.navigator;return n?.userAgent?w4.test(n.userAgent):!1}const A4={...rd,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroun
40dSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...Vw},L4=(n={})=>{"enableElementTiming"in n&&mi(()=>{console.warn("[Sentry] `enableElementTiming` is deprecated and no longer has any effect. Use the standalone `elementTimingIntegration` instead.")});const e={name:void 0,source:void 0},t=ge.document,{enableInp:r,enableLongTask:i,enableLongAnimationFrame:s,_experiments:{enableInteractions:a,enableStandaloneClsSpans:o,enableStandaloneLcpSpans:l},beforeStartSpan:u,idleTimeout:c,finalTimeout:d,childSpanTimeout:f,markBackgroundSpan:h,traceFetch:p,traceXHR:m,trackFetchStreamPerformance:g,shouldCreateSpanForRequest:y,enableHTTPTimings:v,ignoreResourceSpans:S,ignorePerformanceApiSpans:x,instrumentPageLoad:T,instrumentNavigation:w,detectRedirects:I,linkPreviousTrace:R,consistentTraceSampling:A,enableReportPageLoaded:b,onRequestSpanStart:C,onRequestSpanEnd:k}={...A4,...n},$=R4();let U,N;function D(M,L,O=!0,B){const G=L.op==="pageload",j=L.name,W=u?u(L):L,z=Nl(B||Ws()),Y={...z?.pathname&&{[gM]:z.pathname},...z&&!ah(z)&&{[xo]:z.href},...W.attributes};if(j!==W.name&&(Y[Bn]="custom"),W.attributes=Y,!O){const ae=ea();fs({...W,startTime:ae}).end(ae);return}e.name=W.name,e.source=Y[Bn];const V=YI(W,{idleTimeout:c,finalTimeout:d,childSpanTimeout:f,disableAutoFinish:G,beforeSpanEnd:ae=>{D2(ae,{ignoreResourceSpans:S,ignorePerformanceApiSpans:x,spanStreamingEnabled:Hr(M)}),xx(M,void 0);const _e=Le(),Ge=_e.getPropagationContext();_e.setPropagationContext({...Ge,traceId:V.spanContext().traceId,sampled:gi(V),dsc:yi(ae)}),G&&(N=void 0)},trimIdleSpanEndTimestamp:!b});G&&b&&(N=V),xx(M,V);function J(){t&&["interactive","complete"].includes(t.readyState)&&(M.emit("idleSpanEnableAutoFinish",V),t.removeEventListener("readystatechange",J))}G&&!b&&t&&(t.addEventListener("readystatechange",J),J())}return{name:I4,setup(M){if($){en&&K.log("[Tracing] Skipping browserTracingIntegration setup for bot user agent.");return}if(LO(),s&&Ie.PerformanceObserver&&PerformanceObserver.supportedEntryTypes?.includes("long-animation-frame")?w2():i&&I2(),a&&R2(),I&&t){const O=()=>{U=Tt()};addEventListener("click",O,{capture:!0}),addEventListener("keydown",O,{capture:!0,passive:!0})}function L(){const O=Wl(M);O&&!ke(O).timestamp&&(en&&K.log(`[Tracing] Finishing current active span with op: ${ke(O).op}`),O.setAttribute(Ol,"cancelled"),O.end())}M.on("startNavigationSpan",(O,B)=>{if(Se()!==M)return;if(B?.isRedirect){en&&K.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),D(M,{op:"navigation.redirect",...O},!1,B.url);return}U=void 0,L();const G=Le();G.setPropagationContext({traceId:Ji(),sampleRand:Math.random(),propagationSpanId:Vn()?void 0:Zi()}),G.setSDKProcessingMetadata({normalizedRequest:void 0}),D(M,{op:"navigation",...O,parentSpan:null,forceTransaction:!0},!0,B?.url)}),M.on("startPageLoadSpan",(O,B={})=>{if(Se()!==M)return;L();const G=B.sentryTrace||Sx("sentry-trace")||Ex("sentry-trace"),j=B.baggage||Sx("baggage")||Ex("baggage"),W=TO(G,j),z=Le();z.setPropagationContext(W),Vn()||(z.getPropagationContext().propagationSpanId=Zi()),z.setSDKProcessingMetadata({normalizedRequest:Fd()}),D(M,{op:"pageload",...O})}),M.on("endPageloadSpan",()=>{b&&N&&(N.setAttribute(Ol,"reportPageLoaded"),N.end())})},afterAllSetup(M){if($)return;M.addIntegration&&!M.getIntegrationByName?.(Ww)&&M.addIntegration(y4({ignore:r?[]:["inp"],_experiments:{enableStandaloneClsSpans:o,enableStandaloneLcpSpans:l}}));let L=Ws();if(R!=="off"&&x4(M,{linkPreviousTrace:R,consistentTraceSampling:A}),ge.location){if(T){const O=Dt();Kw(M,{name:ge.location.pathname,startTime:O?O/1e3:void 0,attributes:{[Bn]:"url",[gt]:"auto.pageload.browser"}})}w&&ph(({to:O,from:B})=>{if(B===void 0&&L?.indexOf(O)!==-1){L=void 0;return}L=void 0;const G=Nl(O),j=Wl(M),W=j&&I&&D4(j,U);C4(M,{name:G?.pathname||ge.location.pathname,attributes:{[Bn]:"url",[gt]:"auto.navigation.browser"}},{url:O,isRedirect:W})})}h&&v4(),a&&k4(M,c,d,f,e),l4(M,{traceFetch:p,traceXHR:m,tracePropagationTargets:M.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:y,enableHTTPTimings:v,onRequestSpanStart:C,onRequestSpanEnd:k}),g&&M.addIntegration(g4())}}};function Kw(n,e,t){n.emit("startPageLoadSpan",e,t),Le().setTransactionName(e.name);const r=Wl(n);return r&&n.emit("afterStartPageLoadSpan",r),r}function C4(n,e,t){const{url:r,isRedirect:i}=t||{};n.emit("beforeStartNavigationSpan",e,{isRedirect:i,url:r}),n.emit("startNavigationSpan",e,{isRedirect:i,url:r});const s=Le();return s.setTransactionName(e.name),r&&!i&&s.setSDKProcessingMetadata({normalizedRequest:{...Fd(),url:r}}),Wl(n)}function Sx(n){return ge.document?.querySelector(`meta[name=${n}]`)?.getAttribute("content")||void 0}function Ex(n){return ge.performance?.getEntriesByType?.("navigation")[0]?.serverTiming?.find(r=>r.name===n)?.description}function k4(n,e,t,r,i){const s=ge.document;let a;const o=()=>{const l="ui.action.click",u=Wl(n);if(u){const c=ke(u).op;
40if(["navigation","pageload"].includes(c)){en&&K.warn(`[Tracing] Did not create ${l} span because a pageload or navigation span is in progress.`);return}}if(a&&(a.setAttribute(Ol,"interactionInterrupted"),a.end(),a=void 0),!i.name){en&&K.warn(`[Tracing] Did not create ${l} transaction because _latestRouteName is missing.`);return}a=YI({name:i.name,op:l,attributes:{[Bn]:i.source||"url"}},{idleTimeout:e,finalTimeout:t,childSpanTimeout:r})};s&&addEventListener("click",o,{capture:!0})}const qw="_sentry_idleSpan";function Wl(n){return n[qw]}function xx(n,e){Kt(n,qw,e)}const Tx=1.5;function D4(n,e){const t=ke(n),r=ea(),i=t.start_timestamp;return!(r-i>Tx||e&&r-e<=Tx)}function P4(n){return kl(n)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n}function O4(n){const e={...n};E1(e,"react"),n1("react",{version:P.version});const t=SB(e);return cI(M4),t}function M4(n){return P4(n)?"[SyntheticEvent]":Z1(n)}function F4(n){const e=n.match(/^([^.]+)/);return e!==null&&parseInt(e[0])>=17}function N4(n,e){const t=new WeakSet;function r(i,s){if(!t.has(i)){if(i.cause)return t.add(i),r(i.cause,s);i.cause=s}}r(n,e)}function U4(n,{componentStack:e},t){if(F4(P.version)&&Br(n)&&e){const r=new Error(n.message);r.name=`React ErrorBoundary ${n.name}`,r.stack=e,N4(n,r)}return kr(n,t)}const ud=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,wp={componentStack:null,error:null,eventId:null};class B4 extends P.Component{constructor(e){super(e),this.state=wp,this._openFallbackReportDialog=!0;const t=Se();t&&e.showDialog&&(this._openFallbackReportDialog=!1,this._cleanupHook=t.on("afterSendEvent",r=>{!r.type&&this._lastEventId&&r.event_id===this._lastEventId&&$E({...e.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(e,t){const{componentStack:r}=t,{beforeCapture:i,onError:s,showDialog:a,dialogOptions:o}=this.props;Lu(l=>{i&&i(l,e,r);const u=this.props.handled!=null?this.props.handled:!!this.props.fallback,c=U4(e,t,{mechanism:{handled:u,type:"auto.function.react.error_boundary"}});s&&s(e,r,c),a&&(this._lastEventId=c,this._openFallbackReportDialog&&$E({...o,eventId:c})),this.setState({error:e,componentStack:r,eventId:c})})}componentDidMount(){const{onMount:e}=this.props;e&&e()}componentWillUnmount(){const{error:e,componentStack:t,eventId:r}=this.state,{onUnmount:i}=this.props;i&&(this.state===wp?i(null,null,null):i(e,t,r)),this._cleanupHook&&(this._cleanupHook(),this._cleanupHook=void 0)}resetErrorBoundary(){const{onReset:e}=this.props,{error:t,componentStack:r,eventId:i}=this.state;e&&e(t,r,i),this.setState(wp)}render(){const{fallback:e,children:t}=this.props,r=this.state;if(r.componentStack===null)return typeof t=="function"?t():t;const i=typeof e=="function"?P.createElement(e,{error:r.error,componentStack:r.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:r.eventId}):e;return P.isValidElement(i)?i:(e&&ud&&K.warn("fallback did not produce a valid ReactElement"),null)}}const $4=new WeakSet;function G4(n,e){const t=L4({...n,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:r,useLocation:i,useNavigationType:s,createRoutesFromChildren:a,matchRoutes:o,stripBasename:l,enableAsyncRouteHandlers:u=!1,instrumentPageLoad:c=!0,instrumentNavigation:d=!0,lazyRouteTimeout:f,lazyRouteManifest:h}=n;return{...t,setup(p){t.setup(p);const m=n.finalTimeout??3e4,g=(n.idleTimeout??1e3)*3,y=f??g;y===1/0?ud&&K.log("[React Router] lazyRouteTimeout set to Infinity, capping at finalTimeout:",m,"ms to prevent indefinite hangs"):Number.isNaN(y)?ud&&K.warn("[React Router] lazyRouteTimeout must be a number, falling back to default:",g):y<0&&ud&&K.warn("[React Router] lazyRouteTimeout must be non-negative or Infinity, got:",y,"falling back to:",g)},afterAllSetup(p){t.afterAllSetup(p);const m=ge.location?.pathname;c&&m&&Kw(p,{name:m,attributes:{[Bn]:"url",[wn]:"pageload",[gt]:`auto.pageload.react.reactrouter${`_v${e}`}`}}),d&&$4.add(p)}}}function j4(n){return G4(n,"6")}/** 41 * react-router v7.18.4 42 * 43 * Copyright (c) Remix Software Inc. 44 * 45 * This source code is licensed under the MIT license found in the 46 * LICENSE.md file in the root directory of this source tree. 47 * 48 * @license MIT 49 */var jy=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Yw=/^[\\/]{2}/;function H4(n,e){return e+n.replace(/\\/g,"/")}var _x="popstate";function bx(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function V4(n={}){function e(r,i){let s=i.state?.masked,{pathname:a,search:o,hash:l}=s||r.location;return _g("",{pathname:a,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function t(r,i){return typeof i=="string"?i:ro(i)}return z4(e,t,null,n)}function lt(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function Gr(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function W4(){return Math.random().toString(36).substring(2,10)}function Ix(n,e){return{usr:n.state,key:n.key,idx:e,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function _g(n,e,t=null,r,i){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof e=="string"?Io(e):e,state:t,key:e&&e.key||r||W4(),mask:i}}function ro({pathname:n="/",search:e="",hash:t=""}){return e&&e!=="?"&&(n+=e.charAt(0)==="?"?e:"?"+e),t&&t!=="#"&&(n+=t.charAt(0)==="#"?t:"#"+t),n}function Io(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substring(t),n=n.substring(0,t));let r=n.indexOf("?");r>=0&&(e.search=n.substring(r),n=n.substring(0,r)),n&&(e.pathname=n)}return e}function z4(n,e,t,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,a=i.history,o="POP",l=null,u=c();u==null&&(u=0,a.replaceState({...a.state,idx:u},""));function c(){return(a.state||{idx:null}).idx}function d(){o="POP";let g=c(),y=g==null?null:g-u;u=g,l&&l({action:o,location:m.location,delta:y})}function f(g,y){o="PUSH";let v=bx(g)?g:_g(m.location,g,y);u=c()+1;let S=Ix(v,u),x=m.createHref(v.mask||v);try{a.pushState(S,"",x)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(x)}s&&l&&l({action:o,location:m.location,delta:1})}function h(g,y){o="REPLACE";let v=bx(g)?g:_g(m.location,g,y);u=c();let S=Ix(v,u),x=m.createHref(v.mask||v);a.replaceState(S,"",x),s&&l&&l({action:o,location:m.location,delta:0})}function p(g){return K4(i,g)}let m={get action(){return o},get location(){return n(i,a)},listen(g){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(_x,d),l=g,()=>{i.removeEventListener(_x,d),l=null}},createHref(g){return e(i,g)},createURL:p,encodeLocation(g){let y=p(g);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:h,go(g){return a.go(g)}};return m}function K4(n,e,t=!1){let r="http://localhost";n&&(r=n.location.origin!=="null"?n.location.origin:n.location.href),lt(r,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:ro(e);return i=i.replace(/ $/,"%20"),!t&&Yw.test(i)&&(i=r+i),new URL(i,r)}function Hy(n,e,t="/"){return q4(n,e,t,!1)}function q4(n,e,t,r,i){let s=typeof e=="string"?Io(e):e,a=ci(s.pathname||"/",t);if(a==null)return null;let o=Y4(n),l=null,u=a6(a);for(let c=0;l==null&&c<o.length;++c)l=s6(o[c],u,r);return l}function Y4(n){let e=Xw(n);return X4(e),e}function Xw(n,e=[],t=[],r="",i=!1){let s=(a,o,l=i,u)=>{let c={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(r)&&l)return;lt(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}
49" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let d=hr([r,c.relativePath]),f=t.concat(c);a.children&&a.children.length>0&&(lt(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Xw(a.children,e,f,d,l)),!(a.path==null&&!a.index)&&e.push({path:d,score:r6(d,a.index),routesMeta:f.map((h,p)=>{let[m,g]=Zw(h.relativePath,h.caseSensitive,p===f.length-1);return{...h,matcher:m,compiledParams:g}})})};return n.forEach((a,o)=>{if(a.path===""||!a.path?.includes("?"))s(a,o);else for(let l of Qw(a.path))s(a,o,!0,l)}),e}function Qw(n){let e=n.split("/");if(e.length===0)return[];let[t,...r]=e,i=t.endsWith("?"),s=t.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let a=Qw(r.join("/")),o=[];return o.push(...a.map(l=>l===""?s:[s,l].join("/"))),i&&o.push(...a),o.map(l=>n.startsWith("/")&&l===""?"/":l)}function X4(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:i6(e.routesMeta.map(r=>r.childrenIndex),t.routesMeta.map(r=>r.childrenIndex)))}var Q4=/^:[\w-]+$/,J4=3,Z4=2,e6=1,t6=10,n6=-2,wx=n=>n==="*";function r6(n,e){let t=n.split("/"),r=t.length;return t.some(wx)&&(r+=n6),e&&(r+=Z4),t.filter(i=>!wx(i)).reduce((i,s)=>i+(Q4.test(s)?J4:s===""?e6:t6),r)}function i6(n,e){return n.length===e.length&&n.slice(0,-1).every((r,i)=>r===e[i])?n[n.length-1]-e[e.length-1]:0}function s6(n,e,t=!1){let{routesMeta:r}=n,i={},s="/",a=[];for(let o=0;o<r.length;++o){let l=r[o],u=o===r.length-1,c=s==="/"?e:e.slice(s.length)||"/",d={path:l.relativePath,caseSensitive:l.caseSensitive,end:u},f=l.matcher&&l.compiledParams?Jw(d,c,l.matcher,l.compiledParams):Xd(d,c),h=l.route;if(!f&&u&&t&&!r[r.length-1].route.index&&(f=Xd({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},c)),!f)return null;
49Object.assign(i,f.params),a.push({params:i,pathname:hr([s,f.pathname]),pathnameBase:u6(hr([s,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(s=hr([s,f.pathnameBase]))}return a}function Xd(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,r]=Zw(n.path,n.caseSensitive,n.end);return Jw(n,e,t,r)}function Jw(n,e,t,r){let i=e.match(t);if(!i)return null;let s=i[0],a=io(s,1),o=i.slice(1);return{params:r.reduce((u,{paramName:c,isOptional:d},f)=>{if(c==="*"){let p=o[f]||"";a=io(s.slice(0,s.length-p.length),1)}const h=o[f];return d&&!h?u[c]=void 0:u[c]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:a,pattern:n}}function Zw(n,e=!1,t=!0){Gr(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let r=[],i="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l,u,c)=>{if(r.push({paramName:o,isOptional:l!=null}),l){let d=c.charAt(u+a.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(r.push({paramName:"*"}),i+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?i+="\\/*$":n!==""&&n!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function a6(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Gr(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),n}}function ci(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,r=n.charAt(t);return r&&r!=="/"?null:n.slice(t)||"/"}function o6(n,e="/"){let{pathname:t,search:r="",hash:i=""}=typeof n=="string"?Io(n):n,s;return t?(t=tR(t),t.startsWith("/")||t.startsWith("\\")?s=Rx(t.substring(1),"/"):s=Rx(t,e)):s=e,{pathname:s,search:c6(r),hash:d6(i)}}function Rx(n,e){let t=io(e).split("/");return n.split("/").forEach(i=>{i===".."?t.length>1&&t.pop():i!=="."&&t.push(i)}),t.length>1?t.join("/"):"/"}function Rp(n,e,t,r){return`Cannot include a '${n}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function l6(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function eR(n){let e=l6(n);return e.map((t,r)=>r===e.length-1?t.pathname:t.pathnameBase)}function Vy(n,e,t,r=!1){let i;typeof n=="string"?i=Io(n):(i={...n},lt(!i.pathname||!i.pathname.includes("?"),Rp("?","pathname","search",i)),lt(!i.pathname||!i.pathname.includes("#"),Rp("#","pathname","hash",i)),lt(!i.search||!i.search.includes("#"),Rp("#","search","hash",i)));let s=n===""||i.pathname==="",a=s?"/":i.pathname,o;if(a==null)o=t;else{let d=e.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}o=d>=0?e[d]:"/"}let l=o6(i,o),u=a&&a!=="/"&&a.endsWith("/"),c=(s||a===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}var tR=n=>n.replace(/[\\/]{2,}/g,"/"),hr=n=>tR(n.join("/"));function io(n,e=0){let t=n.length;for(;t>e&&n.charCodeAt(t-1)===47;)t--;return t===n.length?n:n.slice(0,t)}var u6=n=>io(n).replace(/^\/*/,"/"),c6=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,d6=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,f6=class{constructor(n,e,t,r=!1){this.status=n,this.statusText=e||"",this.internal=r,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}};function h6(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function p6(n){let e=n.map(t=>t.route.path).filter(Boolean);return hr(e)||"/"}var nR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function rR(n,e){let t=n;if(typeof t!="string"||!jy.test(t))return{absoluteURL:void 0,isExternal:!1,to:t};let r=t,i=!1;if(nR)try{let s=new URL(window.location.href),a=Yw.test(t)?new URL(H4(t,s.protocol)):new URL(t),o=ci(a.pathname,e);a.origin===s.origin&&o!=null?t=o+a.search+a.hash:i=!0}catch{Gr(!1,`<Link to="${t}">
49 contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:t}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ax=new URL("http://localhost");function iR(n){if(n.createURL)return n.createURL("/");try{return new URL(n.createHref("/"),Ax)}catch{return Ax}}function Ap(n,e){return n.origin===e.origin&&(n.origin!=="null"||n.protocol===e.protocol&&n.host===e.host)}function m6(n,e){if(n.startsWith("//"))return!0;let t=e.protocol.toLowerCase();return n.toLowerCase().startsWith(t)?e.host===""||n.slice(t.length).startsWith("//"):!1}function sR(n,e,t,r){let i=null;try{i=n==null?null:new URL(n,t)}catch{}let s=new URL(e,t),a=i!=null&&!Ap(i,t),o=!Ap(s,t);if(r==="reject"){if(a||o)throw new Error("External navigation is not allowed")}else if(o&&(i==null||!m6(n,i)||!Ap(i,s)))throw new Error("External navigation is not allowed")}var aR=["POST","PUT","PATCH","DELETE"];new Set(aR);var g6=["GET",...aR];new Set(g6);var y6=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function v6(n){try{return y6.includes(new URL(n).protocol)}catch{return!1}}var wo=P.createContext(null);wo.displayName="DataRouter";var Th=P.createContext(null);Th.displayName="DataRouterState";var oR=P.createContext(!1);function S6(){return P.useContext(oR)}var lR=P.createContext({isTransitioning:!1});lR.displayName="ViewTransition";var E6=P.createContext(new Map);E6.displayName="Fetchers";var x6=P.createContext(null);x6.displayName="Await";var qn=P.createContext(null);qn.displayName="Navigation";var Ro=P.createContext(null);Ro.displayName="Location";var Vr=P.createContext({outlet:null,matches:[],isDataRoute:!1});Vr.displayName="Route";var Wy=P.createContext(null);Wy.displayName="RouteError";var uR="REACT_ROUTER_ERROR",T6="REDIRECT",_6="ROUTE_ERROR_RESPONSE";function b6(n){if(n.startsWith(`${uR}:${T6}:{`))try{let e=JSON.parse(n.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function I6(n){if(n.startsWith(`${uR}:${_6}:{`))try{let e=JSON.parse(n.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new f6(e.status,e.statusText,e.data)}catch{}}function w6(n,{relative:e}={}){lt(ju(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:r}=P.useContext(qn),{hash:i,pathname:s,search:a}=Hu(n,{relative:e}),o=s;return t!=="/"&&(o=s==="/"?t:hr([t,s])),r.createHref({pathname:o,search:a,hash:i})}function ju(){return P.useContext(Ro)!=null}function Wr(){return lt(ju(),"useLocation() may be used only in the context of a <Router> component."),P.useContext(Ro).location}function R6(){return P.useContext(Ro).navigationType}var cR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function dR(n){P.useContext(qn).static||P.useLayoutEffect(n)}function A6(){let{isDataRoute:n}=P.useContext(Vr);return n?H6():L6()}function L6(){lt(ju(),"useNavigate() may be used only in the context of a <Router> component.");let n=P.useContext(wo),{basename:e,navigator:t}=P.useContext(qn),{matches:r}=P.useContext(Vr),{pathname:i}=Wr(),s=JSON.stringify(eR(r)),a=P.useRef(!1);return dR(()=>{a.current=!0}),P.useCallback((l,u={})=>{if(Gr(a.current,cR),!a.current)return;if(typeof l=="number"){t.go(l);return}let c=Vy(l,JSON.parse(s),i,u.relative==="path");n==null&&e!=="/"&&(c.pathname=c.pathname==="/"?e:hr([e,c.pathname])),sR(typeof l=="string"?l:ro(l),t.createHref(c),iR(t),"reject"),(u.replace?t.replace:t.push)(c,u.state,u)},[e,t,s,i,n])}var C6=P.createContext(null);function k6(n){let e=P.useContext(Vr).outlet;return P.useMemo(()=>e&&P.createElement(C6.Provider,{value:n},e),[e,n])}function Hu(n,{relative:e}={}){let{matches:t}=P.useContext(Vr),{pathname:r}=Wr(),i=JSON.stringify(eR(t));return P.useMemo(()=>Vy(n,JSON.parse(i),r,e==="path"),[n,i,r,e])}function D6(n,e){return fR(n,e)}function fR(n,e,t){lt(ju(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=P.useContext(qn),{matches:i}=P.useContext(Vr),s=i[i.length-1],a=s?s.params:{},o=s?s.pathname:"/",l=s?s.pathnameBase:"/",u=s&&s.route;{let g=u&&u.path||"";pR(o,!u||g.endsWith("*")||g.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${g}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. 50 51Please change the parent <Route path="${g}"> to <Route path="${g==="/"?"*":`${g}/*`}">.`)}let c=Wr(),d;if(e){let g=typeof e=="string"?Io(e):e;lt(l==="/"||g.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${g.pathname}" was given in the \`location\` prop.`),d=g}else d=c;let f=d.pathname||"/",h=f;if(l!=="/"){let g=l.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(g.length).join("/")}let p=t&&t.state.matches.length?t.state.matches.map(g=>Object.assign(g,{route:t.manifest[g.route.id]||g.route})):Hy(n,{pathname:h});Gr(u||p!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),Gr(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let m=N6(p&&p.map(g=>Object.assign({},g,{params:Object.assign({},a,g.params),pathname:hr([l,r.encodeLocation?r.encodeLocation(g.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?l:hr([l,r.encodeLocation?r.encodeLocation(g.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),i,t);return e&&m?P.createElement(Ro.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},m):m}function P6(){let n=j6(),e=h6(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",n),a=P.createElement(P.Fragment,null,P.createElement("p",null,"ð¿ Hey developer ð"),P.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",P.createElement("code",{style:s},"ErrorBoundary")," or"," ",P.createElement("code",{style:s},"errorElement")," prop on your route.")),P.createElement(P.Fragment,null,P.createElement("h2",null,"Unexpected Application
51Error!"),P.createElement("h3",{style:{fontStyle:"italic"}},e),t?P.createElement("pre",{style:i},t):null,a)}var O6=P.createElement(P6,null),hR=class extends P.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,e){return e.location!==n.location||e.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:e.error,location:e.location,revalidation:n.revalidation||e.revalidation}}componentDidCatch(n,e){this.props.onError?this.props.onError(n,e):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const t=I6(n.digest);t&&(n=t)}let e=n!==void 0?P.createElement(Vr.Provider,{value:this.props.routeContext},P.createElement(Wy.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?P.createElement(M6,{error:n},e):e}};hR.contextType=oR;var Lp=new WeakMap;function M6({children:n,error:e}){let{basename:t,navigator:r}=P.useContext(qn);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let i=b6(e.digest);if(i){let s=Lp.get(e);if(s)throw s;let a=rR(i.location,t),o=a.absoluteURL||a.to;if(sR(i.location,o,iR(r),"allow-explicit"),v6(o))throw new Error("Invalid redirect location");if(nR&&!Lp.get(e))if(a.isExternal||i.reloadDocument)window.location.href=o;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:i.replace}));throw Lp.set(e,l),l}return P.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return n}function F6({routeContext:n,match:e,children:t}){let r=P.useContext(wo);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),P.createElement(Vr.Provider,{value:n},t)}function N6(n,e=[],t){let r=t?.state;if(n==null){if(!r)return null;if(r.errors)n=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)n=r.matches;else return null}let i=n,s=r?.errors;if(s!=null){let c=i.findIndex(d=>d.route.id&&s?.[d.route.id]!==void 0);lt(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,c+1))}let a=!1,o=-1;if(t&&r){a=r.renderFallback;for(let c=0;c<i.length;c++){let d=i[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(o=c),d.route.id){let{loaderData:f,errors:h}=r,p=d.route.loader&&!f.hasOwnProperty(d.route.id)&&(!h||h[d.route.id]===void 0);if(d.route.lazy||p){t.isStatic&&(a=!0),o>=0?i=i.slice(0,o+1):i=[i[0]];break}}}}let l=t?.onError,u=r&&l?(c,d)=>{l(c,{location:r.location,params:r.matches?.[0]?.params??{},pattern:p6(r.matches),errorInfo:d})}:void 0;return i.reduceRight((c,d,f)=>{let h,p=!1,m=null,g=null;r&&(h=s&&d.route.id?s[d.route.id]:void 0,m=d.route.errorElement||O6,a&&(o<0&&f===0?(pR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),p=!0,g=null):o===f&&(p=!0,g=d.route.hydrateFallbackElement||null)));let y=e.concat(i.slice(0,f+1)),v=()=>{let S;return h?S=m:p?S=g:d.route.Component?S=P.createElement(d.route.Component,null):d.route.element?S=d.route.element:S=c,P.createElement(F6,{match:d,routeContext:{outlet:c,matches:y,isDataRoute:r!=null},children:S})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?P.createElement(hR,{location:r.location,revalidation:r.revalidation,component:m,error:h,children:v(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:u}):v()},null)}function zy(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function U6(n){let e=P.useContext(wo);return lt(e,zy(n)),e}function B6(n){let e=P.useContext(Th);return lt(e,zy(n)),e}function $6(n){let e=P.useContext(Vr);return lt(e,zy(n)),e}function Ky(n){let e=$6(n),t=e.matches[e.matches.length-1];return lt(t.route.id,`${n} can only be used on routes that contain a unique "id"`),t.route.id}function G6(){return Ky("useRouteId")}function j6(){let n=P.useContext(Wy),e=B6("useRouteError"),t=Ky("useRouteError");return n!==void 0?n:e.errors?.[t]}function H6(){let{router:n}=U6("useNavigate"),e=Ky("useNavigate"),t=P.useRef(!1);return dR(()=>{t.current=!0}),P.useCallback(async(i,s={})=>{Gr(t.current,cR),t.current&&(typeof i=="number"?await n.navigate(i):await n.navigate(i,{fromRouteId:e,...s}))},[n,e])}var Lx={};function pR(n,e,t){!e&&!Lx[n]&&(Lx[n]=!0,Gr(!1,t))}P.memo(V6);function V6({routes:n,manifest:e,future:t,state:r,isStatic:i,onError:s}){return fR(n,void 0,{manifest:e,state:r,isStatic:i,onError:s})}function W6(n){return k6(n.context)}function ya(n){lt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function z6({basename:n="/",children:e=null,location:t,navigationType:r="POP",navigator:i,static:s=!1,useTransitions:a}){lt(!ju(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=n.replace(/^\/*/,"/"),l=P.useMemo(()=>({basename:o,navigator:i,static:s,useTransitions:a,future:{}}),[o,i,s,a]);typeof t=="string"&&(t=Io(t));
51let{pathname:u="/",search:c="",hash:d="",state:f=null,key:h="default",mask:p}=t,m=P.useMemo(()=>{let g=ci(u,o);return g==null?null:{location:{pathname:g,search:c,hash:d,state:f,key:h,mask:p},navigationType:r}},[o,u,c,d,f,h,r,p]);return Gr(m!=null,`<Router basename="${o}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:P.createElement(qn.Provider,{value:l},P.createElement(Ro.Provider,{children:e,value:m}))}function K6({children:n,location:e}){return D6(Qd(n),e)}function Qd(n,e=[]){let t=[];return P.Children.forEach(n,(r,i)=>{if(!P.isValidElement(r))return;let s=[...e,i];if(r.type===P.Fragment){t.push.apply(t,Qd(r.props.children,s));return}lt(r.type===ya,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),lt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=Qd(r.props.children,s)),t.push(a)}),t}var cd="get",dd="application/x-www-form-urlencoded";function _h(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function q6(n){return _h(n)&&n.tagName.toLowerCase()==="button"}function Y6(n){return _h(n)&&n.tagName.toLowerCase()==="form"}function X6(n){return _h(n)&&n.tagName.toLowerCase()==="input"}function Q6(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function J6(n,e){return n.button===0&&(!e||e==="_self")&&!Q6(n)}var lc=null;function Z6(){if(lc===null)try{new FormData(document.createElement("form"),0),lc=!1}catch{lc=!0}return lc}var e5=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Cp(n){return n!=null&&!e5.has(n)?(Gr(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${dd}"`),null):n}function t5(n,e){let t,r,i,s,a;if(Y6(n)){let o=n.getAttribute("action");r=o?ci(o,e):null,t=n.getAttribute("method")||cd,i=Cp(n.getAttribute("enctype"))||dd,s=new FormData(n)}else if(q6(n)||X6(n)&&(n.type==="submit"||n.type==="image")){let o=n.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=n.getAttribute("formaction")||o.getAttribute("action");if(r=l?ci(l,e):null,t=n.getAttribute("formmethod")||o.getAttribute("method")||cd,i=Cp(n.getAttribute("formenctype"))||Cp(o.getAttribute("enctype"))||dd,s=new FormData(o,n),!Z6()){let{name:u,type:c,value:d}=n;if(c==="image"){let f=u?`${u}.`:"";s.append(`${f}x`,"0"),s.append(`${f}y`,"0")}else u&&s.append(u,d)}}else{if(_h(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=cd,r=null,i=dd,a=n}return s&&i==="text/plain"&&(a=s,s=void 0),{action:r,method:t.toLowerCase(),encType:i,formData:s,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function qy(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function mR(n,e,t,r){let i=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return t?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:e&&ci(i.pathname,e)==="/"?i.pathname=`${io(e)}/_root.${r}`:i.pathname=`${io(i.pathname)}.${r}`,i}async function n5(n,e){if(n.id in e)return e[n.id];try{let t=await import(n.module);return e[n.id]=t,t}catch(t){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.
51isSpaMode,window.location.reload(),new Promise(()=>{})}}function r5(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function i5(n,e,t){let r=await Promise.all(n.map(async i=>{let s=e.routes[i.route.id];if(s){let a=await n5(s,t);return a.links?a.links():[]}return[]}));return l5(r.flat(1).filter(r5).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Cx(n,e,t,r,i,s){let a=(l,u)=>t[u]?l.route.id!==t[u].route.id:!0,o=(l,u)=>t[u].pathname!==l.pathname||t[u].route.path?.endsWith("*")&&t[u].params["*"]!==l.params["*"];return s==="assets"?e.filter((l,u)=>a(l,u)||o(l,u)):s==="data"?e.filter((l,u)=>{let c=r.routes[l.route.id];if(!c||!c.hasLoader)return!1;if(a(l,u)||o(l,u))return!0;if(l.route.shouldRevalidate){let d=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:t[0]?.params||{},nextUrl:new URL(n,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function s5(n,e,{includeHydrateFallback:t}={}){return a5(n.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),t&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function a5(n){return[...new Set(n)]}function o5(n){let e={},t=Object.keys(n).sort();for(let r of t)e[r]=n[r];return e}function l5(n,e){let t=new Set;return new Set(e),n.reduce((r,i)=>{let s=JSON.stringify(o5(i));return t.has(s)||(t.add(s),r.push({key:s,link:i})),r},[])}function Yy(){let n=P.useContext(wo);return qy(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function u5(){let n=P.useContext(Th);return qy(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Xy=P.createContext(void 0);Xy.displayName="FrameworkContext";function bh(){let n=P.useContext(Xy);return qy(n,"You must render this element inside a <HydratedRouter> element"),n}function c5(n,e){let t=P.useContext(Xy),[r,i]=P.useState(!1),[s,a]=P.useState(!1),{onFocus:o,onBlur:l,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=e,f=P.useRef(null);P.useEffect(()=>{if(n==="render"&&a(!0),n==="viewport"){let m=y=>{y.forEach(v=>{a(v.isIntersecting)})},g=new IntersectionObserver(m,{threshold:.5});return f.current&&g.observe(f.current),()=>{g.disconnect()}}},[n]),P.useEffect(()=>{if(r){let m=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(m)}}},[r]);let h=()=>{i(!0)},p=()=>{i(!1),a(!1)};return t?n!=="intent"?[s,f,{}]:[s,f,{onFocus:Oo(o,h),onBlur:Oo(l,p),onMouseEnter:Oo(u,h),onMouseLeave:Oo(c,p),onTouchStart:Oo(d,h)}]:[!1,f,{}]}function Oo(n,e){return t=>{n&&n(t),t.defaultPrevented||e(t)}}function d5({page:n,...e}){let t=S6(),{nonce:r}=bh(),{router:i}=Yy(),s=P.useMemo(()=>Hy(i.routes,n,i.basename),[i.routes,n,i.basename]);return s?(e.nonce==null&&r&&(e={...e,nonce:r}),t?P.createElement(h5,{page:n,matches:s,...e}):P.createElement(p5,{page:n,matches:s,...e})):null}function f5(n){let{manifest:e,routeModules:t}=bh(),[r,i]=P.useState([]);return P.useEffect(()=>{let s=!1;return i5(n,e,t).then(a=>{s||i(a)}),()=>{s=!0}},[n,e,t]),r}function h5({page:n,matches:e,...t}){let r=Wr(),{future:i}=bh(),{basename:s}=Yy(),a=P.useMemo(()=>{if(n===r.pathname+r.search+r.hash)return[];let o=mR(n,s,i.v8_trailingSlashAwareDataRequests,"rsc"),l=!1,u=[];for(let c of e)typeof c.route.shouldRevalidate=="function"?l=!0:u.push(c.route.id);return l&&u.length>0&&o.searchParams.set("_routes",u.join(",")),[o.pathname+o.search]},[s,i.v8_trailingSlashAwareDataRequests,n,r,e]);return P.createElement(P.Fragment,null,a.map(o=>P.createElement("link",{key:o,rel:"prefetch",as:"fetch",href:o,...t})))}function p5({page:n,matches:e,...t}){let r=Wr(),{future:i,manifest:s,routeModules:a}=bh(),{basename:o}=Yy(),{loaderData:l,matches:u}=u5(),c=P.useMemo(()=>Cx(n,e,u,s,r,"data"),[n,e,u,s,r]),d=P.useMemo(()=>Cx(n,e,u,s,r,"assets"),[n,e,u,s,r]),f=P.useMemo(()=>
51{if(n===r.pathname+r.search+r.hash)return[];let m=new Set,g=!1;if(e.forEach(v=>{let S=s.routes[v.route.id];!S||!S.hasLoader||(!c.some(x=>x.route.id===v.route.id)&&v.route.id in l&&a[v.route.id]?.shouldRevalidate||S.hasClientLoader?g=!0:m.add(v.route.id))}),m.size===0)return[];let y=mR(n,o,i.v8_trailingSlashAwareDataRequests,"data");return g&&m.size>0&&y.searchParams.set("_routes",e.filter(v=>m.has(v.route.id)).map(v=>v.route.id).join(",")),[y.pathname+y.search]},[o,i.v8_trailingSlashAwareDataRequests,l,r,s,c,e,n,a]),h=P.useMemo(()=>s5(d,s),[d,s]),p=f5(d);return P.createElement(P.Fragment,null,f.map(m=>P.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...t})),h.map(m=>P.createElement("link",{key:m,rel:"modulepreload",href:m,...t})),p.map(({key:m,link:g})=>P.createElement("link",{key:m,nonce:t.nonce,...g,crossOrigin:g.crossOrigin??t.crossOrigin})))}function m5(...n){return e=>{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var g5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{g5&&(window.__reactRouterVersion="7.18.4")}catch{}function y5({basename:n,children:e,useTransitions:t,window:r}){let i=P.useRef();i.current==null&&(i.current=V4({window:r,v5Compat:!0}));let s=i.current,[a,o]=P.useState({action:s.action,location:s.location}),l=P.useCallback(u=>{t===!1?o(u):P.startTransition(()=>o(u))},[t]);return P.useLayoutEffect(()=>s.listen(l),[s,l]),P.createElement(z6,{basename:n,children:e,location:a.location,navigationType:a.action,navigator:s,useTransitions:t})}var si=P.forwardRef(function({onClick:e,discover:t="render",prefetch:r="none",relative:i,reloadDocument:s,replace:a,mask:o,state:l,target:u,to:c,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:h,...p},m){let{basename:g,navigator:y,useTransitions:v}=P.useContext(qn),S=typeof c=="string"&&jy.test(c),x=rR(c,g);c=x.to;let T=w6(c,{relative:i}),w=Wr(),I=null;if(o){let N=Vy(o,[],w.mask?w.mask.pathname:"/",!0);g!=="/"&&(N.pathname=N.pathname==="/"?g:hr([g,N.pathname])),I=y.createHref(N)}let[R,A,b]=c5(r,p),C=E5(c,{replace:a,mask:o,state:l,target:u,preventScrollReset:d,relative:i,viewTransition:f,defaultShouldRevalidate:h,useTransitions:v});function k(N){e&&e(N),N.defaultPrevented||C(N)}let $=!(x.isExternal||s),U=P.createElement("a",{...p,...b,href:($?I:void 0)||x.absoluteURL||T,onClick:$?k:e,ref:m5(m,A),target:u,"data-discover":!S&&t==="render"?"true":void 0});return R&&!S?P.createElement(P.Fragment,null,U,P.createElement(d5,{page:T})):U});si.displayName="Link";var el=P.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:i=!1,style:s,to:a,viewTransition:o,children:l,...u},c){let d=Hu(a,{relative:u.relative}),f=Wr(),h=P.useContext(Th),{navigator:p,basename:m}=P.useContext(qn),g=h!=null&&I5(d)&&o===!0,y=p.encodeLocation?p.encodeLocation(d).pathname:d.pathname,v=f.pathname,S=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;t||(v=v.toLowerCase(),S=S?S.toLowerCase():null,y=y.toLowerCase()),S&&m&&(S=ci(S,m)||S);const x=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let T=v===y||!i&&v.startsWith(y)&&v.charAt(x)==="/",w=S!=null&&(S===y||!i&&S.startsWith(y)&&S.charAt(y.length)==="/"),I={isActive:T,isPending:w,isTransitioning:g},R=T?e:void 0,A;typeof r=="function"?A=r(I):A=[r,T?"active":null,w?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let b=typeof s=="function"?s(I):s;return P.createElement(si,{...u,"aria-current":R,className:A,ref:c,style:b,to:a,viewTransition:o},typeof l=="function"?l(I):l)});el.displayName="NavLink";var v5=P.forwardRef(({discover:n="render",fetcherKey:e,navigate:t,reloadDocument:r,replace:i,state:s,method:a=cd,action:o,onSubmit:l,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:f,...h},p)=>{let{useTransitions:m}=P.useContext(qn),g=_5(),y=b5(o,{relative:u}),v=a.toLowerCase()==="get"?"get":"post",S=typeof o=="string"&&jy.test(o),x=T=>{if(l&&l(T),T.defaultPrevented)return;T.preventDefault();let w=T.nativeEvent.submitter,I=w?.getAttribute("formmethod")||a,R=()=>g(w||T.currentTarget,{fetcherKey:e,method:I,navigate:t,replace:i,state:s,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:f});m&&t!==!1?P.startTransition(()=>R()):R()};return P.createElement("form",{ref:p,method:v,action:y,onSubmit:r?l:x,...h,"data-discover":!S&&n==="render"?"true":void 0})});v5.displayName="Form";function S5(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gR(n){let e=P.useContext(wo);return lt(e,S5(n)),e}function E5(n,{target:e,replace:t,mask:r,state:i,preventScrollReset:s,relative:a,viewTransition:o,defaultShouldRevalidate:l,useTransitions:u}={}){let c=A6(),d=Wr(),f=Hu(n,{relative:a});return P.useCallback(h=>{if(J6(h,e)){h.preventDefault();let p=t!==void 0?t:ro(d)===ro(f),m=()=>c(n,{replace:p,mask:r,state:i,preventScrollReset:s,relative:a,viewTransition:o,defaultShouldRevalidate:l});u?P.startTransition(()=>m()):m()}},[d,c,f,t,r,i,e,n,s,a,o,l,u])}var x5=0,T5=()=>`__${String(++x5)}__`;function _5(){let{router:n}=gR("useSubmit"),{basename:e}=P.useContext(qn),t=G6(),r=n.fetch,i=n.navigate;return P.useCallback(async(s,a={})=>{let{action:o,method:l,encType:u,formData:c,body:d}=t5(s,e);if(a.navigate===!1){let f=a.fetcherKey||T5();await r(f,t,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:c,body:d,formMethod:a.method||l,formEncType:a.encType||u,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:c,body:d,formMethod:a.method||l,formEncType:a.encType||u,replace:a.replace,state:a.state,fromRouteId:t,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,e,t])}function b5(n,{relative:e}={}){let{basename:t}=P.useContext(qn),r=P.useContext(Vr);lt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...Hu(n||".",{relative:e})},a=Wr();if(n==null){s.search=a.search;let o=new URLSearchParams(s.search),l=o.getAll("index");if(l.some(c=>
vendor: 9,102 bytes, lines 51-67
51c==="")){o.delete("index"),l.filter(d=>d).forEach(d=>o.append("index",d));let c=o.toString();s.search=c?`?${c}`:""}}return(!n||n===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(s.pathname=s.pathname==="/"?t:hr([t,s.pathname])),ro(s)}function I5(n,{relative:e}={}){let t=P.useContext(lR);lt(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=gR("useViewTransitionState"),i=Hu(n,{relative:e});if(!t.isTransitioning)return!1;let s=ci(t.currentLocation.pathname,r)||t.currentLocation.pathname,a=ci(t.nextLocation.pathname,r)||t.nextLocation.pathname;return Xd(i.pathname,a)!=null||Xd(i.pathname,s)!=null}var yR={exports:{}},An={},vR={exports:{}},SR={};/** 52 * @license React 53 * scheduler.production.min.js 54 * 55 * Copyright (c) Facebook, Inc. and its affiliates. 56 * 57 * This source code is licensed under the MIT license found in the 58 * LICENSE file in the root directory of this source tree. 59 */(function(n){function e(L,O){var B=L.length;L.push(O);e:for(;0<B;){var G=B-1>>>1,j=L[G];if(0<i(j,O))L[G]=O,L[B]=j,B=G;else break e}}function t(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var O=L[0],B=L.pop();if(B!==O){L[0]=B;e:for(var G=0,j=L.length,W=j>>>1;G<W;){var z=2*(G+1)-1,Y=L[z],V=z+1,J=L[V];if(0>i(Y,B))V<j&&0>i(J,Y)?(L[G]=J,L[V]=B,G=V):(L[G]=Y,L[z]=B,G=z);else if(V<j&&0>i(J,B))L[G]=J,L[V]=B,G=V;else break e}}return O}function i(L,O){var B=L.sortIndex-O.sortIndex;return B!==0?B:L.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();n.unstable_now=function(){return a.now()-o}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,g=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(L){for(var O=t(u);O!==null;){if(O.callback===null)r(u);else if(O.startTime<=L)r(u),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(u)}}function x(L){if(m=!1,S(L),!p)if(t(l)!==null)p=!0,D(T);else{var O=t(u);O!==null&&M(x,O.startTime-L)}}function T(L,O){p=!1,m&&(m=!1,y(R),R=-1),h=!0;var B=f;try{for(S(O),d=t(l);d!==null&&(!(d.expirationTime>O)||L&&!C());){var G=d.callback;if(typeof G=="function"){d.callback=null,f=d.priorityLevel;var j=G(d.expirationTime<=O);O=n.unstable_now(),typeof j=="function"?d.callback=j:d===t(l)&&r(l),S(O)}else r(l);d=t(l)}if(d!==null)var W=!0;else{var z=t(u);z!==null&&M(x,z.startTime-O),W=!1}return W}finally{d=null,f=B,h=!1}}var w=!1,I=null,R=-1,A=5,b=-1;function C(){return!(n.unstable_now()-b<A)}function k(){if(I!==null){var L=n.unstable_now();b=L;var O=!0;try{O=I(!0,L)}finally{O?$():(w=!1,I=null)}}else w=!1}var $;if(typeof v=="function")$=function(){v(k)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,N=U.port2;U.port1.onmessage=k,$=function(){N.postMessage(null)}}else $=function(){g(k,0)};function D(L){I=L,w||(w=!0,$())}function M(L,O){R=g(function(){L(n.unstable_now())},O)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(L){L.callback=null},n.unstable_continueExecution=function(){p||h||(p=!0,D(T))},n.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<L?Math.floor(1e3/L):5},n.unstable_getCurrentPriorityLevel=function(){return f},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(L){switch(f){case 1:case 2:case 3:var O=3;break;default:O=f}var B=f;f=O;try{return L()}finally{f=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(L,O){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var B=f;f=L;try{return O()}finally{f=B}},n.unstable_scheduleCallback=function(L,O,B){var G=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?G+B:G):B=G,L){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=B+j,L={id:c++,callback:O,priorityLevel:L,startTime:B,expirationTime:j,sortIndex:-1},B>G?(L.sortIndex=B,e(u,L),t(l)===null&&L===t(u)&&(m?(y(R),R=-1):m=!0,M(x,B-G))):(L.sortIndex=j,e(l,L),p||h||(p=!0,D(T))),L},n.unstable_shouldYield=C,n.unstable_wrapCallback=function(L){var O=f;return function(){var B=f;f=O;try{return L.apply(this,arguments)}finally{f=B}}}})(SR);vR.exports=SR;var w5=vR.exports;/** 60 * @license React 61 * react-dom.production.min.js 62 * 63 * Copyright (c) Facebook, Inc. and its affiliates. 64 * 65 * This source code is licensed under the MIT license found in the 66 * LICENSE file in the root directory of this source tree. 67 */var R5=P,Rn=w5;function q(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var ER=new Set,zl={};function na(n,e){so(n,e),so(n+"Capture",e)}function so(n,e){for(zl[n]=e,n=0;n<e.length;n++)ER.add(e[n])}var di=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bg=Object.prototype.hasOwnProperty,A5=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,kx={},Dx={};function L5(n){return bg.call(Dx,n)?!0:bg.call(kx,n)?!1:A5.test(n)?Dx[n]=!0:(kx[n]=!0,!1)}function C5(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function k5(n,e,t,r){if(e===null||typeof e>"u"||C5(n,e,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function sn(n,e,t,r,i,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var $t={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){$t[n]=new sn(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];$t[e]=new sn(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){$t[n]=new sn(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){$t[n]=new sn(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){$t[n]=new sn(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){$t[n]=new sn(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){$t[n]=new sn(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){$t[n]=new sn(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){$t[n]=new sn(n,5,!1,n.toLowerCase(),null,!1,!1)});var Qy=/[\-:]([a-z])/g;function Jy(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode
67-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(Qy,Jy);$t[e]=new sn(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(Qy,Jy);$t[e]=new sn(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(Qy,Jy);$t[e]=new sn(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){$t[n]=new sn(n,1,!1,n.toLowerCase(),null,!1,!1)});$t.xlinkHref=new sn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){$t[n]=new sn(n,1,!1,n.toLowerCase(),null,!0,!0)});function Zy(n,e,t,r){var i=$t.hasOwnProperty(e)?$t[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(k5(e,t,i,r)&&(t=null),r||i===null?L5(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):i.mustUseProperty?n[i.propertyName]=t===null?i.type===3?!1:"":t:(e=i.attributeName,r=i.attributeNamespace,t===null?n.removeAttribute(e):(i=i.type,t=i===3||i===4&&t===!0?"":""+t,r?n.setAttributeNS(r,e,t):n.setAttribute(e,t))))}var vi=R5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,uc=Symbol.for("react.element"),ba=Symbol.for("react.portal"),Ia=Symbol.for("react.fragment"),ev=Symbol.for("react.strict_mode"),Ig=Symbol.for("react.profiler"),xR=Symbol.for("react.provider"),TR=Symbol.for("react.context"),tv=Symbol.for("react.forward_ref"),wg=Symbol.for("react.suspense"),Rg=Symbol.for("react.suspense_list"),nv=Symbol.for("react.memo"),Ci=Symbol.for("react.lazy"),_R=Symbol.for("react.offscreen"),Px=Symbol.iterator;function Mo(n){return n===null||typeof n!="object"?null:(n=Px&&n[Px]||n["@@iterator"],typeof n=="function"?n:null)}var ct=Object.assign,kp;function tl(n){if(kp===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);kp=e&&e[1]||""}return` 68`+kp+n}var Dp=!1;function Pp(n,e){if(!n||Dp)return"";Dp=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(n,[],e)}else{try{e.call()}catch(u){r=u}n.call(e.prototype)}else{try{throw Error()}catch(u){r=u}n()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(` 69`),s=r.stack.split(` 70`),a=i.length-1,o=s.length-1;1<=a&&0<=o&&i[a]!==s[o];)o--;for(;1<=a&&0<=o;a--,o--)if(i[a]!==s[o]){if(a!==1||o!==1)do if(a--,o--,0>o||i[a]!==s[o]){var l=` 71`+i[a].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=a&&0<=o);break}}}finally{Dp=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?tl(n):""}function D5(n){switch(n.tag){case 5:return tl(n.type);case 16:return tl("Lazy");case 13:return tl("Suspense");case 19:return tl("SuspenseList");case 0:case 2:case 15:return n=Pp(n.type,!1),n;case 11:return n=Pp(n.type.render,!1),n;case 1:return n=Pp(n.type,!0),n;default:return""}}function Ag(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Ia:return"Fragment";case ba:return"Portal";case Ig:return"Profiler";case ev:return"StrictMode";case wg:return"Suspense";case Rg:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case TR:return(n.displayName||"Context")+".Consumer";case xR:return(n._context.displayName||"Context")+".Provider";case tv:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case nv:return e=n.displayName||null,e!==null?e:Ag(n.type)||"Memo";case Ci:e=n._payload,n=n._init;try{return Ag(n(e))}catch{}}return null}function P5(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ag(e);case 8:return e===ev?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function ns(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function bR(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function O5(n){var e=bR(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function cc(n){n._valueTracker||(n._valueTracker=O5(n))}function IR(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=bR(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function Jd(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Lg(n,e){var t=e.checked;return ct({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function Ox(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=ns(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function wR(n,e){e=e.checked,e!=null&&Zy(n,"checked",e,!1)}function Cg(n,e){wR(n,e);var t=ns(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?kg(n,e.type,t):e.hasOwnProperty("defaultValue")&&kg(n,e.type,ns(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function Mx(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function kg(n,e,t){(e!=="number"||Jd(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var nl=Array.isArray;function Ba(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i<t.length;i++)e["$"+t[i]]=!0;for(t=0;t<n.length;t++)i=e.hasOwnProperty("$"+n[t].value),n[t].selected!==i&&(n[t].selected=i),i&&r&&(n[t].defaultSelected=!0)}else{for(t=""+ns(t),e=null,i=0;i<n.length;i++){if(n[i].value===t){n[i].selected=!0,r&&(n[i].defaultSelected=!0);return}e!==null||n[i].disabled||(e=n[i])}e!==null&&(e.selected=!0)}}function Dg(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(q(91));return ct({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Fx(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(q(92));if(nl(t)){if(1<t.length)throw Error(q(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:ns(t)}}function RR(n,e){var t=ns(e.value),r=ns(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),r!=null&&(n.defaultValue=""+r)}function Nx(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function AR(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Pg(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?AR(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var dc,LR=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,r,i){MSApp.execUnsafeLocalFunction(function(){return n(e,t,r,i)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(dc=dc||document.createElement("div"),dc.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=dc.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function Kl(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var ml={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},M5=["Webkit","ms","Moz","O"];
vendor: 6,768 bytes, line 71
71Object.keys(ml).forEach(function(n){M5.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),ml[e]=ml[n]})});function CR(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||ml.hasOwnProperty(n)&&ml[n]?(""+e).trim():e+"px"}function kR(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=CR(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var F5=ct({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Og(n,e){if(e){if(F5[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Mg(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Fg=null;function rv(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ng=null,$a=null,Ga=null;function Ux(n){if(n=zu(n)){if(typeof Ng!="function")throw Error(q(280));var e=n.stateNode;e&&(e=Lh(e),Ng(n.stateNode,n.type,e))}}function DR(n){$a?Ga?Ga.push(n):Ga=[n]:$a=n}function PR(){if($a){var n=$a,e=Ga;if(Ga=$a=null,Ux(n),e)for(n=0;n<e.length;n++)Ux(e[n])}}function OR(n,e){return n(e)}function MR(){}var Op=!1;function FR(n,e,t){if(Op)return n(e,t);Op=!0;try{return OR(n,e,t)}finally{Op=!1,($a!==null||Ga!==null)&&(MR(),PR())}}function ql(n,e){var t=n.stateNode;if(t===null)return null;var r=Lh(t);if(r===null)return null;t=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(n=n.type,r=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!r;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(q(231,e,typeof t));return t}var Ug=!1;if(di)try{var Fo={};Object.defineProperty(Fo,"passive",{get:function(){Ug=!0}}),window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,Fo)}catch{Ug=!1}function N5(n,e,t,r,i,s,a,o,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(t,u)}catch(c){this.onError(c)}}var gl=!1,Zd=null,ef=!1,Bg=null,U5={onError:function(n){gl=!0,Zd=n}};function B5(n,e,t,r,i,s,a,o,l){gl=!1,Zd=null,N5.apply(U5,arguments)}function $5(n,e,t,r,i,s,a,o,l){if(B5.apply(this,arguments),gl){if(gl){var u=Zd;gl=!1,Zd=null}else throw Error(q(198));ef||(ef=!0,Bg=u)}}function ra(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function NR(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function Bx(n){if(ra(n)!==n)throw Error(q(188))}function G5(n){var e=n.alternate;if(!e){if(e=ra(n),e===null)throw Error(q(188));return e!==n?null:n}for(var t=n,r=e;;){var i=t.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){t=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===t)return Bx(i),n;if(s===r)return Bx(i),e;s=s.sibling}throw Error(q(188))}if(t.return!==r.return)t=i,r=s;else{for(var a=!1,o=i.child;o;){if(o===t){a=!0,t=i,r=s;break}if(o===r){a=!0,r=i,t=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===t){a=!0,t=s,r=i;break}if(o===r){a=!0,r=s,t=i;break}o=o.sibling}if(!a)throw Error(q(189))}}if(t.alternate!==r)throw Error(q(190))}if(t.tag!==3)throw Error(q(188));return t.stateNode.current===t?n:e}function UR(n){return n=G5(n),n!==null?BR(n):null}function BR(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=BR(n);if(e!==null)return e;n=n.sibling}return null}var $R=Rn.unstable_scheduleCallback,$x=Rn.unstable_cancelCallback,j5=Rn.unstable_shouldYield,H5=Rn.unstable_requestPaint,mt=Rn.unstable_now,V5=Rn.unstable_getCurrentPriorityLevel,iv=Rn.unstable_ImmediatePriority,GR=Rn.unstable_UserBlockingPriority,tf=Rn.unstable_NormalPriority,W5=Rn.unstable_LowPriority,jR=Rn.unstable_IdlePriority,Ih=null,Nr=null;function z5(n){if(Nr&&typeof Nr.onCommitFiberRoot=="function")try{Nr.onCommitFiberRoot(Ih,n,void 0,(n.current.flags&128)===128)}catch{}}var pr=Math.clz32?Math.clz32:Y5,K5=Math.log,q5=Math.LN2;function Y5(n){return n>>>=0,n===0?32:31-(K5(n)/q5|0)|0}var fc=64,hc=4194304;function rl(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function nf(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,a=t&268435455;if(a!==0){var o=a&~i;o!==0?r=rl(o):(s&=a,s!==0&&(r=rl(s)))}else a=t&~i,a!==0?r=rl(a):s!==0&&(r=rl(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0<e;)t=31-pr(e),i=1<<t,r|=n[t],e&=~i;return r}function X5(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Q5(n,e){for(var t=n.suspendedLanes,r=n.pingedLanes,i=n.expirationTimes,s=n.pendingLanes;0<s;){var a=31-pr(s),o=1<<a,l=i[a];l===-1?(!(o&t)||o&r)&&(i[a]=X5(o,e)):l<=e&&(n.expiredLanes|=o),s&=~o}}function $g(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function HR(){var n=fc;return fc<<=1,!(fc&4194240)&&(fc=64),n}function Mp(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function Vu(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-pr(e),n[e]=t}function J5(n,e){var t=n.pendingLanes&~e;
vendor: 4,148 bytes, line 71
71n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0<t;){var i=31-pr(t),s=1<<i;e[i]=0,r[i]=-1,n[i]=-1,t&=~s}}function sv(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var r=31-pr(t),i=1<<r;i&e|n[r]&e&&(n[r]|=e),t&=~i}}var $e=0;function VR(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var WR,av,zR,KR,qR,Gg=!1,pc=[],ji=null,Hi=null,Vi=null,Yl=new Map,Xl=new Map,Mi=[],Z5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Gx(n,e){switch(n){case"focusin":case"focusout":ji=null;break;case"dragenter":case"dragleave":Hi=null;break;case"mouseover":case"mouseout":Vi=null;break;case"pointerover":case"pointerout":Yl.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xl.delete(e.pointerId)}}function No(n,e,t,r,i,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=zu(e),e!==null&&av(e)),n):(n.eventSystemFlags|=r,e=n.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),n)}function eG(n,e,t,r,i){switch(e){case"focusin":return ji=No(ji,n,e,t,r,i),!0;case"dragenter":return Hi=No(Hi,n,e,t,r,i),!0;case"mouseover":return Vi=No(Vi,n,e,t,r,i),!0;case"pointerover":var s=i.pointerId;return Yl.set(s,No(Yl.get(s)||null,n,e,t,r,i)),!0;case"gotpointercapture":return s=i.pointerId,Xl.set(s,No(Xl.get(s)||null,n,e,t,r,i)),!0}return!1}function YR(n){var e=Cs(n.target);if(e!==null){var t=ra(e);if(t!==null){if(e=t.tag,e===13){if(e=NR(t),e!==null){n.blockedOn=e,qR(n.priority,function(){zR(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function fd(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=jg(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var r=new t.constructor(t.type,t);Fg=r,t.target.dispatchEvent(r),Fg=null}else return e=zu(t),e!==null&&av(e),n.blockedOn=t,!1;e.shift()}return!0}function jx(n,e,t){fd(n)&&t.delete(e)}function tG(){Gg=!1,ji!==null&&fd(ji)&&(ji=null),Hi!==null&&fd(Hi)&&(Hi=null),Vi!==null&&fd(Vi)&&(Vi=null),Yl.forEach(jx),Xl.forEach(jx)}function Uo(n,e){n.blockedOn===e&&(n.blockedOn=null,Gg||(Gg=!0,Rn.unstable_scheduleCallback(Rn.unstable_NormalPriority,tG)))}function Ql(n){function e(i){return Uo(i,n)}if(0<pc.length){Uo(pc[0],n);for(var t=1;t<pc.length;t++){var r=pc[t];r.blockedOn===n&&(r.blockedOn=null)}}for(ji!==null&&Uo(ji,n),Hi!==null&&Uo(Hi,n),Vi!==null&&Uo(Vi,n),Yl.forEach(e),Xl.forEach(e),t=0;t<Mi.length;t++)r=Mi[t],r.blockedOn===n&&(r.blockedOn=null);for(;0<Mi.length&&(t=Mi[0],t.blockedOn===null);)YR(t),t.blockedOn===null&&Mi.shift()}var ja=vi.ReactCurrentBatchConfig,rf=!0;function nG(n,e,t,r){var i=$e,s=ja.transition;ja.transition=null;try{$e=1,ov(n,e,t,r)}finally{$e=i,ja.transition=s}}function rG(n,e,t,r){var i=$e,s=ja.transition;ja.transition=null;try{$e=4,ov(n,e,t,r)}finally{$e=i,ja.transition=s}}function ov(n,e,t,r){if(rf){var i=jg(n,e,t,r);if(i===null)Wp(n,e,r,sf,t),Gx(n,r);else if(eG(i,n,e,t,r))r.stopPropagation();else if(Gx(n,r),e&4&&-1<Z5.indexOf(n)){for(;i!==null;){var s=zu(i);if(s!==null&&WR(s),s=jg(n,e,t,r),s===null&&Wp(n,e,r,sf,t),s===i)break;i=s}i!==null&&r.stopPropagation()}else Wp(n,e,r,null,t)}}var sf=null;function jg(n,e,t,r){if(sf=null,n=rv(r),n=Cs(n),n!==null)if(e=ra(n),e===null)n=null;else if(t=e.tag,t===13){if(n=NR(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return sf=n,null}function XR(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invali
71d":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(V5()){case iv:return 1;case GR:return 4;case tf:case W5:return 16;case jR:return 536870912;default:return 16}default:return 16}}var Ni=null,lv=null,hd=null;function QR(){if(hd)return hd;var n,e=lv,t=e.length,r,i="value"in Ni?Ni.value:Ni.textContent,s=i.length;for(n=0;n<t&&e[n]===i[n];n++);var a=t-n;for(r=1;r<=a&&e[t-r]===i[s-r];r++);return hd=i.slice(n,1<r?1-r:void 0)}function pd(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function mc(){return!0}function Hx(){return!1}function Ln(n){function e(t,r,i,s,a){this._reactName=t,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var o in n)n.hasOwnProperty(o)&&(t=n[o],this[o]=t?t(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?mc:Hx,this.isPropagationStopped=Hx,this}return ct(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=mc)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=mc)},persist:function(){},isPersistent:mc}),e}var Ao={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uv=Ln(Ao),Wu=ct({},Ao,{view:0,detail:0}),iG=Ln(Wu),Fp,Np,Bo,wh=ct({},Wu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cv,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Bo&&(Bo&&n.type==="mousemove"?(Fp=n.screenX-Bo.screenX,Np=n.screenY-Bo.screenY):Np=Fp=0,Bo=n),Fp)},movementY:function(n){return"movementY"in n?n.movementY:Np}}),Vx=Ln(wh),sG=ct({},wh,{dataTransfer:0}),aG=Ln(sG),oG=ct({},Wu,{relatedTarget:0}),Up=Ln(oG),lG=ct({},Ao,{animationName:0,elapsedTime:0,pseudoElement:0}),uG=Ln(lG),cG=ct({},Ao,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),dG=Ln(cG),fG=ct({},Ao,{data:0}),Wx=Ln(fG),hG={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pG={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},mG={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gG(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=mG[n])?!!e[n]:!1}function cv(){return gG}var yG=ct({},Wu,{key:function(n){if(n.key){var e=hG[n.key]||n.key;if(e!=="Unidentified")return e}
vendor: 6,028 bytes, line 71
71return n.type==="keypress"?(n=pd(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?pG[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cv,charCode:function(n){return n.type==="keypress"?pd(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?pd(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),vG=Ln(yG),SG=ct({},wh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zx=Ln(SG),EG=ct({},Wu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cv}),xG=Ln(EG),TG=ct({},Ao,{propertyName:0,elapsedTime:0,pseudoElement:0}),_G=Ln(TG),bG=ct({},wh,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),IG=Ln(bG),wG=[9,13,27,32],dv=di&&"CompositionEvent"in window,yl=null;di&&"documentMode"in document&&(yl=document.documentMode);var RG=di&&"TextEvent"in window&&!yl,JR=di&&(!dv||yl&&8<yl&&11>=yl),Kx=" ",qx=!1;function ZR(n,e){switch(n){case"keyup":return wG.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eA(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var wa=!1;function AG(n,e){switch(n){case"compositionend":return eA(e);case"keypress":return e.which!==32?null:(qx=!0,Kx);case"textInput":return n=e.data,n===Kx&&qx?null:n;default:return null}}function LG(n,e){if(wa)return n==="compositionend"||!dv&&ZR(n,e)?(n=QR(),hd=lv=Ni=null,wa=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return JR&&e.locale!=="ko"?null:e.data;default:return null}}var CG={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Yx(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!CG[n.type]:e==="textarea"}function tA(n,e,t,r){DR(r),e=af(e,"onChange"),0<e.length&&(t=new uv("onChange","change",null,t,r),n.push({event:t,listeners:e}))}var vl=null,Jl=null;function kG(n){fA(n,0)}function Rh(n){var e=La(n);if(IR(e))return n}function DG(n,e){if(n==="change")return e}var nA=!1;if(di){var Bp;if(di){var $p="oninput"in document;if(!$p){var Xx=document.createElement("div");Xx.setAttribute("oninput","return;"),$p=typeof Xx.oninput=="function"}Bp=$p}else Bp=!1;nA=Bp&&(!document.documentMode||9<document.documentMode)}function Qx(){vl&&(vl.detachEvent("onpropertychange",rA),Jl=vl=null)}function rA(n){if(n.propertyName==="value"&&Rh(Jl)){var e=[];tA(e,Jl,n,rv(n)),FR(kG,e)}}function PG(n,e,t){n==="focusin"?(Qx(),vl=e,Jl=t,vl.attachEvent("onpropertychange",rA)):n==="focusout"&&Qx()}function OG(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Rh(Jl)}function MG(n,e){if(n==="click")return Rh(e)}function FG(n,e){if(n==="input"||n==="change")return Rh(e)}function NG(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Sr=typeof Object.is=="function"?Object.is:NG;function Zl(n,e){if(Sr(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(r=0;r<t.length;r++){var i=t[r];if(!bg.call(e,i)||!Sr(n[i],e[i]))return!1}return!0}function Jx(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Zx(n,e){var t=Jx(n);n=0;for(var r;t;){if(t.nodeType===3){if(r=n+t.textContent.length,n<=e&&r>=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=Jx(t)}}function iA(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?iA(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function sA(){for(var n=window,e=Jd();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Jd(n.document)}return e}function fv(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function UG(n){var e=sA(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&iA(t.ownerDocument.documentElement,t)){if(r!==null&&fv(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=Zx(t,s);var a=Zx(t,r);i&&a&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==a.node||n.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(n.addRange(e),n.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var BG=di&&"documentMode"in document&&11>=document.documentMode,Ra=null,Hg=null,Sl=null,Vg=!1;function eT(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Vg||Ra==null||Ra!==Jd(r)||(r=Ra,"selectionStart"in r&&fv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 4,501 bytes, line 71
71sNode:r.focusNode,focusOffset:r.focusOffset}),Sl&&Zl(Sl,r)||(Sl=r,r=af(Hg,"onSelect"),0<r.length&&(e=new uv("onSelect","select",null,e,t),n.push({event:e,listeners:r}),e.target=Ra)))}function gc(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var Aa={animationend:gc("Animation","AnimationEnd"),animationiteration:gc("Animation","AnimationIteration"),animationstart:gc("Animation","AnimationStart"),transitionend:gc("Transition","TransitionEnd")},Gp={},aA={};di&&(aA=document.createElement("div").style,"AnimationEvent"in window||(delete Aa.animationend.animation,delete Aa.animationiteration.animation,delete Aa.animationstart.animation),"TransitionEvent"in window||delete Aa.transitionend.transition);function Ah(n){if(Gp[n])return Gp[n];if(!Aa[n])return n;var e=Aa[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in aA)return Gp[n]=e[t];return n}var oA=Ah("animationend"),lA=Ah("animationiteration"),uA=Ah("animationstart"),cA=Ah("transitionend"),dA=new Map,tT="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function hs(n,e){dA.set(n,e),na(e,[n])}for(var jp=0;jp<tT.length;jp++){var Hp=tT[jp],$G=Hp.toLowerCase(),GG=Hp[0].toUpperCase()+Hp.slice(1);hs($G,"on"+GG)}hs(oA,"onAnimationEnd");hs(lA,"onAnimationIteration");hs(uA,"onAnimationStart");hs("dblclick","onDoubleClick");hs("focusin","onFocus");hs("focusout","onBlur");hs(cA,"onTransitionEnd");so("onMouseEnter",["mouseout","mouseover"]);so("onMouseLeave",["mouseout","mouseover"]);so("onPointerEnter",["pointerout","pointerover"]);so("onPointerLeave",["pointerout","pointerover"]);na("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));na("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));na("onBeforeInput",["compositionend","keypress","textInput","paste"]);na("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));na("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));na("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var il="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),jG=new Set("cancel close invalid load scroll toggle".split(" ").concat(il));function nT(n,e,t){var r=n.type||"unknown-event";n.currentTarget=t,$5(r,e,void 0,n),n.currentTarget=null}function fA(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var r=n[t],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var a=r.length-1;0<=a;a--){var o=r[a],l=o.instance,u=o.currentTarget;if(o=o.listener,l!==s&&i.isPropagationStopped())break e;nT(i,o,u),s=l}else for(a=0;a<r.length;a++){if(o=r[a],l=o.instance,u=o.currentTarget,o=o.listener,l!==s&&i.isPropagationStopped())break e;nT(i,o,u),s=l}}}if(ef)throw n=Bg,ef=!1,Bg=null,n}function Je(n,e){var t=e[Yg];t===void 0&&(t=e[Yg]=new Set);var r=n+"__bubble";t.has(r)||(hA(e,n,2,!1),t.add(r))}function Vp(n,e,t){var r=0;e&&(r|=4),hA(t,n,r,e)}var yc="_reactListening"+Math.random().toString(36).slice(2);function eu(n){if(!n[yc]){n[yc]=!0,ER.forEach(function(t){t!=="selectionchange"&&(jG.has(t)||Vp(t,!1,n),Vp(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[yc]||(e[yc]=!0,Vp("selectionchange",!1,e))}}function hA(n,e,t,r){switch(XR(e)){case 1:var i=nG;break;case 4:i=rG;break;default:i=ov}t=i.bind(null,e,t,n),i=void 0,!Ug||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?n.addEventListener(e,t,{capture:!0,passive:i}):n.addEventListener(e,t,!0):i!==void 0?n.addEventListener(e,t,{passive:i}):n.addEventListener(e,t,!1)}function Wp(n,e,t,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;
vendor: 10,869 bytes, lines 71-72
71if(o===i||o.nodeType===8&&o.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var l=a.tag;if((l===3||l===4)&&(l=a.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;a=a.return}for(;o!==null;){if(a=Cs(o),a===null)return;if(l=a.tag,l===5||l===6){r=s=a;continue e}o=o.parentNode}}r=r.return}FR(function(){var u=s,c=rv(t),d=[];e:{var f=dA.get(n);if(f!==void 0){var h=uv,p=n;switch(n){case"keypress":if(pd(t)===0)break e;case"keydown":case"keyup":h=vG;break;case"focusin":p="focus",h=Up;break;case"focusout":p="blur",h=Up;break;case"beforeblur":case"afterblur":h=Up;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=Vx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=aG;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=xG;break;case oA:case lA:case uA:h=uG;break;case cA:h=_G;break;case"scroll":h=iG;break;case"wheel":h=IG;break;case"copy":case"cut":case"paste":h=dG;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=zx}var m=(e&4)!==0,g=!m&&n==="scroll",y=m?f!==null?f+"Capture":null:f;m=[];for(var v=u,S;v!==null;){S=v;var x=S.stateNode;if(S.tag===5&&x!==null&&(S=x,y!==null&&(x=ql(v,y),x!=null&&m.push(tu(v,x,S)))),g)break;v=v.return}0<m.length&&(f=new h(f,p,null,t,c),d.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=n==="mouseover"||n==="pointerover",h=n==="mouseout"||n==="pointerout",f&&t!==Fg&&(p=t.relatedTarget||t.fromElement)&&(Cs(p)||p[fi]))break e;if((h||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,h?(p=t.relatedTarget||t.toElement,h=u,p=p?Cs(p):null,p!==null&&(g=ra(p),p!==g||p.tag!==5&&p.tag!==6)&&(p=null)):(h=null,p=u),h!==p)){if(m=Vx,x="onMouseLeave",y="onMouseEnter",v="mouse",(n==="pointerout"||n==="pointerover")&&(m=zx,x="onPointerLeave",y="onPointerEnter",v="pointer"),g=h==null?f:La(h),S=p==null?f:La(p),f=new m(x,v+"leave",h,t,c),f.target=g,f.relatedTarget=S,x=null,Cs(c)===u&&(m=new m(y,v+"enter",p,t,c),m.target=S,m.relatedTarget=g,x=m),g=x,h&&p)t:{for(m=h,y=p,v=0,S=m;S;S=la(S))v++;for(S=0,x=y;x;x=la(x))S++;for(;0<v-S;)m=la(m),v--;for(;0<S-v;)y=la(y),S--;for(;v--;){if(m===y||y!==null&&m===y.alternate)break t;m=la(m),y=la(y)}m=null}else m=null;h!==null&&rT(d,f,h,m,!1),p!==null&&g!==null&&rT(d,g,p,m,!0)}}e:{if(f=u?La(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var T=DG;else if(Yx(f))if(nA)T=FG;else{T=OG;var w=PG}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(T=MG);if(T&&(T=T(n,u))){tA(d,T,t,c);break e}w&&w(n,f,u),n==="focusout"&&(w=f._wrapperState)&&w.controlled&&f.type==="number"&&kg(f,"number",f.value)}switch(w=u?La(u):window,n){case"focusin":(Yx(w)||w.contentEditable==="true")&&(Ra=w,Hg=u,Sl=null);break;case"focusout":Sl=Hg=Ra=null;break;case"mousedown":Vg=!0;break;case"contextmenu":case"mouseup":case"dragend":Vg=!1,eT(d,t,c);break;case"selectionchange":if(BG)break;case"keydown":case"keyup":eT(d,t,c)}var I;if(dv)e:{switch(n){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else wa?ZR(n,t)&&(R="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(R="onCompositionStart");R&&(JR&&t.locale!=="ko"&&(wa||R!=="onCompositionStart"?R==="onCompositionEnd"&&wa&&(I=QR()):(Ni=c,lv="value"in Ni?Ni.value:Ni.textContent,wa=!0)),w=af(u,R),0<w.length&&(R=new Wx(R,n,null,t,c),d.push({event:R,listeners:w}),I?R.data=I:(I=eA(t),I!==null&&(R.data=I)))),(I=RG?AG(n,t):LG(n,t))&&(u=af(u,"onBeforeInput"),0<u.length&&(c=new Wx("onBeforeInput","beforeinput",null,t,c),d.push({event:c,listeners:u}),c.data=I))}fA(d,e)})}function tu(n,e,t){return{instance:n,listener:e,currentTarget:t}}function af(n,e){for(var t=e+"Capture",r=[];n!==null;){var i=n,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=ql(n,t),s!=null&&r.unshift(tu(n,s,i)),s=ql(n,e),s!=null&&r.push(tu(n,s,i))),n=n.return}return r}function la(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function rT(n,e,t,r,i){for(var s=e._reactName,a=[];t!==null&&t!==r;){var o=t,l=o.alternate,u=o.stateNode;if(l!==null&&l===r)break;o.tag===5&&u!==null&&(o=u,i?(l=ql(t,s),l!=null&&a.unshift(tu(t,l,o))):i||(l=ql(t,s),l!=null&&a.push(tu(t,l,o)))),t=t.return}a.length!==0&&n.push({event:e,listeners:a})}var HG=/\r\n?/g,VG=/\u0000|\uFFFD/g;function iT(n){return(typeof n=="string"?n:""+n).replace(HG,` 72`).replace(VG,"")}function vc(n,e,t){if(e=iT(e),iT(n)!==e&&t)throw Error(q(425))}function of(){}var Wg=null,zg=null;function Kg(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var qg=typeof setTimeout=="function"?setTimeout:void 0,WG=typeof clearTimeout=="function"?clearTimeout:void 0,sT=typeof Promise=="function"?Promise:void 0,zG=typeof queueMicrotask=="function"?queueMicrotask:typeof sT<"u"?function(n){return sT.resolve(null).then(n).catch(KG)}:qg;function KG(n){setTimeout(function(){throw n})}function zp(n,e){var t=e,r=0;do{var i=t.nextSibling;if(n.removeChild(t),i&&i.nodeType===8)if(t=i.data,t==="/$"){if(r===0){n.removeChild(i),Ql(e);return}r--}else t!=="$"&&t!=="$?"&&t!=="$!"||r++;t=i}while(t);Ql(e)}function Wi(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function aT(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var Lo=Math.random().toString(36).slice(2),Cr="__reactFiber$"+Lo,nu="__reactProps$"+Lo,fi="__reactContainer$"+Lo,Yg="__reactEvents$"+Lo,qG="__reactListeners$"+Lo,YG="__reactHandles$"+Lo;function Cs(n){var e=n[Cr];if(e)return e;for(var t=n.parentNode;t;){if(e=t[fi]||t[Cr]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=aT(n);n!==null;){if(t=n[Cr])return t;n=aT(n)}return e}n=t,t=n.parentNode}return null}function zu(n){return n=n[Cr]||n[fi],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function La(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(q(33))}function Lh(n){return n[nu]||null}var Xg=[],Ca=-1;function ps(n){return{current:n}}function et(n){0>Ca||(n.current=Xg[Ca],Xg[Ca]=null,Ca--)}function qe(n,e){Ca++,Xg[Ca]=n.current,n.current=e}var rs={},qt=ps(rs),fn=ps(!1),Ks=rs;function ao(n,e){var t=n.type.contextTypes;if(!t)return rs;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function hn(n){return n=n.childContextTypes,n!=null}function lf(){et(fn),et(qt)}function oT(n,e,t){if(qt.current!==rs)throw Error(q(168));qe(qt,e),qe(fn,t)}function pA(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(q(108,P5(n)||"Unknown",i));return ct({},t,r)}function uf(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||rs,Ks=qt.current,qe(qt,n),qe(fn,fn.current),!0}function lT(n,e,t){var r=n.stateNode;if(!r)throw Error(q(169));t?(n=pA(n,e,Ks),r.__reactInternalMemoizedMergedChildContext=n,et(fn),et(qt),qe(qt,n)):et(fn),qe(fn,t)}var Jr=null,Ch=!1,Kp=!1;function mA(n){Jr===null?Jr=[n]:Jr.push(n)}function XG(n){Ch=!0,mA(n)}function ms(){if(!Kp&&Jr!==null){Kp=!0;var n=0,e=$e;try{var t=Jr;for($e=1;n<t.length;n++){var r=t[n];do r=r(!0);while(r!==null)}Jr=null,Ch=!1}catch(i){throw Jr!==null&&(Jr=Jr.slice(n+1)),$R(iv,ms),i}finally{$e=e,Kp=!1}}return null}var ka=[],Da=0,cf=null,df=0,Fn=[],Nn=0,qs=null,ti=1,ni="";function Ts(n,e){ka[Da++]=df,ka[Da++]=cf,cf=n,df=e}function gA(n,e,t){Fn[Nn++]=ti,Fn[Nn++]=ni,Fn[Nn++]=qs,qs=n;var r=ti;n=ni;var i=32-pr(r)-1;r&=~(1<<i),t+=1;var s=32-pr(e)+i;if(30<s){var a=i-i%5;s=(r&(1<<a)-1).toString(32),r>>=a,i-=a,ti=1<<32-pr(e)+i|t<<i|r,ni=s+n}else ti=1<<s|t<<i|r,ni=n}function hv(n){n.return!==null&&(Ts(n,1),gA(n,1,0))}function pv(n){for(;n===cf;)cf=ka[--Da],ka[Da]=null,df=ka[--Da],ka[Da]=null;for(;n===qs;)qs=Fn[--Nn],Fn[Nn]=null,ni=Fn[--Nn],Fn[Nn]=null,ti=Fn[--Nn],Fn[Nn]=null}var bn=null,Tn=null,it=!1,lr=null;function yA(n,e){var t=$n(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function uT(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,bn=n,Tn=Wi(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,bn=n,Tn=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=qs!==null?{id:ti,overflow:ni}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=$n(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,bn=n,Tn=null,!0):!1;default:return!1}}function Qg(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Jg(n){if(it){var e=Tn;if(e){var t=e;if(!uT(n,e)){if(Qg(n))throw Error(q(418));e=Wi(t.nextSibling);var r=bn;e&&uT(n,e)?yA(r,t):(n.flags=n.flags&-4097|2,it=!1,bn=n)}}else{if(Qg(n))throw Error(q(418));n.flags=n.flags&-4097|2,it=!1,bn=n}}}function cT(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;bn=n}function Sc(n){if(n!==bn)return!1;if(!it)return cT(n),it=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!Kg(n.type,n.memoizedProps)),e&&(e=Tn)){if(Qg(n))throw vA(),Error(q(418));for(;e;)yA(n,e),e=Wi(e.nextSibling)}if(cT(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(q(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){Tn=Wi(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}Tn=null}}else Tn=bn?Wi(n.stateNode.nextSibling):null;return!0}function vA(){for(var n=Tn;n;)n=Wi(n.nextSibling)}function oo(){Tn=bn=null,it=!1}function mv(n){lr===null?lr=[n]:lr.push(n)}var QG=vi.ReactCurrentBatchConfig;function $o(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(q(309));var r=t.stateNode}if(!r)throw Error(q(147,n));var i=r,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(a){var o=i.refs;a===null?delete o[s]:o[s]=a},e._stringRef=s,e)}
vendor: 4,831 bytes, line 72
72if(typeof n!="string")throw Error(q(284));if(!t._owner)throw Error(q(290,n))}return n}function Ec(n,e){throw n=Object.prototype.toString.call(e),Error(q(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function dT(n){var e=n._init;return e(n._payload)}function SA(n){function e(y,v){if(n){var S=y.deletions;S===null?(y.deletions=[v],y.flags|=16):S.push(v)}}function t(y,v){if(!n)return null;for(;v!==null;)e(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function i(y,v){return y=Yi(y,v),y.index=0,y.sibling=null,y}function s(y,v,S){return y.index=S,n?(S=y.alternate,S!==null?(S=S.index,S<v?(y.flags|=2,v):S):(y.flags|=2,v)):(y.flags|=1048576,v)}function a(y){return n&&y.alternate===null&&(y.flags|=2),y}function o(y,v,S,x){return v===null||v.tag!==6?(v=em(S,y.mode,x),v.return=y,v):(v=i(v,S),v.return=y,v)}function l(y,v,S,x){var T=S.type;return T===Ia?c(y,v,S.props.children,x,S.key):v!==null&&(v.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ci&&dT(T)===v.type)?(x=i(v,S.props),x.ref=$o(y,v,S),x.return=y,x):(x=xd(S.type,S.key,S.props,null,y.mode,x),x.ref=$o(y,v,S),x.return=y,x)}function u(y,v,S,x){return v===null||v.tag!==4||v.stateNode.containerInfo!==S.containerInfo||v.stateNode.implementation!==S.implementation?(v=tm(S,y.mode,x),v.return=y,v):(v=i(v,S.children||[]),v.return=y,v)}function c(y,v,S,x,T){return v===null||v.tag!==7?(v=Us(S,y.mode,x,T),v.return=y,v):(v=i(v,S),v.return=y,v)}function d(y,v,S){if(typeof v=="string"&&v!==""||typeof v=="number")return v=em(""+v,y.mode,S),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case uc:return S=xd(v.type,v.key,v.props,null,y.mode,S),S.ref=$o(y,null,v),S.return=y,S;case ba:return v=tm(v,y.mode,S),v.return=y,v;case Ci:var x=v._init;return d(y,x(v._payload),S)}if(nl(v)||Mo(v))return v=Us(v,y.mode,S,null),v.return=y,v;Ec(y,v)}return null}function f(y,v,S,x){var T=v!==null?v.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return T!==null?null:o(y,v,""+S,x);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case uc:return S.key===T?l(y,v,S,x):null;case ba:return S.key===T?u(y,v,S,x):null;case Ci:return T=S._init,f(y,v,T(S._payload),x)}if(nl(S)||Mo(S))return T!==null?null:c(y,v,S,x,null);Ec(y,S)}return null}function h(y,v,S,x,T){if(typeof x=="string"&&x!==""||typeof x=="number")return y=y.get(S)||null,o(v,y,""+x,T);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case uc:return y=y.get(x.key===null?S:x.key)||null,l(v,y,x,T);case ba:return y=y.get(x.key===null?S:x.key)||null,u(v,y,x,T);case Ci:var w=x._init;return h(y,v,S,w(x._payload),T)}if(nl(x)||Mo(x))return y=y.get(S)||null,c(v,y,x,T,null);Ec(v,x)}return null}function p(y,v,S,x){for(var T=null,w=null,I=v,R=v=0,A=null;I!==null&&R<S.length;R++){I.index>R?(A=I,I=null):A=I.sibling;var b=f(y,I,S[R],x);if(b===null){I===null&&(I=A);break}n&&I&&b.alternate===null&&e(y,I),v=s(b,v,R),w===null?T=b:w.sibling=b,w=b,I=A}if(R===S.length)return t(y,I),it&&Ts(y,R),T;if(I===null){for(;R<S.length;R++)I=d(y,S[R],x),I!==null&&(v=s(I,v,R),w===null?T=I:w.sibling=I,w=I);return it&&Ts(y,R),T}for(I=r(y,I);R<S.length;R++)A=h(I,y,R,S[R],x),A!==null&&(n&&A.alternate!==null&&I.delete(A.key===null?R:A.key),v=s(A,v,R),w===null?T=A:w.sibling=A,w=A);return n&&I.forEach(function(C){return e(y,C)}),it&&Ts(y,R),T}function m(y,v,S,x){var T=Mo(S);if(typeof T!="function")throw Error(q(150));if(S=T.call(S),S==null)throw Error(q(151));for(var w=T=null,I=v,R=v=0,A=null,b=S.next();I!==null&&!b.done;R++,b=S.next()){I.index>R?(A=I,I=null):A=I.sibling;var C=f(y,I,b.value,x);if(C===null){I===null&&(I=A);break}n&&I&&C.alternate===null&&e(y,I),v=s(C,v,R),w===null?T=C:w.sibling=C,w=C,I=A}if(b.done)return t(y,I),it&&Ts(y,R),T;if(I===null){for(;!b.done;R++,b=S.next())b=d(y,b.value,x),b!==null&&(v=s(b,v,R),w===null?T=b:w.sibling=b,w=b);return it&&Ts(y,R),T}for(I=r(y,I);!b.done;R++,b=S.next())b=h(I,y,R,b.value,x),b!==null&&(n&&b.alternate!==null&&I.delete(b.key===null?R:b.key),v=s(b,v,R),w===null?T=b:w.sibling=b,w=b);return n&&I.forEach(function(k){return e(y,k)}),it&&Ts(y,R),T}function g(y,v,S,x){if(typeof S=="object"&&S!==null&&S.type===Ia&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case uc:e:{for(var T=S.key,w=v;w!==null;){if(w.key===T){if(T=S.type,T===Ia){if(w.tag===7){t(y,w.sibling),v=i(w,S.props.children),v.return=y,y=v;break e}}else if(w.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ci&&dT(T)===w.type){t(y,w.sibling),v=i(w,S.props),v.ref=$o(y,w,S),v.return=y,y=v;break e}t(y,w);break}else e(y,w);w=w.sibling}S.type===Ia?(v=Us(S.props.children,y.mode,x,S.key),v.return=y,y=v):(x=xd(S.type,S.key,S.props,null,y.mode,x),x.ref=$o(y,v,S),x.return=y,y=x)}return a(y);case ba:e:{for(w=S.key;v!==null;
vendor: 4,632 bytes, line 72
72){if(v.key===w)if(v.tag===4&&v.stateNode.containerInfo===S.containerInfo&&v.stateNode.implementation===S.implementation){t(y,v.sibling),v=i(v,S.children||[]),v.return=y,y=v;break e}else{t(y,v);break}else e(y,v);v=v.sibling}v=tm(S,y.mode,x),v.return=y,y=v}return a(y);case Ci:return w=S._init,g(y,v,w(S._payload),x)}if(nl(S))return p(y,v,S,x);if(Mo(S))return m(y,v,S,x);Ec(y,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,v!==null&&v.tag===6?(t(y,v.sibling),v=i(v,S),v.return=y,y=v):(t(y,v),v=em(S,y.mode,x),v.return=y,y=v),a(y)):t(y,v)}return g}var lo=SA(!0),EA=SA(!1),ff=ps(null),hf=null,Pa=null,gv=null;function yv(){gv=Pa=hf=null}function vv(n){var e=ff.current;et(ff),n._currentValue=e}function Zg(n,e,t){for(;n!==null;){var r=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),n===t)break;n=n.return}}function Ha(n,e){hf=n,gv=Pa=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(dn=!0),n.firstContext=null)}function Wn(n){var e=n._currentValue;if(gv!==n)if(n={context:n,memoizedValue:e,next:null},Pa===null){if(hf===null)throw Error(q(308));Pa=n,hf.dependencies={lanes:0,firstContext:n}}else Pa=Pa.next=n;return e}var ks=null;function Sv(n){ks===null?ks=[n]:ks.push(n)}function xA(n,e,t,r){var i=e.interleaved;return i===null?(t.next=t,Sv(e)):(t.next=i.next,i.next=t),e.interleaved=t,hi(n,r)}function hi(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var ki=!1;function Ev(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function TA(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function ai(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function zi(n,e,t){var r=n.updateQueue;if(r===null)return null;if(r=r.shared,De&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,hi(n,t)}return i=r.interleaved,i===null?(e.next=e,Sv(r)):(e.next=i.next,i.next=e),r.interleaved=e,hi(n,t)}function md(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,sv(n,t)}}function fT(n,e){var t=n.updateQueue,r=n.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var a={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=a:s=s.next=a,t=t.next}while(t!==null);s===null?i=s=e:s=s.next=e}else i=s=e;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function pf(n,e,t,r){var i=n.updateQueue;ki=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var l=o,u=l.next;l.next=null,a===null?s=u:a.next=u,a=l;var c=n.alternate;c!==null&&(c=c.updateQueue,o=c.lastBaseUpdate,o!==a&&(o===null?c.firstBaseUpdate=u:o.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;a=0,c=u=l=null,o=s;do{var f=o.lane,h=o.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:h,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=n,m=o;switch(f=e,h=t,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(h,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,f=typeof p=="function"?p.call(h,d,f):p,f==null)break e;d=ct({},d,f);break e;case 2:ki=!0}}o.callback!==null&&o.lane!==0&&(n.flags|=64,f=i.effects,f===null?i.effects=[o]:f.push(o))}else h={eventTime:h,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},c===null?(u=c=h,l=d):c=c.next=h,a|=f;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;f=o,o=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(c===null&&(l=d),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,e=i.shared.interleaved,e!==null){i=e;do a|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Xs|=a,n.lanes=a,n.memoizedState=d}}function hT(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var r=n[e],i=r.callback;if(i!==null){if(r.callback=null,r=t,typeof i!="function")throw Error(q(191,i));i.call(r)}}}var Ku={},Ur=ps(Ku),ru=ps(Ku),iu=ps(Ku);function Ds(n){if(n===Ku)throw Error(q(174));return n}
vendor: 9,435 bytes, line 72
72function xv(n,e){switch(qe(iu,e),qe(ru,n),qe(Ur,Ku),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Pg(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=Pg(e,n)}et(Ur),qe(Ur,e)}function uo(){et(Ur),et(ru),et(iu)}function _A(n){Ds(iu.current);var e=Ds(Ur.current),t=Pg(e,n.type);e!==t&&(qe(ru,n),qe(Ur,t))}function Tv(n){ru.current===n&&(et(Ur),et(ru))}var st=ps(0);function mf(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var qp=[];function _v(){for(var n=0;n<qp.length;n++)qp[n]._workInProgressVersionPrimary=null;qp.length=0}var gd=vi.ReactCurrentDispatcher,Yp=vi.ReactCurrentBatchConfig,Ys=0,ut=null,bt=null,Ct=null,gf=!1,El=!1,su=0,JG=0;function Ht(){throw Error(q(321))}function bv(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!Sr(n[t],e[t]))return!1;return!0}function Iv(n,e,t,r,i,s){if(Ys=s,ut=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,gd.current=n===null||n.memoizedState===null?nj:rj,n=t(r,i),El){s=0;do{if(El=!1,su=0,25<=s)throw Error(q(301));s+=1,Ct=bt=null,e.updateQueue=null,gd.current=ij,n=t(r,i)}while(El)}if(gd.current=yf,e=bt!==null&&bt.next!==null,Ys=0,Ct=bt=ut=null,gf=!1,e)throw Error(q(300));return n}function wv(){var n=su!==0;return su=0,n}function br(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?ut.memoizedState=Ct=n:Ct=Ct.next=n,Ct}function zn(){if(bt===null){var n=ut.alternate;n=n!==null?n.memoizedState:null}else n=bt.next;var e=Ct===null?ut.memoizedState:Ct.next;if(e!==null)Ct=e,bt=n;else{if(n===null)throw Error(q(310));bt=n,n={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Ct===null?ut.memoizedState=Ct=n:Ct=Ct.next=n}return Ct}function au(n,e){return typeof e=="function"?e(n):e}function Xp(n){var e=zn(),t=e.queue;if(t===null)throw Error(q(311));t.lastRenderedReducer=n;var r=bt,i=r.baseQueue,s=t.pending;if(s!==null){if(i!==null){var a=i.next;i.next=s.next,s.next=a}r.baseQueue=i=s,t.pending=null}if(i!==null){s=i.next,r=r.baseState;var o=a=null,l=null,u=s;do{var c=u.lane;if((Ys&c)===c)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:n(r,u.action);else{var d={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(o=l=d,a=r):l=l.next=d,ut.lanes|=c,Xs|=c}u=u.next}while(u!==null&&u!==s);l===null?a=r:l.next=o,Sr(r,e.memoizedState)||(dn=!0),e.memoizedState=r,e.baseState=a,e.baseQueue=l,t.lastRenderedState=r}if(n=t.interleaved,n!==null){i=n;do s=i.lane,ut.lanes|=s,Xs|=s,i=i.next;while(i!==n)}else i===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function Qp(n){var e=zn(),t=e.queue;if(t===null)throw Error(q(311));t.lastRenderedReducer=n;var r=t.dispatch,i=t.pending,s=e.memoizedState;if(i!==null){t.pending=null;var a=i=i.next;do s=n(s,a.action),a=a.next;while(a!==i);Sr(s,e.memoizedState)||(dn=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,r]}function bA(){}function IA(n,e){var t=ut,r=zn(),i=e(),s=!Sr(r.memoizedState,i);if(s&&(r.memoizedState=i,dn=!0),r=r.queue,Rv(AA.bind(null,t,r,n),[n]),r.getSnapshot!==e||s||Ct!==null&&Ct.memoizedState.tag&1){if(t.flags|=2048,ou(9,RA.bind(null,t,r,i,e),void 0,null),kt===null)throw Error(q(349));Ys&30||wA(t,e,i)}return i}function wA(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=ut.updateQueue,e===null?(e={lastEffect:null,stores:null},ut.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function RA(n,e,t,r){e.value=t,e.getSnapshot=r,LA(e)&&CA(n)}function AA(n,e,t){return t(function(){LA(e)&&CA(n)})}function LA(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!Sr(n,t)}catch{return!0}}function CA(n){var e=hi(n,1);e!==null&&mr(e,n,1,-1)}function pT(n){var e=br();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:au,lastRenderedState:n},e.queue=n,n=n.dispatch=tj.bind(null,ut,n),[e.memoizedState,n]}function ou(n,e,t,r){return n={tag:n,create:e,destroy:t,deps:r,next:null},e=ut.updateQueue,e===null?(e={lastEffect:null,stores:null},ut.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(r=t.next,t.next=n,n.next=r,e.lastEffect=n)),n}function kA(){return zn().memoizedState}function yd(n,e,t,r){var i=br();ut.flags|=n,i.memoizedState=ou(1|e,t,void 0,r===void 0?null:r)}function kh(n,e,t,r){var i=zn();r=r===void 0?null:r;var s=void 0;if(bt!==null){var a=bt.memoizedState;if(s=a.destroy,r!==null&&bv(r,a.deps)){i.memoizedState=ou(e,t,s,r);return}}ut.flags|=n,i.memoizedState=ou(1|e,t,s,r)}function mT(n,e){return yd(8390656,8,n,e)}function Rv(n,e){return kh(2048,8,n,e)}function DA(n,e){return kh(4,2,n,e)}function PA(n,e){return kh(4,4,n,e)}function OA(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function MA(n,e,t){return t=t!=null?t.concat([n]):null,kh(4,4,OA.bind(null,e,n),t)}function Av(){}function FA(n,e){var t=zn();e=e===void 0?null:e;var r=t.memoizedState;return r!==null&&e!==null&&bv(e,r[1])?r[0]:(t.memoizedState=[n,e],n)}function NA(n,e){var t=zn();e=e===void 0?null:e;var r=t.memoizedState;return r!==null&&e!==null&&bv(e,r[1])?r[0]:(n=n(),t.memoizedState=[n,e],n)}function UA(n,e,t){return Ys&21?(Sr(t,e)||(t=HR(),ut.lanes|=t,Xs|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,dn=!0),n.memoizedState=t)}function ZG(n,e){var t=$e;$e=t!==0&&4>t?t:4,n(!0);var r=Yp.transition;Yp.transition={};try{n(!1),e()}finally{$e=t,Yp.transition=r}}function BA(){return zn().memoizedState}function ej(n,e,t){var r=qi(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},$A(n))GA(e,t);else if(t=xA(n,e,t,r),t!==null){var i=tn();mr(t,n,r,i),jA(t,e,r)}}function tj(n,e,t){var r=qi(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if($A(n))GA(e,i);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,t);if(i.hasEagerState=!0,i.eagerState=o,Sr(o,a)){var l=e.interleaved;l===null?(i.next=i,Sv(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=xA(n,e,i,r),t!==null&&(i=tn(),mr(t,n,r,i),jA(t,e,r))}}function $A(n){var e=n.alternate;return n===ut||e!==null&&e===ut}function GA(n,e){El=gf=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function jA(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,sv(n,t)}}var yf={readContext:Wn,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},nj={readContext:Wn,useCallback:function(n,e){return br().memoizedState=[n,e===void 0?null:e],n},useContext:Wn,useEffect:mT,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,yd(4194308,4,OA.bind(null,e,n),t)},useLayoutEffect:function(n,e){return yd(4194308,4,n,e)},useInsertionEffect:function(n,e){return yd(4,2,n,e)},useMemo:function(n,e){var t=br();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=br();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=ej.bind(null,ut,n),[r.memoizedState,n]},useRef:function(n){var e=br();return n={current:n},e.memoizedState=n},useState:pT,useDebugValue:Av,useDeferredValue:function(n){return br().memoizedState=n},useTransition:function(){var n=pT(!1),e=n[0];return n=ZG.bind(null,n[1]),br().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=ut,i=br();if(it){if(t===void 0)throw Error(q(407));t=t()}else{if(t=e(),kt===null)throw Error(q(349));Ys&30||wA(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,mT(AA.bind(null,r,s,n),[n]),r.flags|=2048,ou(9,RA.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=br(),e=kt.identifierPrefix;if(it){var t=ni,r=ti;t=(r&~(1<<32-pr(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=su++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=JG++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},rj={readContext:Wn,useCallback:FA,useContext:Wn,useEffect:Rv,useImperativeHandle:MA,useInsertionEffect:DA,useLayoutEffect:PA,useMemo:NA,useReducer:Xp,useRef:kA,useState:function(){return Xp(au)},useDebugValue:Av,useDeferredValue:function(n){var e=zn();return UA(e,bt.memoizedState,n)},useTransition:function(){var n=Xp(au)[0],e=zn().memoizedState;return[n,e]},useMutableSource:bA,useSyncExternalStore:IA,useId:BA,unstable_isNewReconciler:!1},ij={readContext:Wn,useCallback:FA,useContext:Wn,useEffect:Rv,useImperativeHandle:MA,useInsertionEffect:DA,useLayoutEffect:PA,useMemo:NA,useReducer:Qp,useRef
vendor: 4,291 bytes, lines 72-74
72:kA,useState:function(){return Qp(au)},useDebugValue:Av,useDeferredValue:function(n){var e=zn();return bt===null?e.memoizedState=n:UA(e,bt.memoizedState,n)},useTransition:function(){var n=Qp(au)[0],e=zn().memoizedState;return[n,e]},useMutableSource:bA,useSyncExternalStore:IA,useId:BA,unstable_isNewReconciler:!1};function sr(n,e){if(n&&n.defaultProps){e=ct({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function e0(n,e,t,r){e=n.memoizedState,t=t(r,e),t=t==null?e:ct({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var Dh={isMounted:function(n){return(n=n._reactInternals)?ra(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var r=tn(),i=qi(n),s=ai(r,i);s.payload=e,t!=null&&(s.callback=t),e=zi(n,s,i),e!==null&&(mr(e,n,i,r),md(e,n,i))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var r=tn(),i=qi(n),s=ai(r,i);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=zi(n,s,i),e!==null&&(mr(e,n,i,r),md(e,n,i))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=tn(),r=qi(n),i=ai(t,r);i.tag=2,e!=null&&(i.callback=e),e=zi(n,i,r),e!==null&&(mr(e,n,r,t),md(e,n,r))}};function gT(n,e,t,r,i,s,a){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(r,s,a):e.prototype&&e.prototype.isPureReactComponent?!Zl(t,r)||!Zl(i,s):!0}function HA(n,e,t){var r=!1,i=rs,s=e.contextType;return typeof s=="object"&&s!==null?s=Wn(s):(i=hn(e)?Ks:qt.current,r=e.contextTypes,s=(r=r!=null)?ao(n,i):rs),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Dh,n.stateNode=e,e._reactInternals=n,r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=i,n.__reactInternalMemoizedMaskedChildContext=s),e}function yT(n,e,t,r){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,r),e.state!==n&&Dh.enqueueReplaceState(e,e.state,null)}function t0(n,e,t,r){var i=n.stateNode;i.props=t,i.state=n.memoizedState,i.refs={},Ev(n);var s=e.contextType;typeof s=="object"&&s!==null?i.context=Wn(s):(s=hn(e)?Ks:qt.current,i.context=ao(n,s)),i.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(e0(n,e,s,t),i.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&Dh.enqueueReplaceState(i,i.state,null),pf(n,t,i,r),i.state=n.memoizedState),typeof i.componentDidMount=="function"&&(n.flags|=4194308)}function co(n,e){try{var t="",r=e;do t+=D5(r),r=r.return;while(r);var i=t}catch(s){i=` 73Error generating stack: `+s.message+` 74`+s.stack}return{value:n,source:e,stack:i,digest:null}}function Jp(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function n0(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var sj=typeof WeakMap=="function"?WeakMap:Map;function VA(n,e,t){t=ai(-1,t),t.tag=3,t.payload={element:null};var r=e.value;return t.callback=function(){Sf||(Sf=!0,f0=r),n0(n,e)},t}function WA(n,e,t){t=ai(-1,t),t.tag=3;var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;t.payload=function(){return r(i)},t.callback=function(){n0(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){n0(n,e),typeof r!="function"&&(Ki===null?Ki=new Set([this]):Ki.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),t}function vT(n,e,t){var r=n.pingCache;if(r===null){r=n.pingCache=new sj;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(t)||(i.add(t),n=Sj.bind(null,n,e,t),e.then(n,n))}function ST(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function ET(n,e,t,r,i){return n.mode&1?(n.flags|=65536,n.lanes=i,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=ai(-1,1),e.tag=2,zi(t,e,1)
vendor: 10,189 bytes, line 74
74)),t.lanes|=1),n)}var aj=vi.ReactCurrentOwner,dn=!1;function Xt(n,e,t,r){e.child=n===null?EA(e,null,t,r):lo(e,n.child,t,r)}function xT(n,e,t,r,i){t=t.render;var s=e.ref;return Ha(e,i),r=Iv(n,e,t,r,s,i),t=wv(),n!==null&&!dn?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,pi(n,e,i)):(it&&t&&hv(e),e.flags|=1,Xt(n,e,r,i),e.child)}function TT(n,e,t,r,i){if(n===null){var s=t.type;return typeof s=="function"&&!Fv(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,zA(n,e,s,r,i)):(n=xd(t.type,null,r,e,e.mode,i),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&i)){var a=s.memoizedProps;if(t=t.compare,t=t!==null?t:Zl,t(a,r)&&n.ref===e.ref)return pi(n,e,i)}return e.flags|=1,n=Yi(s,r),n.ref=e.ref,n.return=e,e.child=n}function zA(n,e,t,r,i){if(n!==null){var s=n.memoizedProps;if(Zl(s,r)&&n.ref===e.ref)if(dn=!1,e.pendingProps=r=s,(n.lanes&i)!==0)n.flags&131072&&(dn=!0);else return e.lanes=n.lanes,pi(n,e,i)}return r0(n,e,t,r,i)}function KA(n,e,t){var r=e.pendingProps,i=r.children,s=n!==null?n.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(Ma,Sn),Sn|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,qe(Ma,Sn),Sn|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,qe(Ma,Sn),Sn|=r}else s!==null?(r=s.baseLanes|t,e.memoizedState=null):r=t,qe(Ma,Sn),Sn|=r;return Xt(n,e,i,t),e.child}function qA(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function r0(n,e,t,r,i){var s=hn(t)?Ks:qt.current;return s=ao(e,s),Ha(e,i),t=Iv(n,e,t,r,s,i),r=wv(),n!==null&&!dn?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,pi(n,e,i)):(it&&r&&hv(e),e.flags|=1,Xt(n,e,t,i),e.child)}function _T(n,e,t,r,i){if(hn(t)){var s=!0;uf(e)}else s=!1;if(Ha(e,i),e.stateNode===null)vd(n,e),HA(e,t,r),t0(e,t,r,i),r=!0;else if(n===null){var a=e.stateNode,o=e.memoizedProps;a.props=o;var l=a.context,u=t.contextType;typeof u=="object"&&u!==null?u=Wn(u):(u=hn(t)?Ks:qt.current,u=ao(e,u));var c=t.getDerivedStateFromProps,d=typeof c=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||l!==u)&&yT(e,a,r,u),ki=!1;var f=e.memoizedState;a.state=f,pf(e,r,a,i),l=e.memoizedState,o!==r||f!==l||fn.current||ki?(typeof c=="function"&&(e0(e,t,c,r),l=e.memoizedState),(o=ki||gT(e,t,o,r,f,l,u))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),a.props=r,a.state=l,a.context=u,r=o):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{a=e.stateNode,TA(n,e),o=e.memoizedProps,u=e.type===e.elementType?o:sr(e.type,o),a.props=u,d=e.pendingProps,f=a.context,l=t.contextType,typeof l=="object"&&l!==null?l=Wn(l):(l=hn(t)?Ks:qt.current,l=ao(e,l));var h=t.getDerivedStateFromProps;(c=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==d||f!==l)&&yT(e,a,r,l),ki=!1,f=e.memoizedState,a.state=f,pf(e,r,a,i);var p=e.memoizedState;o!==d||f!==p||fn.current||ki?(typeof h=="function"&&(e0(e,t,h,r),p=e.memoizedState),(u=ki||gT(e,t,u,r,f,p,l)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,p,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,p,l)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),a.props=r,a.state=p,a.context=l,r=u):(typeof a.componentDidUpdate!="function"||o===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),r=!1)}return i0(n,e,t,r,s,i)}function i0(n,e,t,r,i,s){qA(n,e);var a=(e.flags&128)!==0;if(!r&&!a)return i&&lT(e,t,!1),pi(n,e,s);r=e.stateNode,aj.current=e;var o=a&&typeof t.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,n!==null&&a?(e.child=lo(e,n.child,null,s),e.child=lo(e,null,o,s)):Xt(n,e,o,s),e.memoizedState=r.state,i&&lT(e,t,!0),e.child}function YA(n){var e=n.stateNode;e.pendingContext?oT(n,e.pendingContext,e.pendingContext!==e.context):e.context&&oT(n,e.context,!1),xv(n,e.containerInfo)}function bT(n,e,t,r,i){return oo(),mv(i),e.flags|=256,Xt(n,e,t,r),e.child}var s0={dehydrated:null,treeContext:null,retryLane:0};function a0(n){return{baseLanes:n,cachePool:null,transitions:null}}function XA(n,e,t){var r=e.pendingProps,i=st.current,s=!1,a=(e.flags&128)!==0,o;if((o=a)||(o=n!==null&&n.memoizedState===null?!1:(i&2)!==0),o?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(i|=1),qe(st,i&1),n===null)return Jg(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=r.children,n=r.fallback,s?(r=e.mode,s=e.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=Mh(a,r,0,null),n=Us(n,r,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=a0(t),e.memoizedState=s0,n):Lv(e,a));if(i=n.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return oj(n,e,a,r,o,i,t);if(s){s=r.fallback,a=e.mode,i=n.child,o=i.sibling;var l={mode:"hidden",children:r.children};return!(a&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=Yi(i,l),r.subtreeFlags=i.subtreeFlags&14680064),o!==null?s=Yi(o,s):(s=Us(s,a,t,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,a=n.child.memoizedState,a=a===null?a0(t):{baseLanes:a.baseLanes|t,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=n.childLanes&~t,e.memoizedState=s0,r}return s=n.child,n=s.sibling,r=Yi(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=t),r.return=e,r.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=r,e.memoizedState=null,r}function Lv(n,e){return e=Mh({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function xc(n,e,t,r){return r!==null&&mv(r),lo(e,n.child,null,t),n=Lv(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function oj(n,e,t,r,i,s,a){if(t)return e.flags&256?(e.flags&=-257,r=Jp(Error(q(422))),xc(n,e,a,r)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=Mh({mode:"visible",children:r.children},i,0,null),s=Us(s,i,a,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&lo(e,n.child,null,a),e.child.memoizedState=a0(a),e.memoizedState=s0,s);if(!(e.mode&1))return xc(n,e,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var o=r.dgst;return r=o,s=Error(q(419)),r=Jp(s,r,void 0),xc(n,e,a,r)}if(o=(a&n.childLanes)!==0,dn||o){if(r=kt,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,hi(n,i),mr(r,n,i,-1))}return Mv(),r=Jp(Error(q(421))),xc(n,e,a,r)}return i.data==="$?"?(e.flags|=128,e.child=n.child,e=Ej.bind(null,n),i._reactRetry=e,null):(n=s.treeContext,Tn=Wi(i.nextSibling),bn=e,it=!0,lr=null,n!==null&&(Fn[Nn++]=ti,Fn[Nn++]=ni,Fn[Nn++]=qs,ti=n.id,ni=n.overflow,qs=e),e=Lv(e,r.children),e.flags|=4096,e)}function IT(n,e,t){n.lanes|=e;var r=n.alternate;r!==null&&(r.lanes|=e),Zg(n.return,e,t)}function Zp(n,e,t,r,i){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=t,s.tailMode=i)}function QA(n,e,t){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Xt(n,e,r.children,t),r=st.current,r&2)r=r&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&IT(n,t,e);else if(n.tag===19)IT(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}r&=1}if(qe(st,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(t=e.child,i=null;t!==null;)n=t.alternate,n!==null&&mf(n)===null&&(i=t),t=t.sibling;t=i,t===null?(i=e.child,e.child=null):(i=t.sibling,t.sibling=null),Zp(e,!1,i,t,s);break;case"backwards":for(t=null,i=e.child,e.child=null;i!==null;){if(n=i.alternate,n!==null&&mf(n)===null){e.child=i;break}n=i.sibling,i.sibling=t,t=i,i=n}Zp(e,!0,t,null,s);break;case"together":Zp(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function vd(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function pi(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),Xs|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(q(153));if(e.child!==null){for(n=e.child,t=Yi(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Yi(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function lj(n,e,t){switch(e.tag){case 3:YA(e),oo();break;case 5:_A(e);break;case 1:hn(e.type)&&uf(e);break;case 4:xv(e,e.stateNode.containerInfo);break;
vendor: 4,400 bytes, line 74
74case 10:var r=e.type._context,i=e.memoizedProps.value;qe(ff,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(qe(st,st.current&1),e.flags|=128,null):t&e.child.childLanes?XA(n,e,t):(qe(st,st.current&1),n=pi(n,e,t),n!==null?n.sibling:null);qe(st,st.current&1);break;case 19:if(r=(t&e.childLanes)!==0,n.flags&128){if(r)return QA(n,e,t);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),qe(st,st.current),r)break;return null;case 22:case 23:return e.lanes=0,KA(n,e,t)}return pi(n,e,t)}var JA,o0,ZA,eL;JA=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};o0=function(){};ZA=function(n,e,t,r){var i=n.memoizedProps;if(i!==r){n=e.stateNode,Ds(Ur.current);var s=null;switch(t){case"input":i=Lg(n,i),r=Lg(n,r),s=[];break;case"select":i=ct({},i,{value:void 0}),r=ct({},r,{value:void 0}),s=[];break;case"textarea":i=Dg(n,i),r=Dg(n,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(n.onclick=of)}Og(t,r);var a;t=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var o=i[u];for(a in o)o.hasOwnProperty(a)&&(t||(t={}),t[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(zl.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(o=i?.[u],r.hasOwnProperty(u)&&l!==o&&(l!=null||o!=null))if(u==="style")if(o){for(a in o)!o.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(t||(t={}),t[a]="");for(a in l)l.hasOwnProperty(a)&&o[a]!==l[a]&&(t||(t={}),t[a]=l[a])}else t||(s||(s=[]),s.push(u,t)),t=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,o=o?o.__html:void 0,l!=null&&o!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(zl.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Je("scroll",n),s||o===l||(s=[])):(s=s||[]).push(u,l))}t&&(s=s||[]).push("style",t);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};eL=function(n,e,t,r){t!==r&&(e.flags|=4)};function Go(n,e){if(!it)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:r.sibling=null}}function Vt(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,r=0;if(e)for(var i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=n,i=i.sibling;else for(i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=n,i=i.sibling;return n.subtreeFlags|=r,n.childLanes=t,e}function uj(n,e,t){var r=e.pendingProps;switch(pv(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(e),null;case 1:return hn(e.type)&&lf(),Vt(e),null;case 3:return r=e.stateNode,uo(),et(fn),et(qt),_v(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(Sc(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,lr!==null&&(m0(lr),lr=null))),o0(n,e),Vt(e),null;case 5:Tv(e);var i=Ds(iu.current);if(t=e.type,n!==null&&e.stateNode!=null)ZA(n,e,t,r,i),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(q(166));return Vt(e),null}if(n=Ds(Ur.current),Sc(e)){r=e.stateNode,t=e.type;var s=e.memoizedProps;switch(r[Cr]=e,r[nu]=s,n=(e.mode&1)!==0,t){case"dialog":Je("cancel",r),Je("close",r);break;case"iframe":case"object":case"embed":Je("load",r);break;case"video":case"audio":for(i=0;i<il.length;i++)Je(il[i],r);break;case"source":Je("error",r);break;case"img":case"image":case"link":Je("error",r),Je("load",r);break;case"details":Je("toggle",r);break;case"input":Ox(r,s),Je("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Je("invalid",r);break;case"textarea":Fx(r,s),Je("invalid",r)}Og(t,s),i=null;for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];
vendor: 32,553 bytes, line 74
74a==="children"?typeof o=="string"?r.textContent!==o&&(s.suppressHydrationWarning!==!0&&vc(r.textContent,o,n),i=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(s.suppressHydrationWarning!==!0&&vc(r.textContent,o,n),i=["children",""+o]):zl.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&Je("scroll",r)}switch(t){case"input":cc(r),Mx(r,s,!0);break;case"textarea":cc(r),Nx(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=of)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=AR(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=a.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=a.createElement(t,{is:r.is}):(n=a.createElement(t),t==="select"&&(a=n,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):n=a.createElementNS(n,t),n[Cr]=e,n[nu]=r,JA(n,e,!1,!1),e.stateNode=n;e:{switch(a=Mg(t,r),t){case"dialog":Je("cancel",n),Je("close",n),i=r;break;case"iframe":case"object":case"embed":Je("load",n),i=r;break;case"video":case"audio":for(i=0;i<il.length;i++)Je(il[i],n);i=r;break;case"source":Je("error",n),i=r;break;case"img":case"image":case"link":Je("error",n),Je("load",n),i=r;break;case"details":Je("toggle",n),i=r;break;case"input":Ox(n,r),i=Lg(n,r),Je("invalid",n);break;case"option":i=r;break;case"select":n._wrapperState={wasMultiple:!!r.multiple},i=ct({},r,{value:void 0}),Je("invalid",n);break;case"textarea":Fx(n,r),i=Dg(n,r),Je("invalid",n);break;default:i=r}Og(t,i),o=i;for(s in o)if(o.hasOwnProperty(s)){var l=o[s];s==="style"?kR(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&LR(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&Kl(n,l):typeof l=="number"&&Kl(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(zl.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Je("scroll",n):l!=null&&Zy(n,s,l,a))}switch(t){case"input":cc(n),Mx(n,r,!1);break;case"textarea":cc(n),Nx(n);break;case"option":r.value!=null&&n.setAttribute("value",""+ns(r.value));break;case"select":n.multiple=!!r.multiple,s=r.value,s!=null?Ba(n,!!r.multiple,s,!1):r.defaultValue!=null&&Ba(n,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(n.onclick=of)}switch(t){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Vt(e),null;case 6:if(n&&e.stateNode!=null)eL(n,e,n.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(q(166));if(t=Ds(iu.current),Ds(Ur.current),Sc(e)){if(r=e.stateNode,t=e.memoizedProps,r[Cr]=e,(s=r.nodeValue!==t)&&(n=bn,n!==null))switch(n.tag){case 3:vc(r.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&vc(r.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else r=(t.nodeType===9?t:t.ownerDocument).createTextNode(r),r[Cr]=e,e.stateNode=r}return Vt(e),null;case 13:if(et(st),r=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(it&&Tn!==null&&e.mode&1&&!(e.flags&128))vA(),oo(),e.flags|=98560,s=!1;else if(s=Sc(e),r!==null&&r.dehydrated!==null){if(n===null){if(!s)throw Error(q(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(q(317));s[Cr]=e}else oo(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Vt(e),s=!1}else lr!==null&&(m0(lr),lr=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(r=r!==null,r!==(n!==null&&n.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(n===null||st.current&1?It===0&&(It=3):Mv())),e.updateQueue!==null&&(e.flags|=4),Vt(e),null);case 4:return uo(),o0(n,e),n===null&&eu(e.stateNode.containerInfo),Vt(e),null;case 10:return vv(e.type._context),Vt(e),null;case 17:return hn(e.type)&&lf(),Vt(e),null;case 19:if(et(st),s=e.memoizedState,s===null)return Vt(e),null;if(r=(e.flags&128)!==0,a=s.rendering,a===null)if(r)Go(s,!1);else{if(It!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(a=mf(n),a!==null){for(e.flags|=128,Go(s,!1),r=a.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=t,t=e.child;t!==null;)s=t,n=r,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,n=a.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return qe(st,st.current&1|2),e.child}n=n.sibling}s.tail!==null&&mt()>fo&&(e.flags|=128,r=!0,Go(s,!1),e.lanes=4194304)}else{if(!r)if(n=mf(a),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Go(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!it)return Vt(e),null}else 2*mt()-s.renderingStartTime>fo&&t!==1073741824&&(e.flags|=128,r=!0,Go(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(t=s.last,t!==null?t.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=mt(),e.sibling=null,t=st.current,qe(st,r?t&1|2:t&1),e):(Vt(e),null);case 22:case 23:return Ov(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Sn&1073741824&&(Vt(e),e.subtreeFlags&6&&(e.flags|=8192)):Vt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function cj(n,e){switch(pv(e),e.tag){case 1:return hn(e.type)&&lf(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return uo(),et(fn),et(qt),_v(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return Tv(e),null;case 13:if(et(st),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(q(340));oo()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return et(st),null;case 4:return uo(),null;case 10:return vv(e.type._context),null;case 22:case 23:return Ov(),null;case 24:return null;default:return null}}var Tc=!1,zt=!1,dj=typeof WeakSet=="function"?WeakSet:Set,ne=null;function Oa(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){ft(n,e,r)}else t.current=null}function l0(n,e,t){try{t()}catch(r){ft(n,e,r)}}var wT=!1;function fj(n,e){if(Wg=rf,n=sA(),fv(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var a=0,o=-1,l=-1,u=0,c=0,d=n,f=null;t:for(;;){for(var h;d!==t||i!==0&&d.nodeType!==3||(o=a+i),d!==s||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===n)break t;if(f===t&&++u===i&&(o=a),f===s&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}t=o===-1||l===-1?null:{start:o,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(zg={focusedElem:n,selectionRange:t},rf=!1,ne=e;ne!==null;)if(e=ne,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ne=n;else for(;ne!==null;){e=ne;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,g=p.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:sr(e.type,m),g);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(x){ft(e,e.return,x)}if(n=e.sibling,n!==null){n.return=e.return,ne=n;break}ne=e.return}return p=wT,wT=!1,p}function xl(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&l0(e,t,s)}i=i.next}while(i!==r)}}function Ph(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function u0(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function tL(n){var e=n.alternate;e!==null&&(n.alternate=null,tL(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Cr],delete e[nu],delete e[Yg],delete e[qG],delete e[YG])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function nL(n){return n.tag===5||n.tag===3||n.tag===4}function RT(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||nL(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function c0(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=of));else if(r!==4&&(n=n.child,n!==null))for(c0(n,e,t),n=n.sibling;n!==null;)c0(n,e,t),n=n.sibling}function d0(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(d0(n,e,t),n=n.sibling;n!==null;)d0(n,e,t),n=n.sibling}var Mt=null,or=!1;function Ti(n,e,t){for(t=t.child;t!==null;)rL(n,e,t),t=t.sibling}function rL(n,e,t){if(Nr&&typeof Nr.onCommitFiberUnmount=="function")try{Nr.onCommitFiberUnmount(Ih,t)}catch{}switch(t.tag){case 5:zt||Oa(t,e);case 6:var r=Mt,i=or;Mt=null,Ti(n,e,t),Mt=r,or=i,Mt!==null&&(or?(n=Mt,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Mt.removeChild(t.stateNode));break;case 18:Mt!==null&&(or?(n=Mt,t=t.stateNode,n.nodeType===8?zp(n.parentNode,t):n.nodeType===1&&zp(n,t),Ql(n)):zp(Mt,t.stateNode));break;case 4:r=Mt,i=or,Mt=t.stateNode.containerInfo,or=!0,Ti(n,e,t),Mt=r,or=i;break;case 0:case 11:case 14:case 15:if(!zt&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&l0(t,e,a),i=i.next}while(i!==r)}Ti(n,e,t);break;case 1:if(!zt&&(Oa(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(o){ft(t,e,o)}Ti(n,e,t);break;case 21:Ti(n,e,t);break;case 22:t.mode&1?(zt=(r=zt)||t.memoizedState!==null,Ti(n,e,t),zt=r):Ti(n,e,t);break;default:Ti(n,e,t)}}function AT(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new dj),e.forEach(function(r){var i=xj.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Qn(n,e){var t=e.deletions;if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];try{var s=n,a=e,o=a;e:for(;o!==null;){switch(o.tag){case 5:Mt=o.stateNode,or=!1;break e;case 3:Mt=o.stateNode.containerInfo,or=!0;break e;case 4:Mt=o.stateNode.containerInfo,or=!0;break e}o=o.return}if(Mt===null)throw Error(q(160));rL(s,a,i),Mt=null,or=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(u){ft(i,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)iL(e,n),e=e.sibling}function iL(n,e){var t=n.alternate,r=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Qn(e,n),xr(n),r&4){try{xl(3,n,n.return),Ph(3,n)}catch(m){ft(n,n.return,m)}try{xl(5,n,n.return)}catch(m){ft(n,n.return,m)}}break;case 1:Qn(e,n),xr(n),r&512&&t!==null&&Oa(t,t.return);break;case 5:if(Qn(e,n),xr(n),r&512&&t!==null&&Oa(t,t.return),n.flags&32){var i=n.stateNode;try{Kl(i,"")}catch(m){ft(n,n.return,m)}}if(r&4&&(i=n.stateNode,i!=null)){var s=n.memoizedProps,a=t!==null?t.memoizedProps:s,o=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{o==="input"&&s.type==="radio"&&s.name!=null&&wR(i,s),Mg(o,a);var u=Mg(o,s);for(a=0;a<l.length;a+=2){var c=l[a],d=l[a+1];c==="style"?kR(i,d):c==="dangerouslySetInnerHTML"?LR(i,d):c==="children"?Kl(i,d):Zy(i,c,d,u)}switch(o){case"input":Cg(i,s);break;case"textarea":RR(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Ba(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?Ba(i,!!s.multiple,s.defaultValue,!0):Ba(i,!!s.multiple,s.multiple?[]:"",!1))}i[nu]=s}catch(m){ft(n,n.return,m)}}break;case 6:if(Qn(e,n),xr(n),r&4){if(n.stateNode===null)throw Error(q(162));i=n.stateNode,s=n.memoizedProps;try{i.nodeValue=s}catch(m){ft(n,n.return,m)}}break;case 3:if(Qn(e,n),xr(n),r&4&&t!==null&&t.memoizedState.isDehydrated)try{Ql(e.containerInfo)}catch(m){ft(n,n.return,m)}break;case 4:Qn(e,n),xr(n);break;case 13:Qn(e,n),xr(n),i=n.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Dv=mt())),r&4&&AT(n);break;case 22:if(c=t!==null&&t.memoizedState!==null,n.mode&1?(zt=(u=zt)||c,Qn(e,n),zt=u):Qn(e,n),xr(n),r&8192){if(u=n.memoizedState!==null,(n.stateNode.isHidden=u)&&!c&&n.mode&1)for(ne=n,c=n.child;c!==null;){for(d=ne=c;ne!==null;){switch(f=ne,h=f.child,f.tag){case 0:case 11:case 14:case 15:xl(4,f,f.return);break;case 1:Oa(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){r=f,t=f.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(m){ft(r,t,m)}}break;case 5:Oa(f,f.return);break;case 22:if(f.memoizedState!==null){CT(d);continue}}h!==null?(h.return=f,ne=h):CT(d)}c=c.sibling}e:for(c=null,d=n;;){if(d.tag===5){if(c===null){c=d;try{i=d.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(o=d.stateNode,l=d.memoizedProps.style,a=l!=null&&l.hasOwnProperty("display")?l.display:null,o.style.display=CR("display",a))}catch(m){ft(n,n.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(m){ft(n,n.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===n)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===n)break e;for(;d.sibling===null;){if(d.return===null||d.return===n)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Qn(e,n),xr(n),r&4&&AT(n);break;case 21:break;default:Qn(e,n),xr(n)}}function xr(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(nL(t)){var r=t;break e}t=t.return}throw Error(q(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Kl(i,""),r.flags&=-33);var s=RT(n);d0(n,s,i);break;case 3:case 4:var a=r.stateNode.containerInfo,o=RT(n);c0(n,o,a);break;default:throw Error(q(161))}}catch(l){ft(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function hj(n,e,t){ne=n,sL(n)}function sL(n,e,t){for(var r=(n.mode&1)!==0;ne!==null;){var i=ne,s=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||Tc;if(!a){var o=i.alternate,l=o!==null&&o.memoizedState!==null||zt;o=Tc;var u=zt;if(Tc=a,(zt=l)&&!u)for(ne=i;ne!==null;)a=ne,l=a.child,a.tag===22&&a.memoizedState!==null?kT(i):l!==null?(l.return=a,ne=l):kT(i);for(;s!==null;)ne=s,sL(s),s=s.sibling;ne=i,Tc=o,zt=u}LT(n)}else i.subtreeFlags&8772&&s!==null?(s.return=i,ne=s):LT(n)}}function LT(n){for(;ne!==null;){var e=ne;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:zt||Ph(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!zt)if(t===null)r.componentDidMount();else{var i=e.elementType===e.type?t.memoizedProps:sr(e.type,t.memoizedProps);r.componentDidUpdate(i,t.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&hT(e,s,r);break;case 3:var a=e.updateQueue;if(a!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}hT(e,a,t)}break;case 5:var o=e.stateNode;if(t===null&&e.flags&4){t=o;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&Ql(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(q(163))}zt||e.flags&512&&u0(e)}catch(f){ft(e,e.return,f)}}if(e===n){ne=null;break}if(t=e.sibling,t!==null){t.return=e.return,ne=t;break}ne=e.return}}function CT(n){for(;ne!==null;){var e=ne;if(e===n){ne=null;break}var t=e.sibling;if(t!==null){t.return=e.return,ne=t;break}ne=e.return}}function kT(n){for(;ne!==null;){var e=ne;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{Ph(4,e)}catch(l){ft(e,t,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){ft(e,i,l)}}var s=e.return;try{u0(e)}catch(l){ft(e,s,l)}break;case 5:var a=e.return;try{u0(e)}catch(l){ft(e,a,l)}}}catch(l){ft(e,e.return,l)}if(e===n){ne=null;break}var o=e.sibling;if(o!==null){o.return=e.return,ne=o;break}ne=e.return}}var pj=Math.ceil,vf=vi.ReactCurrentDispatcher,Cv=vi.ReactCurrentOwner,Hn=vi.ReactCurrentBatchConfig,De=0,kt=null,xt=null,Bt=0,Sn=0,Ma=ps(0),It=0,lu=null,Xs=0,Oh=0,kv=0,Tl=null,un=null,Dv=0,fo=1/0,Qr=null,Sf=!1,f0=null,Ki=null,_c=!1,Ui=null,Ef=0,_l=0,h0=null,Sd=-1,Ed=0;function tn(){return De&6?mt():Sd!==-1?Sd:Sd=mt()}function qi(n){return n.mode&1?De&2&&Bt!==0?Bt&-Bt:QG.transition!==null?(Ed===0&&(Ed=HR()),Ed):(n=$e,n!==0||(n=window.event,n=n===void 0?16:XR(n.type)),n):1}function mr(n,e,t,r){if(50<_l)throw _l=0,h0=null,Error(q(185));Vu(n,t,r),(!(De&2)||n!==kt)&&(n===kt&&(!(De&2)&&(Oh|=t),It===4&&Fi(n,Bt)),pn(n,r),t===1&&De===0&&!(e.mode&1)&&(fo=mt()+500,Ch&&ms()))}function pn(n,e){var t=n.callbackNode;Q5(n,e);var r=nf(n,n===kt?Bt:0);if(r===0)t!==null&&$x(t),n.callbackNode=null,n.callbackPriority=0;else if(e=r&-r,n.callbackPriority!==e){if(t!=null&&$x(t),e===1)n.tag===0?XG(DT.bind(null,n)):mA(DT.bind(null,n)),zG(function(){!(De&6)&&ms()}),t=null;else{switch(VR(r)){case 1:t=iv;break;case 4:t=GR;break;case 16:t=tf;break;case 536870912:t=jR;break;default:t=tf}t=hL(t,aL.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function aL(n,e){if(Sd=-1,Ed=0,De&6)throw Error(q(327));var t=n.callbackNode;if(Va()&&n.callbackNode!==t)return null;var r=nf(n,n===kt?Bt:0);if(r===0)return null;if(r&30||r&n.expiredLanes||e)e=xf(n,r);else{e=r;var i=De;De|=2;var s=lL();(kt!==n||Bt!==e)&&(Qr=null,fo=mt()+500,Ns(n,e));do try{yj();break}catch(o){oL(n,o)}while(!0);yv(),vf.current=s,De=i,xt!==null?e=0:(kt=null,Bt=0,e=It)}if(e!==0){if(e===2&&(i=$g(n),i!==0&&(r=i,e=p0(n,i))),e===1)throw t=lu,Ns(n,0),Fi(n,r),pn(n,mt()),t;if(e===6)Fi(n,r);else{if(i=n.current.alternate,!(r&30)&&!mj(i)&&(e=xf(n,r),e===2&&(s=$g(n),s!==0&&(r=s,e=p0(n,s))),e===1))throw t=lu,Ns(n,0),Fi(n,r),pn(n,mt()),t;switch(n.finishedWork=i,n.finishedLanes=r,e){case 0:case 1:throw Error(q(345));case 2:_s(n,un,Qr);break;case 3:if(Fi(n,r),(r&130023424)===r&&(e=Dv+500-mt(),10<e)){if(nf(n,0)!==0)break;if(i=n.suspendedLanes,(i&r)!==r){tn(),n.pingedLanes|=n.suspendedLanes&i;break}n.timeoutHandle=qg(_s.bind(null,n,un,Qr),e);break}_s(n,un,Qr);break;case 4:if(Fi(n,r),(r&4194240)===r)break;for(e=n.eventTimes,i=-1;0<r;){var a=31-pr(r);s=1<<a,a=e[a],a>i&&(i=a),r&=~s}if(r=i,r=mt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*pj(r/1960))-r,10<r){n.timeoutHandle=qg(_s.bind(null,n,un,Qr),r);break}_s(n,un,Qr);break;case 5:_s(n,un,Qr);break;default:throw Error(q(329))}}}return pn(n,mt()),n.callbackNode===t?aL.bind(null,n):null}function p0(n,e){var t=Tl;return n.current.memoizedState.isDehydrated&&(Ns(n,e).flags|=256),n=xf(n,e),n!==2&&(e=un,un=t,e!==null&&m0(e)),n}function m0(n){un===null?un=n:un.push.apply(un,n)}function mj(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var r=0;r<t.length;r++){var i=t[r],s=i.getSnapshot;i=i.value;try{if(!Sr(s(),i))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Fi(n,e){for(e&=~kv,e&=~Oh,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-pr(e),r=1<<t;n[t]=-1,e&=~r}}function DT(n){if(De&6)throw Error(q(327));Va();var e=nf(n,0);if(!(e&1))return pn(n,mt()),null;var t=xf(n,e);if(n.tag!==0&&t===2){var r=$g(n);r!==0&&(e=r,t=p0(n,r))}if(t===1)throw t=lu,Ns(n,0),Fi(n,e),pn(n,mt()),t;if(t===6)throw Error(q(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,_s(n,un,Qr),pn(n,mt()),null}function Pv(n,e){var t=De;De|=1;try{return n(e)}finally{De=t,De===0&&(fo=mt()+500,Ch&&ms())}}function Qs(n){Ui!==null&&Ui.tag===0&&!(De&6)&&Va();var e=De;De|=1;var t=Hn.transition,r=$e;try{if(Hn.transition=null,$e=1,n)return n()}finally{$e=r,Hn.transition=t,De=e,!(De&6)&&ms()}}function Ov(){Sn=Ma.current,et(Ma)}function Ns(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,WG(t)),xt!==null)for(t=xt.return;t!==null;){var r=t;switch(pv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&lf();break;case 3:uo(),et(fn),et(qt),_v();break;case 5:Tv(r);break;case 4:uo();break;case 13:et(st);break;case 19:et(st);break;case 10:vv(r.type._context);break;case 22:case 23:Ov()}t=t.return}if(kt=n,xt=n=Yi(n.current,null),Bt=Sn=e,It=0,lu=null,kv=Oh=Xs=0,un=Tl=null,ks!==null){for(e=0;e<ks.length;e++)if(t=ks[e],r=t.interleaved,r!==null){t.interleaved=null;var i=r.next,s=t.pending;if(s!==null){var a=s.next;s.next=i,r.next=a}t.pending=r}ks=null}return n}function oL(n,e){do{var t=xt;try{if(yv(),gd.current=yf,gf){for(var r=ut.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}gf=!1}if(Ys=0,Ct=bt=ut=null,El=!1,su=0,Cv.current=null,t===null||t.return===null){It=1,lu=e,xt=null;break}e:{var s=n,a=t.return,o=t,l=e;if(e=Bt,o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,c=o,d=c.tag;if(!(c.mode&1)&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var h=ST(a);if(h!==null){h.flags&=-257,ET(h,a,o,s,e),h.mode&1&&vT(s,u,e),e=h,l=u;var p=e.updateQueue;if(p===null){var m=new Set;m.add(l),e.updateQueue=m}else p.add(l);break e}else{if(!(e&1)){vT(s,u,e),Mv();break e}l=Error(q(426))}}else if(it&&o.mode&1){var g=ST(a);if(g!==null){!(g.flags&65536)&&(g.flags|=256),ET(g,a,o,s,e),mv(co(l,o));break e}}s=l=co(l,o),It!==4&&(It=2),Tl===null?Tl=[s]:Tl.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var y=VA(s,l,e);fT(s,y);break e;case 1:o=l;var v=s.type,S=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Ki===null||!Ki.has(S)))){s.flags|=65536,e&=-e,s.lanes|=e;var x=WA(s,o,e);fT(s,x);break e}}s=s.return}while(s!==null)}cL(t)}catch(T){e=T,xt===t&&t!==null&&(xt=t=t.return);continue}break}while(!0)}function lL(){var n=vf.current;return vf.current=yf,n===null?yf:n}function Mv(){(It===0||It===3||It===2)&&(It=4),kt===null||!(Xs&268435455)&&!(Oh&268435455)||Fi(kt,Bt)}function xf(n,e){var t=De;De|=2;var r=lL();(kt!==n||Bt!==e)&&(Qr=null,Ns(n,e));do try{gj();break}catch(i){oL(n,i)}while(!0);if(yv(),De=t,vf.current=r,xt!==null)throw Error(q(261));return kt=null,Bt=0,It}function gj(){for(;xt!==null;)uL(xt)}function yj(){for(;xt!==null&&!j5();)uL(xt)}function uL(n){var e=fL(n.alternate,n,Sn);n.memoizedProps=n.pendingProps,e===null?cL(n):xt=e,Cv.current=null}function cL(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=cj(t,e),t!==null){t.flags&=32767,xt=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{It=6,xt=null;return}}else if(t=uj(t,e,Sn),t!==null){xt=t;return}if(e=e.sibling,e!==null){xt=e;return}xt=e=n}while(e!==null);It===0&&(It=5)}function _s(n,e,t){var r=$e,i=Hn.transition;try{Hn.transition=null,$e=1,vj(n,e,t,r)}finally{Hn.transition=i,$e=r}return null}function vj(n,e,t,r){do Va();while(Ui!==null);if(De&6)throw Error(q(327));t=n.finishedWork;var i=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(q(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(J5(n,s),n===kt&&(xt=kt=null,Bt=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||_c||(_c=!0,hL(tf,function(){return Va(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=Hn.transition,Hn.transition=null;var a=$e;$e=1;var o=De;De|=4,Cv.current=null,fj(n,t),iL(t,n),UG(zg),rf=!!Wg,zg=Wg=null,n.current=t,hj(t),H5(),De=o,$e=a,Hn.transition=s}else n.current=t;if(_c&&(_c=!1,Ui=n,Ef=i),s=n.pendingLanes,s===0&&(Ki=null),z5(t.stateNode),pn(n,mt()),e!==null)for(r=n.onRecoverableError,t=0;t<e.length;t++)i=e[t],r(i.value,{componentStack:i.stack,digest:i.digest});if(Sf)throw Sf=!1,n=f0,f0=null,n;return Ef&1&&n.tag!==0&&Va(),s=n.pendingLanes,s&1?n===h0?_l++:(_l=0,h0=n):_l=0,ms(),null}function Va(){if(Ui!==null){var n=VR(Ef),e=Hn.transition,t=$e;try{if(Hn.transition=null,$e=16>n?16:n,Ui===null)var r=!1;else{if(n=Ui,Ui=null,Ef=0,De&6)throw Error(q(331));var i=De;for(De|=4,ne=n.current;ne!==null;){var s=ne,a=s.child;if(ne.flags&16){var o=s.deletions;if(o!==null){for(var l=0;l<o.length;l++){var u=o[l];for(ne=u;ne!==null;){var c=ne;switch(c.tag){case 0:case 11:case 15:xl(8,c,s)}var d=c.child;if(d!==null)d.return=c,ne=d;else for(;ne!==null;){c=ne;var f=c.sibling,h=c.return;if(tL(c),c===u){ne=null;break}if(f!==null){f.return=h,ne=f;break}ne=h}}}var p=s.alternate;if(p!==null){var m=p.child;if(m!==null){p.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(m!==null)}}ne=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,ne=a;else e:for(;ne!==null;){if(s=ne,s.flags&2048)switch(s.tag){case 0:case 11:case 15:xl(9,s,s.return)}var y=s.sibling;if(y!==null){y.return=s.return,ne=y;break e}ne=s.return}}var v=n.current;for(ne=v;ne!==null;){a=ne;var S=a.child;if(a.subtreeFlags&2064&&S!==null)S.return=a,ne=S;else e:for(a=v;ne!==null;){if(o=ne,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:Ph(9,o)}}catch(T){ft(o,o.return,T)}if(o===a){ne=null;break e}var x=o.sibling;if(x!==null){x.return=o.return,ne=x;break e}ne=o.return}}if(De=i,ms(),Nr&&typeof Nr.onPostCommitFiberRoot=="function")try{Nr.onPostCommitFiberRoot(Ih,n)}catch{}r=!0}return r}finally{$e=t,Hn.transition=e}}return!1}function PT(n,e,t){e=co(t,e),e=VA(n,e,1),n=zi(n,e,1),e=tn(),n!==null&&(Vu(n,1,e),pn(n,e))}function ft(n,e,t){if(n.tag===3)PT(n,n,t);else for(;e!==null;){if(e.tag===3){PT(e,n,t);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ki===null||!Ki.has(r))){n=co(t,n),n=WA(e,n,1),e=zi(e,n,1),n=tn(),e!==null&&(Vu(e,1,n),pn(e,n));break}}e=e.return}}function Sj(n,e,t){var r=n.pingCache;r!==null&&r.delete(e),e=tn(),n.pingedLanes|=n.suspendedLanes&t,kt===n&&(Bt&t)===t&&(It===4||It===3&&(Bt&130023424)===Bt&&500>mt()-Dv?Ns(n,0):kv|=t),pn(n,e)}function dL(n,e){e===0&&(n.mode&1?(e=hc,hc<<=1,!(hc&130023424)&&(hc=4194304)):e=1);var t=tn();n=hi(n,e),n!==null&&(Vu(n,e,t),pn(n,t))}function Ej(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),dL(n,t)}function xj(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(q(314))}r!==null&&r.delete(e),dL(n,t)}var fL;fL=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||fn.current)dn=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return dn=!1,lj(n,e,t);dn=!!(n.flags&131072)}else dn=!1,it&&e.flags&1048576&&gA(e,df,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;vd(n,e),n=e.pendingProps;var i=ao(e,qt.current);Ha(e,t),i=Iv(null,e,r,n,i,t);var s=wv();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,hn(r)?(s=!0,uf(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ev(e),i.updater=Dh,e.stateNode=i,i._reactInternals=e,t0(e,r,n,t),e=i0(null,e,r,!0,s,t)):(e.tag=0,it&&s&&hv(e),Xt(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(vd(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=_j(r),n=sr(r,n),i){case 0:e=r0(null,e,r,n,t);break e;case 1:e=_T(null,e,r,n,t);break e;case 11:e=xT(null,e,r,n,t);break e;case 14:e=TT(null,e,r,sr(r.type,n),t);break e}throw Error(q(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:sr(r,i),r0(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:sr(r,i),_T(n,e,r,i,t);case 3:e:{if(YA(e),n===null)throw Error(q(387));r=e.pendingProps,s=e.memoizedState,i=s.element,TA(n,e),pf(e,r,null,t);var a=e.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=co(Error(q(423)),e),e=bT(n,e,r,t,i);break e}else if(r!==i){i=co(Error(q(424)),e),e=bT(n,e,r,t,i);break e}else for(Tn=Wi(e.stateNode.containerInfo.firstChild),bn=e,it=!0,lr=null,t=EA(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(oo(),r===i){e=pi(n,e,t);break e}Xt(n,e,r,t)}e=e.child}return e;case 5:return _A(e),n===null&&Jg(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,a=i.children,Kg(r,i)?a=null:s!==null&&Kg(r,s)&&(e.flags|=32),qA(n,e),Xt(n,e,a,t),e.child;case 6:return n===null&&Jg(e),null;case 13:return XA(n,e,t);case 4:return xv(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=lo(e,null,r,t):Xt(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:sr(r,i),xT(n,e,r,i,t);case 7:return Xt(n,e,e.pendingProps,t),e.child;case 8:return Xt(n,e,e.pendingProps.children,t),e.child;case 12:return Xt(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,qe(ff,r._currentValue),r._currentValue=a,s!==null)if(Sr(s.value,a)){if(s.children===i.children&&!fn.current){e=pi(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=ai(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),Zg(s.return,t,e),o.lanes|=t;break}l=l.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(q(341));a.lanes|=t,o=a.alternate,o!==null&&(o.lanes|=t),Zg(a,t,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Xt(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Ha(e,t),i=Wn(i),r=r(i),e.flags|=1,Xt(n,e,r,t),e.child;case 14:return r=e.type,i=sr(r,e.pendingProps),i=sr(r.type,i),TT(n,e,r,i,t);case 15:return zA(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:sr(r,i),vd(n,e),e.tag=1,hn(r)?(n=!0,uf(e)):n=!1,Ha(e,t),HA(e,r,i),t0(e,r,i,t),i0(null,e,r,!0,n,t);case 19:return QA(n,e,t);case 22:return KA(n,e,t)}throw Error(q(156,e.tag))};function hL(n,e){return $R(n,e)}function Tj(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $n(n,e,t,r){return new Tj(n,e,t,r)}function Fv(n){return n=n.prototype,!(!n||!n.isReactComponent)}function _j(n){if(typeof n=="function")return Fv(n)?1:0;if(n!=null){if(n=n.$$typeof,n===tv)return 11;if(n===nv)return 14}return 2}function Yi(n,e){var t=n.alternate;return t===null?(t=$n(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.
vendor: 2,769 bytes, line 74
74childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function xd(n,e,t,r,i,s){var a=2;if(r=n,typeof n=="function")Fv(n)&&(a=1);else if(typeof n=="string")a=5;else e:switch(n){case Ia:return Us(t.children,i,s,e);case ev:a=8,i|=8;break;case Ig:return n=$n(12,t,e,i|2),n.elementType=Ig,n.lanes=s,n;case wg:return n=$n(13,t,e,i),n.elementType=wg,n.lanes=s,n;case Rg:return n=$n(19,t,e,i),n.elementType=Rg,n.lanes=s,n;case _R:return Mh(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case xR:a=10;break e;case TR:a=9;break e;case tv:a=11;break e;case nv:a=14;break e;case Ci:a=16,r=null;break e}throw Error(q(130,n==null?n:typeof n,""))}return e=$n(a,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function Us(n,e,t,r){return n=$n(7,n,r,e),n.lanes=t,n}function Mh(n,e,t,r){return n=$n(22,n,r,e),n.elementType=_R,n.lanes=t,n.stateNode={isHidden:!1},n}function em(n,e,t){return n=$n(6,n,null,e),n.lanes=t,n}function tm(n,e,t){return e=$n(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function bj(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mp(0),this.expirationTimes=Mp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mp(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Nv(n,e,t,r,i,s,a,o,l){return n=new bj(n,e,t,o,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=$n(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ev(s),n}function Ij(n,e,t){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ba,key:r==null?null:""+r,children:n,containerInfo:e,implementation:t}}function pL(n){if(!n)return rs;n=n._reactInternals;e:{if(ra(n)!==n||n.tag!==1)throw Error(q(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(hn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(q(171))}if(n.tag===1){var t=n.type;if(hn(t))return pA(n,t,e)}return e}function mL(n,e,t,r,i,s,a,o,l){return n=Nv(t,r,!0,n,i,s,a,o,l),n.context=pL(null),t=n.current,r=tn(),i=qi(t),s=ai(r,i),s.callback=e??null,zi(t,
vendor: 6,784 bytes, line 74
74s,i),n.current.lanes=i,Vu(n,i,r),pn(n,r),n}function Fh(n,e,t,r){var i=e.current,s=tn(),a=qi(i);return t=pL(t),e.context===null?e.context=t:e.pendingContext=t,e=ai(s,a),e.payload={element:n},r=r===void 0?null:r,r!==null&&(e.callback=r),n=zi(i,e,a),n!==null&&(mr(n,i,a,s),md(n,i,a)),a}function Tf(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function OT(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function Uv(n,e){OT(n,e),(n=n.alternate)&&OT(n,e)}function wj(){return null}var gL=typeof reportError=="function"?reportError:function(n){console.error(n)};function Bv(n){this._internalRoot=n}Nh.prototype.render=Bv.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(q(409));Fh(n,e,null,null)};Nh.prototype.unmount=Bv.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;Qs(function(){Fh(null,n,null,null)}),e[fi]=null}};function Nh(n){this._internalRoot=n}Nh.prototype.unstable_scheduleHydration=function(n){if(n){var e=KR();n={blockedOn:null,target:n,priority:e};for(var t=0;t<Mi.length&&e!==0&&e<Mi[t].priority;t++);Mi.splice(t,0,n),t===0&&YR(n)}};function $v(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Uh(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function MT(){}function Rj(n,e,t,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=Tf(a);s.call(u)}}var a=mL(e,r,n,0,null,!1,!1,"",MT);return n._reactRootContainer=a,n[fi]=a.current,eu(n.nodeType===8?n.parentNode:n),Qs(),a}for(;i=n.lastChild;)n.removeChild(i);if(typeof r=="function"){var o=r;r=function(){var u=Tf(l);o.call(u)}}var l=Nv(n,0,!1,null,null,!1,!1,"",MT);return n._reactRootContainer=l,n[fi]=l.current,eu(n.nodeType===8?n.parentNode:n),Qs(function(){Fh(e,l,t,r)}),l}function Bh(n,e,t,r,i){var s=t._reactRootContainer;if(s){var a=s;if(typeof i=="function"){var o=i;i=function(){var l=Tf(a);o.call(l)}}Fh(e,a,n,i)}else a=Rj(t,e,n,i,r);return Tf(a)}WR=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=rl(e.pendingLanes);t!==0&&(sv(e,t|1),pn(e,mt()),!(De&6)&&(fo=mt()+500,ms()))}break;case 13:Qs(function(){var r=hi(n,1);if(r!==null){var i=tn();mr(r,n,1,i)}}),Uv(n,1)}};av=function(n){if(n.tag===13){var e=hi(n,134217728);if(e!==null){var t=tn();mr(e,n,134217728,t)}Uv(n,134217728)}};zR=function(n){if(n.tag===13){var e=qi(n),t=hi(n,e);if(t!==null){var r=tn();mr(t,n,e,r)}Uv(n,e)}};KR=function(){return $e};qR=function(n,e){var t=$e;try{return $e=n,e()}finally{$e=t}};Ng=function(n,e,t){switch(e){case"input":if(Cg(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var r=t[e];if(r!==n&&r.form===n.form){var i=Lh(r);if(!i)throw Error(q(90));IR(r),Cg(r,i)}}}break;case"textarea":RR(n,t);break;case"select":e=t.value,e!=null&&Ba(n,!!t.multiple,e,!1)}};OR=Pv;MR=Qs;var Aj={usingClientEntryPoint:!1,Events:[zu,La,Lh,DR,PR,Pv]},jo={findFiberByHostInstance:Cs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Lj={bundleType:jo.bundleType,version:jo.version,rendererPackageName:jo.rendererPackageName,rendererConfig:jo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vi.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=UR(n),n===null?null:n.stateNode},findFiberByHostInstance:jo.findFiberByHostInstance||wj,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bc.isDisabled&&bc.supportsFiber)try{Ih=bc.inject(Lj),Nr=bc}catch{}}An.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Aj;An.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!$v(e))throw Error(q(200));return Ij(n,e,null,t)};An.createRoot=function(n,e){if(!$v(n))throw Error(q(299));var t=!1,r="",i=gL;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=Nv(n,1,!1,null,null,t,!1,r,i),n[fi]=e.current,eu(n.nodeType===8?n.parentNode:n),new Bv(e)};An.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(q(188)):(n=Object.keys(n).join(","),Error(q(268,n)));return n=UR(e),n=n===null?null:n.stateNode,n};An.flushSync=function(n){return Qs(n)};An.hydrate=function(n,e,t){if(!Uh(e))throw Error(q(200));return Bh(null,n,e,!0,t)};An.hydrateRoot=function(n,e,t){if(!$v(n))throw Error(q(405));var r=t!=null&&t.hydratedSources||null,i=!1,s="",a=gL;if(t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),e=mL(e,null,n,1,t??null,i,!1,s,a),n[fi]=e.current,eu(n),r)for(n=0;n<r.length;n++)t=r[n],i=t._getVersion,i=i(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,i]:e.mutableSourceEagerHydrationData.push(t,i);return new Nh(e)};An.render=function(n,e,t){if(!Uh(e))throw Error(q(200));return Bh(null,n,e,!1,t)};An.unmountComponentAtNode=function(n){if(!Uh(n))throw Error(q(40));return n._reactRootContainer?(Qs(function(){Bh(null,null,n,!1,function(){n._reactRootContainer=null,n[fi]=null})}),!0):!1};An.unstable_batchedUpdates=Pv;An.unstable_renderSubtreeIntoContainer=function(n,e,t,r){if(!Uh(t))throw Error(q(200));if(n==null||n._reactInternals===void 0)throw Error(q(38));return Bh(n,e,t,!1,r)};An.version="18.3.1-next-f1338f8080-20240426";function yL(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yL)}catch(n){console.error(n)}}yL(),yR.exports=An;var Cj=yR.exports;O4({dsn:"https://208fd1e1ea91c4d6e0dd0f005ecbe679@o4511507257950208.ingest.de.sentry.io/4511507267715152",environment:"production",integrations:[j4({useEffect:aP.useEffect,useLocation:Wr,useNavigationType:R6,createRoutesFromChildren:Qd,matchRoutes:Hy}),r4({maskAllText:!1,blockAllMedia:!0})],tracesSampleRate:.2,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,enableLogs:!0});var vL,FT=Cj;vL=FT.createRoot,FT.hydrateRoot;
74const kj=()=>{const n=localStorage.getItem("theme");return n==="light"||n==="dark"?n:"light"},Dj=()=>{const[n,e]=P.useState(kj);P.useEffect(()=>{document.documentElement.setAttribute("data-theme",n),localStorage.setItem("theme",n)},[n]);const t=()=>{e(r=>r==="dark"?"light":"dark")};return _.jsxs("div",{className:"app",children:[_.jsxs("header",{className:"app-header",children:[_.jsxs(si,{to:"/",className:"app-title",children:[_.jsx("img",{src:"/web-app-manifest-192x192.png",alt:"HLS & MP4 Downloader",className:"app-logo"}),_.jsxs("div",{className:"app-title-text",children:[_.jsx("span",{className:"app-title-main",children:"StreamCatcher"}),_.jsx("span",{className:"app-title-sub",children:"HLS & Video Downloader"})]})]}),_.jsxs("nav",{className:"app-nav",children:[_.jsx(el,{to:"/",end:!0,className:"nav-link",children:"Home"}),_.jsx(el,{to:"/terms",className:"nav-link",children:"Terms & Conditions"}),_.jsx(el,{to:"/privacy",className:"nav-link",children:"Privacy Policy"}),_.jsx(el,{to:"/feedback",className:"nav-link",children:"Feedback"}),_.jsx("button",{className:"theme-toggle",onClick:t,"aria-label":n==="dark"?"Switch to light theme":"Switch to dark theme",children:n==="dark"?"âï¸":"ð"})]})]}),_.jsx("main",{className:"app-main",children:_.jsx(W6,{})}),_.jsxs("footer",{className:"app-footer",children:[_.jsxs("div",{className:"footer-links",children:[_.jsx(si,{to:"/terms",className:"nav-link",children:"Terms & Conditions"}),_.jsx(si,{to:"/privacy",className:"nav-link",children:"Privacy Policy"})]}),_.jsxs("span",{className:"footer-copy",children:["streamcatcher.online © ",new Date().getFullYear()]})]})]})},Pj="https://chromewebstore.google.com/detail/streamcatcher-hls-video-d/hnldocnfdnemijiiehpjnjcanfpkphnj",Oj="https://microsoftedge.microsoft.com/addons/detail/streamcatcher-hls-vid/ppdkbhhllbekhdfebbellaojmldhhpdk",Mj="https://s3.eu-north-1.amazonaws.com/streamcatcher.online/streamcatcher_latest.zip";function Fj(){const n=new URLSearchParams(window.location.hash.slice(1).replace(/\+/g,"%2B")).has("d");return _.jsx("div",{className:"no-streams-card",children:n?_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"no-streams-icon",children:_.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",children:_.jsx("path",{d:"M15 10l4.553-2.277A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M3 8a2 2 0 012-2h10a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V8z",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}),_.jsx("h2",{className:"no-streams-title",children:"No streams detected"}),_.jsx("p",{className:"no-streams-subtitle",children:"Navigate to a page with video and press play, then click the extension icon in your toolbar."})]}):_.jsxs(_.Fragment,{children:[_.jsx("h2",{className:"no-streams-title",children:"Download any video from the web"}),_.jsx("p",{className:"no-streams-subtitle",children:"StreamCatcher captures HLS streams and MP4s directly in your browser â no extra software needed."}),_.jsxs("ol",{className:"no-streams-steps",children:[_.jsxs("li",{children:[_.jsx("span",{className:"step-num",children:"1"}),_.jsxs("div",{children:[_.jsx("strong",{children:"Install the extension"}),_.jsx("span",{children:"Add StreamCatcher to Chrome for free"})]})]}),_.jsxs("li",{children:[_.jsx("span",{className:"step-num",children:"2"}),_.jsxs("div",{children:[_.jsx("strong",{children:"Open a video page"}),_.jsx("span",{children:"Any site or player that streams video"})]})]}),_.jsxs("li",{children:[_.jsx("span",{className:"step-num",children:"3"}),_.jsxs("div",{children:[_.jsx("strong",{children:"Click the icon & download"}),_.jsx("span",{children:"StreamCatcher detects streams automatically"})]})]})]}),_.jsx("h3",{className:"store-title",children:"Get StreamCatcher â it's free"}),_.jsxs("div",{className:"store-buttons",children:[_.jsxs("a",{className:"store-button store-button--chrome",href:Pj,target:"_blank",rel:"noopener noreferrer",children:[_.jsxs("svg",{className:"store-icon",viewBox:"0 0 256 256",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[_.jsx("path",{fill:"#fff",d:"M128.003 199.216c39.335 0 71.221-31.888 71.221-71.223S167.338 56.77 128.003 56.77S56.78 88.658 56.78 127.993s31.887 71.223 71.222 71.223"}),_.jsx("path",{fill:"#229342",d:"M35.89 92.997Q27.92 79.192 17.154 64.02a127.98 127.98 0 0 0 110.857 191.981q17.671-24.785 23.99
746-35.74q12.148-21.042 31.423-60.251v-.015a63.993 63.993 0 0 1-110.857.017Q46.395 111.19 35.89 92.998"}),_.jsx("path",{fill:"#fbc116",d:"M128.008 255.996A127.97 127.97 0 0 0 256 127.997A128 128 0 0 0 238.837 64q-36.372-3.585-53.686-3.585q-19.632 0-57.152 3.585l-.014.01a63.99 63.99 0 0 1 55.444 31.987a63.99 63.99 0 0 1-.001 64.01z"}),_.jsx("path",{fill:"#1a73e8",d:"M128.003 178.677c27.984 0 50.669-22.685 50.669-50.67s-22.685-50.67-50.67-50.67c-27.983 0-50.669 22.686-50.669 50.67s22.686 50.67 50.67 50.67"}),_.jsx("path",{fill:"#e33b2e",d:"M128.003 64.004H238.84a127.973 127.973 0 0 0-221.685.015l55.419 95.99l.015.008a63.993 63.993 0 0 1 55.415-96.014z"})]}),"Add to Chrome"]}),_.jsxs("a",{className:"store-button store-button--edge",href:Oj,target:"_blank",rel:"noopener noreferrer",children:[_.jsxs("svg",{className:"store-icon",viewBox:"0 0 256 256",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[_.jsxs("defs",{children:[_.jsxs("radialGradient",{id:"edgeBadgeR1",cx:"161.83",cy:"788.401",r:"95.38",gradientTransform:"matrix(.9999 0 0 .9498 -4.622 -570.387)",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{offset:".72",stopOpacity:"0"}),_.jsx("stop",{offset:".95",stopOpacity:".53"}),_.jsx("stop",{offset:"1"})]}),_.jsxs("radialGradient",{id:"edgeBadgeR2",cx:"-773.636",cy:"746.715",r:"143.24",gradientTransform:"matrix(.15 -.9898 .8 .12 -410.718 -656.341)",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{offset:".76",stopOpacity:"0"}),_.jsx("stop",{offset:".95",stopOpacity:".5"}),_.jsx("stop",{offset:"1"})]}),_.jsxs("radialGradient",{id:"edgeBadgeR3",cx:"230.593",cy:"-106.038",r:"202.43",gradientTransform:"matrix(-.04 .9998 -2.1299 -.07998 -190.775 -191.635)",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{offset:"0",stopColor:"#35c1f1"}),_.jsx("stop",{offset:".11",stopColor:"#34c1ed"}),_.jsx("stop",{offset:".23",stopColor:"#2fc2df"}),_.jsx("stop",{offset:".31",stopColor:"#2bc3d2"}),_.jsx("stop",{offset:".67",stopColor:"#36c752"})]}),_.jsxs("radialGradient",{id:"edgeBadgeR4",cx:"536.357",cy:"-117.703",r:"97.34",gradientTransform:"matrix(.28 .9598 -.78 .23 -1.928 -410.318)",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{offset:"0",stopColor:"#66eb6e"}),_.jsx("stop",{offset:"1",stopColor:"#66eb6e",stopOpacity:"0"})]}),_.jsxs("linearGradient",{id:"edgeBadgeL1",x1:"63.334",x2:"241.617",y1:"757.83",y2:"757.83",gradientTransform:"translate(-4.63 -580.81)",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{offset:"0",stopColor:"#0c59a4"}),_.jsx("stop",{offset:"1",stopColor:"#114a8b"})]}),_.jsxs("linearGradient",{id:"edgeBadgeL2",x1:"157.401",x2:"46.028",y1:"680.556",y2:"801.868",gradientTransform:"translate(-4.63 -580.81)",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{offset:"0",stopColor:"#1b9de2"}),_.jsx("stop",{offset:".16",stopColor:"#1595df"}),_.jsx("stop",{offset:".67",stopColor:"#0680d7"}),_.jsx("stop",{offset:"1",stopColor:"#0078d4"})]})]}),_.jsx("path",{fill:"url(#edgeBadgeL1)",d:"M231 190.5c-3.4 1.8-6.9 3.4-10.5 4.7c-11.5 4.3-23.6 6.5-35.9 6.5c-47.3 0-88.5-32.5-88.5-74.3c.1-11.4 6.4-21.9 16.4-27.3c-42.8 1.8-53.8 46.4-53.8 72.5c0 73.9 68.1 81.4 82.8 81.4c7.9 0 19.8-2.3 27-4.6l1.3-.4c27.6-9.5 51-28.1 66.6-52.8c1.2-1.9.6-4.3-1.2-5.5c-1.3-.8-2.9-.9-4.2-.2"}),_.jsx("path",{fill:"url(#edgeBadgeR1)",opacity:".35",d:"M231 190.5c-3.4 1.8-6.9 3.4-10.5 4.7c-11.5 4.3-23.6 6.5-35.9 6.5c-47.3 0-88.5-32.5-88.5-74.3c.1-11.4 6.4-21.9 16.4-27.3c-42.8 1.8-53.8 46.4-53.8 72.5c0 73.9 68.1 81.4 82.8 81.4c7.9 0 19.8-2.3 27-4.6l1.3-.4c27.6-9.5 51-28.1 66.6-52.8c1.2-1.9.6-4.3-1.2-5.5c-1.3-.8-2.9-.9-4.2-.2"}),_.jsx("path",{fill:"url(#edgeBadgeL2)",d:"M105.7 241.4c-8.9-5.5-16.6-12.8-22.7-21.3c-26.3-36-18.4-86.5 17.6-112.8c3.8-2.7 7.7-5.2 11.9-7.2c3.1-1.5 8.4-4.1 15.5-4c10.1.1 19.6 4.9 25.7 13c4 5.4 6.3 11.9 6.4 18.7c0-.2 24.5-79.6-80-79.6c-43.9 0-80 41.7-80 78.2c-.2 19.3 4 38.5 12.1 56c27.6 58.8 94.8 87.6 156.4 67.1c-21.1 6.6-44.1 3.7-62.9-8.1"}),_.jsx("path",{fill:"url(#edgeBadgeR2)",opacity:".41",d:"M105.7 241.4c-8.9-5.5-16.6-12.8-22.7-21.3c-26.3-36-18.4-86.5 17.6-112.8c3.8-2.7 7.7-5.2 11.9-7.2c3.1-1.5 8.4-4.1 15.5-4c10.1.1 19.6 4.9 25.7 13c4 5.4 6.3 11.9 6.4 18.7c0-.2 24.5-79.6-80-79.6c-43.9 0-80 41.7-80 78.2c-.2 19.3 4 38.5 12.1 56c27.6 58.8 94.8 87.6 156.4 67.1c-21.1 6.6-44.1 3.7-62.9-8.1"}),_.jsx("path",{fill:"url(#edgeBadgeR3)",d:"M152.3 148.9c-.8 1-3.3 2.5-3.3 5.7c0 2.6 1.7 5.1 4.7 7.2c14.4 10 41.5 8.7 41.6 8.7c10.7 0 21.1-2.9 30.3-8.3c18.8-11 30.4-31.1 30.4-52.9c.3-22.4-8-37.3-11.3-43.9C223.5 23.9 177.7 0 128 0C58 0 1 56.2 0 126.2c.5-36.5 36.8-66 80-66c3.5 0 23.5.3 42 10.1c16.3 8.6 24.9 18.9 30.8 29.2c6.2 10.7 7.3 24.1 7.3 29.5c0 5.3-2.7 13.3-7.8 19.9"}),_.jsx("path",{fill:"url(#edgeBadgeR4)",d:"M152.3 148.9c-.8 1-3.3 2.5-3.3 5.7c0 2.6 1.7 5.1 4.7 7.2c14.4 10 41.5 8.7 41.6 8.7c10.7 0 21.1-2.9 30.3-8.3c18.8-11 30.4-31.1 30.4-52.9c.3-22.4-8-37.3-11.3-43.9C223.5 23.9 177.7 0 128 0C58 0 1 56.2 0 126.2c.5-36.5 36.8-66 80-66c3.5 0 23.5.3 42 10.1c16.3 8.6 24.9 18.9 30.8 29.2c6.2 10.7 7.3 24.1 7.3 29.5c0 5.3-2.7 13.3-7.8 19.9"})]}),"Add to Edge"]})]}),_.jsx("p",{className:"no-streams-hint",children:"Already installed? Open a video page and click the toolbar icon."}),_.jsxs("div",{className:"manual-install",children:[_.jsxs("a",{className:"store-button store-button--manual",href:Mj,target:"_blank",rel:"noopener noreferrer",children:[_.jsx("svg",{className:"store-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:_.jsx("path",{d:"M12 3v12m0 0l-4.5-4.5M12 15l4.5-4.5M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})}),"Download manually (.zip)"]}),_.jsxs("p",{className:"manual-install-hint",children:["Unzip the file, open ",_.jsx("code",{children:"chrome://extensions"})," (or"," ",_.jsx("code",{children:"edge://extensions"}),"), enable ",_.jsx("strong",{children:"Developer mode"}),", then click"," ",_.jsx("strong",{children:"Load unpacked"})," and select the unzipped folder."]}
74)]})]})})}const Nj=({streams:n,onSelect:e})=>n.length===0?_.jsx(Fj,{}):_.jsx("ul",{className:"stream-list",children:n.map((t,r)=>{const i=t.pageUrl?new URL(t.pageUrl).hostname:"Unknown source",s=t.url.length>60?t.url.slice(0,57)+"...":t.url;return _.jsxs("li",{className:"stream-item",children:[_.jsxs("div",{className:"stream-info",children:[_.jsx("span",{className:`badge badge-${t.type}`,children:t.type.toUpperCase()}),_.jsx("span",{className:"stream-source",children:i}),_.jsx("span",{className:"stream-url",title:t.url,children:s})]}),_.jsx("button",{className:"btn btn-primary",onClick:()=>e(t),children:"Download"})]},r)})}),X=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Uj=Number.isSafeInteger||function(n){return typeof n=="number"&&Math.abs(n)<=Bj},Bj=Number.MAX_SAFE_INTEGER||9007199254740991;let re=function(n){return n.NETWORK_ERROR="networkError",n.MEDIA_ERROR="mediaError",n.KEY_SYSTEM_ERROR="keySystemError",n.MUX_ERROR="muxError",n.OTHER_ERROR="otherError",n}({}),F=function(n){return n.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",n.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",n.KEY_SYSTEM_NO_SESSION="keySystemNoSession",n.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",n.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",n.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",n.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",n.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",n.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",n.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",n.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",n.MANIFEST_LOAD_ERROR="manifestLoadError",n.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",n.MANIFEST_PARSING_ERROR="manifestParsingError",n.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",n.LEVEL_EMPTY_ERROR="levelEmptyError",n.PLAYLIST_UNCHANGED_ERROR="playlistUnchangedError",n.LEVEL_LOAD_ERROR="levelLoadError",n.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",n.LEVEL_PARSING_ERROR="levelParsingError",n.LEVEL_SWITCH_ERROR="levelSwitchError",n.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",n.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",n.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",n.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",n.FRAG_LOAD_ERROR="fragLoadError",n.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",n.FRAG_DECRYPT_ERROR="fragDecryptError",n.FRAG_PARSING_ERROR="fragParsingError",n.FRAG_GAP="fragGap",n.REMUX_ALLOC_ERROR="remuxAllocError",n.KEY_LOAD_ERROR="keyLoadError",n.KEY_LOAD_TIMEOUT="keyLoadTimeOut",n.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",n.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",n.BUFFER_APPEND_ERROR="bufferAppendError",n.BUFFER_APPENDING_ERROR="bufferAppendingError",n.BUFFER_APPEND_NO_PROGRESS="bufferAppendNoProgress",n.BUFFER_STALLED_ERROR="bufferStalledError",n.BUFFER_FULL_ERROR="bufferFullError",n.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",n.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",n.ASSET_LIST_LOAD_ERROR="assetListLoadError",n.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",n.ASSET_LIST_PARSING_ERROR="assetListParsingError",n.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",n.INTERNAL_EXCEPTION="internalException",n.INTERNAL_ABORTED="aborted",n.ATTACH_MEDIA_ERROR="attachMediaError",n.MEDIA_SOURCE_REQUIRES_RESET="mediaSourceRequiresReset",n.UNKNOWN="unknown",n}({}),E=function(n){return n.MEDIA_ATTACHING="hlsMediaAttaching",n.MEDIA_ATTACHED="hlsMediaAttached",n.MEDIA_DETACHING="hlsMediaDetaching",n.MEDIA_DETACHED="hlsMediaDetached",n.MEDIA_ENDED="hlsMediaEnded",n.STALL_RESOLVED="hlsStallResolved",n.BUFFER_RESET="hlsBufferReset",n.BUFFER_CODECS="hlsBufferCodecs",n.BUFFER_CREATED="hlsBufferCreated",n.BUFFER_APPENDING="hlsBufferAppending",n.BUFFER_APPENDED="hlsBufferAppended",n.BUFFER_EOS="hlsBufferEos",n.BUFFERED_TO_END="hlsBufferedToEnd",n.BUFFER_FLUSHING="hlsBufferFlushing",n.BUFFER_FLUSHED="hlsBufferFlushed",n.MANIFEST_LOADING="hlsManifestLoading",n.MANIFEST_LOADED="hlsManifestLoaded",n.MANIFEST_PARSED="hl
74sManifestParsed",n.LEVEL_SWITCHING="hlsLevelSwitching",n.LEVEL_SWITCHED="hlsLevelSwitched",n.LEVEL_LOADING="hlsLevelLoading",n.LEVEL_LOADED="hlsLevelLoaded",n.LEVEL_UPDATED="hlsLevelUpdated",n.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",n.LEVELS_UPDATED="hlsLevelsUpdated",n.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",n.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",n.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",n.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",n.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",n.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",n.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",n.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",n.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",n.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",n.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",n.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",n.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",n.CUES_PARSED="hlsCuesParsed",n.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",n.INIT_PTS_FOUND="hlsInitPtsFound",n.FRAG_LOADING="hlsFragLoading",n.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",n.FRAG_LOADED="hlsFragLoaded",n.FRAG_DECRYPTED="hlsFragDecrypted",n.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",n.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",n.FRAG_PARSING_METADATA="hlsFragParsingMetadata",n.FRAG_PARSED="hlsFragParsed",n.FRAG_BUFFERED="hlsFragBuffered",n.FRAG_CHANGED="hlsFragChanged",n.FPS_DROP="hlsFpsDrop",n.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",n.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",n.ERROR="hlsError",n.DESTROYING="hlsDestroying",n.KEY_LOADING="hlsKeyLoading",n.KEY_LOADED="hlsKeyLoaded",n.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",n.BACK_BUFFER_REACHED="hlsBackBufferReached",n.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",n.ASSET_LIST_LOADING="hlsAssetListLoading",n.ASSET_LIST_LOADED="hlsAssetListLoaded",n.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",n.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",n.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",n.INTERSTITIAL_STARTED="hlsInterstitialStarted",n.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",n.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",n.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",n.INTERSTITIAL_ENDED="hlsInterstitialEnded",n.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",n.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",n.EVENT_CUE_ENTER="hlsEventCueEnter",n}({});function $j(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var nm={exports:{}},NT;function Gj(){return NT||(NT=1,function(n,e){(function(t){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,u,c){if(c=c||{},l=l.trim(),u=u.trim(),!u){if(!c.alwaysNormalize)return l;var d=o.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var f=o.parseURL(u);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return c.alwaysNormalize?(f.path=o.normalizePath(f.path),o.buildURLFromParts(f)):u;var h=o.parseURL(l);if(!h)throw new Error("Error trying to parse base URL.");if(!h.netLoc&&h.path&&h.path[0]!=="/"){var p=i.exec(h.path);h.netLoc=p[1],h.path=p[2]}h.netLoc&&!h.path&&(h.path="/");var m={scheme:h.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(m.netLoc=h.netLoc,f.path[0]!=="/"))if(!f.path)m.path=h.path,f.params||(m.params=h.params,f.query||(m.query=h.query));else{var g=h.path,y=g.substring(0,g.lastIndexOf("/")+1)+f.path;m.path=o.normalizePath(y)}return m.path===null&&(m.path=c.alwaysNormalize?o.normalizePath(f.path):f.path),o.buildURLFromParts(m)},parseURL:function(l){var u=r.exec(l);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};n.exports=o})()}(nm)),nm.exports}var Gv=Gj();
vendor: 6,456 bytes, line 74
74class jv{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}let ve=function(n){return n.MANIFEST="manifest",n.LEVEL="level",n.AUDIO_TRACK="audioTrack",n.SUBTITLE_TRACK="subtitleTrack",n.MEDIA_FRAGMENT="media-fragment",n.KEY="key",n.STEERING_MANIFEST="steering-manifest",n.SERVER_CERTIFICATE="server-certificate",n.INTERSTITIAL_ASSET_LIST="interstitial-asset-list",n}({}),te=function(n){return n.MAIN="main",n.AUDIO="audio",n.SUBTITLE="subtitle",n}({});var He={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class SL{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,Hj(this,"stats")}setByteRange(e,t){const r=e.split("@",2);let i;r.length===1?i=t?.byteRangeEndOffset||0:i=parseInt(r[1]),this._byteRange=[i,parseInt(r[0])+i]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[He.AUDIO]:null,[He.VIDEO]:null,[He.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new jv),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.relurl&&(this._url=Gv.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[He.AUDIO]=null,e[He.VIDEO]=null,e[He.AUDIOVIDEO]=null,this.url=null}}function at(n){return n.sn!=="initSegment"}function sl(n,e){return n.sn===e?.sn&&n.level===e.level}function g0(n,e){return n.sn===e?.sn&&n.level===e.level&&n.cc===e.cc}class Ic extends SL{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(X(e)&&X(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const r=Object.keys(t);if(r.length===1){const i=this._decryptdata=t[r[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=X(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const r=Object.keys(this.levelkeys),i=r.length;if(i>1||i===1&&(t=this.levelkeys[r[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!X(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return at(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var r;const i=t[e];i&&!((r=this._decryptdata)!=null&&r.keyId)&&(this._decryptdata=i.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,r,i,s,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:r,startDTS:i,endDTS:s,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,r),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,s)}}class jj extends SL{constructor(e,t,r,i,s){super(r),this.fragOffset=0,this.duration=0,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.gap=!1,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo||this.fragment.type===te.SUBTITLE&&this.stats.loading.end>0)}}function EL(n,e){const t=Object.getPrototypeOf(n);if(t){const r=Object.getOwnPropertyDescriptor(t,e);return r||EL(t,e)}}function Hj(n,e){const t=EL(n,e);t&&(t.enumerable=!0,Object.defineProperty(n,e,t))}function Vj(n,e,t){return(e=Kj(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ne(){return Ne=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Ne.apply(null,arguments)}function UT(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ie(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};
vendor: 15,390 bytes, line 74
74e%2?UT(Object(t),!0).forEach(function(r){Vj(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):UT(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $h(n,e){if(n==null)return{};var t,r,i=Wj(n,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r<s.length;r++)t=s[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function Wj(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function zj(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Kj(n){var e=zj(n,"string");return typeof e=="symbol"?e:e+""}function _f(n){switch(n.details){case F.FRAG_LOAD_TIMEOUT:case F.KEY_LOAD_TIMEOUT:case F.LEVEL_LOAD_TIMEOUT:case F.MANIFEST_LOAD_TIMEOUT:case F.AUDIO_TRACK_LOAD_TIMEOUT:case F.SUBTITLE_TRACK_LOAD_TIMEOUT:case F.ASSET_LIST_LOAD_TIMEOUT:return!0}return!1}function xL(n){return n.details.startsWith("key")}function TL(n){return xL(n)&&!!n.frag&&!n.frag.decryptdata}function BT(n,e){const t=_f(e);return n.default[`${t?"timeout":"error"}Retry`]}function Hv(n,e){const t=n.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*n.retryDelayMs,n.maxRetryDelayMs)}function $T(n){return ie(ie({},n),{errorRetry:null,timeoutRetry:null})}function uu(n,e,t,r){if(!n)return!1;const i=r?.code,s=e<n.maxNumRetry&&(qj(i)||!!t);return n.shouldRetry?n.shouldRetry(n,e,t,r,s):s}function qj(n){return cu(n)||!!n&&(n<400||n>499)}function cu(n){return n===0&&navigator.onLine===!1}function _L(n,e){return e>0&&n.loadError>0&&n.loadErrorTime!==0&&self.performance.now()-n.loadErrorTime>e}class ua{constructor(e,t=0,r=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=r}sample(e,t){const r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class Yj{constructor(e,t,r,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ua(e),this.fast_=new ua(t),this.defaultTTFB_=i,this.ttfb_=new ua(e)}update(e,t){const{slow_:r,fast_:i,ttfb_:s}=this;r.halfLife!==e&&(this.slow_=new ua(e,r.getEstimate(),r.getTotalWeight())),i.halfLife!==t&&(this.fast_=new ua(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new ua(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){if(t<=0)return;const r=Math.min(this.minDelayMs_,t/1e5),i=8*t,s=Math.max(e,r)/1e3,a=i/s;this.fast_.sample(s,a),this.slow_.sample(s,a)}sampleTTFB(e){const t=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(r,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}class Cn{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const r=`[${e}]:`;this.trace=Di,this.debug=t.debug.bind(null,r),this.log=t.log.bind(null,r),this.warn=t.warn.bind(null,r),this.info=t.info.bind(null,r),this.error=t.error.bind(null,r)}}const Di=function(){},Xj={trace:Di,debug:Di,log:Di,warn:Di,info:Di,error:Di};function y0(){return Ne({},Xj)}function Qj(n,e){const t=self.console[n];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${n}] >`):Di}function GT(n,e,t){return e[n]?e[n].bind(e):Qj(n,t)}const v0=y0();function Jj(n,e,t){const r=y0();if(typeof console=="object"&&n===!0||typeof n=="object"){const i=["debug","log","info","warn","error"];i.forEach(s=>{r[s]=GT(s,n,t)});try{r.log(`Debug logs enabled for "${e}" in hls.js version 1.7.3`)}catch{return y0()}i.forEach(s=>{v0[s]=GT(s,n)})}else Ne(v0,r);return r}const Pe=v0;function is(n=!0){return typeof self>"u"?void 0:(n||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Zj(n){return typeof self<"u"&&n===self.ManagedMediaSource}function bL(n,e){const t=Object.keys(n),r=Object.keys(e),i=t.length,s=r.length;return!i||!s||i===s&&!t.some(a=>r.indexOf(a)===-1)}function eH(n){return btoa(String.fromCharCode(...n))}function Gh(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}const tH="utf-16",rm="utf-16be",jT="utf-16le",Td="utf-8";function nH(n,e={}){let t;Gh(n)?t=new DataView(n):t=new DataView(n.buffer,n.byteOffset,n.byteLength);let r=0,{encoding:i}=e;if(!i){const u=t.getUint8(0),c=t.getUint8(1);u==239&&c==187&&t.getUint8(2)==191?(i=Td,r=3):u==254&&c==255?(i=rm,r=2):u==255&&c==254?(i=jT,r=2):i=Td}if(typeof TextDecoder<"u")return new TextDecoder(i).decode(t);const{byteLength:s}=t,a=i!==rm;let o="",l;for(;r<s;){switch(i){case Td:if(l=t.getUint8(r),l<128)r++;else if(l>=194&&l<=223)if(r+1<s){const u=t.getUint8(r+1);u>=128&&u<=191?(l=(l&31)<<6|u&63,r+=2):r++}else r++;else if(l>=224&&l<=239)if(r+2<=s-1){const u=t.getUint8(r+1),c=t.getUint8(r+2);u>=128&&u<=191&&c>=128&&c<=191?(l=(l&15)<<12|(u&63)<<6|c&63,r+=3):r++}else r++;else if(l>=240&&l<=244)if(r+3<=s-1){const u=t.getUint8(r+1),c=t.getUint8(r+2),d=t.getUint8(r+3);u>=128&&u<=191&&c>=128&&c<=191&&d>=128&&d<=191?(l=(l&7)<<18|(u&63)<<12|(c&63)<<6|d&63,r+=4):r++}else r++;else r++;break;case rm:case tH:case jT:l=t.getUint16(r,a),r+=2;break}o+=String.fromCodePoint(l)}return o}function rH(n){const e=typeof n=="string"?new URL(n):n;return e.origin+e.pathname.substring(0,e.pathname.lastIndexOf("/")+1)}function IL(n,e){if(n<0)return-IL(-n,e);const t=Math.pow(10,e);if(Math.abs(n*t%1-.5)<Number.EPSILON){const r=Math.floor(n*t);return(r%2===0?r:r+1)/t}else return Math.round(n*t)/t}function iH(n,e){let t;try{t=new URL(n)}catch{return n}const r=new URL(e);if(t.origin!==r.origin)return n;const i=t.pathname.split("/").slice(1),s=r.pathname.split("/").slice(1,-1),a=Math.min(i.length,s.length);for(let o=0;o<a&&i[o]===s[o];o++)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")+t.search+t.hash}function wL(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const i=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?i:i&3|8).toString(16)})}}}function Vv(n,e){return e+10<=n.length&&n[e]===73&&n[e+1]===68&&n[e+2]===51&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function jh(n,e){let t=0;return t=(n[e]&127)<<21,t|=(n[e+1]&127)<<14,t|=(n[e+2]&127)<<7,t|=n[e+3]&127,t}function sH(n,e){return Vv(n,e)&&jh(n,e+6)+10<=n.length-e}function RL(n,e){return e+10<=n.length&&n[e]===51&&n[e+1]===68&&n[e+2]===73&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function du(n,e){const t=e;let r=0;for(;Vv(n,e);){r+=10;const i=jh(n,e+6);r+=i,RL(n,e+10)&&(r+=10),e+=r}if(r>0)return n.subarray(t,t+r)}function aH(n){return Gh(n)?n:n.byteOffset==0&&n.byteLength==n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer}function im(n,e=0,t=1/0){return oH(n,e,t,Uint8Array)}function oH(n,e,t,r){const i=lH(n);let s=1;"BYTES_PER_ELEMENT"in r&&(s=r.BYTES_PER_ELEMENT);const a=uH(n)?n.byteOffset:0,o=(a+n.byteLength)/s,l=(a+e)/s,u=Math.floor(Math.max(0,Math.min(l,o)));return new r(i,u,Math.floor(Math.min(u+Math.max(t,0),o))-u)}function lH(n){return Gh(n)?n:n.buffer}function uH(n){return n&&Gh(n.buffer)&&n.byteLength!==void 0&&n.byteOffset!==void 0}function In(n,e=!1){const t=e?n.indexOf(0):n.length,r=nH(new DataView(n.buffer,n.byteOffset,t),{encoding:Td});return e?r:r.replace(/\0/g,"")}function cH(n){const e={key:n.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(n.size<2)return;if(n.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const r=n.data.subarray(1).indexOf(0);if(r===-1)return;const i=In(im(n.data,1,r)),s=n.data[2+r],a=n.data.subarray(3+r).indexOf(0);if(a===-1)return;const o=In(im(n.data,3+r,a));let l;return i==="-->"?l=In(im(n.data,4+r+a)):l=aH(n.data.subarray(4+r+a)),e.mimeType=i,e.pictureType=s,e.description=o,e.data=l,e}function dH(n){if(n.size<2)return;const e=In(n.data,!0),t=new Uint8Array(n.data.subarray(e.length+1));return{key:n.type,info:e,data:t.buffer}}function fH(n){if(n.size<2)return;if(n.type==="TXXX"){let t=1;const{data:r}=n,i=In(r.subarray(t),!0);t+=i.length+1;const s=In(r.subarray(t));return{key:n.type,info:i,data:s}}const e=In(n.data.subarray(1));return{key:n.type,info:"",data:e}}function hH(n){if(n.type==="WXXX"){if(n.size<2)return;let t=1;const r=In(n.data.subarray(t),!0);t+=r.length+1;const i=In(n.data.subarray(t));return{key:n.type,info:r,data:i}}const e=In(n.data);return{key:n.type,info:"",data:e}}function pH(n){return n.type==="PRIV"?dH(n):n.type[0]==="W"?hH(n):n.type==="APIC"?cH(n):fH(n)}function mH(n){const e=String.fromCharCode(n[0],n[1],n[2],n[3]),t=jh(n,4),r=10;return{type:e,size:t,data:n.subarray(r,r+t)}}const wc=10,gH=10;function AL(n){let e=0;const t=[];for(;Vv(n,e);){const r=jh(n,e+6);n[e+5]>>6&1&&(e+=wc),e+=wc;const i=e+r;for(;e+gH<i;){const s=mH(n.subarray(e)),a=pH(s);a&&t.push(a),e+=s.size+wc}RL(n,e)&&(e+=wc)}return t}function LL(n){return n&&n.key==="PRIV"&&n.info==="com.apple.streaming.transportStreamTimestamp"}function yH(n){if(n.data.byteLength===8){const e=new Uint8Array(n.data),t=e[3]&1;let r=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return r/=45,t&&(r+=4772185884e-2),Math.round(r)}}function Wv(n){const e=AL(n);for(const t of e)if(LL(t))return yH(t)}function St(n){let e="";for(let t=0;t<n.length;t++){let r=n[t].toString(16);r.length<2&&(r="0"+r),e+=r}return e}function CL(n){return Uint8Array.from(n.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function zv(n){return Uint8Array.from(atob(n),e=>e.charCodeAt(0))}function gr(n){return String.fromCharCode.apply(null,n)}const Ir=Math.pow(2,32)-1,ce={avc1:1635148593,avcC:1635148611,hvc1:1752589105,hvcC:1752589123,btrt:1651798644,dinf:1684631142,dref:1685218662,esds:1702061171,free:1718773093,ftyp:1718909296,hdlr:1751411826,mdat:1835295092,mdhd:1835296868,mdia:1835297121,mfhd:1835427940,minf:1835626086,moof:1836019558,moov:1836019574,mp4a:1836069985,".mp3":778924083,dac3:1684103987,"ac-3":1633889587,mvex:1836475768,mvhd:1836476516,pasp:1885434736,sdtp:1935963248,stbl:1937007212,stco:1937007471,stsc:1937011555,stsd:1937011556,stsz:1937011578,stts:1937011827,tfdt:1952867444,tfhd:1952868452,traf:1953653094,trak:1953653099,trun:1953658222,trex:1953654136,tkhd:1953196132,vmhd:1986881636,smhd:1936549988},kL={video:1,audio:2,id3:3,text:4};function DL(n,e){const t=n[e]<<8|n[e+1];return t<0?65536+t:t}function Z(n,e){const t=n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3];return t<0?4294967296+t:t}function HT(n,e){let t=Z(n,e);return t*=Math.pow(2,32),t+=Z(n,e+4),t}function Rc(n,e){let t="";for(let r=e;r<n.length;r++)if(t+=String.fromCharCode(n[r]),n[r]===0)return t;return null}function S0(n,e){return n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3]}function pt(n,e,t){n[e]=t>>24,n[e+1]=t>>16&255,n[e+2]=t>>8&255,n[e+3]=t&255}function VT(n,e,t){const r=e.byteOffset-n.byteOffset-8,i=8+t,s=e.byteLength+8-i;s<8||(pt(n,r,i),pt(n,r+i,s),pt(n,r+i+4,ce.free))}function E0(n,e){return[n.byteOffset-e-8,n.byteOffset-e+n.byteLength]}function PL(n,e){e.sort((o,l)=>o[0]-l[0]);const t=e.reduce((o,[l,u])=>o+u-l,0),r=new Uint8Array(n.byteLength-t);let i=0,s=0;for(let o=0;o<e.length;o++){const[l,u]=e[o];r.set(n.subarray(i,l),s),s+=l-i,i=u}return r.set(n.subarray(i),s),{result:r,dropped:t,droppedBefore:o=>e.reduce((l,[u,c])=>c<=o?l+c-u:l,0)}}function vH(n){const e=de(n,["moov"]);if(e.length!==1||de(n,["moof"]).length)return null;const t=n.byteOffset,r=[],i=[];let s=!1;const a=de(e[0],["trak"]);for(let h=0;h<a.length;h++){const p=a[h],m=de(p,["mdia","hdlr"])[0];if((m?gr(m.subarray(8,12)):"")==="vide"){s=!0;continue}const y=de(p,["tkhd"])[0];if(!y)return null;const v=y[0];i.push(Z(y,v===0?12:20)),r.push(E0(p,t))}if(!s||!r.length)return null;const o=de(e[0],["mvex"])[0];let l=0;if(o){const h=de(o,["trex"]);for(let p=0;p<h.length;p++){const m=h[p];i.indexOf(Z(m,4))!==-1&&(r.push(E0(m,t)),l+=m.byteLength+8)}}const{result:u,dropped:c,droppedBefore:d}=PL(n,r),f=e[0].byteOffset-t-8;if(pt(u,f,e[0].byteLength+8-c),o&&l){const h=o.byteOffset-t-8;pt(u,h-d(h),o.byteLength+8-l)}return u}function SH(n,e,t,r,i){if(t<1)return null;const s=de(n,["moof"]);if(s.length!==1)return null;const a=s[0],o=n.byteOffset,l=[],u=[],c=de(a,["traf"]);let d=!0;for(let m=0;m<c.length;m++){const g=c[m],y=de(g,["tfhd"])[0];if(!y)return null;Z(y,4)===e?(l.push(g),Z(y,0)&131072||(d=!1)):u.push(E0(g,o))}if(!l.length||u.length&&!d)return null;if(r!==void 0){let m=t;for(let y=0;y<l.length;y++){const v=l[y];let S=0;const x=de(v,["trun"]);for(let I=0;I<x.length;I++){const R=x[I],A=Math.min(m,Z(R,4));if(A){pt(n,R.byteOffset-o+4,A);const b=Z(R,0)&16777215,C=(b&256?4:0)+(b&512?4:0)+(b&1024?4:0)+(b&2048?4:0);VT(n,R,8+(b&1?4:0)+(b&4?4:0)+A*C)}else pt(n,R.byteOffset-o-4,ce.free);m-=A,S+=A}const T=de(v,["senc"])[0];T&&pt(n,T.byteOffset-o+4,S);const w=de(v,["saiz"])[0];if(w){const I=w[1]<<16|w[2]<<8|w[3];let R=4;I&1&&(R+=8);const A=w[R];R+=1,pt(n,w.byteOffset-o+R,S),VT(n,w,R+4+(A===0?S:0))}}const g=de(n,["mdat"]);if(g.length===1){const y=g[0].byteOffset-o-8;pt(n,y,r-y)}}let f=n,h=0,p=()=>0;if(u.length){({result:f,dropped:h,droppedBefore:p}=PL(n,u)),pt(f,a.byteOffset-o-8,a.byteLength+8-h);for(let m=0;m<l.length;m++){const g=l[m],y=p(g.byteOffset-o),v=de(g,["trun"]);for(let S=0;S<v.length;S++){const x=v[S];Z(x,0)&1&&pt(f,x.byteOffset-o-y+8,Z(x,8)-h)}if(y){const S=de(g,["saio"]);for(let x=0;x<S.length;x++){const T=S[x],w=T[0]===0?4:8;let I=Z(T,0)&1?12:4,R=Z(T,I);for(I+=4;R--;I+=w){const A=I+w-4;pt(f,T.byteOffset-o-y+A,Z(T,A)-y)}}}}}if(i){const{durationOffset:m,value:g}=i;pt(f,m-p(m),g)}return r!==void 0?f.subarray(0,r-h):f}function EH(n,e){const t=n.byteLength;for(let r=0;r<t;){const i=Z(n,r);if(i>8&&Z(n,r+4)===ce[e])return!0;r=i>1?r+i:t}return!1}function de(n,e){const t=[];return e.length&&OL(n,e,0,0,n.byteLength,t),t}function OL(n,e,t,r,i,s){const a=e[t];if(a?.length!==4)return;const o=a.charCodeAt(0),l=a.charCodeAt(1),u=a.charCodeAt(2),c=a.charCodeAt(3),d=e.length-1;for(let f=r;f<i;){const h=f+8<=i,p=f+4<=i?n[f]*16777216+(n[f+1]<<16|n[f+2]<<8|n[f+3]):Z(n,f),m=p>1?f+p:i;if(h&&n[f+4]===o&&n[f+5]===l&&n[f+6]===u&&n[f+7]===c){const g=Math.min(m,i);t===d?s.push(n.subarray(f+8,g)):OL(n,e,t+1,f+8,g,s)}f=m}}function xH(n){const e=[],t=n[0];let r=8;const i=Z(n,r);r+=4;let s=0,a=0;t===0?(s=Z(n,r),a=Z(n,r+4),r+=8):(s=HT(n,r),a=HT(n,r+8),r+=16),r+=2;let o=n.length+a;const l=DL(n,r);r+=2;
vendor: 9,033 bytes, line 74
74for(let u=0;u<l;u++){let c=r;const d=Z(n,c);c+=4;const f=d&2147483647;if((d&2147483648)>>>31===1)return Pe.warn("SIDX has hierarchical references (not supported)"),null;const p=Z(n,c);c+=4,e.push({referenceSize:f,subsegmentDuration:p,info:{duration:p/i,start:o,end:o+f-1}}),o+=f,c+=4,r=c}return{earliestPresentationTime:s,timescale:i,version:t,referencesCount:l,references:e}}function ML(n){const e=[],t=de(n,["moov","trak"]);for(let i=0;i<t.length;i++){const s=t[i],a=de(s,["tkhd"])[0];if(a){let o=a[0];const l=Z(a,o===0?12:20),u=de(s,["mdia","mdhd"])[0];if(u){o=u[0];const c=Z(u,o===0?12:20),d=de(s,["mdia","hdlr"])[0];if(d){const f=gr(d.subarray(8,12)),h={soun:He.AUDIO,vide:He.VIDEO}[f],p=de(s,["mdia","minf","stbl","stsd"])[0],m=TH(p);h?(e[l]={timescale:c,type:h,stsd:m},e[h]=ie({timescale:c,id:l},m)):e[l]={timescale:c,type:f,stsd:m}}}}}return de(n,["moov","mvex","trex"]).forEach(i=>{const s=Z(i,4),a=e[s];a&&(a.default={duration:Z(i,12),sampleSize:Z(i,16),flags:Z(i,20)})}),e}function TH(n){const e=n.subarray(8),t=e.subarray(86),r=gr(e.subarray(4,8));let i=r,s;const a=r==="enca"||r==="encv";if(a){const u=de(e,[r])[0].subarray(r==="enca"?28:78);de(u,["sinf"]).forEach(d=>{const f=de(d,["schm"])[0];if(f){const h=gr(f.subarray(4,8));if(h==="cbcs"||h==="cenc"){const p=de(d,["frma"])[0];p&&(i=gr(p))}}})}const o=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const l=de(t,["avcC"])[0];l&&l.length>3&&(i+="."+Lc(l[1])+Lc(l[2])+Lc(l[3]),s=Ac(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const l=de(e,[r])[0],u=de(l.subarray(28),["esds"])[0];if(u&&u.length>7){let c=4;if(u[c++]!==3)break;c=sm(u,c),c+=2;const d=u[c++];if(d&128&&(c+=2),d&64&&(c+=u[c++]),u[c++]!==4)break;c=sm(u,c);const f=u[c++];if(f===64)i+="."+Lc(f);else break;if(c+=12,u[c++]!==5)break;c=sm(u,c);const h=u[c++];let p=(h&248)>>3;p===31&&(p+=1+((h&7)<<3)+((u[c]&224)>>5)),i+="."+p}break}case"hvc1":case"hev1":{const l=de(t,["hvcC"])[0];if(l&&l.length>12){const u=l[1],c=["","A","B","C"][u>>6],d=u&31,f=Z(l,2),h=(u&32)>>5?"H":"L",p=l[12],m=l.subarray(6,12);i+="."+c+d,i+="."+_H(f).toString(16).toUpperCase(),i+="."+h+p;let g="";for(let y=m.length;y--;){const v=m[y];(v||g)&&(g="."+v.toString(16).toUpperCase()+g)}i+=g}s=Ac(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=Ac(i,t)||i;break}case"vp09":{const l=de(t,["vpcC"])[0];if(l&&l.length>6){const u=l[4],c=l[5],d=l[6]>>4&15;i+="."+wr(u)+"."+wr(c)+"."+wr(d)}break}case"av01":{const l=de(t,["av1C"])[0];if(l&&l.length>2){const u=l[1]>>>5,c=l[1]&31,d=l[2]>>>7?"H":"M",f=(l[2]&64)>>6,h=(l[2]&32)>>5,p=u===2&&f?h?12:10:f?10:8,m=(l[2]&16)>>4,g=(l[2]&8)>>3,y=(l[2]&4)>>2,v=l[2]&3;i+="."+u+"."+wr(c)+d+"."+wr(p)+"."+m+"."+g+y+v+"."+wr(1)+"."+wr(1)+"."+wr(1)+"."+0,s=Ac("dav1",t)}break}}return{codec:i,encrypted:a,supplemental:s}}function Ac(n,e){const t=de(e,["dvvC"]),r=t.length?t[0]:de(e,["dvcC"])[0];if(r){const i=r[2]>>1&127,s=r[2]<<5&32|r[3]>>3&31;return n+"."+wr(i)+"."+wr(s)}}function _H(n){let e=0;for(let t=0;t<32;t++)e|=(n>>t&1)<<31-t;return e>>>0}function sm(n,e){const t=e+5;for(;n[e++]&128&&e<t;);return e}function Lc(n){return("0"+n.toString(16).toUpperCase()).slice(-2)}function wr(n){return(n<10?"0":"")+n}function bH(n,e){if(!n||!e)return;const t=e.keyId;t?.byteLength===16&&e.isCommonEncryption&&FL(n,(r,i)=>{const s=r.subarray(8,24);s.some(a=>a!==0)||(Pe.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${St(s)} -> ${St(t)}`),r.set(t,8))})}function IH(n){const e=[];return FL(n,t=>e.push(t.subarray(8,24))),e}function FL(n,e){de(n,["moov","trak"]).forEach(r=>{const i=de(r,["mdia","minf","stbl","stsd"])[0];if(!i)return;const s=i.subarray(8);let a=de(s,["enca"]);const o=a.length>0;o||(a=de(s,["encv"])),a.forEach(l=>{const u=o?l.subarray(28):l.subarray(78);de(u,["sinf"]).forEach(d=>{const f=NL(d);f&&e(f,o)})})})}function NL(n){const e=de(n,["schm"])[0];if(e){const t=gr(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const r=de(n,["schi","tenc"])[0];if(r)return r}}}let WT;function wH(n){return typeof TextDecoder>"u"?In(n):(WT||(WT=new TextDecoder("utf-8"))).decode(n).replace(/\0/g,"")}function RH(n){const e=n.byteLength,t=[];for(let r=0;r<e;){const i=r+8<=e,s=r+4<=e?n[r]*16777216+(n[r+1]<<16|n[r+2]<<8|n[r+3]):Z(n,r),a=s>1?r+s:e;if(i&&n[r+4]===109&&n[r+5]===111&&n[r+6]===111&&n[r+7]===102){const o=Math.min(a,e);for(let l=r+8;l<o;){const u=l+8<=o,c=l+4<=o?n[l]*16777216+(n[l+1]<<16|n[l+2]<<8|n[l+3]):Z(n,l),d=c>1?l+c:o;if(u&&n[l+4]===116&&n[l+5]===114&&n[l+6]===97&&n[l+7]===102){const f=Math.min(d,o);let h,p;const m=[];for(let g=l+8;g<f;){const y=g+8<=f,v=g+4<=f?n[g]*16777216+(n[g+1]<<16|n[g+2]<<8|n[g+3]):Z(n,g),S=v>1?g+v:f;if(y&&n[g+4]===116){const x=Math.min(S,f);n[g+5]===102&&n[g+6]===104&&n[g+7]===100?p||(p=n.subarray(g+8,x)):n[g+5]===102&&n[g+6]===100&&n[g+7]===116?h||(h=n.subarray(g+8,x)):n[g+5]===114&&n[g+6]===117&&n[g+7]===110&&m.push(n.subarray(g+8,x))}g=S}t.push({moofOffset:n.byteOffset+r,tfdt:h,tfhd:p,truns:m})}l=d}}r=a}return t}function AH(n,e,t,r,i=!0){return UL(n,e,r,i)}function LH(n,e,t,r,i=!1){const s=[],a=e.samples,o=UL(a,t,r,i,{isHEVCFlavor:qu(e.codec),samples:s,timeOffset:n,timescale:e.timescale,trackId:e.id});return{samples:s,sampleData:{includeSampleDetails:i,tracks:o}}}function UL(n,e,t,r,i){const s={};let a=!1;const o=RH(n),l=n.byteLength;for(let d=0;d<o.length;d++){const{moofOffset:f,tfdt:h,tfhd:p,truns:m}=o[d],g=Z(p,4),y=e[g];if(!y)continue;const v=s[g]||(s[g]={start:NaN,duration:0,sampleCount:0,trun:[],timescale:y.timescale,type:y.type});let S;if(h){const M=h[0];S=Z(h,4),M===1&&(S===Ir?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(S*=Ir+1,S+=Z(h,8))),X(S)&&(!X(v.start)||S<v.start)&&(v.start=S),i&&X(S)&&(i.timeOffset=S/i.timescale)}const x=i?.trackId===g&&y.type===He.VIDEO,T=y.default,w=Z(p,0)&16777215;let I=T?.duration||0,R,A=T?.sampleSize||0,b=8;w&1&&(b+=8),w&2&&(b+=4),w&8&&(I=Z(p,b),R=p.byteOffset-n.byteOffset+b,b+=4),w&16&&(A=Z(p,b));let C=0;const k=(w&1)!==0,$=!k&&(w&131072)!==0;k?(C=Z(p,8),C*=Math.pow(2,32),C+=Z(p,12)):$&&(C=f);let U=S||0,N=0,D=I;for(let M=0;M<m.length;M++){const L=m[M],O=Z(L,4),B=v.sampleCount;v.sampleCount+=O;const G=L[3]&1;let j=0;const W=L[3]&4,z=L[2]&1,Y=L[2]&2,V=L[2]&4,J=L[2]&8;let ae=8;G&&(j=S0(L,ae),ae+=4),W&&(!(L[ae+1]&1)&&v.keyFrameIndex===void 0&&(v.keyFrameIndex=B),ae+=4);let _e=C+j;if(!r&&L[1]===0&&L[2]===6&&L[3]===1){var u,c;const je=U,yt=_e,Rt=ae;let ee=-1,Ee=0,xe=0,tt=(u=i?.timeOffset)!=null?u:0;const oe=I/((c=i?.timescale)!=null?c:1),Ve=i?.isHEVCFlavor===!0,pe=Ve?2:1;for(let ue=0;ue<O;ue++){const ht=L[ae]===0?L[ae+1]<<16|L[ae+2]<<8|L[ae+3]:Z(L,ae),Pn=ee===-1&&v.keyFrameIndex===void 0&&(L[ae+5]&1)===0;ae+=8;const gn=_e+ht;if(x){if(ht>0){let jt=_e;do{const Ei=n[jt]===0?n[jt+1]<<16|n[jt+2]<<8|n[jt+3]:Z(n,jt);jt+=4;const zr=n[jt],Xn=Ve?zr>>1&63:zr&31;(Ve?Xn===39||Xn===40:Xn===6)&&fu(n.subarray(jt,jt+Ei),pe,tt,i.samples),jt+=Ei}while(jt<gn)}tt+=oe}_e=gn,Pn&&(ee=ue,Ee=_e)}if(_e<=l)xe=O;else{let ue=yt,ht=Rt;for(let Pn=0;Pn<O;Pn++){const gn=L[ht]===0?L[ht+1]<<16|L[ht+2]<<8|L[ht+3]:Z(L,ht);if(ue+=gn,ue>l)break;xe=Pn+1,ht+=8}}if(x&&(i.timeOffset=tt),ee!==-1&&Ee<=l&&v.keyFrameIndex===void 0&&(v.keyFrameIndex=ee,v.keyFrameStart=je+ee*I),xe){(!X(v.ptsMin)||je<v.ptsMin)&&(v.ptsMin=je);const ue=je+xe*I;(!X(v.ptsMax)||ue>v.ptsMax)&&(v.ptsMax=ue)}const Qe=I*O;U=je+Qe,N+=Qe;continue}let Ge,Pt;r&&(Ge=[],Pt={sampleOffset:_e,samples:Ge,defaultSampleDurationOffset:R},_e<=l&&v.trun.push(Pt));let Yn;for(let je=0;je<O;je++){let yt;z?(r&&(yt=L.byteOffset-n.byteOffset+ae),D=Z(L,ae),ae+=4):D=I,Y?(Yn=Z(L,ae),ae+=4):Yn=A;let Rt,ee;V&&(ee=L[ae+1]&1?1:0,r&&(Rt={isNonSync:ee,dependsOn:(L[ae]&3)===1?1:2}),ae+=4);let Ee=0;if(J&&(Ee=L[0]===0?Z(L,ae):S0(L,ae),ae+=4),x){let xe=_e,tt=0;for(;tt<Yn;){const oe=Z(n,xe);xe+=4,BL(i.isHEVCFlavor,n[xe])&&fu(n.subarray(xe,xe+oe),i.isHEVCFlavor?2:1,i.timeOffset+Ee/i.timescale,i.samples),xe+=oe,tt+=oe+4}i.timeOffset+=D/i.timescale}if(_e+=Yn,_e<=l){Pt&&yt!==void 0&&(Pt.lastSampleDurationOffset=yt),ee===0&&v.keyFrameIndex===void 0&&(v.keyFrameIndex=je,v.keyFrameStart=U);const xe=U+Ee;(!X(v.ptsMin)||xe<v.ptsMin)&&(v.ptsMin=xe),(!X(v.ptsMax)||xe+D>v.ptsMax)&&(v.ptsMax=xe+D),Ge&&(Ge[je]={cts:Ee,duration:D,flags:Rt,size:Yn})}U+=D,N+=D}!N&&I&&(N+=I*O)}v.duration+=N,v.duration&&(a=!0)}if(!a){let d=1/0,f=0;const h=de(n,["sidx"]);for(let p=0;p<h.length;p++){const m=xH(h[p]);if(m!=null&&m.references){d=Math.min(d,m.earliestPresentationTime/m.timescale);const g=m.references.reduce((y,v)=>y+v.info.duration||0,0);f=Math.max(f,g+m.earliestPresentationTime/m.timescale)}}f&&X(f)&&Object.keys(s).forEach(p=>{s[p].duration||(s[p].duration=f*s[p].timescale-s[p].start)})}return s}function CH(n){const e={valid:null,remainder:null},t=de(n,["moof"]);if(t.length<2)return e.remainder=n,e;const r=t[t.length-1];return e.valid=n.slice(0,r.byteOffset-8),e.remainder=n.slice(r.byteOffset-8),e}function Kn(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function kH(n,e){const t=[],r=e.samples,i=e.timescale,s=e.id;let a=!1;
vendor: 13,412 bytes, line 74
74return de(r,["moof"]).map(l=>{const u=l.byteOffset-8;de(l,["traf"]).map(d=>{const f=de(d,["tfdt"]).map(h=>{const p=h[0];let m=Z(h,4);return p===1&&(m*=Math.pow(2,32),m+=Z(h,8)),m/i})[0];return f!==void 0&&(n=f),de(d,["tfhd"]).map(h=>{const p=Z(h,4),m=Z(h,0)&16777215,g=(m&1)!==0;let y=0;const v=(m&2)!==0,S=(m&8)!==0;let x=0;const T=(m&16)!==0;let w=0;const I=(m&32)!==0,R=!g&&(m&131072)!==0;let A=8;p===s&&(g?(y=Z(h,A),A+=4,y*=Math.pow(2,32),y+=Z(h,A),A+=4):R&&(y=u),v&&(A+=4),S&&(x=Z(h,A),A+=4),T&&(w=Z(h,A),A+=4),I&&(A+=4),e.type==="video"&&(a=qu(e.codec)),de(d,["trun"]).map(b=>{const C=b[0],k=Z(b,0)&16777215,$=(k&1)!==0;let U=0;const N=(k&4)!==0,D=(k&256)!==0;let M=0;const L=(k&512)!==0;let O=0;const B=(k&1024)!==0,G=(k&2048)!==0;let j=0;const W=Z(b,4);let z=8;$&&(U=Z(b,z),z+=4),N&&(z+=4);let Y=y+U;for(let V=0;V<W;V++){if(D?(M=Z(b,z),z+=4):M=x,L?(O=Z(b,z),z+=4):O=w,B&&(z+=4),G&&(C===0?j=Z(b,z):j=S0(b,z),z+=4),e.type===He.VIDEO){let J=0;for(;J<O;){const ae=Z(r,Y);if(Y+=4,BL(a,r[Y])){const _e=r.subarray(Y,Y+ae);fu(_e,a?2:1,n+j/i,t)}Y+=ae,J+=ae+4}}n+=M/i}}))})})}),t}function qu(n){if(!n)return!1;const e=n.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function BL(n,e){if(n){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function fu(n,e,t,r){const i=$L(n);let s=0;s+=e;let a=0,o=0,l=0;for(;s<i.length;){a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(l===255);o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(l===255);const u=i.length-s;let c=s;if(o<u)s+=o;else if(o>u){Pe.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(a===4){if(i[c++]===181){const f=DL(i,c);if(c+=2,f===49){const h=Z(i,c);if(c+=4,h===1195456820){const p=i[c++];if(p===3){const m=i[c++],g=31&m,y=64&m,v=y?2+g*3:0,S=new Uint8Array(v);if(y){S[0]=m;for(let x=1;x<v;x++)S[x]=i[c++]}r.push({type:p,payloadType:a,pts:t,bytes:S})}}}}}else if(a===5&&o>16){const d=[];for(let p=0;p<16;p++){const m=i[c++].toString(16);d.push(m.length==1?"0"+m:m),(p===3||p===5||p===7||p===9)&&d.push("-")}const f=o-16,h=new Uint8Array(f);for(let p=0;p<f;p++)h[p]=i[c++];r.push({payloadType:a,pts:t,uuid:d.join(""),userData:wH(h),userDataBytes:h})}}}function $L(n){const e=n.byteLength;let t,r=n.indexOf(3,3);for(;r!==-1;)n[r-1]===0&&n[r-2]===0&&(t||(t=[])).push(r),r=n.indexOf(3,r+1);if(!t)return n;const i=e-t.length,s=new Uint8Array(i);let a=0,o=0;for(let l=0;l<i;o++,l++)o===t[a]&&(o++,a++),s[l]=n[o];return s}function DH(n){const e=n[0];let t="",r="",i=0,s=0,a,o=0,l=0,u=4;if(e===0){const d=Rc(n,u),f=d!==null?Rc(n,u+d.length):null;d!==null&&f!==null?(t=d,r=f,u+=d.length+f.length,i=Z(n,u),u+=4,s=Z(n,u),u+=4,o=Z(n,u),u+=4,l=Z(n,u),u+=4):(Pe.warn(`Unterminated ${d===null?"scheme_id_uri":"value"} in parsing emsg box: version 0 box ends inside a string, dropping all of its fields`),u=n.length)}else if(e===1){i=Z(n,u),u+=4;const d=Z(n,u);u+=4;const f=Z(n,u);u+=4,a=2**32*d+f,Uj(a)||(a=Number.MAX_SAFE_INTEGER,Pe.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Z(n,u),u+=4,l=Z(n,u),u+=4;const h=Rc(n,u),p=h!==null?Rc(n,u+h.length):null;h!==null&&(t=h,u+=h.length),p!==null?(r=p,u+=p.length):(Pe.warn(`Unterminated ${h===null?"scheme_id_uri":"value"} in parsing emsg box: version 1 box ends inside a string, dropping its ${h===null?"strings and payload":"value and payload"}`),u=n.length)}const c=n.subarray(u,n.byteLength);return{schemeIdUri:t,value:r,timeScale:i,presentationTime:a,presentationTimeDelta:s,eventDuration:o,id:l,payload:c}}function PH(n,...e){const t=e.length;let r=8,i=t;for(;i--;)r+=e[i].byteLength;const s=new Uint8Array(r);for(s[0]=r>>24&255,s[1]=r>>16&255,s[2]=r>>8&255,s[3]=r&255,s.set(n,4),i=0,r=8;i<t;i++)s.set(e[i],r),r+=e[i].byteLength;return s}function OH(n,e,t){if(n.byteLength!==16)throw new RangeError("Invalid system id");let r,i;r=0,i=new Uint8Array;let s;r>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),PH([112,115,115,104],new Uint8Array([r,0,0,0]),n,s,i,a,t)}function GL(n){const e=[];if(n instanceof ArrayBuffer){const t=n.byteLength;let r=0;for(;r+32<t;){const i=new DataView(n,r),s=FH(i);e.push(s),r+=s.size}}return e}function MH(n){const e=[];for(let t=0;t<n.length;){const r=n[t++],i=r&7;if(i===0){for(;n[t++]&128;);continue}if(i!==2){t+=i===1?8:4;continue}let s=0;for(let a=0,o=128;o&128;a+=7)s|=((o=n[t++])&127)<<a;if(r>>3===2)if(s===32){const a=new Uint8Array(16);for(let o=0;o<16;o++)a[o]=parseInt(String.fromCharCode(n[t+o*2],n[t+o*2+1]),16);e.push(a)}else s===16&&e.push(n.subarray(t,t+16));t+=s}return e}function FH(n){const e=n.getUint32(0),t=n.byteOffset,r=n.byteLength;if(r<e)return{offset:t,size:r};if(n.getUint32(4)!==1886614376)return{offset:t,size:e};const s=n.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const a=n.buffer,o=St(new Uint8Array(a,t+12,16));let l=null,u=null,c=0;if(s===0)c=28;else{const f=n.getUint32(28);if(!f||r<32+f*16)return{offset:t,size:e};l=[];for(let h=0;h<f;h++)l.push(new Uint8Array(a,t+32+h*16,16));c=32+f*16}if(!c)return{offset:t,size:e};const d=n.getUint32(c);return e-32<d?{offset:t,size:e}:(u=new Uint8Array(a,t+c+4,d),s===0&&(l=MH(u)),{version:s,systemId:o,kids:l,data:u,offset:t,size:e})}const Co=jL("userAgent"),NH=jL("vendor");let am,om,lm;function jL(n){try{return navigator[n]||""}catch{}return""}function UH(){if(lm===void 0){const n=Co.match(/Safari\/(\d+)/i);lm=n?parseInt(n[1]):0}return lm}function bl(){if(am===void 0){const n=Co.match(/Chrome\/(\d+)/i);am=n?parseInt(n[1]):0}return am}function BH(){if(om===void 0){const n=Co.match(/Firefox\/(\d+)/i);om=n?parseInt(n[1]):0}return om}function HL(){return/\(Windows.+Firefox\//i.test(Co)}function $H(){return NH.indexOf("Apple")>-1||/iPhone|iPad|iPod/.test(Co)}function GH(){return/Android/.test(Co)}const ho={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1},image:{mjpg:1}};function Kv(n,e){const t=ho[e];return!!t&&!!t[n.slice(0,4)]}function hu(n,e,t=!0){return!n.split(",").some(r=>!qv(r,e,t))}function qv(n,e,t=!0){var r;const i=is(t);return(r=i?.isTypeSupported(pu(n,e)))!=null?r:!1}function pu(n,e){return`${e}/mp4;codecs=${n}`}function zT(n){if(n){const e=n.substring(0,4);return ho.video[e]}return 2}function bf(n){const e=HL();return n.split(",").reduce((t,r)=>{const s=e&&qu(r)?9:ho.video[r];return s?(s*2+t)/(t?3:2):(ho.audio[r]+t)/(t?2:1)},0)}const um={};function jH(n,e=!0){if(um[n])return um[n];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[n];for(let i=0;i<t.length;i++){var r;if(qv(t[i],"audio",e))return um[n]=t[i],t[i];if(t[i]==="mp3"&&(r=is(e))!=null&&r.isTypeSupported("audio/mpeg"))return""}return n}const HH=/flac|opus|mp4a\.40\.34/i;function If(n,e=!0){return n.replace(HH,t=>jH(t.toLowerCase(),e))}function VH(n,e){const t=[];if(n){const r=n.split(",");for(let i=0;i<r.length;i++)Kv(r[i],"video")||t.push(r[i])}return e&&t.push(e),t.join(",")}function _d(n,e){if(n&&(n.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(n)!==-1)&&(KT(n,"audio")||KT(n,"video")))return n;if(e){const t=e.split(",");if(t.length>1){if(n){for(let r=t.length;r--;)if(t[r].substring(0,4)===n.substring(0,4))return t[r]}return t[0]}}return e||n}function KT(n,e){return Kv(n,e)&&qv(n,e)}function WH(n){const e=n.split(",");for(let t=0;t<e.length;t++){const r=e[t].split(".");r.length>2&&r[0]==="avc1"&&(e[t]=`avc1.${parseInt(r[1]).toString(16)}${("000"+parseInt(r[2]).toString(16)).slice(-4)}`)}return e.join(",")}function zH(n){if(n.startsWith("av01.")){const e=n.split("."),t=["0","111","01","01","01","0"];for(let r=e.length;r>4&&r<10;r++)e[r]=t[r-4];return e.join(".")}return n}function qT(n){const e=is(n)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function x0(n){return n.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const KH={supported:!0,powerEfficient:!0,smooth:!0},qH={supported:!1,smooth:!1,powerEfficient:!1},VL={supported:!0,configurations:[],decodingInfoResults:[KH]};function WL(n,e){return{supported:!1,configurations:e,decodingInfoResults:[qH],error:n}}function YH(n,e,t,r,i,s){const a=n.videoCodec,o=n.audioCodec?n.audioGroups:null,l=s?.audioCodec,u=s?.channels,c=u?parseInt(u):l?1/0:2;let d=null;if(o!=null&&o.length)try{o.length===1&&o[0]?d=e.groups[o[0]].channels:d=o.reduce((f,h)=>{if(h){const p=e.groups[h];if(!p)throw new Error(`Audio track group ${h} not found`);Object.keys(p.channels).forEach(m=>{f[m]=(f[m]||0)+p.channels[m]})}return f},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(f=>qu(f))||n.width>1920&&n.height>1088||n.height>1920&&n.width>1088||n.frameRate>Math.max(r,30)||n.videoRange!=="SDR"&&n.videoRange!==t||n.bitrate>Math.max(i,8e6))||!!d&&X(c)&&Object.keys(d).some(f=>parseInt(f)>c)}function zL(n,e,t,r={}){const i=n.videoCodec;if(!i&&!n.audioCodec||!t)return Promise.resolve(VL);const s=[],a=XH(n),o=a.length,l=QH(n,e,o>0),u=l.length;for(let c=o||1*u||1;c--;){const d={type:"media-source"};if(o&&(d.video=a[c%o]),u){d.audio=l[c%u];const f=d.audio.bitrate;d.video&&f&&(d.video.bitrate-=f)}s.push(d)}if(i){const c=navigator.userAgent;if(i.split(",").some(d=>qu(d))&&HL())return Promise.resolve(WL(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${c})`),s))}return Promise.all(s.map(c=>{const d=JH(c);return r[d]||(r[d]=t.decodingInfo(c))})).then(c=>({supported:!c.some(d=>!d.supported),configurations:s,decodingInfoResults:c})).catch(c=>({supported:!1,configurations:s,decodingInfoResults:[],error:c}))}function XH(n){var e;const t=(e=n.videoCodec)==null?void 0:e.split(","),r=qL(n),i=n.width||640,s=n.height||480,a=n.frameRate||30,o=n.videoRange.toLowerCase();return t?t.map(l=>{const u={contentType:pu(zH(l),"video"),width:i,height:s,bitrate:r,framerate:a};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function QH(n,e,t){var r;const i=(r=n.audioCodec)==null?void 0:r.split(","),s=qL(n);return i&&n.audioGroups?n.audioGroups.reduce((a,o)=>{var l;const u=o?(l=e.groups[o])==null?void 0:l.tracks:null;return u?u.reduce((c,d)=>{if(d.groupId===o){const f=parseFloat(d.channels||"");i.forEach(h=>{const p={contentType:pu(h,"audio"),bitrate:t?KL(h,s):s};f&&(p.channels=""+f),c.push(p)})}return c},a):a},[]):[]}function KL(n,e){if(e<=1)return 1;let t=128e3;return n==="ec-3"?t=768e3:n==="ac-3"&&(t=64e4),Math.min(e/2,t)}function qL(n){return Math.ceil(Math.max(n.bitrate*.9,n.averageBitrate)/1e3)*1e3||1}function JH(n){let e="";const{audio:t,video:r}=n;if(r){const i=x0(r.contentType);e+=`${i}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||"sd"}_${Math.ceil(r.bitrate/1e5)}`}if(t){const i=x0(t.contentType);e+=`${r?"_":""}${i}_c${t.channels}`}return e}function Xi(n,e,t){const r=encodeURIComponent(e),i=`${r}=${encodeURIComponent(t)}`;let s=!1;const a=[];n.search.substring(1).split("&").forEach(o=>{o===r||o.startsWith(r+"=")?s||(a.push(i),s=!0):o&&a.push(o)}),s||a.push(i),n.search=a.join("&")}const T0=["NONE","TYPE-0","TYPE-1",null];function ZH(n){return T0.indexOf(n)>-1}const wf=["SDR","PQ","HLG"];function eV(n){return!!n&&wf.indexOf(n)>-1}var bd={No:"",Yes:"YES",v2:"v2"};function YT(n){const{canSkipUntil:e,canSkipDateRanges:t,age:r}=n,i=r<e/2;return e&&i?t?bd.v2:bd.Yes:bd.No}class XT{constructor(e,t,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=r}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&Xi(t,"_HLS_msn",this.msn.toString()),this.part!==void 0&&Xi(t,"_HLS_part",this.part.toString()),this.skip&&Xi(t,"_HLS_skip",this.skip),t.href}}class mu{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.imageCodec=void 0,this.iframes=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loadErrorTime=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,"imageCodec"in e&&(this.imageCodec=e.imageCodec),this.codecSet=[e.videoCodec,e.audioCodec].filter(r=>!!r).map(r=>r.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const r=(t=e.supplemental)==null?void 0:t.videoCodec;r&&r!==e.videoCodec&&(this.codecSet+=`,${r.substring(0,4)}`)}
vendor: 4,286 bytes, line 74
74"iframes"in e&&e.iframes?this.iframes=!0:(this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES))}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return QT(this._audioGroups,e)}hasSubtitleGroup(e){return QT(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let r=this._audioGroups;r||(r=this._audioGroups=[]),r.indexOf(t)===-1&&r.push(t)}else if(e==="text"){let r=this._subtitleGroups;r||(r=this._subtitleGroups=[]),r.indexOf(t)===-1&&r.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function QT(n,e){return!e||!n?!1:n.indexOf(e)!==-1}function tV(){if(typeof matchMedia=="function"){const n=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(n.media!==e.media)return n.matches===!0}return!1}function nV(n,e){let t=!1,r=[];if(n&&(t=n!=="SDR",r=[n]),e){r=e.allowedVideoRanges||wf.slice(0);const i=r.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&tV(),t||(r=["SDR"])}return{preferHDR:t,allowedVideoRanges:r}}const rV=n=>{const e=new WeakSet;return(t,r)=>{if(n&&(r=n(t,r)),typeof r=="object"&&r!==null){if(e.has(r))return;e.add(r)}return r}},We=(n,e)=>JSON.stringify(n,rV(e));function iV(n,e,t,r,i){const s=Object.keys(n),a=r?.channels,o=r?.audioCodec,l=i?.videoCodec,u=a&&parseInt(a)===2;let c=!1,d=!1,f=1/0,h=1/0,p=1/0,m=1/0,g=0,y=[];const{preferHDR:v,allowedVideoRanges:S}=nV(e,i);for(let R=s.length;R--;){const A=n[s[R]];c||(c=A.channels[2]>0),f=Math.min(f,A.minHeight),h=Math.min(h,A.minFramerate),p=Math.min(p,A.minBitrate),S.filter(C=>A.videoRanges[C]>0).length>0&&(d=!0)}f=X(f)?f:0,h=X(h)?h:0;const x=Math.max(1080,f),T=Math.max(30,h);p=X(p)?p:t,t=Math.max(p,t),d||(e=void 0);const w=s.length>1;return{codecSet:s.reduce((R,A)=>{const b=n[A];if(A===R)return R;if(y=d?S.filter(C=>b.videoRanges[C]>0):[],w){if(b.minBitrate>t)return Tr(A,`min bitrate of ${b.minBitrate} > current estimate of ${t}`),R;if(!b.hasDefaultAudio)return Tr(A,"no renditions with default or auto-select sound found"),R;if(o&&A.indexOf(o.substring(0,4))%5!==0)return Tr(A,`audio codec preference "${o}" not found`),R;if(a&&!u){if(!b.channels[a])return Tr(A,`no renditions with ${a} channel sound found (channels options: ${Object.keys(b.channels)})`),R}else if((!o||u)&&c&&b.channels[2]===0)return Tr(A,"no renditions with stereo sound found"),R;if(b.minHeight>x)return Tr(A,`min resolution of ${b.minHeight} > maximum of ${x}`),R;if(b.minFramerate>T)return Tr(A,`min framerate of ${b.minFramerate} > maximum of ${T}`),R;if(!y.some(C=>b.videoRanges[C]>0))return Tr(A,`no variants with VIDEO-RANGE of ${We(y)} found`),R;if(l&&A.indexOf(l.substring(0,4))%5!==0)return Tr(A,`video codec preference "${l}" not found`),R;if(b.maxScore<g)return Tr(A,`max score of ${b.maxScore} < selected max of ${g}`),R}return R&&(bf(A)>=bf(R)||b.fragmentError>n[R].fragmentError)?R:(m=b.minIndex,g=b.maxScore,A)},void 0),videoRanges:y,preferHDR:v,minFramerate:h,minBitrate:p,minIndex:m}}function Tr(n,e){Pe.log(`[abr] start candidates with "${n}" ignored because ${e}`)}function YL(n){return n.reduce((e,t)=>{let r=e.groups[t.groupId];r||(r=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(t);const i=t.channels||"2";return r.channels[i]=(r.channels[i]||0)+1,r.hasDefault=r.hasDefault||t.default,r.hasAutoSelect=r.hasAutoSelect||t.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function sV(n,e,t,r){return n.slice(t,r+1).reduce((i,s,a)=>
vendor: 3,018 bytes, line 74
74{if(!s.codecSet)return i;const o=s.audioGroups;let l=i[s.codecSet];l||(i[s.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,s.bitrate);const u=Math.min(s.height,s.width);return l.minHeight=Math.min(l.minHeight,u),l.minFramerate=Math.min(l.minFramerate,s.frameRate),l.minIndex=Math.min(l.minIndex,a),l.maxScore=Math.max(l.maxScore,s.score),l.fragmentError+=s.fragmentError,l.videoRanges[s.videoRange]=(l.videoRanges[s.videoRange]||0)+1,o&&o.forEach(c=>{if(!c)return;const d=e.groups[c];d&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(f=>{l.channels[f]=(l.channels[f]||0)+d.channels[f]}))}),i},{})}function JT(n){if(!n)return n;const{lang:e,assocLang:t,characteristics:r,channels:i,audioCodec:s}=n;return{lang:e,assocLang:t,characteristics:r,channels:i,audioCodec:s}}function Pr(n,e,t){if("attrs"in n){const r=e.indexOf(n);if(r!==-1)return r}for(let r=0;r<e.length;r++){const i=e[r];if(Bs(n,i,t))return r}return-1}function Bs(n,e,t){const{groupId:r,name:i,lang:s,assocLang:a,default:o}=n,l=n.forced;return(r===void 0||e.groupId===r)&&(i===void 0||e.name===i)&&(s===void 0||aV(s,e.lang))&&(a===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(l===void 0||e.forced===l)&&(!("characteristics"in n)||oV(n.characteristics||"",e.characteristics))&&(t===void 0||t(n,e))}function aV(n,e="--"){return n.length===e.length?n===e:n.startsWith(e)||e.startsWith(n)}function oV(n,e=""){const t=n.split(","),r=e.split(",");return t.length===r.length&&!t.some(i=>r.indexOf(i)===-1)}function bs(n,e){const{audioCodec:t,channels:r}=n;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(r===void 0||r===(e.channels||"2"))}function lV(n,e,t,r,i){const s=e[r],o=e.reduce((f,h,p)=>{const m=h.uri;return(f[m]||(f[m]=[])).push(p),f},{})[s.uri];o.length>1&&(r=Math.max.apply(Math,o));const l=s.videoRange,u=s.frameRate,c=s.codecSet.substring(0,4),d=ZT(e,r,f=>{if(f.videoRange!==l||f.frameRate!==u||f.codecSet.substring(0,4)!==c)return!1;const h=f.audioGroups,p=t.filter(m=>gu(m.groupId,h));return Pr(n,p,i)>-1});return d>-1?d:ZT(e,r,f=>{const h=f.audioGroups,p=t.filter(m=>gu(m.groupId,h));return Pr(n,p,i)>-1})}function ZT(n,e,t){for(let r=e;r>-1;r--)if(t(n[r]))return r;for(let r=e+1;r<n.length;r++)if(t(n[r]))return r;return-1}function Rf(n,e){var t;return!!n&&n!==((t=e.loadLevelObj)==null?void 0:t.uri)}function gu(n,e){return e?e.indexOf(n)!==-1:!0}function XL(n,e){if(e||n){const t=Ne({},e);return n&&(n.videoCodec&&(t.videoCodec=n.videoCodec),n.videoRange&&(t.allowedVideoRanges=[n.videoRange])),t}}class uV extends Cn{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.co
vendor: 5,721 bytes, lines 74-84
74decTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var r;const{fragCurrent:i,partCurrent:s,hls:a}=this;if(!a)return;const{autoLevelEnabled:o,media:l}=a;if(!i||!l)return;const u=performance.now(),c=s?s.stats:i.stats,d=s?s.duration:i.duration,f=u-c.loading.start,h=a.minAutoLevel,p=i.level,m=this._nextAutoLevel;if(c.aborted||c.loaded&&c.loaded===c.total||p<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const g=m>-1&&m!==p,y=!!t||g;if(!y&&(l.paused||!l.playbackRate||!l.readyState))return;const v=a.mainForwardBufferInfo;if(!y&&v===null)return;const S=this.bwEstimator.getEstimateTTFB(),x=Math.abs(l.playbackRate);if(f<=Math.max(S,1e3*(d/(x*2))))return;const T=v?v.len/x:0,w=c.loading.first?c.loading.first-c.loading.start:-1,I=c.loaded&&w>-1,R=this.getBwEstimate(),A=a.levels,b=A[p],C=Math.max(c.loaded,Math.round(d*(i.bitrate||b.averageBitrate)/8));let k=I?f-w:f;k<1&&I&&(k=Math.min(f,c.loaded*8/R));const $=I?c.loaded*1e3/k:0,U=S/1e3,N=$?(C-c.loaded)/$:C*8/R+U;if(N<=T)return;const D=$?$*8:R,M=((r=t?.details||a.latestLevelDetails)==null?void 0:r.live)===!0,L=a.config.abrBandWidthUpFactor;let O=Number.POSITIVE_INFINITY,B;for(B=p-1;B>h;B--){const z=A[B].maxBitrate,Y=!A[B].details||M;if(O=this.getTimeToLoadFrag(U,D,d*z,Y),O<Math.min(T,d+U))break}if(O>=N||O>d*10)return;I?this.bwEstimator.sample(f-Math.min(S,w),c.loaded):this.bwEstimator.sampleTTFB(f);const G=A[B].maxBitrate;this.getBwEstimate()*L>G&&(this.firstAutoFloor=Math.min(B,a.firstLevel),this.resetEstimator(G));const j=this.findBestLevel(G,h,B,0,T,1,1);j>-1&&(B=j),this.warn(`Fragment ${i.sn}${s?" part "+s.index:""} of level ${p} is loading too slowly; 75 Fragment duration: ${i.duration.toFixed(3)} 76 Time to underbuffer: ${T.toFixed(3)} s 77 Estimated load time for current fragment: ${N.toFixed(3)} s 78 Estimated load time for down switch fragment: ${O.toFixed(3)} s 79 TTFB estimate: ${w|0} ms 80 Current BW estimate: ${X(R)?R|0:"Unknown"} bps 81 New BW estimate: ${this.getBwEstimate()|0} bps 82 Switching to level ${B} @ ${G|0} bps`),a.nextLoadLevel=a.nextAutoLevel=B,this.clearTimer();const W=()=>{this.clearTimer();const z=this.hls;if(this.fragCurrent===i&&z.loadLevel===B&&B>0){const Y=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${B>0?"and switching down":""} 83 Fragment duration: ${i.duration.toFixed(3)} s 84 Time to underbuffer: ${Y.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,B>h){let V=this.findBestLevel(z.levels[h].bitrate,h,B,0,Y,1,1);V===-1&&(V=h),z.nextLoadLevel=z.nextAutoLevel=V,this.firstAutoFloor=Math.min(V,z.firstLevel),this.resetEstimator(z.levels[V].bitrate)}}};g||N>O*2?W():this.timer=self.setInterval(W,O*1e3),a.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:s,stats:c})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){this.hls&&(e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator())}initEstimator(){const e=this.hls.config;return new Yj(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.audioTracksByGroup=this.codecTiers=this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const r=t.frag;if(!this.ignoreFragment(r)){if(!r.bitrateTest){var i;this.fragCurrent=r,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case F.BUFFER_ADD_CODEC_ERROR:case F.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case F.FRAG_LOAD_TIMEOUT:{const r=t.frag,{fragCurrent:i,partCurrent:s}=this;if(r&&g0(r,i)){const a=performance.now(),o=s?s.stats:r.stats,l=a-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(d,u),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}
vendor: 2,716 bytes, line 84
84getTimeToLoadFrag(e,t,r,i){const s=e+r/t,a=i?e+this.lastLevelLoadSec:0;return s+a}onLevelLoaded(e,t){const r=this.hls.config,{loading:i}=t.stats,s=i.end-i.first;X(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,t){var r;const{frag:i,part:s}=t,a=s?s.stats:i.stats;if(i.type===te.MAIN&&this.bwEstimator.sampleTTFB(a.loading.first-a.loading.start),!this.ignoreFragment(i)){if(this.clearTimer(),i.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,(r=this.hls)!=null&&r.config.abrMaxWithRealBitrate){const o=s?s.duration:i.duration,l=this.hls.levels[i.level],u=(l.loaded?l.loaded.bytes:0)+a.loaded,c=(l.loaded?l.loaded.duration:0)+o;l.loaded={bytes:u,duration:c},l.realBitrate=Math.round(8*u/c)}if(i.bitrateTest){const o={stats:a,frag:i,part:s,id:i.type};this.onFragBuffered(E.FRAG_BUFFERED,o),i.bitrateTest=!1}else this.lastLoadedFragLevel=i.level}}onFragBuffered(e,t){const{frag:r,part:i}=t,s=i!=null&&i.stats.loaded?i.stats:r.stats;if(s.aborted||this.ignoreFragment(r))return;const o=((r.bitrate||0)>=1e5?s.parsing.end:s.loading.end)-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,s.loaded),s.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=o/1e3:(this.bitrateTestDelay=0,this.firstAutoFloor>-1&&this.bwEstimator.canEstimate()&&(this.firstAutoFloor=-1))}ignoreFragment(e){return e.type!==te.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{hls:e}=this;if(!e)return 0;const{maxAutoLevel:t,minAutoLevel:r}=e,i=this.getBwEstimate(),s=this.getStarvationDelay(),a=e.config.maxStarvationDelay,o=this.findBestLevel(i,r,t,s/2,a,1,1);if(o>-1)return o;const l=e.firstLevel,u=this.firstAutoFloor===-1?1/0:this.firstAutoFloor,c=Math.min(Math.max(l,r),t,u);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${l} clamped to ${c}`),c}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){if(!this.hls)return-1;const e=this.forcedAutoLevel,r=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!r||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=r&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,s)&&a[e].loadError<=a[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}
84_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:r}=this;if(!r)return-1;if(r.levels.length<=1)return r.loadLevel;const{maxAutoLevel:i,config:s,minAutoLevel:a}=r,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),u=this.getStarvationDelay();let c=s.abrBandWidthFactor,d=s.abrBandWidthUpFactor;if(u){const g=this.findBestLevel(l,a,i,u,0,c,d);if(g>=0)return this.rebufferNotice=-1,g}let f=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const g=this.bitrateTestDelay;g&&(f=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-g,this.info(`bitrate test took ${Math.round(1e3*g)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),c=d=1)}const h=this.findBestLevel(l,a,i,u,f,c,d);if(this.rebufferNotice!==h&&(this.rebufferNotice=h,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${h}`)),h>-1)return h;const p=r.levels[a],m=r.loadLevelObj;return m&&p?.bitrate<m.bitrate?a:r.loadLevel}getStarvationDelay(){const e=this.hls,t=e?.media;if(!t)return 1/0;const r=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/r}getBwEstimate(){return this.bwEstimator.getEstimate()}findBestLevel(e,t,r,i,s,a,o){const{hls:l,lastLoadedFragLevel:u,fragCurrent:c,partCurrent:d}=this;if(!l)return-1;const f=i+s,h=u===-1?l.firstLevel:u,{levels:p,allAudioTracks:m,loadLevel:g,latestLevelDetails:y,config:v}=l;if(p.length===1)return 0;const S=p[h],x=!!(y!=null&&y.live),T=g===-1||u===-1;let w,I="SDR",R=S?.frameRate||0;const{audioPreference:A,videoPreference:b}=v,C=this.audioTracksByGroup||(this.audioTracksByGroup=YL(m));let k=-1;if(T){if(this.firstSelection!==-1)return this.firstSelection;const M=this.codecTiers||(this.codecTiers=sV(p,C,t,r)),L=iV(M,I,e,A,b),{codecSet:O,videoRanges:B,minFramerate:G,minBitrate:j,minIndex:W,preferHDR:z}=L;k=W,w=O,I=z?B[B.length-1]:B[0],R=G,e=Math.max(e,j),this.log(`picked start tier ${We(L)}`)}else w=S?.codecSet,I=S?.videoRange;const $=d?d.duration:c?c.duration:0,U=this.bwEstimator.getEstimateTTFB()/1e3,N=[];for(let M=r;M>=t;M--){var D;const L=p[M],O=M>h;if(!L)continue;if(v.useMediaCapabilities&&!L.supportedResult&&!L.supportedPromise){const V=navigator.mediaCapabilities;typeof V?.decodingInfo=="function"&&YH(L,C,I,R,e,A)?(L.supportedPromise=zL(L,C,V,this.supportedCache),L.supportedPromise.then(J=>{if(!this.hls)return;L.supportedResult=J;const ae=this.hls.levels,_e=ae.indexOf(L);J.error?this.warn(`MediaCapabilities decodingInfo error: "${J.error}" for level ${_e} ${We(J)}`):J.supported?J.decodingInfoResults.some(Ge=>Ge.smooth===!1||Ge.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${_e} not smooth or powerEfficient: ${We(J)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${_e} ${We(J)}`),_e>-1&&ae.length>1&&(this.log(`Removing unsupported level ${_e}`),this.hls.removeLevel(_e),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(J=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${J}`)})):L.supportedResult=VL}if((w&&L.codecSet!==w||I&&L.videoRange!==I||O&&R>L.frameRate||!O&&R>0&&R<L.frameRate||(D=L.supportedResult)!=null&&(D=D.decodingInfoResults)!=null&&D.some(V=>V.smooth===!1))&&(!T||M!==k)){N.push(M);continue}const B=L.details,G=(d?B?.partTarget:B?.averagetargetduration)||$||1;let j;O?j=o*e:j=a*e;const W=$&&i>=$*2&&s===0?L.averageBitrate:L.maxBitrate,z=this.getTimeToLoadFrag(U,j,W*G,!B||B.live);if(j>=W&&(M===u||L.loadError===0&&L.fragmentError===0||_L(L,v.errorPenaltyExpireMs))&&(z<=U||!X(z)||x&&!this.bitrateTestDelay||z<f)){const V=this.forcedAutoLevel;return M!==g&&(V===-1||V!==g)&&(N.length&&this.trace(`Skipped level(s) ${N.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${p[N[0]].codecs}" ${p[N[0]].videoRange}; not compatible with "${w}" ${I}`),this.info(`switch candidate:${h}->${M} adjustedbw(${Math.round(j)})-bitrate=${Math.round(j-W)} ttfb:${U.toFixed(1)} avgDuration:${G.toFixed(1)} maxFetchDuration:${f.toFixed(1)} fetchDuration:${z.toFixed(1)} firstSelection:${T} codecSet:${L.codecSet} videoRange:${L.videoRange} hls.loadLevel:${g}`)),T&&(this.firstSelection=M),M}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){if(!this.hls)return-1;const{maxAutoLevel:t,minAutoLevel:r}=this.hls;return Math.min(Math.max(e,r),t)}}const QL={search:function(n,e){let t=0,r=n.length-1,i=null,s=null;for(;t<=r;){i=(t+r)/2|0,s=n[i];const a=e(s);if(a>0)t=i+1;else if(a<0)r=i-1;else return s}return null}};
vendor: 20,986 bytes, line 84
84function cV(n,e,t){if(e===null||!Array.isArray(n)||!n.length||!X(e))return null;const r=n[0].programDateTime;if(e<(r||0))return null;const i=n[n.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let s=0;s<n.length;++s){const a=n[s];if(fV(e,t,a))return a}return null}function po(n,e,t=0,r=0,i=.005){let s=null;if(n){s=e[1+n.sn-e[0].sn]||null;const o=n.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),s&&n.level!==s.level&&s.end<=n.end&&(s=e[2+n.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!n||n.level===s.level)&&e_(t,r,s)===0||dV(s,n,Math.min(i,r))))return s;const a=QL.search(e,e_.bind(null,t,r));return a&&(a!==n||!s)?a:s}function dV(n,e,t){if(e?.start===0&&e.level<n.level&&(e.endPTS||0)>0){const r=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),t);return n.start<=r}return!1}function e_(n=0,e=0,t){if(t.start<=n&&t.start+t.duration>n)return 0;const r=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-r<=n?1:t.start-r>n&&t.start?-1:0}function fV(n,e,t){const r=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-r>n}function JL(n,e,t){if(n&&n.startCC<=e&&n.endCC>=e){let r=n.fragments;const{fragmentHint:i}=n;i&&(r=r.concat(i));let s;return QL.search(r,a=>a.cc<e?1:a.cc>e?-1:(s=a,a.end<=t?1:a.start>t?-1:0)),s||null}return null}function ZL(n,e){return e===n.endSN&&n.fragmentHint?n.fragmentHint:n.fragments[1+e-n.startSN]||null}var Ft={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},At={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8,ResetMediaSource:16};class hV extends Cn{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===te.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,r=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||r===-1?t.loadLevel:r}variantHasKey(e,t){if(e){var r;if((r=e.details)!=null&&r.hasKey(t))return!0;const i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(a=>i.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var r;if(t.fatal)return;const i=this.hls,s=t.context;switch(t.details){case F.FRAG_LOAD_ERROR:case F.FRAG_LOAD_TIMEOUT:case F.KEY_LOAD_ERROR:case F.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case F.FRAG_PARSING_ERROR:if((r=t.frag)!=null&&r.gap){t.errorAction=Il();return}case F.FRAG_GAP:case F.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ft.SendAlternateToPenaltyBox;return}case F.PLAYLIST_UNCHANGED_ERROR:case F.LEVEL_EMPTY_ERROR:case F.LEVEL_PARSING_ERROR:{var a;const o=t.parent===te.MAIN?t.level:i.loadLevel;t.details===F.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,o))}return;case F.LEVEL_LOAD_ERROR:case F.LEVEL_LOAD_TIMEOUT:typeof s?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case F.AUDIO_TRACK_LOAD_ERROR:case F.AUDIO_TRACK_LOAD_TIMEOUT:case F.SUBTITLE_LOAD_ERROR:case F.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const o=i.loadLevelObj;if(o&&(s.type===ve.AUDIO_TRACK&&o.hasAudioGroup(s.groupId)||s.type===ve.SUBTITLE_TRACK&&o.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=Ft.SendAlternateToPenaltyBox,t.errorAction.flags=At.MoveAllAlternatesMatchingHost;return}}return;case F.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:Ft.SendAlternateToPenaltyBox,flags:At.MoveAllAlternatesMatchingHDCP};return;case F.KEY_SYSTEM_SESSION_UPDATE_FAILED:case F.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case F.KEY_SYSTEM_NO_SESSION:t.errorAction={action:Ft.SendAlternateToPenaltyBox,flags:At.MoveAllAlternatesMatchingKey};return;case F.BUFFER_ADD_CODEC_ERROR:case F.REMUX_ALLOC_ERROR:case F.BUFFER_APPEND_ERROR:t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,t.level));return;case F.MEDIA_SOURCE_REQUIRES_RESET:t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,t.level)),t.errorAction.flags|=At.ResetMediaSource|At.SwitchToSDR;return;case F.INTERNAL_EXCEPTION:case F.BUFFER_APPENDING_ERROR:case F.BUFFER_APPEND_NO_PROGRESS:case F.BUFFER_FULL_ERROR:case F.LEVEL_SWITCH_ERROR:case F.BUFFER_STALLED_ERROR:case F.BUFFER_SEEK_OVER_HOLE:case F.BUFFER_NUDGE_ON_STALL:t.errorAction=Il();return}t.type===re.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Il())}getPlaylistRetryOrSwitchAction(e,t){const r=this.hls,i=BT(r.config.playlistLoadPolicy,e),s=this.playlistError++;if(uu(i,s,_f(e),e.response))return{action:Ft.RetryRequest,flags:At.None,retryConfig:i,retryCount:s};const o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const t=this.hls,r=this.getVariantLevelIndex(e.frag),i=t.levels[r],{fragLoadPolicy:s,keyLoadPolicy:a}=t.config,o=BT(xL(e)?a:s,e),l=t.levels.reduce((c,d)=>c+d.fragmentError,0);if(i&&(e.details!==F.FRAG_GAP&&i.fragmentError++,!TL(e)&&uu(o,l,_f(e),e.response)))return{action:Ft.RetryRequest,flags:At.None,retryConfig:o,retryCount:l};const u=this.getLevelSwitchAction(e,r);return o&&(u.retryConfig=o,u.retryCount=l),u}getLevelSwitchAction(e,t){const r=this.hls;t==null&&(t=r.loadLevel);const i=this.hls.levels[t];if(i){var s,a;const u=e.details;i.loadError++,i.loadErrorTime=self.performance.now(),u===F.BUFFER_APPEND_ERROR&&i.fragmentError++;let c=-1;const{levels:d,loadLevel:f,minAutoLevel:h,maxAutoLevel:p}=r;!r.autoLevelEnabled&&!r.config.preserveManualLevelOnError&&(r.loadLevel=-1);const m=(s=e.frag)==null?void 0:s.type,y=(m===te.AUDIO&&u===F.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&t_(e))&&d.some(({audioCodec:w})=>i.audioCodec!==w),S=e.sourceBufferName==="video"&&t_(e)&&d.some(({codecSet:w,audioCodec:I})=>i.codecSet!==w&&i.audioCodec===I),{type:x,groupId:T}=(a=e.context)!=null?a:{};for(let w=d.length;w--;){const I=(w+f)%d.length;if(I!==f&&I>=h&&I<=p&&(d[I].loadError===0||_L(d[I],r.config.errorPenaltyExpireMs))){var o,l;const R=d[I];if(u===F.FRAG_GAP&&m===te.MAIN&&e.frag){const A=d[I].details;if(A){const b=po(e.frag,A.fragments,e.frag.start);if(b!=null&&b.gap)continue}}else{if(x===ve.AUDIO_TRACK&&R.hasAudioGroup(T)||x===ve.SUBTITLE_TRACK&&R.hasSubtitleGroup(T))continue;if(m===te.AUDIO&&(o=i.audioGroups)!=null&&o.some(A=>R.hasAudioGroup(A))||m===te.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(A=>R.hasSubtitleGroup(A))||y&&i.audioCodec===R.audioCodec||S&&i.codecSet===R.codecSet||!y&&i.audioCodec!==R.audioCodec)continue}c=I;break}}if(c>-1&&r.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:Ft.SendAlternateToPenaltyBox,flags:At.None,nextAutoLevel:c}}return{action:Ft.SendAlternateToPenaltyBox,flags:At.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var r,i;switch((r=t.errorAction)==null?void 0:r.action){case Ft.DoNothing:break;case Ft.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==F.FRAG_GAP&&t.details!==F.PLAYLIST_UNCHANGED_ERROR&&!eC(t)&&(t.fatal=!0);break}if((((i=t.errorAction)==null?void 0:i.flags)||0)&At.ResetMediaSource&&this.hls.recoverMediaError(),t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,r=e.errorAction;if(!r)return;let i=r.nextAutoLevel;if(r.flags===At.None)this.switchLevel(e,i);else if(r.flags&At.SwitchToSDR){const o=this.hls.levels,l=o.length;for(let u=l;u--;)o[u].videoRange!=="SDR"?(o[u].fragmentError++,o[u].loadError++):i===void 0&&(i=u)}else if(r.flags&At.MoveAllAlternatesMatchingHDCP){const o=this.getVariantLevelIndex(e.frag),l=t.levels[o],u=l?.attrs["HDCP-LEVEL"];r.hdcpLevel=u;const c=u==="NONE";u&&!c?(t.maxHdcpLevel=T0[T0.indexOf(u)-1],r.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)):(c&&this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE"),r.flags|=At.MoveAllAlternatesMatchingKey)}if(r.flags&At.MoveAllAlternatesMatchingKey){const o=e.decryptdata;if(o){const l=this.hls.levels,u=l.length;for(let d=u;d--;)if(this.variantHasKey(l[d],o)){var s,a;this.log(`Banned key found in level ${d} (${l[d].bitrate}bps) or audio group "${(s=l[d].audioGroups)==null?void 0:s.join(",")}" (${(a=e.frag)==null?void 0:a.type} fragment) ${St(o.keyId||[])}`),l[d].fragmentError++,l[d].loadError++,this.log(`Removing level ${d} with key error (${e.error})`),this.hls.removeLevel(d)}const c=e.frag;if(this.hls.levels.length<u)r.resolved=!0;else if(c&&c.type!==te.MAIN){const d=c.decryptdata;d&&!o.matches(d)&&(r.resolved=!0)}}}r.resolved||this.switchLevel(e,i)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===F.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const r=x0(e.mimeType),i=this.hls.levels;for(let s=i.length;s--;)i[s][`${e.sourceBufferName}Codec`]===r&&(this.log(`Removing level ${s} for ${e.details} ("${r}" not supported)`),this.hls.removeLevel(s))}}}function t_(n){const e=n.details;return e===F.BUFFER_ADD_CODEC_ERROR||e===F.MEDIA_SOURCE_REQUIRES_RESET||e===F.BUFFER_APPEND_ERROR&&!eC(n)}function eC(n){return n.details===F.BUFFER_APPEND_ERROR&&(n.error.name==="QuotaExceededError"||n.error.name==="InvalidStateError")}function Il(n){const e={action:Ft.DoNothing,flags:At.None};return n&&(e.resolved=!0),e}var rt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class pV{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const r=this.activePartLists[t];if(r)for(let i=r.length;i--;){const s=r[i];if(!s)break;if(s.start<=e&&e<=s.end&&s.loaded)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,r){const{fragments:i}=this,s=Object.keys(i);for(let a=s.length;a--;){const o=i[s[a]];if(o?.body.type===t&&(!r||o.buffered)){const l=o.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,t,r,i,s,a){this.timeRanges&&(this.timeRanges[e]=t);const o=s?.fragment.sn||-1;Object.keys(this.fragments).forEach(l=>{const u=this.fragments[l];if(!u||!this.hls)return;const c=u.body;if(o>=c.sn)return;if(!u.buffered&&(!u.loaded||a)){c.type===r&&this.removeFragment(c);return}const d=u.range[e];if(d){if(d.time.length===0){this.removeFragment(c);return}if(d.time.some(f=>{const h=!this.isTimeBuffered(f.startPTS,f.endPTS,t);return h&&this.removeFragment(c),h}),i&&i!==c&&bl()){const f=i.endPTS,h=c.startPTS;if(f&&h&&u.range.video){const p=h-f;p<0&&p>-.1&&(this.removeFragment(c),this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:f+.004,endOffset:1/0,type:"video"}))}}}})}detectPartialFragments(e){const t=this.timeRanges,{frag:r,part:i,id:s}=e;if(!t||!at(r))return;const a=ca(r),o=this.fragments[a];if(!o||o.buffered&&r.gap)return;const l=!r.relurl;Object.keys(t).forEach(c=>{const d=r.elementaryStreams[c];if(!d)return;const f=t[c],h=l||d.partial===!0;o.range[c]=this.getBufferedTimes(r,i,h,f),this.detectEvictedFragments(c,f,s,r,i)}),o.loaded=null;const u=Object.keys(o.range);if(u.length){if(this.bufferedEnd(o,r),Cc(o)||this.removeParts(r.sn-1,r.type),!i){const c=Math.min(.004,r.duration);u.some(d=>{var f;const h=(f=o.range[d])==null?void 0:f.time,p=h.length===0||h.length===1&&h[0].endPTS-h[0].startPTS<c;return p&&this.addAsGap(r),p})}}else this.removeFragment(r)}addAsGap(e){e.gap=!0,this.removeFragment(e),this.fragBuffered(e,!0)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&!t.gap&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const r=this.activePartLists[t];r&&(this.activePartLists[t]=n_(r,i=>i.fragment.sn>=e))}fragBuffered(e,t){const r=ca(e);let i=this.fragments[r];return!i&&t&&(i=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,e)),i}getBufferedTimes(e,t,r,i){const s={time:[],partial:r},a=e.start,o=e.end,l=e.minEndPTS||o,u=e.maxStartPTS||a;for(let c=0;c<i.length;c++){const d=i.start(c)-this.bufferPadding,f=i.end(c)+this.bufferPadding;if(u>=d&&l<=f){s.time.push({startPTS:Math.max(a,i.start(c)),endPTS:Math.min(o,i.end(c))});break}else if(a<f&&o>d){const h=Math.max(a,i.start(c)),p=Math.min(o,i.end(c));p>h&&(s.partial=!0,s.time.push({startPTS:h,endPTS:p}))}else if(o<=d)break}return s}getPartialFragment(e){let t=null,r,i,s,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(u=>{const c=l[u];c&&Cc(c)&&(i=c.body.start-o,s=c.body.end+o,e>=i&&e<=s&&(r=Math.min(e-i,s-e),a<=r&&(t=c.body,a=r)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Cc(t))}getState(e){const t=ca(e),r=this.fragments[t];return r?r.buffered?Cc(r)?rt.PARTIAL:rt.OK:rt.APPENDING:rt.NOT_LOADED}isTimeBuffered(e,t,r){let i,s;for(let a=0;a<r.length;a++){if(i=r.start(a)-this.bufferPadding,s=r.end(a)+this.bufferPadding,e>=i&&t<=s)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(!at(t.frag)||t.frag.bitrateTest)return;const r=t.frag,i=t.part?null:t,s=ca(r);this.fragments[s]={body:r,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:r,part:i,timeRanges:s}=t;if(!at(r))return;const a=r.type;if(i){let o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(i)}this.timeRanges=s}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=ca(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,r=Object.keys(t);if(!e)return r.length>0;for(let i=r.length;i--;){const s=t[r[i]];if(s?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}getBackBufferEvictionEnd(e,t,r){const{fragments:i}=this;let s=0,a=0;const o=Object.keys(i);for(let l=0;l<o.length;l++){const u=i[o[l]];if(!u||!u.buffered||u.body.type!==t)continue;const c=u.body;if(c.gap)return 0;const d=c.hasStats&&c.stats.loaded||c.byteLength||c.bitrate&&c.bitrate*8*c.duration;if(c.end<=e&&d&&(s+=d,a=Math.max(a,c.end),s>=r))return a}return a>0?a:0}removeFragmentsInRange(e,t,r,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==r||i&&!l.gap||l.start<t&&l.end>e&&(o.buffered||s)&&this.removeFragment(l)})}removeFragment(e){const t=ca(e);e.clearElementaryStreamInfo();const r=this.activePartLists[e.type];if(r){const i=e.sn;this.activePartLists[e.type]=n_(r,s=>s.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(r=>r.clearElementaryStreamInfo())}}function Cc(n){var e,t,r,i;return n.buffered&&!!(n.body.gap||(e=n.range.video)!=null&&e.partial||(t=n.range.audio)!=null&&t.partial||(r=n.range.audiovideo)!=null&&r.partial||(i=n.range.subs)!=null&&i.partial)}function ca(n){return`${n.type}_${n.level}_${n.sn}`}function n_(n,e){return n.filter(t=>{const r=e(t);return r||t.clearElementaryStreamInfo(),r})}var ss={cbc:0,ctr:1};class mV{constructor(e,t,r){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=r}decrypt(e,t){switch(this.aesMode){case ss.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case ss.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function gV(n){const e=n.byteLength,t=e&&new DataView(n.buffer).getUint8(e-1);return t?n.slice(0,e-t):n}class yV{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),r=new Uint32Array(4);for(let i=0;i<4;i++)r[i]=t.getUint32(i*4);return r}initTable(){const e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],s=r[1],a=r[2],o=r[3],l=this.invSubMix,u=l[0],c=l[1],d=l[2],f=l[3],h=new Uint32Array(256);let p=0,m=0,g=0;for(g=0;g<256;g++)g<128?h[g]=g<<1:h[g]=g<<1^283;for(g=0;g<256;g++){let y=m^m<<1^m<<2^m<<3^m<<4;y=y>>>8^y&255^99,e[p]=y,t[y]=p;const v=h[p],S=h[v],x=h[S];let T=h[y]*257^y*16843008;i[p]=T<<24|T>>>8,s[p]=T<<16|T>>>16,a[p]=T<<8|T>>>24,o[p]=T,T=x*16843009^S*65537^v*257^p*16843008,u[y]=T<<24|T>>>8,c[y]=T<<16|T>>>16,d[y]=T<<8|T>>>24,f[y]=T,p?(p=v^h[h[h[x^v]]],m^=h[h[m]]):p=m=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let r=!0,i=0;for(;i<t.length&&r;)r=t[i]===this.key[i],i++;if(r)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const a=this.ksRows=(s+6+1)*4;let o,l;const u=this.keySchedule=new Uint32Array(a),c=this.invKeySchedule=new Uint32Array(a),d=this.sBox,f=this.rcon,h=this.invSubMix,p=h[0],m=h[1],g=h[2],y=h[3];let v,S;for(o=0;o<a;o++){if(o<s){v=u[o]=t[o];continue}S=v,o%s===0?(S=S<<8|S>>>24,S=d[S>>>24]<<24|d[S>>>16&255]<<16|d[S>>>8&255]<<8|d[S&255],S^=f[o/s|0]<<24):s>6&&o%s===4&&(S=d[S>>>24]<<24|d[S>>>16&255]<<16|d[S>>>8&255]<<8|d[S&255]),u[o]=v=(u[o-s]^S)>>>0}for(l=0;l<a;l++)o=a-l,l&3?S=u[o]:S=u[o-4],l<4||o<=4?c[l]=S:c[l]=p[d[S>>>24]]^m[d[S>>>16&255]]^g[d[S>>>8&255]]^y[d[S&255]],c[l]=c[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,r){const i=this.keySize+6,s=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],u=o[1],c=o[2],d=o[3],f=this.uint8ArrayToUint32Array_(r);let h=f[0],p=f[1],m=f[2],g=f[3];const y=new Int32Array(e),v=new Int32Array(y.length);let S,x,T,w,I,R,A,b,C,k,$,U,N,D;const M=this.networkToHostOrderSwap;for(;t<y.length;){for(C=M(y[t]),k=M(y[t+1]),$=M(y[t+2]),U=M(y[t+3]),I=C^s[0],R=U^s[1],A=$^s[2],b=k^s[3],N=4,D=1;D<i;D++)S=l[I>>>24]^u[R>>16&255]^c[A>>8&255]^d[b&255]^s[N],x=l[R>>>24]^u[A>>16&255]^c[b>>8&255]^d[I&255]^s[N+1],T=l[A>>>24]^u[b>>16&255]^c[I>>8&255]^d[R&255]^s[N+2],w=l[b>>>24]^u[I>>16&255]^c[R>>8&255]^d[A&255]^s[N+3],I=S,R=x,A=T,b=w,N=N+4;S=a[I>>>24]<<24^a[R>>16&255]<<16^a[A>>8&255]<<8^a[b&255]^s[N],x=a[R>>>24]<<24^a[A>>16&255]<<16^a[b>>8&255]<<8^a[I&255]^s[N+1],T=a[A>>>24]<<24^a[b>>16&255]<<16^a[I>>8&255]<<8^a[R&255]^s[N+2],w=a[b>>>24]<<24^a[I>>16&255]<<16^a[R>>8&255]<<8^a[A&255]^s[N+3],v[t]=M(S^h),v[t+1]=M(w^p),v[t+2]=M(T^m),v[t+3]=M(x^g),h=C,p=k,m=$,g=U,t=t+4}return v.buffer}}class vV{constructor(e,t,r){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=r}expandKey(){const e=SV(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function SV(n){switch(n){case ss.cbc:return"AES-CBC";case ss.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${n}`)}}const EV=16;class Yv{constructor(e,t){if(this.logEnabled=!0,this.decryptRange=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftw
vendor: 11,499 bytes, line 84
84areAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,t!==!0)try{const r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const r=new Uint8Array(e);this.reset();const i=this.decryptRange;return i?i.start===0&&i.end>=r.length?r:r.slice(i.start,i.end):gV(r)}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,r,i,s){return this.decryptRange=s,this.useSoftware||s?new Promise((a,o)=>{const l=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(l,t,r,i);const u=this.flush();u?a(u.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,r,i)}softwareDecrypt(e,t,r,i){const{currentIV:s,currentResult:a,remainderData:o}=this;if(i!==ss.cbc||t.byteLength!==16)return Pe.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Kn(o,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;s&&(r=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new yV),u.expandKey(t);const c=a;return this.currentResult=u.decrypt(l.buffer,0,r),this.currentIV=l.slice(-16).buffer,c||null}webCryptoDecrypt(e,t,r,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,r,i));this.key=t,this.fastAesKey=new vV(this.subtle,t,i)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new mV(this.subtle,new Uint8Array(r),i).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(Pe.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,r,i)))}onWebCryptoError(e,t,r,i){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r,i);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const r=e.length-e.length%EV;return r!==e.length&&(t=e.slice(0,r),this.remainderData=e.slice(r)),t}logOnce(e){this.logEnabled&&(Pe.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const r_=Math.pow(2,17);class i_{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t,r,i){const s=e.url;if(!s)return Promise.reject(new Rr({type:re.NETWORK_ERROR,details:F.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const a=this.config,o=a.fLoader,l=a.loader;return new Promise((u,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(g=>g[0]==="GAP")){c(a_(e));return}else e.gap=!1;const d=this.loader=o?new o(a):new l(a),f=s_(e,null,t);e.loader=d;const h=$T(a.fragLoadPolicy.default),p={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:r_};d.stats.retry=e.stats.retry,e.stats=d.stats;const m={onSuccess:(g,y,v,S)=>{this.resetLoader(e,d);let x=g.data;v.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(x.slice(0,16)),x=x.slice(16)),u({frag:e,part:null,payload:x,networkDetails:S})},onError:(g,y,v,S)=>{this.resetLoader(e,d),c(new Rr({type:re.NETWORK_ERROR,details:F.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ie({url:s,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:v,stats:S}))},onAbort:(g,y,v)=>{this.resetLoader(e,d),c(new Rr({type:re.NETWORK_ERROR,details:F.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:v,stats:g}))},onTimeout:(g,y,v)=>{this.resetLoader(e,d),c(new Rr({type:re.NETWORK_ERROR,details:F.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${p.timeout}ms`),networkDetails:v,stats:g}))}};if(r){const g=this.gateProgress(r,i);m.onProgress=(y,v,S,x)=>g({frag:e,part:null,payload:S,networkDetails:x})}d.load(f,p,m)})}gateProgress(e,t){let r=e;if(t){const i=[];let s=!1;t.then(()=>{s=!0,i.forEach(a=>e(a)),i.length=0}).catch(()=>{}),r=a=>{s?e(a):i.push(a)}}return r}loadPart(e,t,r){this.abort();const i=this.config,s=i.fLoader,a=i.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(a_(e,t));return}const u=this.loader=s?new s(i):new a(i),c=s_(e,t);e.loader=u;const d=$T(i.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:r_};t.stats=u.stats,u.load(c,f,{onSuccess:(h,p,m,g)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:h.data,networkDetails:g};r(y),o(y)},onError:(h,p,m,g)=>{this.resetLoader(e,u),l(new Rr({type:re.NETWORK_ERROR,details:F.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ie({url:c.url,data:void 0},h),error:new Error(`HTTP Error ${h.code} ${h.text}`),networkDetails:m,stats:g}))},onAbort:(h,p,m)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),l(new Rr({type:re.NETWORK_ERROR,details:F.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:m,stats:h}))},onTimeout:(h,p,m)=>{this.resetLoader(e,u),l(new Rr({type:re.NETWORK_ERROR,details:F.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:m,stats:h}))}})})}updateStatsFromPart(e,t){const r=e.stats,i=t.stats,s=i.total;if(r.loaded+=i.loaded,s){const l=Math.round(e.duration/t.duration),u=Math.min(Math.round(r.loaded/s),l),d=(l-u)*Math.round(r.loaded/u);r.total=r.loaded+d}else r.total=Math.max(r.loaded,r.total);const a=r.loading,o=i.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,e.url=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function s_(n,e=null,t){const r=e||n,i={type:ve.MEDIA_FRAGMENT,frag:n,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},s=Af(n,e,t);return s.resetIV&&(i.resetIV=!0),s.byteRange&&(i.rangeStart=s.byteRange.start,i.rangeEnd=s.byteRange.end),i}function Af(n,e=null,t){const r={},i=e||n,s=i.byteRangeStartOffset,a=i.byteRangeEndOffset;if(X(s)&&X(a)){var o;if((n.sn==="initSegment"||t)&&xV((o=n.decryptdata)==null?void 0:o.method)){let l=Math.floor(s/16)*16;const u=Math.ceil(a/16)*16;r.decryptRange={start:s-l,end:a-l},l>=16&&(r.resetIV=!0,l=l-16),r.byteRange={start:l,end:u}}else r.byteRange={start:s,end:a}}return r}function a_(n,e){const t=new Error(`GAP ${n.gap?"tag":"attribute"} found`),r={type:re.MEDIA_ERROR,details:F.FRAG_GAP,fatal:!1,frag:n,error:t,networkDetails:null};return e&&(r.part=e),(e||n).stats.aborted=!0,new Rr(r)}function xV(n){return n==="AES-128"||n==="AES-256"}class Rr extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class tC extends Cn{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1?(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0):(this.log(`possible exception thrown in task-loop (${this.constructor.name}.doTick)`),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class Xv{constructor(e,t,r,i=0,s=-1,a=!1,o,l,u){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.iframe=void 0,this.duration=void 0,this.decryptRange=void 0,this.transmuxing=kc(),this.buffering={audio:kc(),video:kc(),audiovideo:kc()},this.level=e,this.sn=t,this.id=r,this.size=i,this.part=s,this.partial=a,this.duration=o||0,this.decryptRange=u,this.iframe=l||!1}}function kc(){return{start:0,executeStart:0,executeEnd:0,end:0}}const o_={length:0,start:()=>0,end:()=>0};class le{static isBuffered(e,t){if(e){const r=le.getBuffered(e);for(let i=r.length;i--;)if(t>=r.start(i)&&t<=r.end(i))return!0}return!1}static bufferedRanges(e){if(e){const t=le.getBuffered(e);return le.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t}static bufferInfo(e,t,r){if(e){const i=le.bufferedRanges(e);if(i.length)return le.bufferedInfo(i,t,r)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,r){t=Math.max(0,t),e.length>1&&e.sort((c,d)=>c.start-d.start||d.end-c.end);let i=-1,s=[];if(r)for(let c=0;c<e.length;c++){t>=e[c].start&&t<=e[c].end&&(i=c);const d=s.length;if(d){const f=s[d-1].end;e[c].start-f<r?e[c].end>f&&(s[d-1].end=e[c].end):s.push(e[c])}else s.push(e[c])}else s=e;let a=0,o,l=t,u=t;for(let c=0;c<s.length;c++){const d=s[c].start,f=s[c].end;if(i===-1&&t>=d&&t<=f&&(i=c),t+r>=d&&t<f)l=d,u=f,a=u-t;else if(t+r<d){o=d;break}}return{len:a,start:l||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||o_}catch(t){return Pe.log("failed to get media.buffered",t),o_}}}const _0=/\{\$([a-zA-Z0-9-_]+)\}/g;function l_(n){return _0.lastIndex=0,_0.test(n)}function Qv(n,e){if(n.variableList!==null||n.hasVariableRefs){const t=n.variableList;return e.replace(_0,r=>{const i=r.substring(2,r.length-1),s=t?.[i];return s===void 0?(n.playlistParsingError||(n.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),r):s})}return e}function u_(n,e,t){let r=n.variableList;r||(n.variableList=r={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(i))s=a.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(a){n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else i=e.NAME,s=e.VALUE;i in r?n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):r[i]=s||""}function TV(n,e,t){const r=e.IMPORT;if(t&&r in t){let i=n.variableList;i||(n.variableList=i={}),i[r]=t[r]}else n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`))}const _V=/^(\d+)x(\d+)$/,c_=/(.+?)=(".*?"|.*?)(?:,|$)/g;class nt{constructor(e,t){typeof e=="string"&&(e=nt.parseAttrList(e,t)),Ne(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;
vendor: 5,251 bytes, line 84
84const r=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(i*2,i*2+2),16);return r}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const r=this[e];return r?parseFloat(r):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const r=this[e];return(r?r.split(/[ ,]+/):[]).reduce((i,s)=>(i[s.toLowerCase()]=!0,i),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=_V.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let r;const i={},s='"';for(c_.lastIndex=0;(r=c_.exec(e))!==null;){const a=r[1].trim();let o=r[2];const l=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let u=!1;if(l)o=o.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(l||u))o=Qv(t,o);else if(!u&&!l)switch(a){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Pe.warn(`${e}: attribute ${a} is missing quotes`)}i[a]=o}return i}}const bV="com.apple.hls.interstitial";function IV(n){return n!=="ID"&&n!=="CLASS"&&n!=="CUE"&&n!=="START-DATE"&&n!=="DURATION"&&n!=="END-DATE"&&n!=="END-ON-NEXT"}function wV(n){return n==="SCTE35-OUT"||n==="SCTE35-IN"||n==="SCTE35-CMD"}class nC{constructor(e,t,r=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(i=t?.tagOrder)!=null?i:r,t){const s=t.attr;for(const a in s)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==s[a]){Pe.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=Ne(new nt({}),s,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in e){const s=t?.endDate||new Date(e["END-DATE"]);X(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(Pe.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(X(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===bV}get isValid(){return!!this.id&&!this._badValueForSameId&&X(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}get invalidReason(){return this.id?this._badValueForSameId?`Date range ${this._badValueForSameId} mismatch`:X(this.startDate.getTime())?this.isInterstitial&&!("X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)?"Interstitial Date range missing X-ASSET-(LIST|URI)":this.isValid?null:"Unknown (check DURATION(|END|NEXT), CLASS, and CUE)":"Date range invalid start date":"Missing ID"}}const rC=10;class RV{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.iframesOnly=!1,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.drift
vendor: 17,079 bytes, line 84
84StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&r>0,this.updated||this.advanced?this.misses=0:this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let r=t.decryptdata;return r||(t.setKeyFormat(e.keyFormat),r=t.decryptdata),!!r&&e.matches(r)})}get hasProgramDateTime(){return this.fragments.length?X(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||rC}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let r=e.length;r--;)if(e[r].index>t)return e[r].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Lf(n,e){return n.length===e.length?!n.some((t,r)=>t!==e[r]):!1}function d_(n,e){return!n&&!e?!0:!n||!e?!1:Lf(n,e)}function Wa(n){return n==="AES-128"||n==="AES-256"||n==="AES-256-CTR"}function Jv(n){switch(n){case"AES-128":case"AES-256":return ss.cbc;case"AES-256-CTR":return ss.ctr;default:throw new Error(`invalid full segment method ${n}`)}}function b0(n){return Uint8Array.from(unescape(encodeURIComponent(n)),e=>e.charCodeAt(0))}function AV(n){const e=b0(n).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function iC(n){const e=function(r,i,s){const a=r[i];r[i]=r[s],r[s]=a};e(n,0,3),e(n,1,2),e(n,4,5),e(n,6,7)}function sC(n){const e=n.split(":");let t=null;if(e[0]==="data"&&e.length===2){const r=e[1].split(";"),i=r[r.length-1].split(",");if(i.length===2){const s=i[0]==="base64",a=i[1];s?(r.splice(-1,1),t=zv(a)):t=AV(a)}}return t}const Cf=typeof self<"u"?self:void 0;var Ze={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Nt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Dc(n){switch(n){case Nt.FAIRPLAY:return Ze.FAIRPLAY;case Nt.PLAYREADY:return Ze.PLAYREADY;case Nt.WIDEVINE:return Ze.WIDEVINE;case Nt.CLEARKEY:return Ze.CLEARKEY}}var aC={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function cm(n){switch(n){case Ze.FAIRPLAY:return Nt.FAIRPLAY;case Ze.PLAYREADY:return Nt.PLAYREADY;case Ze.WIDEVINE:return Nt.WIDEVINE;case Ze.CLEARKEY:return Nt.CLEARKEY}}function Ho(n){const{drmSystems:e,widevineLicenseUrl:t}=n,r=e?[Ze.FAIRPLAY,Ze.WIDEVINE,Ze.PLAYREADY,Ze.CLEARKEY].filter(i=>!!e[i]):[];return!r[Ze.WIDEVINE]&&t&&r.push(Ze.WIDEVINE),r}const oC=function(n){return Cf!=null&&(n=Cf.navigator)!=null&&n.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function LV(n,e,t,r){let i;switch(n){case Ze.FAIRPLAY:i=["cenc","sinf"];break;case Ze.WIDEVINE:case Ze.PLAYREADY:i=["cenc"];break;case Ze.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${n}`)}return CV(i,e,t,r)}function CV(n,e,t,r){return[{initDataTypes:n,persistentState:r.persistentState||"optional",distinctiveIdentifier:r.distinctiveIdentifier||"optional",sessionTypes:r.sessionTypes||[r.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:r.audioRobustness||"",encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:r.videoRobustness||"",encryptionScheme:r.videoEncryptionScheme||null}))}]}function kV(n){var e;return!!n&&(n.sessionType==="persistent-license"||!!((e=n.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Zv(n){const e=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2),t=gr(e),r=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const l=zv(o).subarray(0,16);return iC(l),l}}return null}let da={};class oi{static clearKeyUriToKeyIdMap(){da={}}static setKeyIdForUri(e,t){da[e]=t}static addKeyIdForUri(e){const t=Object.keys(da).length%Number.MAX_SAFE_INTEGER,r=new Uint8Array(16);return new DataView(r.buffer,12,4).setUint32(0,t),da[e]=r,r}constructor(e,t,r,i=[1],s=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.scheme=void 0,this.method=e,this.uri=t,this.keyFormat=r,this.keyFormatVersions=i,this.iv=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Wa(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(CL(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Lf(e.keyFormatVersions,this.keyFormatVersions)&&d_(e.iv,this.iv)&&d_(e.keyId,this.keyId)}isSupported(){if(this.method){if(Wa(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Nt.FAIRPLAY:case Nt.WIDEVINE:case Nt.PLAYREADY:case Nt.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){var r;if(!this.encrypted||!this.uri)return null;if(Wa(this.method)){let a=this.iv;return a||(typeof e!="number"&&(Pe.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),a=PV(e)),new oi(this.method,this.uri,"identity",this.keyFormatVersions,a)}if(this.keyId){const a=da[this.uri];if(a&&!Lf(this.keyId,a)&&oi.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=sC(this.uri);if(i)switch(this.keyFormat){case Nt.WIDEVINE:if(this.pssh=i,!this.keyId){const a=GL(i.buffer).filter(o=>o.systemId===aC.WIDEVINE);if(a.length){var s;const o=a[0];this.keyId=(s=o.kids)!=null&&s.length?o.kids[0]:null}}this.keyId||(this.keyId=f_(t));break;case Nt.PLAYREADY:{const a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=OH(a,null,i),this.keyId=Zv(i);break}default:{let a=i.subarray(0,16);if(a.length!==16){const o=new Uint8Array(16);o.set(a,16-a.length),a=o}this.keyId=a;break}}if(((r=this.keyId)==null?void 0:r.byteLength)!==16){let a;a=DV(t),a||(a=f_(t),a||(a=da[this.uri])),a&&(this.keyId=a,oi.setKeyIdForUri(this.uri,a))}return this}}function DV(n){const e=n?.[Nt.WIDEVINE];return e?e.keyId:null}function f_(n){const e=n?.[Nt.PLAYREADY];if(e){const t=sC(e.uri);if(t)return Zv(t)}return null}function PV(n){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=n>>8*(15-t)&255;return e}const h_=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(I-FRAME-STREAM-INF|SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)(?:[\r\n]+|$)/g,p_=/#EXT-X-MEDIA:(.*)/g,OV=/^#EXT(?:INF|-X-TARGETDURATION):/m,dm=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),MV=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS|I-FRAMES-ONLY)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Or{static findGroup(e,t){for(let r=0;r<e.length;r++){const i=e[r];if(i.id===t)return i}}static resolve(e,t){return Gv.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return OV.test(e)}static parseMasterPlaylist(e,t){const r=l_(e),i={contentSteering:null,levels:[],iframeVariants:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:r},s=[];if(h_.lastIndex=0,!e.startsWith("#EXTM3U"))return i.playlistParsingError=new Error("no EXTM3U delimiter"),i;let a;for(;(a=h_.exec(e))!=null;)if(a[1]){const l=new nt(a[1],i),u=m_(l,a[2],t,i,s);u&&i.levels.push(u)}else if(a[3]){const l=a[3],u=a[4];switch(l){case"I-FRAME-STREAM-INF":{const c=new nt(u,i),d=m_(c,c.URI,t,i,s,!0);d&&i.iframeVariants.push(d)}break;case"SESSION-DATA":{const c=new nt(u,i),d=c["DATA-ID"];d&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[d]=c);break}case"SESSION-KEY":{const c=g_(u,t,i);c.encrypted&&c.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(c)):Pe.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const c=new nt(u,i);u_(i,c,t)}break}case"CONTENT-STEERING":{const c=new nt(u,i);i.contentSteering={uri:Or.resolve(c["SERVER-URI"],t),pathwayId:c["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=y_(u);break}}}const o=s.length>0&&s.length<i.levels.length;return i.levels=o?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,r){let i;const s={},a=r.levels,o={AUDIO:a.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:a.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(p_.lastIndex=0;(i=p_.exec(e))!==null;){const u=new nt(i[1],r),c=u.TYPE;if(c){const d=o[c],f=s[c]||[];s[c]=f;const h=u.LANGUAGE,p=u["ASSOC-LANGUAGE"],m=u.CHANNELS,g=u.CHARACTERISTICS,y=u["INSTREAM-ID"],v={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||h||"",type:c,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:h,url:u.URI?Or.resolve(u.URI,t):""};if(p&&(v.assocLang=p),m&&(v.channels=m),g&&(v.characteristics=g),y&&(v.instreamId=y),d!=null&&d.length){const S=Or.findGroup(d,v.groupId)||d[0];S_(v,S,"audioCodec"),S_(v,S,"textCodec")}f.push(v)}}return s}static parseLevelPlaylist(e,t,r,i,s,a){var o;const l={url:t},u=new RV(t),c=u.fragments,d=[];let f=null,h=0,p=0,m=0,g=0,y=0,v=null,S=new Ic(i,l),x,T,w,I=-1,R=!1,A=null,b;if(dm.lastIndex=0,u.m3u8=e,u.hasVariableRefs=l_(e),((o=dm.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(x=dm.exec(e))!==null;){R&&(R=!1,S=new Ic(i,l),S.playlistOffset=m,S.setStart(m),S.sn=h,S.cc=g,y&&(S.bitrate=y),S.level=r,f&&(S.initSegment=f,f.rawProgramDateTime&&(S.rawProgramDateTime=f.rawProgramDateTime,f.rawProgramDateTime=null),A&&(S.setByteRange(A),A=null)));const N=x[1];if(N){S.duration=parseFloat(N);const D=(" "+x[2]).slice(1);S.title=D||null,S.tagList.push(D?["INF",N,D]:["INF",N])}else if(x[3]){if(X(S.duration)){var C;S.playlistOffset=m,S.setStart(m),w&&x_(S,w,u),S.sn=h,S.level=r,S.cc=g;const D=(" "+x[3]).slice(1);S.relurl=Qv(u,D),I0(S,v,d),v=S,m+=S.duration,h++,p=0;const M=S.byteRange;if(M.length===2&&(S.bitrate=(M[1]-M[0])*8/S.duration|0),u.iframesOnly&&M[0]&&((C=f)==null?void 0:C.cc)!==g){const L=new Ic(i,l);L.relurl=S.relurl,L.setByteRange(`${Math.min(M[0],7*188)}@0`),L.level=r,L.sn="initSegment",w&&(L.levelkeys=w,w.identity&&(L._decryptdata=w.identity.getDecryptData(0))),f=L,S.initSegment=f}c.push(S),R=!0}}else{if(x=x[0].match(MV),!x){Pe.warn("No matches on slow regex match for level playlist!");continue}for(T=1;T<x.length&&x[T]===void 0;T++);const D=(" "+x[T]).slice(1),M=(" "+x[T+1]).slice(1),L=x[T+2]?(" "+x[T+2]).slice(1):null;switch(D){case"BYTERANGE":v?S.setByteRange(M,v):S.setByteRange(M);break;case"PROGRAM-DATE-TIME":S.rawProgramDateTime=M,S.tagList.push(["PROGRAM-DATE-TIME",M]),I===-1&&(I=c.length);break;case"PLAYLIST-TYPE":u.type&&Kr(u,D,x),u.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Kr(u,D,x):v!==null&&UV(u,D,x),u.startSN=parseInt(M),h=u.startSN+u.skippedSegments;break;case"SKIP":{u.skippedSegments&&Kr(u,D,x);const O=new nt(M,u),B=O.decimalInteger("SKIPPED-SEGMENTS");if(X(B)){u.skippedSegments+=B;for(let j=B;j--;)c.push(null);h+=B}const G=O.enumeratedString("RECENTLY-REMOVED-DATERANGES");G&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(G.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Kr(u,D,x),u.targetduration=Math.max(parseInt(M),1);break;case"VERSION":u.version!==null&&Kr(u,D,x),u.version=parseInt(M);break;case"INDEPENDENT-SEGMENTS":break;case"I-FRAMES-ONLY":u.iframesOnly=!0;break;case"ENDLIST":u.live||Kr(u,D,x),u.live=!1;break;case"#":(M||L)&&S.tagList.push(L?[M,L]:[M]);break;case"DISCONTINUITY":g++,S.tagList.push(["DIS"]);break;case"GAP":S.gap=!0,S.tagList.push([D]);break;case"BITRATE":S.tagList.push([D,M]),y=parseInt(M)*1e3,X(y)?S.bitrate=y:y=0;break;case"DATERANGE":{const O=new nt(M,u),B=new nC(O,u.dateRanges[O.ID],u.dateRangeTagCount);u.dateRangeTagCount++,B.isValid||u.skippedSegments?u.dateRanges[B.id]=B:Pe.log(`Ignoring invalid DATERANGE tag: ${B.invalidReason}: ${M}`),S.tagList.push(["EXT-X-DATERANGE",M]);break}case"DEFINE":{{const O=new nt(M,u);"IMPORT"in O?TV(u,O,a):u_(u,O,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0&&Kr(u,D,x),u.startCC=g=parseInt(M),c.forEach(O=>O&&(O.cc=g));break;case"KEY":{const O=g_(M,t,u);if(O.isSupported()){if(O.method==="NONE"){w=void 0;break}w||(w={});const B=w[O.keyFormat];B!=null&&B.matches(O)||(B&&(w=Ne({},w)),w[O.keyFormat]=O)}else Pe.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${M}"`);break}case"START":u.startTimeOffset=y_(M);break;case"MAP":{const O=new nt(M,u);if(S.duration){const B=new Ic(i,l);E_(B,O,r,w),f=B,S.initSegment=f,f.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=f.rawProgramDateTime)}else{const B=S.byteRangeEndOffset;if(B){const G=S.byteRangeStartOffset;A=`${B-G}@${G}`}else A=null;E_(S,O,r,w),f=S,R=!0}f.cc=g;break}case"SERVER-CONTROL":{b&&Kr(u,D,x),b=new nt(M),u.canBlockReload=b.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=b.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&b.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=b.optionalFloat("PART-HOLD-BACK",0),u.holdBack=b.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&Kr(u,D,x);const O=new nt(M);u.partTarget=O.decimalFloatingPoint("PART-TARGET");break}case"PART":{let O=u.partList;O||(O=u.partList=[]);const B=p>0?O[O.length-1]:void 0,G=p++,j=new nt(M,u),W=new jj(j,S,l,G,B);O.push(W),S.duration+=W.duration;break}case"PRELOAD-HINT":{const O=new nt(M,u);u.preloadHint=O;break}case"RENDITION-REPORT":{const O=new nt(M,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(O);break}default:Pe.warn(`line parsed but not handled: ${x}`);break}}}v&&!v.relurl?(c.pop(),m-=v.duration,u.partList&&(u.fragmentHint=v)):u.partList&&(I0(S,v,d),S.cc=g,u.fragmentHint=S,w&&x_(S,w,u)),u.targetduration||(u.playlistParsingError=new Error("Missing Target Duration"));const k=c.length,$=c[0],U=c[k-1];if(m+=u.skippedSegments*u.targetduration,m>0&&k&&U){u.averagetargetduration=m/k;const N=U.sn;u.endSN=N!=="initSegment"?N:0,u.live||(U.endList=!0),I>0&&(NV(c,I,I>k-1?S:null),$&&d.unshift($))}return u.fragmentHint&&(m+=u.fragmentHint.duration),u.totalduration=m,d.length&&u.dateRangeTagCount&&$&&lC(d,u),u.endCC=g,u}}function m_(n,e,t,r,i,s){var a;if(e===void 0)return null;const o=Qv(r,e),l={attrs:n,bitrate:n.decimalInteger("BANDWIDTH")||n.decimalInteger("AVERAGE-BANDWIDTH"),name:n.NAME,url:Or.resolve(o,t)},u=n.decimalResolution("RESOLUTION");u&&(l.width=u.width,l.height=u.height),v_(n.CODECS,l);const c=n["SUPPLEMENTAL-CODECS"];return c&&(l.supplemental={},v_(c,l.supplemental)),(a=l.unknownCodecs)!=null&&a.length||i.push(l),s&&(l.iframes=!0),l}function lC(n,e){let t=n.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];n.push(o),t++}else return;const r=n[t-1],i=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let o=s.length;o--;){const l=e.dateRanges[s[o]],u=l.startDate.getTime();l.tagAnchor=r.ref;for(let c=t;c--;){var a;if(((a=n[c])==null?void 0:a.sn)<e.startSN)break;const d=FV(e,u,n,c,i);if(d){l.tagAnchor=d.ref;break}}}}function FV(n,e,t,r,i){const s=t[r];
vendor: 4,210 bytes, line 84
84if(s){const o=s.programDateTime;if(e>=o||r===0){var a;const l=(((a=t[r+1])==null?void 0:a.start)||i)-s.start;if(e<=o+l*1e3){const u=s.sn-n.startSN,c=n.fragments;if(u>=0&&u<c.length){if(c.length>t.length){const d=t[r+1]||c[c.length-1],f=Math.min(d.sn-n.startSN,c.length-1);for(let h=f;h>u;h--){const p=c[h].programDateTime;if(e>=p&&e<p+c[h].duration*1e3)return c[h]}}return c[u]}}}}return null}function g_(n,e,t){var r,i;const s=new nt(n,t),a=(r=s.METHOD)!=null?r:"",o=s.URI,l=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,c=(i=s.KEYFORMAT)!=null?i:"identity";o&&s.IV&&!l&&Pe.error(`Invalid IV: ${s.IV}`);const d=o?Or.resolve(o,e):"",f=(u||"1").split("/").map(Number).filter(Number.isFinite);return new oi(a,d,c,f,l,s.KEYID)}function y_(n){const t=new nt(n).decimalFloatingPoint("TIME-OFFSET");return X(t)?t:null}function v_(n,e){let t=(n||"").split(/[ ,]+/).filter(r=>r);["video","audio","text","image"].forEach(r=>{const i=t.filter(s=>Kv(s,r));i.length&&(e[`${r}Codec`]=i.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function S_(n,e,t){const r=e[t];r&&(n[t]=r)}function NV(n,e,t){if(t||(t=n[e]),!!t)for(let r=e;r--;){const i=n[r];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function I0(n,e,t){n.rawProgramDateTime?t.push(n):e!=null&&e.programDateTime&&(n.programDateTime=e.endProgramDateTime)}function E_(n,e,t,r){n.relurl=e.URI,e.BYTERANGE&&n.setByteRange(e.BYTERANGE),n.level=t,n.sn="initSegment",r&&(n.levelkeys=r),n.initSegment=null}function x_(n,e,t){n.levelkeys=e;const{encryptedFragments:r}=t;(!r.length||r[r.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&r.push(n)}function Kr(n,e,t){n.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function UV(n,e,t){n.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function fm(n,e){const t=e.startPTS;if(X(t)){let r=0,i;e.sn>n.sn?(r=t-n.start,i=n):(r=n.start-t,i=e),i.duration!==r&&i.setDuration(r)}else e.sn>n.sn?n.cc===e.cc&&n.minEndPTS?e.setStart(n.start+(n.minEndPTS-n.start)):e.setStart(n.start+n.duration):e.setStart(Math.max(n.start-e.duration,0))}function uC(n,e,t,r,i,s,a,o){r-t<=0&&(o.warn("Fragment should have a positive duration",e),r=t+e.duration,s=i+e.duration);let u=t,c=r;const d=e.startPTS,f=e.endPTS;if(X(d)){const v=Math.abs(d-t);n&&v>n.totalduration?o.warn(`media timestamps and playlist times differ by ${v}s for level ${e.level} ${n.url}`):X(e.deltaPTS)?e.deltaPTS=Math.max(v,e.deltaPTS):e.deltaPTS=v,u=Math.max(t,d),t=Math.min(t,d),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,c=Math.min(r,f),r=Math.max(r,f),s=e.endDTS!==void 0?Math.max(s,e.endDTS):s}const h=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(r-e.start),e.startPTS=t,e.maxStartPTS=u,e.startDTS=i,e.endPTS=r,e.minEndPTS=c,e.endDTS=s;const p=e.sn;if(!n||p<n.startSN||p>n.endSN)return 0;let m;const g=p-n.startSN,y=n.fragments;for(y[g]=e,m=g;m>0;m--)fm(y[m],y[m-1]);for(m=g;m<y.length-1;m++)fm(y[m],y[m+1]);return n.fragmentHint&&fm(y[y.length-1],n.fragmentHint),n.PTSKnown=n.alignedSliding=!0,h}function BV(n,e,t){if(n===e)return;let r=null;const i=n.fragments;for(let c=i.length-1;c>=0;c--){const d=i[c].initSegment;if(d){r=d;break}}n.fragmentHint&&delete n.fragmentHint.endPTS;let s;jV(n,e,(c,d,f,h)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==c.cc){const p=c.cc-d.cc;for(let m=f;m<h.length;m++)h[m].cc+=p;e.endCC=h[h.length-1].cc}X(c.startPTS)&&X(c.endPTS)&&(d.setStart(d.startPTS=c.startPTS),d.startDTS=c.startDTS,d.maxStartPTS=c.maxStartPTS,d.endPTS=c.endPTS,d.endDTS=c.endDTS,d.minEndPTS=c.minEndPTS,d.setDuration(c.endPTS-c.startPTS),d.duration&&(s=d),e.PTSKnown=e.alignedSliding=!0),c.hasStreams&&(d.elementaryStreams=c.elementaryStreams),d.loader=c.loader,c.hasStats&&(d.stats=c.stats),c.initSegment&&(d.initSegment=c.initSegment,r=c.initSegment)});const a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(r&&o.forEach(c=>{var d;c&&(!c.initSegment||c.initSegment.relurl===((d=r)==null?void 0:d.relurl))&&(c.initSegment=r)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(c=>!c),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments ski
84pped in delta playlist");for(let c=e.skippedSegments;c--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=$V(n.dateRanges,e,t));const c=n.fragments.filter(d=>d.rawProgramDateTime);if(n.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d<o.length;d++)o[d].programDateTime===null&&I0(o[d],o[d-1],c);lC(c,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var l;const c=fC(n,e.startSN-1);e.startCC=(l=c?.cc)!=null?l:a[0].cc}if(GV(n.partList,e.partList,(c,d)=>{d.elementaryStreams=c.elementaryStreams,d.stats=c.stats,d.gap=c.gap||d.gap}),s){const c=e.iframesOnly&&s.type===te.MAIN;uC(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,c,t)}else cC(n,e);a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=n.driftStartTime,e.driftStart=n.driftStart;const u=e.advancedDateTime;if(e.advanced&&u){const c=e.edge;e.driftStart||(e.driftStartTime=u,e.driftStart=c),e.driftEndTime=u,e.driftEnd=c}else e.driftEndTime=n.driftEndTime,e.driftEnd=n.driftEnd,e.advancedDateTime=n.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=n.requestScheduled)}function $V(n,e,t){const{dateRanges:r,recentlyRemovedDateranges:i}=e,s=Ne({},n);i&&i.forEach(l=>{delete s[l]});const o=Object.keys(s).length;return o?(Object.keys(r).forEach(l=>{const u=s[l],c=new nC(r[l].attr,u);c.isValid?(s[l]=c,u||(c.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${We(r[l].attr)}"`)}),s):r}function GV(n,e,t){if(n&&e){let r=0;for(let i=0,s=n.length;i<s;i++){const a=n[i],o=e[i+r];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):r--}}}function jV(n,e,t){var r;const i=e.skippedSegments,s=Math.max(n.startSN,e.startSN)-e.startSN,a=(n.fragmentHint?1:0)+(i?e.endSN:Math.min(n.endSN,e.endSN))-e.startSN,o=e.startSN-n.startSN,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,u=(r=n.fragmentHint)!=null&&r.duration?n.fragments.concat(n.fragmentHint):n.fragments;for(let c=s;c<=a;c++){const d=u[o+c];let f=l[c];if(i&&!f&&d&&(f=e.fragments[c]=d),d&&f){t(d,f,c,l);const h=d.relurl,p=f.relurl;if(h&&VV(h,p)){e.playlistParsingError=T_(`media sequence mismatch ${f.sn}:`,n,e,d,f);return}else if(d.cc!==f.cc){e.playlistParsingError=T_(`discontinuity sequence mismatch (${d.cc}!=${f.cc})`,n,e,d,f);return}}}}function T_(n,e,t,r,i){return new Error(`${n} ${i.url} 85Playlist starting @${e.startSN} 86${e.m3u8} 87 88Playlist starting @${t.startSN} 89${t.m3u8}`)}function cC(n,e,t=!0,r){const i=e.startSN+e.skippedSegments-n.startSN,s=n.fragments,a=i>=0;let o=0;if(a&&i<s.length)o=s[i].start,r?.log(`Aligning playlists based on SN ${e.startSN} (diff: ${o})`);else if(a&&e.startSN===n.endSN+1)o=n.fragmentEnd,r?.log(`Aligning playlists based on first/last SN ${e.startSN} (diff: ${o})`);else if(a&&t)o=n.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)o=n.fragmentStart,r?.log(`Aligning playlists based on first SN ${e.startSN} (diff: ${o})`);else return o;return HV(e,o),o}function HV(n,e){if(e){const t=n.fragments;for(let r=n.skippedSegments;r<t.length;r++)t[r].addStart(e);n.fragmentHint&&n.fragmentHint.addStart(e)}}function dC(n,e=1/0){let t=1e3*n.targetduration;if(n.updated){const r=n.fragments;if(r.length&&t*4>e){const s=r[r.length-1].duration*1e3;s>0&&s<t&&(t=s)}}else t/=2;return Math.round(t)}function fC(n,e,t){var r;if(!n)return null;let i=n.fragments[e-n.startSN];return i||(i=n.fragmentHint,((r=i)==null?void 0:r.sn)===e)?i:t&&e<n.startSN&&t.sn===e?t:null}function __(n,e,t){return n?hC(n.partList,e,t):null}function hC(n,e,t){if(n)for(let r=n.length;r--;){const i=n[r];if(i.index===t&&i.fragment.sn===e)return i}return null}function pC(n){n.forEach((e,t)=>{var r;(r=e.details)==null||r.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t)})})}function VV(n,e){return n!==e&&e?b_(n)!==b_(e):!1}function b_(n){return n.replace(/\?[^?]*$/,"")}function wl(n,e){for(let r=0,i=n.length;r<i;r++){var t;if(((t=n[r])==null?void 0:t.cc)===e)return n[r]}return null}function WV(n,e){return!!(n&&e.startCC<n.endCC&&e.endCC>n.startCC)}function I_(n,e){const t=n.start+e;n.setStart(t)}function mC(n,e){const t=e.fragments;for(let r=0,i=t.length;r<i;
vendor: 4,137 bytes, line 89
89r++)I_(t[r],n);e.fragmentHint&&I_(e.fragmentHint,n),e.alignedSliding=!0}function kf(n,e,t){n&&(zV(e,n,t),e.alignedSliding||KV(e,n,t),!e.alignedSliding&&!e.skippedSegments&&cC(n,e,!1,t))}function zV(n,e,t){if(!WV(e,n))return;const r=Math.min(e.endCC,n.endCC),i=wl(e.fragments,r),s=wl(n.fragments,r);if(!i||!s)return;const a=i.start-s.start;t.log(`Aligning playlists using dicontinuity sequence ${r} (diff: ${a})`),mC(a,n)}function KV(n,e,t){if(!n.hasProgramDateTime||!e.hasProgramDateTime)return;const r=n.fragments,i=e.fragments;if(!r.length||!i.length)return;let s,a;const o=Math.min(e.endCC,n.endCC);e.startCC<o&&n.startCC<o&&(s=wl(i,o),a=wl(r,o)),(!s||!a)&&(s=i[Math.floor(i.length/2)]||i.filter(f=>!!f)[0],a=wl(r,s.cc)||r[Math.floor(r.length/2)]);const l=s.programDateTime,u=a.programDateTime;if(!l||!u)return;const c=(u-l)/1e3;if(Math.abs(c)>Math.max(60,n.totalduration)){t.log(`Cannot align playlists using PDT without overlap (${Math.abs(c)} > ${n.totalduration})`);return}const d=c-(a.start-s.start);t.log(`Aligning playlists using PDT (diff: ${d})`),mC(d,n)}function Me(n,e,t){Oe(n,e,t),n.addEventListener(e,t)}function Oe(n,e,t){n.removeEventListener(e,t)}function Df(n){let e="";const t=n.length;for(let r=0;r<t;r++)e+=`[${n.start(r).toFixed(3)}-${n.end(r).toFixed(3)}]`;return e}const H={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class eS extends tC{constructor(e,t,r,i,s){super(i,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragPlaying=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=H.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=-1,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.initFragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:a,fragCurrent:o,media:l,mediaBuffer:u,state:c}=this,d=l?l.currentTime:0,f=le.bufferInfo(u||l,d,a.maxBufferHole),h=f.len;if(this.log(`Media seeking to ${d}, state: ${c}, ${h?"in":"out of"} buffer`),this.state===H.ENDED)this.resetLoadingState();else if(o){const m=a.maxFragLookUpTolerance,g=o.start-m,y=o.start+o.duration+m;if(!h||y<f.start||g>f.end){const v=d<g,S=d>y;(v||S)&&(o.loader&&(S||!this.isFragmentNearlyDownloaded(o))?(this.log(`Cancelling fragment load for seek (sn: ${o.sn}) - ${v?"backward":"forward"} seek`),o.abortRequests(),this.resetLoadingState()):this.fragPrevious=null)}}if(l){this.fragmentTracker.removeFragmentsInRange(d,1/0,this.playlistType,!0);const m=this.lastCurrentTime;if(d>m&&(this.lastCurrentTime=d),!this.loadingParts){const g=Math.max(f.end,d),y=this.shouldLoadParts(this.getLevelDetails(),g);y&&(this.log(`LL-Part loading ON after seeking to ${d} with buffer @${g}`),this.loadingParts=y)}}const p=!le.isBuffered(l,d);(!this.hls.hasEnoughToStart||p)&&(this.log(`Setting ${p?"startPosition":"nextLoadPosition"} to ${d} for seek without enough to start`),this.nextLoadPosition=d,p&&(this.startPosition=d)),h<1&&this.state===H.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new i_(e.config),this.initFragmentLoader=new i_(e.config),this.keyLoader=r,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Yv(e.config)}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;
vendor: 18,341 bytes, line 89
89e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===H.STOPPED)return;this.fragmentLoader.abort(),this.initFragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=H.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;if(t===-1&&e){const r=this.getLevelDetails();return r!=null&&r.live?(this.hls.liveSyncPosition||r.fragmentStart)+this.timelineOffset:e}return t}get bufferingEnabled(){return this.buffering}get backtrackFragment(){}set backtrackFragment(e){}get couldBacktrack(){return!1}set couldBacktrack(e){}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const r=e.end||0,i=this.config.timelineOffset||0;if(r<=i)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=le.bufferedInfo(s,e.start,0));const a=e.nextStart;if(a&&a>i&&a<t.edge||this.media.currentTime<e.start)return!1;const l=t.partList;if(l!=null&&l.length){const c=l[l.length-1];return le.isBuffered(this.media,c.start+c.duration/2)}const u=t.fragments[t.fragments.length-1];return this.fragmentTracker.isEndListAppended(u.type)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const r=this.media=this.mediaBuffer=t.media;Me(r,"seeking",this.onMediaSeeking),Me(r,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===H.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(e,t){this.fragPlaying=null;const r=!!t.transferMedia,i=this.media;if(i!==null){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Oe(i,"seeking",this.onMediaSeeking),Oe(i,"ended",this.onMediaEnded),this.media=this.mediaBuffer=null,this.loopSn=void 0,r){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.fragPlaying=this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=0,this.startPosition=-1,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=H.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.initFragmentLoader&&this.initFragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.decrypter=this.keyLoader=null,this.fragmentLoader=this.initFragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,r){this.startFragRequested=!0,this._loadFragForPlayback(e,t,r)}_loadFragForPlayback(e,t,r){const i=s=>{const a=s.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(a,!1,s.part)} was dropped during download.`),this.fragmentTracker.removeFragment(a);return}const o=++a.stats.chunkCount;this.log(`load progress ${a.type} sn: ${a.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(a,!1,s.part)} chunk: ${o}`),this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,r,i).then(s=>{if(!s)return;const a=this.state,o=s.frag;if(this.fragContextChanged(o)){(a===H.FRAG_LOADING||!this.fragCurrent&&a===H.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=H.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level} (bytes ${o.stats.loaded})`),this.hls.trigger(E.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===H.STOPPED||this.state===H.ERROR||(this.log(`Frag error ${e.type} sn:${e.sn} cc:${e.cc}: ${s?.message||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:r}=this;if(r.getState(e)===rt.APPENDING){const s=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,s),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&r.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?r.removeAllFragments():r.hasParts(e.type)&&(r.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),r.getState(e)===rt.PARTIAL&&r.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=this.fragmentTracker,r=e.fragments[e.fragments.length-1];if(r.endList&&!t.isEndListAppended(this.playlistType)){const i=t.getPartialFragment(r.end);i&&(t.removeFragment(i),t.fragBuffered(r,!0))}t.detectPartialFragments({frag:r,part:null,stats:r.stats,id:r.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,r=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:r};this.hls.trigger(E.BUFFER_FLUSHING,i)}_loadInitSegment(e){const{hls:t}=this;return this.initFragmentLoader.abort(),t.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:0}),this.initFragmentLoader.load(e).then(r=>{var i;const s=r.frag;if(!this.levels||!g0(s,(i=this.fragCurrent)==null?void 0:i.initSegment))throw new Rr({type:re.NETWORK_ERROR,details:F.INTERNAL_ABORTED,error:new Error("init load aborted"),fatal:!1,frag:s,networkDetails:null});return r}).then(r=>{const{frag:i,payload:s}=r,a=i.decryptdata;if(s&&s.byteLength>0&&a!=null&&a.key&&a.iv&&Wa(a.method)){const o=self.performance.now(),{decryptRange:l}=Af(i,null,this.iframesOnly);return this.decrypter.decrypt(new Uint8Array(s),a.key.buffer,a.iv.buffer,Jv(a.method),l).catch(u=>{throw t.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:i}),this.fragmentLoader.abort(),u}).then(u=>{const c=self.performance.now();return t.trigger(E.FRAG_DECRYPTED,{frag:i,part:null,payload:u,stats:{tstart:o,tdecrypt:c}}),r.payload=u,this.completeInitSegmentLoad(r)})}return this.completeInitSegmentLoad(r)})}completeInitSegmentLoad(e){const t=e.frag.stats;e.frag.data=new Uint8Array(e.payload),t.parsing.start=t.buffering.start=self.performance.now(),t.parsing.end=t.buffering.end=self.performance.now()}loadInitSegmentIfNeeded(e){const{initSegment:t}=e;if(!this.bitrateTest&&at(e)&&t&&!t.data){var r;return(t.encrypted&&!((r=t.decryptdata)!=null&&r.key)?this.keyLoader.load(t).then(()=>this._loadInitSegment(t)):this._loadInitSegment(t)).catch(s=>{throw this.state===H.STOPPED||this.state===H.ERROR||("data"in s&&(s.data.frag=e,this.fragmentLoader.abort(),this.handleFragLoadError(s)),this.resetFragmentLoading(e)),s})}}unhandledEncryptionError(e,t){var r,i;const s=e.tracks;if(s&&!t.encrypted&&((r=s.audio)!=null&&r.encrypted||(i=s.video)!=null&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(E.ERROR,{type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!g0(e,t)}fragBufferedComplete(e,t){const r=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${r?Df(le.getBuffered(r)):"(detached)"})`),at(e)){var i;if(e.type!==te.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=H.IDLE;return}}const s=(i=this.levels)==null?void 0:i[e.level];s!=null&&s.fragmentError&&(t||this.fragmentTracker.getState(e)!==rt.PARTIAL)&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0,e.stats.retry=0)}this.state=H.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const r=e.frag,{part:i,partsLoaded:s}=e,a=!s||s.length===0||s.some(u=>!u),{decryptRange:o}=Af(r,i),l=new Xv(r.level,r.sn,r.stats.chunkCount+1,0,i?i.index:-1,!a,r.duration,this.iframesOnly,o);this.log(`load complete ${r.type} sn: ${r.sn}${i?" part: "+i.index:""} of ${this.fragInfo(r,!1,i)}`),t.flush(l)}_handleFragmentLoadProgress(e){}loadKeyFor(e,t,r){var i;let s=null;return e.encrypted&&!((i=e.decryptdata)!=null&&i.key)?(this.log(`Loading key for ${e.sn} of [${t.startSN}-${t.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=H.KEY_LOADING,s=this.keyLoader.load(e,r).then(a=>{if(!this.fragContextChanged(a.frag))return this.hls.trigger(E.KEY_LOADED,a),this.state===H.KEY_LOADING&&(this.state=H.IDLE),a}),this.hls.trigger(E.KEY_LOADING,{frag:e})):e.encrypted||(s=this.keyLoader.loadClear(e,t.encryptedFragments,this.startFragRequested),s&&this.log(`[eme] blocking frag sn: ${e.sn} load until media-keys acquired`)),s}_doFragLoad(e,t,r=null,i){this.fragCurrent=e;const s=t.details;if(!this.levels||!s)throw new Error(`frag load aborted, missing level${s?"":" detail"}s`);const a=this.fragPrevious;if(!sl(e,a)){const h=this.shouldLoadParts(t.details,e.end);h!==this.loadingParts&&(this.log(`LL-Part loading ${h?"ON":"OFF"} loading sn ${a?.sn}->${e.sn}`),this.loadingParts=h)}if(r=Math.max(e.start,r||0),this.loadingParts){const h=s.partList;if(h&&i){r>s.fragmentEnd&&s.fragmentHint&&(e=s.fragmentHint);const p=this.getNextPart(h,e,r);if(p>-1){const m=h[p];if(e=this.fragCurrent=m.fragment,!sl(e,a)&&!this.shouldLoadParts(t.details,e.end))return this.log(`LL-Part loading OFF @${this.playhead} next part: ${this.fragInfo(e,!1,m)}`),this.loadingParts=!1,Promise.resolve(null);if(!this.filterReplacedPrimary(m,t.details))return Promise.resolve(null);const g=this.loadKeyFor(e,s);if(this.fragContextChanged(e))return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} part: ${m.index} (${p}/${h.length-1}) of ${this.fragInfo(e,!1,m)} cc: ${e.cc} [${s.startSN}-${s.endSN}], target: ${r}${m.byteRange.length?` range:${m.byteRange.join("-")}`:""}`),this.nextLoadPosition=m.start+m.duration,this.state=H.FRAG_LOADING;let y;const v=this.loadInitSegmentIfNeeded(e);if(g||v){const S=!!g;y=Promise.all([g,v]).then(([x])=>S&&(!x||this.fragContextChanged(x.frag))?null:this.doFragPartsLoad(e,m,t,i)).catch(x=>this.handleFragLoadError(x))}else y=this.doFragPartsLoad(e,m,t,i).catch(S=>this.handleFragLoadError(S));return this.hls.trigger(E.FRAG_LOADING,{frag:e,part:m,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):y}else if(!e.url||this.loadedEndOfParts(h,r))return Promise.resolve(null)}}if(this.loadingParts){var o;this.log(`LL-Part loading OFF after next part miss @${r} Check buffer at sn: ${e.sn} loaded parts: ${(o=s.partList)==null?void 0:o.filter(h=>h.loaded).map(h=>`[${h.start}-${h.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);if(!this.filterReplacedPrimary(e,t.details))return Promise.resolve(null);const l=this.loadInitSegmentIfNeeded(e),u=this.loadKeyFor(e,s,l);if(this.fragContextChanged(e)){var c;return this.log(`Context changed in KEY_LOADING sn: ${e.sn} ${e.relurl} > ${(c=this.fragCurrent)==null?void 0:c.relurl}`),l?.catch(()=>null),u?.catch(()=>null),Promise.resolve(null)}this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)} cc: ${e.cc} ${"["+s.startSN+"-"+s.endSN+"]"}, target: ${r}${e.byteRange.length?` range:${e.byteRange.join("-")}`:""}`),X(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=H.FRAG_LOADING;const d=this.config.progressive&&e.type!==te.SUBTITLE;let f;return d&&u?f=u.then(h=>!h||this.fragContextChanged(h.frag)?null:this.fragmentLoader.load(e,this.iframesOnly,i,l)).catch(h=>this.handleFragLoadError(h)):f=Promise.all([this.fragmentLoader.load(e,this.iframesOnly,d?i:void 0,d?l:void 0),u,l]).then(([h])=>(!d&&i&&i(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):Promise.all([f,l]).then(([h])=>h)}doFragPartsLoad(e,t,r,i){return new Promise((s,a)=>{var o;const l=[],u=(o=r.details)==null?void 0:o.partList,c=d=>{this.fragmentLoader.loadPart(e,d,i).then(f=>{l[d.index]=f;const h=f.part;this.hls.trigger(E.FRAG_LOADED,f);const p=__(r.details,e.sn,d.index+1)||hC(u,e.sn,d.index+1);if(p)c(p);else return s({frag:e,part:h,partsLoaded:l})}).catch(a)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===F.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===re.KEY_SYSTEM_ERROR&&!t.fatal&&(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)),this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==H.PARSING){!this.fragCurrent&&this.state!==H.STOPPED&&this.state!==H.ERROR&&(this.state=H.IDLE);return}const{frag:r,part:i,level:s}=t,a=self.performance.now();r.stats.parsing.end=a,i&&(i.stats.parsing.end=a);const o=this.getLevelDetails(),u=o&&r.sn>o.endSN||this.shouldLoadParts(o,r.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${r.end}`),this.loadingParts=u),this.updateLevelTiming(r,i,s,e)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList&&!this.iframesOnly){var r;const i=e.partList[0],s=i.end+(((r=e.fragmentHint)==null?void 0:r.duration)||0);if(t>=s&&this.playhead>i.start-i.fragment.duration)return!0}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:r}=this,{level:i,sn:s,part:a}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const o=t[i],l=o.details,u=a>-1?__(l,s,a):null,c=u?u.fragment:fC(l,s,r);return c?(r&&r!==c&&(c.stats=r.stats),{frag:c,part:u,level:o}):null}bufferFragmentData(e,t,r,i,s){if(this.state!==H.PARSING)return;at(t)&&!this.fragContextChanged(t)&&(this.fragPrevious=t);const{data1:a,data2:o}=e;let l=a;if(o&&(l=Kn(a,o)),!l.length)return;const u=this.initPTS[t.cc],c=u?-u.baseTime/u.timescale:void 0,d={type:e.type,frag:t,part:r,chunkMeta:i,offset:c,parent:t.type,data:l};if(this.hls.trigger(E.BUFFER_APPENDING,d),e.dropped&&e.independent&&!r){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!le.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const r=t.currentTime,i=le.bufferInfo(t,r,0),s=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),o=Math.max(Math.min(e.start-a,i.end-a),r+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var r;const i=this.playhead,a=this.lastCurrentTime>i||(r=this.media)!=null&&r.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,a)}getFwdBufferInfoAtPos(e,t,r,i){const s=le.bufferInfo(e,t,i);if(s.len===0&&s.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,r);if(a&&(s.nextStart<=a.end||a.gap)){const o=Math.max(Math.min(s.nextStart,a.end)-t,i);return le.bufferInfo(e,t,o)}}return s}getMaxBufferLength(e){const{config:t}=this;let r;return e?r=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):r=t.maxBufferLength,Math.min(r,t.maxMaxBufferLength)}exceedsMaxBuffer(e,t,r){const i=e.nextStart;if(i&&r.start>i){const s=e.buffered;if(s){let a=e.len;const o=e.bufferedIndex;for(let l=s.length-1;l>o;l--)s[l].start<r.start&&(a+=s[l].end-s[l].start);return a>=t}}return!1}reduceMaxBufferLength(e,t){const r=this.config,i=Math.max(Math.min(e-t,r.maxBufferLength),t/2),s=Math.max(e-t*3,r.maxMaxBufferLength/2,i);return s>=i?(r.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e){const t=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,this.playlistType):null;return t&&"fragment"in t?t.fragment:t}getNextFragment(e,t){const r=t.fragments,i=r.length;if(!i)return null;const{config:s}=this,a=t.fragmentStart,o=s.lowLatencyMode&&!!t.partList;let l=null;if(t.live){const d=s.initialLiveManifestSize;if(i<d)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${d})`),null;if(!this.startFragRequested&&o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var u;l=this.getInitialLiveFragment(t);const f=this.config.startPosition,h=this.hls.startPosition,p=this.hls.liveSyncPosition,m=((u=l)==null?void 0:u.start)||0;let g,y;if(h!==-1&&h>=a?(g=h,y=h===f?"config":"next load start"):p?(g=p,y="live edge"):(g=e,y="buffer pos"),g<m&&(g=m,y="live frag start"),g<a&&(g=a,y="playlist start"),this.startPosition!=g||this.nextLoadPosition!=g){const S=t.live&&!this.filterReplacedPrimary(l,t)?-1:g;this.log(`Setting startPosition to ${S} next load ${g} ${h===-1?"":`(from ${f}) `}based on ${y}. live edge: ${p} live frag start: ${m} playlist start: ${a} buffer pos: ${e}`),this.startPosition=S,this.nextLoadPosition=g}}}else e<=a&&(l=r[0]);if(!l){const d=this.loadingParts?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,d,t)}let c=this.filterReplacedPrimary(l,t);return!c&&l&&(c=ZL(t,l.sn),c&&(this.nextLoadPosition=c.start)),c}isLoopLoading(e,t){if(this.nextLoadPosition<=t)return!1;const r=this.fragmentTracker.getState(e);return!!(r===rt.OK||r===rt.PARTIAL&&(e.gap||e.stats.retry>1))}getNextFragmentLoopLoading(e,t,r,i,s){let a=null;
vendor: 2,728 bytes, line 89
89if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&r.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,i,0);if(o!==null&&r.len+o.len>=s){const l=a.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(Pf(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Pf(this.config)&&("type"in e?e:e.fragment).type!==te.SUBTITLE){const r=this.hls.interstitialsManager,i=r?.bufferingItem;if(i){const s=i.event;if(s){if(!s.appendInPlace&&(Math.abs(e.start-i.start)>1||i.start===0))return null}else if(e.end<=i.start&&t?.live===!1||e.start>=i.end&&i.nextEvent&&(i.nextEvent.appendInPlace&&!i.nextEvent.hasPlayed||e.start-i.end>1))return null}if(gC(e,r?.playerQueue,this.playhead))return null}return e}getNextPart(e,t,r){let i=-1,s=!1,a=!0;for(let l=0,u=e.length;l<u;l++){const c=e[l];if(a=a&&!c.independent,i>-1&&r<c.start)break;const d=c.loaded||c.gap;d?i=-1:(s||(c.independent||a)&&c.fragment===t)&&(i=l),s=d&&!c.gap}const o=e[i];return o&&o.fragment!==t&&this.log(`Need buffer at ${r} but next unloaded part starts at ${o.start} (sn: ${t.sn} -> ${o.fragment.sn})`),i}loadedEndOfParts(e,t){let r;for(let i=e.length;i--;){if(r=e[i],!r.loaded)return!1;if(t>r.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,r=this.fragPrevious;let i=null;if(r){if(e.hasProgramDateTime&&(i=cV(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance),i&&this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`)),!i){const s=r.sn+1;if(s>=e.startSN&&s<=e.endSN){const a=t[s-e.startSN];r.cc===a.cc&&(i=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=JL(e,r.cc,r.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,r){const{config:i}=this;let{fragPrevious:s}=this,{fragments:a,endSN:o}=r;const{fragmentHint:l}=r,{maxFragLookUpTolerance:u}=i,c=r.partList,d=!!(this.loadingParts&&c!=null&&c.length&&l);d&&!this.bitrateTest&&c[c.length-1].fragment.sn===l.sn&&(a=a.concat(l),o=l.sn),s&&this.fragmentTracker.getState(s)===rt.NOT_LOADED&&(s=null);let f;if(e<t){var h;const m=e<this.lastCurrentTime||e>t-u||(h=this.media)!=null&&h.paused||!this.startFragRequested?0:u;f=po(s,a,e,m)}else f=a[a.length-1];if(f){const p=f.sn-r.startSN,m=this.fragmentTracker.getState(f);
vendor: 4,832 bytes, line 89
89if((m===rt.OK||m===rt.PARTIAL&&f.gap)&&(s=f),sl(f,s)&&(!d||c[0].fragment.sn>f.sn||!r.live)){const g=a[p+1];f.sn<o&&this.fragmentTracker.getState(g)!==rt.OK?f=g:f=null}}return f}alignPlaylists(e,t,r){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,a=!t,o=e.alignedSliding&&X(s);if(a||!o&&!s){kf(r,e,this);const l=e.fragmentStart;return this.log(`Live playlist sliding: ${l} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${i}`),l}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let r=this.startPosition;r<t&&(r=-1);const i=this.timelineOffset;if(r===-1){const s=this.startTimeOffset!==null,a=s?this.startTimeOffset:e.startTimeOffset;if(a!==null&&X(a))r=t+a,a<0&&(r+=e.edge),r=Math.min(Math.max(t,r),t+e.totalduration),this.log(`Setting startPosition to ${r} for start time offset ${a} found in ${s?"multivariant":"media"} playlist`),this.startPosition=r;else if(e.live){const o=this.hls.liveSyncPosition;r=o||t,this.log(`Setting startPosition to -1 to start at ${o?"live edge":"playlist start"} ${r}`),this.startPosition=-1}else this.log("setting startPosition to 0 by default"),this.startPosition=r=0;this.lastCurrentTime=r+i}this.nextLoadPosition=r+i}getLoadPosition(){var e;const{media:t}=this;let r=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t&&!this.iframesOnly?r=t.currentTime:this.nextLoadPosition>=0&&(r=this.nextLoadPosition),r}get playhead(){var e;if((e=this.hls)!=null&&e.hasEnoughToStart){var t;const r=(t=this.media)==null?void 0:t.currentTime;return X(r)?r:this.lastCurrentTime}return this.getLoadPosition()}get iframesOnly(){var e;if(this.playlistType!==te.MAIN)return!1;const t=this.getLevelDetails();return t?t.iframesOnly:(e=this.levelLastLoaded)==null?void 0:e.iframes}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&at(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==H.FRAG_LOADING_WAITING_RETRY)&&(this.state=H.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const v=this.getCurrentContext(t.chunkMeta);v&&(t.frag=v.frag)}const{frag:r,part:i}=t;if(!r||!this.levels||r.type!==e)return;if(this.fragContextChanged(r)){var s;this.warn(`Frag load error must match current frag to retry ${r.relurl} > ${(s=this.fragCurrent)==null?void 0:s.relurl}`);return}const a=t.details===F.FRAG_GAP;a&&this.fragmentTracker.addAsGap(r);const o=t.errorAction;if(!o){this.state=H.ERROR;return}const{action:l,flags:u,retryCount:c=0,retryConfig:d}=o,f=!!d,h=f&&l===Ft.RetryRequest,p=f&&!o.resolved&&u&At.MoveAllAlternatesMatchingHost,m=this.hls.latestLevelDetails,g=m?.live;if(!h&&p&&at(r)&&g&&r.sn<m.endSN&&!TL(t))this.resetFragmentErrors(e),i?i.gap=!0:this.treatAsGap(r),o.resolved=!0;else if((h||p)&&c<d.maxNumRetry){var y;const v=cu((y=t.response)==null?void 0:y.code),S=Hv(d,c);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+S,this.state=H.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,v){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${c+1}/${d.maxNumRetry} in ${S}ms`)}else if(d)if(this.resetFragmentErrors(e),c<d.maxNumRetry)!a&&l!==Ft.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${c})`);return}else l===Ft.SendAlternateToPenaltyBox?this.state=H.WAITING_LEVEL:this.state=H.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,r=t===1/0;(!t||e>=t||r&&!cu(0))&&(r&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=H.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===H.PARSING||this.state===H.PARSED){const t=e.frag,r=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,r),s=i&&i.len>.5;s&&this.reduceMaxBufferLength(i.len,t?.duration||10);const a=!s;return a?this.warn(`Buffer full error while media.currentTime (${this.playhead}) is not buffered, flush ${r} buffer`):i.nextStart&&t&&i.nextStart>t.start&&this.flushMainBuffer(i.nextStart,Number.POSITIVE_INFINITY,r===te.AUDIO?r:void 0),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===te.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==H.STOPPED&&(this.state=H.IDLE)}afterBufferFlushed(e,t){if(!e)return;const r=le.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,this.playlistType),this.state===H.ENDED&&this.resetLoadingState()}
vendor: 79,112 bytes, line 89
89resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==H.STOPPED&&(this.state=H.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.getLevelDetails();e!=null&&e.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(e,e.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,r,i){const s=r.details;if(!s){this.warn("level.details undefined");return}if(this.log(`update level timing ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)}`),!Object.keys(e.elementaryStreams).reduce((d,f)=>{const h=e.elementaryStreams[f];if(h){const p=h.endPTS-h.startPTS;if(p<=0)return this.warn(`Could not parse fragment ${e.sn} ${f} duration reliably (${p})`),d||!1;const m=i.partial?0:uC(s,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS,this.iframesOnly,this);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:s,level:r,drift:m,type:f,frag:e,start:h.startPTS,end:h.endPTS}),!0}return d},!1)){var o,l,u,c;const d=((o=this.transmuxer)==null?void 0:o.error)===null,f=((l=this.transmuxer)==null?void 0:l.error)!=null,h=((u=(c=this.levels)==null?void 0:c.length)!=null?u:0)>1;if((r.fragmentError===0||d&&(r.fragmentError<2||e.endList)||f&&h)&&this.treatAsGap(e,r),d){const p=new Error(`Found no media in ${this.playlistLabel()} ${e.level} ${t?`part: ${t.index} of `:""}sn: ${e.sn} at playlist time: ${e.start}. Resetting transmuxer to fallback to playlist timing`);if(this.warn(p.message),this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.FRAG_PARSING_ERROR,fatal:!1,error:p,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=H.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)}`),this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t,chunkMeta:i})}playlistLabel(){return`${this.playlistType} playlist`}fragInfo(e,t=!0,r){var i,s;return`${this.playlistLabel()} ${e.level} (${r?"part":"frag"}:[${(i=t&&!r?e.startPTS:(r||e).start)!=null?i:NaN}-${(s=t&&!r?e.endPTS:(r||e).end)!=null?s:NaN}]${r&&e.type==="main"?"INDEPENDENT="+(r.independent?"YES":"NO"):""})`}treatAsGap(e,t){t&&t.fragmentError++,this.fragmentTracker.addAsGap(e)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}isFragmentNearlyDownloaded(e){var t;const r=(t=e.loader)==null?void 0:t.stats;if(!r)return!1;const i=r.loading.first>0,a=(r.total-r.loaded)/(this.hls.bandwidthEstimate||this.hls.config.abrEwmaDefaultEstimate);return i&&a<=.15}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}calculateOptimalSwitchPoint(e,t){let r=0;const{hls:i,media:s,config:a,levels:o,playlistType:l}=this,u=this.getLevelDetails();if(s&&!s.paused&&o){var c;const h=l===te.AUDIO?KL(e.audioCodec,128e3):e.maxBitrate,p=1+i.ttfbEstimate/1e3,m=i.bandwidthEstimate*a.abrBandWidthUpFactor,g=u&&(this.loadingParts?u.partTarget:u.averagetargetduration)||((c=this.fragCurrent)==null?void 0:c.duration)||6;r=p+h*g/m,e.details||(r+=p)}const d=this.playhead,f=!(u!=null&&u.live)||t.end-d>r*1.5;return{fetchdelay:r,okToFlushForwardBuffer:f}}scheduleTrackSwitch(e,t,r){const{media:i,playlistType:s}=this;if(!i||!e)return;const a=r?this.getBufferedFrag(this.playhead+t):null;if(a){const l=this.followingBufferedFrag(a);if(l){var o;this.abortCurrentFrag();const u=l.maxStartPTS?l.maxStartPTS:l.start,c=l.duration,d=Math.max(a.end,u+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));if((((o=this.getLevelDetails())==null?void 0:o.fragmentStart)||0)>d)return;const h=s===te.MAIN?null:"audio";this.flushMainBuffer(d,Number.POSITIVE_INFINITY,h),this.cleanupBackBuffer()}}}cleanupBackBuffer(){const{media:e,playlistType:t}=this;if(!e)return;const r=this.getAppendedFrag(this.playhead);if(r&&r.start>1){const i=t===te.AUDIO;this.flushMainBuffer(0,r.start-(i?0:1),i?"audio":null)}}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,this.playlistType)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case H.KEY_LOADING:case H.FRAG_LOADING:case H.FRAG_LOADING_WAITING_RETRY:case H.PARSING:case H.PARSED:this.state=H.IDLE;break}this.nextLoadPosition=this.playhead}checkFragPlaying(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const r=e.currentTime;if(le.isBuffered(e,r)?t=this.getAppendedFrag(r):le.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t&&(this.backtrackFragment=void 0,!sl(t,this.fragPlaying)))return this.fragPlaying=t,!0}return!1}getBufferOutput(){return null}nextLevelSwitch(){const{levels:e,media:t,hls:r,config:i,playlistType:s}=this;if(t!=null&&t.readyState&&e&&r&&i){const a=this.getBufferOutput(),o=this.getFwdBufferInfo(a,s);if(!o)return;const l=s===te.AUDIO?r.nextAudioTrack:r.nextLoadLevel,u=e[l],{fetchdelay:c,okToFlushForwardBuffer:d}=this.calculateOptimalSwitchPoint(u,o);this.scheduleTrackSwitch(o,c,d)}this.tickImmediate()}}function gC(n,e,t){if(e)for(let r=e.length;r--;){const i=e[r].interstitial,s=i.startTime,a=Math.min(s+i.duration,i.resumeTime);if(i.appendInPlace&&(n.start>=s&&n.end<=a||t>n.start&&n.end>s&&n.start<a))return!0}return!1}function Pf(n){return!!n.interstitialsController&&n.enableInterstitialPlayback!==!1}class yC{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let r;if(e.length)e.length===1?r=e[0]:r=qV(e,t);else return new Uint8Array(0);return this.reset(),r}reset(){this.chunks.length=0,this.dataLength=0}}function qV(n,e){const t=new Uint8Array(e);let r=0;for(let i=0;i<n.length;i++){const s=n[i];t.set(s,r),r+=s.length}return t}var hm={exports:{}},w_;function YV(){return w_||(w_=1,function(n){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function s(l,u,c,d,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var h=new i(c,d||l,f),p=t?t+u:u;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],h]:l._events[p].push(h):(l._events[p]=h,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new r:delete l._events[u]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=t?t+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,h=d.length,p=new Array(h);f<h;f++)p[f]=d[f].fn;return p},o.prototype.listenerCount=function(u){var c=t?t+u:u,d=this._events[c];return d?d.fn?1:d.length:0},o.prototype.emit=function(u,c,d,f,h,p){var m=t?t+u:u;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,v,S;if(g.fn){switch(g.once&&this.removeListener(u,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,d),!0;case 4:return g.fn.call(g.context,c,d,f),!0;case 5:return g.fn.call(g.context,c,d,f,h),!0;case 6:return g.fn.call(g.context,c,d,f,h,p),!0}for(S=1,v=new Array(y-1);S<y;S++)v[S-1]=arguments[S];g.fn.apply(g.context,v)}else{var x=g.length,T;for(S=0;S<x;S++)switch(g[S].once&&this.removeListener(u,g[S].fn,void 0,!0),y){case 1:g[S].fn.call(g[S].context);break;case 2:g[S].fn.call(g[S].context,c);break;case 3:g[S].fn.call(g[S].context,c,d);break;case 4:g[S].fn.call(g[S].context,c,d,f);break;default:if(!v)for(T=1,v=new Array(y-1);T<y;T++)v[T-1]=arguments[T];g[S].fn.apply(g[S].context,v)}}return!0},o.prototype.on=function(u,c,d){return s(this,u,c,d,!1)},o.prototype.once=function(u,c,d){return s(this,u,c,d,!0)},o.prototype.removeListener=function(u,c,d,f){var h=t?t+u:u;if(!this._events[h])return this;if(!c)return a(this,h),this;var p=this._events[h];if(p.fn)p.fn===c&&(!f||p.once)&&(!d||p.context===d)&&a(this,h);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==c||f&&!p[m].once||d&&p[m].context!==d)&&g.push(p[m]);g.length?this._events[h]=g.length===1?g[0]:g:a(this,h)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=t?t+u:u,this._events[c]&&a(this,c)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,n.exports=o}(hm)),hm.exports}var XV=YV(),tS=$j(XV);const yu="1.7.3",mo={};function QV(){return typeof __HLS_WORKER_BUNDLE__=="function"}function JV(){const n=mo[yu];if(n)return n.clientCount++,n;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),i={worker:new self.Worker(t),objectURL:t,clientCount:1};return mo[yu]=i,i}function ZV(n){const e=mo[n];if(e)return e.clientCount++,e;const t=new self.URL(n,self.location.href).href,i={worker:new self.Worker(t),scriptURL:t,clientCount:1};return mo[n]=i,i}function e7(n){const e=mo[n||yu];if(e&&e.clientCount--===1){const{worker:r,objectURL:i}=e;delete mo[n||yu],i&&self.URL.revokeObjectURL(i),r.terminate()}}function t7(n,e,t,r){const i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[t+2],a=s>>2&15;if(a>12){const g=new Error(`invalid ADTS sampling index:${a}`);n.emit(E.ERROR,E.ERROR,{type:re.MEDIA_ERROR,details:F.FRAG_PARSING_ERROR,fatal:!0,error:g,reason:g.message});return}const o=(s>>6&3)+1,l=e[t+3]>>6&3|(s&1)<<2,u=i[a];let c=a;(o===5||o===29)&&(c-=3);let d;const f=(c&14)>>1,h=(c&1)<<7|l<<3;let p=0;if(o===1&&a>=6){p=5;const g=a-3;d=[p<<3|f,h|(g&14)>>1,(g&1)<<7|8,0]}else d=[o<<3|f,h];const m="mp4a.40."+(p||o);return Pe.log(`manifest codec:${r}, parsed codec:${m}, channels:${l}, rate:${u} (ADTS object type:${o} sampling index:${a} esds config:[${d.join(",")}])`),{config:d,samplerate:u,channelCount:l,codec:m,parsedCodec:m,manifestCodec:r}}function vC(n,e){return n[e]===255&&(n[e+1]&246)===240}function SC(n,e){return n[e+1]&1?7:9}function nS(n,e){return(n[e+3]&3)<<11|n[e+4]<<3|(n[e+5]&224)>>>5}function n7(n,e){return e+5<n.length}function Of(n,e){return e+1<n.length&&vC(n,e)}function r7(n,e){return n7(n,e)&&vC(n,e)&&nS(n,e)<=n.length-e}function i7(n,e){if(Of(n,e)){const t=SC(n,e);if(e+t>=n.length)return!1;const r=nS(n,e);if(r<=t)return!1;const i=e+r;return i===n.length||Of(n,i)}return!1}function EC(n,e,t,r,i){if(!n.samplerate){const s=t7(e,t,r,i);if(!s)return;Ne(n,s)}}function xC(n){return 1024*9e4/n}function s7(n,e){const t=SC(n,e);if(e+t<=n.length){const r=nS(n,e)-t;if(r>0)return{headerLength:t,frameLength:r}}}function TC(n,e,t,r,i){const s=xC(n.samplerate),a=r+i*s,o=s7(e,t);let l;if(o){const{frameLength:d,headerLength:f}=o,h=f+d,p=Math.max(0,t+h-e.length);p?(l=new Uint8Array(h-f),l.set(e.subarray(t+f,e.length),0)):l=e.subarray(t+f,t+h);const m={unit:l,pts:a};return p||n.samples.push(m),{sample:m,length:h,missing:p}}const u=e.length-t;return l=new Uint8Array(u),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:u,missing:-1}}let Qt=function(n){return n.audioId3="org.id3",n.dateRange="com.apple.quicktime.HLS",n.emsg="https://aomedia.org/emsg/ID3",n.misbklv="urn:misb:KLV:bin:1910.1",n}({});function Ar(n="",e=9e4){return{type:n,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class rS{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,r,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,r){}demux(e,t){this.cachedData&&(e=Kn(this.cachedData,e),this.cachedData=null);let r=du(e,0),i=r?r.length:0,s;const a=this._audioTrack,o=this._id3Track,l=r?Wv(r):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&X(l))&&(this.basePTS=a7(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:Qt.audioId3,duration:Number.POSITIVE_INFINITY});i<u;){if(this.canParse(e,i)){const c=this.appendFrame(a,e,i);c?(this.frameIndex++,this.lastPTS=c.sample.pts,i+=c.length,s=i):i=u}else sH(e,i)?(r=du(e,i),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:Qt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=r.length,s=i):i++;if(i===u&&s!==u){const c=e.slice(s);this.cachedData?this.cachedData=Kn(this.cachedData,c):this.cachedData=c}}return{audioTrack:a,videoTrack:Ar(),id3Track:o,textTrack:Ar()}}demuxSampleAes(e,t,r){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Ar(),id3Track:this._id3Track,textTrack:Ar()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const a7=(n,e,t)=>{if(X(n))return n*90;const r=t?t.baseTime*9e4/t.timescale:0;return e*9e4+r},o7=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],l7=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],u7=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],c7=[0,1,1,4];function _C(n,e,t,r,i){if(t+24>e.length)return;const s=bC(e,t);if(s&&t+s.frameLength<=e.length){const a=s.samplesPerFrame*9e4/s.sampleRate,o=r+i*a,l={unit:e.subarray(t,t+s.frameLength),pts:o,dts:o};return n.config=[],n.channelCount=s.channelCount,n.samplerate=s.sampleRate,n.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function bC(n,e){const t=n[e+1]>>3&3,r=n[e+1]>>1&3,i=n[e+2]>>4&15,s=n[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&s!==3){const a=n[e+2]>>1&1,o=n[e+3]>>6,l=t===3?3-r:r===3?3:4,u=o7[l*14+i-1]*1e3,d=l7[(t===3?0:t===2?1:2)*3+s],f=o===3?1:2,h=u7[t][r],p=c7[r],m=h*8*p,g=Math.floor(h*u/d+a)*p,y=bl();return!!y&&y<=87&&r===2&&u>=224e3&&o===0&&(n[e+3]=n[e+3]|128),{sampleRate:d,channelCount:f,frameLength:g,samplesPerFrame:m}}}function iS(n,e){return n[e]===255&&(n[e+1]&224)===224&&(n[e+1]&6)!==0}function IC(n,e){return e+1<n.length&&iS(n,e)}function d7(n,e){return iS(n,e)&&4<=n.length-e}function wC(n,e){if(e+1<n.length&&iS(n,e)){const r=bC(n,e);let i=4;r!=null&&r.frameLength&&(i=r.frameLength);const s=e+i;return s===n.length||IC(n,s)}return!1}class RC{constructor(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new Yv(t,!0)}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,ss.cbc,{start:0,end:e.byteLength})}decryptAacSample(e,t,r){const i=e[t].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),a=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,r)}).catch(r)}decryptAacSamples(e,t,r){for(;;t++){if(t>=e.length){r();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,r),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,r=new Int8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)r.set(e.subarray(s,s+16),i);return r}getAvcDecryptedUnit(e,t){const r=new Uint8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(r.subarray(i,i+16),s);return e}decryptAvcSample(e,t,r,i,s){const a=$L(s.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{s.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,r+1,i)}).catch(i)}decryptAvcSamples(e,t,r,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length){i();return}const s=e[t].units;for(;!(r>=s.length);r++){const a=s[r];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,r,i,a),!this.decrypter.isSync()))return}}}}class f7 extends rS{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.sampleAes=null,this.observer=e,this.config=t}resetInitSegment(e,t,r,i){super.resetInitSegment(e,t,r,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const r=du(e,0);let i=r?.length||0;if(wC(e,i))return!1;for(let s=e.length;i<s;i++)if(i7(e,i))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return r7(e,t)}appendFrame(e,t,r){EC(e,this.observer,t,r,e.manifestCodec);const i=TC(e,t,r,this.basePTS,this.frameIndex);if(i?.missing===0)return i}demuxSampleAes(e,t,r){const i=this.demux(e,r),s=this.sampleAes=new RC(this.observer,this.config,t);return new Promise(a=>{s.decryptAacSamples(i.audioTrack.samples,0,()=>{a(i)})})}}const AC=(n,e)=>{let t=0,r=5;e+=r;const i=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;r>0;){a[0]=n[e];const o=Math.min(r,8),l=8-o;s[0]=4278190080>>>24+l<<l,i[0]=(a[0]&s[0])>>l,t=t?t<<o|i[0]:i[0],e+=1,r-=o}return t};class h7 extends rS{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,r,i){super.resetInitSegment(e,t,r,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,r){const i=LC(e,t,r,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=du(e,0);if(!t)return!1;const r=t.length;if(e[r]===11&&e[r+1]===119&&Wv(t)!==void 0){if(AC(e,r)<16)return!0;throw new Error("Containerless ec-3 is not supported")}return!1}}function LC(n,e,t,r,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],l=e[t+4]&63,c=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+s]*2;if(t+c>e.length)return-1;const d=e[t+6]>>5;let f=0;d===2?f+=2:(d&1&&d!==1&&(f+=2),d&4&&(f+=2));const h=(e[t+6]<<8|e[t+7])>>12-f&1,m=[2,1,2,3,3,4,4,5][d]+h,g=e[t+5]>>3,y=e[t+5]&7,v=new Uint8Array([s<<6|g<<1|y>>2,(y&3)<<6|d<<3|h<<2|l>>4,l<<4&224]),S=1536/o*9e4,x=r+i*S,T=e.subarray(t,t+c);return n.config=v,n.channelCount=m,n.samplerate=o,n.samples.push({unit:T,pts:x}),c}class p7 extends rS{resetInitSegment(e,t,r,i){super.resetInitSegment(e,t,r,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=du(e,0);let r=t?.length||0;if(t&&e[r]===11&&e[r+1]===119&&Wv(t)!==void 0&&AC(e,r)<=16)return!1;for(let i=e.length;r<i;r++)if(wC(e,r))return Pe.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return d7(e,t)}appendFrame(e,t,r){if(this.basePTS!==null)return _C(e,t,r,this.basePTS,this.frameIndex)}}const m7=/\/emsg[-/]ID3/i;class g7{constructor(e,t,r,i=Pe){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.initData=void 0,this.logger=void 0,this.config=t,this.logger=i}resetTimeStamp(){}resetInitSegment(e,t,r,i){const s=this.videoTrack=Ar("video",1),a=this.audioTrack=Ar("audio",1),o=this.txtTrack=Ar("text",1);if(this.id3Track=Ar("id3",1),this.initData=void 0,this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=this.initData=ML(e);if(l.video){const{id:u,timescale:c,codec:d,supplemental:f}=l.video;s.id=u,s.timescale=o.timescale=c,s.codec=d,s.supplemental=f}if(l.audio){const{id:u,timescale:c,codec:d}=l.audio;a.id=u,a.timescale=c,a.codec=d}o.id=kL.text,s.sampleDuration=0,s.duration=a.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return EH(e,"moof")}demux(e,t,r){this.timeOffset=t;let i=e;const s=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Kn(this.remainderData,e));const u=CH(i);this.remainderData=u.remainder,s.samples=u.valid||new Uint8Array}else s.samples=i;const o=this.extractID3Track(s,t),l=this.parseFragment(s,a,t,r);return{videoTrack:s,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack,initData:this.initData,sampleData:l}}flush(e,t){const r=this.timeOffset,i=this.videoTrack,s=this.txtTrack;i.samples=this.remainderData||new Uint8Array,this.remainderData=null;const a=this.extractID3Track(i,this.timeOffset),o=this.parseFragment(i,s,r,t);return{videoTrack:i,audioTrack:Ar(),id3Track:a,textTrack:Ar(),initData:this.initData,sampleData:o}}parseFragment(e,t,r,i){const s=this.initData;if(s&&i){const{samples:a,sampleData:o}=LH(r,e,s,this.logger,i.iframe);return t.samples=a,o}t.samples=kH(r,e)}extractID3Track(e,t){const r=this.id3Track;if(e.samples.length){const i=de(e.samples,["emsg"]);i&&i.forEach(s=>{const a=DH(s);if(m7.test(a.schemeIdUri)){const o=R_(a,t);let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const u=a.payload;r.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Qt.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata){const o=this.config.emsgKLVSchemaUri||Qt.misbklv;if(a.schemeIdUri.startsWith(o)){const l=R_(a,t);r.samples.push({data:a.payload,len:a.payload.byteLength,dts:l,pts:l,type:Qt.misbklv,duration:Number.POSITIVE_INFINITY})}}})}return r}demuxSampleAes(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0,this.initData=void 0}}function R_(n,e){return X(n.presentationTime)?n.presentationTime/n.timeScale:e+n.presentationTimeDelta/n.timeScale}const y7=1,v7=2,Vo=-1;class CC{constructor(){this.VideoSample=null}createVideoSample(e,t,r){return{key:e,frame:!1,pts:t,dts:r,units:[],length:0}}getLastNalUnit(e){var t;let r=this.VideoSample,i;if((!r||r.units.length===0)&&(r=e[e.length-1]),(t=r)!=null&&t.units){const s=r.units;i=s[s.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const r=t.samples,i=r.length;if(i){const s=r[i-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,r){const i=t.byteLength;if(i===0)return[];const s=e.naluState||0,a=s===Vo?0:s,o=[];let l=0,u=0,c=-1,d=0;for(s===Vo&&(c=0,d=this.getNALuType(t,0),u=1);u<i;){const f=t.indexOf(y7,u);if(f===-1)break;u=f+1;let h=f;for(;h>0&&t[h-1]===0;)h--;if(!(f-h+(h===0?a:0)<v7)){if(c>=0)o.push({data:t.subarray(c,h),type:d});else{const m=this.getLastNalUnit(e.samples);m&&(h>0?m.data=Kn(m.data,t.subarray(0,h)):a>0&&(m.data=m.data.subarray(0,m.data.byteLength-a)),m.state=0)}if(u<i)c=u,d=this.getNALuType(t,u);else{l=Vo,c=-1;break}}}if(l!==Vo){let f=i;for(;f>0&&t[f-1]===0;)f--;l=i-f+(f===0?a:0)}if(c>=0)o.push({data:t.subarray(c),type:d,state:l});else if(o.length===0&&l!==Vo){const f=this.getLastNalUnit(e.samples);f&&(f.data=Kn(f.data,t),f.state=l)}return e.naluState=l,o}}let Rl=class{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");i.set(e.subarray(r,r+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const r=this.word>>>32-t;if(e>32&&Pe.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?r<<t|this.readBits(t):r}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}};class S7 extends CC{parsePES(e,t,r,i,s){const a=s.iframe,o=this.parseNALu(e,r.data,i);let l=this.VideoSample,u,c=!1;r.data=null,l&&o.length&&!e.audFound&&(this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),o.forEach(d=>{var f,h;switch(d.type){case 1:{if(a)break;let y=!1;u=!0;const v=d.data;if(c&&v.length>4){const S=this.readSliceType(v);(S===2||S===4||S===7||S===9)&&(y=!0)}if(y){var p;(p=l)!=null&&p.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null)}l||(l=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),l.frame=!0,l.key=y;break}case 5:u=!0,(f=l)!=null&&f.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null),l||(l=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),l.key=!0,l.frame=!0;break;case 6:{if(a)break;u=!0,fu(d.data,1,r.pts,t.samples);break}case 7:{var m,g;u=!0,c=!0;const y=d.data,v=this.readSPS(y);if(!e.sps||e.width!==v.width||e.height!==v.height||((m=e.pixelRatio)==null?void 0:m[0])!==v.pixelRatio[0]||((g=e.pixelRatio)==null?void 0:g[1])!==v.pixelRatio[1]){e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.sps=[y];const S=y.subarray(1,4);let x="avc1.";for(let T=0;T<3;T++){let w=S[T].toString(16);w.length<2&&(w="0"+w),x+=w}e.codec=x}break}case 8:u=!0,e.pps=[d.data];break;case 9:u=!0,e.audFound=!0,(h=l)!=null&&h.frame&&(this.pushAccessUnit(l,e),l=null),l||(l=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts));break;case 12:u=!0;break;default:u=!1;break}l&&u&&l.units.push(d)}),i&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Rl(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let r=8,i=8,s;for(let a=0;a<e;a++)i!==0&&(s=t.readEG(),i=(r+s+256)%256),r=i===0?r:i}readSPS(e){const t=new Rl(e);let r=0,i=0,s=0,a=0,o,l,u;const c=t.readUByte.bind(t),d=t.readBits.bind(t),f=t.readUEG.bind(t),h=t.readBoolean.bind(t),p=t.skipBits.bind(t),m=t.skipEG.bind(t),g=t.skipUEG.bind(t),y=this.skipScalingList.bind(this);c();const v=c();if(d(5),p(3),c(),g(),v===100||v===110||v===122||v===244||v===44||v===83||v===86||v===118||v===128){const R=f();if(R===3&&p(1),g(),g(),p(1),h())for(l=R!==3?8:12,u=0;u<l;u++)h()&&(u<6?y(16,t):y(64,t))}g();const S=f();if(S===0)f();else if(S===1)for(p(1),m(),m(),o=f(),u=0;u<o;u++)m();g(),p(1);const x=f(),T=f(),w=d(1);w===0&&p(1),p(1),h()&&(r=f(),i=f(),s=f(),a=f());let I=[1,1];if(h()&&h())switch(c()){case 1:I=[1,1];break;case 2:I=[12,11];break;case 3:I=[10,11];break;case 4:I=[16,11];break;case 5:I=[40,33];break;case 6:I=[24,11];break;case 7:I=[20,11];break;case 8:I=[32,11];break;case 9:I=[80,33];break;case 10:I=[18,11];break;case 11:I=[15,11];break;case 12:I=[64,33];break;case 13:I=[160,99];break;case 14:I=[4,3];break;case 15:I=[3,2];break;case 16:I=[2,1];break;case 255:{I=[c()<<8|c(),c()<<8|c()];break}}return{width:Math.ceil((x+1)*16-r*2-i*2),height:(2-w)*(T+1)*16-(w?2:4)*(s+a),pixelRatio:I}}}class E7 extends CC{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,r,i){const s=this.parseNALu(e,r.data,i);let a=this.VideoSample,o,l=!1;r.data=null;const u=c=>(a=this.VideoSample=this.createVideoSample(c,r.pts,r.dts),a);s.forEach((c,d)=>{var f,h;if(this.startsNewAccessUnit(a,e,c,d)){this.pushAccessUnit(a,e);const m=c.type>=16&&c.type<=23;a=u(m),l=!1}switch(c.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=u(!1)),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:case 22:case 23:if(o=!0,l){var p;(p=a)!=null&&p.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=u(!0)),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=u(!0)),a.key=!0,a.frame=!0;break;case 39:o=!0,fu(c.data,2,r.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=Ne(e.params,this.readVPS(c.data)),this.initVPS=c.data),e.vps=[c.data];break;case 33:if(o=!0,l=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],c.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const m=this.readSPS(c.data);e.width=m.width,e.height=m.height,e.pixelRatio=m.pixelRatio,e.codec=m.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const g in m.params)e.params[g]=m.params[g]}this.pushParameterSet(e.sps,c.data,e.vps),a||(a=u(!1));break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const m=this.readPPS(c.data);for(const g in m)e.params[g]=m[g]}this.pushParameterSet(e.pps,c.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(h=a)!=null&&h.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=u(!1));break;default:o=!1;break}a&&o&&a.units.push(c)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,r){(r&&r[0]===this.initVPS||!r&&!e.length)&&e.push(t)}startsNewAccessUnit(e,t,r,i){if(!e)return!1;if(!t.audFound&&i===0)return!0;if(!e.frame)return!1;const{type:s,data:a}=r;return s>=32&&s<=35||s===39||s>=41&&s<=44||s>=48&&s<=55?!0:s<=31&&a.length>2&&(a[2]&128)!==0}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let r=0;for(let i=0;i<e.byteLength;i++)i>=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(t[r]=e[i],r++);return new Uint8Array(t.buffer,0,r)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Rl(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const r=t.readBits(3),i=t.readBoolean();return{numTemporalLayers:r+1,temporalIdNested:i}}readSPS(e){const t=new Rl(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const r=t.readBits(3);t.readBoolean();const i=t.readBits(2),s=t.readBoolean(),a=t.readBits(5),o=t.readUByte(),l=t.readUByte(),u=t.readUByte(),c=t.readUByte(),d=t.readUByte(),f=t.readUByte(),h=t.readUByte(),p=t.readUByte(),m=t.readUByte(),g=t.readUByte(),y=t.readUByte(),v=[],S=[];for(let ee=0;ee<r;ee++)v.push(t.readBoolean()),S.push(t.readBoolean());if(r>0)for(let ee=r;ee<8;ee++)t.readBits(2);for(let ee=0;ee<r;ee++)v[ee]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),S[ee]&&t.readUByte();t.readUEG();const x=t.readUEG();x==3&&t.skipBits(1);const T=t.readUEG(),w=t.readUEG(),I=t.readBoolean();let R=0,A=0,b=0,C=0;I&&(R+=t.readUEG(),A+=t.readUEG(),b+=t.readUEG(),C+=t.readUEG());const k=t.readUEG(),$=t.readUEG(),U=t.readUEG(),N=t.readBoolean();for(let ee=N?0:r;ee<=r;ee++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let Ee=0;Ee<4;Ee++)for(let xe=0;xe<(Ee===3?2:6);xe++)if(!t.readBoolean())t.readUEG();else{const oe=Math.min(64,1<<4+(Ee<<1));Ee>1&&t.readEG();for(let Ve=0;Ve<oe;Ve++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const L=t.readUEG();let O=0;for(let ee=0;ee<L;ee++){let Ee=!1;if(ee!==0&&(Ee=t.readBoolean()),Ee){ee===L&&t.readUEG(),t.readBoolean(),t.readUEG();let xe=0;for(let tt=0;tt<=O;tt++){const oe=t.readBoolean();let Ve=!1;oe||(Ve=t.readBoolean()),(oe||Ve)&&xe++}O=xe}else{const xe=t.readUEG(),tt=t.readUEG();O=xe+tt;for(let oe=0;oe<xe;oe++)t.readUEG(),t.readBoolean();for(let oe=0;oe<tt;oe++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const ee=t.readUEG();for(let Ee=0;Ee<ee;Ee++){for(let xe=0;xe<U+4;xe++)t.readBits(1);t.readBits(1)}}let G=0,j=1,W=1,z=!0,Y=1,V=0;t.readBoolean(),t.readBoolean();let J=!1;if(t.readBoolean()){if(t.readBoolean()){const pe=t.readUByte(),Qe=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],ue=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];pe>0&&pe<16?(j=Qe[pe-1],W=ue[pe-1]):pe===255&&(j=t.readBits(16),W=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),J=t.readBoolean(),J&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Y=t.readBits(32),V=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const ue=t.readBoolean(),ht=t.readBoolean();let Pn=!1;(ue||ht)&&(Pn=t.readBoolean(),Pn&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Pn&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let gn=0;gn<=r;gn++){z=t.readBoolean();const jt=z||t.readBoolean();let Ei=!1;jt?t.readEG():Ei=t.readBoolean();const zr=Ei?1:t.readUEG()+1;if(ue)for(let Xn=0;Xn<zr;Xn++)t.readUEG(),t.readUEG(),Pn&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(ht)for(let Xn=0;Xn<zr;Xn++)t.readUEG(),t.readUEG(),Pn&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),G=t.readUEG())}let _e=T,Ge=w;if(I){let ee=1,Ee=1;x===1?ee=Ee=2:x==2&&(ee=2),_e=T-ee*A-ee*R,Ge=w-Ee*C-Ee*b}const Pt=i?["A","B","C"][i]:"",Yn=o<<24|l<<16|u<<8|c;let je=0;for(let ee=0;ee<32;ee++)je=(je|(Yn>>ee&1)<<31-ee)>>>0;let yt=je.toString(16);return a===1&&yt==="2"&&(yt="6"),{codecString:`hvc1.${Pt}${a}.${yt}.${s?"H":"L"}${y}.B0`,params:{general_tier_flag:s,general_profile_idc:a,general_profile_space:i,general_profile_compatibility_flags:[o,l,u,c],general_constraint_indicator_flags:[d,f,h,p,m,g],general_level_idc:y,bit_depth:k+8,bit_depth_luma_minus8:k,bit_depth_chroma_minus8:$,min_spatial_segmentation_idc:G,chroma_format_idc:x,frame_rate:{fixed:z,fps:V/Y}},width:_e,height:Ge,pixelRatio:[j,W]}}readPPS(e){const t=new Rl(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const i=t.readBoolean(),s=t.readBoolean();let a=1;return s&&i?a=0:s?a=3:i&&(a=2),{parallelismType:a}}matchSPS(e,t){return gr(e).substring(3)===gr(t).substring(3)}}const vt=188;class Zr{constructor(e,t,r,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this._klvPid=-1,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.videoIntegrityChecker=null,this.observer=e,this.config=t,this.typeSupported=r,this.logger=i,this.videoParser=null}static probe(e,t){const r=Zr.syncOffset(e);return r>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${r}`),r!==-1}static syncOffset(e){const t=e.length;let r=Math.min(vt*5,t-vt)+1,i=0;for(;i<r;){let s=!1,a=-1,o=0;for(let l=i;l<t;l+=vt)if(e[l]===71&&(t-l===vt||e[l+vt]===71)){if(o++,a===-1&&(a=l,a!==0&&(r=Math.min(a+vt*99,e.length-vt)+1)),s||(s=Mf(e,l)===0),s&&o>1&&(a===0&&o>2||l+vt>r))return a}else{if(o)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:kL[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,r,i,s,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Zr.createTrack("video"),this._videoTrack.duration=i,this.videoIntegrityChecker=this.config.handleMpegTsVideoIntegrityErrors==="skip"?new _7(this.logger):null,this._audioTrack=Zr.createTrack("audio",i),this._id3Track=Zr.createTrack("id3"),this._txtTrack=Zr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=r,e&&this.demux(e,0,a,s?.method==="SAMPLE-AES")}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:r}=this;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,r,i=!1,s=!1){i||(this.sampleAes=null);let a;const o=this._videoTrack,l=this.videoIntegrityChecker,u=this._audioTrack,c=this._id3Track,d=this._txtTrack,f=r.iframe;let h=o.pid,p=o.pesData,m=u.pid,g=c.pid,y=this._klvPid,v=u.pesData,S=c.pesData,x=null,T=null,w=this.pmtParsed,I=this._pmtId,R=e.length;if(this.remainderData&&(e=Kn(this.remainderData,e),R=e.length,this.remainderData=null),R<vt&&!s)return this.remainderData=e,{audioTrack:u,videoTrack:o,id3Track:c,textTrack:d};const A=Math.max(0,Zr.syncOffset(e));R-=(R-A)%vt,R<e.byteLength&&!s&&(this.remainderData=new Uint8Array(e.buffer,R,e.buffer.byteLength-R));let b=0;for(let k=A;k<R;k+=vt)if(e[k]===71){const $=!!(e[k+1]&64),U=Mf(e,k),N=(e[k+3]&48)>>4;let D;if(N>1){if(D=k+5+e[k+4],D===k+vt)continue}else D=k+4;switch(U){case h:$&&(p&&!(l!=null&&l.isCorrupted)&&(a=vs(p,this.logger))&&(this.readyVideoParser(o.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(o,d,a,!1,r)),p={data:[],size:0},l?.reset(h)),l?.handlePacket(e.subarray(k)),p&&(p.data.push(e.subarray(D,k+vt)),p.size+=k+vt-D);break;case m:if(f)break;if($){if(v&&(a=vs(v,this.logger)))switch(u.segmentCodec){case"aac":this.parseAACPES(u,a,r);break;case"mp3":this.parseMPEGPES(u,a);break;case"ac3":this.parseAC3PES(u,a);break}v={data:[],size:0}}v&&(v.data.push(e.subarray(D,k+vt)),v.size+=k+vt-D);break;case g:if(f)break;$&&(S&&(a=vs(S,this.logger))&&this.parseID3PES(c,a),S={data:[],size:0}),S&&(S.data.push(e.subarray(D,k+vt)),S.size+=k+vt-D);break;case y:if(f)break;$&&(x&&(a=vs(x,this.logger))&&this.parseKlvPES(c,a),x={data:[],size:0}),x&&(x.data.push(e.subarray(D,k+vt)),x.size+=k+vt-D);break;case 0:$&&(D+=e[D]+1),I=this._pmtId=x7(e,D);break;case I:{$&&(D+=e[D]+1);const M=T7(e,D,this.typeSupported,i,this.observer,this.logger,this.config,r);h=M.videoPid,h>0&&(o.pid=h,o.segmentCodec=M.segmentVideoCodec),m=M.audioPid,m>0&&(u.pid=m,u.segmentCodec=M.segmentAudioCodec),g=M.id3Pid,g>0&&(c.pid=g),y=M.klvPid,y>0&&(this._klvPid=y),T!==null&&!w&&(this.logger.warn(`MPEG-TS PMT found at ${k} after unknown PID '${T}'. Backtracking to sync byte @${A} to parse all TS packets.`),T=null,k=A-188),w=this.pmtParsed=!0;break}case 17:case 8191:break;default:T=U;break}}else b++;b>0&&w0(this.observer,new Error(`Found ${b} TS packet/s that do not start with 0x47`),r,void 0,this.logger),o.pesData=p,u.pesData=v,c.pesData=S;const C={audioTrack:u,videoTrack:o,id3Track:c,textTrack:d};return s&&this.extractRemainingSamples(C,r),C}flush(e,t){const{remainderData:r}=this;this.remainderData=null;let i;return r?i=this.demux(r,0,t,!1,!0):i={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(i,t),this.sampleAes?this.decrypt(i,this.sampleAes):i}extractRemainingSamples(e,t){const{audioTrack:r,videoTrack:i,id3Track:s,textTrack:a}=e,o=i.pesData,l=r.pesData,u=s.pesData,c=this.videoIntegrityChecker;let d;if(o&&!(c!=null&&c.isCorrupted)&&(d=vs(o,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,a,d,!0,t),i.pesData=null)):i.pesData=o,l&&(d=vs(l,this.logger))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,d,t);break;case"mp3":this.parseMPEGPES(r,d);break;case"ac3":this.parseAC3PES(r,d);break}r.pesData=null}else l!=null&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=l;u&&(d=vs(u,this.logger))?(this.parseID3PES(s,d),s.pesData=null):s.pesData=u}demuxSampleAes(e,t,r,i){const s=this.demux(e,r,i,!0,!this.config.progressive),a=this.sampleAes=new RC(this.observer,this.config,t);return this.decrypt(s,a)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new S7:e==="hevc"&&(this.videoParser=new E7))}decrypt(e,t){return new Promise(r=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{r(e)}):r(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{r(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0,this.videoIntegrityChecker=null}parseAACPES(e,t,r){let i=0;const s=this.aacOverFlow;let a=t.data;if(s){this.aacOverFlow=null;const f=s.missing,h=s.sample.unit.byteLength;if(f===-1)a=Kn(s.sample.unit,a);else{const p=h-f;s.sample.unit.set(a.subarray(0,f),p),e.samples.push(s.sample),i=s.missing}}let o,l;for(o=i,l=a.length;o<l-1&&!Of(a,o);o++);if(o!==i){let f;const h=o<l-1;if(h?f=`AAC PES did not start with ADTS header,offset:${o}`:f="No ADTS header found in AAC PES",w0(this.observer,new Error(f),r,h,this.logger),!h)return}EC(e,this.observer,a,o,this.audioCodec);let u;if(t.pts!==void 0)u=t.pts;else if(s){const f=xC(e.samplerate);u=s.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,d;for(;o<l;)if(d=TC(e,a,o,u,c),o+=d.length,d.missing){this.aacOverFlow=d;break}else for(c++;o<l-1&&!Of(a,o);o++);}parseMPEGPES(e,t){const r=t.data,i=r.length;let s=0,a=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<i;)if(IC(r,a)){const l=_C(e,r,a,o,s);if(l)a+=l.length,s++;else break}else a++}parseAC3PES(e,t){{const r=t.data,i=t.pts;if(i===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=r.length;let a=0,o=0,l;for(;o<s&&(l=LC(e,r,o,i,a++))>0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const r=Ne({},t,{type:this._videoTrack?Qt.emsg:Qt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}parseKlvPES(e,t){var r;const i=(r=t.pts)!=null?r:t.dts;if(i===void 0){this.logger.warn("[tsdemuxer]: KLV PES unknown PTS and DTS");return}const s=t.data;if(s.length<16){this.logger.warn("[tsdemuxer]: KLV PES payload too short");return}let a=0;for(;a<s.length;){var o;if(a+16>s.length)break;const l=a;if(a+=16,a>=s.length)break;const u=s[a];a+=1;let c=0;if(u&128){const p=u&127;if(p===0||p>4||a+p>s.length){this.logger.warn("[tsdemuxer]: Invalid KLV length encoding");break}for(let m=0;m<p;m++)c=c<<8|s[a+m];a+=p}else c=u;if(a+c>s.length){this.logger.warn("[tsdemuxer]: KLV value extends beyond PES payload");break}const d=a+c,f=s.subarray(l,d),h={data:f,len:f.byteLength,pts:i,dts:(o=t.dts)!=null?o:i,type:Qt.misbklv,duration:Number.POSITIVE_INFINITY};e.samples.push(h),a=d}}}function Mf(n,e){return((n[e+1]&31)<<8)+n[e+2]}function x7(n,e){return(n[e+10]&31)<<8|n[e+11]}function T7(n,e,t,r,i,s,a,o){const l={audioPid:-1,videoPid:-1,id3Pid:-1,klvPid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},u=(n[e+1]&15)<<8|n[e+2],c=e+3+u-4,d=(n[e+10]&15)<<8|n[e+11];for(e+=12+d;e<c;){const f=Mf(n,e),h=(n[e+3]&15)<<8|n[e+4];switch(n[e]){case 207:if(!r){pm("ADTS AAC",s);break}case 15:l.audioPid===-1&&(l.audioPid=f);break;case 21:l.id3Pid===-1&&(l.id3Pid=f);break;case 219:if(!r){pm("H.264",s);break}case 27:l.videoPid===-1&&(l.videoPid=f);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):l.audioPid===-1&&(l.audioPid=f,l.segmentAudioCodec="mp3");break;case 193:if(!r){pm("AC-3",s);break}case 129:t.ac3?l.audioPid===-1&&(l.audioPid=f,l.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(h>0){let p=e+5,m=h;for(;m>2;){switch(n[p]){case 106:l.audioPid===-1&&(t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(l.audioPid=f,l.segmentAudioCodec="ac3"));break;case 5:l.klvPid===-1&&a.enableEmsgKLVMetadata&&(l.klvPid=f,s.log(`KLV metadata PID found: ${f}`));break}const y=n[p+1]+2;p+=y,m-=y}}break;case 194:case 135:return w0(i,new Error("Unsupported EC-3 in M2TS found"),o,void 0,s),l;case 36:l.videoPid===-1&&(l.videoPid=f,l.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=h+5}return l}function w0(n,e,t,r,i){i.warn(`parsing error: ${e.message}`),n.emit(E.ERROR,E.ERROR,{type:re.MEDIA_ERROR,details:F.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,chunkMeta:t,error:e,reason:e.message})}function pm(n,e){e.log(`${n} with AES-128-CBC encryption found in unencrypted stream`)}function vs(n,e){let t=0,r,i,s,a,o;const l=n.data;if(!n||n.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=Kn(l[0],l[1]),l.splice(1,1);if(r=l[0],(r[0]<<16)+(r[1]<<8)+r[2]===1){if(i=(r[4]<<8)+r[5],i&&i>n.size-6)return null;const c=r[7];c&192&&(a=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2,c&64?(o=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),s=r[8];let d=s+9;if(n.size<=d)return null;n.size-=d;const f=new Uint8Array(n.size);for(let h=0,p=l.length;h<p;h++){r=l[h];let m=r.byteLength;if(d)if(d>m){d-=m;continue}else r=r.subarray(d),m-=d,d=0;f.set(r,t),t+=m}return i&&(i-=s+3),{data:f,pts:a,dts:o,len:i}}return null}class _7{constructor(e){this.logger=void 0,this.pid=0,this.lastContinuityCounter=-1,this.integrityState="ok",this.logger=e}get isCorrupted(){return this.integrityState!=="ok"}reset(e){this.pid=e,this.lastContinuityCounter=-1,this.integrityState="ok"}handlePacket(e){if(e.byteLength<4)return;const t=Mf(e,0);if(t!==this.pid){this.logger.debug(`Packet PID mismatch, expected ${this.pid} got ${t}`);return}const r=(e[3]&48)>>4;if(r===0)return;const i=e[3]&15,s=this.lastContinuityCounter;this.lastContinuityCounter=i;const a=(r&1)!=0;if((r&2)!=0&&e[4]!=0&&(e[5]&128)!=0||s<0)return;const u=a?s+1&15:s;if(i!==u){this.logger.warn(`MPEG-TS Continuity Counter check failed for PID='${t}', CC=${i}, Expected-CC=${u} Last-CC=${s}`),this.integrityState="cc-failed";return}if(e[1]&128){this.logger.warn(`MPEG-TS Packet had TEI flag set for PID='${t}'`),this.integrityState="tei-bit";return}}}class b7{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}var Ff;const I7={video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])},mm=new Uint8Array([0,0,0,0,0,0,0,0]),w7=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R7=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),A7=new Uint8Array([0,0,0,0,0,0,0,0]),Wo=new Uint8Array([0,0,0,0,0,0,0,1]),A_=new Uint8Array([105,115,111,109]),L7=new Uint8Array([97,118,99,49]),C7=new Uint8Array([0,0,0,1]);class Q{static box(e,...t){let r=8,i=t.length;const s=i;for(;i--;)r+=t[i].byteLength;const a=new Uint8Array(r);for(pt(a,0,r),pt(a,4,e),i=0,r=8;i<s;i++)a.set(t[i],r),r+=t[i].byteLength;return a}static hdlr(e){return Q.box(ce.hdlr,I7[e])}static mdat(e){return Q.box(ce.mdat,e)}static mdhd(e,t){t*=e;const r=Math.floor(t/(Ir+1)),i=Math.floor(t%(Ir+1));return Q.box(ce.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24,r>>16&255,r>>8&255,r&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return Q.box(ce.mdia,Q.mdhd(e.timescale||0,e.duration||0),Q.hdlr(e.type),Q.minf(e))}static mfhd(e){return Q.box(ce.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?Q.box(ce.minf,Q.box(ce.smhd,A7),Q.DINF,Q.stbl(e)):Q.box(ce.minf,Q.box(ce.vmhd,R7),Q.DINF,Q.stbl(e))}static moof(e,t,r){return Q.box(ce.moof,Q.mfhd(e),Q.traf(r,t))}static moov(e){let t=e.length;const r=[];for(;t--;)r[t]=Q.trak(e[t]);return Q.box.apply(null,[ce.moov,Q.mvhd(e[0].timescale||0,e[0].duration||0)].concat(r).concat(Q.mvex(e)))}static mvex(e){let t=e.length;const r=[];for(;t--;)r[t]=Q.trex(e[t]);return Q.box.apply(null,[ce.mvex,...r])}static mvhd(e,t){t*=e;const r=Math.floor(t/(Ir+1)),i=Math.floor(t%(Ir+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24,r>>16&255,r>>8&255,r&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Q.box(ce.mvhd,s)}static sdtp(e){const t=e.samples||[],r=new Uint8Array(4+t.length);let i,s;for(i=0;i<t.length;i++)s=t[i].flags,r[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return Q.box(ce.sdtp,r)}static stbl(e){return Q.box(ce.stbl,Q.stsd(e),Q.box(ce.stts,mm),Q.box(ce.stsc,mm),Q.box(ce.stsz,w7),Q.box(ce.stco,mm))}static avc1(e){let t=[],r=[],i,s,a;for(i=0;i<e.sps.length;i++)s=e.sps[i],a=s.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],a=s.byteLength,r.push(a>>>8&255),r.push(a&255),r=r.concat(Array.prototype.slice.call(s));const o=Q.box(ce.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(r))),l=e.width,u=e.height,c=e.pixelRatio[0],d=e.pixelRatio[1];return Q.box(ce.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,Q.box(ce.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Q.box(ce.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(e){const t=e.config,r=t.length;return new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5,r,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return Q.box(ce.mp4a,Q.audioStsd(e),Q.box(ce.esds,Q.esds(e)))}static mp3(e){return Q.box(ce[".mp3"],Q.audioStsd(e))}static ac3(e){return Q.box(ce["ac-3"],Q.audioStsd(e),Q.box(ce.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Q.box(ce.stsd,Wo,Q.mp4a(e));if(t==="ac3"&&e.config)return Q.box(ce.stsd,Wo,Q.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Q.box(ce.stsd,Wo,Q.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Q.box(ce.stsd,Wo,Q.avc1(e));if(t==="hevc"&&e.vps)return Q.box(ce.stsd,Wo,Q.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,r=(e.duration||0)*(e.timescale||0),i=e.width||0,s=e.height||0,a=Math.floor(r/(Ir+1)),o=Math.floor(r%(Ir+1));return Q.box(ce.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const r=Q.sdtp(e),i=e.id,s=Math.floor(t/(Ir+1)),a=Math.floor(t%(Ir+1));return Q.box(ce.traf,Q.box(ce.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),Q.box(ce.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])),Q.trun(e,r.length+16+20+8+16+8+8),r)}static trak(e){return e.duration=e.duration||4294967295,Q.box(ce.trak,Q.tkhd(e),Q.mdia(e))}static trex(e){const t=e.id;return Q.box(ce.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const r=e.samples||[],i=r.length,s=12+16*i,a=new Uint8Array(s);let o,l,u,c,d,f;for(t+=8+s,a.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<i;o++)l=r[o],u=l.duration,c=l.size,d=l.flags,f=l.cts,a.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*o);return Q.box(ce.trun,a)}static initSegment(e){const t=Q.moov(e);return Kn(Q.FTYP,t)}static hvc1(e){const t=e.params,r=[e.vps,e.sps,e.pps],i=4,s=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),i-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),r.length]);let a=s.length;for(let p=0;p<r.length;p+=1){a+=3;for(let m=0;m<r[p].length;m+=1)a+=2+r[p][m].length}const o=new Uint8Array(a);o.set(s,0),a=s.length;const l=r.length-1;for(let p=0;p<r.length;p+=1){o.set(new Uint8Array([32+p|(p===l?128:0),0,r[p].length]),a),a+=3;for(let m=0;m<r[p].length;m+=1)o.set(new Uint8Array([r[p][m].length>>8,r[p][m].length&255]),a),a+=2,o.set(r[p][m],a),a+=r[p][m].length}const u=Q.box(ce.hvcC,o),c=e.width,d=e.height,f=e.pixelRatio[0],h=e.pixelRatio[1];return Q.box(ce.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,Q.box(ce.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Q.box(ce.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,h>>24,h>>16&255,h>>8&255,h&255])))}}Ff=Q;Q.FTYP=Ff.box(ce.ftyp,A_,C7,A_,L7);Q.DINF=Ff.box(ce.dinf,Ff.box(ce.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])));const kC=9e4;function sS(n,e,t=1,r=!1){const i=n*e*t;return r?Math.round(i):i}function k7(n,e,t=1,r=!1){return sS(n,e,1/t,r)}function zo(n,e=!1){return sS(n,1e3,1/kC,e)}function D7(n,e=1){return sS(n,kC,1/e)}function L_(n){const{baseTime:e,timescale:t,trackId:r}=n;return`${e/t} (${e}/${t}) trackId: ${r}`}const P7=10*1e3,O7=1024,M7=1152,F7=1536,R0=8589934592;function C_(n,e,t,r){return{duration:e,size:t,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:n?2:1,isNonSync:n?0:1,paddingValue:0}}}class Id extends Cn{constructor(e,t,r,i){super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&L_(t)} > ${e&&L_(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const r=e[0].pts,i=e.reduce((s,a)=>{let o=a.pts,l=o-s;return l<-4294967296&&(t=!0,o=vn(o,r),l=o-s),l>0?s:o},r);return t&&this.debug("PTS rollover detected"),i}remux(e,t,r,i,s,a,o,l,u){let c,d,f,h,p,m,g=s,y=s;const S=!u.iframe&&e.pid>-1,x=t.pid>-1,T=t.samples.length,w=e.samples.length>0,I=o&&T>0||T>1;if((!S||w)&&(!x||I)||this.ISGenerated||o){if(this.ISGenerated){var A,b,C,k;const D=this.videoTrackConfig;(D&&(t.width!==D.width||t.height!==D.height||((A=t.pixelRatio)==null?void 0:A[0])!==((b=D.pixelRatio)==null?void 0:b[0])||((C=t.pixelRatio)==null?void 0:C[1])!==((k=D.pixelRatio)==null?void 0:k[1]))||!D&&I||this.nextAudioTs===null&&w)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,s,a));const $=this.isVideoContiguous;let U=-1,N;if(I&&(U=N7(t.samples),!$&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,U>0){this.warn(`Dropped ${U} out of ${T} video samples due to a missing keyframe`);const D=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(U),t.dropped+=U,y+=(t.samples[0].pts-D)/t.inputTimeScale,N=y}else U===-1&&(this.warn(`No keyframe found out of ${T} video samples`),m=!1);if(this.ISGenerated){if(w&&I&&s){const D=this.getVideoStartPts(t.samples),L=(vn(e.samples[0].pts,D)-D)/t.inputTimeScale;g+=Math.max(0,L),y+=Math.max(0,-L)}if(w){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),f=this.generateIS(e,t,s,a)),d=this.remuxAudio(e,g,this.isAudioContiguous,a,x||I||l===te.AUDIO?y:void 0,u),I){const D=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),f=this.generateIS(e,t,s,a)),c=this.remuxVideo(t,y,$,D,u)}}else I&&(c=this.remuxVideo(t,y,$,0,u));c&&(c.firstKeyFrame=U,c.independent=U!==-1,c.firstKeyFramePTS=N)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(p=DC(r,s,this._initPTS,this._initDTS)),i.samples.length&&(h=PC(i,s,this._initPTS))),{audio:d,video:c,initSegment:f,independent:m,text:h,id3:p}}computeInitPts(e,t,r,i){const s=Math.round(r*t);let a=vn(e,s);if(a<s)for(this.log(`Adjusting PTS for rollover in timeline near ${(s-a)/t} ${i}`);a<s;)a+=R0;return a-s}generateIS(e,t,r,i){const s=e.samples,a=t.samples,o=this.typeSupported,l={},u=this._initPTS,c=!u||i;let d="audio/mp4",f,h,p,m=-1;if(c&&(f=h=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(d="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}if(l.audio={id:"audio",container:d,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):Q.initSegment([e]),metadata:{channelCount:e.channelCount}},c){m=e.id,p=e.inputTimeScale;const g=this.computeInitPts(s[0].pts,p,r,"audio");(!u||p!==u.timescale||r===0&&g<u.baseTime)&&(f=h=g)}}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Q.initSegment([t]),metadata:{width:t.width,height:t.height}},c){m=t.id,p=t.inputTimeScale;const g=this.getVideoStartPts(a),y=vn(a[0].dts,g),v=this.computeInitPts(y,p,r,"video"),S=this.computeInitPts(g,p,r,"video");(!u||p!==u.timescale||X(f)||r===0&&S<u.baseTime)&&(h=Math.min(h,v),f=Math.min(f,v))}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,c&&X(f)?(u&&this.warn(`Timestamps at playlist time: ${i?"":"~"}${r} ${f/p} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${r} offset: ${f/p} (${f}/${p}) trackId: ${m}`),this._initPTS={baseTime:f,timescale:p,trackId:m},this._initDTS={baseTime:h,timescale:p,trackId:m}):f=p=void 0,{tracks:l,initPTS:f,timescale:p,trackId:m}}remuxVideo(e,t,r,i,s){const a=e.inputTimeScale,o=e.samples,l=[],u=o.length,c=this._initPTS,d=c.baseTime*a/c.timescale;let f=this.nextVideoTs,h=8,p=this.videoSampleDuration,m,g,y=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY,S=!1;if(!r||f===null){const G=d+t*a,j=o[0].pts-vn(o[0].dts,o[0].pts);bl()&&f!==null&&Math.abs(G-j-(f+d))<15e3?r=!0:f=G-j-d}const x=f+d;for(let G=0;G<u;G++){const j=o[G];j.pts=vn(j.pts,x),j.dts=vn(j.dts,x),j.dts<o[G>0?G-1:G].dts&&(S=!0)}S&&o.sort(function(G,j){const W=G.dts-j.dts,z=G.pts-j.pts;return W||z}),m=o[0].dts,g=o[o.length-1].dts;const T=g-m,w=T?Math.round(T/(u-1)):p||e.inputTimeScale/30;if(r){const G=m-x,j=G>w,W=G<-1;if((j||W)&&(j?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${zo(G,!0)} ms (${G}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${zo(-G,!0)} ms (${G}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!W||x>=o[0].pts||bl())){m=x;const z=o[0].pts-G;if(j)o[0].dts=m,o[0].pts=z;else{let Y=!0;for(let V=0;V<o.length&&!(o[V].dts>z&&Y);V++){const J=o[V].pts;if(o[V].dts-=G,o[V].pts-=G,V<o.length-1){const ae=o[V+1].pts,_e=o[V].pts,Ge=ae<=_e,Pt=ae<=J;Y=Ge==Pt}}}this.log(`Video: Initial PTS/DTS adjusted: ${zo(z,!0)}/${zo(m,!0)}, delta: ${zo(G,!0)} ms`)}}m=Math.max(0,m);let I=0,R=0,A=m;for(let G=0;G<u;G++){const j=o[G],W=j.units,z=W.length;let Y=0;for(let V=0;V<z;V++)Y+=W[V].data.length;R+=Y,I+=z,j.length=Y,j.dts<A?(j.dts=A,A+=w/4|0||1):A=j.dts,y=Math.min(j.pts,y),v=Math.max(j.pts,v)}g=o[u-1].dts;const b=R+4*I+8;let C;try{C=new Uint8Array(b)}catch(G){this.observer.emit(E.ERROR,E.ERROR,{type:re.MUX_ERROR,details:F.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:s,error:G,bytes:b,reason:`fail allocating video mdat ${b}`});return}pt(C,0,b),pt(C,4,ce.mdat);let k=!1,$=Number.POSITIVE_INFINITY,U=Number.POSITIVE_INFINITY,N=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let G=0;G<u;G++){const j=o[G],W=j.units;let z=0;for(let J=0,ae=W.length;J<ae;J++){const _e=W[J],Ge=_e.data,Pt=_e.data.byteLength;pt(C,h,Pt),h+=4,C.set(Ge,h),h+=Pt,z+=4+Pt}let Y;if(G<u-1)p=o[G+1].dts-j.dts,Y=o[G+1].pts-j.pts;else{const J=this.config,ae=G>0?j.dts-o[G-1].dts:w;if(Y=G>0?j.pts-o[G-1].pts:w,J.stretchShortVideoTrack&&this.nextAudioTs!==null){const _e=Math.floor(J.maxBufferHole*a),Ge=(i?y+i*a:this.nextAudioTs+d)-j.pts;Ge>_e?(p=Ge-ae,p<0?p=ae:k=!0,this.log(`It is approximately ${Ge/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=ae}else p=ae}let V=Math.round(j.pts-j.dts);if($=Math.min($,p),N=Math.max(N,p),U=Math.min(U,Y),D=Math.max(D,Y),!r&&G===0&&V>p){const J=Math.round(V/w)*w;J-V===1&&(this.log(`pad first CTS ${V} -> ${J} of sn: ${s.sn}`),V=J)}l.push(C_(j.key,p,z,V))}if(l.length){const G=bl();if(G){if(G<70){const j=l[0].flags;j.dependsOn=2,j.isNonSync=0}}else if(UH()&&D-U<N-$&&w/N<.025&&l[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let j=m;for(let W=0,z=l.length;W<z;W++){const Y=j+l[W].duration,V=j+l[W].cts;if(W<z-1){const J=Y+l[W+1].cts;l[W].duration=J-V}else l[W].duration=W?l[W-1].duration:w;l[W].cts=0,j=Y}}}p=k||!p?w:p;const M=g+p;this.nextVideoTs=f=M-d,this.videoSampleDuration=p,this.isVideoContiguous=!0,s.iframe&&(l.length===1?(l[0].duration=p=s.duration*a,this.nextVideoTs=f=m+p-d):this.warn(`Not adjusting IFrame duration (sample count ${l.length})`));const B={data1:Q.moof(s.sn,m,Ne(e,{samples:l})),data2:C,startPTS:(y-d)/a,endPTS:(v+p-d)/a,startDTS:(m-d)/a,endDTS:f/a,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,B}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return M7;case"ac3":return F7;default:return O7}}remuxAudio(e,t,r,i,s,a){const o=e.inputTimeScale,l=e.samplerate?e.samplerate:o,u=o/l,c=this.getSamplesPerFrame(e),d=c*u,f=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,p=[],m=s!==void 0;let g=e.samples,y=h?0:8,v=this.nextAudioTs||-1;const S=f.baseTime*o/f.timescale,x=S+t*o;if(this.isAudioContiguous=r=r||g.length&&v>0&&(i&&Math.abs(x-(v+S))<9e3||Math.abs(vn(g[0].pts,x)-(v+S))<20*d),g.forEach(function(M){M.pts=vn(M.pts,x)}),!r||v<0){const M=g.length;if(g=g.filter(L=>L.pts>=0),M!==g.length&&this.warn(`Removed ${g.length-M} of ${M} samples (initPTS ${S} / ${o})`),!g.length)return;s===0?v=0:i&&!m?v=Math.max(0,x-S):v=g[0].pts-S}if(e.segmentCodec==="aac"){const M=this.config.maxAudioFramesDrift;for(let L=0,O=v+S;L<g.length;L++){const B=g[L],G=B.pts,j=G-O,W=Math.abs(1e3*j/o);if(j<=-M*d&&m)L===0&&(this.warn(`Audio frame @ ${(G/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*j/o)} ms.`),this.nextAudioTs=v=G-S,O=G);else if(j>=M*d&&W<P7&&m){let z=Math.round(j/d);for(O=G-z*d;O<0&&z&&d;)z--,O+=d;L===0&&(this.nextAudioTs=v=O-S),this.warn(`Injecting ${z} audio frames @ ${((O-S)/o).toFixed(3)}s due to ${Math.round(1e3*j/o)} ms gap.`);for(let Y=0;Y<z;Y++){let V=b7.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);V||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),V=B.unit.subarray()),g.splice(L,0,{unit:V,pts:O}),O+=d,L++}}B.pts=O,O+=d}}let T=null,w=null,I,R=0,A=g.length;for(;A--;)R+=g[A].unit.byteLength;for(let M=0,L=g.length;M<L;M++){const O=g[M],B=O.unit;let G=O.pts;if(w!==null){const W=p[M-1];W.duration=Math.round((G-w)/u)}else if(r&&e.segmentCodec==="aac"&&(G=v+S),T=G,R>0){R+=y;try{I=new Uint8Array(R)}catch(W){this.observer.emit(E.ERROR,E.ERROR,{type:re.MUX_ERROR,details:F.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:a,error:W,bytes:R,reason:`fail allocating audio mdat ${R}`});return}h||(pt(I,0,R),pt(I,4,ce.mdat))}else return;I&&I.set(B,y);const j=B.byteLength;y+=j,p.push(C_(!0,c,j,0)),w=G}const b=p.length;if(!b)return;const C=p[p.length-1];v=w-S,this.nextAudioTs=v+u*C.duration;const k=h?new Uint8Array(0):Q.moof(e.sequenceNumber++,T/u,Ne({},e,{samples:p}));e.samples=[];const $=(T-S)/o,U=this.nextAudioTs/o,D={data1:k,data2:I,startPTS:$,endPTS:U,startDTS:$,endDTS:U,type:"audio",hasAudio:!0,hasVideo:!1,nb:b};return this.isAudioContiguous=!0,D}}function vn(n,e){let t;if(e===null)return n;for(e<n?t=-R0:t=R0;Math.abs(n-e)>4294967296;)n+=t;return n}function N7(n){for(let e=0;e<n.length;e++)if(n[e].key)return e;return-1}function DC(n,e,t,r){const i=n.samples.length;if(!i)return;const s=n.inputTimeScale;for(let o=0;o<i;o++){const l=n.samples[o];l.pts=vn(l.pts-t.baseTime*s/t.timescale,e*s)/s,l.dts=vn(l.dts-r.baseTime*s/r.timescale,e*s)/s}const a=n.samples;return n.samples=[],{samples:a}}function PC(n,e,t){const r=n.samples.length;if(!r)return;const i=n.inputTimeScale;for(let a=0;a<r;a++){const o=n.samples[a];o.pts=vn(o.pts-t.baseTime*i/t.timescale,e*i)/i}n.samples.sort((a,o)=>a.pts-o.pts);const s=n.samples;return n.samples=[],{samples:s}}class U7 extends Cn{constructor(e,t,r,i){super("passthrough-remuxer",i),this.observer=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1,this.videoOnlyRemux=!1,this.decryptdata=null,this.pendingInitSegment=void 0,this.observer=e}destroy(){this.observer&&this.observer.removeAllListeners(),this.observer=null}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,r,i){this.audioCodec=t,this.videoCodec=r,this.decryptdata=i,this.pendingInitSegment=e,this.videoOnlyRemux=!1,this.initTracks=void 0,this.initData=void 0,this.emitInitSegment=!0}generateInitSegment(e,t,r){this.videoOnlyRemux=!1;let{audioCodec:i,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:a,video:o}=this.initData=r||ML(e);if(t)bH(e,t);else{const u=a||o;u!=null&&u.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${u.codec}")!`)}a&&(i=k_(a,He.AUDIO,this)),o&&(s=k_(o,He.VIDEO,this));const l={};a&&o?l.audiovideo={container:"video/mp4",codec:i+","+s,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:a?l.audio={container:"audio/mp4",codec:i,encrypted:a.encrypted,initSegment:e,id:"audio"}:o?l.video={container:"video/mp4",codec:s,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=l}remux(e,t,r,i,s,a,o,l,u,c,d){var f,h;let{initPTS:p,lastEndTime:m}=this;const g={audio:void 0,video:void 0,text:void 0,id3:r,initSegment:void 0};X(m)||(m=this.lastEndTime=s||0);const y=t.samples;if(!y.length)return g;const v=this.pendingInitSegment;v&&(this.pendingInitSegment=void 0,this.generateInitSegment(v,this.decryptdata,c));const S={initPTS:void 0,timescale:void 0,trackId:void 0};let x=this.initData;if((f=x)!=null&&f.length||(this.generateInitSegment(y),x=this.initData),!((h=x)!=null&&h.length))return this.warn("Failed to generate initSegment."),g;if(u.iframe&&x.audio&&x.video){var T;const ee=(T=this.initTracks)==null||(T=T.audiovideo)==null?void 0:T.initSegment,Ee=ee?vH(ee):null;if(Ee){var w;this.log("Converted muxed init segment to video-only for I-Frame playback"),this.generateInitSegment(Ee,this.decryptdata),(w=this.initData)!=null&&w.length&&(x=this.initData,this.emitInitSegment=!0,this.videoOnlyRemux=!0)}}this.emitInitSegment&&(S.tracks=this.initTracks,g.initSegment=S,this.emitInitSegment=!1);const I=u.iframe,R=d&&(!I||d.includeSampleDetails)?d.tracks:AH(y,x,u,this,I),A=x.audio?R[x.audio.id]:null,b=x.video?R[x.video.id]:null,C=!!x.audio,k=!!x.video;let $="";C&&($+="audio"),k&&($+="video");const U=Pc(b,1/0),N=Pc(A,1/0),D=Pc(b,0,!0),M=Pc(A,0,!0);let L=s,O=0;b&&A&&x.audio&&(N>D||U>M)&&this.warn(`audio and video track sample timestamps do not overlap. v: ${U}-${D} a: ${N}-${M}}`,b,A);const B=!!A&&(!b||!p&&N<U||!!p&&p.trackId===x.audio.id),G=B?A:b;if(!G)return this.log(`No media samples found in ${l} ${u.level} ${u.part===-1?"":`part: ${u.part} of`} sn: ${u.sn} at playlist time: ${s}`),g;let j=y,W,z;if(b&&b.sampleCount>=1&&x.video&&u.iframe){const{trun:ee,start:Ee}=b,xe=ee.length===1,tt=ee.length?xe?ee[0].samples:ee[0].samples.concat(...ee.slice(1).map(oe=>oe.samples)):[];if(tt.length){const oe=ee[0];let Ve=oe;for(let gn=ee.length;gn--;)if(ee[gn].samples.length){Ve=ee[gn];break}const pe=Ve.lastSampleDurationOffset,{defaultSampleDurationOffset:Qe}=oe,ue=Math.abs(u.duration-(D-U))>.05,ht=tt.length<b.sampleCount;if(!(ue||ht||this.videoOnlyRemux||!xe))O=D-U;else{const gn=ht?Ve.sampleOffset+Ve.samples.reduce((Xn,LS)=>Xn+LS.size,0):void 0,jt=ue?u.duration:D-U,Ei=$7(tt,jt*x.video.timescale,pe,Qe),zr=SH(y,x.video.id,tt.length,gn,Ei);zr?(j=zr,z=B7(Ee,tt)):this.warn(`IFrame remux skipped (sn ${u.sn}); using native sample duration`),O=zr&&Ei?jt:D-U}}else this.warn(`Could not remux IFrame track fragment (no samples in range, trun count ${ee.length})`),O=D-U}else O=B?M-N:D-U;if(this.videoOnlyRemux&&j===y)return this.warn(`Dropping muxed I-Frame fragment that could not be remuxed to video-only (sn: ${u.sn})`),g;const Y=G.timescale,V=G.start-s*Y,J=B?x.audio.id:x.video.id;if(L=G.start/Y,(a||!p)&&(G7(p,L,s,O)||Y!==p.timescale)){let ee=!1;const Ee=B?"audio":"video";if(p){const xe=s!==0?L/s:1+L/1;ee=L>=0&&Math.abs(1-xe)<.001,this.log(`${Ee} timestamps in track ${J} at playlist time: ${a?"":"~"}${s} maps to ${L} with initPTS: ${p.baseTime/p.timescale} (${V/Y-p.baseTime/p.timescale}s diff) (${$}) drift estimate: ${xe} ${ee?"(ignoring drift)":"remapping timestamps (initPTS)"}`)}ee||(this.log(`Found initPTS in ${Ee} track ${J} at playlist time: ${s} offset: ${L-s} (${V}/${Y})`),p=null,S.initPTS=V,S.timescale=Y,S.trackId=J)}p?(S.initPTS=p.baseTime,S.timescale=p.timescale,S.trackId=p.trackId):((!S.timescale||S.trackId===void 0||S.initPTS===void 0)&&(this.warn("Could not set initPTS"),S.initPTS=L,S.timescale=1,S.trackId=-1),this.initPTS=p={baseTime:S.initPTS,timescale:S.timescale,trackId:S.trackId});const ae=L-p.baseTime/p.timescale,_e=ae+O,Ge=k&&G?.ptsMin!==void 0?G.ptsMin/G.timescale-p.baseTime/p.timescale:ae,Pt=z!==void 0&&b?z/b.timescale-p.baseTime/p.timescale:k&&G!=null&&G.ptsMax?G.ptsMax/G.timescale-p.baseTime/p.timescale:_e;O>0?this.lastEndTime=_e:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Yn=(x.audio?x.audio.encrypted:!1)||(x.video?x.video.encrypted:!1),je={data1:j,data2:W,startPTS:Ge,startDTS:ae,endPTS:Pt,endDTS:_e,type:$,hasAudio:C,hasVideo:k,nb:1,dropped:0,encrypted:Yn};g.audio=C&&!k?je:void 0,g.video=k?je:void 0;const yt=this.isVideoContiguous,Rt=b?.sampleCount;if(Rt){const ee=b.keyFrameIndex,Ee=ee!==-1;je.nb=Rt,je.dropped=ee===0||yt?0:Ee?ee:Rt,je.independent=Ee,je.firstKeyFrame=ee,Ee&&b.keyFrameStart&&(je.firstKeyFramePTS=(b.keyFrameStart-p.baseTime)/p.timescale),yt||(g.independent=Ee),this.isVideoContiguous||(this.isVideoContiguous=Ee),je.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${ee}/${Rt} dropped: ${je.dropped} start: ${je.firstKeyFramePTS||"NA"}`)}return g.initSegment=S,g.id3=DC(r,s,p,p),i.samples.length&&(g.text=PC(i,s,p)),g}}function Pc(n,e,t=!1){return n?.start!==void 0?(n.start+(t?n.duration:0))/n.timescale:e}function B7(n,e){let t=n,r=n;for(let i=0;i<e.length;i++){const{cts:s,duration:a}=e[i];r=Math.max(r,t+(s||0)+a),t+=a}return r}function $7(n,e,t,r){if(t!==void 0){const s=n[n.length-1];let a=e;for(let o=0;o<n.length-1;o++)a-=n[o].duration;return a<=0&&(a=s.duration),s.duration=a,{durationOffset:t,value:a}}if(r===void 0)return;const i=Math.round(e/n.length);for(let s=0;s<n.length;s++)n[s].duration=i;return{durationOffset:r,value:i}}function G7(n,e,t,r){if(n===null)return!0;const i=Math.max(r,1),s=e-n.baseTime/n.timescale;return Math.abs(s-t)>=i}function k_(n,e,t){const r=n.codec;return r&&r.length>4?r:e===He.AUDIO?r==="ec-3"||r==="ac-3"||r==="alac"?r:r==="fLaC"||r==="Opus"?If(r,!1):(t.warn(`Unhandled audio codec "${r}" in mp4 MAP`),r||"mp4a"):r==="mjpg"?r:(t.warn(`Unhandled video codec "${r}" in mp4 MAP`),r||"avc1")}let Pi;try{Pi=self.performance.now.bind(self.performance)}catch{Pi=Date.now}const wd=[{demux:g7,remux:U7},{demux:Zr,remux:Id},{demux:f7,remux:Id},{demux:p7,remux:Id}];wd.splice(2,0,{demux:h7,remux:Id});let D_=class{constructor(e,t,r,i,s,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=r,this.id=s,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,r,i){if(!this.observer)return Oc(r);const s=r.transmuxing;s.executeStart=Pi();const a=new Uint8Array(e),{currentTransmuxState:o,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:u,discontinuity:c,trackSwitch:d,accurateTimeOffset:f,timeOffset:h,initSegmentChange:p}=i||o,{audioCodec:m,videoCodec:g,defaultInitPts:y,duration:v,initSegmentData:S}=l,x=j7(a,t);if(x&&Wa(x.method)){const R=this.getDecrypter(),A=Jv(x.method);return this.asyncResult=!0,this.decryptionPromise=R.decrypt(a,x.key.buffer,x.iv.buffer,A,r.decryptRange).then(b=>{const C=this.push(b,null,r);return this.decryptionPromise=null,C}),this.decryptionPromise}const T=this.needsProbing(c,d);if(T){const R=r.iframe&&S&&Zr.probe(S,this.logger)?S:a,A=this.configureTransmuxer(R);if(A)return this.logger.warn(`[transmuxer] ${A.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:re.MEDIA_ERROR,details:F.FRAG_PARSING_ERROR,fatal:!1,error:A,reason:A.message}),s.executeEnd=Pi(),Oc(r)}(c||d||p||T)&&this.resetInitSegment(S,m,g,v,t,r),(c||p||T)&&this.resetInitialTimestamp(y),u||this.resetContiguity();const w=this.transmux(a,x,h,f,r);this.asyncResult=vu(w);const I=this.currentTransmuxState;return I.contiguous=!0,I.discontinuity=!1,I.trackSwitch=!1,s.executeEnd=Pi(),w}flush(e){const t=e.transmuxing;t.executeStart=Pi();const{decrypter:r,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const a=[],{timeOffset:o}=i;if(r){const d=r.flush();d&&a.push(this.push(d.buffer,null,e))}const{demuxer:l,remuxer:u}=this;if(!l||!u){t.executeEnd=Pi();const d=[Oc(e)];return this.asyncResult?Promise.resolve(d):d}const c=l.flush(o,e);return vu(c)?(this.asyncResult=!0,c.then(d=>(this.flushRemux(a,d,e),a))):(this.flushRemux(a,c,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,r){if(!this.remuxer)return;const{audioTrack:i,videoTrack:s,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${r.sn}${r.part>-1?" part: "+r.part:""} of ${this.id} playlist ${r.level}`);const c=this.remuxer.remux(i,s,a,o,u,l,!0,this.id,r,t.initData,t.s
vendor: 2,891 bytes, line 89
89ampleData);e.push({remuxResult:c,chunkMeta:r}),r.transmuxing.executeEnd=Pi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:r}=this;!t||!r||(t.resetTimeStamp(e),r.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,r,i,s,a){const{demuxer:o,remuxer:l}=this;!o||!l||(o.resetInitSegment(e,t,r,i,s,a),l.resetInitSegment(e,t,r,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0),this.observer&&this.observer.removeAllListeners(),this.decryptionPromise=null,this.decrypter=this.observer=void 0,this.logger=this.config=this.probe=void 0}transmux(e,t,r,i,s){let a;return t?.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,r,i,s):a=this.transmuxUnencrypted(e,r,i,s),a}transmuxUnencrypted(e,t,r,i){const{demuxer:s,remuxer:a}=this;if(!s||!a)return Oc(i);const o=s.demux(e,t,i,!1,!this.config.progressive),{audioTrack:l,videoTrack:u,id3Track:c,textTrack:d}=o;return{remuxResult:a.remux(l,u,c,d,t,r,!1,this.id,i,o.initData,o.sampleData),chunkMeta:i}}transmuxSampleAes(e,t,r,i,s){return this.demuxer?this.demuxer.demuxSampleAes(e,t,r,s).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,r,i,!1,this.id,s,a.initData,a.sampleData),chunkMeta:s})):Promise.reject(new Error("no demuxer"))}configureTransmuxer(e){const{config:t,observer:r,typeSupported:i}=this;if(!r)return;let s;try{for(let d=0,f=wd.length;d<f;d++){var a;if((a=wd[d].demux)!=null&&a.probe(e,this.logger)){s=wd[d];break}}}catch(d){return d}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,l=this.remuxer,u=s.demux,c=s.remux;(!o||!(o instanceof u))&&(this.logger.log(`Using ${u.name}`),this.demuxer=new u(r,t,i,this.logger),this.probe=u.probe),(!l||!(l instanceof c))&&(this.logger.log(`Using ${c.name}`),this.remuxer=new c(r,t,i,this.logger))}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Yv(this.config)),e}};function j7(n,e){let t=null;return n.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Oc=n=>({remuxResult:{},chunkMeta:n});function vu(n){return"then"in n&&n.then instanceof Function}class H7{constructor(e,t,r,i,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=r,this.duration=i,this.defaultInitPts=s||null}}class V7{constructor(e,t,r,i,s,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=r,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=a}}let P_=0;
vendor: 20,838 bytes, lines 89-95
89class OC{constructor(e,t,r,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=P_++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=l=>{const u=l.data,c=this.hls;if(!(!c||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var d;const f=(d=this.workerContext)==null?void 0:d.objectURL;f&&self.URL.revokeObjectURL(f);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{c.logger[u.data.logType]&&c.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,c.trigger(u.event,u.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const u=new Error(`${l.message} (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=r,this.onFlush=i;const a=(l,u)=>{u=u||{},u.frag=this.frag||void 0,l===E.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(l,u)};this.observer=new tS,this.observer.on(E.FRAG_DECRYPTED,a),this.observer.on(E.ERROR,a);const o=qT(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(s.workerPath||QV()){try{s.workerPath?(l.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=ZV(s.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=JV());const{worker:c}=this.workerContext;c.addEventListener("message",this.onWorkerMessage),c.addEventListener("error",this.onWorkerError),c.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:We(s)})}catch(c){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.terminateWorker(),this.error=null,this.transmuxer=new D_(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new D_(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=P_++;const t=this.hls.config,r=qT(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:r,id:this.id,config:We(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),e7(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,r,i,s,a,o,l,u,c){var d,f;u.transmuxing.start=self.performance.now();const{instanceNo:h,transmuxer:p}=this,m=a?a.start:s.start,g=s.decryptdata,y=this.frag,v=y?s.cc!==y.cc:!0,S=y?u.level!==y.level:!0,x=y?u.sn-y.sn:-1,T=this.part?u.part-this.part.index:-1,w=x===0&&u.id>1&&u.id===y?.stats.chunkCount,I=!S&&(x===1||x===0&&(T===1||w&&T<=0)),R=self.performance.now();(S||x||s.stats.parsing.start===0)&&(s.stats.parsing.start=R),a&&(T||!I)&&(a.stats.parsing.start=R);const A=!(y&&((d=s.initSegment)==null?void 0:d.url)===((f=y.initSegment)==null?void 0:f.url)),b=new V7(v,I,l,S,m,A);if(!I||v||A){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id} playlist: ${u.level} id: ${u.id} 90 discontinuity: ${v} 91 trackSwitch: ${S} 92 contiguous: ${I} 93 accurateTimeOffset: ${l} 94 timeOffset: ${m} 95 initSegmentChange: ${A}`);const C=new H7(r,i,t,o,c);this.configureTransmuxer(C)}if(this.frag=s,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:h,cmd:"demux",data:e,decryptdata:g,chunkMeta:u,state:b},e instanceof ArrayBuffer?[e]:[]);else if(p){const C=p.push(e,g,u,b);vu(C)?C.then(k=>{this.handleTransmuxComplete(k)}).catch(k=>{this.transmuxerError(k,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(C)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:r}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(r){const i=r.flush(e);vu(i)?i.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(i,e)}}transmuxerError(e,t,r){this.hls&&(this.error=e,this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:r}))}handleFlushResult(e,t){e.forEach(r=>{this.handleTransmuxComplete(r)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:r}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):r&&r.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const O_=100;class W7 extends eS{constructor(e,t,r){super(e,t,r,"audio-stream-controller",te.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.nextTrackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,t){const{frag:r,id:i,initPTS:s,timescale:a,trackId:o,timestampOffsets:l}=t;if(i===te.MAIN){const u=r.cc,c=this.fragCurrent;if(this.initPTS=l,this.log(`InitPTS for cc: ${u} found from main: ${s/a} (${s}/${a}) trackId: ${o}`),this.mainAnchor=r,this.state===H.WAITING_INIT_PTS){const d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==u)&&this.syncWithAnchor(r,d?.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==u?(c.abortRequests(),this.syncWithAnchor(r,c)):this.state===H.IDLE&&this.tick()}}getLoadPosition(){var e;return!this.startFragRequested&&this.nextLoadPosition>=0&&((e=this.switchingTrack)==null?void 0:e.flushImmediate)!==!1?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var r;const i=((r=this.mainFragLoading)==null?void 0:r.frag)||null;if(t&&i?.cc===t.cc)return;const s=(i||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=JL(a,s,o);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===H.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=H.STOPPED;return}const r=this.lastCurrentTime;this.stopLoad(),this.setInterval(O_),r>0&&e===-1&&!t&&this.initPTS.length&&(this.log(`Override startPosition with lastCurrentTime @${r.toFixed(3)}`),e=r),this.state=H.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,!t&&!this.fragmentTracker.hasFragments(this.playlistType)&&(this.startFragRequested=!1),this.tick()}doTick(){switch(this.state){case H.IDLE:this.doTickIdle();break;case H.WAITING_TRACK:{const{levels:e,trackId:t}=this,r=e?.[t],i=r?.details;if(i&&!this.waitForLive(r)){if(this.waitForCdnTuneIn(i))break;this.state=H.WAITING_INIT_PTS}break}case H.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case H.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:r,cache:i,complete:s}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=H.FRAG_LOADING;const o=i.flush().buffer,l={frag:t,part:r,payload:o,networkDetails:null};this._handleFragmentLoadProgress(l),s&&super._handleFragmentLoadComplete(l)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=H.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime,this.checkFragmentChanged())}doTickIdle(){var e;const{hls:t,levels:r,media:i,trackId:s}=this,a=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(r!=null&&r[s]))return;const o=r[s],l=o.details;if(!l||this.waitForLive(o)||this.waitForCdnTuneIn(l)){this.state=H.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.getBufferOutput();this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,He.AUDIO));const c=this.getFwdBufferInfo();if(c===null)return;if(!this.switchingTrack&&this._streamEnded(c,l)){t.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=H.ENDED;return}const d=c.len,f=t.maxBufferLength,h=l.fragments,p=h[0].start,m=this.getLoadPosition(),g=this.flushing||this.switchingTrack&&!this.switchingTrack.flushImmediate?m:c.end;if(this.switchingTrack&&i){const S=m;l.PTSKnown&&S<p&&S>=this.timelineOffset&&(c.end>p||c.nextStart)&&(this.log(`Alt audio track ahead of main track, seek to start of alt audio track ${S} -> ${p} + 0.05`),i.currentTime=p+.05)}if(d>=f&&!this.switchingTrack&&g<h[h.length-1].start)return;let y=this.getNextFragment(g,l);if(y&&this.isLoopLoading(y,g)&&(y=this.getNextFragmentLoopLoading(y,l,c,te.MAIN,f)),!y){this.bufferFlushed=!0;return}if(this.exceedsMaxBuffer(c,f,y))return;let v=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&v&&at(y)&&!y.endList&&(!l.live||!this.loadingParts&&g<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(v)===rt.OK&&(this.mainFragLoading=v=null),v&&at(v))){if(y.start>v.end){const x=this.fragmentTracker.getFragAtPos(g,te.MAIN);x&&x.end>v.end&&(v=x,this.mainFragLoading={frag:x,targetBufferTime:null})}if(y.start>v.end)return}this.loadFragment(y,o,g)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(r=>new mu(r))}onAudioTrackSwitching(e,t){const r=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),r?(this.switchingTrack=t,t.flushImmediate||(this.nextTrackId=t.id,this.nextLevelSwitch()),this.flushAudioIfNeeded(t),this.state!==H.STOPPED&&(this.setInterval(O_),this.state=H.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const r=this.cachedTrackLoadedData;r&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(E.AUDIO_TRACK_LOADED,r))}onAudioTrackLoaded(e,t){var r;const{levels:i}=this,{details:s,id:a,groupId:o,track:l}=t;if(!i){this.warn(`Audio tracks reset while loading track ${a} "${l.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||s.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==H.STOPPED&&(this.state=H.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${l.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const c=i[a];let d=0;if(s.live||(r=c.details)!=null&&r.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(c.details){var f;d=this.alignPlaylists(s,c.details,(f=this.levelLastLoaded)==null?void 0:f.details)}s.alignedSliding||(kf(u,s,this),d=s.fragmentStart)}c.details=s,this.levelLastLoaded=c,this.startFragRequested||this.setStartPosition(u,d),this.hls.trigger(E.AUDIO_TRACK_UPDATED,{details:s,id:a,groupId:t.groupId}),this.state===H.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=H.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const r=e.frag,{part:i,payload:s}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const u=l[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const c=u.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(r.start);return}const d=a.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let f=this.transmuxer;f||(f=this.transmuxer=new OC(this.hls,te.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const h=this.initPTS[r.cc],p=(t=r.initSegment)==null?void 0:t.data;if(h!==void 0){const g=i?i.index:-1,y=g!==-1,v=new Xv(r.level,r.sn,r.stats.chunkCount,s.byteLength,g,y,r.duration);f.push(s,p,d,"",r,i,c.totalduration,!1,v,h)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${c.startSN} ,${c.endSN}],track ${o}`);const{cache:m}=this.waitingData=this.waitingData||{frag:r,part:i,cache:new yC,complete:!1};m.push(new Uint8Array(s)),this.state!==H.STOPPED&&(this.state=H.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===te.MAIN&&at(t.frag)&&(this.mainFragLoading=t,this.state===H.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:r,part:i}=t;if(r.type!==te.AUDIO){!this.audioOnly&&r.type===te.MAIN&&!r.elementaryStreams.video&&!r.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${i?" p: "+i.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(at(r)){const s=this.switchingTrack;s&&(this.bufferedTrack=s)}this.fragBufferedComplete(r,i),this.media&&this.tick()}getFwdBufferInfo(){const e=this.getBufferOutput();return super.getFwdBufferInfo(e,te.AUDIO)}getBufferOutput(){return this.mediaBuffer?this.mediaBuffer:this.media}checkFragmentChanged(){const e=this.fragPlaying;if(!this.checkFragPlaying())return!1;const r=this.fragPlaying,i=e?.level;return(!r||r.level!==i)&&(e&&this.cleanupBackBuffer(),this.switchingTrack&&this.completeAudioSwitch(this.switchingTrack)),!0}onError(e,t){var r;if(t.fatal){this.state=H.ERROR;return}switch(t.details){case F.FRAG_GAP:case F.FRAG_PARSING_ERROR:case F.FRAG_DECRYPT_ERROR:case F.FRAG_LOAD_ERROR:case F.FRAG_LOAD_TIMEOUT:case F.KEY_LOAD_ERROR:case F.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(te.AUDIO,t);break;case F.AUDIO_TRACK_LOAD_ERROR:case F.AUDIO_TRACK_LOAD_TIMEOUT:case F.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===H.WAITING_TRACK&&((r=t.context)==null?void 0:r.type)===ve.AUDIO_TRACK&&(this.state=H.IDLE);break;case F.BUFFER_APPEND_NO_PROGRESS:if(t.parent!=="audio")return;t.frag&&(t.appendsWithoutProgress||0)>=this.config.appendErrorMaxRetry&&(this.warn(`Marking fragment ${t.frag.sn} of track ${t.frag.level} as a gap after ${t.appendsWithoutProgress} appends without buffered range growth, to prevent loop loading`),this.fragmentTracker.addAsGap(t.frag));break;case F.BUFFER_ADD_CODEC_ERROR:case F.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case F.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case F.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==He.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==He.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===H.ENDED&&(this.state=H.IDLE);const r=this.getBufferOutput();r&&(this.afterBufferFlushed(r,t),this.tick())}}_handleTransmuxComplete(e){var t;const r="audio",{hls:i}=this,{remuxResult:s,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:u,level:c}=o,{details:d}=c,{audio:f,text:h,id3:p,initSegment:m}=s;if(this.fragContextChanged(l)||!d){this.fragmentTracker.removeFragment(l),m!=null&&m.tracks&&this.resetTransmuxer();return}if(this.state=H.PARSING,f&&this.switchingTrack&&!this.switchingTrack.flushImmediate){const{config:g}=this,y=g.nextAudioTrackBufferFlushForwardOffset,v=Math.max(this.getLoadPosition()+y,l.start);super.flushMainBuffer(v,Number.POSITIVE_INFINITY,te.AUDIO)}if(m!=null&&m.tracks){const g=l.initSegment||l;if(this.unhandledEncryptionError(m,l))return;this._bufferInitSegment(c,m.tracks,g,a),i.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:r,tracks:m.tracks})}if(f){const{startPTS:g,endPTS:y,startDTS:v,endDTS:S}=f;u&&(u.elementaryStreams[He.AUDIO]={startPTS:g,endPTS:y,startDTS:v,endDTS:S}),l.setElementaryStreamInfo(He.AUDIO,g,y,v,S),this.bufferFragmentData(f,l,u,a)}if(p!=null&&(t=p.samples)!=null&&t.length){const g=Ne({id:r,frag:l,details:d},p);i.trigger(E.FRAG_PARSING_METADATA,g)}if(h){const g=Ne({id:r,frag:l,details:d},h);i.trigger(E.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,r,i){if(this.state!==H.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=te.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${a}/${s.codec}]`),a?.split(",").length===1&&(s.levelCodec=a),this.hls.trigger(E.BUFFER_CODECS,t);const o=s.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:r,part:null,chunkMeta:i,parent:r.type,data:o};this.hls.trigger(E.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,r){const i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===rt.NOT_LOADED||i===rt.PARTIAL){var s;if((s=t.details)!=null&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=H.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&kf(a,t.details,this)}else super.loadFragment(e,t,r)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack&&e.flushImmediate){const{name:t,lang:r,assocLang:i,characteristics:s,audioCodec:a,channels:o}=this.bufferedTrack;Bs({name:t,lang:r,assocLang:i,characteristics:s,audioCodec:a,channels:o},e,bs)||(Rf(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,ie({},e))}get nextAudioTrack(){return this.nextTrackId}}class aS extends Cn{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.loadingSync=!1,this.hls=e}destroy(){this.clearTimer(),this.hls=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}
vendor: 4,575 bytes, line 95
95startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,r){const i=t?.renditionReports;if(i){let s=-1;for(let a=0;a<i.length;a++){const o=i[a];let l;try{l=new self.URL(o.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),l=o.URI||""}if(l===e){s=a;break}else l===e.substring(0,l.length)&&(s=a)}if(s!==-1){const a=i[s],o=parseInt(a["LAST-MSN"])||t.lastPartSn;let l=parseInt(a["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const c=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&c>t.partTarget&&(l+=1)}const u=r&&YT(r);return new XT(o,l>=0?l:void 0,u)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}return e}playlistLoaded(e,t,r){const{details:i,stats:s}=t,a=i.fragments,o=self.performance.now(),l=s.loading.first?Math.max(0,Math.floor(o-s.loading.first)):0;i.advancedDateTime=Date.now()-l;const u=this.hls.config.timelineOffset;if(u!==i.appliedTimelineOffset){const d=Math.max(u||0,0);i.appliedTimelineOffset=d,a.forEach(f=>{f?.setStart(f.playlistOffset+d)})}if(i.live||r!=null&&r.live){var c;const d="levelInfo"in t?t.levelInfo:t.track;i.reloaded(r);const f=(c=a[a.length-1])==null?void 0:c.type;if(i.misses>=this.hls.config.liveMaxUnchangedPlaylistRefresh){const T=new Error(`${f} playlist ${d.id} hit max allowed unchanged reloads.`);this.warn(T);const{networkDetails:w,context:I}=t;this.hls.trigger(E.ERROR,{type:re.NETWORK_ERROR,details:F.PLAYLIST_UNCHANGED_ERROR,fatal:!1,url:i.url,error:T,reason:T.message,level:t.level,parent:f,context:I,networkDetails:w,stats:s});return}if(r){BV(r,i,this);const T=i.playlistParsingError;if(T){this.warn(T);const w=this.hls;if(!w.config.ignorePlaylistParsingErrors){const{networkDetails:I}=t;w.trigger(E.ERROR,{type:re.NETWORK_ERROR,details:F.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:T,reason:T.message,level:t.level,parent:f,networkDetails:I,stats:s});return}i.playlistParsingError=null}}i.requestScheduled===-1&&(i.requestScheduled=s.loading.start);const h=this.hls.mainForwardBufferInfo,p=h?h.end-h.len:0,m=(i.edge-p)*1e3,g=dC(i,m);i.requestScheduled+g<o?i.requestScheduled=o:i.requestScheduled<=o&&(i.requestScheduled+=g);const y=t.deliveryDirectives;if(this.log(`live playlist ${e} ${i.advanced?`REFRESHED ${i.lastPartSn} - ${i.lastPartIndex}`:i.updated?"UPDATED":`MISSED (received ${i.lastPartSn} - ${i.lastPartIndex}${y?` | requested ${y.msn} - ${y.part}`:""})`}`),!this.canLoad||!i.live)return;let v,S,x;if(i.canBlockReload&&i.advanced){const T=this.hls.config.lowLatencyMode,w=i.lastPartSn,I=i.endSN,R=i.lastPartIndex,A=R!==-1,b=w===I;A?b?(S=I+1,x=T?0:R):(S=w,x=T?R+1:i.maxPartIndex):S=I+1;const C=i.age,k=C+i.ageHeader;let $=Math.min(k-i.partTarget,i.targetduration*1.5);if($>0){if(k>i.targetduration*3)this.log(`Playlist last advanced ${C.toFixed(2)}s ago. Omitting segment and part directives.`),S=void 0,x=void 0;else if(r!=null&&r.tuneInGoal&&k-i.partTarget>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${$} with playlist age: ${i.age}`),$=0;else{const U=Math.floor($/i.targetduration);if(S+=U,x!==void 0){const N=Math.round($%i.targetduration/i.partTarget);x+=N}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${C.toFixed(2)}s goal: ${$} skip sn ${U} to part ${x}`)}i.tuneInGoal=$}if(v=this.getDeliveryDirectives(i,t.deliveryDirectives,S,x),T||!b){i.requestScheduled=o,this.loadingPlaylist(d,v);return}}else(i.canBlockReload||i.canSkipUntil)&&(v=this.getDeliveryDirectives(i,t.deliveryDirectives,S,x));v&&S!==void 0&&i.canBlockReload&&(i.requestScheduled=s.loading.first+Math.max(g-l*2,g/2)),this.scheduleLoading(d,v,i)}else this.clearTimer()}scheduleLoading(e,t,r){const i=r||e.details;if(!i){this.loadingPlaylist(e,t);return}const s=self.performance.now(),a=i.requestScheduled;if(s>=a&&!this.loadingSync){this.loadingSync=!0,this.loadingPlaylist(e,t),this.loadingSync=!1;return}const o=Math.max(a-s,0);this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,r,i){let s=YT(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,i=t.part,s=bd.No),new XT(r,i,s)}checkRetry(e){const t=e.details,r=_f(e),i=e.errorAction,{action:s,retryCount:a=0,retryConfig:o}=i||{}
vendor: 9,079 bytes, lines 95-98
95,l=!!i&&!!o&&(s===Ft.RetryRequest||!i.resolved&&s===Ft.SendAlternateToPenaltyBox);if(l){var u;if(a>=o.maxNumRetry)return!1;if(r&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{var c;const d=cu((c=e.response)==null?void 0:c.code);if(this.clearTimer(),d)this.log("Waiting for connection (offline)"),e.reason="offline",this.timer=self.setTimeout(()=>this.checkOfflineStatus(),1e3);else{const f=Hv(o,a);this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${f}ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(),f)}}e.levelRetry=!0,i.resolved=!0}return l}checkOfflineStatus(){this.clearTimer(),cu(0)?this.timer=self.setTimeout(()=>this.checkOfflineStatus(),1e3):(this.log("Connection restored (online)"),this.loadPlaylist())}}function MC(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!Su(n[t].attrs,e[t].attrs))return!1;return!0}function Su(n,e,t){const r=n["STABLE-RENDITION-ID"];return r&&!t?r===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>n[i]!==e[i])}class z7 extends aS{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:r,groupId:i,details:s}=t,a=this.tracksInGroup[r];if(!a||a.groupId!==i){this.warn(`Audio track with id:${r} and group:${i} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${r} "${a.name}" lang:${a.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),r===this.trackId&&this.playlistLoaded(r,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const r=t.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!r||i?.length!==r?.length||r!=null&&r.some(o=>i?.indexOf(o)===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(f=>gu(f.groupId,r));if(o.length)this.selectDefaultTrack&&!o.some(f=>f.default)&&(this.selectDefaultTrack=!1),o.forEach((f,h)=>{f.id=h});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!s&&l){const f=Pr(l,o,bs);if(f>-1)s=o[f];else{const h=Pr(l,this.tracks);s=this.tracks[h]}}let u=this.findTrackId(s);u===-1&&s&&(u=this.findTrackId(null));const c={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${r?.join(",")}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,c);const d=this.trackId;if(u!==-1&&d===-1)this.setAudioTrack(u);else if(o.length&&d===-1){var a;const f=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(f.message),this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}}onError(e,t){t.fatal||!t.context||t.context.type===ve.AUDIO_TRACK&&t.context.id===this.trackId&&gu(t.context.groupId,this.groupIds)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}get nextAudioTrack(){return this.trackId}set nextAudioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e,!1)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const i=this.currentTrack;if(i&&Bs(e,i,bs))return i;const s=Pr(e,this.tracksInGroup,bs);if(s>-1){const a=this.tracksInGroup[s];return this.setAudioTrack(s,"flushImmediate"in e&&e.flushImmediate),a}else if(i){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=lV(e,t.levels,r,a,bs);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Pr(e,r);if(a>-1)return r[a]}}}return null}setAudioTrack(e,t=!0){const r=this.tracksInGroup;if(e<0||e>=r.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,s=r[e],a=s.details&&!s.details.live;if(e===this.trackId&&s===i&&a||(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,ie(ie({},s),{},{flushImmediate:t})),a))return;const o=this.switchParams(s.url,i?.details,s.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let r=0;r<t.length;r++){const i=t[r];if(!(this.selectDefaultTrack&&!i.default)&&(!e||Bs(e,i,bs)))return r}if(e){const{name:r,lang:i,assocLang:s,characteristics:a,audioCodec:o,channels:l}=e;for(let u=0;u<t.length;u++){const c=t[u];if(Bs({name:r,lang:i,assocLang:s,characteristics:a,audioCodec:o,channels:l},c,bs))return u}for(let u=0;u<t.length;u++){const c=t[u];if(Su(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const c=t[u];if(Su(e.attrs,c.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Rf(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const r=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading audio-track ${r} "${e.name}" lang:${e.lang} group:${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:s,id:r,groupId:i,deliveryDirectives:t||null,track:e})}}class K7{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,r){if(this.queues===null||this.tracks===null)return;const i=this.queues[t];i.push(e),i.length===1&&!r&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const r={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(r,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const r={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(r)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const r=(t=e[0])==null?void 0:t.label;r==="async-blocker"||r==="async-blocker-prepend"?(e[0].execute(),e.splice(0,1)):r==="block-audio"&&e.splice(0,1)})}insertNext(e,t){this.queues!==null&&this.queues[t].splice(1,0,...e)}unblockAudio(){var e;this.queues!==null&&((e=this.current("audio"))==null?void 0:e.label)==="block-audio"&&this.shiftAndExecuteNext("audio")}audioBlocking(){return this.queues===null?!1:this.queues.audio.some(e=>e.label==="block-audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(s){var r;if(i.onError(s),this.queues===null||this.tracks===null)return;const a=(r=this.tracks[e])==null?void 0:r.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":` 96${this.list("video")} 97${this.list("audio")} 98${this.list("audiovideo")}}`}list(e){var t,r;return(t=this.queues)!=null&&t[e]||(r=this.tracks)!=null&&r[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const r=(t=this.tracks)==null?void 0:t[e],i=r?.buffer;return i?`SourceBuffer${i.updating?" updating":""}${r.ended?" ended":""}${r.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(r=>r.label).join(", "))||""}}const M_=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,FC="HlsJsTrackRemovedError",q7=.25,Y7=.001;
vendor: 13,937 bytes, lines 98-100
98class X7 extends Error{constructor(e){super(e),this.name=FC}}class Q7 extends Cn{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null),this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0,this._quotaEvictionPending={},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=r=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)==="open"&&(!this.media||this.media.seeking||this.hls.pauseBuffering())},this._onStartStreaming=r=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=r=>{const{media:i,mediaSource:s}=this;r&&this.log("Media source opened"),!(!i||!s)&&(Oe(s,"sourceopen",this._onMediaSourceOpen),Oe(i,"emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:i,mediaSource:s}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{if(this.log("Media source closed"),this.media){const r=this.media.error,{appendError:i,appendErrors:s}=this;let a=!1;!i&&r&&(a=Math.max(++s.audio,++s.video,++s.audiovideo)>=this.hls.config.appendErrorMaxRetry);const o=new Error(`MediaSource closed while media attached${N_(a,r)}`);this.warn(o),this.hls.trigger(E.ERROR,Ne({fatal:a},i,{type:re.MEDIA_ERROR,details:F.MEDIA_SOURCE_REQUIRES_RESET,error:o}))}},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:r,_objectUrl:i}=this;r!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${r})`)},this._onMediaError=()=>{const{media:r}=this;if(r){var i,s;this.log(`Media error (code: ${(i=r.error)==null?void 0:i.code}): ${(s=r.error)==null?void 0:s.message}`)}},this.hls=e,this.fragmentTracker=t,this.appendSource=Zj(is(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null,this._onMediaEmptied=this._onMediaError=null}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this),e.off(E.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const r={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const a=this.isQueued();(s||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const i=this.transferData;return i&&!this.sourceBufferCount&&i.mediaSource===t?Ne(r,i.tracks):this.sourceBuffers.forEach(s=>{const[a]=s;a&&(r[a]=Ne({},this.tracks[a]),this.removeBuffer(a)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:r}}initTracks(){const e={};this.resetAppendProgress(),this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null,this.resetAppendErrors(),this.resetAppendProgress()}onManifestParsed(e,t){var r;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),(r=this.transferData)!=null&&r.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){const r=this.media=t.media;this.transferData=this.overrides=void 0;const i=is(this.appendSource);if(i){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(a),s)this._objectUrl=r.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{r.removeAttribute("src");const l=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||l&&a instanceof l,F_(r),J7(r,o),r.load()}catch{r.src=o}else r.src=o}Me(r,"emptied",this._onMediaEmptied),Me(r,"error",this._onMediaError),this.appendSource&&Me(r,"seeking",this._onStartStreaming)}}assignMediaSource(e){var t,r;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(r=e.constructor)==null?void 0:r.name}`),Me(e,"sourceopen",this._onMediaSourceOpen),Me(e,"sourceended",this._onMediaSourceEnded),Me(e,"sourceclose",this._onMediaSourceClose),this.appendSource&&(Me(e,"startstreaming",this._onStartStreaming),Me(e,"endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const r=this.tracks,i=t.tracks,s=i?Object.keys(i):null,a=s?s.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(i&&s&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) 99required tracks: ${We(r,(l,u)=>l==="initSegment"?void 0:u)}; 100transfer tracks: ${We(i,(l,u)=>l==="initSegment"?void 0:u)}}`),!bL(i,r)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,u=this.details,c=Math.max(l,u?.fragments[0].start||0);if(c-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${c}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(r)}") start time: ${c} currentTime: ${l}`),this.onMediaDetaching(E.MEDIA_DETACHING,{}),this.onMediaAttaching(E.MEDIA_ATTACHING,t),e.currentTime=c;return}this.transferData=void 0,s.forEach(l=>{const u=l,c=i[u];if(c){const d=c.buffer;if(d){const f=this.fragmentTracker,h=c.id;if(f.hasFragments(h)||f.hasParts(h)){const g=le.getBuffered(d);f.detectEvictedFragments(u,g,h,null,null,!0)}const p=gm(u),m=[u,d];this.sourceBuffers[p]=m,d.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,c)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const r=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:s,_objectUrl:a}=this;if(s){if(this.log(`media source ${r?"transferring":"detaching"}`),r)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=s.readyState==="open";try{const l=s.sourceBuffers;for(let u=l.length;u--;)o&&l[u].abort(),s.removeSourceBuffer(l[u]);o&&s.endOfStream()}catch(l){this.warn(`onMediaDetaching: ${l.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}Oe(s,"sourceopen",this._onMediaSourceOpen),Oe(s,"sourceended",this._onMediaSourceEnded),Oe(s,"sourceclose",this._onMediaSourceClose),this.appendSource&&(Oe(s,"startstreaming",this._onStartStreaming),Oe(s,"endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}i&&(Oe(i,"emptied",this._onMediaEmptied),Oe(i,"error",this._onMediaError),Oe(i,"seeking",this._onStartStreaming),r||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(i.removeAttribute("src"),this.appendSource&&F_(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const r=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),r)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[gm(e)]=[null,null];const t=this.tracks[e];t&&(this.clearBufferAppendTimeoutId(t),t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new K7(this.tracks)}onBufferCodecs(e,t){var r;const i=this.tracks,s=Object.keys(t);this.log(`BUFFER_CODECS: "${s}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),o=!a&&this.sourceBufferCount&&this.media&&s.some(l=>!i[l]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${s}" SourceBuffers`);return}s.forEach(l=>{var u,c;const d=t[l],{id:f,codec:h,levelCodec:p,container:m,metadata:g,supplemental:y}=d;let v=i[l];const S=(u=this.transferData)==null||(u=u.tracks)==null?void 0:u[l],x=S!=null&&S.buffer?S:v,T=x?.pendingCodec||x?.codec,w=x?.levelCodec;v||(v=i[l]={buffer:void 0,listeners:[],codec:h,supplemental:y,container:m,levelCodec:p,metadata:g,id:f});const I=_d(T,w),R=I?.replace(M_,"$1");let A=_d(h,p);const b=(c=A)==null?void 0:c.replace(M_,"$1");A&&I&&R!==b&&(l.slice(0,5)==="audio"&&(A=If(A,this.appendSource)),this.log(`switching codec ${T} to ${A}`),A!==(v.pendingCodec||v.codec)&&(v.pendingCodec=A),v.container=m,this.appendChangeType(l,m,A))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((r=t.audio)==null?void 0:r.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const r=this.tracks[t];return e[t]={id:r.id,container:r.container,codec:r.codec,levelCodec:r.levelCodec},e},{})}appendChangeType(e,t,r){const i=`${t};codecs=${r}`,s={label:`change-type=${i}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),o.changeType(i),a.codec=r,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const r=e.start,i=r+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(r,te.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var o,l;(this.lastVideoAppendEnd>i||le.isBuffered((o=this.tracks.video)==null?void 0:o.buffer,i)||((l=this.fragmentTracker.getAppendedFrag(i,te.MAIN))==null?void 0:l.gap)===!0)&&this.unblockAudio()},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.append(a,"audio",!0)}unblockAudio(){this.operationQueue&&this.operationQueue.unblockAudio()}onBufferAppending(e,t){const{tracks:r}=this,{data:i,type:s,parent:a,frag:o,part:l,chunkMeta:u,offset:c}=t,d=u.buffering[s],f=at(o)&&!l&&!o.gap&&!u.partial&&!u.iframe;let h=null,p=!1;const{sn:m,cc:g}=o,y=self.performance.now();d.start=y;const v=o.stats.buffering,S=l?l.stats.buffering:null;v.start===0&&(v.start=y),S?.start===0&&(S.start=y);const x=r.audio;let T=!1;s==="audio"&&x?.container==="audio/mpeg"&&(T=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const w=r.video,I=w?.buffer;if(I&&m!=="initSegment"&&c!==void 0){const b=x?.buffer,C=l||o;if(s==="audio"&&a!=="main"&&!(w.ending||w.ended)&&b&&le.getBuffered(b).length){const $=C.start+C.duration*.05,U=le.getBuffered(I),N=this.currentOp("video");!U.length&&!N?this.blockAudio(C):!le.isBuffered(I,$)&&this.lastVideoAppendEnd<$&&this.blockAudio(C)}else if(s==="video"){const k=C.end,$=this.lastVideoAppendEnd-k;this.lastVideoAppendEnd=k,$<0||$>C.duration?this.unblockAudio():this.isAudioBlocked()&&this.executeNext("audio")}}const R=(l||o).start,A={label:`append-${s}`,execute:()=>{var b;d.executeStart=self.performance.now();const C=(b=this.tracks[s])==null?void 0:b.buffer;C&&(f&&(h=le.timeRangesToArray(le.getBuffered(C)),p=B_(ym(h,o),o)),T?this.updateTimestampOffset(C,R,.1,s,m,g):c!==void 0&&X(c)&&this.updateTimestampOffset(C,c,1e-6,s,m,g)),this.appendExecutor(i,s)},onStart:()=>{},onComplete:()=>{this.clearBufferAppendTimeoutId(this.tracks[s]);const b=self.performance.now();d.executeEnd=d.end=b,v.first===0&&(v.first=b),S?.first===0&&(S.first=b);const C={};
vendor: 4,537 bytes, line 100
100if(this.sourceBuffers.forEach(([k,$])=>{k&&(C[k]=le.getBuffered($))}),f){const k=this.getFragmentAppendProgress(o),$=C[s];if($&&h){const U=le.timeRangesToArray($),N=ym(U,o);k.progressed||(k.progressed=N-ym(h,o)>Y7);const D=p&&B_(N,o);k.fullyBuffered[s]=(k.fullyBuffered[s]===void 0||k.fullyBuffered[s])&&D}}this.hls.trigger(E.BUFFER_APPENDED,{type:s,frag:o,part:l,chunkMeta:u,parent:a,timeRanges:C})},onError:b=>{var C;this.clearBufferAppendTimeoutId(this.tracks[s]);const k=b.code===DOMException.QUOTA_EXCEEDED_ERR||b.name=="QuotaExceededError"||"quota"in b;if(k&&!this._quotaEvictionPending[s]){const D=this.getBackBufferEvictionTarget(s,i.byteLength,o.type);if(D>0){this._quotaEvictionPending[s]=!0,this.log(`QuotaExceededError on "${s}" append sn: ${m} - evicting back buffer to ${D.toFixed(3)}s and retrying`);const M=this.getFlushOp(s,0,D),L=this.getClearEvictionPendingOp(s);this.insertNext([M,A,L],s);return}this.warn(`QuotaExceededError on "${s}" sn: ${m} - no back buffer available to evict`)}f&&(this.getFragmentAppendProgress(o).errored=!0);const $={type:re.MEDIA_ERROR,parent:a,details:F.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:l,chunkMeta:u,error:b,err:b,fatal:!1},U=(C=this.media)==null?void 0:C.error;if(b.name===FC&&this.sourceBufferCount===0&&(!this.media||this.pendingTrackCount===0))$.errorAction=Il(!0);else{var N;k&&($.details=F.BUFFER_FULL_ERROR);const D=++this.appendErrors[s],M=this.hls.config.appendErrorMaxRetry;this.warn(`Failed ${D}/${M+1} times to append segment in "${s}" sourceBuffer with error: ${b.message}`),D>=M&&($.fatal=!k);const L=(N=this.mediaSource)==null?void 0:N.readyState;(L==="ended"||L==="closed"||U)&&(this.warn(`MediaSource readyState "${L}" during SourceBuffer${N_($.fatal,U)}`),$.details=F.MEDIA_SOURCE_REQUIRES_RESET)}this.appendError=$,this.hls.trigger(E.ERROR,$),k&&this.hls&&this.trimBuffers(o.start,1)}};this.log(`queuing "${s}" append sn: ${m}${l?" p: "+l.index:""} of ${a} playlist ${o.level} cc: ${g} offset: ${c} bytes: ${i.byteLength}`),this.append(A,s,this.isPending(this.tracks[s]))}getClearEvictionPendingOp(e){return{label:"clear",execute:()=>{this._quotaEvictionPending[e]=!1,this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:()=>{}}}getFlushOp(e,t,r){return this.log(`queuing "${e}" remove ${t}-${r}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,r)},onStart:()=>{},onComplete:()=>{var i;const s=(i=this.tracks[e])==null?void 0:i.buffer;this.log(`Remove request ${t}-${r} from ${e} Source Buffer complete > buffer: ${s?Df(le.getBuffered(s)):"(detached)"}`),this.hls.trigger(E.BUFFER_FLUSHED,{type:e,start:t,end:r})},onError:i=>{this.warn(`Failed to remove ${t}-${r} from "${e}" SourceBuffer`,i),this.hls.trigger(E.BUFFER_FLUSHED,{type:e,start:0,end:0,error:i})}}}onBufferFlushing(e,t){const{type:r,startOffset:i,endOffset:s}=t;(!r||r==="audio")&&this.unblockAudio(),r?this.append(this.getFlushOp(r,i,s),r):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,i,s),a)})}onFragParsed(e,t){const{frag:r,part:i,chunkMeta:s}=t,a=[],o=i?i.elementaryStreams:r.elementaryStreams;o[He.AUDIOVIDEO]?a.push("audiovideo"):(o[He.AUDIO]&&a.push("audio"),o[He.VIDEO]&&a.push("video"));const l=()=>{const u=self.performance.now();r.stats.buffering.end=u,i&&(i.stats.buffering.end=u);const c=i?i.stats:r.stats;this.checkAppendProgress(r,i,s,a),this.hls&&(this.hls.trigger(E.FRAG_BUFFERED,{frag:r,part:i,stats:c,id:r.type,chunkMeta:s}),!i&&r.gap&&c.retry&&this.log(`Nothing buffered for ${r.type} level: ${r.level} sn: ${r.sn} retries ${c.retry}`))};a.length===0&&this.log(`Fragments must have at least one ElementaryStreamType set. ${r.type} ${r.level} ${i?`part: ${i.index} of `:""}sn: ${r.sn}`),this.blockBuffers(l,a).catch(u=>{this.warn(`Fragment buffered callback ${u.message}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){var r,i;const s=(r=this.hls)==null?void 0:r.config;if(!s)return;const{backBufferLength:a,frontBufferFlushThreshold:o}=s;this.trimBuffers(o,a,t.frag,t.previousFrag);const l=t.frag.elementaryStreams,{appendErrors:u}=this,c=(i=this.appendError)==null?void 0:i.sourceBufferName;Object.keys(l).forEach(d=>{l[d]&&(u[d]=0,d===c&&(this.appendError=void 0),d==="audio"||d==="video"?(u.audiovideo=0,c==="audiovideo"&&(this.appendError=void 0)):(u.audio=0,u.video=0,c!=="audiovideo"&&(this.appendError=void 0)))})}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var r;
vendor: 11,390 bytes, line 100
100this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!t.type||t.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});const i=((r=this.overrides)==null?void 0:r.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?(this.unblockAudio(),i?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(a?.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(E.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(E.BUFFERED_TO_END,void 0))):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===F.BUFFER_APPEND_ERROR&&t.frag){var r;const i=(r=t.errorAction)==null?void 0:r.nextAutoLevel;X(i)&&i!==t.frag.level&&this.resetAppendErrors()}}getBackBufferEvictionTarget(e,t,r){const{media:i}=this;return i?this.fragmentTracker.getBackBufferEvictionEnd(i.currentTime,r,t):0}getFragmentAppendProgress(e){var t;const r=U_(e);let i=this.fragmentAppendProgress[r];return((t=i)==null?void 0:t.stats)!==e.stats&&(i={stats:e.stats,progressed:!1,errored:!1,fullyBuffered:Object.create(null)},this.fragmentAppendProgress[r]=i),i}checkAppendProgress(e,t,r,i){if(t||!at(e)||e.gap||r.iframe||r.partial)return;const s=U_(e),a=this.fragmentAppendProgress[s];delete this.fragmentAppendProgress[s];const o=e.stats.buffering;if(o.start&&!o.first)return;const l=a?.stats===e.stats?a:void 0;if(l!=null&&l.errored)return;const u=i.length>0&&i.every(h=>l?.fullyBuffered[h]===!0);if(l!=null&&l.progressed||u){delete this.appendsWithoutProgress[s];return}if(!l&&i.length===0)return;const c=(this.appendsWithoutProgress[s]||0)+1,d=this.hls;c>=d.config.appendErrorMaxRetry?delete this.appendsWithoutProgress[s]:this.appendsWithoutProgress[s]=c,this.warn(`Fragment ${e.sn} of ${e.type} playlist ${e.level} appended ${c} time${c>1?"s":""} without buffered range growth`),d.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.BUFFER_APPEND_NO_PROGRESS,fatal:!1,frag:e,chunkMeta:r,parent:e.type,appendsWithoutProgress:c,error:new Error(`Fragment append did not increase buffered coverage (${c})`)})}resetAppendProgress(){this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null)}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0}trimBuffers(e,t,r,i){const{hls:s,details:a,media:o}=this;if(!o||a===null||!this.sourceBufferCount)return;const l=s.config,u=o.currentTime,c=a.levelTargetDuration;t=a.live&&l.liveBackBufferLength!==null?l.liveBackBufferLength:t;let d=-1/0;if(X(t)&&t>=0){const f=Math.max(t,c);d=Math.floor(u/c)*c-f}if(r){const f=this.getLoopBackBufferFlushEnd(r,i??null);f>0&&(d=Math.max(d,f))}if(d>0&&this.flushBackBuffer(u,c,d),X(e)&&e>0){const f=Math.max(l.maxBufferLength,e),h=Math.max(f,c),p=Math.floor(u/c)*c+h;this.flushFrontBuffer(u,c,p)}}getLoopBackBufferFlushEnd(e,t){var r;const{media:i}=this;if(((r=this.hls)==null?void 0:r.config.loopBackBufferFlush)===!1||!(i!=null&&i.loop)||!t||e.level<=t.level)return 0;const{video:s,audiovideo:a}=e.elementaryStreams;if(s!=null&&s.partial||a!=null&&a.partial)return 0;const o=this.getEarliestElementaryStreamStart(e)-q7;return o<=0?0:(this.log(`Flushing lower quality back buffer for loop: level ${e.level}, range [0-${o.toFixed(3)}]`),o)}getEarliestElementaryStreamStart(e){const{audio:t,video:r,audiovideo:i}=e.elementaryStreams;let s=e.start;return i?s=Math.min(s,i.startDTS):(t&&(s=Math.min(s,t.startDTS)),r&&(s=Math.min(s,r.startDTS))),s}flushBackBuffer(e,t,r){this.sourceBuffers.forEach(([i,s])=>{if(s){const u=le.getBuffered(s);if(u.length>0&&r>u.start(0)){var a,o,l;this.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:r});const c=this.tracks[i];if((a=this.details)!=null&&a.live)this.hls.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(c!=null&&c.ended&&!((o=this.media)!=null&&o.loop&&((l=this.hls)==null?void 0:l.config.loopBackBufferFlush)!==!1)){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:i})}}})}flushFrontBuffer(e,t,r){this.sourceBuffers.forEach(([i,s])=>{if(s){const a=le.getBuffered(s),o=a.length;if(o<2)return;const l=a.start(o-1),u=a.end(o-1);if(r>l||e>=l&&e<=u)return;this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:i})}})}getDurationAndRange(){var e;const{details:t,mediaSource:r}=this;if(!t||!this.media||r?.readyState!=="open")return null;const i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&r.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),c=Math.max(u,i);return{duration:1/0,start:u,end:c}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return X(s)?{duration:s}:null;const a=this.media.duration,o=X(r.duration)?r.duration:0;return i>o&&i>a||!X(a)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:r}){const i=this.mediaSource;!i||!this.media||i.readyState!=="open"||(i.duration!==e&&(X(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),t!==void 0&&r!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${r}.`),i.setLiveSeekableRange(t,r)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:r}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${We(r)}`),this.tracksReady){var i;const s=(i=this.transferData)==null?void 0:i.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,r])=>{if(t){const i=this.tracks[t];e[t]={buffer:r,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(E.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:r}=this;if(!r)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const a=s,o=e[a];if(this.isPending(o)){const l=this.getTrackCodec(o,a),u=`${o.container};codecs=${l}`;o.codec=l,this.log(`creating sourceBuffer(${u})${this.currentOp(a)?" Queued":""} ${We(o)}`);try{const c=r.addSourceBuffer(u),d=gm(a),f=[a,c];t[d]=f,o.buffer=c}catch(c){var i;this.error(`error while trying to add sourceBuffer: ${c.message}`),this.shiftAndExecuteNext(a),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[a],this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,sourceBufferName:a,mimeType:u,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}clearBufferAppendTimeoutId(e){e&&(self.clearTimeout(e.bufferAppendTimeoutId),e.bufferAppendTimeoutId=void 0)}getTrackCodec(e,t){const r=e.supplemental;let i=e.codec;r&&(t==="video"||t==="audiovideo")&&hu(r,"video")&&(i=VH(i,r));const s=_d(i,e.levelCodec);return s?t.slice(0,5)==="audio"?If(s,this.appendSource):s:""}trackSourceBuffer(e,t){const r=t.buffer;if(!r)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:r,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,a)=>{const o=a.removedRanges;o!=null&&o.length&&(this.log(`${s} buffer removed ${Df(o)}`),this.hls.trigger(E.BUFFER_FLUSHED,{type:s,start:o.start(0),end:o.end(o.length-1)}))})}get mediaSrc(){var e,t;const r=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return r?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t,r;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);if(!i)return;if(i.onComplete(),(r=this.tracks[e])==null||(r=r.buffer)==null?void 0:r.updating){this.log(`${e} SourceBuffer updating on "updateend"`),this.blockUntilOpen(()=>{this.shiftAndExecuteNext(e)});return}this.shiftAndExecuteNext(e)}onSBUpdateError(e,t){var r;const i=(r=this.mediaSource)==null?void 0:r.readyState,s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${i}`);this.error(`${s.message}`,t),this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const a=this.currentOp(e);a&&a.onError(s)}updateTimestampOffset(e,t,r,i,s,a){const o=t-e.timestampOffset;Math.abs(o)>=r&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${s} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,r){const{media:i,mediaSource:s}=this,a=this.tracks[e],o=a?.buffer;if(!i||!s||!o)throw new Error(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`);const l=X(i.duration)?i.duration:1/0,u=X(s.duration)?s.duration:1/0,c=Math.max(0,t);if(c>=u){var d;(d=this.currentOp(e))==null||d.onComplete(),this.shiftAndExecuteNext(e);return}const f=Math.min(r,l,u);if(f>c&&(!a.ending||a.ended))a.ended=!1,this.log(`Removing [${c},${f}] from the ${e} SourceBuffer`),o.remove(c,f);else throw new Error(`Cannot remove ${f<=c?`invalid range (${c} >= ${f}) `:""}from the ${e} SourceBuffer${a.ending?" while track ending":""}`)}appendExecutor(e,t){const r=this.tracks[t],i=r?.buffer;if(!i)throw new X7(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);if(r.ending=!1,r.ended=!1,this.hls.config.appendTimeout!==1/0){const s=this.calculateAppendTimeoutTime(i);r.bufferAppendTimeoutId=self.setTimeout(()=>this.appendTimeoutHandler(t,i,s),s)}i.appendBuffer(e)}appendTimeoutHandler(e,t,r){this.log(`Received timeout after ${r}ms for append on ${e} source buffer. Aborting and triggering error.`);try{t.abort()}catch{this.log(`Failed to abort append on ${e} source buffer after timeout.`)}const i=this.currentOp(e);i&&i.onError(new Error(`${e}-append-timeout`))}calculateAppendTimeoutTime(e){let t=rC;this.details&&(t=this.details.levelTargetDuration);let r=2*t*1e3;if(this.media===null)return r;const i=le.bufferInfo(e,this.media.currentTime,0);return i.len?(r=Math.max(i.len*1e3,r),Math.max(this.hls.config.appendTimeout,r)):r}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}
100`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}isAudioBlocked(){var e;return((e=this.currentOp("audio"))==null?void 0:e.label)==="block-audio"}isAudioBlocking(){return this.operationQueue?this.operationQueue.audioBlocking():!1}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:r}=this,s=t.length===2&&this.isAudioBlocking()?[this.appendBlocker("video")]:t.map(a=>this.appendBlocker(a));return Promise.all(s).then(a=>{r===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var r;const i=(r=this.tracks[t])==null?void 0:r.buffer;!i||i.updating||t==="audio"&&this.isAudioBlocked()||this.shiftAndExecuteNext(t)})}append(e,t,r){this.operationQueue&&this.operationQueue.append(e,t,r)}insertNext(e,t){this.operationQueue&&this.operationQueue.insertNext(e,t)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,r){const i=this.tracks[e];if(!i)return;const s=i.buffer;if(!s)return;const a=r.bind(this,e);i.listeners.push({event:t,listener:a}),Me(s,t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const r=t.buffer;r&&(t.listeners.forEach(i=>{Oe(r,i.event,i.listener)}),t.listeners.length=0)}}function F_(n){const e=n.querySelectorAll("source");[].slice.call(e).forEach(t=>{n.removeChild(t)})}function J7(n,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,n.appendChild(t)}function gm(n){return n==="audio"?1:0}function N_(n,e){return`${n?"":" - triggering recovery"}${e?" with HTMLMediaElement Error: "+e.message:""}`}function U_(n){return`${n.type}_${n.sn}_${n.level}`}function ym(n,e){const{start:t,end:r}=e;let i=0;for(let s=0;s<n.length;s++){const a=n[s];if(a.start>=r)break;const o=Math.max(t,a.start),l=Math.min(r,a.end);l>o&&(i+=l-o)}return i}function B_(n,e){return e.duration-n<=.05}class oS{constructor(e){this.hls=null,this.autoLevelCapping=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.observer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.media=null,this.restrictedLevels=[],this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),(this.timer||this.observer)&&this.stopCapping(),this.media=this.clientRect=this.hls=null,this.streamController=void 0}registerListeners(){const{hls:e}=this;e&&(e.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this))}unregisterListener(){const{hls:e}=this;e&&(e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this))}onFpsDropLevelCapping(e,t){if(!this.hls)return;const r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(e,t){const r=t.media;this.clientRect=null,this.hls&&(r instanceof HTMLVideoElement?(this.media=r,this.hls.config.capLevelToPlayerSize&&this.observe()):this.media=null,(this.timer||this.observer)&&this.hls.levels.length>1&&this.detectPlayerSize())}onManifestParsed(e,t){this.restrictedLevels=[],t.video&&this.startCapping(),this.onLevelsUpdated()}onLevelsUpdated(){if(this.hls){if((this.timer||this.observer)&&(X(this.autoLevelCapping)||this.clientRect))this.detectPlayerSize();else if(this.observer===void 0&&this.timer===void 0){const e=this.hls.levels;e.length>1&&e.some(t=>!!t.videoCodec)&&this.startCapping()}}}onBufferCodecs(e,t){t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0||!this.hls){this.clientRect=null;return}const e=this.hls.levels;if(e.length>1){const t=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${r}: ${e[r].height}p@${e[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=r,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}else e.length===1&&this.stopCapping()}}getMaxLevel(e){if(!this.hls)return-1;const t=this.hls.levels;if(!t.length)return-1;const r=t.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.observer||(this.clientRect=null),oS.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}observe(){const e=self.ResizeObserver;e&&(this.observer=new e(t=>{var r;const i=(r=t[0])==null?void 0:r.contentRect;i&&(this.clientRect=i,this.detectPlayerSize())})),this.observer&&this.media&&this.observer.observe(this.media)}startCapping(){var e;this.timer||this.observer||!((e=this.hls)!=null&&e.config.capLevelToPlayerSize)||(self.clearInterval(this.timer),this.timer=void 0,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.observe(),this.observer||(this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3)),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0),this.observer&&(this.observer.disconnect(),this.observer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,!t.width&&!t.height&&(t.width=r.right-r.left||e.
vendor: 4,221 bytes, line 100
100width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls)return e;const{ignoreDevicePixelRatio:t,maxDevicePixelRatio:r}=this.hls.config;if(!t)try{e=self.devicePixelRatio}catch{}return Math.min(e,r)}isLevelAllowed(e){return!this.restrictedLevels.some(r=>e.bitrate===r.bitrate&&e.width===r.width&&e.height===r.height)}static getMaxLevelByMediaSize(e,t,r){if(!(e!=null&&e.length))return-1;const i=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let s=e.length-1;const a=Math.max(t,r);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&i(l,e[o+1])){s=o;break}}return s}}var mn=class A0{constructor(e,t){Array.isArray(e)&&(e=e.map(r=>r instanceof A0?r:new A0(r))),this.value=e,this.params=t}};const Z7="Dict";function eW(n){return Array.isArray(n)?JSON.stringify(n):n instanceof Map?"Map{}":n instanceof Set?"Set{}":typeof n=="object"?JSON.stringify(n):String(n)}function tW(n,e,t,r){return new Error(`failed to ${n} "${eW(e)}" as ${t}`,{cause:r})}const $_="Bare Item",nW="Boolean",rW="Byte Sequence",iW="Decimal",sW="Integer";function aW(n){return n<-999999999999999||999999999999999<n}const oW="String",lW=/[\x00-\x1f\x7f]+/;var NC=class{constructor(n){this.description=n}};const uW="Token",cW="Key";function jr(n,e,t){return tW("serialize",n,e,t)}function dW(n){if(typeof n!="boolean")throw jr(n,nW);return n?"?1":"?0"}function fW(n){if(ArrayBuffer.isView(n)===!1)throw jr(n,rW);return`:${eH(n)}:`}function UC(n){if(aW(n))throw jr(n,sW);return n.toString()}function hW(n){return`@${UC(n.getTime()/1e3)}`}function pW(n){const e=IL(n,3);if(Math.floor(Math.abs(e)).toString().length>12)throw jr(n,iW);const t=e.toString();return t.includes(".")?t:`${t}.0`}function mW(n){if(lW.test(n))throw jr(n,oW);return`"${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function gW(n){return n.description||n.toString().slice(7,-1)}function G_(n){const e=gW(n);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw jr(e,uW);return e}function L0(n){switch(typeof n){case"number":if(!X(n))throw jr(n,$_);return Number.isInteger(n)?UC(n):pW(n);case"string":return mW(n);case"symbol":return G_(n);case"boolean":return dW(n);case"object":if(n instanceof Date)return hW(n);if(n instanceof Uint8Array)return fW(n);if(n instanceof NC)return G_(n);default:throw jr(n,$_)}}function C0(n){if(/^[a-z*][a-z0-9\-_.*]*$/.test(n)===!1)throw jr(n,cW);return n}function lS(n){return n==null?"":Object.entries(n).map(([e,t])=>t===!0?`;${C0(e)}`:`;${C0(e)}=${L0(t)}`).join("")}function BC(n){return n instanceof mn?`${L0(n.value)}${lS(n.params)}`:L0(n)}function yW(n){return`(${n.value.map(BC).join(" ")})${lS(n.params)}`}function vW(n,e={whitespace:!0}){if(typeof n!="object"||n==null)throw jr(n,Z7);const t=n instanceof Map?n.entries():Object.entries(n),r=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof mn||(s=new mn(s));let a=C0(i);return s.value===!0?a+=lS(s.params):(a+="=",Array.isArray(s.value)?a+=yW(s):a+=BC(s)),a}).join(`,${r}`)}function $C(n,e){return vW(n,e)}const SW=["url"],EW=["version","eventTargets","sid","transmissionMode"],xW=["customData","headers"],j_=n=>n instanceof mn?new mn(Math.round(n.value),n.params):Math.round(n),vm=n=>Array.isArray(n)?n.map(j_):j_(n),k0=(n,e)=>Array.isArray(n)?n.map(t=>k0(t,e)):n instanceof mn&&typeof n.value=="string"?new mn(k0(n.value,e),n.params):(e.baseUrl&&(n=iH(n,rH(e.baseUrl))),e.version===1?encodeURIComponent(n):n),H_=n=>n instanceof mn?new mn(Math.round(n.value/100)*100,n.params):Math.round(n/100)*100,Mc=n=>Array.isArray(n)?n.map(H_):H_(n),TW=(n,e)=>{let t=n;return e.version>=2&&(n instanceof mn&&typeof n.value=="string"?t=new mn([n]):typeof n=="string"&&(t=[n])),k0(t,e)},_W={br:vm,d:vm,bl:Mc,dl:Mc,mtp:Mc,nor:TW,rtp:Mc,tb:vm},Eu=2,GC="bc",bW="ps",jC="pr",IW="e",V_="t",wW="c",HC="b",uS="rr",VC="ce",Fc={BITRATE_CHANGE:GC,ERROR:IW,RESPONSE_RECEIVED:uS,CUSTOM_EVENT:VC},WC=new Map([[bW,"sta"],[jC,"pr"],[wW,"cid"],[HC,"bg"],[GC,"br"]]),cS="event",dS="request",zC=["cen","e","h","ts"],KC=["ab","bg","bl","br","bs","b
100sa","bsd","bsda","cdn","cid","cs","d","dfa","dl","ec","lab","lb","ltc","msd","mtp","nor","nr","ot","pb","pr","pt","rtp","sf","sid","sn","st","sta","su","tab","tb","tbl","tpb","v"],RW=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function fS(n){return RW.test(n)}const AW=new Set(KC);function qC(n){return AW.has(n)||fS(n)}const YC=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"],LW=new Set(YC);function XC(n){return LW.has(n)}const CW=new Set(zC);function kW(n){return qC(n)||XC(n)||CW.has(n)}const DW=new Set(["ab","bl","br","bsa","bsd","bsda","lab","lb","mtp","pb","tab","tb","tbl","tpb"]),Hh=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"],PW=new Set(Hh);function OW(n){return PW.has(n)||fS(n)}const MW=new Set(["ot","sf","st","e","sta"]);function FW(n){return MW.has(n)}function NW(n){return typeof n=="number"?X(n):n!=null&&n!==""&&n!==!1}const UW={[cS]:kW,[dS]:qC};function QC(n,e){if(Array.isArray(n)){let t;return e&&(t=n.find(r=>{var i;return((i=r.params)==null?void 0:i.ot)===e})),t||(t=n[0]),QC(t)}return n instanceof mn?n.value:n}function BW(n){const e={};for(const[r,i]of Object.entries(n)){if(i==null){e[r]=i;continue}if(r==="nor"){const s=(Array.isArray(i)?i:[i])[0];if(s instanceof mn){var t;e.nor=s.value,(t=s.params)!=null&&t.r&&(e.nrr=s.params.r)}else e.nor=s}else DW.has(r)?e[r]=QC(i,n.ot):e[r]=i}return e}function JC(n,e={}){const t={};if(n==null||typeof n!="object")return t;const r=e.version||n.v||Eu,i=e.reportingMode||dS,s=r===1?BW(n):n,a=r===1?OW:UW[i];let o=Object.keys(s).filter(a);s.e&&s.e!==uS&&(o=o.filter(h=>!XC(h)));const l=e.filter;typeof l=="function"&&(o=o.filter(l));const u=i===cS;if(u){const h=s.e;!o.includes("e")&&h!=null&&o.push("e"),o.includes("ts")||o.push("ts"),!o.includes("cen")&&s.cen!=null&&h===VC&&o.push("cen");const p=h?WC.get(h):void 0;p&&s[p]!=null&&!o.includes(p)&&o.push(p)}if(o.length===0)return t;r>1&&!o.includes("v")&&o.push("v");const c={version:r,reportingMode:i,baseUrl:e.baseUrl};o.sort();for(const h of o){var d,f;let p=s[h];const m=(d=(f=e.formatters)==null?void 0:f[h])!=null?d:_W[h];if(typeof m=="function"&&(p=m(p,c)),h==="v"){if(r===1)continue;p=r}if(h==="pr"&&p===1&&!(u&&s.e===jC))continue;u&&h==="ts"&&!X(p)&&(p=Date.now());const g=u&&p===!1&&h==="bg"&&s.e===HC;!NW(p)&&!g||(FW(h)&&typeof p=="string"&&(p=new NC(p)),t[h]=p)}return t}const qr="CMCD-Object",an="CMCD-Request",fa="CMCD-Session",Jn="CMCD-Status",$W={REQUEST:an},GW={ab:qr,br:qr,d:qr,lab:qr,lb:qr,ot:qr,tab:qr,tb:qr,tpb:qr,bl:an,cs:an,dfa:an,dl:an,ltc:an,mtp:an,nor:an,nrr:an,pb:an,sn:an,sta:an,su:an,tbl:an,cid:fa,msd:fa,sf:fa,sid:fa,st:fa,v:fa,bg:Jn,bs:Jn,bsa:Jn,bsd:Jn,bsda:Jn,cdn:Jn,ec:Jn,nr:Jn,pr:Jn,pt:Jn,rtp:Jn};function jW(n){return Object.keys(n).reduce((e,t)=>{var r;return(r=n[t])==null||r.forEach(i=>e[i]=t),e},{})}function HW(n,e){const t={};if(!n)return t;const r=Object.keys(n),i=e?jW(e):{};for(const a of r){var s;const o=GW[a]||i[a]||$W.REQUEST,l=(s=t[o])!=null?s:t[o]={};l[a]=n[a]}return t}function VW(n,e){const t={},r=HW(n,e);for(const[i,s]of Object.entries(r)){const a=$C(s,{whitespace:!1});a&&(t[i]=a)}return t}const W_="CMCD";function ZC(n){return $C(n,{whitespace:!1})}function WW(n,e={}){return n?ZC(JC(n,e)):""}const zW=30,D0=[...Hh,...KC,...YC,...zC].filter((n,e,t)=>t.indexOf(n)===e),KW="application/cmcd",qW=1,Ot={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",
100KEY:"k",OTHER:"o"},Zn={STARTING:"s",PLAYING:"p",SEEKING:"k",REBUFFERING:"r",PAUSED:"a",ENDED:"e",FATAL_ERROR:"f",PRELOADING:"d"},hS="query",ek="headers";function z_(n,e,t){var r;const i=new Set((r=e.enabledKeys)!=null?r:[]);return{version:e.version||Eu,reportingMode:n,filter:s=>i.has(s),baseUrl:t}}function YW(n,e){if(n===e)return!0;if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++){const r=n[t],i=e[t];if(r===i)continue;if(typeof r=="number"||typeof i=="number"||r.value!==i.value)return!1;const s=r.params,a=i.params,o=s&&Object.keys(s)[0],l=a&&Object.keys(a)[0];if(o!==l||o!==void 0&&l!==void 0&&s&&a&&s[o]!==a[l])return!1}return!0}const XW=Object.is,QW=n=>n,tk=Array.from(WC,([n,e])=>e==="br"?{event:n,field:e,equal:(t,r)=>t===void 0||r===void 0?t===r:YW(t,r),snapshot:t=>t.slice()}:{event:n,field:e,equal:XW,snapshot:QW}),JW=new Map(tk.map(n=>[n.event,n]));function ZW(n){const{url:e}=n,t=$h(n,SW);return fetch(e,t)}function ez(n){const{version:e=Eu,eventTargets:t=[],sid:r=wL(),transmissionMode:i=hS}=n,s=$h(n,EW);return ie(ie({},s),{},{version:e,transmissionMode:i,sid:r,eventTargets:t.reduce((a,o)=>{var l,u,c;return o!=null&&o.url&&(l=o.events)!=null&&l.length&&a.push({version:o.version||Eu,enabledKeys:((u=o.enabledKeys)==null?void 0:u.slice())||[],url:o.url,events:o.events.slice(),interval:(c=o.interval)!=null?c:zW,batchSize:o.batchSize||1}),a},[])})}var tz=class{constructor(n,e=ZW){var t;this.timeOrigin=performance.timeOrigin||((t=performance.timing)==null?void 0:t.fetchStart)||Date.now()-performance.now(),this.data={},this.msd=NaN,this.eventTargets=new Map,this.lastEmitted={},this.requestTarget={sn:0,msdSent:!1},this.config=ez(n),this.data={cid:this.config.cid,sid:this.config.sid,v:this.config.version},this.requester=e;for(const r of this.config.eventTargets)this.eventTargets.set(r,{intervalId:void 0,sn:0,msdSent:!1,queue:[]})}start(){this.eventTargets.forEach((n,e)=>{if(this.disarmInterval(n),e.interval===0||!e.events.includes(V_))return;const t=()=>{this.recordTargetEvent(n,e,V_),this.processEventTargets()};n.intervalId=setInterval(t,e.interval*1e3),t()})}stop(n=!1){n&&this.flush(),this.eventTargets.forEach(e=>{this.disarmInterval(e)})}flush(){this.processEventTargets(!0)}update(n){n.sid&&n.sid!==this.data.sid&&this.resetSession(),n.msd&&!isNaN(n.msd)&&(this.msd=n.msd),this.data=ie(ie(ie({},this.data),n),{},{msd:void 0});for(const e of tk)e.field in n&&!e.equal(this.data[e.field],this.lastEmitted[e.field])&&this.recordEvent(e.event)}recordEvent(n,e={}){const t=JW.get(n);if(t){const r=t.field,i=e[r];i!==void 0&&Ne(this.data,{[r]:i});const s=this.data[r];if(s===void 0||t.equal(s,this.lastEmitted[r]))return;Ne(this.lastEmitted,{[r]:t.snapshot(s)})}this.eventTargets.forEach((r,i)=>{this.recordTargetEvent(r,i,n,e)}),this.processEventTargets()}recordTargetEvent(n,e,t,r={}){var i;if(!e.events.includes(t))return;const s=ie(ie(ie({},this.data),r),{},{e:t,ts:(i=r.ts)!=null?i:Date.now(),sn:n.sn++});!isNaN(this.msd)&&!n.msdSent&&(s.msd=this.msd,n.msdSent=!0),n.queue.push(s)}recordResponseReceived(n,e={}){var t,r,i;const{request:s}=n,a=(t=e.url)!=null?t:s?.url;if(!a)return;const o=new URL(a);o.searchParams.delete(W_);const l={url:o.toString(),rc:n.status},u=n.resourceTiming;u&&(u.startTime!=null&&(l.ts=Math.round(this.timeOrigin+u.startTime),u.responseStart!=null&&(l.ttfb=Math.round(u.responseStart-u.startTime))),u.duration!=null&&(l.ttlb=Math.round(u.duration)));const c=(r=(i=s.customData)==null?void 0:i.cmcd)!=null?r:{};this.recordEvent(uS,ie(ie(ie({},c),l),e))}applyRequestReport(n){var e;return(e=this.createRequestReport(n))!=null?e:n}isRequestReportingEnabled(){var n;return!!((n=this.config.enabledKeys)!=null&&n.length)}createRequestReport(n,e){var t;const{customData:r={},headers:i={}}=n,s=$h(n,xW),a=ie(ie({},s),{},{headers:ie({},i),customData:ie(ie({},r),{},{cmcd:{}})});if(!((t=this.config.enabledKeys)!=null&&t.length)||!a.url)return a;const o=new URL(a.url),l=ie(ie(ie({},this.data),e),{},{sn:this.requestTarget.sn++}),u=z_(dS,this.config,a.url);!isNaN(this.msd)&&!this.requestTarget.msdSent&&(l.msd=this.msd,this.requestTarget.msdSent=!0);const c=a.customData.cmcd=JC(l,u);switch(this.config.transmissionMode){case hS:const d=ZC(c);d&&(o.searchParams.set(W_,d),a.url=o.toString());break;
100case ek:Ne(a.headers,VW(c,u.customHeaderMap));break}return a}processEventTargets(n=!1){let e=!1;this.eventTargets.forEach((t,r)=>{const{queue:i}=t;if(!i.length||i.length<r.batchSize&&!n)return;const s=n?i.length:r.batchSize,a=i.splice(0,s);this.sendEventReport(r,a).catch(()=>{t.queue.unshift(...a)}),e||(e=i.length>0)}),e&&this.processEventTargets()}async sendEventReport(n,e){const t=z_(cS,n),{status:r}=await this.requester({url:n.url,method:"POST",headers:{"Content-Type":KW},body:e.map(i=>WW(i,t)).join(` 101`)+` 102`});if(r===410)this.disposeEventTarget(n);else if(r===429||r>499&&r<600)throw new Error(`Event report failed with status ${r}`)}disarmInterval(n){clearInterval(n.intervalId),n.intervalId=void 0}disposeEventTarget(n){const e=this.eventTargets.get(n);e&&(this.disarmInterval(e),this.eventTargets.delete(n))}resetSession(){this.eventTargets.forEach(n=>n.sn=0),this.requestTarget.sn=0,this.lastEmitted={}}};const nz={HLS:"h"},Sm={VOD:"v",LIVE:"l",LOW_LATENCY:"ll"};function rz(n,e){return new mn(n,e)}new Set(Hh);new Set(D0);const iz=["includeKeys"];function K_(n){return Object.keys(n).every(fS)}class sz{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.playerState=void 0,this.reporter=void 0,this.playheadLevel=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0,this.setPlayerState(Zn.REBUFFERING)),this.buffering=!0},this.onPlay=()=>{this.initialized||this.setPlayerState(Zn.STARTING)},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1,this.setPlayerState(Zn.PLAYING)},this.onPause=()=>{this.media&&!this.media.ended&&this.setPlayerState(Zn.PAUSED)},this.onSeeking=()=>{this.initialized&&this.setPlayerState(Zn.SEEKING)},this.onSeeked=()=>{var i;this.initialized&&(i=this.media)!=null&&i.paused&&this.setPlayerState(Zn.PAUSED)},this.onRateChange=()=>{this.reporter&&this.media&&this.reporter.update({pr:this.media.playbackRate})},this.applyPlaylistData=i=>{try{this.apply(i,{ot:Ot.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const{frag:o,part:l}=i,u=this.hls.levels[o.level],c=this.getObjectType(o,u),d={d:(l||o).duration*1e3,ot:c};if(c===Ot.VIDEO||c===Ot.AUDIO||c===Ot.MUXED||c==null&&(o.type==="main"||o.type==="audio")){var s;const h=u.bitrate/1e3;d.br=[h];const{cmcd:p}=this.config,m=(s=p?.rtpSafetyFactor)!=null?s:5;if(d.rtp=Math.round(h*m/100)*100,c===Ot.MUXED||c==null&&o.type==="main"){const v=this.getTopBandwidth()/1e3;X(v)&&(d.tb=[v]);const S=this.getLowestBandwidth()/1e3;X(S)&&(d.lb=[S])}const g=this.getBufferLength(o);if(X(g)){var a;d.bl=[g];const v=((a=this.media)==null?void 0:a.playbackRate)||1;d.dl=Math.round(g/v/100)*100}this.playheadLevel&&(d.pb=[this.playheadLevel.bitrate/1e3]);const y=this.hls.maxAutoLevel;if(y>=0){const v=this.hls.levels[y];v&&(d.tpb=[v.bitrate/1e3])}}const f=l?this.getNextPart(l):this.getNextFrag(o);f!=null&&f.url&&f.url!==o.url&&(f.byteRange.length>0?d.nor=[rz(f.url,{r:`${f.byteRange[0]}-${f.byteRange[1]}`})]:d.nor=[f.url]),this.apply(i,d)}catch(o){this.hls.logger.warn("Could not generate segment CMCD data.",o)}},this.recordFragmentResponse=(i,s,a)=>{var o;const{cmcd:l}=this.config,u=l==null||(o=l.eventTargets)==null?void 0:o.some(c=>{var d;return(d=c.events)==null?void 0:d.includes(Fc.RESPONSE_RECEIVED)});if(!(!this.reporter||!(a.loading.first>0)||!u))try{this.reporter.recordResponseReceived({request:{url:i},status:s.code,resourceTiming:{startTime:a.loading.start,responseStart:a.loading.first,duration:a.loading.end-a.loading.start,encodedBodySize:a.total}})}catch(c){this.hls.logger.warn("Could not record fragment response CMCD data.",c)}},this.hls=e;const t=this.config=e.config,{cmcd:r}=t;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.registerListeners())}createReporter(){var e,t;const{cmcd:r}=this.config;if(r==null)return;const i=r.version||qW;if(this.reporter=new tz({sid:r.sessionId||this.hls.sessionId,cid:r.contentId,version:i,transmissionMode:r.useHeaders===!0?ek:hS,enabledKeys:(e=r.includeKeys)!=null?e:[...i>=Eu?D0:Hh],eventTargets:((t=r.eventTargets)!=null?t:[]).map(s=>{let{includeKeys:a}=s,o=$h(s,iz);return ie(ie({},o),{},{enabledKeys:a??D0})})},r.loader),this.reporter.update({sf:nz.HLS,sta:this.playerState}),r.reporterCallback){const s=this.reporter,a={updateCustomData:o=>{K_(o)&&s.update(o)}
102,recordCustomEvent:(o,l={})=>{K_(l)&&s.recordEvent(Fc.CUSTOM_EVENT,ie({cen:o},l))}};r.reporterCallback(a)}this.reporter.start()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.MEDIA_ENDED,this.onMediaEnded,this),e.on(E.ERROR,this.onError,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_SWITCHED,this.onLevelSwitched,this),e.on(E.BUFFER_APPENDED,this.onBufferInfoChange,this),e.on(E.BUFFER_FLUSHED,this.onBufferInfoChange,this)}unregisterListeners(){const e=this.hls;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.MEDIA_ENDED,this.onMediaEnded,this),e.off(E.ERROR,this.onError,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_SWITCHED,this.onLevelSwitched,this),e.off(E.BUFFER_APPENDED,this.onBufferInfoChange,this),e.off(E.BUFFER_FLUSHED,this.onBufferInfoChange,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.hls=this.config=null,this.onWaiting=this.onPlay=this.onPlaying=this.onPause=null,this.onSeeking=this.onSeeked=this.onRateChange=this.media=null}onMediaAttaching(e,t){const r=this.media=t.media;this.setPlayerState(this.media.autoplay?Zn.STARTING:Zn.PRELOADING),Me(r,"waiting",this.onWaiting),Me(r,"play",this.onPlay),Me(r,"playing",this.onPlaying),Me(r,"pause",this.onPause),Me(r,"seeking",this.onSeeking),Me(r,"seeked",this.onSeeked),Me(r,"ratechange",this.onRateChange)}onMediaDetached(){const e=this.media;e&&(Oe(e,"waiting",this.onWaiting),Oe(e,"play",this.onPlay),Oe(e,"playing",this.onPlaying),Oe(e,"pause",this.onPause),Oe(e,"seeking",this.onSeeking),Oe(e,"seeked",this.onSeeked),Oe(e,"ratechange",this.onRateChange),this.media=null)}onMediaEnded(e,t){this.setPlayerState(Zn.ENDED)}onManifestLoading(e,t){this.initialized=!1,this.starved=!1,this.buffering=!0,this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.createReporter(),this.media||this.setPlayerState(Zn.PRELOADING)}onError(e,t){t.fatal&&(this.setPlayerState(Zn.FATAL_ERROR),this.reporter&&this.reporter.recordEvent(Fc.ERROR,{ec:[t.details]}))}onLevelSwitching(e,t){var r;if(!this.reporter)return;const i={br:[t.bitrate/1e3]},s=(r=t.details)==null?void 0:r.fragments[0];s&&(i.ot=this.getObjectType(s,t)),this.reporter.recordEvent(Fc.BITRATE_CHANGE,i)}onLevelSwitched(e,t){const r=this.hls.levels[t.level];r&&(this.playheadLevel=r)}setPlayerState(e){this.playerState=e,this.reporter&&this.reporter.update({sta:e})}getStreamType(){const e=this.hls.latestLevelDetails;if(e)return e.live?e.partList&&e.canBlockReload?Sm.LOW_LATENCY:Sm.LIVE:Sm.VOD}apply(e,t={}){var r;if(!this.reporter)return;this.reporter.update({mtp:[this.hls.bandwidthEstimate/1e3],pr:(r=this.media)==null?void 0:r.playbackRate,st:this.getStreamType()});const i=t.ot===Ot.INIT||t.ot===Ot.VIDEO||t.ot===Ot.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const s=this.reporter.createRequestReport({url:e.url,headers:e.headers},t);e.url=s.url,e.headers=s.headers}getNextFrag(e){var t;const r=(t=this.hls.levels[e.level])==null?void 0:t.details;if(r){const i=e.sn-r.startSN;return r.fragments[i+1]}}getNextPart(e){var t;const{index:r,fragment:i}=e,s=(t=this.hls.levels[i.level])==null||(t=t.details)==null?void 0:t.partList;if(s){const{sn:a}=i;for(let o=s.length-1;o>=0;o--){const l=s[o];if(l.index===r&&l.fragment.sn===a)return s[o+1]}}}getObjectType(e,t){const{type:r}=e;if(r==="subtitle")return Ot.TIMED_TEXT;if(e.sn==="initSegment")return Ot.INIT;if(r==="audio")return Ot.AUDIO;if(r==="main"){if(e.hasStreams){const i=e.elementaryStreams;if(i.audiovideo)return Ot.MUXED;if(i.video)return Ot.VIDEO;if(i.audio)return Ot.AUDIO}if(t){const{audioCodec:i,videoCodec:s}=t;if(!this.hls.audioTracks.length){if(i&&s)return Ot.MUXED;if(i)return Ot.AUDIO}if(s)return Ot.VIDEO}}}getTopBandwidth(){let e=0;const t=this.hls,r=t.maxAutoLevel,i=r>-1?r+1:t.levels.length;
102return t.levels.slice(0,i).forEach(a=>{a.bitrate>e&&(e=a.bitrate)}),e>0?e:NaN}getLowestBandwidth(){let e=1/0;const t=this.hls,r=t.maxAutoLevel,i=r>-1?r+1:t.levels.length;return t.levels.slice(0,i).forEach(a=>{a.bitrate<e&&(e=a.bitrate)}),X(e)?e:NaN}getBufferLength(e){if(!this.media)return NaN;const t=e.type==="audio"?this.hls.audioForwardBufferInfo:this.hls.mainForwardBufferInfo;return t?t.len*1e3:NaN}getEventBufferLength(){if(!this.media)return NaN;const e=this.hls.mainForwardBufferInfo,t=this.hls.audioForwardBufferInfo;if(e&&t)return Math.min(e.len,t.len)*1e3;const r=e||t;return r?r.len*1e3:NaN}onBufferInfoChange(e,t){if(!this.reporter)return;const r=this.getEventBufferLength();X(r)&&this.reporter.update({bl:[r]})}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,r=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new r(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,a,o){t(s),this.loader.load(s,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,r=this.recordFragmentResponse,i=e||this.config.loader;return class{constructor(a){this.loader=void 0,this.loader=new i(a)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(a,o,l){t(a);const{onSuccess:u}=l;this.loader.load(a,o,ie(ie({},l),{},{onSuccess:(c,d,f,h)=>{u(c,d,f,h),r(a.url,c,d)}}))}}}}const az=3e5;class oz extends Cn{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(r=>r!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:r}=t;r!==null&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:r}=t;if(r?.action===Ft.SendAlternateToPenaltyBox&&r.flags&At.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:u}=t.context;o&&i?a=this.getPathwayForGroupId(o,u,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!s&&i&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),r.resolved=this.pathwayId!==a,!r.resolved&&(t.details!==F.BUFFER_APPEND_ERROR||t.fatal)&&this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${i&&i.length} priorities: ${We(s)} penalized: ${We(this.penalizedPathways)}`))}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const r=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),t=this.getLevelsForPathway(r),this.pathwayId=r}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const r=this.penalizedPathways,i=performance.now();Object.keys(r).forEach(s=>{i-r[s]>az&&delete r[s]});for(let s=0;s<e.length;s++){const a=e[s];if(a in r)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,pC(t),this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];l&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,r){const i=this.getLevelsForPathway(r).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(t===ve.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===ve.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return r}clonePathways(e){const t=this.levels;if(!t)return;const r={},i={};e.forEach(s=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=s;if(t.some(c=>
vendor: 4,295 bytes, line 102
102c.pathwayId===a))return;const u=this.getLevelsForPathway(o).map(c=>{const d=new nt(c.attrs);d["PATHWAY-ID"]=a;const f=d.AUDIO&&`${d.AUDIO}_clone_${a}`,h=d.SUBTITLES&&`${d.SUBTITLES}_clone_${a}`;f&&(r[d.AUDIO]=f,d.AUDIO=f),h&&(i[d.SUBTITLES]=h,d.SUBTITLES=h);const p=nk(c.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),m=new mu({attrs:d,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:p,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let g=1;g<c.audioGroups.length;g++)m.addGroupId("audio",`${c.audioGroups[g]}_clone_${a}`);if(c.subtitleGroups)for(let g=1;g<c.subtitleGroups.length;g++)m.addGroupId("text",`${c.subtitleGroups[g]}_clone_${a}`);return m});t.push(...u),q_(this.audioTracks,r,l,a),q_(this.subtitleTracks,i,l,a)})}loadSteeringManifest(e){const t=this.hls.config,r=t.loader;this.loader&&this.loader.destroy(),this.loader=new r(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;Xi(i,"_HLS_pathway",this.pathwayId),Xi(i,"_HLS_throughput",""+c)}const s={type:ve.STEERING_MANIFEST,responseType:"json",url:i.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(c,d,f,h)=>{this.log(`Loaded steering manifest: "${i}"`);const p=c.data;if(p?.VERSION!==1){this.log(`Steering VERSION ${p.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=p.TTL;const{"RELOAD-URI":m,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":y}=p;if(m)try{this.uri=new self.URL(m,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${m}`);return}this.scheduleRefresh(this.uri||f.url),g&&this.clonePathways(g);const v={steeringManifest:p,url:i.toString()};this.hls.trigger(E.STEERING_MANIFEST_LOADED,v),y&&this.updatePathwayPriority(y)},onError:(c,d,f,h)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${d.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let p=this.timeToLoad*1e3;if(c.code===429){const m=this.loader;if(typeof m?.getResponseHeader=="function"){const g=m.getResponseHeader("Retry-After");g&&(p=parseFloat(g)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,p)},onTimeout:(c,d,f)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,l,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var r;const i=(r=this.hls)==null?void 0:r.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function q_(n,e,t,r){n&&Object.keys(e).forEach(i=>{const s=n.filter(a=>a.groupId===i).map(a=>{const o=Ne({},a);return o.details=void 0,o.attrs=new nt(o.attrs),o.url=o.attrs.URI=nk(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[i],o.attrs["PATHWAY-ID"]=r,o});n.push(...s)})}function nk(n,e,t,r){if(e){const{[t]:o}=r;if(o){const l=o[e];if(l)return l}}const{HOST:i,PARAMS:s}=r,a=new self.URL(n);return i&&(a.hostname=i),s&&Object.keys(s).sort().forEach(o=>{o&&Xi(a,o,s[o])}),a.href}class lz{constructor(){this.status="initialized",this.requestErrors=[],this.licenseXhr=void 0,this.onmessage=void 0,this.onkeystatuseschange=void 0,this.emitter=new tS,this.error=void 0,this.ok=void 0}get errored(){return this.error}set errored(e){this.error=e,this.emitter.eventNames().length&&this.emitter.emit("error",e)}get hasListeners(){return this.emitter.eventNames().length>0}get resolved(){return this.ok}resolve(){this.ok=!0,this.emitter.emit("resolved")}get useable(){return this.ok?Promise.resolve():this.error?Promise.reject(this.error):new Promise((e,t)=>{this.emitter.on("error",t),this.emitter.on("resolved",e)})}reset(){this.emitter.removeAllListeners();const e=this.licenseXhr;e&&(e.readyState!==XMLHttpRequest.DONE&&e.abort(),this.licenseXhr=void 0),this.onmessage=this.onkeystatuseschange=void 0}}
102class nr extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}class za extends Cn{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this.sessionSetupByUri={},this.mediaKeySessions=[],this.activeKeys={},this.mediaKeys=null,this.setMediaKeysQueue=za.CDMCleanupPromise?[za.CDMCleanupPromise]:[],this.onMediaEncrypted=t=>{const{initDataType:r,initData:i}=t,s=`"${t.type}" event: init data type: "${r}"`;if(this.log(s),i!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=Ho(this.config));const o=a.map(cm).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{let o;const l=Dc(a),u=this.activeLevelKeys();if(l===Ze.FAIRPLAY&&r==="sinf")try{const p=gr(new Uint8Array(i)),m=zv(JSON.parse(p).sinf),g=NL(m);if(!g)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=new Uint8Array(g.subarray(8,24))}catch(p){this.warn(`${s} Failed to parse sinf: ${p}`);return}else if(l===Ze.PLAYREADY)o=Zv(new Uint8Array(i));else if(l===Ze.WIDEVINE){const p=GL(i).filter(m=>m.systemId===aC.WIDEVINE);if(p.length){var c;const m=p[0];o=(c=m.kids)!=null&&c.length?m.kids[0]:null}}let d;if(o){const p=St(o);for(let m=0;m<u.length;m++){const g=u[m];if(g.keyId&&(Lf(o,g.keyId)||g.uri.replace(/-/g,"").indexOf(p)!==-1)){g.pssh||(g.scheme=r,g.pssh=new Uint8Array(i),g.keyId=o,oi.setKeyIdForUri(g.uri,o)),d=this.getSessionForKey(g,"encrypted-event-key-match");break}}}if(!d){if(u.length){var f,h;return(f=u[0]).scheme||(f.scheme=r),(h=u[0]).pssh||(h.pssh=new Uint8Array(i)),this.getSessionForKey(u[0],"encrypted-event-no-match")}if(o)throw new Error(`Key ID ${St(o)} not encountered in playlist`);this.log(`Ignoring "${t.type}" event - could not determine keyId`)}return d}).catch(a=>this.handleError(a))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.DESTROYING,this.onDestroying,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.DESTROYING,this.onDestroying,this))}attemptKeySystemAccess(e){if(!this.hls)return Promise.reject(new Error("destroyed"));const t=this.hls.levels,r=(a,o,l)=>!!a&&l.indexOf(a)===o,i=t.map(a=>a.audioCodec).filter(r),s=t.map(a=>a.videoCodec).filter(r);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((a,o)=>{const l=u=>{const c=u.shift();this.getMediaKeysPromise(c,i,s).then(d=>a({keySystem:c,mediaKeys:d})).catch(d=>{u.length?l(u):d instanceof nr?o(d):o(new nr({type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:r}=this.config;if(typeof r!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${r}`;return oC===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return r(e,t)}getMediaKeysPromise(e,t,r){var i;const s=LV(e,t,r,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(i=a)==null?void 0:i.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${We(s)}`),o=this.requestMediaKeySystemAccess(e,s);const l=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(u=>{this.log(`Failed to obtain access to key-system "${e}": ${u}`)}),o.then(u=>{this.throwIfDestroyed(),this.log(`Access for key-system "${u.keySystem}" obtained`);const c=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const d=l.mediaKeys=u.createMediaKeys().then(f=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,c.then(h=>h?this.setMediaKeysServerCertificate(f,e,h):f)));return d.catch(f=>{this.error(`Failed to create media-keys for "${e}"}: ${f}`)}),d})}return o.then(()=>a.mediaKeys)}
vendor: 60,581 bytes, lines 102-113
102getMediaKeySessionContext(e,t,r,i){const{mediaKeySessions:s}=this,a=` key-session "${e}" keyId: ${St(r.keyId||[])} keyUri: ${r.uri} for "${i}"`;for(let u=0;u<s.length;u++){const c=s[u];if(!c.initialized&&c.createdFor.levelKey.uri===r.uri)return this.log(`Reusing${a}`),c}this.log(`Creating${a}`);const o=t.createSession(),l={keySystem:e,mediaKeys:t,mediaKeysSession:o,keyRequests:{},keyStatuses:{},createdFor:{levelKey:r,reason:i},initialized:!1};return s.push(l),l}resetMediaKeys(){var e;const t=(e=this.mediaKeySessions[0])==null?void 0:e.keySystem,r=this.keySystemAccessPromises[t];r&&(this.log("reset mediaKeys"),this.mediaKeys=null,r.hasMediaKeys=!1,delete r.mediaKeys,delete this.keySystemAccessPromises[t])}updateKeySession(e,t,r){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${St(t.keyId||[])} 103 } (data length: ${r.byteLength})`),i.update(r)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>cm(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:r})=>this.attemptSetMediaKeys(t,r))}selectKeySystem(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t})=>{const r=cm(t);if(!r)throw new Error(`Unable to find format for key-system "${t}"`);return r})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=Ho(this.config),r=e.map(Dc).filter(i=>!!i&&t.indexOf(i)!==-1);return this.selectKeySystem(r)}loadClear(e,t,r){if(this.config.emeEnabled&&!this.getSelectedKeySystemFormats().length){if(t.length)for(let i=0,s=t.length;i<s;i++){const a=t[i];if(e.cc<=a.cc&&(!at(e)||!at(a)||e.sn<a.sn)||!r&&i==s-1)return this.selectKeySystemFormat(a).then(o=>{if(!this.hls)return;a.setKeyFormat(o);const l=Dc(o);if(l)return this.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const i=Ho(this.config);if(i.length)return this.getKeySystemAccess(i)}}return null}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let r=0;r<t.length;r++){const i=Em(e,t[r]);if(i)return i}}loadKey(e){const t=e.decryptdata,r=this.getKeyStatus(t);if(r==="internal-error"){const o=Y_(r,t);return o.data.frag=e,this.error(`${o.message} (${St(t.keyId||[])})`),Promise.reject(o)}const i=e.type,s=this.activeKeys,a=s[i];a&&!t.matches(a.decryptdata)&&(s.previous||(s.previous=[]),s.previous.push(a),delete s[i]),s[i]||(s[i]=e);for(let o=this.mediaKeySessions.length;o--;){const l=this.mediaKeySessions[o];if(t.keyId&&l.keyStatuses[St(t.keyId)]==="expired")return this.renewKeySession(t,l)}return this.updateUsablePromise(t,"playlist-key",e)}renewKeySession(e,t){return this.resetMediaKeys(),this.removeSession(t).then(()=>(this.throwIfDestroyed(),this.updateUsablePromise(e,"expired")))}updateUsablePromise(e,t,r){const i=this.getSessionForKey(e,t);return i.catch(s=>this.handleError(s,r)),i.then(s=>e)}getSessionForKey(e,t){const r=this.findContextForKey(e);if(r!==void 0)return Promise.resolve(r);const i=e.uri,s=this.sessionSetupByUri[i];let a;s===void 0?a=this.resolveSessionForKey(e,t):a=s.catch(()=>{}).then(()=>(this.throwIfDestroyed(),this.resolveSessionForKey(e,t))),this.sessionSetupByUri[i]=a;const o=()=>{this.sessionSetupByUri[i]===a&&delete this.sessionSetupByUri[i]};return a.then(o,o),a}findContextForKey(e){const{mediaKeySessions:t}=this;for(let r=t.length;r--;){const i=t[r];if(Em(e,i))return i}}resolveSessionForKey(e,t){return this.getKeySystemForKeyPromise(e).then(({keySystem:r,mediaKeys:i})=>{this.throwIfDestroyed();for(let s=this.mediaKeySessions.length;s--;){const a=this.mediaKeySessions[s];if(Em(e,a))return a;const o=this.getUsableKeyPromise(a,e,t);if(o)return o}return this.attemptSetMediaKeys(r,i).then(()=>(this.throwIfDestroyed(),this.getMediaKeySessionContext(r,i,e,t))).then(s=>{this.throwIfDestroyed();const a=e.scheme||"cenc",o=e.pssh?e.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(s,e,a,o,t)})})}getUsableKeyPromise(e,t,r){const i=e.keyRequests[t.uri];if(i)return this.log(`Waiting for usable key (${r} keyId: ${dz(t)} format: "${t.keyFormat}" URI: ${t.uri})`),i.useable.then(()=>e)}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof nr){t&&(e.data.frag=t);const r=e.data.decryptdata;this.error(`${e.message}${r?` (${St(r.keyId||[])})`:""}`),this.hls.trigger(E.ERROR,e.data)}else this.error(e.message),this.hls.trigger(E.ERROR,{type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=Dc(e.keyFormat),r=t?[t]:Ho(this.config);return this.attemptKeySystemAccess(r)}getKeySystemSelectionPromise(e){if(e.length||(e=Ho(this.config)),e.length===0)throw new nr({type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${We({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}activeLevelKeys(){const e=this.activeKeys,t=(e.previous||[]).map(r=>r.decryptdata);return e.audio&&t.unshift(e.audio.decryptdata),e.main&&t.unshift(e.main.decryptdata),t}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(r).then(()=>this.media?this.media.setMediaKeys(t):new Promise((s,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(s).catch(a)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),r.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>r.indexOf(s)===-1)})}filterInitData(e,t,r,i,s){var a;const o=(a=this.config.drmSystems)==null||(a=a[e.keySystem])==null?void 0:a.generateRequest;if(o)try{const u=o.call(this.hls,r,i,Ne({},e,{decryptdata:t,reason:s}),s);if(!u)throw new Error("Invalid response from configured generateRequest filter");t.scheme=u.initDataType?u.initDataType:"cenc";const c=u.initData?u.initData:null;return t.pssh=c?new Uint8Array(c):null,u}catch(u){var l;if(this.warn(u.message),(l=this.hls)!=null&&l.config.debug)throw u}return{initDataType:r,initData:i}}generateRequestWithPreferredKeySession(e,t,r,i,s){const a=this.getUsableKeyPromise(e,t,s);if(a)return a;const o=this.filterInitData(e,t,r,i,s);if(o&&(i=o.initData?o.initData:null,r=o.initDataType),i===null)return s.startsWith("encrypted-event")?Promise.reject(new Error(`missing initialization data for "${s}"`)):(this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e));const l=t.uri,u=new lz;e.keyRequests[l]=u;const c=f=>{const h=e.mediaKeysSession;if(!h){const g=new Error("invalid state");u.errored=g;return}const{messageType:p,message:m}=f;u.status=p,this.log(`"${p}" message event for session "${h.sessionId}" message size: ${m.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,t,m).catch(g=>{u.errored=g,u.hasListeners||this.handleError(g),this.removeSession(e)}):p==="license-release"?e.keySystem===Ze.FAIRPLAY&&this.updateKeySession(e,t,b0("acknowledged")).then(()=>this.removeSession(e)).catch(g=>this.handleError(g)):this.warn(`unhandled media key message type "${p}"`)};return u.onmessage=c,Me(e.mediaKeysSession,"message",c),this.generateRequest(e,t,r,i,s,!1)}generateRequest(e,t,r,i,s,a){if(a){const h=this.filterInitData(e,t,r,i,s);h&&(i=h.initData?h.initData:i,r=h.initDataType)}const o=t.uri,l=e.keyRequests[o],u=St(t.keyId||[]),c=h=>{let p;h.startsWith("usable")?l.resolve():h==="internal-error"||h==="output-restricted"||h==="output-downscaled"?p=Y_(h,t):h==="expired"?p=new Error(`key expired (keyId: ${u})`):h==="released"?p=new Error("key released"):h==="status-pending"||this.warn(`unhandled key status change "${h}" (keyId: ${u})`),p&&(l.errored=p,l.hasListeners||this.handleError(p))},d=h=>{if(!e.mediaKeysSession){const T=new Error("invalid state");l.errored=T;return}const m=e.keyStatuses=this.getKeyStatuses(e);if(!Object.keys(m).some(T=>m[T]!=="status-pending"))return;const y=this.activeLevelKeys();for(let T=0;T<y.length;T++){const w=St(y[T].keyId||[]);if(m[w]==="expired"){var v;this.log(`Expired key ${We(m)} in key-session "${(v=e.mediaKeysSession)==null?void 0:v.sessionId}"`),this.renewKeySession(t,e).catch(I=>this.handleError(I));break}}let S=m[u];if(S)c(S);else{var x;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(x=e.keyStatusTimeouts)[u]||(x[u]=self.setTimeout(()=>{var w;if(!e.mediaKeysSession)return;const I=this.getKeyStatus(t);if(I&&I!=="status-pending"){var R;return this.log(`No status for keyId ${u} in key-session "${(R=e.mediaKeysSession)==null?void 0:R.sessionId}". Using session key-status ${I} from other session.`),c(I)}this.log(`key status for ${u} in key-session "${(w=e.mediaKeysSession)==null?void 0:w.sessionId}" timed out after 1000ms`),S="internal-error",c(S)},1e3)),this.log(`No status for keyId ${u} (${We(m)}).`)}};l.onkeystatuseschange=d,Me(e.mediaKeysSession,"keystatuseschange",d);const f=l.useable;return this.log(`Generating key-session request for "${s}" keyId: ${u} URI: ${o} (init data type: ${r} length: ${i.byteLength})`),l.status="started",e.initialized=!0,e.mediaKeysSession.generateRequest(r,i).then(()=>{var h;l.status="generated",this.log(`Request generated for key-session "${(h=e.mediaKeysSession)==null?void 0:h.sessionId}" keyId: ${u} URI: ${o}`)}).catch(h=>{throw this.log(`mediaKeysSession.generateRequest failed: ${h}`),new nr({type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_NO_SESSION,error:h,decryptdata:t,fatal:!1},`Error generating key-session request: ${h}`)}).then(()=>f).catch(h=>{var p;this.log(`mediaKeysSession.generateRequest failed: ${h}`);const m=(p=h.data)==null?void 0:p.details;return(m===F.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED||m===F.KEY_SYSTEM_STATUS_INTERNAL_ERROR)&&Object.keys(e.keyStatuses).some(g=>e.keyStatuses[g]==="usable")?(this.handleError(h),e):this.removeSession(e).then(()=>{throw h})}).then(()=>e)}getKeyStatuses(e){const t={},r=e.mediaKeysSession.sessionId;return e.mediaKeysSession.keyStatuses.forEach((i,s)=>{if(typeof s=="string"&&typeof i=="object"){const l=s;s=i,i=l}const a="buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);if(e.keySystem===Ze.PLAYREADY&&a.length===16){const l=St(a);t[l]=i,iC(a)}const o=St(a);this.log(`key status change "${i}" for keyStatuses keyId: ${o} key-session "${r}"`),t[o]=i}),t}fetchServerCertificate(e){const t=this.config,r=t.loader,i=new r(t),s=cz(e,t);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={type:ve.SERVER_CERTIFICATE,responseType:"arraybuffer",url:s},u=t.certLoadPolicy.default,c={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,h,p,m)=>{a(f.data)},onError:(f,h,p,m)=>{o(new nr({type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:ie({url:l.url,data:void 0},f)},`"${e}" certificate request failed (${s}). Status: ${f.code} (${f.text})`))},onTimeout:(f,h,p)=>{o(new nr({type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(f,h,p)=>{o(new Error("aborted"))}};i.load(l,c,d)})):(this.log(`No Server Certificate in config.drmSystems["${e}"]`),Promise.resolve())}setMediaKeysServerCertificate(e,t,r){return new Promise((i,s)=>{e.setServerCertificate(r).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${r.byteLength}) on "${t}"`),i(e)}).catch(a=>{s(new nr({type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t,r){return this.requestLicense(e,t,new Uint8Array(r)).then(i=>this.updateKeySession(e,t,new Uint8Array(i)).catch(s=>{throw new nr({type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:t,error:s,fatal:!1},s.message)}))}unpackPlayReadyKeyMessage(e,t){const r=gr(new Uint16Array(t.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(r,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let c;for(let d=0,f=s.length;d<f;d++){var a,o;c=s[d];const h=(a=c.querySelector("name"))==null?void 0:a.textContent,p=(o=c.querySelector("value"))==null?void 0:o.textContent;h&&p&&e.setRequestHeader(h,p)}}const l=i.querySelector("Challenge"),u=l?.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return b0(atob(u))}setupLicenseXHR(e,t,r,i,s){const a=this.config.licenseXhrSetup;return a?Promise.resolve().then(()=>(this.throwIfDestroyed(),a.call(this.hls,e,t,ie(ie({},r),{},{decryptdata:i}),s))).catch(o=>{if(!r.mediaKeysSession)throw o;return e.open("POST",t,!0),a.call(this.hls,e,t,ie(ie({},r),{},{decryptdata:i}),s)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||s})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t,r){return new Promise((i,s)=>{const a=uz(e.keySystem,this.config);if(!a)return s(new Error(`no license server URL configured for key-system "${e.keySystem}"`));const o=e.keyRequests[t.uri];if(!o)return s(new Error("License emitter removed"));this.log(`Sending license request to URL: ${a}`);const l=this.config.keyLoadPolicy.default,u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(u.readyState===4)if(u.status===200){o.requestErrors=[];let c=u.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const d=this.config.licenseResponseCallback;if(d)try{c=d.call(this.hls,u,a,ie(ie({},e),{},{decryptdata:t}))}catch(f){this.error(f)}i(c)}else{const c=l.errorRetry,d=c?c.maxNumRetry:0;if(o.requestErrors.push({status:u.status,message:u.statusText}),o.requestErrors.length>d||u.status>=400&&u.status<500)s(new nr({type:re.KEY_SYSTEM_ERROR,details:F.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:t,fatal:!0,networkDetails:u,response:{url:a,data:void 0,code:u.status,text:u.statusText}},`License Request XHR failed (${a}). Status: ${u.status} (${u.statusText})`));else{const f=d-o.requestErrors.length;this.warn(`Retrying license request, ${f} attempts left`),this.requestLicense(e,t,r).then(i,s)}}},o.licenseXhr&&o.licenseXhr.readyState!==XMLHttpRequest.DONE&&o.licenseXhr.abort(),o.licenseXhr=u,this.setupLicenseXHR(u,a,e,t,r).then(({xhr:c,licenseChallenge:d})=>{e.keySystem==Ze.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(c,d)),c.send(d)}).catch(s)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const r=t.media;this.media=r,Me(r,"encrypted",this.onMediaEncrypted),Me(r,"waitingforkey",this.onWaitingForKey);const i=this.mediaResolved;i?i():this.mediaKeys=r.mediaKeys}onMediaDetached(){const e=this.media;e&&(Oe(e,"encrypted",this.onMediaEncrypted),Oe(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this.keyFormatPromise=null,this.keySystemAccessPromises={},this.activeKeys={},this.sessionSetupByUri={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const r=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,oi.clearKeyUriToKeyIdMap();const s=i.length;za.CDMCleanupPromise=Promise.all(i.map(a=>this.removeSession(a)).concat((r==null||(e=r.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{s&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear(),this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const r=t.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r),this.keyFormatPromise.catch(()=>{})}}removeSession(e){const{mediaKeysSession:t}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}"`),Object.keys(e.keyRequests).forEach(o=>{const l=e.keyRequests[o];l.onmessage&&t.removeEventListener("message",l.onmessage),l.onkeystatuseschange&&t.removeEventListener("keystatuseschange",l.onkeystatuseschange),l.reset(),e.keyRequests[o]=void 0}),e.mediaKeysSession=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:i}=e;i&&Object.keys(i).forEach(o=>self.clearTimeout(i[o]));const{drmSystemOptions:s}=this.config;return(kV(s)?new Promise((o,l)=>{self.setTimeout(()=>l(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(o).catch(l)}):Promise.resolve()).catch(o=>{this.log(`Could not remove session: ${o}`),this.hls&&this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${o}`)})}).then(()=>t.close()).then(()=>t.closed).catch(o=>{this.log(`Could not close session: ${o}`),this.hls&&this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${o}`)})})}return Promise.resolve()}}za.CDMCleanupPromise=void 0;function uz(n,e){const{drmSystems:t,widevineLicenseUrl:r}=e,i=t?.[n];if(i)return i.licenseUrl;if(n===Ze.WIDEVINE&&r)return r}function cz(n,e){const{drmSystems:t}=e,r=t?.[n];if(r)return r.serverCertificateUrl}function dz(n){if(n.keyFormat===Nt.FAIRPLAY)return n.uri;if(n.keyId===null)throw new Error("keyId is null");return St(n.keyId)}function Em(n,e){const t=n.keyId,r=e.mediaKeysSession;if(t&&r){const i=e.mediaKeysSession.keyStatuses;if(i.size)return i.has(t)?i.get(t):e.keyStatuses[St(t)]}}function Y_(n,e){const t=n==="output-restricted",r=t?F.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:F.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new nr({type:re.KEY_SYSTEM_ERROR,details:r,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${n}"`)}class fz{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const r=this.hls.config;if(r.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,r){const i=performance.now();if(t){if(this.lastTime){const s=i-this.lastTime,a=r-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/s,u=this.hls;if(u.trigger(E.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:r}),l>0&&a>u.config.fpsDroppedMonitoringThreshold*o){let c=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=c)&&(c=c-1,u.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:u.currentLevel}),u.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}var pS=function(){if(Cf!=null&&Cf.VTTCue)return self.VTTCue;const n=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const u=l.toLowerCase();return~o.indexOf(u)?u:!1}function r(o){return t(n,o)}function i(o){return t(e,o)}function s(o,...l){let u=1;for(;u<arguments.length;u++){const c=arguments[u];for(const d in c)o[d]=c[d]}return o}function a(o,l,u){const c=this,d={enumerable:!0};c.hasBeenReset=!1;let f="",h=!1,p=o,m=l,g=u,y=null,v="",S=!0,x="auto",T="start",w=50,I="middle",R=50,A="middle";Object.defineProperty(c,"id",s({},d,{get:function(){return f},set:function(b){f=""+b}})),Object.defineProperty(c,"pauseOnExit",s({},d,{get:function(){return h},set:function(b){h=!!b}})),Object.defineProperty(c,"startTime",s({},d,{get:function(){return p},set:function(b){if(typeof b!="number")throw new TypeError("Start time must be set to a number.");p=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",s({},d,{get:function(){return m},set:function(b){if(typeof b!="number")throw new TypeError("End time must be set to a number.");m=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",s({},d,{get:function(){return g},set:function(b){g=""+b,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",s({},d,{get:function(){return y},set:function(b){y=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",s({},d,{get:function(){return v},set:function(b){const C=r(b);if(C===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=C,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",s({},d,{get:function(){return S},set:function(b){S=!!b,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",s({},d,{get:function(){return x},set:function(b){if(typeof b!="number"&&b!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");x=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",s({},d,{get:function(){return T},set:function(b){const C=i(b);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");T=C,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",s({},d,{get:function(){return w},set:function(b){if(b<0||b>100)throw new Error("Position must be between 0 and 100.");w=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",s({},d,{get:function(){return I},set:function(b){const C=i(b);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");I=C,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",s({},d,{get:function(){return R},set:function(b){if(b<0||b>100)throw new Error("Size must be between 0 and 100.");R=b,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",s({},d,{get:function(){return A},set:function(b){const C=i(b);if(!C)throw new SyntaxError("An invalid or illegal string was specified.");A=C,this.hasBeenReset=!0}})),c.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class hz{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function rk(n){function e(r,i,s,a){return(r|0)*3600+(i|0)*60+(s|0)+parseFloat(a||0)}const t=n.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class pz{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,r){for(let i=0;i<r.length;++i)if(t===r[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const r=parseFloat(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1}}function ik(n,e,t,r){const i=r?n.split(r):[n];for(const s in i){if(typeof i[s]!="string")continue;const a=i[s].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const P0=new pS(0,0,""),Nc=P0.align==="middle"?"middle":"center";function mz(n,e,t){const r=n;function i(){const o=rk(n);if(o===null)throw new Error("Malformed timestamp: "+r);return n=n.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,l){const u=new pz;ik(o,function(f,h){let p;switch(f){case"region":for(let m=t.length-1;m>=0;m--)if(t[m].id===h){u.set(f,t[m].region);break}break;case"vertical":u.alt(f,h,["rl","lr"]);break;case"line":p=h.split(","),u.integer(f,p[0]),u.percent(f,p[0])&&u.set("snapToLines",!1),u.alt(f,p[0],["auto"]),p.length===2&&u.alt("lineAlign",p[1],["start",Nc,"end"]);break;case"position":p=h.split(","),u.percent(f,p[0]),p.length===2&&u.alt("positionAlign",p[1],["start",Nc,"end","line-left","line-right","auto"]);break;case"size":u.percent(f,h);break;case"align":u.alt(f,h,["start",Nc,"end","left","right"]);break}},/:/,/\s/),l.region=u.get("region",null),l.vertical=u.get("vertical","");let c=u.get("line","auto");c==="auto"&&P0.line===-1&&(c=-1),l.line=c,l.lineAlign=u.get("lineAlign","start"),l.snapToLines=u.get("snapToLines",!0),l.size=u.get("size",100),l.align=u.get("align",Nc);let d=u.get("position","auto");d==="auto"&&P0.position===50&&(d=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=d}function a(){n=n.replace(/^\s+/,"")}if(a(),e.startTime=i(),a(),n.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);n=n.slice(3),a(),e.endTime=i(),a(),s(n,e)}function sk(n){return n.replace(/<br(?: \/)?>/gi,` 104`)}class gz{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new hz,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function r(){let s=t.buffer,a=0;for(s=sk(s);a<s.length&&s[a]!=="\r"&&s[a]!==` 105`;)++a;const o=s.slice(0,a);return s[a]==="\r"&&++a,s[a]===` 106`&&++a,t.buffer=s.slice(a),o}function i(s){ik(s,function(a,o){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=r();const o=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:s=r(),t.state){case"HEADER":/:/.test(s)?i(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new pS(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{mz(s,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=s.indexOf("-->")!==-1;if(!s||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` 107`),t.cue.text+=s}continue;case"BADCUE":s||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` 108 109`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}function Al(n){let e=5381,t=n.length;for(;t;)e=e*33^n.charCodeAt(--t);return(e>>>0).toString()}const yz=/\r\n|\n\r|\n|\r/g,X_="Missing initPTS for VTT ",vz=function(e){let t=parseInt(e.slice(-3));const r=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!X(t)||!X(r)||!X(i)||!X(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*r,t+=60*1e3*i,t+=60*60*1e3*s,t};function mS(n,e,t){return Al(n.toString())+Al(e.toString())+Al(t)}function Sz(n,e,t,r,i,s,a){const o=new gz,l=In(new Uint8Array(n)).trim().replace(yz,` 110`).split(` 111`),u=[],c=e?D7(e.baseTime,e.timescale):0;let d="00:00.000",f=0,h=0,p=!1,m,g=!0;o.oncue=function(y){const v=t[r];let S=t.ccOffset;const x=(f-c)/9e4;if(p){if(v!=null&&v.new&&(S=t.ccOffset=v.start),x){if(!e){m=new Error(X_+"MPEGTS");return}S=x-t.presentationOffset}}else if(e)S=-e.baseTime/e.timescale;else{m=new Error(X_+"without X-TIMESTAMP-MAP");return}const T=y.endTime-y.startTime,w=vn((y.startTime+S-h)*9e4,i*9e4)/9e4;y.startTime=Math.max(w,0),y.endTime=Math.max(w+T,0);const I=y.text.trim();y.text=decodeURIComponent(encodeURIComponent(I)),y.id?r&&(y.id=`hlsjscc${r}_${y.id}`):y.id=mS(y.startTime,y.endTime,I),y.endTime>0&&u.push(y)},o.onparsingerror=function(y){m=y},o.onflush=function(){if(m){a(m);return}s(u)},l.forEach(y=>{if(g)if(y.startsWith("X-TIMESTAMP-MAP=")){g=!1,p=!0,y.slice(16).split(",").forEach(v=>{v.startsWith("LOCAL:")?d=v.slice(6):v.startsWith("MPEGTS:")&&(f=parseInt(v.slice(7)))});try{h=vz(d)/1e3}catch(v){m=v}return}else y===""&&(g=!1);o.parse(y+` 112`)}),o.flush()}const O0="stpp.ttml.im1t",ak=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,ok=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Ez={left:"start",center:"center",right:"end",start:"start",end:"end"};function Q_(n,e,t,r){const i=de(new Uint8Array(n),["mdat"]);if(i.length===0){r(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(o=>In(o)),a=k7(e.baseTime,1,e.timescale);try{s.forEach(o=>t(xz(o,a)))}catch(o){r(o)}}function xz(n,e){const i=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:1},a=Object.keys(s).reduce((d,f)=>(d[f]=i.getAttribute(`ttp:${f}`)||s[f],d),{});!i.getAttribute("ttp:tickRate")&&i.getAttribute("ttp:frameRate")&&(a.tickRate=Number(a.frameRate)*Number(a.subFrameRate));const o=i.getAttribute("xml:space")!=="preserve",l=J_(xm(i,"styling","style")),u=J_(xm(i,"layout","region")),c=xm(i,"body","[begin]");return[].map.call(c,d=>{const f=lk(d,o);if(!f||!d.hasAttribute("begin"))return null;const h=_m(d.getAttribute("begin"),a),p=_m(d.getAttribute("dur"),a);let m=_m(d.getAttribute("end"),a);if(h===null)throw Z_(d);if(m===null){if(p===null)throw Z_(d);m=h+p}const g=new pS(h-e,m-e,f);g.id=mS(g.startTime,g.endTime,g.text);const y=u[d.getAttribute("region")],v=l[d.getAttribute("style")],S=Tz(y,v,l),{textAlign:x}=S;if(x){const T=Ez[x];T&&(g.lineAlign=T),g.align=x}return Ne(g,S),g}).filter(d=>d!==null)}function xm(n,e,t){const r=n.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(t)):[]}function J_(n){return n.reduce((e,t)=>{const r=t.getAttribute("xml:id");return r&&(e[r]=t),e},{})}function lk(n,e){return[].slice.call(n.childNodes).reduce((t,r,i)=>{var s;return r.nodeName==="br"&&i?t+` 113`:(s=r.childNodes)!=null&&s.length?lk(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}function Tz(n,e,t){const r="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=n!=null&&n.hasAttribute("style")?n.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(i=t[a]),s.reduce((o,l)=>{const u=Tm(e,r,l)||Tm(n,r,l)||Tm(i,r,l);return u&&(o[l]=u),o},{})}function Tm(n,e,t){return n&&n.hasAttributeNS(e,t)?n.getAttributeNS(e,t):null}function Z_(n){return new Error(`Could not parse ttml timestamp ${n}`)}function _m(n,e){if(!n)return null;let t=rk(n);return t===null&&(ak.test(n)?t=_z(n,e):ok.test(n)&&(t=bz(n,e))),t}function _z(n,e){const t=ak.exec(n),r=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+r/e.frameRate}function bz(n,e){const t=ok.exec(n),r=Number(t[1]);switch(t[2]){case"h":return r*3600;case"m":return r*60;case"ms":return r/1e3;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}function gS(n,e,t,r="",i="disabled"){const s=n.ownerDocument.createElement("track");return s.kind=e,s.label=t,r&&(s.srclang=r),s.src="data:,WEBVTT",s.track.mode=i,n.appendChild(s),s}function Iz(n){return n.forced&&$H()?"forced":n.characteristics&&/transcribes-spoken-dialog/gi.test(n.characteristics)&&/describes-music-and-sound/gi.test(n.characteristics)?"captions":"subtitles"}function M0(n,e){const t=n.mode;if(t==="disabled"&&(n.mode="hidden"),n.cues&&!n.cues.getCueById(e.id))try{if(n.addCue(e),!n.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(r){Pe.debug(`[texttrack-utils]: ${r}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,n.addCue(i)}catch(i){Pe.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(n.mode=t)}function F0(n,e,t,r){const i=n.mode;if(i==="disabled"&&(n.mode="hidden"),n.cues&&n.cues.length>0){const s=Rz(n.cues,e,t);for(let a=0;a<s.length;a++)(!r||r(s[a]))&&n.removeCue(s[a])}i==="disabled"&&(n.mode=i)}function wz(n,e){if(e<=n[0].startTime)return 0;const t=n.length-1;if(e>n[t].endTime)return-1;let r=0,i=t,s;for(;r<=i;)if(s=Math.floor((i+r)/2),e<n[s].startTime)i=s-1;else if(e>n[s].startTime&&r<t)r=s+1;else return s;return n[r].startTime-e<e-n[i].startTime?r:i}function Rz(n,e,t){const r=[],i=wz(n,e);if(i>-1)for(let s=i,a=n.length;s<a;s++){const o=n[s];if(o.startTime>=e&&o.endTime<=t)r.push(o);else if(o.startTime>t)return r}return r}class Az extends aS{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=-1,r=!1;if(this.currentTrack){var i;const o=(i=this.currentTrack.trackNode)==null?void 0:i.track.mode;o==="showing"?(t=this.trackId,r=!0):o==="hidden"&&(t=this.trackId)}if(!r)for(let o=0;o<this.tracksInGroup.length;o++){var s;const l=(s=this.tracksInGroup[o].trackNode)==null?void 0:s.track.mode;if(l==="showing"){t=o;break}else t<0&&l==="hidden"&&(t=o)}if(t>-1){var a;this._subtitleDisplay=((a=this.tracksInGroup[t].trackNode)==null?void 0:a.track.mode)==="showing"}this.setSubtitleTrack(t,!0)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.ERROR,this.onError,this)}createTracksInGroup(){var e;if(!this.media||!this.hls.config.renderTextTracksNatively)return;this.tracksInGroup.forEach(r=>{r.trackNode||(r.trackNode=gS(this.media,Iz(r),r.name,r.lang))});const t=(e=this.currentTrack)==null||(e=e.trackNode)==null?void 0:e.track;t?.mode==="disabled"&&(t.mode=this._subtitleDisplay?"showing":"hidden")}onMediaAttached(e,t){const r=t.media;this.media=r;let i=this.trackId;this.queuedDefaultTrack>-1&&(i=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.setSubtitleTrack(i),this.createTracksInGroup(),this.useTextTrackPolling=!(r.textTracks&&"onchange"in r.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):r.textTracks.addEventListener("change",this.asyncPollTrackChange)}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const r=this.media;if(!r)return;const i=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||r.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId,this.setSubtitleTrack(-1)),this.media=null,!i&&this.hls.config.renderTextTracksNatively&&this.tracksInGroup.forEach(s=>{const a=s.trackNode;a&&(a.track.mode="hidden",a.remove(),s.trackNode=void 0)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:r,groupId:i,details:s}=t,a=this.tracksInGroup[r];if(!a||a.groupId!==i){this.warn(`Subtitle track with id:${r} and group:${i} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${r} "${a.name}" lang:${a.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),r===this.trackId&&this.playlistLoaded(r,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const r=t.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!r||i?.length!==r?.length||r!=null&&r.some(a=>i?.indexOf(a)===-1)){this.groupIds=r;const a=[];if(this.tracks.forEach(c=>{(c.textCodec===O0?this.hls.config.enableIMSC1:this.hls.config.enableWebVTT)&&(!r||r.indexOf(c.groupId)>-1?(c.id=a.length,a.push(c)):c.trackNode&&(c.trackNode.remove(),c.trackNode=void 0))}),a.length===this.tracksInGroup.length){let c=!1;for(let d=0;d<a.length;d++)if(a[d]!==this.tracksInGroup[d]){c=!0;break}if(!c)return}a.length&&this.selectDefaultTrack&&!a.some(c=>c.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=a,this.trackId=-1,this.currentTrack=null;const o=this.hls.config.subtitlePreference;if(!s&&o){this.selectDefaultTrack=!1;const c=Pr(o,a);if(c>-1)s=a[c];else{const d=Pr(o,this.tracks);s=this.tracks[d]}}let l=this.findTrackId(s);l===-1&&s&&(l=this.findTrackId(null));const u={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${r?.join(",")}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,u),this.setSubtitleTrack(l),this.createTracksInGroup()}}findTrackId(e){const t=this.tracksInGroup,r=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const s=t[i];if(!(r&&!s.default||!r&&!e)&&(!e||Bs(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(Su(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(Su(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ve.SUBTITLE_TRACK&&t.context.id===this.trackId&&gu(t.context.groupId,this.groupIds)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e,!0)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1,!0),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const r=this.currentTrack;if(r&&Bs(e,r))return r;const i=Pr(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i,!0),s}else{if(r)return null;{const s=Pr(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const r=e.id,i=e.groupId,s=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading subtitle ${r} "${e.name}" lang:${e.lang} group:${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:s,id:r,groupId:i,deliveryDirectives:t||null,track:e})}toggleTrackModes(){if(!this.media||!this.hls.config.renderTextTracksNatively)return;const e=this.currentTrack;this.tracksInGroup.forEach(t=>{if(t.trackNode){const r=t===e?this._subtitleDisplay?"showing":"hidden":"disabled",i=t.trackNode.track;i.mode!==r&&(i.mode=r)}})}setSubtitleTrack(e,t=!1){const r=this.tracksInGroup;if(this.media||(this.queuedDefaultTrack=e),e<-1||e>=r.length||!X(e)){this.warn(`Invalid subtitle track id: ${e}`);return}const i=this.currentTrack,s=r[e]||null;if(this.trackId=e,this.currentTrack=s,t&&this.toggleTrackModes(),!s){i&&this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e});return}const a=!!s.details&&!s.details.live;if(s===i&&a)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:o,groupId:l="",name:u,type:c,url:d}=s;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:o,groupId:l,name:u,type:c,url:d});const f=this.switchParams(s.url,i?.details,s.details);this.loadPlaylist(f)}}const Rd=2,Lz=100;class Cz extends tC{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.skipRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=void 0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var r;(r=this.media)!=null&&r.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var r;this.ended=((r=this.media)==null?void 0:r.currentTime)||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.lastCurrentTime=this.getCurrentTime(),this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Lz),this.mediaSource=t.mediaSource;const r=this.media=t.media;Me(r,"playing",this.onMediaPlaying),Me(r,"waiting",this.onMediaWaiting),Me(r,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:r}=this;r&&(Oe(r,"playing",this.onMediaPlaying),Oe(r,"waiting",this.onMediaWaiting),Oe(r,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}getCurrentTime(){var e;const t=((e=this.hls)==null?void 0:e.config.timelineOffset)||0;return this.media?Math.max(this.media.currentTime,t):t}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.getCurrentTime();this.media.currentTime<t||(this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t)}poll(e,t){var r,i;const s=(r=this.hls)==null?void 0:r.config;if(!s)return;const a=this.media;if(!a)return;const{seeking:o}=a,l=this.seeking&&!o,u=!this.seeking&&o,c=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.skipRetry=this.nudgeRetry=0,s.nudgeOnVideoHole&&!c&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(u||l){l&&this.stallResolved(e);return}if(c){this.skipRetry=this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!1}));return}if(!le.getBuffered(a).length){this.skipRetry=this.nudgeRetry=0;return}const d=le.bufferInfo(a,e,0),f=this.fragmentTracker;f&&this.hls&&nb(d,e,f,this.hls);const h=d.nextStart||0;if(o&&f&&this.hls){const w=eb(this.hls.inFlightFragments,e),I=d.len>Rd,R=!h||w||h-e>Rd&&!f.getPartialFragment(e);if(I||R)return;this.moved=!1}const p=(i=this.hls)==null?void 0:i.latestLevelDetails;if(!this.moved&&this.stalled!==null&&f){if(!(d.len>0)&&!h)return;const I=Math.max(h,d.start||0)-e,A=!!(p!=null&&p.live)?p.targetduration*2:Rd,b=al(e,f);if(I>0&&(I<=A||b)){a.paused||this._trySkipBufferHole(b);return}}const m=s.detectStallWithCurrentTimeMs,g=self.performance.now(),y=this.waiting;let v=this.stalled;if(v===null)if(y>0&&g-y<m)v=this.stalled=y;else{this.stalled=g;return}const S=g-v;if(!o&&(S>=m||y&&this.moved)&&this.hls){var x;if(((x=this.mediaSource)==null?void 0:x.readyState)==="ended"&&!(p!=null&&p.live)&&Math.abs(e-(p?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return;if(a.currentTime!==e){const w=e;e=a.currentTime,this.moved=!0,this.log(`currentTime changed ${w} > ${e}`);return}}const T=le.bufferInfo(a,e,s.maxBufferHole);this._tryFixBufferStall(T,S,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const r=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(r)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(E.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var r;const i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(r=this.buffered.audio)!=null&&r.length&&i&&i.length>1&&e>i.end(0)){const s=le.bufferedInfo(le.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const a=le.timeRangesToArray(i),o=le.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&o<a.length-1){const l=le.bufferedInfo(a,e,0).bufferedIndex,u=a[o].end,c=a[o+1].start;if((l===-1||l>o)&&c-u<1&&e-u<2){const d=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${c} buffered index: ${l}`);this.warn(d.message),this.media.currentTime+=1e-6;let f=al(e,this.fragmentTracker);f&&"fragment"in f?f=f.fragment:f||(f=void 0);const h=le.bufferInfo(this.media,e,0);this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:f,buffer:h.len,bufferInfo:h})}}}}}_tryFixBufferStall(e,t,r){var i,s;const{fragmentTracker:a,media:o}=this,l=(i=this.hls)==null?void 0:i.config;if(!o||!a||!l)return;const u=(s=this.hls)==null?void 0:s.latestLevelDetails,c=al(r,a);if((c||u!=null&&u.live&&r<u.fragmentStart)&&(this._trySkipBufferHole(c)||!this.media))return;const d=e.buffered,f=this.adjacentTraversal(e,r);(d&&d.length>1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-r<l.maxBufferHole||f))&&(t>l.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const r=this.fragmentTracker,i=e.nextStart;if(r&&i){const s=r.getFragAtPos(t,te.MAIN),a=r.getFragAtPos(i,te.MAIN);if(s&&a)return a.sn-s.sn<2}return!1}_reportStall(e){const{hls:t,media:r,stallReported:i,stalled:s}=this;if(!i&&s!==null&&r&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${We(e)})`);this.warn(a.message),t.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){const{fragmentTracker:t,media:r,hls:i}=this,s=i?.config;if(!r||!t||!s)return 0;const a=r.currentTime,o=le.bufferInfo(r,a,0);nb(o,a,t,i);const l=a<o.start?o.start:o.nextStart;if(l){const c=o.len<=s.maxBufferHole,d=o.len>0&&o.len<1&&r.readyState<3,f=l-a;if(f>0&&(c||d)){if(f>s.maxBufferHole){let y=!1;if(a===0){const v=t.getAppendedFrag(0,te.MAIN);v&&l<v.end&&(y=!0)}if(!y&&e){var u;if(!((u=i.loadLevelObj)!=null&&u.details)||eb(i.inFlightFragments,l))return 0;let S=!1,x=e.end;for(;x<l;){const T=al(x,t),w=T?T.duration:0;if(w>0)x+=w;else{S=!0;break}}if(S)return 0}}const{nudgeMaxRetry:h,skipBufferHolePadding:p}=s,m=++this.skipRetry>h,g=Math.max(l,a)+p;if(m||(this.warn(`skipping hole, adjusting currentTime from ${a} to ${g}`),this.moved=!0,r.currentTime=g),!(e!=null&&e.gap)||m){const y=new Error(m?`Playhead still not moving after seeking over buffer hole from ${a} to ${g} after ${s.nudgeMaxRetry} attempts.`:`fragment loaded with buffer holes, seeking from ${a} to ${g}`),v={type:re.MEDIA_ERROR,details:F.BUFFER_SEEK_OVER_HOLE,fatal:m,error:y,reason:y.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?v.part=e:v.frag=e),i.trigger(E.ERROR,v)}return g}}return 0}_tryNudgeBuffer(e){const{hls:t,media:r,nudgeRetry:i}=this,s=t?.config;if(!r||!s)return 0;const a=r.currentTime;if(this.nudgeRetry++,i<s.nudgeMaxRetry){const o=a+(i+1)*s.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(l.message),r.currentTime=o,t.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${a} after ${s.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function eb(n,e){const t=tb(n.main);if(t&&t.start<=e)return t;const r=tb(n.audio);return r&&r.start<=e?r:null}function tb(n){if(!n)return null;switch(n.state){case H.IDLE:case H.STOPPED:case H.ENDED:case H.ERROR:return null}return n.frag}function al(n,e){return e.getAppendedFrag(n,te.MAIN)||e.getPartialFragment(n)}function nb(n,e,t,r){const i=r.latestLevelDetails,s=al(e,t);if(Pf(r.config)&&!n.nextStart&&i&&s&&r.interstitialsManager){const a="type"in s?s:s.fragment,o=ZL(i,a.sn);o?.level===a.level&&gC(o,r.interstitialsManager.playerQueue,e)&&(n.nextStart=o.start)}}const kz=.25;function N0(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function bm(n,e,t,r,i){let s=new n(e,t,"");try{s.value=r,i&&(s.type=i)}catch{s=new n(e,t,We(i?ie({type:i},r):r))}return s}const Uc=(()=>{const n=N0();try{n&&new n(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Dz{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(E.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){this.media=t.media}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.id3Track.remove(),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){return gS(e,"metadata","id3","","hidden")}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:r,enableID3MetadataCues:i}=this.hls.config;if(!r&&!i)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=N0();if(a)for(let o=0;o<s.length;o++){const l=s[o].type;if(l===Qt.emsg&&!r||!i)continue;const u=AL(s[o].data),c=s[o].pts;let d=c+s[o].duration;d>Uc&&(d=Uc),d-c<=0&&(d=c+kz);for(let h=0;h<u.length;h++){const p=u[h];if(!LL(p)){this.updateId3CueEnds(c,l);const m=bm(a,c,d,p,l);m&&this.id3Track.track.addCue(m)}}}}updateId3CueEnds(e,t){var r;const i=(r=this.id3Track)==null?void 0:r.track.cues;if(i)for(let s=i.length;s--;){const a=i[s];a.type===t&&a.startTime<e&&a.endTime===Uc&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:r,type:i}){const{id3Track:s,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(s&&(o||l)){let u;i==="audio"?u=c=>c.type===Qt.audioId3&&l:i==="video"?u=c=>c.type===Qt.emsg&&o:u=c=>c.type===Qt.audioId3&&l||c.type===Qt.emsg&&o,F0(s.track,t,r,u)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:r,timelineOffset:i,enableDateRangeMetadataCues:s,interstitialsController:a}=this.hls.config;if(!s)return;const o=N0();if(r&&i&&!a){const{fragmentStart:m,fragmentEnd:g}=e;let y=this.assetCue;y?(y.startTime=m,y.endTime=g):o&&(y=this.assetCue=bm(o,m,g,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),y&&(y.id=r,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.track.addCue(y),y.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:u}=e,c=Object.keys(u);let d=this.dateRangeCuesAppended;if(l&&t){var f;if((f=l.track.cues)!=null&&f.length){const m=Object.keys(d).filter(g=>c.indexOf(g)===-1);for(let g=m.length;g--;){var h;const y=m[g],v=(h=d[y])==null?void 0:h.cues;delete d[y],v&&Object.keys(v).forEach(S=>{const x=v[S];if(x){x.removeEventListener("enter",this.onEventCueEnter);try{l.track.removeCue(x)}catch{}}})}}else d=this.dateRangeCuesAppended={}}const p=e.fragments[e.fragments.length-1];if(!(c.length===0||!X(p?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let m=0;m<c.length;m++){const g=c[m],y=u[g],v=y.startTime,S=d[g],x=S?.cues||{};let T=S?.durationKnown||!1,w=Uc;const{duration:I,endDate:R}=y;if(R&&I!==null)w=v+I,T=!0;else if(y.endOnNext&&!T){const b=c.reduce((C,k)=>{if(k!==y.id){const $=u[k];if($.class===y.class&&$.startDate>y.startDate&&(!C||y.startDate<C.startDate))return $}return C},null);b&&(w=b.startTime,T=!0)}const A=Object.keys(y.attr);for(let b=0;b<A.length;b++){const C=A[b];if(!IV(C))continue;const k=x[C];if(k)T&&!(S!=null&&S.durationKnown)?k.endTime=w:Math.abs(k.startTime-v)>.01&&(k.startTime=v,k.endTime=w);else if(o){let $=y.attr[C];wV(C)&&($=CL($));const N=bm(o,v,w,{key:C,data:$},Qt.dateRange);N&&(N.id=g,this.id3Track.track.addCue(N),x[C]=N,a&&(C==="X-ASSET-LIST"||C==="X-ASSET-URL")&&N.addEventListener("enter",this.onEventCueEnter))}}d[g]={cues:x,dateRange:y,durationKnown:T}}}}}function uk(){return self.SourceBuffer||self.WebKitSourceBuffer}function ck(){if(!is())return!1;const e=uk();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Pz(){if(!ck())return!1;const n=is();return typeof n?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>n.isTypeSupported(pu(e,"video")))||["mp4a.40.2","fLaC"].some(e=>n.isTypeSupported(pu(e,"audio"))))}function Oz(){var n;const e=uk();return typeof(e==null||(n=e.prototype)==null?void 0:n.changeType)=="function"}var _r={DISABLED:0,SWITCHING:1,SWITCHED:2};const Mz=100;class dk extends eS{constructor(e,t,r){super(e,t,r,"stream-controller",te.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=_r.DISABLED,this.audioOnly=!1,this._couldBacktrack=!1,this._backtrackFragment=void 0,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const i=this.media,s=i?i.currentTime:null;if(s===null||!X(s)||(this.log(`Media seeked to ${s}`),!this.getBufferedFrag(s)))return;const a=this.getFwdBufferInfoAtPos(i,s,te.MAIN,0);if(!a||a.len===0){this.log(`Main buffer empty at ${s} on "seeked" event: ${a&&a.len}`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:r,hls:i}=this;if(this.stopLoad(),this.setInterval(Mz),this.level=-1,!this.startFragRequested){let s=i.startLevel;s===-1&&(i.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=i.firstAutoLevel),i.nextLoadLevel=s,this.level=i.loadLevel,this._hasEnoughToStart=!!t}r>0&&e===-1&&!t&&this.initPTS.length&&(this.log(`Override startPosition with lastCurrentTime @${r}`),e=r),this.state=H.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,!t&&!this.fragmentTracker.hasFragments(this.playlistType)&&(this._hasEnoughToStart=this.startFragRequested=!1),this.tick()}else this._forceStartLoad=!0,this.state=H.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case H.WAITING_LEVEL:{const{levels:e,level:t}=this,r=e?.[t],i=r?.details;if(i&&(!i.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(i))break;this.state=H.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=H.IDLE;break}break}case H.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===H.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:r,media:i}=this;if(t===null||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;
vendor: 4,913 bytes, line 113
113const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(r!=null&&r[s]))return;const a=r[s],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const m={type:this.targetBufferType()};this.hls.trigger(E.BUFFER_EOS,m),this.state=H.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const u=a.details;if(!u||this.state===H.WAITING_LEVEL||this.waitForLive(a)){this.level=s,this.state=H.WAITING_LEVEL,this.startFragRequested=!1;return}const c=o.len,d=this.getMaxBufferLength(a.maxBitrate);if(c>=d)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=void 0);const f=this.backtrackFragment?this.backtrackFragment.start:o.end;let h=this.getNextFragment(f,u);if(this.couldBacktrack&&!this.fragPrevious&&h&&at(h)&&this.fragmentTracker.getState(h)!==rt.OK){var p;const g=((p=this.backtrackFragment)!=null?p:h).sn-u.startSN,y=u.fragments[g-1];y&&h.cc===y.cc&&(h=y,this.fragmentTracker.removeFragment(y))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=void 0);if(h&&this.isLoopLoading(h,f)){if(!h.gap){const g=this.audioOnly&&!this.altAudio?He.AUDIO:He.VIDEO,y=(g===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,g)}h=this.getNextFragmentLoopLoading(h,u,o,te.MAIN,d)}h&&(this.exceedsMaxBuffer(o,d,h)||this.loadFragment(h,a,f))}loadFragment(e,t,r){const i=this.fragmentTracker.getState(e);i===rt.NOT_LOADED||i===rt.PARTIAL?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,r):this.clearTrackerIfNeeded(e)}immediateLevelSwitch(){if(this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY),this.altAudio!==_r.DISABLED){var e;(((e=this.getLevelDetails())==null?void 0:e.fragmentStart)||0)>this.lastCurrentTime&&super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")}}getBufferOutput(){return this.mediaBuffer&&this.altAudio===_r.SWITCHED?this.mediaBuffer:this.media}checkFragmentChanged(){const e=this.fragPlaying;if(!this.checkFragPlaying())return!1;const r=this.fragPlaying;if(r){const i=r.level;this.hls.trigger(E.FRAG_CHANGED,{frag:r,previousFrag:e}),e?.level!==i&&this.hls.trigger(E.LEVEL_SWITCHED,{level:i})}return!0}get backtrackFragment(){return this._backtrackFragment}set backtrackFragment(e){this._backtrackFragment=e}get couldBacktrack(){return this._couldBacktrack}set couldBacktrack(e){this._couldBacktrack=e}abortCurrentFrag(){this.backtrackFragment=void 0,super.abortCurrentFrag()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.targetBufferType())}targetBufferType(){return this.altAudio===_r.SWITCHED&&!this.audioOnly?"video":null}onMediaAttached(e,t){super.onMediaAttached(e,t);const r=t.media;Me(r,"playing",this.onMediaPlaying),Me(r,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:r}=this;r&&(Oe(r,"playing",this.onMediaPlaying),Oe(r,"seeked",this.onMediaSeeked)),this.videoBuffer=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.backtrackFragment=void 0,this.altAudio=_r.DISABLED,this.audioOnly=!1}onManifestParsed(e,t){let r=!1,i=!1;for(let s=0;s<t.levels.length;s++){const a=t.levels[s].audioCodec;a&&(r=r||a.indexOf("mp4a.40.2")!==-1,i=i||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=r&&i&&!Oz(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:r}=this;if(!r||this.state!==H.IDLE)return;const i=t.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=H.WAITING_LEVEL)}onLevelLoaded(e,t){var r;const{levels:i,startFragRequested:s}=this,a=t.level,o=t.details,l=o.totalduration;if(!i){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${l}`);const u=t.levelInfo,c=this.fragCurrent;c&&(this.state===H.FRAG_LOADING||this.state===H.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let d=0;if(o.live||(r=u.details)!=null&&r.live){var f;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,u.details,(f=this.levelLastLoaded)==null?void 0:f.details)}if(u.details=o,this.levelLastLoaded=u,s||this.setStartPosition(o,d),this.hls.trigger(E.LEVEL_UPDATED,{details:o,level:a}),this.state===H.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=H.IDLE}
vendor: 4,577 bytes, line 113
113s&&o.live&&this.synchronizeToLiveEdge(o),this.initPTS.some((h,p)=>{if(p>=o.startCC)return!0;delete this.initPTS[p]}),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:r}=this;if(!r)return;const i=this.hls.liveSyncPosition,s=this.playhead,a=e.fragmentStart,o=e.edge,l=s>=a-t.maxFragLookUpTolerance&&s<=o;if(i!==null&&r.duration>i&&(s<i||!l)){const c=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!l&&r.readyState<4||s<o-c)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),r.readyState))if(this.warn(`Playback: ${s} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${i}`),this.config.liveSyncMode==="buffered"){var u;const d=le.bufferInfo(r,i,0);if(!((u=d.buffered)!=null&&u.length)){r.currentTime=i;return}if(d.start<=s){r.currentTime=i;return}const{nextStart:h}=le.bufferedInfo(d.buffered,s,0);h&&(r.currentTime=h)}else r.currentTime=i}}_handleFragmentLoadProgress(e){var t;const r=e.frag,{part:i,payload:s}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const o=a[r.level];if(!o){this.warn(`Level ${r.level} not found on progress`);return}const l=o.details;if(!l){this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),this.fragmentTracker.removeFragment(r);return}const u=o.videoCodec,c=l.PTSKnown||!l.live,d=(t=r.initSegment)==null?void 0:t.data,f=this._getAudioCodec(o),h=this.transmuxer=this.transmuxer||new OC(this.hls,te.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=i?i.index:-1,m=p!==-1,{decryptRange:g,byteRange:y}=Af(r,i,this.iframesOnly),v=new Xv(r.level,r.sn,r.stats.chunkCount,y?y.end-y.start:s.byteLength,p,m,r.duration,this.iframesOnly,g),S=this.initPTS[r.cc];h.push(s,d,f,u,r,i,l.totalduration,c,v,S)}onAudioTrackSwitching(e,t){const r=this.hls,i=this.altAudio!==_r.DISABLED;if(Rf(t.url,r))this.altAudio=_r.SWITCHING;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(i){this.altAudio=_r.DISABLED,this.fragmentTracker.removeAllFragments(),r.once(E.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(E.AUDIO_TRACK_SWITCHED,t)}),r.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}r.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const r=Rf(t.url,this.hls);if(r){const i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r?_r.SWITCHED:_r.DISABLED,this.tick()}onBufferCreated(e,t){const r=t.tracks;let i,s,a=!1;for(const o in r){const l=r[o];if(l.id==="main"){if(s=o,i=l,o==="video"){const u=r[o];u&&(this.videoBuffer=u.buffer)}}else a=!0}a&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:r,part:i}=t,s=r.type===te.MAIN;if(s){if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${i?" p: "+i.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),this.state===H.PARSED&&(this.state=H.IDLE);return}let l=!1;if(at(r)&&(l=!!r.gap&&!r.tagList.some(u=>u[0]==="GAP")),this.fragBufferedComplete(r,i),l){var a;r.stats.retry++;const u=(a=this.levels)==null?void 0:a[r.level];u&&u.fragmentError++}}const o=this.media;o&&(!this._hasEnoughToStart&&le.getBuffered(o).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var r;if(t.fatal){this.state=H.ERROR;return}switch(t.details){case F.FRAG_GAP:case F.FRAG_PARSING_ERROR:case F.FRAG_DECRYPT_ERROR:case F.FRAG_LOAD_ERROR:case F.FRAG_LOAD_TIMEOUT:case F.KEY_LOAD_ERROR:case F.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(te.MAIN,t);break;case F.LEVEL_LOAD_ERROR:case F.LEVEL_LOAD_TIMEOUT:case F.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===H.WAITING_LEVEL&&((r=t.context)==null?void 0:r.type)===ve.LEVEL&&(this.state=H.IDLE);break;case F.BUFFER_APPEND_NO_PROGRESS:if(t.parent!=="main")return;t.frag&&(t.appendsWithoutProgress||0)>
vendor: 4,168 bytes, line 113
113=this.config.appendErrorMaxRetry&&(this.warn(`Marking fragment ${t.frag.sn} of level ${t.frag.level} as a gap after ${t.appendsWithoutProgress} appends without buffered range growth, to prevent loop loading`),this.fragmentTracker.addAsGap(t.frag));break;case F.BUFFER_ADD_CODEC_ERROR:case F.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case F.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case F.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=H.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==He.AUDIO||!this.altAudio){const r=(t===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;r&&(this.afterBufferFlushed(r,t),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let r=this.startPosition;if(r>=0&&t<r){if(e.seeking){this.log(`could not seek to ${r}, already seeking at ${t}`);return}const i=this.timelineOffset;i&&r&&(r+=i);const s=this.getLevelDetails(),a=le.getBuffered(e),o=a.length?a.start(0):0,l=o-r,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||l>0&&(l<u||this.loadingParts&&l<2*(s?.partTarget||0)))&&(this.log(`adjusting start position by ${l} to match buffer start`),r+=l,this.startPosition=r),t<r&&(this.log(`seek to target start position ${r} from current time ${t} buffer start ${o}`),e.currentTime=r)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(r=>{const{hls:i}=this,s=r?.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=H.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=s.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),i.trigger(E.FRAG_LOADED,r),s.bitrateTest=!1}).catch(r=>{this.state===H.STOPPED||this.state===H.ERROR||(this.warn(r),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:r}=this,{remuxResult:i,chunkMeta:s}=e,a=this.getCurrentContext(s);if(!a){this.resetWhenMissingContext(s);return}const{frag:o,part:l,level:u}=a,{video:c,text:d,id3:f,initSegment:h}=i,{details:p}=u,m=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=H.PARSING,h){const g=h.tracks;if(g){const x=o.initSegment||o;if(this.unhandledEncryptionError(h,o))return;this._bufferInitSegment(u,g,x,s),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:x,id:t,tracks:g})}const y=h.initPTS,v=h.timescale,S=this.initPTS[o.cc];if(X(y)&&(!S||S.baseTime!==y||S.timescale!==v)){const x=h.trackId;this.initPTS[o.cc]={baseTime:y,timescale:v,trackId:x};const T=this.initPTS.slice(0);r.trigger(E.INIT_PTS_FOUND,{timestampOffsets:T,frag:o,id:t,initPTS:y,timescale:v,trackId:x})}}if(c&&p){m&&c.type==="audiovideo"&&this.logMuxedErr(o);const g=p.fragments[o.sn-1-p.startSN],y=o.sn===p.startSN,v=!g||o.cc>g.cc;if(i.independent!==!1){const{startPTS:S,endPTS:x,startDTS:T,endDTS:w}=c;if(l)l.elementaryStreams[c.type]={startPTS:S,endPTS:x,startDTS:T,endDTS:w};else if(c.firstKeyFrame&&c.independent&&s.id===1&&!v&&(this.couldBacktrack=!0),c.dropped&&c.independent){const I=this.getMainFwdBufferInfo(),R=(I?I.end:this.getLoadPosition())+this.config.maxBufferHole,A=c.firstKeyFramePTS?c.firstKeyFramePTS:S;if(!y&&R<A-this.config.maxBufferHole&&!v){this.backtrack(o);return}else v&&(o.gap=!0);o.setElementaryStreamInfo(c.type,o.start,x,o.start,w,!0)}
vendor: 71,716 bytes, lines 113-114
113else y&&S-(p.appliedTimelineOffset||0)>Rd&&(o.gap=!0);o.setElementaryStreamInfo(c.type,S,x,T,w),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(c,o,l,s,y||v)}else if(y||v)o.gap=!0;else{this.backtrack(o);return}}if(m){const{startPTS:g,endPTS:y,startDTS:v,endDTS:S}=m;l&&(l.elementaryStreams[He.AUDIO]={startPTS:g,endPTS:y,startDTS:v,endDTS:S}),o.setElementaryStreamInfo(He.AUDIO,g,y,v,S),this.bufferFragmentData(m,o,l,s)}if(p&&f!=null&&f.samples.length){const g={id:t,frag:o,details:p,samples:f.samples};r.trigger(E.FRAG_PARSING_METADATA,g)}if(p&&d){const g={id:t,frag:o,details:p,samples:d.samples};r.trigger(E.FRAG_PARSING_USERDATA,g)}}logMuxedErr(e){this.warn(`${at(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,r,i){if(this.state!==H.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(r));const{audio:s,video:a,audiovideo:o}=t;if(s){const u=e.audioCodec;let c=_d(s.codec,u);if(c==="mp4a"&&(c="mp4a.40.5"),this.audioCodecSwitch){c&&(c.indexOf("mp4a.40.5")!==-1?c="mp4a.40.2":c="mp4a.40.5");const d=s.metadata;d&&"channelCount"in d&&(d.channelCount||1)!==1&&!BH()&&(c="mp4a.40.5")}c&&c.indexOf("mp4a.40.5")!==-1&&GH()&&s.container!=="audio/mpeg"&&(c="mp4a.40.2",this.log(`Android: force audio codec to ${c}`)),u&&u!==c&&this.log(`Swapping manifest audio codec "${u}" for "${c}"`),s.levelCodec=c,s.id=te.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${c||""}/${u||""}/${s.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=te.MAIN;const u=a.codec;if(u?.length===4)switch(u){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${a.codec!==u?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}o&&(this.iframesOnly&&this.logMuxedErr(r),this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const l=Object.keys(t);if(l.length){if(this.hls.trigger(E.BUFFER_CODECS,t),!this.hls)return;l.forEach(u=>{const d=t[u].initSegment;d!=null&&d.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:u,data:d,frag:r,part:null,chunkMeta:i,parent:r.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.getBufferOutput();return this.getFwdBufferInfo(e,te.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,r=e?.[t];return r?this.getMaxBufferLength(r.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=H.IDLE}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return X(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(X(t)){const r=this.getLevelDetails(),i=this.currentFrag||(r?po(null,r.fragments,t):null);if(i){const s=i.programDateTime;if(s!==null){const a=s+(t-i.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class fk extends dk{constructor(...e){super(...e),this.currentOp=void 0,this.nextOp=void 0,this.cached=[],this.cachedSize=0,this.cacheFragmentData=!0,this.initDetails=void 0,this.onBufferedToEnd=()=>{const t=this.media;t!=null&&t.seeking&&(t.currentTime=t.currentTime)},this.onMediaSeeking=()=>{}}setInitPts(e){this.initPTS=e.slice()}loadMediaAt(e,t){if(!this.hls)return;const{seekOnAppend:r}=t,i=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=i,this.startPosition=e,this.state){case H.STOPPED:case H.ENDED:case H.ERROR:this.state=H.IDLE}this.state===H.IDLE?(this.hls.resumeBuffering(),this.tick(),this.currentOp=[i,t]):this.nextOp=[i,t],this.hls.off(E.BUFFERED_TO_END,this.onBufferedToEnd);const s=this.media;r&&s&&this.seekTo(i)&&(this.currentOp=[i,t],this.nextOp=void 0,this.flushPipeline(i,!0))}seekTo(e){const t=this.media;if(t){var r;const i=(r=this.getLevelDetails())==null?void 0:r.edge,s=i!==void 0?i:t.duration;if(e>=s&&(e=s-.01),le.bufferInfo(t,e,0).len>0&&this.getBufferedAt(e))return t.currentTime=e,!0}return!1}getBufferedAt(e){return this.fragmentTracker.getBufferedFrag(e,te.MAIN)}cacheSet(e,t){if(!this.hls)return;e.data=t;const r=this.cached;r.push(e),this.cachedSize+=t.buffer.byteLength;const i=this.hls.config.iframeCacheLimit;for(;this.cachedSize>i&&r.length>1;){const s=r.shift();if(s.data)this.cachedSize-=s.data.byteLength,s.data=void 0;else{this.cached=r.filter(a=>!!a.data),this.cachedSize=r.reduce((a,{data:o})=>o?o.buffer.byteLength:0,0);break}}}onHandlerDestroying(){this.cached.length=0,this.cachedSize=0,super.onHandlerDestroying()}_handleFragmentLoadProgress(e){const t=e.frag,{part:r,payload:i}=e;this.cacheFragmentData&&!r&&i!=null&&i.byteLength&&!t.data&&at(t)&&this.cacheSet(t,new Uint8Array(i.slice(0))),super._handleFragmentLoadProgress(e)}loadFragment(e,t,r){const i=this.fragmentTracker.getState(e);if((i===rt.NOT_LOADED||i===rt.PARTIAL)&&this.canReplayCached(e)){this.replayCachedFragment(e);return}super.loadFragment(e,t,r)}canReplayCached(e){var t;if(!this.cacheFragmentData||!((t=e.data)!=null&&t.byteLength))return!1;const r=e.decryptdata;return r?.keyFormat!=="identity"||!!r.key}replayCachedFragment(e){const t=e.data.slice().buffer;this.log(`Buffering cached ${e.type} sn: ${e.sn} of level ${e.level} (${t.byteLength} bytes)`),this.fragCurrent=e,this.startFragRequested=!0;const r=e.stats=new jv;r.loading.start=r.loading.first=r.loading.end=self.performance.now(),r.loaded=r.total=t.byteLength,r.chunkCount=1,this.state=H.FRAG_LOADING;const i={frag:e,part:null,payload:t,networkDetails:null};this._handleFragmentLoadProgress(i),this.hls.trigger(E.FRAG_LOADED,i),this._handleFragmentLoadComplete(i)}fragBufferedComplete(e,t){super.fragBufferedComplete(e,t);const{currentOp:r,nextOp:i}=this;this.currentOp=this.nextOp=void 0,this.state=H.STOPPED,r!=null&&r[1].seekOnAppend&&(this.flushPipeline(r[0],!i),this.seekTo(r[0])||this.log(`Could not seek to ${r[0]} after fragment buffered (superseded or flushed) buffer: ${this.media?Df(le.getBuffered(this.media)):"none"}`)),i&&this.loadMediaAt.apply(this,i)}flushPipeline(e,t){if(t){const r=this.media;if(r){const i=le.bufferInfo(r,e,0),s=i.len?i.nextStart:0;s&&(this.fragmentTracker.removeFragmentsInRange(s,1/0,te.MAIN),this.flushMainBuffer(s,1/0))}this.hls.once(E.BUFFERED_TO_END,this.onBufferedToEnd)}this.hls.trigger(E.BUFFER_EOS,{type:"video"})}get playhead(){return this.nextLoadPosition}startLoad(){if(!this.startFragRequested){const e=this.hls;e.nextLoadLevel=e.startLevel===-1?0:e.firstAutoLevel}}seekToStartPos(){}setStartPosition(){}alignPlaylists(e,t,r){const i=this.initDetails;return this.initDetails=null,super.alignPlaylists(e,t,r||i||void 0)}getMainFwdBufferInfo(){const e=this.playhead,t=this.getBufferedAt(e);if(t){const r=t.duration;return{len:r,start:e,end:e+r,bufferedIndex:-1}}return{len:0,start:e,end:e,bufferedIndex:-1}}_streamEnded(){const e=this.playhead,t=this.fragmentTracker.getBufferedFrag(e,te.MAIN);return!!(t!=null&&t.endList)}}class Fz extends fk{constructor(...e){super(...e),this._img=void 0,this.queued=void 0,this.cacheFragmentData=!1}get image(){return this._img}set image(e){var t;const r=(t=this._img)==null?void 0:t.src;r&&self.URL.revokeObjectURL(r),this._img=e}loadMediaAt(e){if(!this.hls)return;const t=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=t,this.startPosition=e,this.state){case H.STOPPED:case H.ENDED:case H.ERROR:this.state=H.IDLE}if(this.state===H.IDLE){if(this.hls.resumeBuffering(),this.media||(this.media={}),this.tick(),this.state===H.IDLE){const r=this.getBufferedAt(e);r&&(this.fragCurrent=r,this.updateImage(r,null))}}else{const r=this.fragCurrent;(!r||e>=r.start&&e<r.end)&&(this.queued=[t])}}updateImage(e,t,r){const i=e.data;i||this.fragmentTracker.removeFragment(e);const s=this._img;if(s&&i){const a=self.performance.now(),o=t?t.stats:e.stats;o.buffering.start=e.stats.buffering.start=a,s.onload=()=>{if(!this.hls)return;const c=this.hls.levels[e.level];c!=null&&c.fragmentError&&(c.fragmentError=0,e.stats.retry=0);const d=self.performance.now(),f=t?t.stats:e.stats;f.buffering.end=e.stats.buffering.end=d,this.hls.trigger(E.FRAG_BUFFERED,{frag:e,part:t,stats:f,id:e.type,chunkMeta:r})},s.onerror=()=>{this.handleError("Image decode error",e,t,r)};const l=s.src;l&&self.URL.revokeObjectURL(l);const u=new Blob([i],{type:"image/jpeg"});s.src=self.URL.createObjectURL(u)}else this.state=H.STOPPED,this.processQueued()}processQueued(){const e=this.queued;this.queued=void 0,e&&this.loadMediaAt.apply(this,e)}handleError(e,t,r,i){if(!this.hls)return;const s=new Error(e);this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.FRAG_PARSING_ERROR,chunkMeta:i,frag:t,part:r,fatal:!1,error:s,err:s})}_bufferInitSegment(){}bufferFragmentData(e,t,r,i){super.bufferFragmentData(e,t,r,i,!0);const s=de(new Uint8Array(e.data1),["mdat"]);if(s.length===0){this.handleError("Could not find I-Frame mdat",t,r,i);return}const a=t;this.cacheSet(a,s[0]),this.updateImage(a,r,i)}fragBufferedComplete(e,t){this.fragmentTracker.fragBuffered(e,!0),super.fragBufferedComplete(e,t),this.processQueued()}checkFragPlaying(){var e;const t=(e=this.fragPrevious)==null?void 0:e.start;if(t!==void 0){const r=this.getAppendedFrag(t);if(r&&!sl(r,this.fragPlaying))return this.fragPlaying=r,!0}return!1}getMainFwdBufferInfo(){return{len:0,start:this.playhead,end:this.playhead,bufferedIndex:-1}}}const Nz=10,Uz="Image I-Frame player does not accept HTMLMediaElements",rb={seekOnAppend:!0};let Bc,Im;class Bz extends Cn{constructor(e,t){super("iframes",e.logger),this.hls=void 0,this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances=void 0,this.instanceCounter=0,Bc||(Bc=$z(t)),Im||(Im=Gz(Bc)),this.hls=e,this.iframeInstances=[],this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(E.MANIFEST_LOADING,this.clearAsset,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.clearAsset,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.DESTROYING,this.onDestroying,this))}clearAsset(){this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances.forEach(e=>e.destroy()),this.iframeInstances.length=0}onDestroying(){this.unregisterListeners(),this.clearAsset(),this.hls=void 0}onManifestLoaded(e,t){this.stats=t.stats,this.variableList=t.variableList}onLevelsUpdated(e,{levels:t}){var r;const i=(r=this.hls)==null?void 0:r.pathwayPriority;t.length&&i&&this.iframeInstances.forEach(s=>{s.pathwayPriority=i})}onInitPtsFound(e,{id:t,timestampOffsets:r}){t===te.MAIN&&(this.initPTS=r)}onFragBuffered(e,t){var r;const i=this.hls;i&&i.hasEnoughToStart&&(((r=i.mainForwardBufferInfo)==null?void 0:r.len)||0)>Nz&&this.iframeInstances.forEach(s=>{if(!s.loadingEnabled){var a;s.startLoad(((a=this.hls)==null||(a=a.media)==null?void 0:a.currentTime)||0)}})}createIFramePlayer(e){var t;return this.createInstance(Bc,(t=this.hls)==null?void 0:t.iframeVariants,e)}createImageIFramePlayer(e){var t;const r=(t=this.hls)==null?void 0:t.iframeVariants.filter(i=>i.imageCodec);return this.createInstance(Im,r,e,"image-")}createInstance(e,t,r,i){const{hls:s}=this;if(!s)return null;const{url:a,userConfig:o,latestLevelDetails:l,loadLevelObj:u,loadLevel:c,bandwidthEstimate:d,sessionId:f}=s,{stats:h,variableList:p}=this;if(!(t!=null&&t.length)||!h||!a)return null;const m=`${i||""}iframe-player-${this.instanceCounter++}`,g=s.levels,y=u||g[c],v=XL(y,o.videoPreference),S=y?.pathwayId||".",x=ie(ie({},o),{},{loggerId:m,primarySessionId:f,videoPreference:v,abrEwmaDefaultEstimate:d,streamController:void 0,audioStreamController:void 0,audioTrackController:void 0,subtitleStreamController:void 0,subtitleTrackController:void 0,timelineController:void 0,id3TrackController:void 0,fpsController:void 0,gapController:void 0,iframeController:void 0,cmcd:void 0,interstitialsController:void 0,backBufferLength:1/0,maxMaxBufferLength:1,capLevelToPlayerSize:!0,enableWorker:!1,autoStartLoad:!1,startFragPrefetch:!1,testBandwidth:!1,progressive:!1},r),T=new e(x,a,this.initPTS,l);return this.iframeInstances=this.iframeInstances.filter(w=>!w.url),this.iframeInstances.push(T),T.trigger(E.MANIFEST_LOADED,{levels:t,contentSteering:{uri:"",pathwayId:S},sessionKeys:null,audioTracks:[],iframeVariants:[],sessionData:null,startTimeOffset:null,stats:h,networkDetails:null,url:a,variableList:p}),T}}function $z(n){return class extends n{constructor(t,r,i,s){t.streamController||(t.streamController=fk),super(t),this._url=r,this.streamController.setInitPts(i),this.streamController.initDetails=s}loadSource(){}loadMediaAt(t,r=rb){if(t<0)return;const i=ie(ie({},rb),r);this.loadingEnabled||this.startLoad(t),this.streamController.loadMediaAt(t,i)}}}function Gz(n){return class extends n{constructor(t,r,i,s){t.cmcdController=void 0,t.emeController=void 0,t.streamController||(t.streamController=Fz),t.capLevelController=void 0,t.bufferController=void 0,super(t,r,i,s)}attachImage(t){this.streamController.image=t}detachImage(){this.streamController.image=void 0}loadSource(){}attachMedia(){throw new Error(Uz)}detachMedia(){}recoverMediaError(){}transferMedia(){return null}loadMediaAt(t){if(t<0)return null;this.loadingEnabled||this.startLoad(t),this.streamController.loadMediaAt(t)}}}const Qi=.025;let Nf=function(n){return n[n.Point=0]="Point",n[n.Range=1]="Range",n}({});function jz(n,e,t){return`${n.identifier}-${t+1}-${Al(e)}`}class Hz{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const r=this.playoutLimit;return e<=0||isNaN(r)?!1:r===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>r}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return ib(t,e)?Ad(e,t):e}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,r=Ad(t,e);return t-r<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=X(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return ib(t,e)?Ad(e,t):e}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Qi))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Nf.Range:Nf.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return Vz(this)}}function Ad(n,e){return n-e.start<e.duration/2&&!(Math.abs(n-(e.start+e.duration))<Qi)?e.start:e.start+e.duration}function ib(n,e){return e>n.start-Qi&&e<n.start+n.duration+Qi}function hk(n,e,t){const r=new self.URL(n,t);return r.protocol!=="data:"&&Xi(r,"_HLS_primary_id",e),r}function wm(n,e){for(;(t=n.assetList[++e])!=null&&t.error;)var t;return e}function Vz(n){return`["${n.identifier}" ${n.cue.pre?"<pre>":n.cue.post?"<post>":""}${n.timelineStart.toFixed(2)}-${n.resumeTime.toFixed(2)}]`}function va(n){const e=n.timelineStart,t=n.duration||0;return`["${n.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Wz{constructor(e,t,r,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(E.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=r,this.assetItem=i;const a=()=>{this.hasDetails=!0};s.once(E.LEVEL_LOADED,a),s.once(E.AUDIO_TRACK_LOADED,a),s.once(E.SUBTITLE_TRACK_LOADED,a),s.on(E.MEDIA_ATTACHING,(o,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(E.BUFFER_APPENDED,()=>{const c=this.bufferedEnd;this.reachedPlayout(c)&&(this._bufferedEosTime=c,s.trigger(E.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=hk(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e,t){var r;if(!this.appendInPlace)return!1;if((r=this.hls)!=null&&r.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),s=this.timelineOffset+(t||0),a=le.bufferInfo(e,s,.02);return this.getAssetTime(a.end)>=i-.02}reachedPlayout(e){const r=this.interstitial.playoutLimit;return this.startOffset+e>=r}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=le.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const r=t-this.startOffset;if(r>0&&r<e)return r}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const r=e-t;if(Math.abs(r)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,r=this.duration;return Math.min(Math.max(0,e-t),r)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=r=>delete r.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,r){var i;(i=this.hls)==null||i.on(e,t)}once(e,t,r){var i;(i=this.hls)==null||i.once(e,t)}off(e,t,r){var i;(i=this.hls)==null||i.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${va(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Rm=.033;class zz extends Cn{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((r,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,r+1):r,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let r=-1;e.nextEvent?r=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(r=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[r]||(t===void 0&&(t=e.start),r=this.findItemIndexAtTime(t));r>=0&&(s=i[r])!=null&&s.event;){var s;r--}return r}findItemIndexAtTime(e,t){const r=this.items;if(r)for(let i=0;i<r.length;i++){let s=r[i];t&&t!=="primary"&&(s=s[t]);const a=s.start,o=r[i].event,l=o!=null&&o.cue.pre?o.duration:s.end;if(e===a||e>a&&e<l)return i}return-1}findJumpRestrictedIndex(e,t){const r=this.items;if(r)for(let i=e;i<=t&&r[i];i++){const s=r[i].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return i}return-1}findEventIndex(e){const t=this.items;if(t)for(let i=t.length;i--;){var r;if(((r=t[i].event)==null?void 0:r.identifier)===e)return i}return-1}findAssetIndex(e,t){const r=e.assetList,i=r.length;if(i>1)for(let s=0;s<i;s++){const a=r[s];if(!a.error){const o=a.timelineStart;if(t===o||t>o&&(t<o+(a.duration||0)||s===i-1))return s}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const r=t.assetList,i=r[r.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t,r=0){const i=e.main.details,{dateRanges:s}=i,a=this.events,o=this.parseDateRanges(s,{url:i.url},t),l=Object.keys(s),u=a?a.filter(c=>l.indexOf(c.identifier)===-1):[];o.length&&o.sort((c,d)=>{const f=c.cue.pre,h=c.cue.post,p=d.cue.pre,m=d.cue.post;if(f&&!p)return-1;if(p&&!f||h&&!m)return 1;if(m&&!h)return-1;if(!f&&!p&&!h&&!m){const g=c.startTime,y=d.startTime;if(g!==y)return g-y}return c.dateRange.tagOrder-d.dateRange.tagOrder}),this.events=o,u.forEach(c=>{this.removeEvent(c)}),this.updateSchedule(e,u,r)}updateSchedule(e,t=[],r=0,i=!1){const s=this.events||[];if(s.length||t.length||this.length<2){const a=this.items,o=this.parseSchedule(s,e,r);(i||t.length||a?.length!==o.length||o.some((u,c)=>Math.abs(u.playout.start-a[c].playout.start)>.005||Math.abs(u.playout.end-a[c].playout.end)>.005))&&(this.items=o,this.onScheduleUpdate(t,a))}}parseDateRanges(e,t,r){const i=[],s=Object.keys(e);for(let a=0;a<s.length;a++){const o=s[a],l=e[o];if(l.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(l):(u=new Hz(l,t),this.eventMap[o]=u,r===!1&&(u.appendInPlace=r)),i.push(u)}}return i}parseSchedule(e,t,r=0){const i=[],s=t.main.details,a=s.live?1/0:s.edge;let o=0;if(e=e.filter(u=>!u.error&&!(u.cue.once&&u.hasPlayed)),e.length){this.resolveOffsets(e,t);let u=0,c=0;if(e.forEach((d,f)=>{const h=d.cue.pre,p=d.cue.post,m=e[f-1]||null,g=d.appendInPlace,y=p?a:d.startOffset,v=d.duration,S=d.timelineOccupancy===Nf.Range?v:0,x=h&&s.live?r+(d.resumeOffset||0):0,T=x||d.resumptionOffset,w=m?.startTime===y,I=y+d.cumulativeDuration;let R=g?I+v:y+T;if(h||!p&&y<=0){const b=c;c+=S,d.timelineStart=I;const C=o;o+=v,i.push({event:d,start:I,end:R,playout:{start:C,end:o},integrated:{start:b,end:c}})}else if(y<=a){if(!w){const k=y-u;if(k>Rm){const $=u,U=c;c+=k;const N=o;o+=k;const D={previousEvent:e[f-1]||null,nextEvent:d,start:$,end:$+k,playout:{start:N,end:o},integrated:{start:U,end:c}};i.push(D)}else k>0&&m&&(m.cumulativeDuration+=k,i[i.length-1].end=y)}p&&(R=I),d.timelineStart=I;const b=c;c+=S;const C=o;o+=v,i.push({event:d,start:I,end:R,playout:{start:C,end:o},integrated:{start:b,end:c}})}else return;const A=x||d.resumeTime;p||A>a?u=a:!h&&R&&d.appendInPlaceStarted&&A-R>Rm?u=R:u=A}),u<a){var l;const d=u,f=c,h=a-u;c+=h;const p=o;o+=h,i.push({previousEvent:((l=i[i.length-1])==null?void 0:l.event)||null,nextEvent:null,start:u,end:d+h,playout:{start:p,end:o},integrated:{start:f,end:c}})}this.setDurations(a,o,c)}else i.push({previousEvent:null,nextEvent:null,start:0,end:a,playout:{start:0,end:a},integrated:{start:0,end:a}}),this.setDurations(a,a,a);return i}setDurations(e,t,r){this.durations={primary:e,playout:t,integrated:r}}resolveOffsets(e,t){const r=t.main.details,i=r.live?1/0:r.edge;let s=0,a=-1;e.forEach((o,l)=>{const u=o.cue.pre,c=o.cue.post,d=u?0:c?i:o.startTime;this.updateAssetDurations(o),a===d?o.cumulativeDuration=s:(s=0,a=d),!c&&o.snapOptions.in&&(o.resumeAnchor=po(null,r.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&l+1<e.length&&e[l+1].startTime-e[l].resumeTime<Rm&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const h=X(o.resumeOffset)?o.resumeOffset:o.duration;s+=h})}primaryCanResumeInPlaceAt(e,t){const r=e.resumeTime,i=e.startTime+e.resumptionOffset;return Math.abs(r-i)>Qi?(this.log(`"${e.identifier}" resumption ${r} not aligned with estimated timeline end ${i}`),!1):!Object.keys(t).some(a=>{const o=t[a].details,l=o.edge;if(r>=l)return this.log(`"${e.identifier}" resumption ${r} past ${a} playlist end ${l}`),!1;const u=po(null,o.fragments,r);if(!u)return this.log(`"${e.identifier}" resumption ${r} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const c=a==="audio"?.175:0;return Math.abs(u.start-r)<Qi+c||Math.abs(u.end-r)<Qi+c?!1:(this.log(`"${e.identifier}" resumption ${r} not aligned with ${a} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let r=0,i=!1,s=!1;for(let a=0;a<e.assetList.length;a++){const o=e.assetList[a],l=t+r;o.startOffset=r,o.timelineStart=l,i||(i=o.duration===null),s||(s=!!o.error);const u=o.error?0:o.duration||0;r+=u}i&&!s?e.duration=Math.max(r,e.duration):e.duration=r}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function yn(n){return`[${n.event?'"'+n.event.identifier+'"':"primary"}: ${n.start.toFixed(2)}-${n.end.toFixed(2)}]`}class Kz{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const r=e.assetListUrl;let i;try{i=hk(r,this.hls.sessionId,e.baseUrl)}catch(f){const h=this.assignAssetListError(e,F.ASSET_LIST_LOAD_ERROR,f,r);this.hls.trigger(E.ERROR,h);return}t&&i.protocol!=="data:"&&Xi(i,"_HLS_start_offset",""+t);const s=this.hls.config,a=s.loader,o=new a(s),l={type:ve.INTERSTITIAL_ASSET_LIST,responseType:"json",url:i.href},u=s.interstitialAssetListLoadPolicy.default,c={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,h,p,m)=>{const g=f.data,y=g?.ASSETS;if(!Array.isArray(y)){const v=this.assignAssetListError(e,F.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),p.url,h,m);this.hls.trigger(E.ERROR,v);return}e.assetListResponse=g,this.hls.trigger(E.ASSET_LIST_LOADED,{event:e,assetListResponse:g,networkDetails:m})},onError:(f,h,p,m)=>{const g=this.assignAssetListError(e,F.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${f.code} ${f.text} (${h.url})`),h.url,m,p);this.hls.trigger(E.ERROR,g)},onTimeout:(f,h,p)=>{const m=this.assignAssetListError(e,F.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${h.url})`),h.url,f,p);this.hls.trigger(E.ERROR,m)}};return o.load(l,c,d),this.hls.trigger(E.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,r,i,s,a){return e.error=r,{type:re.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:r,networkDetails:a,stats:s}}}function sb(n){var e;n==null||(e=n.play())==null||e.catch(()=>{})}function Ss(n,e){return`[${n}] Advancing timeline position to ${e}`}class qz extends Cn{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.bufferPastEdge=!1,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const r=this.currentTime;if(r===void 0||this.playbackDisabled||!this.schedule)return;const i=r-this.timelinePos;if(Math.abs(i)<1/7056e5)return;const a=i<=-.01;this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),this.timelinePos=r,this.bufferedPos=r;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(r,r-i)&&this.updateSchedule(!0),this.checkBuffer(),a&&r<o.start||r>=o.end){var l;const h=this.findItemIndex(o);let p=this.schedule.findItemIndexAtTime(r);if(p===-1&&(p=h+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${r} (resolving from ${h} to ${p})`)),!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!a&&p>h){const m=this.schedule.findJumpRestrictedIndex(h+1,p);if(m>h){this.setSchedulePosition(m);return}}this.setSchedulePosition(p);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const h=o.event.assetList[0];h&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(r,h))}return}const c=u.timelineStart,d=u.duration||0;if(a&&r<c||r>=c+d){var f;(f=o.event)!=null&&f.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(r)),this.setScheduleToAssetAtTime(r,u)}},this.onTimeupdate=()=>{const r=this.currentTime;if(r===void 0||this.playbackDisabled)return;if(this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),r>this.timelinePos)this.timelinePos=r,r>this.bufferedPos&&this.checkBuffer();else return;const i=this.playingItem;if(!i||this.playingLastItem)return;if(r>=i.end){this.timelinePos=i.end;const o=this.findItemIndex(i);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const a=s.timelineStart+(s.duration||0);r>=a&&this.setScheduleToAssetAtTime(r,s)},this.onScheduleUpdate=(r,i)=>{const s=this.schedule;if(!s)return;const a=this.playingItem,o=s.events||[],l=s.items||[],u=s.durations,c=r.map(m=>m.identifier),d=!!(o.length||c.length);(d||i)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o} 114Schedule: ${l.map(m=>yn(m))} pos: ${this.timelinePos}`),c.length&&this.log(`Removed events ${c}`);let f=null,h=null;a&&(f=this.updateItem(a,this.timelinePos),this.itemsMatch(a,f)?this.playingItem=f:this.waitingItem=null),this.waitingItem=this.updateItem(this.waitingItem);const p=this.bufferingItem;if(p&&(h=this.updateItem(p,this.bufferedPos),this.itemsMatch(p,h)?this.bufferingItem=h:p.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(p.event,null))),r.forEach(m=>{m.assetList.forEach(g=>{this.clearAssetPlayer(g.identifier,null)})}),this.playerQueue.forEach(m=>{if(m.interstitial.appendInPlace){const g=m.assetItem.timelineStart,y=m.timelineOffset-g;if(y)try{m.timelineOffset=g}catch(v){Math.abs(y)>Qi&&this.warn(`${v} ("${m.assetId}" ${m.timelineOffset}->${g})`)}}}),d||i){if(this.hls.trigger(E.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:l.slice(0),durations:u,removedIds:c}),this.isInterstitial(a)&&c.indexOf(a.event.identifier)>-1){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(f,a),p&&h!==f&&this.trimInPlace(h,p),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Kz(e),this.schedule=new zz(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(E.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(E.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(E.MEDIA_ENDED,this.onMediaEnded,this),e.on(E.ERROR,this.onError,this),e.on(E.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(E.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(E.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(E.MEDIA_ENDED,this.onMediaEnded,this),e.off(E.ERROR,this.onError,this),e.off(E.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Oe(e,"play",this.onPlay),Oe(e,"pause",this.onPause),Oe(e,"seeking",this.onSeeking),Oe(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const r=this.media=t.media;Me(r,"seeking",this.onSeeking),Me(r,"timeupdate",this.onTimeupdate),Me(r,"play",this.onPlay),Me(r,"pause",this.onPause)}onMediaAttached(e,t){const r=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,r===null)this.checkStart();else if(!i){this.clearScheduleState();const s=this.findItemIndex(r);this.setSchedulePosition(s)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const r=!!t.transferMedia,i=this.media;if(this.media=null,!r&&(i&&this.removeMediaListeners(i),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.log(`Removing schedule state for detachedData and ${s}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,r=d=>d&&e.getAssetPlayer(d.identifier),i=(d,f,h,p,m)=>{if(d){let g=d[f].start;const y=d.event;if(y){if(f==="playout"||y.timelineOccupancy!==Nf.Point){const v=r(h);v?.interstitial===y&&(g+=v.assetItem.startOffset+v[m])}}else{const v=p==="bufferedPos"?a():e[p];g+=v-d.start}return g}return 0},s=(d,f)=>{var h;if(d!==0&&f!=="primary"&&(h=e.schedule)!=null&&h.length){var p;const m=e.schedule.findItemIndexAtTime(d),g=(p=e.schedule.items)==null?void 0:p[m];if(g){const y=g[f].start-g.start;return d+y}}return d},a=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?o("primary"):Math.max(d,0)},o=d=>{var f,h;return(f=e.primaryDetails)!=null&&f.live?e.primaryDetails.edge:((h=e.schedule)==null?void 0:h.durations[d])||0},l=(d,f)=>{var h,p;const m=e.effectivePlayingItem;if(m!=null&&(h=m.event)!=null&&h.restrictions.skip||!e.schedule)return;e.log(`seek to ${d} "${f}"`);const g=e.effectivePlayingItem,y=e.schedule.findItemIndexAtTime(d,f),v=(p=e.schedule.items)==null?void 0:p[y],S=e.getBufferingPlayer(),x=S?.interstitial,T=x?.appendInPlace,w=g&&e.itemsMatch(g,v);if(g&&(T||w)){const I=r(e.playingAsset),R=I?.media||e.primaryMedia;if(R){const A=f==="primary"?R.currentTime:i(g,f,e.playingAsset,"timelinePos","currentTime"),b=d-A,C=(T?A:R.currentTime)+b;if(C>=0&&(!I||T||C<=I.duration)){R.currentTime=C;return}}}if(v){let I=d;if(f!=="primary"){const A=v[f].start,b=d-A;I=v.start+b}const R=!e.isInterstitial(v);if((!e.isInterstitial(g)||g.event.appendInPlace)&&(R||v.event.appendInPlace)){const A=e.media||(T?S?.media:null);A&&(A.currentTime=I)}else if(g){const A=e.findItemIndex(g);if(y>A){const C=e.schedule.findJumpRestrictedIndex(A+1,y);if(C>A){e.setSchedulePosition(C);return}}let b=0;if(R)e.timelinePos=I,e.checkBuffer();else{const C=v.event.assetList,k=d-(v[f]||v).start;for(let $=C.length;$--;){const U=C[$];if(U.duration&&k>=U.startOffset&&k<U.startOffset+U.duration){b=$;break}}}e.setSchedulePosition(y,b)}}},u=()=>{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const f=t();return e.isInterstitial(f)?f:null},c={get bufferedEnd(){const d=t(),f=e.bufferingItem;if(f&&f===d){var h;return i(f,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-f.playout.start||((h=e.bufferingAsset)==null?void 0:h.startOffset)||0}return 0},get currentTime(){const d=u(),f=e.effectivePlayingItem;return f&&f===d?i(f,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-f.playout.start:0},set currentTime(d){const f=u(),h=e.effectivePlayingItem;h&&h===f&&l(d+h.playout.start,"playout")},get duration(){const d=u();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const f=(d=u())==null?void 0:d.event.assetList;return f?f.map(h=>e.getAssetPlayer(h.identifier)):[]},get playingIndex(){var d;const f=(d=u())==null?void 0:d.event;return f&&e.effectivePlayingAsset?f.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};return this.manager={get events(){var d;return((d=e.schedule)==null||(d=d.events)==null?void 0:d.slice(0))||[]},get schedule(){var d;return((d=e.schedule)==null||(d=d.items)==null?void 0:d.slice(0))||[]},get interstitialPlayer(){return u()?c:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const d=t();return e.findItemIndex(d)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const d=e.effectivePlayingItem;return e.findItemIndex(d)},primary:{get bufferedEnd(){return a()},get currentTime(){const d=e.timelinePos;return d>0?d:0},set currentTime(d){l(d,"primary")},get duration(){return o("primary")},get seekableStart(){return e.seekableStart}},integrated:{get bufferedEnd(){return i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){l(d,"integrated")},get duration(){return o("integrated")},get seekableStart(){return s(e.seekableStart,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,f=d?.event;if(f&&!f.restrictions.skip){const h=e.findItemIndex(d);if(f.appendInPlace){const p=d.playout.start+d.event.duration;l(p+.001,"playout")}else e.advanceAfterAssetEnded(f,h,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,r=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!r?!1:this.findItemIndex(t)===r.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const r=this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&!r.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(i=this.primaryMedia);const s=(t=i)==null?void 0:t.currentTime;if(!(s===void 0||!X(s)))return s}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const r=this.getAssetPlayer(e);r&&this.transferMediaFromPlayer(r,t)}transferMediaFromPlayer(e,t){const r=e.interstitial.appendInPlace,i=e.media;if(r&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i){this.detachedData={media:i};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${We(s)}`),this.detachedData=s}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var r,i;if(e.media===t)return;let s=null;const a=this.hls,o=e!==a,l=o&&e.interstitial.appendInPlace,u=(r=this.detachedData)==null?void 0:r.mediaSource;let c;if(a.media)l&&(s=a.transferMedia(),this.detachedData=s),c="Primary";else{const p=this.getBufferingPlayer();p?(s=p.transferMedia(),this.detachedData=s,c=`${p}`):u?c="detached MediaSource":c="detached media"}if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${We(s)}`);else if(!this.detachedData||a.media===t){const p=this.playerQueue;p.length>1&&p.forEach(m=>{if(o&&m.interstitial.appendInPlace!==l){const g=m.interstitial;this.clearInterstitial(m.interstitial,null),g.appendInPlace=!1,g.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${g}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const d=s&&"mediaSource"in s&&((i=s.mediaSource)==null?void 0:i.readyState)!=="closed";if(this.log(`${d?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${c} (media.currentTime: ${t.currentTime})`),!d&&!o){e.attachMedia(t);return}const f=d&&s?ie({},s):{media:t},h=this.schedule;if(h&&o){const p=e.assetId===h.assetIdAtEnd;f.overrides={duration:h.duration,endOfStream:p||e.appendInPlace===!1}}if(!d&&l){const p=e,m=p.assetItem.timelineStart;if(m){const g=p.hls,y=Math.max(this.timelinePos-m,Number.EPSILON);g.startPosition!==y&&(this.log(`Set ${p} startPosition: ${y}`),g.config.startPosition=y,g.loadingEnabled&&g.startLoad(y))}}e.attachMedia(f)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events,r=this.hls;if(!t||this.playbackDisabled||!this.media||!r)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,s=this.effectivePlayingItem;if(i===-1){if(!r.loadingEnabled){this.log("waiting for startLoad( <startPosition> )");return}const a=r.startPosition;if(this.timelinePos=a,t.length===0)this.setSchedulePosition(0);else if(t[0].cue.pre){this.log(Ss("checkStart (preroll)",a));const o=e.findEventIndex(t[0].identifier);this.setSchedulePosition(o)}else if(a>=0||!this.primaryLive){this.log(Ss("checkStart",a));const o=this.timelinePos=a>0?a:0,l=e.findItemIndexAtTime(o);this.setSchedulePosition(l)}else r.liveSyncPosition===0?this.setSchedulePosition(0):this.log("[checkStart] waiting for live start")}else if(s&&!this.playingItem){this.log(Ss("checkStart (playing item)",s.start));const a=e.findItemIndex(s);this.setSchedulePosition(a)}}advanceAssetBuffering(e,t){const r=e.event,i=r.findAssetIndex(t),s=wm(r,i);if(!r.isAssetPastPlayoutLimit(s))this.bufferedToEvent(e,s);else if(this.schedule){var a;const o=this.getNextItemIndex(e,!0),l=(a=this.schedule.items)==null?void 0:a[o];l&&this.bufferedToItem(l)}}livePrerollResumption(e,t){if(e.cue.pre&&this.primaryLive&&!X(e.resumeOffset)&&this.hls){const r=this.getLiveStartPos();if(t){const i=this.getBufferingPlayer(),s=i!=null&&i.interstitial.cue.pre?i.remaining:0;return r+s}return r}}getNextItemIndex(e,t){if(this.schedule){const r=this.livePrerollResumption(e.event,t);if(r!==void 0)return this.log(`find next item index @${r}`),this.schedule.findItemIndexAtTime(r)}return this.findItemIndex(e)+1}advanceAfterAssetEnded(e,t,r){const i=wm(e,r);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){const s=this.schedule.items;if(s){const a=s[t],o=a.event?this.getNextItemIndex(a):t+1,l=s.length;if(o>=l){this.setSchedulePosition(-1);return}const u=e.resumeTime;this.timelinePos<u&&(this.log(Ss("advanceAfterAssetEnded",u)),this.timelinePos=u,e.appendInPlace&&!s[o].event&&this.hls.startLoad(u+.01),this.checkBuffer(this.bufferedPos<u)),this.setSchedulePosition(o)}}}else{if(e.appendInPlace){const s=e.assetList[i];s&&this.advanceInPlace(s.timelineStart)}this.setSchedulePosition(t,i)}}setScheduleToAssetAtTime(e,t){const r=this.schedule;if(!r)return;const i=t.parentIdentifier,s=r.getEvent(i);if(s){const a=r.findEventIndex(i),o=r.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,a,o-1)}}setSchedulePosition(e,t){var r;const i=(r=this.schedule)==null?void 0:r.items;if(!i||this.playbackDisabled)return;const s=e>=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${s&&yn(s)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const d=a.event,f=this.playingAsset,h=f?.identifier,p=h?this.getAssetPlayer(h):null;if(p&&h&&(!this.eventItemsMatch(a,s)||t!==void 0&&h!==d.assetList[t].identifier)){var l;const m=d.findAssetIndex(f);if(this.log(`INTERSTITIAL_ASSET_ENDED ${m+1}/${d.assetList.length} ${va(f)}`),this.endedAsset=f,this.playingAsset=null,this.hls.trigger(E.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:m,event:d,schedule:i.slice(0),scheduleIndex:e,player:p}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(d,this.findItemIndex(this.playingItem),m);return}this.retreiveMediaSource(h,s),p.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&p.detachMedia()}if(!this.eventItemsMatch(a,s)&&(this.endedItem=a,this.playingItem=this.waitingItem=null,this.log(`INTERSTITIAL_ENDED ${d} ${yn(a)}`),d.hasPlayed=!0,this.hls.trigger(E.INTERSTITIAL_ENDED,{event:d,schedule:i.slice(0),scheduleIndex:e}),d.cue.once&&this.hls)){var u;this.updateSchedule();const m=(u=this.schedule)==null?void 0:u.items;if(s&&m){const g=this.findItemIndex(s),y=this.livePrerollResumption(d);if(y!==void 0){let v=y;const S=this.getNextItemIndex(a);if(!this.isInterstitial(i[S])){var c;const x=(c=this.primaryDetails)==null?void 0:c.fragments;if(d.snapOptions.in&&x){const T=po(null,x,y);T&&(v=Math.min(Math.max(i[S].start,Ad(v,T)),i[S].end))}}if(this.log(Ss("live join (preroll)",v)),this.timelinePos=v,S!==g&&(S||S===0)){this.advanceSchedule(S,m,void 0,a,o);return}}this.advanceSchedule(g,m,t,a,o)}return}}this.advanceSchedule(e,i,t,a,o)}advanceSchedule(e,t,r,i,s){const a=this.schedule;if(!a)return;const o=t[e]||null,l=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach(c=>{const d=c.interstitial,f=a.findEventIndex(d.identifier);(f<e||f>e+1)&&this.clearInterstitial(d,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const c=o.event;if(r===void 0){r=c.cue.pre?0:a.findAssetIndex(c,this.timelinePos);const p=wm(c,r-1);if(c.isAssetPastPlayoutLimit(p)||c.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(c,e,r);return}r=p}const d=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let f=this.preloadAssets(c,r);if(this.eventItemsMatch(o,d||i)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${yn(o)} ${c.appendInPlace?"append in place":""}`),c.hasPlayed=!1,this.hls.trigger(E.INTERSTITIAL_STARTED,{event:c,schedule:t.slice(0),scheduleIndex:e})),!c.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${c}`);return}if(c.assetListLoader&&(c.assetListLoader.destroy(),c.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${c}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const h=c.assetList[r];if(!h){this.advanceAfterAssetEnded(c,e,r||0);return}if(f||(f=this.getAssetPlayer(h.identifier)),f===null||f.destroyed){const p=c.assetList.length;this.warn(`asset ${r+1}/${p} player destroyed ${c}`),f=this.createAssetPlayer(c,h,r),f.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&c.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(f,r,t,e,l),this.shouldPlay&&sb(f.media)}else o?(this.resumePrimary(o,e,i),this.shouldPlay&&sb(this.hls.media)):s&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,r){var i,s;this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=null,this.bufferedToItem(e),this.endedItem=null,this.log(`resuming ${yn(e)}`);let a=this.timelinePos;if((i=this.detachedData)!=null&&i.mediaSource?this.primaryLive&&this.startLoadingPrimaryAt(a):((a<e.start||a>=e.end||a<this.seekableStart)&&(a=this.getPrimaryResumption(e,t),this.log(Ss("resumePrimary",a)),this.timelinePos=a),this.attachPrimary(a,e)),!r)return;const o=(s=this.schedule)==null?void 0:s.items;o&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${yn(e)}`),this.hls.trigger(E.INTERSTITIALS_PRIMARY_RESUMED,{schedule:o.slice(0),scheduleIndex:t}),this.checkBuffer())}get seekableStart(){var e;return this.primaryLive&&((e=this.primaryDetails)==null?void 0:e.fragmentStart)||0}getPrimaryResumption(e,t,r){const i=e.start;if(this.primaryLive){if(t===0)return this.hls.startPosition;const s=this.endedItem||this.playingItem,a=s!=null&&s.event?this.livePrerollResumption(s.event,r):void 0;if(a!==void 0)return a;const o=this.primaryDetails;if(o){const{fragmentStart:l,edge:u}=o;if(i<l||i>u&&!r){const c=this.hls.liveSyncPosition;return this.log(`primary resumption out of bounds (${i} [${l}-${u}]) snapping to liveSync ${c}`),c||l}}}return this.log(`primary resumption itemStart: ${i}`),i}getLiveStartPos(){var e;const t=this.hls.startPosition,r=this.hls.liveSyncPosition||0,i=(((e=this.primaryDetails)==null?void 0:e.targetduration)||10)*3;return t===-1||r&&r-t<i?r||0:t}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:le.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,r){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,i),r&&this.startLoadingPrimaryAt(e,r)),r||(this.log(Ss("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,r))}startLoadingPrimaryAt(e,t){const r=this.hls,{loadingEnabled:i,bufferingEnabled:s,startPosition:a}=r,o=r.hasEnoughToStart;if(this.log(`Start loading primary @${e} bufferedPos: ${this.bufferedPos} startPosition: ${a} skip seek: ${t} has enough ${o} loadingEnabled: ${i} bufferingEnabled: ${s}`),!t&&o||!i||Math.abs(a-e)>.1){const l=this.primaryDetails;if(l!=null&&l.live&&e+.5>=l.edge){const u=this.bufferingItem;this.log(`Resume primary loading when live passes ${e} buffering item: ${u?yn(u):null}`),r.pauseBuffering(),this.bufferPastEdge=!0;return}r.startLoad(e,t)}else s||r.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(E.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(E.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const r=this.hls.levels[t.level];if(!r.details)return;const i=ie(ie({},this.mediaSelection||this.altSelection),{},{main:r});this.mediaSelection=i;const s=this.hls.startPosition;if(this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace,s===-1?0:s),!!this.schedule.items){if(!this.effectivePlayingItem)this.checkStart();else if(this.bufferPastEdge){const o=this.primaryDetails,l=this.bufferedPos;if(o!=null&&o.live&&l+.5<o.edge){this.bufferPastEdge=!1;const u=this.bufferingItem;if(this.log(`Live edge ${o.edge} passed buffer: ${l} buffering item: ${u?yn(u):null}`),u?.end===1/0){const d=this.playingItem,f=this.isInterstitial(d)&&d.event.appendInPlace;this.hls.startLoad(Math.max(l,u.start),f)}else{const d=this.getBufferingPlayer();d&&d.bufferedInPlaceToEnd(this.primaryMedia,d.currentTime)&&d.hls&&d.hls.trigger(E.BUFFERED_TO_END,void 0)}}}}}onAudioTrackUpdated(e,t){const r=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=ie(ie({},this.altSelection),{},{audio:r});return}const s=ie(ie({},i),{},{audio:r});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const r=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=ie(ie({},this.altSelection),{},{subtitles:r});return}const s=ie(ie({},i),{},{subtitles:r});this.mediaSelection=s}onAudioTrackSwitching(e,t){const r=JT(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setAudioOption(t)||i.setAudioOption(r)))}onSubtitleTrackSwitch(e,t){const r=JT(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setSubtitleOption(t)||t.id!==-1&&i.setSubtitleOption(r)))}onBufferCodecs(e,t){const r=t.tracks;r&&(this.requiredTracks=r)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const r=this.playingItem;if(r&&!this.itemsMatch(r,this.bufferingItem)&&!this.isInterstitial(r)){const i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const i=t[r];if(i.cue.post){const s=this.getEventItem(i.identifier);s&&this.eventItemsMatch(s,this.bufferingItem)&&this.bufferedToItem(s,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const r=this.findItemIndex(t);this.setSchedulePosition(r+1)}else this.shouldPlay=!1}updateItem(e,t){var r;const i=(r=this.schedule)==null?void 0:r.items;if(e&&i){const s=this.findItemIndex(e,t);return i[s]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((s,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(s.identifier,null)});const r=e.end+.25,i=le.bufferInfo(this.primaryMedia,r,0);(i.end>r||(i.nextStart||0)>r)&&(this.log(`trim buffered interstitial ${yn(e)} (was ${yn(t)})`),this.attachPrimary(r,null,!0),this.flushFrontBuffer(r))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var r;return!!t&&(e===t||e.event.identifier===((r=t.event)==null?void 0:r.identifier))}findEventIndex(e){return this.schedule?this.schedule.findEventIndex(e):-1}getEventItem(e){if(this.schedule){var t;const r=(t=this.schedule.items)==null?void 0:t[this.findEventIndex(e)];if(this.isInterstitial(r)&&r.event.identifier===e)return r}}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t,r;const i=this.mediaSelection;if(!i)return;const s=((t=this.hls)==null?void 0:t.liveSyncPosition)||0;(r=this.schedule)==null||r.updateSchedule(i,[],s,e)}checkBuffer(e){var t;const r=(t=this.schedule)==null?void 0:t.items;if(!r)return;const i=le.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,r,e)}updateBufferedPos(e,t,r){const i=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let l=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var u;const c=this.findItemIndex(s),d=Math.min(c+1,t.length-1),f=t[d];if((l===-1&&s&&e>=s.end||(u=f.event)!=null&&u.appendInPlace&&e+.01>=f.start)&&(l=d),this.isInterstitial(s)){const h=s.event;if(d-o>1&&h.appendInPlace===!1||h.assetList.length===0&&h.assetListLoader)return}if(this.bufferedPos=e,l>c&&l>o)this.bufferedToItem(f);else{const h=this.primaryDetails;this.primaryLive&&h&&e>h.edge-h.targetduration&&f.start<h.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(f)&&this.preloadAssets(f.event,0)}}else r&&a&&!this.itemsMatch(a,s)&&(l===o?this.bufferedToItem(a):l===o+1&&this.bufferedToItem(t[l]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(i=>{const s=this.getAssetPlayer(i.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,r=this.schedule;if(!this.itemsMatch(e,t)&&r){const{items:i,events:s}=r;if(!i||!s)return t;const a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const l=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${yn(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const u=r.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((c,d)=>{const f=this.getAssetPlayer(c.identifier);f&&(d===u&&f.loadSource(),f.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering());this.hls.trigger(E.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const r=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(r!==null){this.bufferingAsset=null;const i=this.getPrimaryResumption(e,this.findItemIndex(e),!0),s=this.bufferedPos=Math.max(i,Math.min(this.bufferedPos,e.end),this.timelinePos,e.start),a=this.detachedData;if(a)a.mediaSource?this.attachPrimary(s,e,!0):this.startLoadingPrimaryAt(s);else{const o=this.playingItem,l=this.isInterstitial(o)&&o.event.appendInPlace;this.startLoadingPrimaryAt(s,l)}}}}bufferedToEvent(e,t){const r=e.event,i=r.assetList.length===0&&!r.assetListLoader,s=r.cue.once;if(i||!s){const a=this.preloadAssets(r,t);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,t){const r=e.assetUrl,i=e.assetList.length,s=i===0&&!e.assetListLoader,a=e.cue.once;if(s){const l=e.timelineStart,u=this.playingItem,c=this.getBufferingPlayer();if(e.appendInPlace){var o;!this.isInterstitial(u)&&(u==null||(o=u.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(l+.25)}let d,f=0;if((!c||c.interstitial.cue.pre)&&this.primaryLive&&(f=this.getLiveStartPos(),c&&(f+=c.remaining)),f&&!(e.cue.pre||e.cue.post)){const p=f-l;p>0&&(d=Math.round(p*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${r?1:i} ${e}${f?` live-start: ${f} start-offset: ${d} (timeline-start: ${l})`:""}`),r)return this.createAsset(e,0,0,l,e.duration,r);const h=this.assetListLoader.loadAssetList(e,d);h&&(e.assetListLoader=h)}else if(!a&&i){for(let u=t;u<i;u++){const c=e.assetList[u],d=this.getAssetPlayerQueueIndex(c.identifier);(d===-1||this.playerQueue[d].destroyed)&&!c.error&&this.createAssetPlayer(e,c,u)}const l=e.assetList[t];if(l){const u=this.getAssetPlayer(l.identifier);return u&&u.loadSource(),u}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;const r=this.primaryDetails;if(r&&e>=r.edge)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(s=>{this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:s})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let r=0;r<t.length;r++)if(e===t[r].assetId)return r;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let r=0;r<e.length;r++)if(e[r].media===t)return e[r]}return null}createAsset(e,t,r,i,s,a){const o={parentIdentifier:e.identifier,identifier:jz(e,a,t),duration:s,startOffset:r,timelineStart:i,uri:a};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,r){const i=this.hls,s=i.userConfig,a=i.loadLevelObj||i.levels[i.currentLevel],o=XL(a,s.videoPreference),l=i.audioTracks[i.audioTrack],u=i.subtitleTracks[i.subtitleTrack];let c=0;if(this.primaryLive||e.appendInPlace){const x=this.timelinePos-t.timelineStart;if(x>=0){const T=t.duration;T&&x<T&&(c=x)}}const d=t.identifier,f=ie(ie({},s),{},{maxMaxBufferLength:Math.min(15,i.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:i.bandwidthEstimate,interstitialsController:void 0,startPosition:c,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:l||s.audioPreference,subtitlePreference:u||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(f.timelineOffset=t.timelineStart));const h=f.cmcd;h!=null&&h.sessionId&&h.contentId&&(f.cmcd=Ne({},h,{contentId:Al(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const p=new Wz(this.HlsPlayerClass,f,e,t);this.playerQueue.push(p),e.assetList[r]=t;let m=!0;const g=x=>{if(x.live){const I=new Error(`Interstitials MUST be VOD assets ${e}`),R={fatal:!0,type:re.OTHER_ERROR,details:F.INTERSTITIAL_ASSET_ITEM_ERROR,error:I},A=this.findEventIndex(e.identifier);this.handleAssetItemError(R,e,A,r,I.message);return}const T=x.edge-x.fragmentStart,w=t.duration;(m||w===null||T>w)&&(m=!1,this.log(`Interstitial asset "${d}" duration change ${w} > ${T}`),t.duration=T,this.updateSchedule())};p.on(E.LEVEL_UPDATED,(x,{details:T})=>g(T)),p.on(E.LEVEL_PTS_UPDATED,(x,{details:T})=>g(T)),p.on(E.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const y=(x,T)=>{const w=this.getAssetPlayer(d);if(w&&T.tracks){w.off(E.BUFFER_CODECS,y),w.tracks=T.tracks;const I=this.primaryMedia;this.bufferingAsset===w.assetItem&&I&&!w.media&&this.bufferAssetPlayer(w,I)}};p.on(E.BUFFER_CODECS,y);const v=()=>{const x=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${x}`),!x||!this.schedule)return;const T=this.getEventItem(e.identifier);T&&this.advanceAssetBuffering(T,x.assetItem)};p.on(E.BUFFERED_TO_END,v);const S=x=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const w=this.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,w,x)};return p.once(E.MEDIA_ENDED,S(r)),p.once(E.PLAYOUT_LIMIT_REACHED,S(1/0)),p.on(E.ERROR,(x,T)=>{if(!this.schedule)return;const w=this.getAssetPlayer(d);if(T.details===F.BUFFER_STALLED_ERROR){if(w!=null&&w.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}else if(T.details===F.BUFFER_SEEK_OVER_HOLE)return;this.handleAssetItemError(T,e,this.findEventIndex(e.identifier),r,`Asset player error ${T.error} ${e}`)}),p.on(E.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const T=new Error(`Asset player destroyed unexpectedly ${d}`),w={fatal:!0,type:re.OTHER_ERROR,details:F.INTERSTITIAL_ASSET_ITEM_ERROR,error:T};this.handleAssetItemError(w,e,this.findEventIndex(e.identifier),r,T.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${va(t)}`),this.hls.trigger(E.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:r,event:e,player:p}),p}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(r=>{this.clearAssetPlayer(r.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const r=this.playerQueue[t];this.transferMediaFromPlayer(r,null),r.resetDetails()}}clearAssetPlayer(e,t){const r=this.getAssetPlayerQueueIndex(e);if(r!==-1){const i=this.playerQueue[r];this.log(`clear ${i} toSegment: ${t&&yn(t)}`),this.transferMediaFromPlayer(i,t),this.playerQueue.splice(r,1),i.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,r,i,s){const{interstitial:a,assetItem:o,assetId:l}=e,u=a.assetList.length,c=this.playingAsset;this.endedAsset=null,this.playingAsset=o,c?.identifier!==l&&(c&&(this.clearAssetPlayer(c.identifier,r[i]),delete c.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${va(o)}`),this.hls.trigger(E.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:a,schedule:r.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var r;if(!this.schedule)return;const{interstitial:i,assetItem:s}=e,a=this.getEventItem(i.identifier);if(!a)return;if(e.loadSource(),this.setBufferingItem(a),this.bufferingAsset=s,e.bufferedInPlaceToEnd(this.primaryMedia,e.currentTime)){this.advanceAssetBuffering(a,s);return}const o=this.getBufferingPlayer();if(o===e)return;const l=i.appendInPlace;if(l&&o?.interstitial.appendInPlace===!1)return;const u=o?.tracks||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(l&&s!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(u&&!bL(u,e.tracks)){const c=new Error(`Asset ${va(s)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(u)}')`),d={fatal:!0,type:re.OTHER_ERROR,details:F.INTERSTITIAL_ASSET_ITEM_ERROR,error:c},f=i.findAssetIndex(s);this.handleAssetItemError(d,i,this.findEventIndex(i.identifier),f,c.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,r=this.primaryMedia;if(!t||!r)return;const i=r.currentTime,s=t.findAssetIndex(e,i),a=e.assetList[s];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const l=o.currentTime||i-a.timelineStart,u=o.duration-l;if(this.warn(`Stalled at ${l} of ${l+u} in ${o} ${e} (media.currentTime: ${i})`),l&&(u/r.playbackRate<.5||o.bufferedInPlaceToEnd(r,o.currentTime))&&o.hls){const c=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,c,s)}}}}advanceInPlace(e){const t=this.primaryMedia;if(t&&t.currentTime<e){const r=`advance currentTime to ${e}, duration: ${t.duration}`;t.duration>e?(this.log(r),t.currentTime=e):this.log(`Cannot ${r}`)}}handleAssetItemError(e,t,r,i,s){if(e.details===F.BUFFER_STALLED_ERROR)return;const a=t.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&va(a)} ${e.error}`),!this.schedule)return;const o=a?.identifier||"",l=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[l]||null,c=this.schedule.items,d=Ne({},e,{fatal:!1,errorAction:Il(!0),asset:a,assetListIndex:i,event:t,schedule:c,scheduleIndex:r,player:u});if(this.hls.trigger(E.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const f=this.playingAsset,h=this.bufferingAsset,p=new Error(s);if(a&&(this.clearAssetPlayer(o,null),a.error=p),!t.assetList.some(m=>!m.error))t.error=p;else for(let m=i;m<t.assetList.length;m++)this.resetAssetPlayer(t.assetList[m].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):f?.identifier===o?this.advanceAfterAssetEnded(t,r,i):h?.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,h)}primaryFallback(e){const t=e.timelineStart,r=this.effectivePlayingItem,i=this.playingItem,s=this.seekableStart,a=this.hls.startPosition;let o=this.timelinePos;if(this.isInterstitial(r)){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${o} playing: ${yn(r)} startPosition: ${a} seekableStart: ${s} error: ${e.error}`),o===-1&&(o=a),o=Math.max(o,s);const u=this.updateItem(r,o);this.itemsMatch(r,u)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(o===-1){this.checkStart();return}if(!this.schedule||!this.isInterstitial(i))return;const l=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(l)}onAssetListLoaded(e,t){var r,i;const s=t.event,a=s.identifier,o=t.assetListResponse.ASSETS;if(!((r=this.schedule)!=null&&r.hasEvent(a)))return;const l=s.timelineStart,u=s.duration;let c=0;o.forEach((p,m)=>{const g=parseFloat(p.DURATION);this.createAsset(s,m,c,l+c,g,p.URI),c+=g}),s.duration=c,this.log(`Loaded asset-list with duration: ${c} (was: ${u}) ${s}`);
114const d=this.waitingItem,f=d?.event.identifier===a;this.updateSchedule();const h=(i=this.bufferingItem)==null?void 0:i.event;if(f){const p=this.findEventIndex(a),m=this.getEventItem(a);if(m){if(!this.playingItem&&this.timelinePos>m.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==p){s.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${s}`),this.log(s.error.message),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(m)}this.setSchedulePosition(p)}else if(h?.identifier===a){const p=s.assetList[0];if(p){const m=this.getAssetPlayer(p.identifier);if(h.appendInPlace){const g=this.primaryMedia;m&&g&&this.bufferAssetPlayer(m,g)}else m&&m.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case F.ASSET_LIST_PARSING_ERROR:case F.ASSET_LIST_LOAD_ERROR:case F.ASSET_LIST_LOAD_TIMEOUT:{const r=t.interstitial;r&&(this.updateSchedule(!0),this.primaryFallback(r));break}case F.BUFFER_STALLED_ERROR:{const r=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&r.event.appendInPlace){this.handleInPlaceStall(r.event);return}const i=this.primaryMedia;this.log(`Primary player stall @${this.timelinePos} currentTime: ${i?.currentTime} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}class Yz{constructor(e){this.hls=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{var t;const{media:r}=this,i=this.levelDetails;if(!r||!i||!this.hls)return;this.currentTime=r.currentTime;const s=this.hls.config,a=this.computeLatency();if(a===null)return;this._latency=a;const{lowLatencyMode:o,maxLiveSyncPlaybackRate:l}=s;if(!o||l===1||!i.live)return;const u=this.targetLatency;if(u===null)return;const c=a-u,d=Math.min(this.maxLatency,u+i.targetduration),f=c<d,h=Pf(s)&&!!((t=this.hls.interstitialsManager)!=null&&(t=t.playingItem)!=null&&t.event);if(f&&c>.05&&this.forwardBufferLength>1&&!h){const p=Math.min(2,Math.max(1,l)),m=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,g=Math.min(p,Math.max(1,m));this.changeMediaPlaybackRate(r,g)}else r.playbackRate!==1&&r.playbackRate!==0&&this.changeMediaPlaybackRate(r,1)},this.hls=e,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){var e;const t=(e=this.hls)==null?void 0:e.config;if(!t)return 0;if(t.liveMaxLatencyDuration!==void 0)return t.liveMaxLatencyDuration;const r=this.levelDetails;return r?t.liveMaxLatencyDurationCount*r.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||!this.hls)return null;const t=this.hls.config,{holdBack:r,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:a,liveSyncDurationCount:o,lowLatencyMode:l}=t,u=this.hls.userConfig;let c=l&&i||r;(this._targetLatencyUpdated||u.liveSyncDuration||u.liveSyncDurationCount||c===0)&&(c=a!==void 0?a:o*s);const d=s;return c+Math.min(this.stallCount*t.liveSyncOnStallIncrease,d)}set targetLatency(e){this.hls&&(this.stallCount=0,this.hls.config.liveSyncDuration=e,this._targetLatencyUpdated=!0)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null||!this.hls)return null;const r=this.levelDetails;if(r===null)return null;const i=r.edge,s=e-t-this.edgeStalled,a=i-r.totalduration,o=i-(this.hls.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,s),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null||!this.hls)return 0;const t=(this.hls.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const r=e.buffered.length;return(r?e.buffered.end(r-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.ERROR,this.onError,this),e.on(E.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))}unregisterListeners(){const{hls:e}=this;
vendor: 43,939 bytes, lines 114-115
114e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.ERROR,this.onError,this),e.off(E.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onAssetStarted(e,t){var r;const i=this.hls,s=this.media||t.event.appendInPlace&&(i==null||(r=i.interstitialsManager)==null?void 0:r.playerQueue.reduce((a,o)=>a||o.media,null));i&&s&&s.playbackRate>1&&s.playbackRate<=i.config.maxLiveSyncPlaybackRate&&this.changeMediaPlaybackRate(s,1)}onError(e,t){var r;t.details===F.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(r=this.levelDetails)!=null&&r.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var r,i;e.playbackRate!==t&&((r=this.hls)==null||r.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(i=this.targetLatency)==null?void 0:i.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const ab=500;class Xz extends eS{constructor(e,t,r){super(e,t,r,"subtitle-stream-controller",te.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=H.IDLE,this.setInterval(ab),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:r,part:i,success:s}=t;if(!s)return;const a=this.tracksBuffered[this.currentTrackId];if(!a)return;let o;const l=(i||r).start;for(let c=0;c<a.length;c++)if(l>=a[c].start&&l<=a[c].end){o=a[c];break}const u=l+(i||r).duration;if(o?o.end=u:(o={start:l,end:u},a.push(o)),!i||u>=r.end){const c=this.fragmentTracker.fragBuffered(r);i&&c&&(c.range.subs={time:[{startPTS:r.start,endPTS:u}],partial:!0}),at(r)&&!this.fragContextChanged(r)&&(this.fragPrevious=r),this.fragBufferedComplete(r,i),this.media&&this.tickImmediate()}}onBufferFlushing(e,t){const{startOffset:r,endOffset:i}=t;if(r===0&&i!==Number.POSITIVE_INFINITY){const s=i-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(a=>{if(a)for(let o=0;o<a.length;){if(a[o].end<=s){a.shift();continue}else if(a[o].start<s)a[o].start=s;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(r,s,te.SUBTITLE)}}onError(e,t){const r=t.frag;r?.type===te.SUBTITLE&&(t.details===F.FRAG_GAP&&this.fragmentTracker.addAsGap(r),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==H.STOPPED&&(this.state=H.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&MC(this.levels,t)){this.levels=t.map(r=>new mu(r));return}this.tracksBuffered=[],this.levels=t.map(r=>{const i=new mu(r);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,te.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var r;if(this.currentTrackId=t.id,this.abortCurrentFrag(),!((r=this.levels)!=null&&r.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];if(!(i!=null&&i.details)){this.mediaBuffer=null;return}this.mediaBuffer=this.mediaBufferTimeRanges,this.state!==H.STOPPED&&this.setInterval(ab)}onSubtitleTrackLoaded(e,t){var r;const{currentTrackId:i,levels:s}=this,{details:a,id:o}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=s[o];if(o>=s.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;const u=this.mainDetails;let c=0;if(a.live||(r=l.details)!=null&&r.live){if(a.deltaUpdateFailed)return;if(!u){this.startFragRequested=!1;return}if(l.details){var d;c=this.alignPlaylists(a,l.details,(d=this.levelLastLoaded)==null?void 0:d.details)}a.alignedSliding||(kf(u,a,this),c=a.fragmentStart)}l.details=a,this.levelLastLoaded=l,u&&!this.startFragRequested&&this.setStartPosition(u,c),o===i&&(this.hls.trigger(E.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tickImmediate())}_handleFragmentLoadProgress(e){const{frag:t,part:r,payload:i}=e;!r||!(i!=null&&i.byteLength)||!this.shouldDecrypt(t)||this.decryptPayload(i,t,r)}_handleFragmentLoadComplete(e){const{frag:t,payload:r}=e;this.fragContextChanged(t)||!(r!=null&&r.byteLength)||!this.shouldDecrypt(t)||this.decryptPayload(r,t,null)}shouldDecrypt(e){const t=e.decryptdata;return!!(t!=null&&t.key&&t.iv&&Wa(t.method))}decryptPayload(e,t,r){const i=t.decryptdata,s=performance.now();this.decrypter.decrypt(new Uint8Array(e),i.key.buffer,i.iv.buffer,Jv(i.method)).then(a=>{this.fragContextChanged(t)||this.hls.trigger(E.FRAG_DECRYPTED,{frag:t,part:r,payload:a,stats:{tstart:s,tdecrypt:performance.now()}})}).catch(a=>{this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t,part:r}),r||(this.warn(`${a.name}: ${a.message}`),this.state=H.IDLE)})}doTick(){if(this.state===H.IDLE&&this.levels){var e;if(!this.media&&!this.primaryPrefetch&&(this.startFragRequested||!this.config.startFragPrefetch))return;const{currentTrackId:r,levels:i}=this,s=i[r],a=s?.details;if(!a||this.waitForLive(s)||this.waitForCdnTuneIn(a)){this.startFragRequested=!1;return}const{config:o}=this,l=this.playhead,u=le.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],l,o.maxBufferHole),{end:c,len:d}=u,f=Math.max(this.hls.maxBufferLength+a.levelTargetDuration,((e=this.hls.mainForwardBufferInfo)==null?void 0:e.len)||0);if(d>f||d&&!this.buffering)return;let h=this.getNextFragment(c,a);if(!h)return;if(at(h)){var t;const p=h.sn-a.startSN,m=a.fragments[p-1];h.cc===m?.cc&&!((t=a.partList)!=null&&t.length)&&this.fragmentTracker.getState(m)===rt.NOT_LOADED&&(h=m)}this.loadFragment(h,s,c)}}loadFragment(e,t,r){const i=this.fragmentTracker.getState(e);(i===rt.NOT_LOADED||i===rt.PARTIAL)&&super.loadFragment(e,t,r)}get mediaBufferTimeRanges(){return new Qz(this.tracksBuffered[this.currentTrackId]||[])}}class Qz{constructor(e){this.buffered=void 0;const t=(r,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${r}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][r]};this.buffered={get length(){return e.length},end(r){return t("end",r,e.length)},start(r){return t("start",r,e.length)}}}}const Jz={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},pk=n=>String.fromCharCode(Jz[n]||n),ir=15,rr=42,Zz={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},e9={17:2,18:4,21:6,22:8,23:10,19:13,20:15},t9={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},n9={25:2,26:4,29:6,30:8,31:10,27:13,28:15},r9=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class i9{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const r=typeof t=="function"?t():t;Pe.log(`${this.time} [${e}] ${r}`)}}}const Es=function(e){const t=[];for(let r=0;r<e.length;r++)t.push(e[r].toString(16));return t},U0=Object.freeze({foreground:"white",underline:!1,italics:!1,background:"black",flash:!1});class mk{constructor(){this.styles=U0}get foreground(){return this.styles.foreground}set foreground(e){const t=this.styles;this.styles={foreground:e,underline:t.underline,italics:t.italics,background:t.background,flash:t.flash}}get underline(){return this.styles.underline}set underline(e){const t=this.styles;this.styles={foreground:t.foreground,underline:e,italics:t.italics,background:t.background,flash:t.flash}}get italics(){return this.styles.italics}set italics(e){const t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:e,background:t.background,flash:t.flash}}get background(){return this.styles.background}set background(e){const t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:t.italics,background:e,flash:t.flash}}get flash(){return this.styles.flash}set flash(e){const t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:t.italics,background:t.background,flash:e}}reset(){this.styles=U0}setStyles(e){const t=this.styles,r=Object.prototype.hasOwnProperty;this.styles={foreground:r.call(e,"foreground")?e.foreground:t.foreground,underline:r.call(e,"underline")?e.underline:t.underline,italics:r.call(e,"italics")?e.italics:t.italics,background:r.call(e,"background")?e.background:t.background,flash:r.call(e,"flash")?e.flash:t.flash}}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class s9{constructor(){this.uchar=" ",this.penState=new mk}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.styles=t.styles}setPenState(e){this.penState.styles=e.styles}copy(e){this.uchar=e.uchar,this.penState.styles=e.penState.styles}}class a9{constructor(e){this.chars=[],this.pos=0,this.currPenState=new mk,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<rr;t++)this.chars.push(new s9);this.logger=e}equals(e){const t=this.chars,r=e.chars;for(let i=0;i<rr;i++){const s=t[i],a=r[i];if(s.uchar!==a.uchar)return!1;const o=s.penState.styles,l=a.penState.styles;if(o!==l&&(o.foreground!==l.foreground||o.underline!==l.underline||o.italics!==l.italics||o.background!==l.background||o.flash!==l.flash))return!1}return!0}copy(e){for(let t=0;t<rr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){const e=this.chars;for(let t=0;t<rr;t++){const r=e[t];if(r.uchar!==" ")return!1;const i=r.penState.styles;if(i!==U0&&(i.foreground!=="white"||i.underline||i.italics||i.background!=="black"||i.flash))return!1}return!0}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>=rr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=rr-1)}moveCursor(e){const t=Math.min(this.pos+e,rr);if(e>1)for(let r=this.pos+1;r<t;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=pk(e);if(this.pos>=rr){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<rr;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let r=0;r<rr;r++){const i=this.chars[r].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Am{constructor(e){this.rows=[],this.currRow=ir-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<ir;t++)this.rows.push(new a9(e));this.logger=e}reset(){for(let e=0;e<ir;e++)this.rows[e].clear();this.currRow=ir-1}equals(e){let t=!0;for(let r=0;r<ir;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}copy(e){for(let t=0;t<ir;t++){const r=this.rows[t].chars,i=e.rows[t].chars;for(let s=0;s<rr;s++){const a=r[s],o=i[s];a.uchar=o.uchar,a.penState.styles=o.penState.styles}}}isEmpty(){let e=!0;for(let t=0;t<ir;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+We(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<ir;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[s].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(a.rows[s+u])}}this.currRow=t;const r=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,a=Math.max(s-1,0);r.setCursor(e.indent),e.color=r.chars[a].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+We(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let r="",i=-1;for(let s=0;s<ir;s++){const a=this.rows[s].getTextString();a&&(i=s+1,e?t.push("Row "+i+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?r="["+t.join(" | ")+"]":r=t.join(` 115`)),r}getTextAndFormat(){return this.rows}}class o9{constructor(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Am(r),this.nonDisplayedMemory=new Am(r),this.lastOutputScreen=new Am(r),this.currRollUpRow=this.displayedMemory.rows[ir-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[ir-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let r=0;r<e.length;r++)this.writeScreen.insertChar(e[r]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const r=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[r]}this.logger.log(2,"MIDROW: "+We(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class ob{constructor(e,t,r){this.channels=[null,null,null],this.currentChannel=0,this.cmdHistory=u9(),this.logger=void 0,this.field=void 0,this.outputFilters=void 0,this.logger=new i9,this.field=e,this.outputFilters=[null,t,r]}getHandler(e){return this.outputFilters[e]}setHandler(e,t){var r;this.outputFilters[e]=t,(r=this.channels[e])==null||r.setHandler(t)}getChannel(e){let t=this.channels[e];return t||(t=this.channels[e]=new o9(this.field+e-1,this.outputFilters[e],this.logger)),t}addData(e,t){this.logger.time=e;for(let r=0;r<t.length;r+=2){const i=t[r]&127,s=t[r+1]&127;let a=!1,o=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+Es([t[r],t[r+1]])+"] -> ("+Es([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(l9(i,s,l)){$c(null,null,l),this.logger.log(3,()=>"Repeated command ("+Es([i,s])+") is dropped");continue}$c(i,s,this.cmdHistory),a=this.parseCmd(i,s),a||(a=this.parseMidrow(i,s)),a||(a=this.parsePAC(i,s)),a||(a=this.parseBackgroundAttributes(i,s))}else $c(null,null,l);if(!a&&(o=this.parseChars(i,s),o)){const c=this.currentChannel;c&&c>0?this.getChannel(c).insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Es([i,s])+" orig: "+Es([t[r],t[r+1]]))}}parseCmd(e,t){const r=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(r||i))return!1;const s=e===20||e===21||e===23?1:2,a=this.getChannel(s);return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=s,!0}parseMidrow(e,t){let r=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?r=1:r=2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[r];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Es([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let r;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(i||s))return!1;const a=e<=23?1:2;return t>=64&&t<=95?r=a===1?Zz[e]:t9[e]:r=a===1?e9[e]:n9[e],this.getChannel(a).setPAC(this.interpretPAC(r,t)),this.currentChannel=a,!0}interpretPAC(e,t){let r;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?r=t-96:r=t-64,i.underline=(r&1)===1,r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((r-16)/2)*4,i}parseChars(e,t){let r,i=null,s=null;if(e>=25?(r=2,s=e-8):(r=1,s=e),s>=17&&s<=19){let a;s===17?a=t+80:s===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+pk(a)+"' in channel "+r),i=[a]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+Es(i).join(",")),i}parseBackgroundAttributes(e,t){const r=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(r||i))return!1;let s;const a={};e===16||e===24?(s=Math.floor((t-32)/2),a.background=r9[s],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const o=e<=23?1:2;return this.getChannel(o).setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}$c(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const r=this.channels[t];r&&r.cueSplitAtTime(e)}}}function $c(n,e,t){t.a=n,t.b=e}function l9(n,e,t){return t.a===n&&t.b===e}function u9(){return{a:null,b:null}}class Gc{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,r){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class c9{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.cueCache={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=lb(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.cueCache={},this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Gc(this,"textTrack1"),t=new Gc(this,"textTrack2"),r=new Gc(this,"textTrack3"),i=new Gc(this,"textTrack4");this.cea608Parser1=new ob(1,e,t),this.cea608Parser2=new ob(3,r,i)}addCues(e,t,r,i,s){let a=!1;for(let l=s.length;l--;){const u=s[l],c=d9(u[0],u[1],t,r);if(c>=0&&(u[0]=Math.min(u[0],t),u[1]=Math.max(u[1],r),a=!0,c/(r-t)>.5))return}if(a||s.push([t,r]),this.config.renderTextTracksNatively){const l=this.cueCache[e];if(l){const u=this.Cues.newCue(null,t,r,i);u.length&&l.push.apply(l,u)}else{const u=this.captionsTracks[e].track;this.Cues.newCue(u,t,r,i)}}else{var o;const l=this.Cues.newCue(null,t,r,i),u=(o=this.captionsProperties[e])==null?void 0:o.media;this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:l,track:e,closedCaptions:u})}}onInitPtsFound(e,{id:t,timestampOffsets:r}){const{unparsedVttFrags:i}=this;t===te.MAIN&&(this.initPTS=r),i.length&&(this.unparsedVttFrags=[],i.forEach(s=>{this.initPTS[s.frag.cc]?this.onFragLoaded(E.FRAG_LOADED,s):this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s.frag,part:null,error:new Error("Subtitle discontinuity domain does not match main")})}))}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:r,cueCache:i,media:s}=this,{label:a,languageCode:o}=t[e];s&&(i[e]=[],r[e]=gS(s,"captions",a,o,"hidden"))}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const r=t.label,i={_id:e,label:r,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}onMediaAttaching(e,t){this.media=t.media}onMediaDetaching(e,t){const r=!!t.transferMedia;if(this.media=null,!r){if(this.config.renderTextTracksNatively){const{captionsTracks:i,cueCache:s}=this;for(const a in i)i[a].remove(),delete s[a]}this.cueCache={},this.captionsTracks={},this.nonNativeCaptionsTracks={}}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=lb(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}onSubtitleTracksUpdated(e,t){const r=t.subtitleTracks||[];if(r.length&&!this.config.renderTextTracksNatively&&!MC(this.tracks,r)){const i=r.map(s=>({label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:i})}this.tracks=r}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(r=>{const i=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(!i)return;const s=`textTrack${i[1]}`,a=this.captionsProperties[s];a&&(a.label=r.name,r.lang&&(a.languageCode=r.lang),a.media=r)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===te.MAIN){var r,i;const{cea608Parser1:s,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:u}=t.frag,c=(r=(i=t.part)==null?void 0:i.index)!=null?r:-1;s&&a&&(u!==o+1||u===o&&c!==this.lastPartIndex+1||l!==this.lastCc)&&(s.reset(),a.reset()),this.lastCc=l,this.lastSn=u,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:r,payload:i}=t;if(r.level<this.tracks.length&&r.type===te.SUBTITLE){var s;if(i.byteLength||(s=r.initSegment)!=null&&(s=s.data)!=null&&s.byteLength){const a=r.decryptdata,o="stats"in t;if(a==null||!a.encrypted||o){const l=this.tracks[r.level],u=this.vttCCs;u[r.cc]||(u[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),l?.textCodec===O0?this._parseIMSC1(t):this._parseVTTs(t)}}else{const a="part"in t?t.part:null;this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,part:a,error:new Error("Empty subtitle payload")})}}}_parseIMSC1(e){const{frag:t,payload:r}=e,i="part"in e?e.part:null,s=this.hls;Q_(r,this.initPTS[t.cc],a=>{this._appendCues(a,t.level),s.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t,part:i})},a=>{s.logger.log(`Cannot parse IMSC1 (sn: ${t.sn} @${t.start}): ${a}`),s.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,part:i,error:a})})}_parseVTTs(e){var t;const{frag:r,payload:i}=e,s="part"in e?e.part:null,{initPTS:a,unparsedVttFrags:o}=this,l=a.length-1;if(!a[r.cc]&&l===-1){o.push(e);return}const u=this.hls,c=(t=r.initSegment)==null?void 0:t.data,d=c?Kn(c,new Uint8Array(i)).buffer:i;Sz(d,this.initPTS[r.cc],this.vttCCs,r.cc,(s&&!c?s:r).start,f=>{this._appendCues(f,r.level),u.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r,part:s})},f=>{const h=f.message.startsWith("Missing initPTS");if(u.logger.log(`${h?"Deferred parsing of":"Cannot parse"} VTT cue (sn: ${r.sn} @${r.start}): ${f}`),h){o.push(e);return}else this.config.enableIMSC1&&this._fallbackToIMSC1(e);u.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,part:s,error:f})})}_fallbackToIMSC1(e){const{frag:t,payload:r}=e,i=this.tracks[t.level];i.textCodec||Q_(r,this.initPTS[t.cc],()=>{i.textCodec=O0,this._parseIMSC1(e)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const r=this.hls;if(this.config.renderTextTracksNatively){var i;const s=(i=this.tracks[t].trackNode)==null?void 0:i.track;if(!s||s.mode==="disabled")return;e.forEach(a=>M0(s,a))}else{const s=this.tracks[t];if(!s)return;const a=s.default?"default":"subtitles"+t;r.trigger(E.CUES_PARSED,{type:"subtitles",cues:e,track:a,subtitleTrack:s})}}onFragDecrypted(e,t){const{frag:r}=t;r.type===te.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:r,samples:i}=t;if(!(r.type===te.MAIN&&this.closedCaptionsForLevel(r)==="NONE"))for(let s=0;s<i.length;s++){const a=i[s].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(a);this.cea608Parser1.addData(i[s].pts,o[0]),this.cea608Parser2.addData(i[s].pts,o[1])}}}onBufferAppended(e,t){if(this.config.renderTextTracksNatively){var r;const{type:i,timeRanges:s}=t;if(i==="video"&&(r=s[i])!=null&&r.length){const{captionsTracks:a,cueCache:o}=this;Object.keys(o).forEach(l=>{var u;const c=(u=a[l])==null?void 0:u.track;if(c){const d=o[l];for(let f=0;f<d.length;f++)M0(c,d[f])}delete o[l]})}}}onBufferFlushing(e,t){const{startOffset:r,endOffset:i,endOffsetSubtitles:s,type:a}=t,{media:o}=this;if(!(!o||o.currentTime<i)){if(!a||a==="video"){const{captionsTracks:l,cueCache:u}=this;Object.keys(l).forEach(c=>F0(l[c].track,r,i)),Object.keys(u).forEach(c=>{const d=u[c];for(let f=d.length;f--;){const h=d[f];h.startTime>=r&&h.endTime<=i&&d.splice(f,1)}})}this.config.renderTextTracksNatively&&r===0&&s!==void 0&&this.tracks.forEach(l=>{var u;const c=(u=l.trackNode)==null?void 0:u.track;c&&F0(c,r,s)})}}extractCea608Data(e){const t=[[],[]],r=e[0]&31;let i=2;for(let s=0;s<r;s++){const a=e[i++],o=127&e[i++],l=127&e[i++];if(o===0&&l===0)continue;if((4&a)!==0){const c=3&a;(c===0||c===1)&&(t[c].push(o),t[c].push(l))}}return t}}function d9(n,e,t,r){return Math.min(e,r)-Math.max(n,t)}function lb(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const f9=/\s/,h9={newCue(n,e,t,r){const i=[];let s,a,o,l,u;const c=self.VTTCue||self.TextTrackCue;for(let f=0;f<r.rows.length;f++)if(s=r.rows[f],o=!0,l=0,u="",!s.isEmpty()){var d;for(let m=0;m<s.chars.length;m++)f9.test(s.chars[m].uchar)&&o?l++:(u+=s.chars[m].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const h=sk(u.trim()),p=mS(e,t,h);n!=null&&(d=n.cues)!=null&&d.getCueById(p)||(a=new c(e,t,h),a.id=p,a.line=f+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(a))}return n&&i.length&&(i.sort((f,h)=>f.line==="auto"||h.line==="auto"?0:f.line>8&&h.line>8?h.line-f.line:f.line-h.line),i.forEach(f=>M0(n,f))),i}};class gk{constructor(){this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=0,this.config=null,this.callbacks=null,this.context=null,this.stats=new jv}destroy(){this.callbacks=this.context=this.config=null,this.abortInternal(),this.stats=null}load(e,t,r){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.loadInternal()}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.getNetworkDetails())}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(uu(e,t,!0))this.retry(e);else{var r;Pe.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.getNetworkDetails()))}}retry(e){const{context:t,stats:r}=this;this.retryDelay=Hv(e,r.retry),r.retry++,Pe.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${r.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.resetInternalLoader(),self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(()=>this.loadInternal(),this.retryDelay)}}function p9(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const m9=/(\d+)-(\d+)\/(\d+)/;class ub extends gk{constructor(e){super(),this.fetchSetup=void 0,this.request=null,this.response=null,this.controller=null,this.fetchSetup=e.fetchSetup||S9}destroy(){this.request=null,super.destroy(),this.response=null,this.controller=null,this.fetchSetup=null}abortInternal(){self.clearTimeout(this.retryTimeout),this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}getNetworkDetails(){return this.response}resetInternalLoader(){this.response=null}loadInternal(){const{config:e,context:t,stats:r}=this;if(!e||!t)return;r.loading.first=0,r.loaded=0,r.aborted=!1,this.controller=new self.AbortController;const i=g9(t,this.controller.signal),s=t.responseType==="arraybuffer",a=s?"byteLength":"length",{maxTimeToFirstByteMs:o,maxLoadTimeMs:l}=e.loadPolicy;this.request=this.fetchSetup(t,i),self.clearTimeout(this.requestTimeout),e.timeout=o&&X(o)?o:l,this.requestTimeout=self.setTimeout(()=>{this.loadtimeout()},e.timeout),(vu(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(c=>{var d;this.response=c;const f=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.loadtimeout()},l-(f-r.loading.start)),!c.ok){const{status:p,statusText:m}=c;throw new E9(m||"fetch, bad network response",p,c)}r.loading.first=f,r.total=v9(c.headers)||r.total;const h=(d=this.callbacks)==null?void 0:d.onProgress;return h&&X(e.highWaterMark)?this.loadProgressively(c,r,t,e.highWaterMark,h):s?c.arrayBuffer():t.responseType==="json"?c.json():c.text()}).then(c=>{var d,f;const h=this.response;if(!h)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const p=c[a];p&&(r.loaded=r.total=p);const m={url:h.url,data:c,code:h.status},g=(d=this.callbacks)==null?void 0:d.onProgress;g&&!X(e.highWaterMark)&&g(r,t,c,h),(f=this.callbacks)==null||f.onSuccess(m,r,t,h)}).catch(c=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const d=c&&c.code||0,f=c?c.message:null,h=e.loadPolicy.errorRetry,p=r.retry,m={url:t.url,data:void 0,code:d};if(uu(h,p,!1,m))this.retry(h);else{var g;Pe.error(`${d} while loading ${t.url}`),(g=this.callbacks)==null||g.onError({code:d,text:f},t,c?c.details:null,r)}})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,r,i=0,s){const a=new yC,o=e.body.getReader(),l=()=>o.read().then(u=>{if(u.done)return a.dataLength&&s(t,r,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const c=u.value,d=c.length;return t.loaded+=d,d<i||a.dataLength?(a.push(c),a.dataLength>=i&&s(t,r,a.flush().buffer,e)):s(t,r,c.buffer,e),l()}).catch(()=>Promise.reject());return l()}}function g9(n,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ne({},n.headers))};return n.rangeEnd&&t.headers.set("Range","bytes="+n.rangeStart+"-"+String(n.rangeEnd-1)),t}function y9(n){const e=m9.exec(n);if(e)return parseInt(e[2])-parseInt(e[1])+1}function v9(n){const e=n.get("Content-Range");if(e){const r=y9(e);if(X(r))return r}const t=n.get("Content-Length");if(t)return parseInt(t)}function S9(n,e){return new self.Request(n.url,e)}class E9 extends Error{constructor(e,t,r){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=r}}const x9=(n,e,t)=>Math.max(e,Math.min(n,t)),T9=/^age:\s*[\d.]+\s*$/im;class yk extends gk{constructor(e){super(),this.xhrSetup=void 0,this.loader=null,this.xhrSetup=e.xhrSetup||null}destroy(){super.destroy(),this.loader=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}getNetworkDetails(){return this.loader}resetInternalLoader(){this.loader=null}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const r=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==r||this.stats.aborted))return s.call(this,r,t.url,t)}).catch(a=>{if(!(this.loader!==r||this.stats.aborted))return r.open("GET",t.url,!0),s.call(this,r,t.url,t)}).then(()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,t,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:r.status,text:a.message},t,r,i)}):this.openAndSendXhr(r,t,e)}openAndSendXhr(e,t,r){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:a}=r.loadPolicy;if(i)for(const o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader("Range",`bytes=${t.rangeStart}-${t.rangeEnd-1}`),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),r.timeout=s&&X(s)?s:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:r}=this;if(!e||!t)return;const i=t.readyState,s=this.config;if(!r.aborted&&i>=2&&(r.loading.first===0&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const u=t.status,c=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const p=c??t.response;if(p!=null){var a,o;r.loading.end=Math.max(self.performance.now(),r.loading.first);const m=t.responseType==="arraybuffer"?p.byteLength:p.length;r.loaded=r.total=m,r.bwEstimate=r.total*8e3/(r.loading.end-r.loading.first);const g=(a=this.callbacks)==null?void 0:a.onProgress;g&&g(r,e,p,t);const y={url:t.responseURL,data:p,code:u};e.rangeEnd&&m!==e.rangeEnd-e.rangeStart&&Pe.warn(`Payload length ${m} does not match requested Range: bytes=${e.rangeStart}-${e.rangeEnd-1}`),(o=this.callbacks)==null||o.onSuccess(y,r,e,t);return}}const d=s.loadPolicy.errorRetry,f=r.retry,h={url:e.url,data:void 0,code:u};if(uu(d,f,!1,h))this.retry(d);else{var l;Pe.error(`${u} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:u,text:t.statusText},e,t,r)}}}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&T9.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const _9={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},b9=ie(ie({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,loopBackBufferFlush:void 0,startOnSegmentBoundary:!1,nextAudioTrackBufferFlushForwardOffset:.25,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,skipBufferHolePadding:.1,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveMaxUnchangedPlaylistRefresh:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftw
vendor: 4,403 bytes, line 115
115areAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,appendTimeout:1/0,ignorePlaylistParsingErrors:!1,loader:yk,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,handleMpegTsVideoIntegrityErrors:"process",abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,abrSwitchInterval:0,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:oC,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,emsgKLVSchemaUri:void 0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,iframeCacheLimit:2*1024*1024,useMediaCapabilities:!0,preserveManualLevelOnError:!1,errorPenaltyExpireMs:0,certLoadPolicy:{default:_9},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,streamController:dk,abrController:uV,bufferController:Q7,capLevelController:oS,errorController:hV,fpsController:fz,id3TrackController:Dz,gapController:Cz,latencyController:Yz},I9()),{},{subtitleStreamController:Xz,subtitleTrackController:Az,timelineController:c9,audioStreamController:W7,audioTrackController:z7,emeController:za,cmcdController:sz,contentSteeringController:oz,iframeController:Bz,interstitialsController:qz});function I9(){return{cueHandler:h9,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function w9(n,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');
vendor: 4,219 bytes, line 115
115if(e.liveMaxUnchangedPlaylistRefresh!==void 0){const a=e.liveMaxUnchangedPlaylistRefresh,o=x9(a,2,1/0);o!==a&&t.warn(`hls.js config: "liveMaxUnchangedPlaylistRefresh" clamped from ${a} to ${o}.`),e.liveMaxUnchangedPlaylistRefresh=o}const r=B0(n),i=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,l=e[o]===void 0,u=[];s.forEach(c=>{const d=`${a}Loading${c}`,f=e[d];if(f!==void 0&&l){u.push(d);const h=r[o].default;switch(e[o]={default:h},c){case"TimeOut":h.maxLoadTimeMs=f,h.maxTimeToFirstByteMs=f;break;case"MaxRetry":h.errorRetry.maxNumRetry=f,h.timeoutRetry.maxNumRetry=f;break;case"RetryDelay":h.errorRetry.retryDelayMs=f,h.timeoutRetry.retryDelayMs=f;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=f,h.timeoutRetry.maxRetryDelayMs=f;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${We(e[o])}`)}),ie(ie({},r),e)}function B0(n){return n&&typeof n=="object"?Array.isArray(n)?n.map(B0):Object.keys(n).reduce((e,t)=>(e[t]=B0(n[t]),e),{}):n}function R9(n,e){const t=n.loader;t!==ub&&t!==yk?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),n.progressive=!1):p9()&&(n.loader=ub,n.progressive=!0,n.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}class A9 extends aS{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.lastABRSwitchTime=-1,this._iframeVariants=[],this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1,this._iframeVariants=[]}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const r=this.hls.config.preferManagedMediaSource,i=[],s={},a={};let o=!1,l=!1,u=!1,c=!1;t.levels.forEach(d=>{const f=d.attrs,h=cb(d,r),{audioCodec:p,videoCodec:m,imageCodec:g,width:y,height:v}=d;if(!h){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}o||(o=!!(y&&v)),l||(l=!!m),u||(u=!!p),c||(c=!!g);const{CODECS:S,"FRAME-RATE":x,"HDCP-LEVEL":T,"PATHWAY-ID":w,RESOLUTION:I,"VIDEO-RANGE":R}=f,b=`${`${w||"."}-`}${d.bitrate}-${I}-${x}-${S}-${R}-${T}`;if(s[b])if(s[b].uri!==d.url&&!d.attrs["PATHWAY-ID"]){const C=a[b]+=1;d.attrs["PATHWAY-ID"]=new Array(C+1).join(".");const k=this.createLevel(d);s[b]=k,i.push(k)}else d.iframes||(s[b].addGroupId("audio",f.AUDIO),s[b].addGroupId("text",f.SUBTITLES));else{const C=this.createLevel(d);s[b]=C,a[b]=1,i.push(C)}}),this.filterAndSortMediaOptions(i,t,o,l,u,c)}createLevel(e){const t=new mu(e),r=e.supplemental;if(r!=null&&r.videoCodec&&!Sk(r.videoCodec,this.hls.config.preferManagedMediaSource)){const i=new Error(`SUPPLEMENTAL-CODECS not supported "${r.videoCodec}"`);this.log(i.message),t.supportedResult=WL(i,[])}return t}filterAndSortMediaOptions(e,t,r,i,s,a){var o;let l=[],u=[],c=e;const d=((o=t.stats)==null?void 0:o.parsing)||{},f=this.hls.config.preferManagedMediaSource;if((r||i)&&s&&(c=c.filter(({videoCodec:T,videoRange:w,width:I,height:R})=>(!!T||!!(I&&R))&&eV(w))),i&&a&&(c=c.filter(T=>!T.imageCodec)),c.length===0){Promise.resolve().then(()=>
vendor: 15,327 bytes, line 115
115{if(this.hls){let T="no level with compatible codecs found in manifest",w=T;t.levels.length&&(w=`one or more CODECS in variant not supported: ${We(t.levels.map(R=>R.attrs.CODECS).filter((R,A,b)=>b.indexOf(R)===A))}`,this.warn(w),T+=` (${w})`);const I=new Error(T);this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:F.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:I,reason:w})}}),d.end=performance.now();return}t.audioTracks&&(l=t.audioTracks.filter(T=>!T.audioCodec||vk(T.audioCodec,f)),db(l)),t.subtitles&&(u=t.subtitles,db(u));const h=c.slice(0);c.sort((T,w)=>{if(T.attrs["HDCP-LEVEL"]!==w.attrs["HDCP-LEVEL"])return(T.attrs["HDCP-LEVEL"]||"")>(w.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&T.height!==w.height)return T.height-w.height;if(T.frameRate!==w.frameRate)return T.frameRate-w.frameRate;if(T.videoRange!==w.videoRange)return wf.indexOf(T.videoRange)-wf.indexOf(w.videoRange);if(T.videoCodec!==w.videoCodec){const I=zT(T.videoCodec),R=zT(w.videoCodec);if(I!==R)return R-I}if(T.uri===w.uri&&T.codecSet!==w.codecSet){const I=bf(T.codecSet),R=bf(w.codecSet);if(I!==R)return R-I}return T.averageBitrate!==w.averageBitrate?T.averageBitrate-w.averageBitrate:0});let p=h[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==h.length)){for(let T=0;T<h.length;T++)if(h[T].pathwayId===c[0].pathwayId){p=h[T];break}}this._levels=c;for(let T=0;T<c.length;T++)if(c[T]===p){var m;this._firstLevel=T;const w=p.bitrate,I=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${w}`),((m=this.hls.userConfig)==null?void 0:m.abrEwmaDefaultEstimate)===void 0){const R=Math.min(w,this.hls.config.abrEwmaDefaultEstimateMax);R>I&&I===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=R)}break}const g=t.iframeVariants.filter(T=>cb(T,f));this._iframeVariants=g;const y=s&&!i,v=this.hls.config,S=!!(v.audioStreamController&&v.audioTrackController),x={levels:c,audioTracks:l,subtitleTracks:u,iframeVariants:g,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:i,altAudio:S&&!y&&l.some(T=>!!T.url)};d.end=performance.now(),this.hls.trigger(E.MANIFEST_PARSED,x)}get iframeVariants(){return this._iframeVariants.length===0?null:this._iframeVariants}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const c=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:c,reason:c.message}),d)return;e=Math.min(e,t.length-1)}const r=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,r===e&&i&&s===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${r}${s?" with Pathway "+s:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(E.LEVEL_SWITCHING,l);const u=a.details;if(!u||u.live){const c=this.switchParams(a.uri,i?.details,u);this.loadPlaylist(c)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),r=e.filter(i=>t.indexOf(i)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=r}}onError(e,t){t.fatal||!t.context||t.context.type===ve.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t.type===te.MAIN){const r=t.elementaryStreams;if(!Object.keys(r).some(s=>!!r[s]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var r;const{level:i,details:s}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${i}`),(o=t.deliveryDirectives)!=null&&o.skip&&(s.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let l=a.details;l===t.details&&l.advanced&&(l=void 0),this.playlistLoaded(i,t,l)}else(r=t.deliveryDirectives)!=null&&r.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const r=this.getUrlWithDirectives(e.uri,t),i=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],a=e.details,o=a?.age;this.log(`Loading level index ${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${s?" Pathway "+s:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${r}`),this.hls.trigger(E.LEVEL_LOADING,{url:r,level:i,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){const t=this.currentLevelIndex;if(this.manualLevelIndex===-1&&e!==t&&e!==-1){const i=this.hls.config.abrSwitchInterval;if(i>0){const s=performance.now(),a=s-this.lastABRSwitchTime,o=i*1e3;if(this.lastABRSwitchTime>-1&&a<o){this.warn(`Preventing ABR level switch: ${t} -> ${e} (${Math.round(a)}ms < ${o}ms / ${i}s)`);return}this.lastABRSwitchTime=s,this.log(`Allowing ABR level switch: ${t} -> ${e} (${Math.round(a)}ms >= ${o}ms / ${i}s)`)}}this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const r=this._levels.filter((s,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(o=>o.level=-1)),!1));pC(r),this._levels=r,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const i=r.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(E.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}}function vk(n,e){return hu(n,"audio",e)}function Sk(n,e){return hu(n,"video",e)}function cb(n,e){let{audioCodec:t,videoCodec:r}=n;t&&(n.audioCodec=t=If(t,e)||void 0),r&&(r=n.videoCodec=WH(r));const{unknownCodecs:i}=n;return!(i?.length||0||t&&!vk(t,e)||r&&!Sk(r,e))}function db(n){const e={};n.forEach(t=>{const r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++})}class L9 extends Cn{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyLoaderInfo={},this.emeController=null,this.config=e}abort(e){for(const r in this.keyLoaderInfo){const i=this.keyLoaderInfo[r].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}destroy(){for(const e in this.keyLoaderInfo){const t=this.keyLoaderInfo[e].loader;t&&t.destroy()}this.emeController=null,this.keyLoaderInfo={}}loadClear(e,t,r){return this.emeController?this.emeController.loadClear(e,t,r):null}load(e,t){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(r=>this.loadInternal(e,t,r)):this.loadInternal(e,t)}loadInternal(e,t,r){r&&e.setKeyFormat(r);const i=e.decryptdata;if(!i){const a=new Error(r?`Expected frag.decryptdata to be defined after setting format ${r}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(_i(e,F.KEY_LOAD_ERROR,a))}const s=e;switch(i.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return i.keyFormat==="identity"?this.loadKeyHTTP(s):t?t.then(()=>this.loadKeyEME(s)):this.loadKeyEME(s);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(s);default:return Promise.reject(_i(e,F.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e){if(this.emeController&&this.config.emeEnabled){var t;if(!e.decryptdata.keyId&&(t=e.initSegment)!=null&&t.data){const r=IH(e.initSegment.data);if(r.length){let i=r[0];const s=e.decryptdata.uri;if(i.some(a=>a!==0))this.log(`Using keyId found in init segment ${St(i)} keyUri: ${s}`),oi.setKeyIdForUri(s,i);else{const a=oi.addKeyIdForUri(s);this.log(`Patching empty keyId with ${St(a)} keyUri: ${s}`),i=a}e.decryptdata.keyId=i}}return this.emeController.loadKey(e).then(()=>({frag:e,keyInfo:{decryptdata:e.decryptdata}}))}return Promise.reject(_i(e,F.KEY_LOAD_ERROR,new Error(`emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`)))}loadKeyHTTP(e){const t=e.decryptdata,r=t.uri;if(!r)return Promise.reject(_i(e,F.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const i=this.keyLoaderInfo[r];if(i){if(i.decryptdata.key)return t.key=i.decryptdata.key,i.keyLoadPromise=null,Promise.resolve({frag:e,keyInfo:i});if(i.keyLoadPromise)return i.keyLoadPromise.then(u=>(t.key=i.decryptdata.key,ie(ie({},u),{},{frag:e})))}this.log(`Loading${t.keyId?" keyId: "+St(t.keyId):""} URI: ${t.uri} from ${e.type} ${e.level}`);const s=this.config,a=s.loader,o=new a(s);e.keyLoader=o;const l=this.keyLoaderInfo[r]={decryptdata:t,keyLoadPromise:null,loader:o};return l.keyLoadPromise=new Promise((u,c)=>{const d={type:ve.KEY,keyInfo:l,frag:e,responseType:"arraybuffer",url:r},f=s.keyLoadPolicy.default,h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:(m,g,y,v)=>{const{frag:S,keyInfo:x,url:T}=y;if(!S.decryptdata||x!==this.keyLoaderInfo[T])return c(_i(S,F.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),v));x.decryptdata.key=S.decryptdata.key=new Uint8Array(m.data),S.keyLoader=x.loader=x.keyLoadPromise=null,u({frag:S,keyInfo:x})},onError:(m,g,y,v)=>{this.resetLoader(g),c(_i(e,F.KEY_LOAD_ERROR,new Error(`HTTP Error ${m.code} loading key ${m.text}`),y,ie({url:r,data:void 0},m)))},onTimeout:(m,g,y)=>{this.resetLoader(g),c(_i(e,F.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),y))},onAbort:(m,g,y)=>{this.resetLoader(g),c(_i(e,F.INTERNAL_ABORTED,new Error("key loading aborted"),y))}};o.load(d,h,p)})}resetLoader(e){const{frag:t,keyInfo:r,url:i}=e,s=r.loader;t.keyLoader===s&&(t.keyLoader=r.loader=r.keyLoadPromise=null),delete this.keyLoaderInfo[i],s&&s.destroy()}}function _i(n,e=F.KEY_LOAD_ERROR,t,r,i){return new Rr({type:re.NETWORK_ERROR,details:e,fatal:!1,frag:n,response:i,error:t,networkDetails:r||null})}function fb(n){const{type:e}=n;switch(e){case ve.AUDIO_TRACK:return te.AUDIO;case ve.SUBTITLE_TRACK:return te.SUBTITLE;default:return te.MAIN}}function Lm(n,e){let t=n.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class C9{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,r=t.pLoader,i=t.loader,s=r||i,a=new s(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:r}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ve.MANIFEST,url:r,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:r,level:i,pathwayId:s,url:a,deliveryDirectives:o,levelInfo:l}=t;this.load({id:r,level:i,pathwayId:s,responseType:"text",type:ve.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:l})}onAudioTrackLoading(e,t){const{id:r,groupId:i,url:s,deliveryDirectives:a,track:o}=t;this.load({id:r,groupId:i,level:null,responseType:"text",type:ve.AUDIO_TRACK,url:s,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:r,groupId:i,url:s,deliveryDirectives:a,track:o}=t;this.load({id:r,groupId:i,level:null,responseType:"text",type:ve.SUBTITLE_TRACK,url:s,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){const r=this.loaders[ve.LEVEL];if(r){const i=r.context;i&&!t.levels.some(s=>s===i.levelOrTrack)&&(r.abort(),delete this.loaders[ve.LEVEL])}}load(e){var t;const r=this.hls.config;let i=this.getInternalLoader(e);if(i){const u=this.hls.logger,c=i.context;if(c?.levelOrTrack===e.levelOrTrack&&(c.url===e.url||c.deliveryDirectives&&!e.deliveryDirectives)){c.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${c.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let s;if(e.type===ve.MANIFEST?s=r.manifestLoadPolicy.default:s=Ne({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),X((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ve.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ve.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ve.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const c=u.partTarget,d=u.targetduration;if(c&&d){const f=Math.max(c*3,d*.8)*1e3;s=Ne({}
vendor: 1,494 bytes, line 115
115,s,{maxTimeToFirstByteMs:Math.min(f,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(f,s.maxTimeToFirstByteMs)})}}}const a=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(u,c,d,f)=>{const h=this.getInternalLoader(d);this.resetInternalLoader(d.type);const p=u.data;c.parsing.start=performance.now(),Or.isMediaPlaylist(p)||d.type!==ve.MANIFEST?this.handleTrackOrLevelPlaylist(u,c,d,f||null,h):this.handleMasterPlaylist(u,c,d,f)},onError:(u,c,d,f)=>{this.handleNetworkError(c,d,!1,u,f)},onTimeout:(u,c,d)=>{this.handleNetworkError(c,d,!0,void 0,u)}};i.load(e,o,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:r}=this.hls;(e||r)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,r,i){const s=this.hls,a=e.data,o=Lm(e,r),l=Or.parseMasterPlaylist(a,o);if(l.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,r,l.playlistParsingError,i,t);return}const{contentSteering:u,levels:c,iframeVariants:d,sessionData:f,sessionKeys:h,startTimeOffset:p,variableList:m}=l;this.variableList=m,c.forEach(S=>{const{unknownCodecs:x}=S;if(x){const{preferManagedMediaSource:T}=this.hls.config;let{audioCodec:w,videoCodec:I}=S;for(let R=x.length;R--;){const A=x[R];hu(A,"audio",T)?(S.audioCodec=w=w?`${w},${A}
115`:A,ho.audio[w.substring(0,4)]=2,x.splice(R,1)):hu(A,"video",T)&&(S.videoCodec=I=I?`${I},${A}`:A,ho.video[I.substring(0,4)]=2,x.splice(R,1))}}});const{AUDIO:g=[],SUBTITLES:y,"CLOSED-CAPTIONS":v}=Or.parseMasterPlaylistMedia(a,o,l);g.length&&!g.some(x=>!x.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new nt({}),bitrate:0,url:""})),s.trigger(E.MANIFEST_LOADED,{levels:c,audioTracks:g,subtitles:y,iframeVariants:d,captions:v,contentSteering:u,url:o,stats:t,networkDetails:i,sessionData:f,sessionKeys:h,startTimeOffset:p,variableList:m})}handleTrackOrLevelPlaylist(e,t,r,i,s){const a=this.hls,{id:o,level:l,type:u}=r,c=Lm(e,r),d=X(l)?l:X(o)?o:0,f=fb(r),h=Or.parseLevelPlaylist(e.data,c,d,f,0,this.variableList);if(u===ve.MANIFEST){const p={attrs:new nt({}),bitrate:0,details:h,name:"",url:c};h.requestScheduled=t.loading.start+dC(h,0),a.trigger(E.MANIFEST_LOADED,{levels:[p],audioTracks:[],iframeVariants:[],url:c,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),r.levelDetails=h,this.handlePlaylistLoaded(h,e,t,r,i,s)}handleManifestParsingError(e,t,r,i,s){this.hls.trigger(E.ERROR,{type:re.NETWORK_ERROR,details:F.MANIFEST_PARSING_ERROR,fatal:t.type===ve.MANIFEST,url:e.url,err:r,error:r,reason:r.message,response:e,context:t,networkDetails:i,stats:s})}handleNetworkError(e,t,r=!1,i,s){let a=`A network ${r?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===ve.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===ve.AUDIO_TRACK||e.type===ve.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let l=F.UNKNOWN,u=!1;const c=this.getInternalLoader(e);switch(e.type){case ve.MANIFEST:l=r?F.MANIFEST_LOAD_TIMEOUT:F.MANIFEST_LOAD_ERROR,u=!0;break;case ve.LEVEL:l=r?F.LEVEL_LOAD_TIMEOUT:F.LEVEL_LOAD_ERROR,u=!1;break;case ve.AUDIO_TRACK:l=r?F.AUDIO_TRACK_LOAD_TIMEOUT:F.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ve.SUBTITLE_TRACK:l=r?F.SUBTITLE_TRACK_LOAD_TIMEOUT:F.SUBTITLE_LOAD_ERROR,u=!1;break}c&&this.resetInternalLoader(e.type);const d={type:re.NETWORK_ERROR,details:l,fatal:u,url:e.url,loader:c,context:e,error:o,networkDetails:t,stats:s};if(i){let f=e.url;t&&"url"in t&&(f=t.url),d.response=ie({url:f,data:void 0},i)}this.hls.trigger(E.ERROR,d)}handlePlaylistLoaded(e,t,r,i,s,a){const o=this.hls,{type:l,level:u,levelOrTrack:c,id:d,groupId:f,deliveryDirectives:h}=i,p=Lm(t,i),m=fb(i);let g=typeof i.level=="number"&&m===te.MAIN?u:void 0;c&&"iframes"in c&&c.iframes&&!e.iframesOnly&&(e.playlistParsingError=new Error("EXT-X-I-FRAME-STREAM-INF media playlist MUST contain an EXT-X-I-FRAMES-ONLY tag"),e.iframesOnly=!0);const y=e.playlistParsingError;if(y){if(this.hls.logger.warn(`${y} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(E.ERROR,{type:re.NETWORK_ERROR,details:F.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:y,reason:y.message,response:t,context:i,level:g,parent:m,networkDetails:s,stats:r});return}e.playlistParsingError=null}if(!e.fragments.length){const v=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(E.ERROR,{type:re.NETWORK_ERROR,details:F.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:v,reason:v.message,response:t,context:i,level:g,parent:m,networkDetails:s,stats:r});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case ve.MANIFEST:case ve.LEVEL:if(g){if(!c)g=0;else if(c!==o.levels[g]){const v=o.levels.indexOf(c);v>-1&&(g=v)}}o.trigger(E.LEVEL_LOADED,{details:e,levelInfo:c||o.levels[0],level:g||0,id:d||0,stats:r,networkDetails:s,deliveryDirectives:h,withoutMultiVariant:l===ve.MANIFEST,context:i});break;case ve.AUDIO_TRACK:o.trigger(E.AUDIO_TRACK_LOADED,{details:e,track:c,id:d||0,groupId:f||"",stats:r,networkDetails:s,deliveryDirectives:h,context:i});break;case ve.SUBTITLE_TRACK:o.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,track:c,id:d||0,groupId:f||"",stats:r,networkDetails:s,deliveryDirectives:h,context:i});break}}}class Lr{static get version(){return yu}static isMSESupported(){return ck()}static isSupported(){return Pz()}static getMediaSource(){return is()}static get Events(){return E}static get MetadataSchema(){return Qt}static get ErrorTypes(){return re}static get ErrorDetails(){return F}static get DefaultConfig(){return Lr.defaultConfig?Lr.defaultConfig:b9}static set DefaultConfig(e){Lr.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this._url=null,this.streamController=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new tS,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.iframeC
vendor: 3,148 bytes, line 115
115ontroller=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=Jj(e.debug||!1,"Hls instance",e.loggerId||e.assetPlayerId),r=this.config=w9(Lr.DefaultConfig,e,t);this.userConfig=e,r.progressive&&R9(r,t);const{streamController:i,abrController:s,bufferController:a,capLevelController:o,errorController:l,fpsController:u,id3TrackController:c,iframeController:d,gapController:f}=r,h=new l(this),p=this.abrController=new s(this),m=new pV(this),g=r.interstitialsController,y=g?this.interstitialsController=new g(this,Lr):null,v=a?this.bufferController=new a(this,m):null,S=o?this.capLevelController=new o(this):null,x=u?new u(this):null,T=r.cmcdController,w=T?this.cmcdController=new T(this):null,I=new C9(this),R=r.contentSteeringController,A=R?new R(this):null,b=this.levelController=new A9(this,A),C=c?new c(this):void 0,k=new L9(this.config,this.logger),$=this.streamController=new i(this,m,k),U=this.gapController=f?new f(this,m):void 0;S&&S.setStreamController($);const N=[I,b,$];y&&N.splice(1,0,y),A&&N.splice(1,0,A),this.networkControllers=N;const D=[p];v&&D.push(v),U&&D.push(U),S&&D.push(S),x&&(x.setStreamController($),D.push(x)),C&&D.push(C),D.push(m),this.audioTrackController=this.createController(r.audioTrackController,N);const M=r.audioStreamController;M&&N.push(this.audioStreamController=new M(this,m,k)),this.subtitleTrackController=this.createController(r.subtitleTrackController,N);const L=r.subtitleStreamController;L&&N.push(this.subtititleStreamController=new L(this,m,k)),this.createController(r.timelineController,D),k.emeController=this.emeController=this.createController(r.emeController,D),w&&D.push(w),this.latencyController=this.createController(r.latencyController,D),this.coreComponents=D,this.iframeController=d?new d(this,Lr):void 0,N.push(h);const O=h.onErrorOut;typeof O=="function"&&this.on(E.ERROR,O,h),this.on(E.MANIFEST_LOADED,I.onManifestLoaded,I)}createController(e,t){if(e){const r=new e(this);return t&&t.push(r),r}return null}on(e,t,r=this){this._emitter.on(e,t,r)}once(e,t,r=this){this._emitter.once(e,t,r)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,r=this,i){this._emitter.off(e,t,r,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,r){return this._emitter.emit(e,t,r)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(r){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+r.message+'". Here is a stacktrace:',r),!this.triggeringException){this.triggeringException=!0;const i=e===E.ERROR;this.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.INTERNAL_EXCEPTION,fatal:i,event:e,error:r}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(E.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>
vendor: 5,784 bytes, line 115
115t.destroy()),this.coreComponents.length=0,this.iframeController=void 0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(E.ERROR,{type:re.OTHER_ERROR,details:F.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,r=t?e.media:e,i=t?e:{media:r};this._media=r,this.trigger(E.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia");const e={};this.trigger(E.MEDIA_DETACHING,e),this._media=null,this.trigger(E.MEDIA_DETACHED,e)}transferMedia(){var e;this._media=null;const t=((e=this.bufferController)==null?void 0:e.transferMedia())||null,r={transferMedia:t};return this.trigger(E.MEDIA_DETACHING,r),this.trigger(E.MEDIA_DETACHED,r),t}loadSource(e){var t;this.stopLoad();const r=this.media,i=this._url,s=this._url=Gv.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${s}`),r&&i&&(i!==s||(t=this.bufferController)!=null&&t.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(r)),this.trigger(E.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let r=0;r<this.networkControllers.length&&(this.networkControllers[r].startLoad(e,t),!(!this.started||!this.networkControllers));r++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started&&this.streamController.state!==H.STOPPED}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[te.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[te.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[te.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=this.started,r=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&(r?this.startLoad(r):this.config.autoStartLoad||this.startLoad()))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=wL()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=this.capLevelController,r=!!e;t&&r!==this.config.capLevelToPlayerSize&&(r?t.startCapping():(t.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){ZH(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const r=e.length;for(let i=0;i<r;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:r}=this;let i;
vendor: 3,076 bytes, line 115
115if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,r)for(let s=i;s--;){const a=e[s].attrs["HDCP-LEVEL"];if(a&&a<=r)return s}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get audioForwardBufferInfo(){var e;return((e=this.audioStreamController)==null?void 0:e.getFwdBufferInfo())||null}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get nextAudioTrack(){var e,t;return(e=(t=this.audioStreamController)==null?void 0:t.nextAudioTrack)!=null?e:-1}set nextAudioTrack(e){const{audioTrackController:t}=this;t&&(t.nextAudioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){var e,t;return(e=(t=this.latencyController)==null?void 0:t.liveSyncPosition)!=null?e:null}get latency(){var e;return((e=this.latencyController)==null?void 0:e.latency)||0}get maxLatency(){var e;return((e=this.latencyController)==null?void 0:e.maxLatency)||0}get targetLatency(){var e;return((e=this.latencyController)==null?void 0:e.targetLatency)||null}set targetLatency(e){this.latencyController&&(this.latencyController.targetLatency=e)}get drift(){var e;return((e=this.latencyController)==null?void 0:e.drift)||null}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){return this.interstitialsController?this.interstitialsController.interstitialsManager:null}get iframeVariants(){const e=this.levelController.iframeVariants;return e||[]}
115createIFramePlayer(e){return this._url&&this.iframeController?this.iframeController.createIFramePlayer(e):null}createImageIFramePlayer(e){return this._url&&this.iframeController?this.iframeController.createImageIFramePlayer(e):null}getMediaDecodingInfo(e,t=this.allAudioTracks){const r=YL(t);return zL(e,r,navigator.mediaCapabilities)}}Lr.defaultConfig=void 0;const er=10,hb=n=>`${Math.floor(n/60)}:${String(Math.floor(n%60)).padStart(2,"0")}`,k9=({url:n,type:e="hls"})=>{const[t,r]=P.useState(!1),[i,s]=P.useState(!1),[a,o]=P.useState(0),[l,u]=P.useState(!1),[c,d]=P.useState(!1),[f,h]=P.useState(!1),p=P.useRef(null),m=P.useRef(null),g=P.useRef(null);P.useEffect(()=>{if(!t){m.current?.destroy(),m.current=null;return}const T=p.current;if(T){if(m.current?.destroy(),m.current=null,g.current=null,d(!1),h(!1),o(0),s(!1),e==="mp4")T.src=n,T.load();else if(Lr.isSupported()){const w=new Lr({maxBufferLength:12,maxMaxBufferLength:12});w.loadSource(n),w.attachMedia(T),m.current=w}else T.canPlayType("application/vnd.apple.mpegurl")&&(T.src=n);return()=>{m.current?.destroy(),m.current=null,e==="mp4"&&(T.src="")}}},[t,n,e]),P.useEffect(()=>{if(!t)return;const T=p.current;if(!T)return;const w=()=>{g.current===null&&(g.current=T.currentTime);const C=T.currentTime-g.current;C>=er?(T.pause(),T.currentTime=g.current+er,o(er),d(!0)):o(C)},I=()=>{if((g.current!==null?T.currentTime-g.current:0)>=er){T.pause();return}s(!0)},R=()=>s(!1),A=()=>{g.current!==null&&(T.currentTime<g.current&&(T.currentTime=g.current),T.currentTime>g.current+er&&(T.currentTime=g.current+er))},b=()=>h(!0);return T.addEventListener("timeupdate",w),T.addEventListener("play",I),T.addEventListener("pause",R),T.addEventListener("seeking",A),T.addEventListener("error",b),()=>{T.removeEventListener("timeupdate",w),T.removeEventListener("play",I),T.removeEventListener("pause",R),T.removeEventListener("seeking",A),T.removeEventListener("error",b)}},[t]);const y=()=>{const T=p.current;T&&(c?(T.currentTime=g.current??0,o(0),d(!1),T.play().catch(()=>h(!0))):i?T.pause():T.play().catch(()=>h(!0)))},v=T=>{const w=p.current;if(!w)return;const I=T.currentTarget.getBoundingClientRect(),R=g.current??0,A=Math.min((T.clientX-I.left)/I.width*er,er);w.currentTime=R+A,o(A),A<er&&d(!1)},S=()=>{const T=p.current;T&&(T.muted=!T.muted,u(T.muted))},x=a/er*100;return _.jsxs("div",{className:"preview-accordion",children:[_.jsxs("button",{className:"preview-accordion__toggle",onClick:()=>r(T=>!T),"aria-expanded":t,children:[_.jsx("span",{children:"Preview"}),_.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:_.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),t&&_.jsxs("div",{className:"preview-accordion__body",children:[_.jsxs("div",{className:"preview-video-wrap",children:[_.jsx("video",{ref:p,className:"preview-video",playsInline:!0}),c&&_.jsx("div",{className:"preview-limit-overlay",children:_.jsx("span",{children:"Preview ended"})}),f&&_.jsx("div",{className:"preview-limit-overlay",children:_.jsx("span",{children:"Preview unavailable"})})]}),_.jsxs("div",{className:"preview-controls",children:[_.jsx("button",{className:"preview-ctrl-btn",onClick:y,"aria-label":c?"Replay":i?"Pause":"Play",children:c?_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("polyline",{points:"1 4 1 10 7 10"}),_.jsx("path",{d:"M3.51 15a9 9 0 1 0 .49-4.5"})]}):i?_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[_.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),_.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]}):_.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:_.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),_.jsx("div",{className:"preview-progress",onClick:v,role:"slider","aria-label":"Seek",children:_.jsx("div",{className:"preview-progress-fill",style:{width:`${x}%`}})}),_.jsxs("span",{className:"preview-time",children:[hb(a)," / ",hb(er)]}),_.jsx("button",{className:"preview-ctrl-btn",onClick:S,"aria-label":l?"Unmute":"Mute",children:l?_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),_.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),_.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}):_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),_.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"})]})})]})]})]})},D9=n=>{const e=[];n.resolution&&e.push(n.resolution),n.frameRate&&e.push(`${n.frameRate}fps`);const t=(n.bandwidth/1e6).toFixed(1);return e.push(`${t} Mbps`),e.join(" · ")},Cm=n=>n>=1073741824?`${(n/1073741824).toFixed(1)} GB`:n>=1048576?`${(n/1048576).toFixed(1)} MB`:n>=1024?`${(n/1024).toFixed(0)} KB`:`${n} B`,pb=n=>n>=1073741824?`${(n/1073741824).toFixed(1)} GB/s`:n>=1048576?`${(n/1048576).toFixed(1)} MB/s`:n>=1024?`${(n/1024).toFixed(0)} KB/s`:`${n.toFixed(0)} B/s`,P9={idle:"Idle",fetching:"Fetching playlistâ¦",awaiting_quality:"Choose qualityâ¦",downloading:"Downloadingâ¦",muxing:"Processingâ¦",partial:"Download incomplete",recording:"Recordingâ¦",done:"Done!",error:"Error",cancelled:"Cancelled"},O9=({state:n,paused:e,filename:t,pageUrl:r,variants:i,selectedVariantUri:s,onFilenameChange:a,onPauseResume:o,onCancel:l,onVariantChange:u,onRetryFailed:c,onSaveAnyway:d,onStopAndSave:f,previewUrl:h,previewType:p})=>{const{status:m,percent:g,error:y,bytesDownloaded:v,totalBytes:S,speedBps:x,failedSegmentCount:T,progressUnknown:w}=n,[I,R]=P.useState(!1),A=P.useRef(t),b=m==="downloading",C=m==="done"||m==="cancelled";return _.jsxs("div",{className:"downloader",children:[_.jsxs("div",{className:"filename-row",children:[_.jsx("input",{className:"filename-input",disabled:!I,value:t,onChange:k=>a(k.target.value),onBlur:()=>R(!1),onKeyDown:k=>{k.key==="Enter"&&R(!1),k.key==="Escape"&&(a(A.current),R(!1))},spellCheck:!1}),I?_.jsxs(_.Fragment,{children:[_.jsx("button",{className:"btn-icon btn-icon-confirm",title:"Save","aria-label":"Save filename",onMouseDown:k=>k.preventDefault(),onClick:()=>R(!1),children:_.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:_.jsx("polyline",{points:"20 6 9 17 4 12"})})}),_.jsx("button",{className:"btn-icon btn-icon-cancel",title:"Cancel","aria-label":"Cancel rename",onMouseDown:k=>k.preventDefault(),onClick:()=>{a(A.current),R(!1)},children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),_.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):_.jsx("button",{className:"btn-icon",title:"Rename",onClick:()=>{A.current=t,R(!0)},"aria-label":"Edit filename",children:"âï¸"}),/^https?:\/\//i.test(r)&&_.jsx("a",{className:"btn-icon",href:r,target:"_blank",rel:"noopener noreferrer",title:"Open source page","aria-label":"Open source page",children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),_.jsx("polyline",{points:"15 3 21 3 21 9"}),_.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})})]}),_.jsxs("div",{className:"resolution-row",children:[_.jsx("span",{className:"resolution-label",children:"Resolution"}),_.jsx("select",{className:"quality-select resolution-select",value:s??"",onChange:k=>u(k.target.value),disabled:i.length<=1,children:i.length===0?_.jsx("option",{value:"",children:"â"}):i.map((k,$)=>_.jsx("option",{value:k.uri,children:D9(k)},$))})]}),_.jsxs("div",{className:"downloader-status",children:[P9[m]??m,m==="downloading"&&!w&&` (${g}%)`,m==="downloading"&&(v??0)>0&&_.jsxs("span",{className:"dl-stats",children:[" · ",Cm(v),S?` / ${Cm(S)}`:"",!e&&(x??0)>0&&` · ${pb(x)}`]}),m==="recording"&&(v??0)>0&&_.jsxs("span",{className:"dl-stats",children:[" · ",Cm(v),(x??0)>0&&` · ${pb(x)}`]})]}),m==="downloading"&&!w&&_.jsx("div",{className:"progress-track",children:_.jsx("div",{className:"progress-fill",style:{width:`${g}%`}})}),(m==="downloading"&&w||m==="recording")&&_.jsx("div",{className:"progress-track",children:_.jsx("div",{className:"progress-fill progress-fill--indeterminate"})}),(m==="muxing"||m==="fetching")&&_.jsx("div",{className:"progress-track",children:_.jsx("div",{className:"progress-fill",style:{width:`${g}%`}})}),y&&_.jsx("div",{className:"error-msg",children:y}),m==="partial"&&_.jsxs("div",{className:"error-msg",children:[T," segment",T!==1?"s":""," failed to download. The video will have ",T!==1?"gaps":"a gap"," if you save now."]}),!C&&m!=="idle"&&m!=="error"&&_.jsxs("div",{className:"downloader-control
115s",children:[b&&_.jsx("button",{className:"btn btn-secondary",onClick:o,children:e?"Resume":"Pause"}),m==="recording"&&_.jsx("button",{className:"btn btn-primary",onClick:f,children:"Stop & Save"}),m==="partial"&&_.jsxs(_.Fragment,{children:[_.jsx("button",{className:"btn btn-secondary",onClick:c,children:"Retry Failed"}),_.jsx("button",{className:"btn btn-primary",onClick:d,children:"Save Anyway"})]}),_.jsx("button",{className:"btn btn-danger",onClick:l,children:"Cancel"})]}),h&&_.jsx(k9,{url:h,type:p}),(m==="error"||m==="partial")&&_.jsx(si,{to:"/feedback",className:"problem-hint",children:"Having problems? Send feedback"}),!C&&m!=="idle"&&m!=="error"&&m!=="partial"&&_.jsx(si,{to:"/feedback",className:"problem-hint",children:"Having problems with the download?"})]})},M9=({settings:n,onChange:e})=>_.jsxs("div",{className:"settings-panel",children:[_.jsx("h3",{className:"settings-title",children:"Settings"}),_.jsxs("div",{className:"settings-row",children:[_.jsxs("label",{className:"settings-label",htmlFor:"concurrency",children:["Concurrent threads",_.jsx("span",{className:"settings-hint",children:"Parallel segment downloads (1â5)"})]}),_.jsxs("div",{className:"settings-control",children:[_.jsx("input",{id:"concurrency",type:"range",min:1,max:5,step:1,value:n.concurrency,onChange:t=>e({concurrency:Number(t.target.value)}),className:"settings-range"}),_.jsx("span",{className:"settings-range-value",children:n.concurrency})]})]}),_.jsxs("div",{className:"settings-row",children:[_.jsxs("label",{className:"settings-label",htmlFor:"autosave",children:["Auto-save",_.jsx("span",{className:"settings-hint",children:n.autoSave?"File saves automatically when download finishes":"You will choose the destination after download finishes"})]}),_.jsx("div",{className:"settings-control",children:_.jsx("input",{id:"autosave",type:"checkbox",checked:n.autoSave,onChange:t=>e({autoSave:t.target.checked}),className:"settings-checkbox"})})]})]});function F9(n){return n.includes("#EXT-X-STREAM-INF")}function N9(n,e){const t=n.split(` 116`).map(s=>s.trim()).filter(Boolean),r=[],i=new Map;for(let s=0;s<t.length;s++){if(!t[s].startsWith("#EXT-X-MEDIA:"))continue;const a=Uf(t[s].slice(13));if(a.TYPE==="AUDIO"&&a.URI){const o=a["GROUP-ID"]??"";(!i.has(o)||a.DEFAULT==="YES")&&i.set(o,Ll(a.URI,e))}}for(let s=0;s<t.length;s++){if(!t[s].startsWith("#EXT-X-STREAM-INF:"))continue;const a=Uf(t[s].slice(18)),o=Ll(t[s+1],e),l=a.AUDIO??null,u=l?i.get(l)??null:null;r.push({bandwidth:parseInt(a.BANDWIDTH??"0",10),resolution:a.RESOLUTION??null,codecs:a.CODECS?a.CODECS.replace(/"/g,""):null,frameRate:a["FRAME-RATE"]?parseFloat(a["FRAME-RATE"]):null,uri:o,audioUri:u})}return r.sort((s,a)=>a.bandwidth-s.bandwidth),r}function mb(n,e){const[t,r]=n.trim().split("@"),i=parseInt(t,10)||0,s=r!==void 0?parseInt(r,10):e;return{length:i,offset:s}}function jc(n,e){const t=n.split(` 117`).map(p=>p.trim()).filter(Boolean),r=[];let i=null,s=null,a=null,o=0,l=null,u=0,c=0,d=0,f=6;for(let p=0;p<t.length;p++){const m=t[p];if(m.startsWith("#EXT-X-MEDIA-SEQUENCE:")){c=parseInt(m.slice(22),10),d=c;continue}if(m.startsWith("#EXT-X-TARGETDURATION:")){f=parseFloat(m.slice(22))||6;continue}if(m.startsWith("#EXT-X-MAP:")){const g=Uf(m.slice(11));g.URI&&(s=Ll(g.URI.replace(/"/g,""),e)),g.BYTERANGE&&(a=mb(g.BYTERANGE.replace(/"/g,""),0));continue}if(m.startsWith("#EXT-X-BYTERANGE:")){l=mb(m.slice(17),u);continue}if(m.startsWith("#EXT-X-KEY:")){const g=Uf(m.slice(11)),y=g.METHOD??"NONE";if(y==="NONE")i=null;else{const v=g.URI?Ll(g.URI.replace(/"/g,""),e):null;let S=null;g.IV&&(S=B9(g.IV.replace(/^0x/i,""))),i={method:y,uri:v,iv:S}}continue}if(m.startsWith("#EXTINF:")){o=parseFloat(m.slice(8).split(",")[0]);continue}m.startsWith("#")||(r.push({uri:Ll(m,e),duration:o,sequenceNumber:d++,keyInfo:i?{...i,iv:i.iv??U9(d-1)}:null,byteRange:l}),l&&(u=l.offset+l.length),o=0,l=null)}const h=!n.includes("#EXT-X-ENDLIST");return{segments:r,initUri:s,initByteRange:a,isLive:h,targetDuration:f}}function U9(n){const e=new Uint8Array(16);return new DataView(e.buffer).setUint32(12,n,!1),e}function Ll(n,e){if(!n)return"";try{return new URL(n,e).href}catch{return n}}function Uf(n){const e={},t=/([A-Z0-9-]+)=("(?:[^"\\]|\\.)*"|[^,]*)/g;let r;for(;(r=t.exec(n))!==null;)e[r[1]]=r[2].startsWith('"')?r[2].slice(1,-1):r[2];return e}function B9(n){const e=new Uint8Array(n.length/2);for(let t=0;t<e.length;t++)e[t]=parseInt(n.slice(t*2,t*2+2),16);return e}function km(n){return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}function xn(n,e){return(n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3])>>>0}function _t(n,e,t){n[e]=t>>>24&255,n[e+1]=t>>>16&255,n[e+2]=t>>>8&255,n[e+3]=t&255}function Vh(n,e){return String.fromCharCode(n[e+4],n[e+5],n[e+6],n[e+7])}function yr(n){const e=[];let t=0;for(;t+8<=n.length;){const r=xn(n,t);if(r<8||t+r>n.length)break;e.push({offset:t,size:r,type:Vh(n,t)}),t+=r}return e}function li(n,e){for(const t of yr(n))if(t.type===e)return n.slice(t.offset,t.offset+t.size);return null}function Ek(n,e,t){let r=e;for(;r+8<=t;){const i=xn(n,r);if(i<8||r+i>t)break;
117if(Vh(n,r)==="mvhd")return n[r+8]===1?xn(n,r+28):xn(n,r+20);r+=i}return 9e4}function yS(n,e,t,r,i){let s=e;for(;s+8<=t;){const a=xn(n,s);if(a<8||s+a>t)break;const o=Vh(n,s);if(o==="mvhd"){const l=n[s+8],u=l===1?xn(n,s+28):xn(n,s+20),c=Math.round(r*u);l===1?(_t(n,s+32,0),_t(n,s+36,c)):_t(n,s+24,c)}else if(o==="tkhd"){const l=n[s+8],u=Math.round(r*i);l===1?(_t(n,s+36,0),_t(n,s+40,u)):_t(n,s+28,u)}else if(o==="mdhd"){const l=n[s+8],u=l===1?xn(n,s+28):xn(n,s+20),c=Math.round(r*u);l===1?(_t(n,s+32,0),_t(n,s+36,c)):_t(n,s+24,c)}(o==="trak"||o==="mdia"||o==="minf"||o==="stbl")&&yS(n,s+8,s+a,r,i),s+=a}}function Bf(n,e){const t=new Uint8Array(n);for(const r of yr(t))if(r.type==="moov"){const i=Ek(t,r.offset+8,r.offset+r.size);yS(t,r.offset+8,r.offset+r.size,e,i);break}return t}function $9(n,e){const t=new Uint8Array(n),r=n.slice(8);for(const i of yr(r))if(i.type==="tkhd"){const s=r[i.offset+8],a=8+i.offset+(s===1?28:20);_t(t,a,e);break}return t}function G9(n,e){const t=new Uint8Array(n);return _t(t,12,e),t}function xk(n,e){const t=new Uint8Array(n);for(const r of yr(t)){if(r.type!=="moof")continue;const i=t.subarray(r.offset+8,r.offset+r.size);for(const s of yr(i)){if(s.type!=="traf")continue;const a=i.subarray(s.offset+8,s.offset+s.size);for(const o of yr(a))if(o.type==="tfhd"){const l=r.offset+8+s.offset+8+o.offset+12;_t(t,l,e)}}}return t}function j9(n,e){const t=n.subarray(8);for(const r of yr(t))if(r.type==="mvhd"){const i=t[r.offset+8];_t(n,8+r.offset+(i===1?116:104),e);break}}function H9(n,e){const t=n.length+e.length,r=new Uint8Array(t);return r.set(n),r.set(e,n.length),_t(r,0,t),r}function Tk(n,e){const t=n.slice(8),r=e.slice(8),i=li(r,"trak"),s=i?$9(i,2):null,a=li(r,"mvex"),o=a?li(a.slice(8),"trex"):null,l=o?G9(o,2):null,u=[];let c=null;for(const p of yr(t)){const m=t.slice(p.offset,p.offset+p.size);p.type==="mvex"?c=m:u.push(m)}s&&u.push(s),c&&l?u.push(H9(c,l)):c&&u.push(c);const d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(8+d);_t(f,0,8+d),f.set([109,111,111,118],4);let h=8;for(const p of u)f.set(p,h),h+=p.length;return j9(f,3),f}function V9(n,e){const t=li(n,"moov"),r=li(e,"moov");if(!t||!r)return n;const i=Tk(t,r),s=li(n,"ftyp"),a=[];s&&a.push(s),a.push(i);const o=a.reduce((c,d)=>c+d.length,0),l=new Uint8Array(o);let u=0;for(const c of a)l.set(c,u),u+=c.length;return l}function W9(n){function e(t){const r=[];let i=0,s=!1;for(;i+8<=t.length;){const u=xn(t,i);if(u<8||i+u>t.length){r.push(t.subarray(i));break}const c=Vh(t,i);if(c==="edts"){s=!0,i+=u;continue}if(c==="moov"||c==="trak"){const d=e(t.subarray(i+8,i+u));if(d!==null){const f=8+d.length,h=new Uint8Array(8);_t(h,0,f),h[4]=t[i+4],h[5]=t[i+5],h[6]=t[i+6],h[7]=t[i+7],r.push(h,d),s=!0,i+=u;continue}}r.push(t.subarray(i,i+u)),i+=u}if(!s)return null;let a=0;for(const u of r)a+=u.length;const o=new Uint8Array(a);let l=0;for(const u of r)o.set(u,l),l+=u.length;return o}return e(n)??n}function gb(n,e){const t=new Uint8Array(n);let r=0;for(const i of yr(t)){if(i.type!=="moof")continue;const s=t.subarray(i.offset+8,i.offset+i.size);for(const a of yr(s)){if(a.type!=="traf")continue;const o=r++,l=s.subarray(a.offset+8,a.offset+a.size);for(const u of yr(l)){if(u.type!=="tfdt")continue;const c=l[u.offset+8],d=i.offset+8+a.offset+8+u.offset+12;let f;c===1?f=BigInt(xn(t,d))<<32n|BigInt(xn(t,d+4)):f=BigInt(xn(t,d)),e.has(o)||e.set(o,f);const h=e.get(o),p=f>h?f-h:0n;c===1?(_t(t,d,Number(p>>32n)),_t(t,d+4,Number(p&0xffffffffn))):_t(t,d,Number(p&0xffffffffn));break}}}return t}async function _k(n,e,t,r,i=0){const s=t!=null&&t.length>0,a=async m=>{const g=await n.getFileHandle(m).then(y=>y.getFile());return new Uint8Array(await g.arrayBuffer())},o=e.length>0?await a(e[0]):null,l=s?await a(t[0]):null;if(!o)throw new Error("combineFmp4Stream: no video segments");let u;if(s&&l){const m=li(o,"moov"),g=li(l,"moov");if(m&&g){const y=Tk(m,g);if(i>0){const w=Ek(y,8,y.length);yS(y,8,y.length,i,w)}const v=li(o,"ftyp"),S=[];v&&S.push(v),S.push(y);const x=S.reduce((w,I)=>w+I.length,0);u=new Uint8Array(x);let T=0;for(const w of S)u.set(w,T),T+=w.length}else u=i>0?Bf(o,i):o}else u=i>0?Bf(o,i):o;await r.write(km(W9(u)));const c=e.slice(1),d=s?t.slice(1):[],f=Math.max(c.length,d.length),h=new Map,p=new Map;for(let m=0;m<f;m++){if(m<c.length){const g=await n.getFileHandle(c[m]).then(S=>S.getFile()),y=new Uint8Array(await g.arrayBuffer()),v=gb(y,h);await r.write(km(v))}if(m<d.length){const g=await a(d[m]),y=xk(g,2),v=gb(y,p);await r.write(km(v))}}}var ia=function(){this.init=function(){var e={};this.on=function(t,r){e[t]||(e[t]=[]),e[t]=e[t].concat(r)},this.off=function(t,r){var i;return e[t]?(i=e[t].indexOf(r),e[t]=e[t].slice(),e[t].splice(i,1),i>-1):!1},this.trigger=function(t){var r,i,s,a;
117if(r=e[t],!!r)if(arguments.length===2)for(s=r.length,i=0;i<s;++i)r[i].call(this,arguments[1]);else{for(a=[],i=arguments.length,i=1;i<arguments.length;++i)a.push(arguments[i]);for(s=r.length,i=0;i<s;++i)r[i].apply(this,a)}},this.dispose=function(){e={}}}};ia.prototype.pipe=function(n){return this.on("data",function(e){n.push(e)}),this.on("done",function(e){n.flush(e)}),this.on("partialdone",function(e){n.partialFlush(e)}),this.on("endedtimeline",function(e){n.endTimeline(e)}),this.on("reset",function(e){n.reset(e)}),n};ia.prototype.push=function(n){this.trigger("data",n)};ia.prototype.flush=function(n){this.trigger("done",n)};ia.prototype.partialFlush=function(n){this.trigger("partialdone",n)};ia.prototype.endTimeline=function(n){this.trigger("endedtimeline",n)};ia.prototype.reset=function(n){this.trigger("reset",n)};var kn=ia,vS=9e4,SS,ES,Wh,xS,bk,Ik,wk;SS=function(e){return e*vS};ES=function(e,t){return e*t};Wh=function(e){return e/vS};xS=function(e,t){return e/t};bk=function(e,t){return SS(xS(e,t))};Ik=function(e,t){return ES(Wh(e),t)};wk=function(e,t,r){return Wh(r?e:e-t)};var gs={ONE_SECOND_IN_TS:vS,secondsToVideoTs:SS,secondsToAudioTs:ES,videoTsToSeconds:Wh,audioTsToSeconds:xS,audioTsToVideoTs:bk,videoTsToAudioTs:Ik,metadataTsToSeconds:wk},z9=kn,K9=gs.ONE_SECOND_IN_TS,$f,yb=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];$f=function(e){var t,r=0;$f.prototype.init.call(this),this.skipWarn_=function(i,s){this.trigger("log",{level:"warn",message:"adts skiping bytes "+i+" to "+s+" in frame "+r+" outside syncword"})},this.push=function(i){var s=0,a,o,l,u,c;if(e||(r=0),i.type==="audio"){t&&t.length?(l=t,t=new Uint8Array(l.byteLength+i.data.byteLength),t.set(l),t.set(i.data,l.byteLength)):t=i.data;for(var d;s+7<t.length;){if(t[s]!==255||(t[s+1]&246)!==240){typeof d!="number"&&(d=s),s++;continue}if(typeof d=="number"&&(this.skipWarn_(d,s),d=null),o=(~t[s+1]&1)*2,a=(t[s+3]&3)<<11|t[s+4]<<3|(t[s+5]&224)>>5,u=((t[s+6]&3)+1)*1024,c=u*K9/yb[(t[s+2]&60)>>>2],t.byteLength-s<a)break;this.trigger("data",{pts:i.pts+r*c,dts:i.dts+r*c,sampleCount:u,audioobjecttype:(t[s+2]>>>6&3)+1,channelcount:(t[s+2]&1)<<2|(t[s+3]&192)>>>6,samplerate:yb[(t[s+2]&60)>>>2],samplingfrequencyindex:(t[s+2]&60)>>>2,samplesize:16,data:t.subarray(s+7+o,s+a)}),r++,s+=a}typeof d=="number"&&(this.skipWarn_(d,s),d=null),t=t.subarray(s)}},this.flush=function(){r=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}};$f.prototype=new z9;var zh=$f,Rk;Rk=function(e){var t=e.byteLength,r=0,i=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+i},this.loadWord=function(){var s=e.byteLength-t,a=new Uint8Array(4),o=Math.min(4,t);if(o===0)throw new Error("no bytes available");a.set(e.subarray(s,s+o)),r=new DataView(a.buffer).getUint32(0),i=o*8,t-=o},this.skipBits=function(s){var a;i>s?(r<<=s,i-=s):(s-=i,a=Math.floor(s/8),s-=a*8,t-=a,this.loadWord(),r<<=s,i-=s)},this.readBits=function(s){var a=Math.min(i,s),o=r>>>32-a;return i-=a,i>0?r<<=a:t>0&&this.loadWord(),a=s-a,a>0?o<<a|this.readBits(a):o},this.skipLeadingZeros=function(){var s;for(s=0;s<i;++s)if(r&2147483648>>>s)return r<<=s,i-=s,s;return this.loadWord(),s+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var s=this.skipLeadingZeros();return this.readBits(s+1)-1},this.readExpGolomb=function(){var s=this.readUnsignedExpGolomb();return 1&s?1+s>>>1:-1*(s>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var q9=Rk,Ak=kn,Y9=q9,Gf,jf,Lk;jf=function(){var e=0,t,r;jf.prototype.init.call(this),this.push=function(i){var s;r?(s=new Uint8Array(r.byteLength+i.data.byteLength),s.set(r),s.set(i.data,r.byteLength),r=s):r=i.data;for(var a=r.byteLength;e<a-3;e++)if(r[e+2]===1){t=e+5;break}for(;t<a;)switch(r[t]){case 0:if(r[t-1]!==0){t+=2;break}else if(r[t-2]!==0){t++;break}e+3!==t-2&&this.trigger("data",r.subarray(e+3,t-2));do t++;while(r[t]!==1&&t<a);e=t-2,t+=3;break;case 1:if(r[t-1]!==0||r[t-2]!==0){t+=3;break}this.trigger("data",r.subarray(e+3,t-2)),e=t-2,t+=3;break;default:t+=3;break}r=r.subarray(e),t-=e,e=0},this.reset=function(){r=null,e=0,this.trigger("reset")},this.flush=function(){r&&r.byteLength>3&&this.trigger("data",r.subarray(e+3)),r=null,e=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}};jf.prototype=new Ak;Lk={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0};Gf=function(){var e=new jf,t,r,i,s,a,o,l;Gf.prototype.init.call(this),t=this,this.push=function(u){u.type==="video"&&(r=u.trackId,i=u.pts,s=u.dts,e.push(u))},e.on("data",function(u){var c={trackId:r,pts:i,dts:s,data:u,nalUnitTypeCode:u[0]&3
1171};switch(c.nalUnitTypeCode){case 5:c.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:c.nalUnitType="sei_rbsp",c.escapedRBSP=a(u.subarray(1));break;case 7:c.nalUnitType="seq_parameter_set_rbsp",c.escapedRBSP=a(u.subarray(1)),c.config=o(c.escapedRBSP);break;case 8:c.nalUnitType="pic_parameter_set_rbsp";break;case 9:c.nalUnitType="access_unit_delimiter_rbsp";break}t.trigger("data",c)}),e.on("done",function(){t.trigger("done")}),e.on("partialdone",function(){t.trigger("partialdone")}),e.on("reset",function(){t.trigger("reset")}),e.on("endedtimeline",function(){t.trigger("endedtimeline")}),this.flush=function(){e.flush()},this.partialFlush=function(){e.partialFlush()},this.reset=function(){e.reset()},this.endTimeline=function(){e.endTimeline()},l=function(c,d){var f=8,h=8,p,m;for(p=0;p<c;p++)h!==0&&(m=d.readExpGolomb(),h=(f+m+256)%256),f=h===0?f:h},a=function(c){for(var d=c.byteLength,f=[],h=1,p,m;h<d-2;)c[h]===0&&c[h+1]===0&&c[h+2]===3?(f.push(h+2),h+=2):h++;if(f.length===0)return c;p=d-f.length,m=new Uint8Array(p);var g=0;for(h=0;h<p;g++,h++)g===f[0]&&(g++,f.shift()),m[h]=c[g];return m},o=function(c){var d=0,f=0,h=0,p=0,m,g,y,v,S,x,T,w,I,R,A,b=[1,1],C,k;if(m=new Y9(c),g=m.readUnsignedByte(),v=m.readUnsignedByte(),y=m.readUnsignedByte(),m.skipUnsignedExpGolomb(),Lk[g]&&(S=m.readUnsignedExpGolomb(),S===3&&m.skipBits(1),m.skipUnsignedExpGolomb(),m.skipUnsignedExpGolomb(),m.skipBits(1),m.readBoolean()))for(A=S!==3?8:12,k=0;k<A;k++)m.readBoolean()&&(k<6?l(16,m):l(64,m));if(m.skipUnsignedExpGolomb(),x=m.readUnsignedExpGolomb(),x===0)m.readUnsignedExpGolomb();else if(x===1)for(m.skipBits(1),m.skipExpGolomb(),m.skipExpGolomb(),T=m.readUnsignedExpGolomb(),k=0;k<T;k++)m.skipExpGolomb();if(m.skipUnsignedExpGolomb(),m.skipBits(1),w=m.readUnsignedExpGolomb(),I=m.readUnsignedExpGolomb(),R=m.readBits(1),R===0&&m.skipBits(1),m.skipBits(1),m.readBoolean()&&(d=m.readUnsignedExpGolomb(),f=m.readUnsignedExpGolomb(),h=m.readUnsignedExpGolomb(),p=m.readUnsignedExpGolomb()),m.readBoolean()&&m.readBoolean()){switch(C=m.readUnsignedByte(),C){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[m.readUnsignedByte()<<8|m.readUnsignedByte(),m.readUnsignedByte()<<8|m.readUnsignedByte()];break}}b&&b[0]/b[1]}return{profileIdc:g,levelIdc:y,profileCompatibility:v,width:(w+1)*16-d*2-f*2,height:(2-R)*(I+1)*16-h*2-p*2,sarRatio:b}}};Gf.prototype=new Ak;var TS={H264Stream:Gf},X9={Adts:zh,h264:TS},Ck=Math.pow(2,32),Q9=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r;return t.getBigUint64?(r=t.getBigUint64(0),r<Number.MAX_SAFE_INTEGER?Number(r):r):t.getUint32(0)*Ck+t.getUint32(4)},ko={getUint64:Q9,MAX_UINT32:Ck},vb=ko.MAX_UINT32,Re,kk,Dk,$0,Pk,Ok,Mk,Fk,G0,Nk,Uk,Bk,$k,Gk,jk,Hk,Vk,Wk,zk,Kk,qk,j0,Te,H0,Yk,Xk,Sb,Eb,Qk,Jk,Zk,eD,Ld,tD,nD,rD;(function(){var n;if(Te={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(n in Te)Te.hasOwnProperty(n)&&(Te[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]);H0=new Uint8Array([105,115,111,109]),Xk=new Uint8Array([97,118,99,49]),Yk=new Uint8Array([0,0,0,1]),Sb=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Eb=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),Qk={video:Sb,audio:Eb},eD=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),Zk=new Uint8Array([0,0,0,0,0,0,0,0]),Ld=new Uint8Array([0,0,0,0,0,0,0,0]),tD=Ld,nD=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),rD=Ld,Jk=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})();Re=function(e){var t=[],r=0,i,s,a;for(i=1;i<arguments.length;i++)t.push(arguments[i]);for(i=t.length;i--;)r+=t[i].byteLength;for(s=new Uint8Array(r+8),a=new DataView(s.buffer,s.byteOffset,s.byteLength),a.setUint32(0,s.byteLength),s.set(e,4),i=0,r=8;i<t.length;i++)s.set(t[i],r),r+=t[i].byteLength;return s};kk=function(){return Re(Te.dinf,Re(Te.dref,eD))};Dk=function(e){return Re(Te.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))};$0=function(){return Re(Te.ftyp,H0,Yk,H0,Xk)};Hk=function(e){return Re(Te.hdlr,Qk[e])};Pk=function(e){return Re(Te.mdat,e)};jk=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,e.duration&255,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=e.samplerate&255),Re(Te.mdhd,t)};Gk=function(e){return Re(Te.mdia,jk(e),Hk(e.type),Mk(e))};Ok=function(e){return Re(Te.mfhd,new Uint8Array([0,0,0,0,(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255]))};Mk=function(e){return Re(Te.minf,e.type==="video"?Re(Te.vmhd,Jk):Re(Te.smhd,Zk),kk(),Wk(e))};Fk=function(e,t){for(var r=[],i=t.length;i--;)r[i]=Kk(t[i]);return Re.apply(null,[Te.moof,Ok(e)].concat(r))};G0=function(e){for(var t=e.length,r=[];t--;)r[t]=Bk(e[t]);return Re.apply(null,[Te.moov,Uk(4294967295)].concat(r).concat(Nk(e)))};Nk=function(e){for(var t=e.length,r=[];t--;)r[t]=qk(e[t]);return Re.apply(null,[Te.mvex].concat(r))};Uk=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Re(Te.mvhd,t)};Vk=function(e){var t=e.samples||[],r=new Uint8Array(4+t.length),i,s;for(s=0;s<t.length;s++)i=t[s].flags,r[s+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return Re(Te.sdtp,r)};Wk=function(e){return Re(Te.stbl,zk(e),Re(Te.stts,rD),Re(Te.stsc,tD),Re(Te.stsz,nD),Re(Te.stco,Ld))};(function(){var n,e;zk=function(r){return Re(Te.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r.type==="video"?n(r):e(r))},n=function(r){var i=r.sps||[],s=r.pps||[],a=[],o=[],l,u;for(l=0;l<i.length;l++)a.push((i[l].byteLength&65280)>>>8),a.push(i[l].byteLength&255),a=a.concat(Array.prototype.slice.call(i[l]));for(l=0;l<s.length;l++)o.push((s[l].byteLength&65280)>>>8),o.push(s[l].byteLength&255),o=o.concat(Array.prototype.slice.call(s[l]));if(u=[Te.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(r.width&65280)>>8,r.width&255,(r.height&65280)>>8,r.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),Re(Te.avcC,new Uint8Array([1,r.profileIdc,r.profileCompatibility,r.levelIdc,255].concat([i.length],a,[s.length],o))),Re(Te.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],r.sarRatio){var c=r.sarRatio[0],d=r.sarRatio[1];u.push(Re(Te.pasp,new Uint8Array([(c&4278190080)>>24,(c&16711680)>>16,(c&65280)>>8,c&255,(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255])))}return Re.apply(null,u)},e=function(r){return Re(Te.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(r.channelcount&65280)>>8,r.channelcount&255,(r.samplesize&65280)>>8,r.samplesize&255,0,0,0,0,(r.samplerate&65280)>>8,r.samplerate&255,0,0]),Dk(r))}})();$k=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,0,(e.duration&4278190080)>>24,(e.duration&16711680)>>16,(e.duration&65280)>>8,e.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(e.width&65280)>>8,e.width&255,0,0,(e.height&65280)>>8,e.height&255,0,0]);return Re(Te.tkhd,t)};Kk=function(e){var t,r,i,s,a,o,l;return t=Re(Te.tfhd,new Uint8Array([0,0,0,58,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),o=Math.floor(e.baseMediaDecodeTime/vb),l=Math.floor(e.baseMediaDecodeTime%vb),r=Re(Te.tfdt,new Uint8Array([1,0,0,0,o>>>24&255,o>>>16&255,o>>>8&255,o&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255])),a=92,e.type==="audio"?(i=j0(e,a),Re(Te.traf,t,r,i)):(s=Vk(e),i=j0(e,s.length+a),Re(Te.traf,t,r,i,s))};Bk=function(e){return e.duration=e.duration||4294967295,Re(Te.trak,$k(e),Gk(e))};qk=function(e){var t=new Uint8Array([0,0,0,0,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.type!=="video"&&(t[t.length-1]=0),Re(Te.trex,t)};(function(){var n,e,t;t=function(i,s){var a=0,o=0,l=0,u=0;return i.length&&(i[0].duration!==void 0&&(a=1),i[0].size!==void 0&&(o=2),i[0].flags!==void 0&&(l=4),i[0].compositionTimeOffset!==void 0&&(u=8)),[0,0,a|o|l|u,1,(i.length&4278190080)>>>24,(i.length&16711680)>>>16,(i.length&65280)>>>8,i.length&255,(s&4278190080)>>>24,(s&16711680)>>>16,(s&65280)>>>8,s&255]},e=function(i,s){var a,o,l,u,c,d;for(u=i.samples||[],s+=20+16*u.length,l=t(u,s),o=new Uint8Array(l.length+u.length*16),o.set(l),a=l.length,d=0;d<u.length;d++)c=u[d],o[a++]=(c.duration&4278190080)>>>24,o[a++]=(c.duration&16711680)>>>16,o[a++]=(c.duration&65280)>>>8,o[a++]=c.duration&255,o[a++]=(c.size&4278190080)>>>24,o[a++]=(c.size&16711680)>>>16,o[a++]=(c.size&65280)>>>8,o[a++]=c.size&255,o[a++]=c.flags.isLeading<<2|c.flags.dependsOn,o[a++]=c.flags.isDependedOn<<6|c.flags.hasRedundancy<<4|c.flags.paddingValue<<1|c.flags.isNonSyncSample,o[a++]=c.flags.degradationPriority&61440,o[a++]=c.flags.degradationPriority&15,o[a++]=(c.compositionTimeOffset&4278190080)>>>24,o[a++]=(c.compositionTimeOffset&16711680)>>>16,o[a++]=(c.compositionTimeOffset&65280)>>>8,o[a++]=c.compositionTimeOffset&255;return Re(Te.trun,o)},n=function(i,s){var a,o,l,u,c,d;for(u=i.samples||[],s+=20+8*u.length,l=t(u,s),a=new Uint8Array(l.length+u.length*8),a.set(l),o=l.length,d=0;d<u.length;d++)c=u[d],a[o++]=(c.duration&4278190080)>>>24,a[o++]=(c.duration&16711680)>>>16,a[o++]=(c.duration&65280)>>>8,a[o++]=c.duration&255,a[o++]=(c.size&4278190080)>>>24,a[o++]=(c.size&16711680)>>>16,a[o++]=(c.size&65280)>>>8,a[o++]=c.size&255;return Re(Te.trun,a)},j0=function(i,s){return i.type==="audio"?n(i,s):e(i,s)}})();var _S={ftyp:$0,mdat:Pk,moof:Fk,moov:G0,initSegment:function(e){var t=$0(),r=G0(e),i;return i=new Uint8Array(t.byteLength+r.byteLength),i.set(t),i.set(r,t.byteLength),i}},J9=function(e){return e>>>0},Z9=function(e){return("00"+e.toString(16)).slice(-2)},Kh={toUnsigned:J9,toHexString:Z9},eK=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3]),t},iD=eK,tK=Kh.toUnsigned,nK=iD,rK=function n(e,t){var r=[],i,s,a,o,l;if(!t.length)return null;for(i=0;i<e.byteLength;)s=tK(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),a=nK(e.subarray(i+4,i+8)),o=s>1?i+s:e.byteLength,a===t[0]&&(t.length===1?r.push(e.subarray(i+8,o)):(l=n(e.subarray(i+8,o),t.slice(1)),l.length&&(r=r.concat(l)))),i=o;return r},iK=rK,sK=function(e){for(var t=0,r=String.fromCharCode(e[t]),i="";r!=="\0";)i+=r,t++,r=String.fromCharCode(e[t]);return i+=r,i},aK={uint8ToCString:sK};aK.uint8ToCString;ko.getUint64;var oK=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4)},i=r.flags[2]&1,s=r.flags[2]&2,a=r.flags[2]&8,o=r.flags[2]&16,l=r.flags[2]&32,u=r.flags[0]&65536,c=r.flags[0]&131072,d;return d=8,i&&(d+=4,r.baseDataOffset=t.getUint32(12),d+=4),s&&(r.sampleDescriptionIndex=t.getUint32(d),d+=4),a&&(r.defaultSampleDuration=t.getUint32(d),d+=4),o&&(r.defaultSampleSize=t.getUint32(d),d+=4),l&&(r.defaultSampleFlags=t.getUint32(d)),u&&(r.durationIsEmpty=!0),!i&&c&&(r.baseDataOffsetIsMoof=!0),r},lK=oK,uK=function(e){return{isLeading:(e[0]&12)>>>2,dependsOn:e[0]&3,isDependedOn:(e[1]&192)>>>6,hasRedundancy:(e[1]&48)>>>4,paddingValue:(e[1]&14)>>>1,isNonSyncSample:e[1]&1,degradationPriority:e[2]<<8|e[3]}},cK=uK,xb=cK,dK=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t.flags[2]&1,s=t.flags[2]&4,a=t.flags[1]&1,o=t.flags[1]&2,l=t.flags[1]&4,u=t.flags[1]&8,c=r.getUint32(4),d=8,f;for(i&&(t.dataOffset=r.getInt32(d),d+=4),s&&c&&(f={flags:xb(e.subarray(d,d+4))},d+=4,a&&(f.duration=r.getUint32(d),d+=4),o&&(f.size=r.getUint32(d),d+=4),u&&(t.version===1?f.compositionTimeOffset=r.getInt32(d):f.compositionTimeOffset=r.getUint32(d),d+=4),t.samples.push(f),c--);c--;)f={},a&&(f.duration=r.getUint32(d),d+=4),o&&(f.size=r.getUint32(d),d+=4),l&&(f.flags=xb(e.subarray(d,d+4)),d+=4),u&&(t.version===1?f.compositionTimeOffset=r.getInt32(d):f.compositionTimeOffset=r.getUint32(d),d+=4),t.samples.push(f);return t},fK=dK,hK=Kh.toUnsigned,pK=ko.getUint64,mK=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return t.version===1?t.baseMediaDecodeTime=pK(e.subarray(4)):t.baseMediaDecodeTime=hK(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},gK=mK,yK=function(e,t,r){if(!e)return-1;for(var i=r;i<e.length;i++)if(e[i]===t)return i;return-1},vK={typedArrayIndexOf:yK},Hc=vK.typedArrayIndexOf,Vc={Utf8:3},sD=function(e,t,r){var i,s="";for(i=t;i<r;i++)s+="%"+("00"+e[i].toString(16)).slice(-2);return s},Ko=function(e,t,r){return decodeURIComponent(sD(e,t,r))},qo=function(e,t,r){return unescape(sD(e,t,r))},ol=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},ll={APIC:function(e){var t=1,r,i,s="-->";e.data[0]===Vc.Utf8&&(r=Hc(e.data,0,t),!(r<0)&&(e.mimeType=qo(e.data,t,r),t=r+1,e.pictureType=e.data[t],t++,i=Hc(e.data,0,t),!(i<0)&&(e.description=Ko(e.data,t,i),t=i+1,e.mimeType===s?e.url=qo(e.data,t,e.data.length):e.pictureData=e.data.subarray(t,e.data.length))))},"T*":function(e){e.data[0]===Vc.Utf8&&(e.value=Ko(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;e.data[0]===Vc.Utf8&&(t=Hc(e.data,0,1),t!==-1&&(e.description=Ko(e.data,1,t),e.value=Ko(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value))},"W*":function(e){e.url=qo(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;e.data[0]===Vc.Utf8&&(t=Hc(e.data,0,1),t!==-1&&(e.description=Ko(e.data,1,t),e.url=qo(e.data,t+1,e.data.length).replace(/\0.*$/,"")))},PRIV:function(e){var t;for(t=0;t<e.data.length;t++)if(e.data[t]===0){e.owner=qo(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}},SK=function(e){var t,r,i=10,s=0,a=[];if(!(e.length<10||e[0]!==73||e[1]!==68||e[2]!==51)){s=ol(e.subarray(6,10)),s+=10;var o=e[5]&64;o&&(i+=4,i+=ol(e.subarray(10,14)),s-=ol(e.subarray(16,20)));do{if(t=ol(e.subarray(i+4,i+8)),t<1)break;r=String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]);var l={id:r,data:e.subarray(i+10,i+t+10)};l.key=l.id,ll[l.id]?ll[l.id](l):l.id[0]==="T"?ll["T*"](l):l.id[0]==="W"&&ll["W*"](l),a.push(l),i+=10,i+=t}while(i<s);return a}},aD={parseId3Frames:SK,parseSyncSafeInteger:ol,frameParsers:ll};Kh.toUnsigned;Kh.toHexString;ko.getUint64;aD.parseId3Frames;var EK=function(e){var t,r,i=[],s=[];for(s.byteLength=0,s.nalCount=0,s.duration=0,i.byteLength=0,t=0;t<e.length;t++)r=e[t],r.nalUnitType==="access_unit_delimiter_rbsp"?(i.length&&(i.duration=r.dts-i.dts,s.byteLength+=i.byteLength,s.nalCount+=i.length,s.duration+=i.duration,s.push(i)),i=[r],i.byteLength=r.data.byteLength,i.pts=r.pts,i.dts=r.dts):(r.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(i.keyFrame=!0),i.duration=r.dts-i.dts,i.byteLength+=r.data.byteLength,i.push(r));return s.length&&(!i.duration||i.duration<=0)&&(i.duration=s[s.length-1].duration),s.byteLength+=i.byteLength,s.nalCount+=i.length,s.duration+=i.duration,s.push(i),s},xK=function(e){var t,r,i=[],s=[];for(i.byteLength=0,i.nalCount=0,i.duration=0,i.pts=e[0].pts,i.dts=e[0].dts,s.byteLength=0,s.nalCount=0,s.duration=0,s.pts=e[0].pts,s.dts=e[0].dts,t=0;t<e.length;t++)r=e[t],r.keyFrame?(i.length&&(s.push(i),s.byteLength+=i.byteLength,s.nalCount+=i.nalCount,s.duration+=i.duration),i=[r],i.nalCount=r.length,i.byteLength=r.byteLength,i.pts=r.pts,i.dts=r.
117dts,i.duration=r.duration):(i.duration+=r.duration,i.nalCount+=r.length,i.byteLength+=r.byteLength,i.push(r));return s.length&&i.duration<=0&&(i.duration=s[s.length-1].duration),s.byteLength+=i.byteLength,s.nalCount+=i.nalCount,s.duration+=i.duration,s.push(i),s},TK=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},_K=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},oD=function(e,t){var r=_K();return r.dataOffset=t,r.compositionTimeOffset=e.pts-e.dts,r.duration=e.duration,r.size=4*e.length,r.size+=e.byteLength,e.keyFrame&&(r.flags.dependsOn=2,r.flags.isNonSyncSample=0),r},bK=function(e,t){var r,i,s,a,o,l=t||0,u=[];for(r=0;r<e.length;r++)for(a=e[r],i=0;i<a.length;i++)o=a[i],s=oD(o,l),l+=s.size,u.push(s);return u},IK=function(e){var t,r,i,s,a,o,l=0,u=e.byteLength,c=e.nalCount,d=u+4*c,f=new Uint8Array(d),h=new DataView(f.buffer);for(t=0;t<e.length;t++)for(s=e[t],r=0;r<s.length;r++)for(a=s[r],i=0;i<a.length;i++)o=a[i],h.setUint32(l,o.data.byteLength),l+=4,f.set(o.data,l),l+=o.data.byteLength;return f},wK=function(e,t){var r,i=t||0,s=[];return r=oD(e,i),s.push(r),s},RK=function(e){var t,r,i=0,s=e.byteLength,a=e.length,o=s+4*a,l=new Uint8Array(o),u=new DataView(l.buffer);for(t=0;t<e.length;t++)r=e[t],u.setUint32(i,r.data.byteLength),i+=4,l.set(r.data,i),i+=r.data.byteLength;return l},lD={groupNalsIntoFrames:EK,groupFramesIntoGops:xK,extendFirstKeyFrame:TK,generateSampleTable:bK,concatenateNalData:IK,generateSampleTableForFrame:wK,concatenateNalDataForFrame:RK},bi=[33,16,5,32,164,27],Dm=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Ue=function(e){for(var t=[];e--;)t.push(0);return t},AK=function(e){return Object.keys(e).reduce(function(t,r){return t[r]=new Uint8Array(e[r].reduce(function(i,s){return i.concat(s)},[])),t},{})},Pm,LK=function(){if(!Pm){var n={96e3:[bi,[227,64],Ue(154),[56]],88200:[bi,[231],Ue(170),[56]],64e3:[bi,[248,192],Ue(240),[56]],48e3:[bi,[255,192],Ue(268),[55,148,128],Ue(54),[112]],44100:[bi,[255,192],Ue(268),[55,163,128],Ue(84),[112]],32e3:[bi,[255,192],Ue(268),[55,234],Ue(226),[112]],24e3:[bi,[255,192],Ue(268),[55,255,128],Ue(268),[111,112],Ue(126),[224]],16e3:[bi,[255,192],Ue(268),[55,255,128],Ue(268),[111,255],Ue(269),[223,108],Ue(195),[1,192]],12e3:[Dm,Ue(268),[3,127,248],Ue(268),[6,255,240],Ue(268),[13,255,224],Ue(268),[27,253,128],Ue(259),[56]],11025:[Dm,Ue(268),[3,127,248],Ue(268),[6,255,240],Ue(268),[13,255,224],Ue(268),[27,255,192],Ue(268),[55,175,128],Ue(108),[112]],8e3:[Dm,Ue(268),[3,121,16],Ue(47),[7]]};Pm=AK(n)}return Pm},CK=LK,Wc=gs,kK=function(e){var t,r,i=0;for(t=0;t<e.length;t++)r=e[t],i+=r.data.byteLength;return i},DK=function(e,t,r,i){var s,a=0,o=0,l=0,u=0,c,d,f;if(t.length&&(s=Wc.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(Wc.ONE_SECOND_IN_TS/(e.samplerate/1024)),r&&i&&(o=s-Math.max(r,i),l=Math.floor(o/a),u=l*a),!(l<1||u>Wc.ONE_SECOND_IN_TS/2))){for(c=CK()[e.samplerate],c||(c=t[0].data),d=0;d<l;d++)f=t[0],t.splice(0,0,{data:c,dts:f.dts-a,pts:f.pts-a});return e.baseMediaDecodeTime-=Math.floor(Wc.videoTsToAudioTs(u,e.samplerate)),u}},PK=function(e,t,r){return t.minSegmentDts>=r?e:(t.minSegmentDts=1/0,e.filter(function(i){return i.dts>=r?(t.minSegmentDts=Math.min(t.minSegmentDts,i.dts),t.minSegmentPts=t.minSegmentDts,!0):!1}))},OK=function(e){var t,r,i=[];for(t=0;t<e.length;t++)r=e[t],i.push({size:r.data.byteLength,duration:1024});return i},MK=function(e){var t,r,i=0,s=new Uint8Array(kK(e));for(t=0;t<e.length;t++)r=e[t],s.set(r.data,i),i+=r.data.byteLength;return s},uD={prefixWithSilence:DK,trimAdtsFramesByEarliestDts:PK,generateSampleTable:OK,concatenateFrameData:MK},FK=gs.ONE_SECOND_IN_TS,NK=function(e,t){typeof t.pts=="number"&&(e.timelineStartInfo.pts===void 0&&(e.timelineStartInfo.pts=t.pts),e.minSegmentPts===void 0?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),e.maxSegmentPts===void 0?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),typeof t.dts=="number"&&(e.timelineStartInfo.dts===void 0&&(e.timelineStartInfo.dts=t.dts),e.minSegmentDts===void 0?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.maxSegmentDts===void 0?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},UK=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},BK=function(e,t){var r,i,s=e.minSegmentDts;return t||(s-=e.timelineStartInfo.dts),r=e.timelineStartInfo.baseMediaDecodeTime,r+=s,r=Math.max(0,r),e.type==="audio"&&(i=e.samplerate/FK,r*=i,r=Math.floor(r)),r},qh={clearDtsInfo:UK,calculateTrackBaseMediaDecodeTime:BK,collectDtsInfo:NK},cD=4,$K=128,GK=function(e){for(var t=0,r={payloadType:-1,payloadSize:0},i=0,s=0;t<e.byteLength&&e[t]!==$K;){for(;e[t]===255;)i+=255,t++;for(i+=e[t++];e[t]===255;)s+=255,t++;if(s+=e[t++],!r.payload&&i===cD){var a=String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6]);if(a==="GA94"){r.payloadType=i,r.payloadSize=s,r.payload=e.subarray(t,t+s);break}else r.payload=void 0}t+=s,i=0,s=0}return r},jK=function(e){return e.payload[0]!==181||(e.payload[1]<<8|e.payload[2])!==49||String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])!=="GA94"||e.payload[7]!==3?null:e.payload.subarray(8,e.payload.length-1)},HK=function(e,t){var r=[],i,s,a,o;if(!(t[0]&64))return r;for(s=t[0]&31,i=0;i<s;i++)a=i*3,o={type:t[a+2]&3,pts:e},t[a+2]&4&&(o.ccData=t[a+3]<<8|t[a+4],r.push(o));return r},VK=function(e){for(var t=e.byteLength,r=[],i=1,s,a;i<t-2;
117)e[i]===0&&e[i+1]===0&&e[i+2]===3?(r.push(i+2),i+=2):i++;if(r.length===0)return e;s=t-r.length,a=new Uint8Array(s);var o=0;for(i=0;i<s;o++,i++)o===r[0]&&(o++,r.shift()),a[i]=e[o];return a},dD={parseSei:GK,parseUserData:jK,parseCaptionPackets:HK,discardEmulationPreventionBytes:VK,USER_DATA_REGISTERED_ITU_T_T35:cD},bS=kn,zc=dD,Dn=function n(e){e=e||{},n.prototype.init.call(this),this.parse708captions_=typeof e.parse708captions=="boolean"?e.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new ot(0,0),new ot(0,1),new ot(1,0),new ot(1,1)],this.parse708captions_&&(this.cc708Stream_=new Xe({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(t){t.on("data",this.trigger.bind(this,"data")),t.on("partialdone",this.trigger.bind(this,"partialdone")),t.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Dn.prototype=new bS;Dn.prototype.push=function(n){var e,t,r;if(n.nalUnitType==="sei_rbsp"&&(e=zc.parseSei(n.escapedRBSP),!!e.payload&&e.payloadType===zc.USER_DATA_REGISTERED_ITU_T_T35&&(t=zc.parseUserData(e),!!t))){if(n.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(n.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}r=zc.parseCaptionPackets(n.pts,t),this.captionPackets_=this.captionPackets_.concat(r),this.latestDts_!==n.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=n.dts}};Dn.prototype.flushCCStreams=function(n){this.ccStreams_.forEach(function(e){return n==="flush"?e.flush():e.partialFlush()},this)};Dn.prototype.flushStream=function(n){if(!this.captionPackets_.length){this.flushCCStreams(n);return}this.captionPackets_.forEach(function(e,t){e.presortIndex=t}),this.captionPackets_.sort(function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}),this.captionPackets_.forEach(function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)},this),this.captionPackets_.length=0,this.flushCCStreams(n)};Dn.prototype.flush=function(){return this.flushStream("flush")};Dn.prototype.partialFlush=function(){return this.flushStream("partialFlush")};Dn.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(n){n.reset()})};Dn.prototype.dispatchCea608Packet=function(n){this.setsTextOrXDSActive(n)?this.activeCea608Channel_[n.type]=null:this.setsChannel1Active(n)?this.activeCea608Channel_[n.type]=0:this.setsChannel2Active(n)&&(this.activeCea608Channel_[n.type]=1),this.activeCea608Channel_[n.type]!==null&&this.ccStreams_[(n.type<<1)+this.activeCea608Channel_[n.type]].push(n)};Dn.prototype.setsChannel1Active=function(n){return(n.ccData&30720)===4096};Dn.prototype.setsChannel2Active=function(n){return(n.ccData&30720)===6144};Dn.prototype.setsTextOrXDSActive=function(n){return(n.ccData&28928)===256||(n.ccData&30974)===4138||(n.ccData&30974)===6186};Dn.prototype.dispatchCea708Packet=function(n){this.parse708captions_&&this.cc708Stream_.push(n)};var WK={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},zK=function(e){var t=WK[e]||e;return e&4096&&e===t?"":String.fromCharCode(t)},Hf=function(e){return 32<=e&&e<=127||160<=e&&e<=255},Si=function(e){this.windowNum=e,this.reset()};Si.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0};Si.prototype.getText=function(){return this.rows.join(` 118`)};Si.prototype.clearText=function(){this.rows=[""],this.rowIdx=0};Si.prototype.newLine=function(n){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(n),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--};Si.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1};Si.prototype.addText=function(n){this.rows[this.rowIdx]+=n};Si.prototype.backspace=function(){if(!this.isEmpty()){var n=this.rows[this.rowIdx];this.rows[this.rowIdx]=n.substr(0,n.length-1)}};var Yh=function(e,t,r){this.serviceNum=e,this.text="",this.currentWindow=new Si(-1),this.windows=[],this.stream=r,typeof t=="string"&&this.createTextDecoder(t)};Yh.prototype.init=function(n,e){this.startPts=n;for(var t=0;t<8;t++)this.windows[t]=new Si(t),typeof e=="function"&&(this.windows[t].beforeRowOverflow=e)};Yh.prototype.setCurrentWindow=function(n){this.currentWindow=this.windows[n]};Yh.prototype.createTextDecoder=function(n){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(n)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+n+" encoding. "+e})}};var Xe=function n(e){e=e||{},n.prototype.init.call(this);var t=this,r=e.captionServices||{},i={},s;Object.keys(r).forEach(function(a){s=r[a],/^SERVICE/.test(a)&&(i[a]=s.encoding)}),this.serviceEncodings=i,this.current708Packet=null,this.services={},this.push=function(a){a.type===3?(t.new708Packet(),t.add708Bytes(a)):(t.current708Packet===null&&t.new708Packet(),t.add708Bytes(a))}};Xe.prototype=new bS;Xe.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}};Xe.prototype.add708Bytes=function(n){var e=n.ccData,t=e>>>8,r=e&255;this.current708Packet.ptsVals.push(n.pts),this.current708Packet.data.push(t),this.current708Packet.data.push(r)};Xe.prototype.push708Packet=function(){var n=this.current708Packet,e=n.data,t=null,r=null,i=0,s=e[i++];for(n.seq=s>>6,n.sizeCode=s&63;i<e.length;i++)s=e[i++],t=s>>5,r=s&31,t===7&&r>0&&(s=e[i++],t=s),this.pushServiceBlock(t,i,r),r>0&&(i+=r-1)};Xe.prototype.pushServiceBlock=function(n,e,t){var r,i=e,s=this.current708Packet.data,a=this.services[n];for(a||(a=this.initService(n,i));i<e+t&&i<s.length;i++)r=s[i],Hf(r)?i=this.handleText(i,a):r===24?i=this.multiByteCharacter(i,a):r===16?i=this.extendedCommands(i,a):128<=r&&r<=135?i=this.setCurrentWindow(i,a):152<=r&&r<=159?i=this.defineWindow(i,a):r===136?i=this.clearWindows(i,a):r===140?i=this.deleteWindows(i,a):r===137?i=this.displayWindows(i,a):r===138?i=this.hideWindows(i,a):r===139?i=this.toggleWindows(i,a):r===151?i=this.setWindowAttributes(i,a):r===144?i=this.setPenAttributes(i,a):r===145?i=this.setPenColor(i,a):r===146?i=this.setPenLocation(i,a):r===143?a=this.reset(i,a):r===8?a.currentWindow.backspace():r===12?a.currentWindow.clearText():r===13?a.currentWindow.pendingNewLine=!0:r===14?a.currentWindow.clearText():r===141&&i++};Xe.prototype.extendedCommands=function(n,e){var t=this.current708Packet.data,r=t[++n];return Hf(r)&&(n=this.handleText(n,e,{isExtended:!0})),n};Xe.prototype.getPts=function(n){return this.current708Packet.ptsVals[Math.floor(n/2)]};Xe.prototype.initService=function(n,e){var r="SERVICE"+n,t=this,r,i;return r in this.serviceEncodings&&(i=this.serviceEncodings[r]),this.services[n]=new Yh(n,i,t),this.services[n].init(this.getPts(e),function(s){t.flushDisplayed(s,t.services[n])}),this.services[n]};Xe.prototype.handleText=function(n,e,t){var r=t&&t.isExtended,i=t&&t.isMultiByte,s=this.current708Packet.data,a=r?4096:0,o=s[n],l=s[n+1],u=e.currentWindow,c,d;return e.textDecoder_&&!r?(i?(d=[o,l],n++):d=[o],c=e.textDecoder_.decode(new Uint8Array(d))):c=zK(a|o),u.pendingNewLine&&!u.isEmpty()&&u.newLine(this.getPts(n)),u.pendingNewLine=!1,u.addText(c),n};Xe.prototype.multiByteCharacter=function(n,e){var t=this.current708Packet.data,r=t[n+1],i=t[n+2];return Hf(r)&&Hf(i)&&(n=this.handleText(++n,e,{isMultiByte:!0})),n};Xe.prototype.setCurrentWindow=function(n,e){var t=this.current708Packet.data,r=t[n],i=r&7;return e.setCurrentWindow(i),n};Xe.prototype.defineWindow=function(n,e){var t=this.current708Packet.data,r=t[n],i=r&7;e.setCurrentWindow(i);var s=e.currentWindow;return r=t[++n],s.visible=(r&32)>>5,s.rowLock=(r&16)>>4,s.columnLock=(r&8)>>3,s.priority=r&7,r=t[++n],s.relativePositioning=(r&128)>>7,s.anchorVertical=r&127,r=t[++n],s.anchorHorizontal=r,r=t[++n],s.anchorPoint=(r&240)>>4,s.rowCount=r&15,r=t[++n],s.columnCount=r&63,r=t[++n],s.windowStyle=(r&56)>>3,s.penStyle=r&7,s.virtualRowCount=s.rowCount+1,n};Xe.prototype.setWindowAttributes=function(n,e){var t=this.current708Packet.data,r=t[n],i=e.currentWindow.winAttr;return r=t[++n],i.fillOpacity=(r&192)>>6,i.fillRed=(r&48)>>4,i.fillGreen=(r&12)>>2,i.fillBlue=r&3,r=t[++n],i.borderType=(r&192)>>6,i.borderRed=(r&48)>>4,i.borderGreen=(r&12)>>2,i.borderBlue=r&3,r=t[++n],i.borderType+=(r&128)>>5,i.wordWrap=(r&64)>>6,i.printDirection=(r&48)>>4,i.scrollDirection=(r&12)>>2,i.justify=r&3,r=t[++n],i.effectSpeed=(r&240)>>4,i.effectDirection=(r&12)>>2,i.displayEffect=r&3,n};Xe.prototype.flushDisplayed=function(n,e){for(var t=[],r=0;r<8;r++)e.windows[r].visible&&!e.windows[r].isEmpty()&&t.push(e.windows[r].getText());e.endPts=n,e.text=t.join(` 119 120`),this.pushCaption(e),e.startPts=n};Xe.prototype.pushCaption=function(n){n.text!==""&&(this.trigger("data",{startPts:n.startPts,endPts:n.endPts,text:n.text,stream
120:"cc708_"+n.serviceNum}),n.text="",n.startPts=n.endPts)};Xe.prototype.displayWindows=function(n,e){var t=this.current708Packet.data,r=t[++n],i=this.getPts(n);this.flushDisplayed(i,e);for(var s=0;s<8;s++)r&1<<s&&(e.windows[s].visible=1);return n};Xe.prototype.hideWindows=function(n,e){var t=this.current708Packet.data,r=t[++n],i=this.getPts(n);this.flushDisplayed(i,e);for(var s=0;s<8;s++)r&1<<s&&(e.windows[s].visible=0);return n};Xe.prototype.toggleWindows=function(n,e){var t=this.current708Packet.data,r=t[++n],i=this.getPts(n);this.flushDisplayed(i,e);for(var s=0;s<8;s++)r&1<<s&&(e.windows[s].visible^=1);return n};Xe.prototype.clearWindows=function(n,e){var t=this.current708Packet.data,r=t[++n],i=this.getPts(n);this.flushDisplayed(i,e);for(var s=0;s<8;s++)r&1<<s&&e.windows[s].clearText();return n};Xe.prototype.deleteWindows=function(n,e){var t=this.current708Packet.data,r=t[++n],i=this.getPts(n);this.flushDisplayed(i,e);for(var s=0;s<8;s++)r&1<<s&&e.windows[s].reset();return n};Xe.prototype.setPenAttributes=function(n,e){var t=this.current708Packet.data,r=t[n],i=e.currentWindow.penAttr;return r=t[++n],i.textTag=(r&240)>>4,i.offset=(r&12)>>2,i.penSize=r&3,r=t[++n],i.italics=(r&128)>>7,i.underline=(r&64)>>6,i.edgeType=(r&56)>>3,i.fontStyle=r&7,n};Xe.prototype.setPenColor=function(n,e){var t=this.current708Packet.data,r=t[n],i=e.currentWindow.penColor;return r=t[++n],i.fgOpacity=(r&192)>>6,i.fgRed=(r&48)>>4,i.fgGreen=(r&12)>>2,i.fgBlue=r&3,r=t[++n],i.bgOpacity=(r&192)>>6,i.bgRed=(r&48)>>4,i.bgGreen=(r&12)>>2,i.bgBlue=r&3,r=t[++n],i.edgeRed=(r&48)>>4,i.edgeGreen=(r&12)>>2,i.edgeBlue=r&3,n};Xe.prototype.setPenLocation=function(n,e){var t=this.current708Packet.data,r=t[n],i=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,r=t[++n],i.row=r&15,r=t[++n],i.column=r&63,n};Xe.prototype.reset=function(n,e){var t=this.getPts(n);return this.flushDisplayed(t,e),this.initService(e.serviceNum,n)};var KK={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Kc=function(e){return e===null?"":(e=KK[e]||e,String.fromCharCode(e))},Xh=14,qK=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],$s=function(){for(var e=[],t=Xh+1;t--;)e.push("");return e},ot=function n(e,t){n.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(r){var i,s,a,o,l;if(i=r.ccData&32639,i===this.lastControlCode_){this.lastControlCode_=null;return}if((i&61440)===4096?this.lastControlCode_=i:i!==this.PADDING_&&(this.lastControlCode_=null),a=i>>>8,o=i&255,i!==this.PADDING_)if(i===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(i===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(r.pts),this.flushDisplayed(r.pts),s=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=s,this.startPts_=r.pts;else if(i===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(r.pts);else if(i===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(r.pts);else if(i===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(r.pts);else if(i===this.CARRIAGE_RETURN_)this.clearFormatting(r.pts),this.flushDisplayed(r.pts),this.shiftRowsUp_(),this.startPts_=r.pts;else if(i===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(i===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(r.pts),this.displayed_=$s();else if(i===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=$s();else if(i===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(r.pts),this.displayed_=$s()),this.mode_="paintOn",this.startPts_=r.pts;else if(this.isSpecialCharacter(a,o))a=(a&3)<<8,l=Kc(a|o),this[this.mode_](r.pts,l),this.column_++;else if(this.isExtCharacter(a,o))this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=(a&3)<<8,l=Kc(a|o),this[this.mode_](r.pts,l),this.column_++;else if(this.isMidRowCode(a,o))this.clearFormatting(r.pts),this[this.mode_](r.pts," "),this.column_++,(o&14)===14&&this.addFormatting(r.pts,["i"]),(o&1)===1&&this.addFormatting(r.pts,["u"]);else if(this.isOffsetControlCode(a,o))this.column_+=o&3;else if(this.isPAC(a,o)){var u=qK.indexOf(i&7968);this.mode_==="rollUp"&&(u-this.rollUpRows_+1<0&&(u=this.rollUpRows_-1),this.setRollUp(r.pts,u)),u!==this.row_&&(this.clearFormatting(r.pts),this.row_=u),o&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(r.pts,["u"]),(i&16)===16&&(this.column_=((i&14)>>1)*4),this.isColorPAC(o)&&(o&14)===14&&this.addFormatting(r.pts,["i"])}
120else this.isNormalChar(a)&&(o===0&&(o=null),l=Kc(a),l+=Kc(o),this[this.mode_](r.pts,l),this.column_+=l.length)}};ot.prototype=new bS;ot.prototype.flushDisplayed=function(n){var e=this.displayed_.map(function(t,r){try{return t.trim()}catch{return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+r+"."}),""}},this).join(` 121`).replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:n,text:e,stream:this.name_})};ot.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=$s(),this.nonDisplayed_=$s(),this.lastControlCode_=null,this.column_=0,this.row_=Xh,this.rollUpRows_=2,this.formatting_=[]};ot.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46};ot.prototype.isSpecialCharacter=function(n,e){return n===this.EXT_&&e>=48&&e<=63};ot.prototype.isExtCharacter=function(n,e){return(n===this.EXT_+1||n===this.EXT_+2)&&e>=32&&e<=63};ot.prototype.isMidRowCode=function(n,e){return n===this.EXT_&&e>=32&&e<=47};ot.prototype.isOffsetControlCode=function(n,e){return n===this.OFFSET_&&e>=33&&e<=35};ot.prototype.isPAC=function(n,e){return n>=this.BASE_&&n<this.BASE_+8&&e>=64&&e<=127};ot.prototype.isColorPAC=function(n){return n>=64&&n<=79||n>=96&&n<=127};ot.prototype.isNormalChar=function(n){return n>=32&&n<=127};ot.prototype.setRollUp=function(n,e){if(this.mode_!=="rollUp"&&(this.row_=Xh,this.mode_="rollUp",this.flushDisplayed(n),this.nonDisplayed_=$s(),this.displayed_=$s()),e!==void 0&&e!==this.row_)for(var t=0;t<this.rollUpRows_;t++)this.displayed_[e-t]=this.displayed_[this.row_-t],this.displayed_[this.row_-t]="";e===void 0&&(e=this.row_),this.topRow_=e-this.rollUpRows_+1};ot.prototype.addFormatting=function(n,e){this.formatting_=this.formatting_.concat(e);var t=e.reduce(function(r,i){return r+"<"+i+">"},"");this[this.mode_](n,t)};ot.prototype.clearFormatting=function(n){if(this.formatting_.length){var e=this.formatting_.reverse().reduce(function(t,r){return t+"</"+r+">"},"");this.formatting_=[],this[this.mode_](n,e)}};ot.prototype.popOn=function(n,e){var t=this.nonDisplayed_[this.row_];t+=e,this.nonDisplayed_[this.row_]=t};ot.prototype.rollUp=function(n,e){var t=this.displayed_[this.row_];t+=e,this.displayed_[this.row_]=t};ot.prototype.shiftRowsUp_=function(){var n;for(n=0;n<this.topRow_;n++)this.displayed_[n]="";for(n=this.row_+1;n<Xh+1;n++)this.displayed_[n]="";for(n=this.topRow_;n<this.row_;n++)this.displayed_[n]=this.displayed_[n+1];this.displayed_[this.row_]=""};ot.prototype.paintOn=function(n,e){var t=this.displayed_[this.row_];t+=e,this.displayed_[this.row_]=t};var fD={CaptionStream:Dn,Cea608Stream:ot,Cea708Stream:Xe},Qh={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},YK=kn,XK=8589934592,QK=4294967296,Tb="shared",V0=function(e,t){var r=1;for(e>t&&(r=-1);Math.abs(t-e)>QK;)e+=r*XK;return e},hD=function n(e){var t,r;n.prototype.init.call(this),this.type_=e||Tb,this.push=function(i){this.type_!==Tb&&i.type!==this.type_||(r===void 0&&(r=i.dts),i.dts=V0(i.dts,r),i.pts=V0(i.pts,r),t=i.dts,this.trigger("data",i))},this.flush=function(){r=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){r=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};hD.prototype=new YK;var pD={TimestampRolloverStream:hD,handleRollover:V0},JK=kn,ZK=Qh,Ii=aD,Vf;Vf=function(e){var t={descriptor:e&&e.descriptor},r=0,i=[],s=0,a;if(Vf.prototype.init.call(this),this.dispatchType=ZK.METADATA_STREAM_TYPE.toString(16),t.descriptor)for(a=0;a<t.descriptor.length;a++)this.dispatchType+=("00"+t.descriptor[a].toString(16)).slice(-2);this.push=function(o){var l,u,c,d,f,h;if(o.type==="timed-metadata"){if(o.dataAlignmentIndicator&&(s=0,i.length=0),i.length===0&&(o.data.length<10||o.data[0]!==73||o.data[1]!==68||o.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(i.push(o),s+=o.data.byteLength,i.length===1&&(r=Ii.parseSyncSafeInteger(o.data.subarray(6,10)),r+=10),!(s<r)){for(l={data:new Uint8Array(r),frames:[],pts:i[0].pts,dts:i[0].dts},f=0;f<r;)l.data.set(i[0].data.subarray(0,r-f),f),f+=i[0].data.byteLength,s-=i[0].data.byteLength,i.shift();u=10,l.data[5]&64&&(u+=4,u+=Ii.parseSyncSafeInteger(l.data.subarray(10,14)),r-=Ii.parseSyncSafeInteger(l.data.subarray(16,20)));do{if(c=Ii.parseSyncSafeInteger(l.data.subarray(u+4,u+8)),c<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(h=String.fromCharCode(l.data[u],l.data[u+1],l.data[u+2],l.data[u+3]),d={id:h,data:l.data.subarray(u+10,u+c+10)},d.key=d.id,Ii.frameParsers[d.id]?Ii.frameParsers[d.id](d):d.id[0]==="T"?Ii.frameParsers["T*"](d):d.id[0]==="W"&&Ii.frameParsers["W*"](d),d.owner==="com.apple.streaming.transportStreamTimestamp"){var p=d.data,m=(p[3]&1)<<30|p[4]<<22|p[5]<<14|p[6]<<6|p[7]>>>2;m*=4,m+=p[7]&3,d.timeStamp=m,l.pts===void 0&&l.dts===void 0&&(l.pts=d.timeStamp,l.dts=d.timeStamp),this.trigger("timestamp",d)}
121l.frames.push(d),u+=10,u+=c}while(u<r);this.trigger("data",l)}}}};Vf.prototype=new JK;var eq=Vf,IS=kn,Om=fD,cr=Qh,tq=pD.TimestampRolloverStream,Wf,xu,zf,Sa=188,Mm=71;Wf=function(){var e=new Uint8Array(Sa),t=0;Wf.prototype.init.call(this),this.push=function(r){var i=0,s=Sa,a;for(t?(a=new Uint8Array(r.byteLength+t),a.set(e.subarray(0,t)),a.set(r,t),t=0):a=r;s<a.byteLength;){if(a[i]===Mm&&a[s]===Mm){this.trigger("data",a.subarray(i,s)),i+=Sa,s+=Sa;continue}i++,s++}i<a.byteLength&&(e.set(a.subarray(i),0),t=a.byteLength-i)},this.flush=function(){t===Sa&&e[0]===Mm&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}};Wf.prototype=new IS;xu=function(){var e,t,r,i;xu.prototype.init.call(this),i=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(a,o){var l=0;o.payloadUnitStartIndicator&&(l+=a[l]+1),o.type==="pat"?t(a.subarray(l),o):r(a.subarray(l),o)},t=function(a,o){o.section_number=a[7],o.last_section_number=a[8],i.pmtPid=(a[10]&31)<<8|a[11],o.pmtPid=i.pmtPid},r=function(a,o){var l,u,c,d;if(a[5]&1){for(i.programMapTable={video:null,audio:null,"timed-metadata":{}},l=(a[1]&15)<<8|a[2],u=3+l-4,c=(a[10]&15)<<8|a[11],d=12+c;d<u;){var f=a[d],h=(a[d+1]&31)<<8|a[d+2];f===cr.H264_STREAM_TYPE&&i.programMapTable.video===null?i.programMapTable.video=h:f===cr.ADTS_STREAM_TYPE&&i.programMapTable.audio===null?i.programMapTable.audio=h:f===cr.METADATA_STREAM_TYPE&&(i.programMapTable["timed-metadata"][h]=f),d+=((a[d+3]&15)<<8|a[d+4])+5}o.programMapTable=i.programMapTable}},this.push=function(s){var a={},o=4;if(a.payloadUnitStartIndicator=!!(s[1]&64),a.pid=s[1]&31,a.pid<<=8,a.pid|=s[2],(s[3]&48)>>>4>1&&(o+=s[o]+1),a.pid===0)a.type="pat",e(s.subarray(o),a),this.trigger("data",a);else if(a.pid===this.pmtPid)for(a.type="pmt",e(s.subarray(o),a),this.trigger("data",a);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([s,o,a]):this.processPes_(s,o,a)},this.processPes_=function(s,a,o){o.pid===this.programMapTable.video?o.streamType=cr.H264_STREAM_TYPE:o.pid===this.programMapTable.audio?o.streamType=cr.ADTS_STREAM_TYPE:o.streamType=this.programMapTable["timed-metadata"][o.pid],o.type="pes",o.data=s.subarray(a),this.trigger("data",o)}};xu.prototype=new IS;xu.STREAM_TYPES={h264:27,adts:15};zf=function(){var e=this,t=!1,r={data:[],size:0},i={data:[],size:0},s={data:[],size:0},a,o=function(c,d){var f,h=c[0]<<16|c[1]<<8|c[2];d.data=new Uint8Array,h===1&&(d.packetLength=6+(c[4]<<8|c[5]),d.dataAlignmentIndicator=(c[6]&4)!==0,f=c[7],f&192&&(d.pts=(c[9]&14)<<27|(c[10]&255)<<20|(c[11]&254)<<12|(c[12]&255)<<5|(c[13]&254)>>>3,d.pts*=4,d.pts+=(c[13]&6)>>>1,d.dts=d.pts,f&64&&(d.dts=(c[14]&14)<<27|(c[15]&255)<<20|(c[16]&254)<<12|(c[17]&255)<<5|(c[18]&254)>>>3,d.dts*=4,d.dts+=(c[18]&6)>>>1)),d.data=c.subarray(9+c[8]))},l=function(c,d,f){var h=new Uint8Array(c.size),p={type:d},m=0,g=0,y=!1,v;if(!(!c.data.length||c.size<9)){for(p.trackId=c.data[0].pid,m=0;m<c.data.length;m++)v=c.data[m],h.set(v.data,g),g+=v.data.byteLength;o(h,p),y=d==="video"||p.packetLength<=c.size,(f||y)&&(c.size=0,c.data.length=0),y&&e.trigger("data",p)}};zf.prototype.init.call(this),this.push=function(u){({pat:function(){},pes:function(){var d,f;switch(u.streamType){case cr.H264_STREAM_TYPE:d=r,f="video";break;case cr.ADTS_STREAM_TYPE:d=i,f="audio";break;case cr.METADATA_STREAM_TYPE:d=s,f="timed-metadata";break;default:return}u.payloadUnitStartIndicator&&l(d,f,!0),d.data.push(u),d.size+=u.data.byteLength},pmt:function(){var d={type:"metadata",tracks:[]};a=u.programMapTable,a.video!==null&&d.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+a.video,codec:"avc",type:"video"}),a.audio!==null&&d.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+a.audio,codec:"adts",type:"audio"}),t=!0,e.trigger("data",d)}})[u.type]()},this.reset=function(){r.size=0,r.data.length=0,i.size=0,i.data.length=0,this.trigger("reset")},this.flushStreams_=function(){l(r,"video"),l(i,"audio"),l(s,"timed-metadata")},this.flush=function(){if(!t&&a){var u={type:"metadata",tracks:[]};a.video!==null&&u.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+a.video,codec:"avc",type:"video"}),a.audio!==null&&u.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+a.audio,codec:"adts",type:"audio"}),e.trigger("data",u)}t=!1,this.flushStreams_(),this.trigger("done")}};zf.prototype=new IS;var mD={PAT_PID:0,MP2T_PACKET_LENGTH:Sa,TransportPacketStream:Wf,TransportParseStream
121:xu,ElementaryStream:zf,TimestampRolloverStream:tq,CaptionStream:Om.CaptionStream,Cea608Stream:Om.Cea608Stream,Cea708Stream:Om.Cea708Stream,MetadataStream:eq};for(var Fm in cr)cr.hasOwnProperty(Fm)&&(mD[Fm]=cr[Fm]);var Jh=mD,nq=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],gD=function(e,t){var r=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],i=e[t+5],s=(i&16)>>4;return r=r>=0?r:0,s?r+20:r+10},rq=function n(e,t){return e.length-t<10||e[t]!==73||e[t+1]!==68||e[t+2]!==51?t:(t+=gD(e,t),n(e,t))},iq=function(e){var t=rq(e,0);return e.length>=t+2&&(e[t]&255)===255&&(e[t+1]&240)===240&&(e[t+1]&22)===16},_b=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},sq=function(e,t,r){var i,s="";for(i=t;i<r;i++)s+="%"+("00"+e[i].toString(16)).slice(-2);return s},aq=function(e,t,r){return unescape(sq(e,t,r))},oq=function(e,t){var r=(e[t+5]&224)>>5,i=e[t+4]<<3,s=e[t+3]&6144;return s|i|r},lq=function(e,t){return e[t]===73&&e[t+1]===68&&e[t+2]===51?"timed-metadata":e[t]&!0&&(e[t+1]&240)===240?"audio":null},uq=function(e){for(var t=0;t+5<e.length;){if(e[t]!==255||(e[t+1]&246)!==240){t++;continue}return nq[(e[t+2]&60)>>>2]}return null},cq=function(e){var t,r,i,s;t=10,e[5]&64&&(t+=4,t+=_b(e.subarray(10,14)));do{if(r=_b(e.subarray(t+4,t+8)),r<1)return null;if(s=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]),s==="PRIV"){i=e.subarray(t+10,t+r+10);for(var a=0;a<i.byteLength;a++)if(i[a]===0){var o=aq(i,0,a);if(o==="com.apple.streaming.transportStreamTimestamp"){var l=i.subarray(a+1),u=(l[3]&1)<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2;return u*=4,u+=l[7]&3,u}break}}t+=10,t+=r}while(t<e.byteLength);return null},Zh={isLikelyAacData:iq,parseId3TagSize:gD,parseAdtsSize:oq,parseType:lq,parseSampleRate:uq,parseAacTimestamp:cq},dq=kn,bb=Zh,Kf;Kf=function(){var e=new Uint8Array,t=0;Kf.prototype.init.call(this),this.setTimestamp=function(r){t=r},this.push=function(r){var i=0,s=0,a,o,l,u;for(e.length?(u=e.length,e=new Uint8Array(r.byteLength+u),e.set(e.subarray(0,u)),e.set(r,u)):e=r;e.length-s>=3;){if(e[s]===73&&e[s+1]===68&&e[s+2]===51){if(e.length-s<10||(i=bb.parseId3TagSize(e,s),s+i>e.length))break;o={type:"timed-metadata",data:e.subarray(s,s+i)},this.trigger("data",o),s+=i;continue}else if((e[s]&255)===255&&(e[s+1]&240)===240){if(e.length-s<7||(i=bb.parseAdtsSize(e,s),s+i>e.length))break;l={type:"audio",data:e.subarray(s,s+i),pts:t,dts:t},this.trigger("data",l),s+=i;continue}s++}a=e.length-s,a>0?e=e.subarray(s):e=new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}};Kf.prototype=new dq;var yD=Kf,fq=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],vD=fq,hq=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],SD=hq,ep=kn,Tu=_S,Yo=lD,qc=uD,dr=qh,Yr=Jh,Cd=gs,Ib=zh,pq=TS.H264Stream,mq=yD,gq=Zh.isLikelyAacData,yq=gs.ONE_SECOND_IN_TS,ED=vD,xD=SD,_u,go,qf,Js,vq=function(e,t){t.stream=e,this.trigger("log",t)},wb=function(e,t){for(var r=Object.keys(t),i=0;i<r.length;i++){var s=r[i];s==="headOfPipeline"||!t[s].on||t[s].on("log",vq.bind(e,s))}},Rb=function(e,t){var r;if(e.length!==t.length)return!1;for(r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},TD=function(e,t,r,i,s,a){var o=r-t,l=i-t,u=s-r;return{start:{dts:e,pts:e+o},end:{dts:e+l,pts:e+u},prependedContentDuration:a,baseMediaDecodeTime:e}};go=function(e,t){var r=[],i,s=0,a=0,o=1/0;t=t||{},i=t.firstSequenceNumber||0,go.prototype.init.call(this),this.push=function(l){dr.collectDtsInfo(e,l),e&&ED.forEach(function(u){e[u]=l[u]}),r.push(l)},this.setEarliestDts=function(l){s=l},this.setVideoBaseMediaDecodeTime=function(l){o=l},this.setAudioAppendStart=function(l){a=l},this.flush=function(){var l,u,c,d,f,h,p;if(r.length===0){this.trigger("done","AudioSegmentStream");return}l=qc.trimAdtsFramesByEarliestDts(r,e,s),e.baseMediaDecodeTime=dr.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),p=qc.prefixWithSilence(e,l,a,o),e.samples=qc.generateSampleTable(l),c=Tu.mdat(qc.concatenateFrameData(l)),r=[],u=Tu.moof(i,[e]),d=new Uint8Array(u.byteLength+c.byteLength),i++,d.set(u),d.set(c,u.byteLength),dr.clearDtsInfo(e),f=Math.ceil(yq*1024/e.samplerate),l.length&&(h=l.length*f,this.trigger("segmentTimingInfo",TD(Cd.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),l[0].dts,l[0].pts,l[0].dts+h,l[0].pts+
121h,p||0)),this.trigger("timingInfo",{start:l[0].pts,end:l[0].pts+h})),this.trigger("data",{track:e,boxes:d}),this.trigger("done","AudioSegmentStream")},this.reset=function(){dr.clearDtsInfo(e),r=[],this.trigger("reset")}};go.prototype=new ep;_u=function(e,t){var r,i=[],s=[],a,o;t=t||{},r=t.firstSequenceNumber||0,_u.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(l){dr.collectDtsInfo(e,l),l.nalUnitType==="seq_parameter_set_rbsp"&&!a&&(a=l.config,e.sps=[l.data],xD.forEach(function(u){e[u]=a[u]},this)),l.nalUnitType==="pic_parameter_set_rbsp"&&!o&&(o=l.data,e.pps=[l.data]),i.push(l)},this.flush=function(){for(var l,u,c,d,f,h,p=0,m,g;i.length&&i[0].nalUnitType!=="access_unit_delimiter_rbsp";)i.shift();if(i.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(l=Yo.groupNalsIntoFrames(i),c=Yo.groupFramesIntoGops(l),c[0][0].keyFrame||(u=this.getGopForFusion_(i[0],e),u?(p=u.duration,c.unshift(u),c.byteLength+=u.byteLength,c.nalCount+=u.nalCount,c.pts=u.pts,c.dts=u.dts,c.duration+=u.duration):c=Yo.extendFirstKeyFrame(c)),s.length){var y;if(t.alignGopsAtEnd?y=this.alignGopsAtEnd_(c):y=this.alignGopsAtStart_(c),!y){this.gopCache_.unshift({gop:c.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),i=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}dr.clearDtsInfo(e),c=y}dr.collectDtsInfo(e,c),e.samples=Yo.generateSampleTable(c),f=Tu.mdat(Yo.concatenateNalData(c)),e.baseMediaDecodeTime=dr.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",c.map(function(v){return{pts:v.pts,dts:v.dts,byteLength:v.byteLength}})),m=c[0],g=c[c.length-1],this.trigger("segmentTimingInfo",TD(e.baseMediaDecodeTime,m.dts,m.pts,g.dts+g.duration,g.pts+g.duration,p)),this.trigger("timingInfo",{start:c[0].pts,end:c[c.length-1].pts+c[c.length-1].duration}),this.gopCache_.unshift({gop:c.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),i=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),d=Tu.moof(r,[e]),h=new Uint8Array(d.byteLength+f.byteLength),r++,h.set(d),h.set(f,d.byteLength),this.trigger("data",{track:e,boxes:h}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),i=[],this.gopCache_.length=0,s.length=0,this.trigger("reset")},this.resetStream_=function(){dr.clearDtsInfo(e),a=void 0,o=void 0},this.getGopForFusion_=function(l){var u=45e3,c=1/0,d,f,h,p,m;for(m=0;m<this.gopCache_.length;m++)p=this.gopCache_[m],h=p.gop,!(!(e.pps&&Rb(e.pps[0],p.pps[0]))||!(e.sps&&Rb(e.sps[0],p.sps[0])))&&(h.dts<e.timelineStartInfo.dts||(d=l.dts-h.dts-h.duration,d>=-1e4&&d<=u&&(!f||c>d)&&(f=p,c=d)));return f?f.gop:null},this.alignGopsAtStart_=function(l){var u,c,d,f,h,p,m,g;for(h=l.byteLength,p=l.nalCount,m=l.duration,u=c=0;u<s.length&&c<l.length&&(d=s[u],f=l[c],d.pts!==f.pts);){if(f.pts>d.pts){u++;continue}c++,h-=f.byteLength,p-=f.nalCount,m-=f.duration}return c===0?l:c===l.length?null:(g=l.slice(c),g.byteLength=h,g.duration=m,g.nalCount=p,g.pts=g[0].pts,g.dts=g[0].dts,g)},this.alignGopsAtEnd_=function(l){var u,c,d,f,h,p;for(u=s.length-1,c=l.length-1,h=null,p=!1;u>=0&&c>=0;){if(d=s[u],f=l[c],d.pts===f.pts){p=!0;break}if(d.pts>f.pts){u--;continue}u===s.length-1&&(h=c),c--}if(!p&&h===null)return null;var m;if(p?m=c:m=h,m===0)return l;var g=l.slice(m),y=g.reduce(function(v,S){return v.byteLength+=S.byteLength,v.duration+=S.duration,v.nalCount+=S.nalCount,v},{byteLength:0,duration:0,nalCount:0});return g.byteLength=y.byteLength,g.duration=y.duration,g.nalCount=y.nalCount,g.pts=g[0].pts,g.dts=g[0].dts,g},this.alignGopsWith=function(l){s=l}};_u.prototype=new ep;Js=function(e,t){this.numberOfTracks=0,this.metadataStream=t,e=e||{},typeof e.remux<"u"?this.remuxTracks=!!e.remux:this.remuxTracks=!0,typeof e.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Js.prototype.init.call(this),this.push=function(r){if(r.text)return this.pendingCaptions.push(r);if(r.frames)return this.pendingMetadata.push(r);this.pendingTracks.push(r.track),this.pendingBytes+=r.boxes.byteLength,r.track.type==="video"&&(this.videoTrack=r.track,this.pendingBoxes.push(r.boxes)),r.track.type==="audio"&&(this.audioTrack=r.track,this.pendingBoxes.unshift(r.boxes))}};Js.prototype=new ep;Js.prototype.flush=function(n){var e=0,t={captions:[],captionStream
vendor: 6,947 bytes, line 121
121s:{},metadata:[],info:{}},r,i,s,a=0,o;if(this.pendingTracks.length<this.numberOfTracks){if(n!=="VideoSegmentStream"&&n!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,xD.forEach(function(l){t.info[l]=this.videoTrack[l]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,ED.forEach(function(l){t.info[l]=this.audioTrack[l]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?t.type=this.pendingTracks[0].type:t.type="combined",this.emittedTracks+=this.pendingTracks.length,s=Tu.initSegment(this.pendingTracks),t.initSegment=new Uint8Array(s.byteLength),t.initSegment.set(s),t.data=new Uint8Array(this.pendingBytes),o=0;o<this.pendingBoxes.length;o++)t.data.set(this.pendingBoxes[o],e),e+=this.pendingBoxes[o].byteLength;for(o=0;o<this.pendingCaptions.length;o++)r=this.pendingCaptions[o],r.startTime=Cd.metadataTsToSeconds(r.startPts,a,this.keepOriginalTimestamps),r.endTime=Cd.metadataTsToSeconds(r.endPts,a,this.keepOriginalTimestamps),t.captionStreams[r.stream]=!0,t.captions.push(r);for(o=0;o<this.pendingMetadata.length;o++)i=this.pendingMetadata[o],i.cueTime=Cd.metadataTsToSeconds(i.pts,a,this.keepOriginalTimestamps),t.metadata.push(i);for(t.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",t),o=0;o<t.captions.length;o++)r=t.captions[o],this.trigger("caption",r);for(o=0;o<t.metadata.length;o++)i=t.metadata[o],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)};Js.prototype.setRemux=function(n){this.remuxTracks=n};qf=function(e){var t=this,r=!0,i,s;qf.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new Yr.MetadataStream,a.aacStream=new mq,a.audioTimestampRolloverStream=new Yr.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new Yr.TimestampRolloverStream("timed-metadata"),a.adtsStream=new Ib,a.coalesceStream=new Js(e,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",function(o){a.aacStream.setTimestamp(o.timeStamp)}),a.aacStream.on("data",function(o){o.type!=="timed-metadata"&&o.type!=="audio"||a.audioSegmentStream||(s=s||{timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new go(s,e),a.audioSegmentStream.on("log",t.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),t.trigger("trackinfo",{hasAudio:!!s,hasVideo:!!i}))}),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),wb(this,a)},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new Yr.MetadataStream,a.packetStream=new Yr.TransportPacketStream,a.parseStream=new Yr.TransportParseStream,a.elementaryStream=new Yr.ElementaryStream,a.timestampRolloverStream=new Yr.TimestampRolloverStream,a.adtsStream=new Ib,a.h264Stream=new pq,a.captionStream=new Yr.CaptionStream(e),a.coalesceStream=new Js(e,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",function(o){var l;if(o.type==="metadata"){for(l=o.tracks.length;l--;)!i&&o.tracks[l].type==="video"?(i=o.tracks[l],i.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime):!s&&o.tracks[l].type==="audio"&&(s=o.tracks[l],s.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime);i&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new _u(i,e),a.videoSegmentStream.on("log",t.getLogTrigger_("videoSegmentStream")),a.videoSegmentStream.on("timelineStartInfo",function(u){s&&!e.keepOriginalTimestamps&&(s.timelineStartInfo=u,a.audioSegmentStream.setEarliestDts(u.dts-t.baseMediaDecodeTime))}),a.videoSegmentStream.on("processedGopsInfo",t.trigger.bind(t,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",t.trigger.bind(t,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",function(u){s&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(u)}),a.videoSegmentStream.on("timingInfo",t.trigger.bind(t,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),s&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new go(s,e),a.audioSegmentStream.on("log",t.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",t.trigger.bind(t,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),t.trigger("trackinfo",{hasAudio:!!s,hasVideo:!!i})}}),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",function(o){o.dispatchType=a.metadataStream.dispatchType,t.trigger("id3Frame",o)}),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),wb(this,a)},this.setBaseMediaDecodeTime=function(a){var o=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=a),s&&(s.timelineStartInfo.dts=void 0,s.timelineStartInfo.pts=void 0,dr.clearDtsInfo(s),o.audioTimestampRolloverStream&&o.audioTimestampRolloverStream.discontinuity()),i&&(o.videoSegmentStream&&(o.videoSegmentStream.gopCache_=[]),i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,dr.clearDtsInfo(i),o.captionStream.reset()),o.timestampRolloverStream&&o.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(a){s&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(a)},this.setRemux=function(a){var o=this.transmuxPipeline_;e.remux=a,o&&o.coalesceStream&&o.coalesceStream.setRemux(a)},this.alignGopsWith=function(a){i&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(a)},this.getLogTrigger_=function(a){var o=this;return function(l){l.stream=a,o.trigger("log",l)}}
121,this.push=function(a){if(r){var o=gq(a);o&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!o&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(a)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}};qf.prototype=new ep;var Nm={Transmuxer:qf,VideoSegmentStream:_u,AudioSegmentStream:go};dD.discardEmulationPreventionBytes;fD.CaptionStream;var Sq={Transmuxer:Nm.Transmuxer,AudioSegmentStream:Nm.AudioSegmentStream,VideoSegmentStream:Nm.VideoSegmentStream},Fe;Fe=function(e,t){var r=0,i=16384,s=function(d,f){var h,p=d.position+f;p<d.bytes.byteLength||(h=new Uint8Array(p*2),h.set(d.bytes.subarray(0,d.position),0),d.bytes=h,d.view=new DataView(d.bytes.buffer))},a=Fe.widthBytes||new Uint8Array(5),o=Fe.heightBytes||new Uint8Array(6),l=Fe.videocodecidBytes||new Uint8Array(12),u;if(!Fe.widthBytes){for(u=0;u<5;u++)a[u]="width".charCodeAt(u);for(u=0;u<6;u++)o[u]="height".charCodeAt(u);for(u=0;u<12;u++)l[u]="videocodecid".charCodeAt(u);Fe.widthBytes=a,Fe.heightBytes=o,Fe.videocodecidBytes=l}switch(this.keyFrame=!1,e){case Fe.VIDEO_TAG:this.length=16,i*=6;break;case Fe.AUDIO_TAG:this.length=13,this.keyFrame=!0;break;case Fe.METADATA_TAG:this.length=29,this.keyFrame=!0;break;default:throw new Error("Unknown FLV tag type")}this.bytes=new Uint8Array(i),this.view=new DataView(this.bytes.buffer),this.bytes[0]=e,this.position=this.length,this.keyFrame=t,this.pts=0,this.dts=0,this.writeBytes=function(c,d,f){var h=d||0,p;
121f=f||c.byteLength,p=h+f,s(this,f),this.bytes.set(c.subarray(h,p),this.position),this.position+=f,this.length=Math.max(this.length,this.position)},this.writeByte=function(c){s(this,1),this.bytes[this.position]=c,this.position++,this.length=Math.max(this.length,this.position)},this.writeShort=function(c){s(this,2),this.view.setUint16(this.position,c),this.position+=2,this.length=Math.max(this.length,this.position)},this.negIndex=function(c){return this.bytes[this.length-c]},this.nalUnitSize=function(){return r===0?0:this.length-(r+4)},this.startNalUnit=function(){if(r>0)throw new Error("Attempted to create new NAL wihout closing the old one");r=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(c){var d,f;this.length===r+4?this.length-=4:r>0&&(d=r+4,f=this.length-d,this.position=r,this.view.setUint32(this.position,f),this.position=this.length,c&&c.push(this.bytes.subarray(d,d+f))),r=0},this.writeMetaDataDouble=function(c,d){var f;if(s(this,2+c.length+9),this.view.setUint16(this.position,c.length),this.position+=2,c==="width")this.bytes.set(a,this.position),this.position+=5;else if(c==="height")this.bytes.set(o,this.position),this.position+=6;else if(c==="videocodecid")this.bytes.set(l,this.position),this.position+=12;else for(f=0;f<c.length;f++)this.bytes[this.position]=c.charCodeAt(f),this.position++;this.position++,this.view.setFloat64(this.position,d),this.position+=8,this.length=Math.max(this.length,this.position),++r},this.writeMetaDataBoolean=function(c,d){var f;for(s(this,2),this.view.setUint16(this.position,c.length),this.position+=2,f=0;f<c.length;f++)s(this,1),this.bytes[this.position]=c.charCodeAt(f),this.position++;s(this,2),this.view.setUint8(this.position,1),this.position++,this.view.setUint8(this.position,d?1:0),this.position++,this.length=Math.max(this.length,this.position),++r},this.finalize=function(){var c,d;switch(this.bytes[0]){case Fe.VIDEO_TAG:this.bytes[11]=(this.keyFrame||t?16:32)|7,this.bytes[12]=t?0:1,c=this.pts-this.dts,this.bytes[13]=(c&16711680)>>>16,this.bytes[14]=(c&65280)>>>8,this.bytes[15]=(c&255)>>>0;break;case Fe.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=t?0:1;break;case Fe.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,r),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position;break}return d=this.length-11,this.bytes[1]=(d&16711680)>>>16,this.bytes[2]=(d&65280)>>>8,this.bytes[3]=(d&255)>>>0,this.bytes[4]=(this.dts&16711680)>>>16,this.bytes[5]=(this.dts&65280)>>>8,this.bytes[6]=(this.dts&255)>>>0,this.bytes[7]=(this.dts&4278190080)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,s(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=Fe.frameTime(this.bytes),this}};Fe.AUDIO_TAG=8;Fe.VIDEO_TAG=9;Fe.METADATA_TAG=18;Fe.isAudioFrame=function(n){return Fe.AUDIO_TAG===n[0]};Fe.isVideoFrame=function(n){return Fe.VIDEO_TAG===n[0]};Fe.isMetaData=function(n){return Fe.METADATA_TAG===n[0]};Fe.isKeyFrame=function(n){return Fe.isVideoFrame(n)?n[11]===23:!!(Fe.isAudioFrame(n)||Fe.isMetaData(n))};Fe.frameTime=function(n){var e=n[4]<<16;return e|=n[5]<<8,e|=n[6]<<0,e|=n[7]<<24,e};var Eq=Fe,xq=kn,wS=function n(e){this.numberOfTracks=0,this.metadataStream=e.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,n.prototype.init.call(this),this.push=function(t){if(t.text)return this.pendingCaptions.push(t);if(t.frames)return this.pendingMetadata.push(t);t.track.type==="video"&&(this.videoTrack=t.track,this.videoTags=t.tags,this.pendingTracks++),t.track.type==="audio"&&(this.audioTrack=t.track,this.audioTags=t.tags,this.pendingTracks++)}};wS.prototype=new xq;wS.prototype.flush=function(n){var e,t,r,i,s={tags:{}
121,captions:[],captionStreams:{},metadata:[]};if(this.pendingTracks<this.numberOfTracks){if(n!=="VideoSegmentStream"&&n!=="AudioSegmentStream")return;if(this.pendingTracks===0&&(this.processedTracks++,this.processedTracks<this.numberOfTracks))return}if(this.processedTracks+=this.pendingTracks,this.pendingTracks=0,!(this.processedTracks<this.numberOfTracks)){for(this.videoTrack?i=this.videoTrack.timelineStartInfo.pts:this.audioTrack&&(i=this.audioTrack.timelineStartInfo.pts),s.tags.videoTags=this.videoTags,s.tags.audioTags=this.audioTags,r=0;r<this.pendingCaptions.length;r++)t=this.pendingCaptions[r],t.startTime=t.startPts-i,t.startTime/=9e4,t.endTime=t.endPts-i,t.endTime/=9e4,s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)e=this.pendingMetadata[r],e.cueTime=e.pts-i,e.cueTime/=9e4,s.metadata.push(e);s.metadata.dispatchType=this.metadataStream.dispatchType,this.videoTrack=null,this.audioTrack=null,this.videoTags=[],this.audioTags=[],this.pendingCaptions.length=0,this.pendingMetadata.length=0,this.pendingTracks=0,this.processedTracks=0,this.trigger("data",s),this.trigger("done")}};var Tq=wS,_q=function(){var e=this;this.list=[],this.push=function(t){this.list.push({bytes:t.bytes,dts:t.dts,pts:t.pts,keyFrame:t.keyFrame,metaDataTag:t.metaDataTag})},Object.defineProperty(this,"length",{get:function(){return e.list.length}})},bq=_q,RS=kn,Un=Eq,wi=Jh,Iq=zh,wq=TS.H264Stream,Rq=Tq,_D=bq,W0,Yf,Xf,AS,bD,ID;AS=function(e,t){typeof t.pts=="number"&&(e.timelineStartInfo.pts===void 0?e.timelineStartInfo.pts=t.pts:e.timelineStartInfo.pts=Math.min(e.timelineStartInfo.pts,t.pts)),typeof t.dts=="number"&&(e.timelineStartInfo.dts===void 0?e.timelineStartInfo.dts=t.dts:e.timelineStartInfo.dts=Math.min(e.timelineStartInfo.dts,t.dts))};bD=function(e,t){var r=new Un(Un.METADATA_TAG);return r.dts=t,r.pts=t,r.writeMetaDataDouble("videocodecid",7),r.writeMetaDataDouble("width",e.width),r.writeMetaDataDouble("height",e.height),r};ID=function(e,t){var r,i=new Un(Un.VIDEO_TAG,!0);for(i.dts=t,i.pts=t,i.writeByte(1),i.writeByte(e.profileIdc),i.writeByte(e.profileCompatibility),i.writeByte(e.levelIdc),i.writeByte(255),i.writeByte(225),i.writeShort(e.sps[0].length),i.writeBytes(e.sps[0]),i.writeByte(e.pps.length),r=0;r<e.pps.length;++r)i.writeShort(e.pps[r].length),i.writeBytes(e.pps[r]);return i};Xf=function(e){var t=[],r=[],i;Xf.prototype.init.call(this),this.push=function(s){AS(e,s),e&&(e.audioobjecttype=s.audioobjecttype,e.channelcount=s.channelcount,e.samplerate=s.samplerate,e.samplingfrequencyindex=s.samplingfrequencyindex,e.samplesize=s.samplesize,e.extraData=e.audioobjecttype<<11|e.samplingfrequencyindex<<7|e.channelcount<<3),s.pts=Math.round(s.pts/90),s.dts=Math.round(s.dts/90),t.push(s)},this.flush=function(){var s,a,o,l=new _D;if(t.length===0){this.trigger("done","AudioSegmentStream");return}for(o=-1/0;t.length;)s=t.shift(),r.length&&s.pts>=r[0]&&(o=r.shift(),this.writeMetaDataTags(l,o)),(e.extraData!==i||s.pts-o>=1e3)&&(this.writeMetaDataTags(l,s.pts),i=e.extraData,o=s.pts),a=new Un(Un.AUDIO_TAG),a.pts=s.pts,a.dts=s.dts,a.writeBytes(s.data),l.push(a.finalize());r.length=0,i=null,this.trigger("data",{track:e,tags:l.list}),this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(s,a){var o;o=new Un(Un.METADATA_TAG),o.pts=a,o.dts=a,o.writeMetaDataDouble("audiocodecid",10),o.writeMetaDataBoolean("stereo",e.channelcount===2),o.writeMetaDataDouble("audiosamplerate",e.samplerate),o.writeMetaDataDouble("audiosamplesize",16),s.push(o.finalize()),o=new Un(Un.AUDIO_TAG,!0),o.pts=a,o.dts=a,o.view.setUint16(o.position,e.extraData),o.position+=2,o.length=Math.max(o.length,o.position),s.push(o.finalize())},this.onVideoKeyFrame=function(s){r.push(s)}};Xf.prototype=new RS;Yf=function(e){var t=[],r,i;Yf.prototype.init.call(this),this.finishFrame=function(s,a){if(a){if(r&&e&&e.newMetadata&&(a.keyFrame||s.length===0)){var o=bD(r,a.dts).finalize(),l=ID(e,a.dts).finalize();o.metaDataTag=l.metaDataTag=!0,s.push(o),s.push(l),e.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),s.push(a.finalize()),i=null}},this.push=function(s){AS(e,s),s.pts=Math.round(s.pts/90),s.dts=Math.round(s.dts/90),t.push(s)},this.flush=function(){for(var s,a=new _D;t.length&&t[0].nalUnitType!=="access_unit_delimiter_rbsp";)t.shift();if(t.length===0){this.trigger("done","VideoSegmentStream");return}for(;t.length;)s=t.shift(),s.nalUnitType==="seq_parameter_set_rbsp"?(e.newMetadata=!0,r=s.config,e.width=r.width,e.height=r.height,e.sps=[s.data],e.profileIdc=r.profileIdc,e.levelIdc=r.levelIdc,e.profileCompatibility=r.profileCompatibility,i.endNalUnit()):s.nalUnitType==="pic_parameter_set_rbsp"?(e.newMetadata=!0,e.pps=[s.data],i.endNalUnit()):s.nalUnitType==="access_unit_delimiter_rbsp"?(i&&this.finishFrame(a,i),i=new Un(Un.VIDEO_TAG),i.pts=s.pts,i.dts=s.dts):(s.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(i.keyFrame=!0),i.endNalUnit()),i.startNalUnit(
121),i.writeBytes(s.data);i&&this.finishFrame(a,i),this.trigger("data",{track:e,tags:a.list}),this.trigger("done","VideoSegmentStream")}};Yf.prototype=new RS;W0=function(e){var t=this,r,i,s,a,o,l,u,c,d,f,h,p;W0.prototype.init.call(this),e=e||{},this.metadataStream=new wi.MetadataStream,e.metadataStream=this.metadataStream,r=new wi.TransportPacketStream,i=new wi.TransportParseStream,s=new wi.ElementaryStream,a=new wi.TimestampRolloverStream("video"),o=new wi.TimestampRolloverStream("audio"),l=new wi.TimestampRolloverStream("timed-metadata"),u=new Iq,c=new wq,p=new Rq(e),r.pipe(i).pipe(s),s.pipe(a).pipe(c),s.pipe(o).pipe(u),s.pipe(l).pipe(this.metadataStream).pipe(p),h=new wi.CaptionStream(e),c.pipe(h).pipe(p),s.on("data",function(m){var g,y,v;if(m.type==="metadata"){for(g=m.tracks.length;g--;)m.tracks[g].type==="video"?y=m.tracks[g]:m.tracks[g].type==="audio"&&(v=m.tracks[g]);y&&!d&&(p.numberOfTracks++,d=new Yf(y),c.pipe(d).pipe(p)),v&&!f&&(p.numberOfTracks++,f=new Xf(v),u.pipe(f).pipe(p),d&&d.on("keyframe",f.onVideoKeyFrame))}}),this.push=function(m){r.push(m)},this.flush=function(){r.flush()},this.resetCaptions=function(){h.reset()},p.on("data",function(m){t.trigger("data",m)}),p.on("done",function(){t.trigger("done")})};W0.prototype=new RS;var Aq={},Lq=Jh,Cq=kn,Um=_S,Yc=uD,Xc=qh,kq=gs.ONE_SECOND_IN_TS,Dq=vD,wD=function n(e,t){var r=[],i=0,s=0,a=0,o=1/0,l=null,u=null;t=t||{},n.prototype.init.call(this),this.push=function(c){Xc.collectDtsInfo(e,c),e&&Dq.forEach(function(d){e[d]=c[d]}),r.push(c)},this.setEarliestDts=function(c){s=c},this.setVideoBaseMediaDecodeTime=function(c){o=c},this.setAudioAppendStart=function(c){a=c},this.processFrames_=function(){var c,d,f,h,p;r.length!==0&&(c=Yc.trimAdtsFramesByEarliestDts(r,e,s),c.length!==0&&(e.baseMediaDecodeTime=Xc.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),Yc.prefixWithSilence(e,c,a,o),e.samples=Yc.generateSampleTable(c),f=Um.mdat(Yc.concatenateFrameData(c)),r=[],d=Um.moof(i,[e]),i++,e.initSegment=Um.initSegment([e]),h=new Uint8Array(d.byteLength+f.byteLength),h.set(d),h.set(f,d.byteLength),Xc.clearDtsInfo(e),l===null&&(u=l=c[0].pts),u+=c.length*(kq*1024/e.samplerate),p={start:l},this.trigger("timingInfo",p),this.trigger("data",{track:e,boxes:h})))},this.flush=function(){this.processFrames_(),this.trigger("timingInfo",{start:l,end:u}),this.resetTiming_(),this.trigger("done","AudioSegmentStream")},this.partialFlush=function(){this.processFrames_(),this.trigger("partialdone","AudioSegmentStream")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline","AudioSegmentStream")},this.resetTiming_=function(){Xc.clearDtsInfo(e),l=null,u=null},this.reset=function(){this.resetTiming_(),r=[],this.trigger("reset")}};wD.prototype=new Cq;var Pq=wD,Oq=kn,Bm=_S,Qc=qh,Xo=lD,Mq=SD,RD=function n(e,t){var r=0,i=[],s=[],a,o,l=null,u=null,c,d=!0;t=t||{},n.prototype.init.call(this),this.push=function(f){Qc.collectDtsInfo(e,f),typeof e.timelineStartInfo.dts>"u"&&(e.timelineStartInfo.dts=f.dts),f.nalUnitType==="seq_parameter_set_rbsp"&&!a&&(a=f.config,e.sps=[f.data],Mq.forEach(function(h){e[h]=a[h]},this)),f.nalUnitType==="pic_parameter_set_rbsp"&&!o&&(o=f.data,e.pps=[f.data]),i.push(f)},this.processNals_=function(f){var h;for(i=s.concat(i);i.length&&i[0].nalUnitType!=="access_unit_delimiter_rbsp";)i.shift();if(i.length!==0){var p=Xo.groupNalsIntoFrames(i);if(p.length){if(s=p[p.length-1],f&&(p.pop(),p.duration-=s.duration,p.nalCount-=s.length,p.byteLength-=s.byteLength),!p.length){i=[];return}if(this.trigger("timelineStartInfo",e.timelineStartInfo),d){if(c=Xo.groupFramesIntoGops(p),!c[0][0].keyFrame){if(c=Xo.extendFirstKeyFrame(c),!c[0][0].keyFrame){i=[].concat.apply([],p).concat(s),s=[];return}p=[].concat.apply([],c),p.duration=c.duration}d=!1}for(l===null&&(l=p[0].pts,u=l),u+=p.duration,this.trigger("timingInfo",{start:l,end:u}),h=0;h<p.length;h++){var m=p[h];e.samples=Xo.generateSampleTableForFrame(m);var g=Bm.mdat(Xo.concatenateNalDataForFrame(m));Qc.clearDtsInfo(e),Qc.collectDtsInfo(e,m),e.baseMediaDecodeTime=Qc.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps);var y=Bm.moof(r,[e]);r++,e.initSegment=Bm.initSegment([e]);var v=new Uint8Array(y.byteLength+g.byteLength);v.set(y),v.set(g,y.byteLength),this.trigger("data",{track:e,boxes:v,sequence:r,videoFrameDts:m.dts,videoFramePts:m.pts})}i=[]}}},this.resetTimingAndConfig_=function(){a=void 0,o=void 0,l=null,u=null},this.partialFlush=function(){this.processNals_(!0),this.trigger("partialdone","VideoSegmentStream")},this.flush=function(){this.processNals_(!1),this.resetTimingAndConfig_(
121),this.trigger("done","VideoSegmentStream")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline","VideoSegmentStream")},this.reset=function(){this.resetTimingAndConfig_(),s=[],i=[],d=!0,this.trigger("reset")}};RD.prototype=new Oq;var Fq=RD,AD=kn,ei=Jh,Ab=X9,LD=Pq,Nq=Fq,Lb=qh,Uq=Zh.isLikelyAacData,Bq=zh,$q=yD,z0=gs,CD=function(e){return e.prototype=new AD,e.prototype.init.call(e),e},Gq=function(e){var t={type:"ts",tracks:{audio:null,video:null},packet:new ei.TransportPacketStream,parse:new ei.TransportParseStream,elementary:new ei.ElementaryStream,timestampRollover:new ei.TimestampRolloverStream,adts:new Ab.Adts,h264:new Ab.h264.H264Stream,captionStream:new ei.CaptionStream(e),metadataStream:new ei.MetadataStream};return t.headOfPipeline=t.packet,t.packet.pipe(t.parse).pipe(t.elementary).pipe(t.timestampRollover),t.timestampRollover.pipe(t.h264),t.h264.pipe(t.captionStream),t.timestampRollover.pipe(t.metadataStream),t.timestampRollover.pipe(t.adts),t.elementary.on("data",function(r){if(r.type==="metadata"){for(var i=0;i<r.tracks.length;i++)t.tracks[r.tracks[i].type]||(t.tracks[r.tracks[i].type]=r.tracks[i],t.tracks[r.tracks[i].type].timelineStartInfo.baseMediaDecodeTime=e.baseMediaDecodeTime);t.tracks.video&&!t.videoSegmentStream&&(t.videoSegmentStream=new Nq(t.tracks.video,e),t.videoSegmentStream.on("timelineStartInfo",function(s){t.tracks.audio&&!e.keepOriginalTimestamps&&t.audioSegmentStream.setEarliestDts(s.dts-e.baseMediaDecodeTime)}),t.videoSegmentStream.on("timingInfo",t.trigger.bind(t,"videoTimingInfo")),t.videoSegmentStream.on("data",function(s){t.trigger("data",{type:"video",data:s})}),t.videoSegmentStream.on("done",t.trigger.bind(t,"done")),t.videoSegmentStream.on("partialdone",t.trigger.bind(t,"partialdone")),t.videoSegmentStream.on("endedtimeline",t.trigger.bind(t,"endedtimeline")),t.h264.pipe(t.videoSegmentStream)),t.tracks.audio&&!t.audioSegmentStream&&(t.audioSegmentStream=new LD(t.tracks.audio,e),t.audioSegmentStream.on("data",function(s){t.trigger("data",{type:"audio",data:s})}),t.audioSegmentStream.on("done",t.trigger.bind(t,"done")),t.audioSegmentStream.on("partialdone",t.trigger.bind(t,"partialdone")),t.audioSegmentStream.on("endedtimeline",t.trigger.bind(t,"endedtimeline")),t.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo")),t.adts.pipe(t.audioSegmentStream)),t.trigger("trackinfo",{hasAudio:!!t.tracks.audio,hasVideo:!!t.tracks.video})}}),t.captionStream.on("data",function(r){var i;t.tracks.video?i=t.tracks.video.timelineStartInfo.pts||0:i=0,r.startTime=z0.metadataTsToSeconds(r.startPts,i,e.keepOriginalTimestamps),r.endTime=z0.metadataTsToSeconds(r.endPts,i,e.keepOriginalTimestamps),t.trigger("caption",r)}),t=CD(t),t.metadataStream.on("data",t.trigger.bind(t,"id3Frame")),t},jq=function(e){var t={type:"aac",tracks:{audio:null},metadataStream:new ei.MetadataStream,aacStream:new $q,audioRollover:new ei.TimestampRolloverStream("audio"),timedMetadataRollover:new ei.TimestampRolloverStream("timed-metadata"),adtsStream:new Bq(!0)};return t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioRollover).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataRollover).pipe(t.metadataStream),t.metadataStream.on("timestamp",function(r){t.aacStream.setTimestamp(r.timeStamp)}),t.aacStream.on("data",function(r){r.type!=="timed-metadata"&&r.type!=="audio"||t.audioSegmentStream||(t.tracks.audio=t.tracks.audio||{timelineStartInfo:{baseMediaDecodeTime:e.baseMediaDecodeTime},codec:"adts",type:"audio"},t.audioSegmentStream=new LD(t.tracks.audio,e),t.audioSegmentStream.on("data",function(i){t.trigger("data",{type:"audio",data:i})}),t.audioSegmentStream.on("partialdone",t.trigger.bind(t,"partialdone")),t.audioSegmentStream.on("done",t.trigger.bind(t,"done")),t.audioSegmentStream.on("endedtimeline",t.trigger.bind(t,"endedtimeline")),t.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream),t.trigger("trackinfo",{hasAudio:!!t.tracks.audio,hasVideo:!!t.tracks.video}))}),t=CD(t),t.metadataStream.on("data",t.trigger.bind(t,"id3Frame")),t},Cb=function(e,t){e.on("data",t.trigger.bind(t,"data")),e.on("done",t.trigger.bind(t,"done")),e.on("partialdone",t.trigger.bind(t,"partialdone")),e.on("endedtimeline",t.trigger.bind(t,"endedtimeline")),e.on("audioTimingInfo",t.trigger.bind(t,"audioTimingInfo")),e.on("videoTimingInfo",t.trigger.bind(t,"videoTimingInfo")),e.on("trackinfo",t.trigger.bind(t,"trackinfo")),e.on("id3Frame",function(r){r.dispatchType=e.metadataStream.dispatchType,r.cueTime=z0.videoTsToSeconds(r.pts),t.trigger("id3Frame",r)}),e.on("caption",function(r){t.trigger("caption",r)}
121)},Hq=function n(e){var t=null,r=!0;e=e||{},n.prototype.init.call(this),e.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.push=function(i){if(r){var s=Uq(i);s&&(!t||t.type!=="aac")?(t=jq(e),Cb(t,this)):!s&&(!t||t.type!=="ts")&&(t=Gq(e),Cb(t,this)),r=!1}t.headOfPipeline.push(i)},this.flush=function(){t&&(r=!0,t.headOfPipeline.flush())},this.partialFlush=function(){t&&t.headOfPipeline.partialFlush()},this.endTimeline=function(){t&&t.headOfPipeline.endTimeline()},this.reset=function(){t&&t.headOfPipeline.reset()},this.setBaseMediaDecodeTime=function(i){e.keepOriginalTimestamps||(e.baseMediaDecodeTime=i),t&&(t.tracks.audio&&(t.tracks.audio.timelineStartInfo.dts=void 0,t.tracks.audio.timelineStartInfo.pts=void 0,Lb.clearDtsInfo(t.tracks.audio),t.audioRollover&&t.audioRollover.discontinuity()),t.tracks.video&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),t.tracks.video.timelineStartInfo.dts=void 0,t.tracks.video.timelineStartInfo.pts=void 0,Lb.clearDtsInfo(t.tracks.video)),t.timestampRollover&&t.timestampRollover.discontinuity())},this.setRemux=function(i){e.remux=i,t&&t.coalesceStream&&t.coalesceStream.setRemux(i)},this.setAudioAppendStart=function(i){!t||!t.tracks.audio||!t.audioSegmentStream||t.audioSegmentStream.setAudioAppendStart(i)},this.alignGopsWith=function(i){}};Hq.prototype=new AD;var $m,kb;function Vq(){if(kb)return $m;kb=1;var n=ko.getUint64,e=function(r){var i=new DataView(r.buffer,r.byteOffset,r.byteLength),s={version:r[0],flags:new Uint8Array(r.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},a=12;s.version===0?(s.earliestPresentationTime=i.getUint32(a),s.firstOffset=i.getUint32(a+4),a+=8):(s.earliestPresentationTime=n(r.subarray(a)),s.firstOffset=n(r.subarray(a+8)),a+=16),a+=2;var o=i.getUint16(a);for(a+=2;o>0;a+=12,o--)s.references.push({referenceType:(r[a]&128)>>>7,referencedSize:i.getUint32(a)&2147483647,subsegmentDuration:i.getUint32(a+4),startsWithSap:!!(r[a+8]&128),sapType:(r[a+8]&112)>>>4,sapDeltaTime:i.getUint32(a+8)&268435455});return s};return $m=e,$m}var kD=ko;kD.MAX_UINT32;var Db=kD.getUint64,Wt,K0,Mn=function(e){return new Date(e*1e3-20828448e5)},Cl=iD,Wq=iK,zq=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[],i,s;for(i=0;i+4<e.length;i+=s){if(s=t.getUint32(i),i+=4,s<=0){r.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(e[i]&31){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+e[i]&31);break}}return r},Oi={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:Wt(e.subarray(78,e.byteLength))}},avcC:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:e[4]&3,sps:[],pps:[]},i=e[5]&31,s,a,o,l;for(o=6,l=0;l<i;l++)a=t.getUint16(o),o+=2,r.sps.push(new Uint8Array(e.subarray(o,o+a))),o+=a;for(s=e[o],o++,l=0;l<s;l++)a=t.getUint16(o),o+=2,r.pps.push(new Uint8Array(e.subarray(o,o+a))),o+=a;return r},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},edts:function(e){return{boxes:Wt(e)}},elst:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),edits:[]},i=t.getUint32(4),s;for(s=8;i;i--)r.version===0?(r.edits.push({segmentDuration:t.getUint32(s),mediaTime:t.getInt32(s+4),mediaRate:t.getUint16(s+8)+t.getUint16(s+10)/(256*256)}),s+=12):(r.edits.push({segmentDuration:Db(e.subarray(s)),mediaTime:Db(e.subarray(s+8)),mediaRate:t.getUint16(s+16)+t.getUint16(s+18)/(256*256)}),s+=20);return r},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:e[8]&31,decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(e[26]&7)<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={majorBrand:Cl(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},i=8;i<e.byteLength;)r.compatibleBrands.push(Cl(e.subarray(i,i+4))),i+=4;return r},dinf:function(e){return{boxes:Wt(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:Wt(e.subarray(8))}},hdlr:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:Cl(e.subarray(8,12)),name:""},i=8;for(i=24;i<e.byteLength;i++){if(e[i]===0){i++;break}r.name+=String.fromCharCode(e[i])}return r.name=decodeURIComponent(escape(r.name)),r},mdat:function(e){return{byteLength:e.byteLength,nals:zq(e)}},mdhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=4,i,s={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return s.version===1?(r+=4,s.creationTime=Mn(t.getUint32(r)),r+=8,s.modificationTime=Mn(t.getUint32(r)),r+=4,s.timescale=t.getUint32(r),r+=8,s.duration=t.getUint32(r)):(s.creationTime=Mn(t.getUint32(r)),r+=4,s.modificationTime=Mn(t.getUint32(r)),r+=4,s.timescale=t.getUint32(r),r+=4,s.duration=t.getUint32(r)),r+=4,i=t.getUint16(r),s.language+=String.fromCharCode((i>>10)+96),s.language+=String.fromCharCode(((i&992)>>5)+96),s.language+=String.fromCharCode((i&31)+96),s},mdia:function(e){return{boxes:Wt(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:Wt(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(r.streamDescriptor=Wt(e.subarray(28))[0]),r},moof:function(e){return{boxes:Wt(e)}},moov:function(e){return{boxes:Wt(e)}},mvex:function(e){return{boxes:Wt(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return i.version===1?(r+=4,i.creationTime=Mn(t.getUint32(r)),r+=8,i.modificationTime=Mn(t.getUint32(r)),r+=4,i.timescale=t.getUint32(r),r+=8,i.duration=t.getUint32(r)):(i.creationTime=Mn(t.getUint32(r)),r+=4,i.modificationTime=Mn(t.getUint32(r)),r+=4,i.timescale=t.getUint32(r),r+=4,i.duration=t.getUint32(r)),r+=4,i.rate=t.getUint16(r)+t.getUint16(r+2)/16,r+=4,i.volume=t.getUint8(r)+t.getUint8(r+1)/8,r+=2,r+=2,r+=2*4,i.matrix=new Uint32Array(e.subarray(r,r+9*4)),r+=9*4,r+=6*4,i.nextTrackId=t.getUint32(r),i},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},r;for(r=4;r<e.byteLength;r++)t.samples.push({dependsOn:(e[r]&48)>>4,isDependedOn:(e[r]&12)>>2,hasRedundancy:e[r]&3});return t},sidx:Vq(),smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:Wt(e)}},ctts:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),compositionOffsets:[]},i=t.getUint32(4),s;for(s=8;i;
121s+=8,i--)r.compositionOffsets.push({sampleCount:t.getUint32(s),sampleOffset:t[r.version===0?"getUint32":"getInt32"](s+4)});return r},stss:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),syncSamples:[]},i=t.getUint32(4),s;for(s=8;i;s+=4,i--)r.syncSamples.push(t.getUint32(s));return r},stco:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},i=t.getUint32(4),s;for(s=8;i;s+=4,i--)r.chunkOffsets.push(t.getUint32(s));return r},stsc:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=t.getUint32(4),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]},s;for(s=8;r;s+=12,r--)i.sampleToChunks.push({firstChunk:t.getUint32(s),samplesPerChunk:t.getUint32(s+4),sampleDescriptionIndex:t.getUint32(s+8)});return i},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:Wt(e.subarray(8))}},stsz:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:t.getUint32(4),entries:[]},i;for(i=12;i<e.byteLength;i+=4)r.entries.push(t.getUint32(i));return r},stts:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},i=t.getUint32(4),s;for(s=8;i;s+=8,i--)r.timeToSamples.push({sampleCount:t.getUint32(s),sampleDelta:t.getUint32(s+4)});return r},styp:function(e){return Oi.ftyp(e)},tfdt:gK,tfhd:lK,tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return i.version===1?(r+=4,i.creationTime=Mn(t.getUint32(r)),r+=8,i.modificationTime=Mn(t.getUint32(r)),r+=4,i.trackId=t.getUint32(r),r+=4,r+=8,i.duration=t.getUint32(r)):(i.creationTime=Mn(t.getUint32(r)),r+=4,i.modificationTime=Mn(t.getUint32(r)),r+=4,i.trackId=t.getUint32(r),r+=4,r+=4,i.duration=t.getUint32(r)),r+=4,r+=2*4,i.layer=t.getUint16(r),r+=2,i.alternateGroup=t.getUint16(r),r+=2,i.volume=t.getUint8(r)+t.getUint8(r+1)/8,r+=2,r+=2,i.matrix=new Uint32Array(e.subarray(r,r+9*4)),r+=9*4,i.width=t.getUint16(r)+t.getUint16(r+2)/65536,r+=4,i.height=t.getUint16(r)+t.getUint16(r+2)/65536,i},traf:function(e){return{boxes:Wt(e)}},trak:function(e){return{boxes:Wt(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:e[20]&3,sampleIsDependedOn:(e[21]&192)>>6,sampleHasRedundancy:(e[21]&48)>>4,samplePaddingValue:(e[21]&14)>>1,sampleIsDifferenceSample:!!(e[21]&1),sampleDegradationPriority:t.getUint16(22)}},trun:fK,"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}};Wt=function(e){for(var t=0,r=[],i,s,a,o,l,u=new ArrayBuffer(e.length),c=new Uint8Array(u),d=0;d<e.length;++d)c[d]=e[d];for(i=new DataView(u);t<e.byteLength;)s=i.getUint32(t),a=Cl(e.subarray(t+4,t+8)),o=s>1?t+s:e.byteLength,l=(Oi[a]||function(f){return{data:f}})(e.subarray(t+8,o)),l.size=s,l.type=a,r.push(l),t=o;return r};K0=function(e,t){var r;return t=t||0,r=new Array(t*2+1).join(" "),e.map(function(i,s){return r+i.type+` 122`+Object.keys(i).filter(function(a){return a!=="type"&&a!=="boxes"}).map(function(a){var o=r+" "+a+": ",l=i[a];if(l instanceof Uint8Array||l instanceof Uint32Array){var u=Array.prototype.slice.call(new Uint8Array(l.buffer,l.byteOffset,l.byteLength)).map(function(c){return" "+("00"+c.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return u?u.length===1?o+"<"+u.join("").slice(1)+">":o+`< 123`+u.map(function(c){return r+" "+c}).join(` 124`)+` 125`+r+" >":o+"<>"}return o+JSON.stringify(l,null,2).split(` 126`).map(function(c,d){return d===0?c:r+" "+c}).join(` 127`)}).join(` 128`)+(i.boxes?` 129`+K0(i.boxes,t+1):"")}).join(` 130`)};var Kq={inspect:Wt,textify:K0,parseType:Cl,findBox:Wq,parseTraf:Oi.traf,parseTfdt:Oi.tfdt,parseHdlr:Oi.hdlr,parseTfhd:Oi.tfhd,parseTrun:Oi.trun,parseSidx:Oi.sidx},qq={8:"audio",9:"video",18:"metadata"},Yq=function(e){return"0x"+("00"+e.toString(16)).slice(-2).toUpperCase()},q0=function(e){for(var t=[],r;e.byteLength>0;
130)r=0,t.push(Yq(e[r++])),e=e.subarray(r);return t.join(" ")},Xq=function(e,t){var r=["AVC Sequence Header","AVC NALU","AVC End-of-Sequence"],i=e[1]&parseInt("01111111",2)<<16|e[2]<<8|e[3];return t=t||{},t.avcPacketType=r[e[0]],t.CompositionTime=e[1]&parseInt("10000000",2)?-i:i,e[0]===1?t.nalUnitTypeRaw=q0(e.subarray(4,100)):t.data=q0(e.subarray(4)),t},Qq=function(e,t){var r=["Unknown","Keyframe (for AVC, a seekable frame)","Inter frame (for AVC, a nonseekable frame)","Disposable inter frame (H.263 only)","Generated keyframe (reserved for server use only)","Video info/command frame"],i=e[0]&parseInt("00001111",2);return t=t||{},t.frameType=r[(e[0]&parseInt("11110000",2))>>>4],t.codecID=i,i===7?Xq(e.subarray(1),t):t},Jq=function(e,t){var r=["AAC Sequence Header","AAC Raw"];return t=t||{},t.aacPacketType=r[e[0]],t.data=q0(e.subarray(1)),t},Zq=function(e,t){var r=["Linear PCM, platform endian","ADPCM","MP3","Linear PCM, little endian","Nellymoser 16-kHz mono","Nellymoser 8-kHz mono","Nellymoser","G.711 A-law logarithmic PCM","G.711 mu-law logarithmic PCM","reserved","AAC","Speex","MP3 8-Khz","Device-specific sound"],i=["5.5-kHz","11-kHz","22-kHz","44-kHz"],s=(e[0]&parseInt("11110000",2))>>>4;return t=t||{},t.soundFormat=r[s],t.soundRate=i[(e[0]&parseInt("00001100",2))>>>2],t.soundSize=(e[0]&parseInt("00000010",2))>>>1?"16-bit":"8-bit",t.soundType=e[0]&parseInt("00000001",2)?"Stereo":"Mono",s===10?Jq(e.subarray(1),t):t},eY=function(e){return{tagType:qq[e[0]],dataSize:e[1]<<16|e[2]<<8|e[3],timestamp:e[7]<<24|e[4]<<16|e[5]<<8|e[6],streamID:e[8]<<16|e[9]<<8|e[10]}},DD=function(e){var t=eY(e);switch(e[0]){case 8:Zq(e.subarray(11),t);break;case 9:Qq(e.subarray(11),t);break}return t},tY=function(e){var t=9,r,i=[],s;for(t+=4;t<e.byteLength;)r=e[t+1]<<16,r|=e[t+2]<<8,r|=e[t+3],r+=11,s=e.subarray(t,t+r),i.push(DD(s)),t+=r+4;return i},nY=function(e){return JSON.stringify(e,null,2)},rY={inspectTag:DD,inspect:tY,textify:nY},Gm=Qh,PD=function(e){var t=e[1]&31;return t<<=8,t|=e[2],t},tp=function(e){return!!(e[1]&64)},np=function(e){var t=0;return(e[3]&48)>>>4>1&&(t+=e[4]+1),t},iY=function(e,t){var r=PD(e);return r===0?"pat":r===t?"pmt":t?"pes":null},sY=function(e){var t=tp(e),r=4+np(e);return t&&(r+=e[r]+1),(e[r+10]&31)<<8|e[r+11]},aY=function(e){var t={},r=tp(e),i=4+np(e);if(r&&(i+=e[i]+1),!!(e[i+5]&1)){var s,a,o;s=(e[i+1]&15)<<8|e[i+2],a=3+s-4,o=(e[i+10]&15)<<8|e[i+11];for(var l=12+o;l<a;){var u=i+l;t[(e[u+1]&31)<<8|e[u+2]]=e[u],l+=((e[u+3]&15)<<8|e[u+4])+5}return t}},oY=function(e,t){var r=PD(e),i=t[r];switch(i){case Gm.H264_STREAM_TYPE:return"video";case Gm.ADTS_STREAM_TYPE:return"audio";case Gm.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},lY=function(e){var t=tp(e);if(!t)return null;var r=4+np(e);if(r>=e.byteLength)return null;var i=null,s;return s=e[r+7],s&192&&(i={},i.pts=(e[r+9]&14)<<27|(e[r+10]&255)<<20|(e[r+11]&254)<<12|(e[r+12]&255)<<5|(e[r+13]&254)>>>3,i.pts*=4,i.pts+=(e[r+13]&6)>>>1,i.dts=i.pts,s&64&&(i.dts=(e[r+14]&14)<<27|(e[r+15]&255)<<20|(e[r+16]&254)<<12|(e[r+17]&255)<<5|(e[r+18]&254)>>>3,i.dts*=4,i.dts+=(e[r+18]&6)>>>1)),i},jm=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},uY=function(e){for(var t=4+np(e),r=e.subarray(t),i=0,s=0,a=!1,o;s<r.byteLength-3;s++)if(r[s+2]===1){i=s+5;break}for(;i<r.byteLength;)switch(r[i]){case 0:if(r[i-1]!==0){i+=2;break}else if(r[i-2]!==0){i++;break}s+3!==i-2&&(o=jm(r[s+3]&31),o==="slice_layer_without_partitioning_rbsp_idr"&&(a=!0));do i++;while(r[i]!==1&&i<r.length);s=i-2,i+=3;break;case 1:if(r[i-1]!==0||r[i-2]!==0){i+=3;break}o=jm(r[s+3]&31),o==="slice_layer_without_partitioning_rbsp_idr"&&(a=!0),s=i-2,i+=3;break;default:i+=3;break}return r=r.subarray(s),i-=s,s=0,r&&r.byteLength>3&&(o=jm(r[s+3]&31),o==="slice_layer_without_partitioning_rbsp_idr"&&(a=!0)),a},cY={parseType:iY,parsePat:sY,parsePmt:aY,parsePayloadUnitStartIndicator:tp,parsePesType:oY,parsePesTime:lY,videoPacketContainsKeyFrame:uY},Pb=Qh,ha=pD.handleRollover,Be={};
130Be.ts=cY;Be.aac=Zh;var Is=gs.ONE_SECOND_IN_TS,Jt=188,Mr=71,dY=function(e,t){for(var r=0,i=Jt,s,a;i<e.byteLength;){if(e[r]===Mr&&e[i]===Mr){switch(s=e.subarray(r,i),a=Be.ts.parseType(s,t.pid),a){case"pat":t.pid=Be.ts.parsePat(s);break;case"pmt":var o=Be.ts.parsePmt(s);t.table=t.table||{},Object.keys(o).forEach(function(l){t.table[l]=o[l]});break}r+=Jt,i+=Jt;continue}r++,i++}},OD=function(e,t,r){for(var i=0,s=Jt,a,o,l,u,c,d=!1;s<=e.byteLength;){if(e[i]===Mr&&(e[s]===Mr||s===e.byteLength)){switch(a=e.subarray(i,s),o=Be.ts.parseType(a,t.pid),o){case"pes":l=Be.ts.parsePesType(a,t.table),u=Be.ts.parsePayloadUnitStartIndicator(a),l==="audio"&&u&&(c=Be.ts.parsePesTime(a),c&&(c.type="audio",r.audio.push(c),d=!0));break}if(d)break;i+=Jt,s+=Jt;continue}i++,s++}for(s=e.byteLength,i=s-Jt,d=!1;i>=0;){if(e[i]===Mr&&(e[s]===Mr||s===e.byteLength)){switch(a=e.subarray(i,s),o=Be.ts.parseType(a,t.pid),o){case"pes":l=Be.ts.parsePesType(a,t.table),u=Be.ts.parsePayloadUnitStartIndicator(a),l==="audio"&&u&&(c=Be.ts.parsePesTime(a),c&&(c.type="audio",r.audio.push(c),d=!0));break}if(d)break;i-=Jt,s-=Jt;continue}i--,s--}},fY=function(e,t,r){for(var i=0,s=Jt,a,o,l,u,c,d,f,h,p=!1,m={data:[],size:0};s<e.byteLength;){if(e[i]===Mr&&e[s]===Mr){switch(a=e.subarray(i,s),o=Be.ts.parseType(a,t.pid),o){case"pes":if(l=Be.ts.parsePesType(a,t.table),u=Be.ts.parsePayloadUnitStartIndicator(a),l==="video"&&(u&&!p&&(c=Be.ts.parsePesTime(a),c&&(c.type="video",r.video.push(c),p=!0)),!r.firstKeyFrame)){if(u&&m.size!==0){for(d=new Uint8Array(m.size),f=0;m.data.length;)h=m.data.shift(),d.set(h,f),f+=h.byteLength;if(Be.ts.videoPacketContainsKeyFrame(d)){var g=Be.ts.parsePesTime(d);g?(r.firstKeyFrame=g,r.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}m.size=0}m.data.push(a),m.size+=a.byteLength}break}if(p&&r.firstKeyFrame)break;
130i+=Jt,s+=Jt;continue}i++,s++}for(s=e.byteLength,i=s-Jt,p=!1;i>=0;){if(e[i]===Mr&&e[s]===Mr){switch(a=e.subarray(i,s),o=Be.ts.parseType(a,t.pid),o){case"pes":l=Be.ts.parsePesType(a,t.table),u=Be.ts.parsePayloadUnitStartIndicator(a),l==="video"&&u&&(c=Be.ts.parsePesTime(a),c&&(c.type="video",r.video.push(c),p=!0));break}if(p)break;i-=Jt,s-=Jt;continue}i--,s--}},hY=function(e,t){if(e.audio&&e.audio.length){var r=t;(typeof r>"u"||isNaN(r))&&(r=e.audio[0].dts),e.audio.forEach(function(a){a.dts=ha(a.dts,r),a.pts=ha(a.pts,r),a.dtsTime=a.dts/Is,a.ptsTime=a.pts/Is})}if(e.video&&e.video.length){var i=t;if((typeof i>"u"||isNaN(i))&&(i=e.video[0].dts),e.video.forEach(function(a){a.dts=ha(a.dts,i),a.pts=ha(a.pts,i),a.dtsTime=a.dts/Is,a.ptsTime=a.pts/Is}),e.firstKeyFrame){var s=e.firstKeyFrame;s.dts=ha(s.dts,i),s.pts=ha(s.pts,i),s.dtsTime=s.dts/Is,s.ptsTime=s.pts/Is}}},pY=function(e){for(var t=!1,r=0,i=null,s=null,a=0,o=0,l;e.length-o>=3;){var u=Be.aac.parseType(e,o);switch(u){case"timed-metadata":if(e.length-o<10){t=!0;break}if(a=Be.aac.parseId3TagSize(e,o),a>e.length){t=!0;break}s===null&&(l=e.subarray(o,o+a),s=Be.aac.parseAacTimestamp(l)),o+=a;break;case"audio":if(e.length-o<7){t=!0;break}if(a=Be.aac.parseAdtsSize(e,o),a>e.length){t=!0;break}i===null&&(l=e.subarray(o,o+a),i=Be.aac.parseSampleRate(l)),r++,o+=a;break;default:o++;break}if(t)return null}if(i===null||s===null)return null;var c=Is/i,d={audio:[{type:"audio",dts:s,pts:s},{type:"audio",dts:s+r*1024*c,pts:s+r*1024*c}]};return d},mY=function(e){var t={pid:null,table:null},r={};dY(e,t);for(var i in t.table)if(t.table.hasOwnProperty(i)){var s=t.table[i];switch(s){case Pb.H264_STREAM_TYPE:r.video=[],fY(e,t,r),r.video.length===0&&delete r.video;break;case Pb.ADTS_STREAM_TYPE:r.audio=[],OD(e,t,r),r.audio.length===0&&delete r.audio;break}}return r},gY=function(e,t){var r=Be.aac.isLikelyAacData(e),i;return r?i=pY(e):i=mY(e),!i||!i.audio&&!i.video?null:(hY(i,t),i)},yY={inspect:gY,parseAudioPes_:OD},rp={mp4:Sq,flv:Aq,mp2t:Lq};rp.mp4.tools=Kq;rp.flv.tools=rY;rp.mp2t.tools=yY;var MD=rp;function ur(n){return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}function FD(n){for(let e=4;e+8<=n.length;e++)if(n[e-4]===0&&n[e-3]===0&&n[e-2]===0&&n[e-1]===0&&n[e]===73&&n[e+1]===69&&n[e+2]===78&&n[e+3]===68){const t=e+8;return t<n.length?n.subarray(t):null}return null}function ND(n){return n.length>=8&&n[0]===137&&n[1]===80&&n[2]===78&&n[3]===71}function UD(n,e){return n.getFileHandle(e).then(t=>t.getFile()).then(t=>t.arrayBuffer()).then(t=>new Uint8Array(t))}function Ka(n,e){return(n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3])>>>0}function BD(n){const e=[],t=Math.min(Ka(n,0),n.length);let r=8;for(;r+8<=t;){const i=Ka(n,r);if(i<8)break;if(n[r+4]===116&&n[r+5]===114&&n[r+6]===97&&n[r+7]===102){const s=r+i;let a=r+8;for(;a+8<=s;){const o=Ka(n,a);if(o<8)break;n[a+4]===116&&n[a+5]===102&&n[a+6]===100&&n[a+7]===116&&e.push(a),a+=o}}r+=i}return e}function $D(n,e){return n[e+8]===1?BigInt(n[e+12])<<56n|BigInt(n[e+13])<<48n|BigInt(n[e+14])<<40n|BigInt(n[e+15])<<32n|BigInt(n[e+16])<<24n|BigInt(n[e+17])<<16n|BigInt(n[e+18])<<8n|BigInt(n[e+19]):BigInt(Ka(n,e+12))}function vY(n,e,t){if(n[e+8]===1)for(let i=0;i<8;i++)n[e+12+i]=Number(t>>BigInt(56-i*8)&0xffn);else{const i=Number(t&0xffffffffn);n[e+12]=i>>>24&255,n[e+13]=i>>>16&255,n[e+14]=i>>>8&255,n[e+15]=i&255}}function Y0(n,e){const t=BD(n);if(t.length===0)return n;for(;e.values.length<t.length;)e.values.push(null);const r=[];let i=!1;for(let a=0;a<t.length;a++){const o=$D(n,t[a]);e.values[a]===null&&(e.values[a]=o);const l=o-e.values[a];r.push(l<0n?0n:l),l!==o&&(i=!0)}if(!i)return n;const s=n.slice();for(let a=0;a<t.length;a++)vY(s,t[a],r[a]);return s}function GD(n,e){const t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),s=e.charCodeAt(3);function a(o){const l=[];let u=0,c=!1;for(;u+8<=o.length;){const p=Ka(o,u);if(p<8||u+p>o.length){l.push(o.subarray(u));break}const m=o[u+4],g=o[u+5],y=o[u+6],v=o[u+7];if(m===t&&g===r&&y===i&&v===s){c=!0,u+=p;continue}if(m===109&&g===111&&y===111&&v===118||m===116&&g===114&&y===97&&v===107||m===117&&g===100&&y===116&&v===97){const x=a(o.subarray(u+8,u+p));if(x!==null){const T=8+x.length,w=new Uint8Array(8);w[0]=T>>>24&255,w[1]=T>>>16&255,w[2]=T>>>8&255,w[3]=T&255,w[4]=m,w[5]=g,w[6]=y,w[7]=v,l.push(w,x),c=!0,u+=p;continue}}l.push(o.subarray(u,u+p)),u+=p}if(!c)return null;let d=0;for(const p of l)d+=p.length;const f=new Uint8Array(d);let h=0;for(const p of l)f.set(p,h),h+=p.length;return f}return a(n)??n}function SY(n,e){let t=null,r=0,i=0;for(;r+8<=n.length;){const s=Ka(n,r);if(s<8||r+s>n.length)break;if(n[r+4]===109&&n[r+5]===111&&n[r+6]===111&&n[r+7]===102){for(;e.length<=i;)e.push({values:[]});const o=(t??n).subarray(r,r+s),l=Y0(o,e[i]);l!==o&&(t===null&&(t=n.slice()),t.set(l,r)),i++}r+=s}return t??n}async function EY(n,e,t,r,i=!1){let s=!1,a=null,o=0;const l=[],u=[];let c=null;const d=new MD.mp4.Transmuxer({remux:!0,keepOriginalTimestamps:!0}),f=e.length>0?r/e.length:10,h=Math.max(2,Math.round(120/f)),p=BigInt(Math.max(1,Math.round(f*9e4)));let m=1,g=0,y=null;d.on("data",v=>{if(!s){let x=new Uint8Array(ur(v.initSegment));i&&(x=GD(x,"edts")),a=x,o=x.byteLength,u.push(ur(x)),s=!0}const S=i?SY(new Uint8Array(ur(v.data)),l):v.data;if(m===1){const x=new Uint8Array(ur(S)),T=BD(x);if(T.length>0){const w=$D(x,T[0]);y!==null&&w-y<p*85n/100n&&(m=h),y=w}}u.push(ur(S))}),d.on("error",v=>{c=v});for(let v=0;v<e.length;v++){const S=await UD(n,e[v]),x=ND(S)?FD(S)??S:S;
130if(u.length=0,d.push(x),(v===e.length-1||v===g)&&(d.flush(),g=v+m),c)throw c;for(const w of u)await t.write(w)}if(a&&r>0){const v=Bf(a,r);v.byteLength===o&&(await t.seek(0),await t.write(ur(v)))}}function Ob(n,e,t){return new Promise((r,i)=>{const s=new MD.mp4.Transmuxer({remux:!1,keepOriginalTimestamps:!0,...t});let a=null;const o=[];let l=null;s.on("data",u=>{a||(a=new Uint8Array(ur(u.initSegment))),o.push(new Uint8Array(ur(u.data)))}),s.on("error",u=>{l=u}),(async()=>{try{for(const u of e){let c=await UD(n,u);if(ND(c)&&(c=FD(c)??c),s.push(c),l)throw l}if(s.flush(),l)throw l;r({init:a??new Uint8Array(0),segments:o})}catch(u){i(u)}})()})}async function xY(n,e,t,r,i,s=!1){const[a,o]=await Promise.all([Ob(n,e,{videoTrackOnly:!0}),Ob(n,t,{audioTrackOnly:!0})]);if(s){const d={values:[]};a.segments=a.segments.map(h=>Y0(h,d));const f={values:[d.values[0]??null]};o.segments=o.segments.map(h=>Y0(h,f))}let l=V9(a.init,o.init);s&&(l=GD(l,"edts"));const u=i>0?Bf(l,i):l;await r.write(ur(u));const c=Math.max(a.segments.length,o.segments.length);for(let d=0;d<c;d++)d<a.segments.length&&await r.write(ur(a.segments[d])),d<o.segments.length&&await r.write(ur(xk(o.segments[d],2)))}async function TY(n,e,t,r,i=0,s=!1){t&&t.length>0?await xY(n,e,t,r,i,s):await EY(n,e,r,i,s)}const Mb=5;function Fb(n){const e=n.match(/_(\d+)\.\w+$/);return e?parseInt(e[1],10):-1}function Qo(n){return n?{Range:`bytes=${n.offset}-${n.offset+n.length-1}`}:void 0}class Nb{constructor(e,t={}){we(this,"callbacks");we(this,"concurrency");we(this,"outputWritable",null);we(this,"abortController",null);we(this,"paused",!1);we(this,"resolveResume");we(this,"pausePromise",Promise.resolve());we(this,"qualityResolve",null);we(this,"totalBytesDownloaded",0);we(this,"smoothedSpeedBps",0);we(this,"opfsDirName",null);we(this,"videoFileNames",[]);we(this,"audioFileNames",[]);we(this,"failedVideoSegments",[]);we(this,"failedAudioSegments",[]);we(this,"videoKeyCache",new Map);we(this,"audioKeyCache",new Map);we(this,"pendingUserDecision",null);we(this,"stopRecordingResolve",null);this.callbacks=e,this.concurrency=Math.min(5,Math.max(1,t.concurrency??3))}start(e){this.abortController=new AbortController,this.runPipeline(e).catch(t=>{t?.name!=="AbortError"&&String(t)!=="cancelled"&&this.callbacks.onError(String(t))})}
130selectQuality(e){this.qualityResolve&&(this.qualityResolve(e),this.qualityResolve=null)}pause(){this.paused||(this.paused=!0,this.pausePromise=new Promise(e=>{this.resolveResume=e}))}resume(){this.paused&&(this.paused=!1,this.resolveResume?.())}cancel(){this.resume(),this.stopRecordingResolve?.(),this.stopRecordingResolve=null,this.abortController?.abort(),this.qualityResolve&&(this.qualityResolve=null),this.outputWritable?.abort().catch(()=>{}),this.outputWritable=null,this.pendingUserDecision?.resolve("save"),this.pendingUserDecision=null}stopAndSave(){this.stopRecordingResolve?.(),this.stopRecordingResolve=null}retryFailed(){this.pendingUserDecision?.resolve("retry"),this.pendingUserDecision=null}saveAnyway(){this.pendingUserDecision?.resolve("save"),this.pendingUserDecision=null}setConcurrency(e){this.concurrency=Math.min(5,Math.max(1,e))}async runPipeline(e){const t=this.abortController.signal,r=`hls_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,i=await navigator.storage.getDirectory(),s=await i.getDirectoryHandle(r,{create:!0});this.opfsDirName=r,this.videoFileNames=[],this.audioFileNames=[],this.failedVideoSegments=[],this.failedAudioSegments=[],this.videoKeyCache=new Map,this.audioKeyCache=new Map;const a=async(o,l)=>{const c=await(await s.getFileHandle(o,{create:!0})).createWritable();await c.write(l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)),await c.close()};try{const o=await this.fetchText(e,t);let l=e,u=null;if(F9(o)){const R=N9(o,e);if(R.length===0)throw new Error("No variants found in master playlist");const A=await new Promise((C,k)=>{this.qualityResolve=C,this.callbacks.onQualityOptions(R),t.addEventListener("abort",()=>{this.qualityResolve=null,k("cancelled")})});l=A,u=(R.find(C=>C.uri===A)??null)?.audioUri??null}const[c,d]=await Promise.all([this.fetchText(l,t),u?this.fetchText(u,t):Promise.resolve(null)]),{segments:f,initUri:h,initByteRange:p,isLive:m}=jc(c,l);if(f.length===0)throw new Error("No segments found in playlist");const g=d&&u?jc(d,u):null,y=h!==null,v=g?.initUri!=null;let S;if(m)S=await this.runLiveLoop(l,u,y,v,a,t);else{S=f.reduce((C,k)=>C+k.duration,0)+(g?Math.max(0,g.segments.reduce((C,k)=>C+k.duration,0)-f.reduce((C,k)=>C+k.duration,0)):0),await Promise.all([h?this.fetchWithSignal(h,t,3,5e3,Qo(p)).then(C=>C.arrayBuffer()).then(async C=>{const k="v_init.mp4";await a(k,new Uint8Array(C)),this.videoFileNames.push(k)}):Promise.resolve(),g?.initUri?this.fetchWithSignal(g.initUri,t,3,5e3,Qo(g.initByteRange)).then(C=>C.arrayBuffer()).then(async C=>{const k="a_init.mp4";await a(k,new Uint8Array(C)),this.audioFileNames.push(k)}):Promise.resolve()]);const R=f.length+(g?.segments.length??0);let A=0,b=0;for(let C=0;C<f.length;C+=this.concurrency){if(t.aborted)throw new DOMException("Aborted","AbortError");await this.pausePromise;const k=f.slice(C,Math.min(C+this.concurrency,f.length)),$=Date.now(),U=await Promise.all(k.map(async(D,M)=>{const L=C+M;for(let O=0;O<3;O++)try{const B=await this.fetchSegment(D,this.videoKeyCache,t);return{playlistIndex:L,data:B}}catch(B){if(t.aborted||B?.name==="AbortError"||String(B)==="cancelled")throw B;O<2&&await this.delayWithAbort(t,1e3*(O+1))}return this.failedVideoSegments.push({seg:D,playlistIndex:L}),null}));let N=0;
130for(const D of U){if(D!==null){const M=`v_${String(D.playlistIndex).padStart(5,"0")}${y?".mp4":".ts"}`;await a(M,D.data),this.videoFileNames.push(M),N+=D.data.byteLength,b=0}else b++;A++}if(this.callbacks.onProgress(Math.round(A/R*100)),N>0){this.totalBytesDownloaded+=N;const D=N/Math.max((Date.now()-$)/1e3,.001);this.smoothedSpeedBps=this.smoothedSpeedBps===0?D:.4*D+.6*this.smoothedSpeedBps,this.callbacks.onStats?.({bytesDownloaded:this.totalBytesDownloaded,totalBytes:0,speedBps:this.smoothedSpeedBps})}if(b>=Mb){if(this.callbacks.onSoftError?.(`${b} consecutive segment failures â possible rate limit. Resume when ready.`),this.pause(),await this.pausePromise,t.aborted)throw new DOMException("Aborted","AbortError");b=0}}if(g){b=0;for(let C=0;C<g.segments.length;C+=this.concurrency){if(t.aborted)throw new DOMException("Aborted","AbortError");await this.pausePromise;const k=g.segments.slice(C,Math.min(C+this.concurrency,g.segments.length)),$=Date.now(),U=await Promise.all(k.map(async(D,M)=>{const L=C+M;for(let O=0;O<3;O++)try{const B=await this.fetchSegment(D,this.audioKeyCache,t);return{playlistIndex:L,data:B}}catch(B){if(t.aborted||B?.name==="AbortError"||String(B)==="cancelled")throw B;O<2&&await this.delayWithAbort(t,1e3*(O+1))}return this.failedAudioSegments.push({seg:D,playlistIndex:L}),null}));let N=0;
130for(const D of U){if(D!==null){const M=`a_${String(D.playlistIndex).padStart(5,"0")}${v?".mp4":".ts"}`;await a(M,D.data),this.audioFileNames.push(M),N+=D.data.byteLength,b=0}else b++;A++}if(this.callbacks.onProgress(Math.round(A/R*100)),N>0){this.totalBytesDownloaded+=N;const D=N/Math.max((Date.now()-$)/1e3,.001);this.smoothedSpeedBps=this.smoothedSpeedBps===0?D:.4*D+.6*this.smoothedSpeedBps,this.callbacks.onStats?.({bytesDownloaded:this.totalBytesDownloaded,totalBytes:0,speedBps:this.smoothedSpeedBps})}if(b>=Mb){if(this.callbacks.onSoftError?.(`${b} consecutive segment failures â possible rate limit. Resume when ready.`),this.pause(),await this.pausePromise,t.aborted)throw new DOMException("Aborted","AbortError");b=0}}}for(this.callbacks.onProgress(100);this.failedVideoSegments.length+this.failedAudioSegments.length>0;){const C=this.failedVideoSegments.length+this.failedAudioSegments.length;if(this.callbacks.onFailedSegments?.(C),await new Promise(($,U)=>{this.pendingUserDecision={resolve:$},t.addEventListener("abort",()=>{this.pendingUserDecision=null,U(new DOMException("Aborted","AbortError"))},{once:!0})})==="save")break;await this.doRetryFailed(t,y,v,a)}}this.callbacks.onMuxing?.();const x=`${r}_output.mp4`,T=await i.getFileHandle(x,{create:!0}),w=await T.createWritable();this.outputWritable=w;let I=!1;try{y?await _k(s,this.videoFileNames,this.audioFileNames.length>0?this.audioFileNames:void 0,w,S):await TY(s,this.videoFileNames,this.audioFileNames.length>0?this.audioFileNames:void 0,w,S,m),await w.close(),this.outputWritable=null,I=!0;const R=await T.getFile();this.callbacks.onDone(R,"video.mp4"),setTimeout(async()=>{try{await i.removeEntry(x)}catch{}},12e4)}finally{if(!I){this.outputWritable?.abort().catch(()=>{}),this.outputWritable=null;try{await i.removeEntry(x)}catch{}}}}finally{if(this.opfsDirName){try{await(await navigator.storage.getDirectory()).removeEntry(this.opfsDirName,{recursive:!0})}catch{}this.opfsDirName=null}}}async doRetryFailed(e,t,r,i){const s=async(a,o,l,u,c)=>{const d=[];for(const{seg:f,playlistIndex:h}of a){let p=!1;for(let m=0;m<3;m++)try{const g=await this.fetchSegment(f,o,e),y=`${l}_${String(h).padStart(5,"0")}${u}`;await i(y,g),c.push(y),c.sort((v,S)=>Fb(v)-Fb(S)),p=!0;break}catch(g){if(e.aborted||g?.name==="AbortError"||String(g)==="cancelled")throw g;m<2&&await this.delayWithAbort(e,1e3*(m+1))}p||d.push({seg:f,playlistIndex:h})}return d};this.failedVideoSegments=await s(this.failedVideoSegments,this.videoKeyCache,"v",t?".mp4":".ts",this.videoFileNames),this.failedAudioSegments=await s(this.failedAudioSegments,this.audioKeyCache,"a",r?".mp4":".ts",this.audioFileNames)}async fetchSegment(e,t,r){const i=await this.fetchWithSignal(e.uri,r,3,5e3,Qo(e.byteRange));let s=new Uint8Array(await i.arrayBuffer());if(e.keyInfo&&e.keyInfo.method==="AES-128"&&e.keyInfo.uri){let a=t.get(e.keyInfo.uri);if(!a){const c=await(await this.fetchWithSignal(e.keyInfo.uri,r)).arrayBuffer();a=await crypto.subtle.importKey("raw",c,{name:"AES-CBC"},!1,["decrypt"]),t.set(e.keyInfo.uri,a)}const o=e.keyInfo.iv.buffer.slice(0),l=await crypto.subtle.decrypt({name:"AES-CBC",iv:o},a,s);s=new Uint8Array(l)}return s}async fetchText(e,t){return(await this.fetchWithSignal(e,t)).text()}async fetchWithSignal(e,t,r=3,i=5e3,s){for(let a=0;;a++){let o;try{o=await fetch(e,{signal:t,referrerPolicy:"origin-when-cross-origin",headers:s})}catch(u){if(u?.name==="AbortError"||a>=r)throw u;await this.delayWithAbort(t,i);continue}if(o.ok)return o;if(!(o.status===403||o.status===429||o.status>=500)||a>=r)throw new Error(`HTTP ${o.status} fetching ${e}`);await this.delayWithAbort(t,i)}}async delayWithAbort(e,t){await new Promise((r,i)=>{const s=setTimeout(r,t);e.addEventListener("abort",()=>{clearTimeout(s),i(new DOMException("Aborted","AbortError"))},{once:!0})})}async runLiveLoop(e,t,r,i,s,a){this.callbacks.onRecordingStart?.();let o=!1;const l=new Promise(g=>{this.stopRecordingResolve=()=>{o=!0,g()}}),u=new Set,c=new Set;let d=!1,f=!1,h=0,p=0,m=0;for(;!a.aborted&&!o;){const g=Date.now(),[y,v]=await Promise.all([this.fetchText(e,a),t?this.fetchText(t,a):Promise.resolve(null)]),S=jc(y,e),x=v&&t?jc(v,t):null;if(S.initUri&&!d){const b=await this.fetchWithSignal(S.initUri,a,3,5e3,Qo(S.initByteRange)),C=new Uint8Array(await b.arrayBuffer()),k="v_init.mp4";await s(k,C),this.videoFileNames.push(k),d=!0}if(x?.initUri&&!f){const b=await this.fetchWithSignal(x.initUri,a,3,5e3,Qo(x.initByteRange)),C=new Uint8Array(await b.arrayBuffer()),k="a_init.mp4";await s(k,C),this.audioFileNames.push(k),f=!0}const T=r?".mp4":".ts",w=i?".mp4":".ts",I=S.segments.filter(b=>!u.has(b.sequenceNumber));for(const b of I){if(a.aborted||o)break;let C=!1;for(let k=0;k<3;k++)try{const $=Date.now(),U=await this.fetchSegment(b,this.videoKeyCache,a),N=`v_${String(p).padStart(5,"0")}${T}`;await s(N,U),this.videoFileNames.push(N),p++,this.totalBytesDownloaded+=U.byteLength,h+=b.duration;const D=Math.max((Date.now()-$)/1e3,.001),M=U.byteLength/D;this.smoothedSpeedBps=this.smoothedSpeedBps===0?M:.4*M+.6*this.smoothedSpeedBps,C=!0;break}catch($){if(a.aborted||$?.name==="AbortError")throw $;k<2&&await this.delayWithAbort(a,1e3*(k+1))}C?u.add(b.sequenceNumber):this.callbacks.onSoftError?.(`Live: ski
130pping segment ${b.sequenceNumber} after 3 failed attempts`)}if(x){const b=x.segments.filter(C=>!c.has(C.sequenceNumber));for(const C of b){if(a.aborted||o)break;let k=!1;for(let $=0;$<3;$++)try{const U=await this.fetchSegment(C,this.audioKeyCache,a),N=`a_${String(m).padStart(5,"0")}${w}`;await s(N,U),this.audioFileNames.push(N),m++,this.totalBytesDownloaded+=U.byteLength,k=!0;break}catch(U){if(a.aborted||U?.name==="AbortError")throw U;$<2&&await this.delayWithAbort(a,1e3*($+1))}k?c.add(C.sequenceNumber):this.callbacks.onSoftError?.(`Live: skipping audio segment ${C.sequenceNumber} after 3 failed attempts`)}}if(this.callbacks.onStats?.({bytesDownloaded:this.totalBytesDownloaded,totalBytes:0,speedBps:this.smoothedSpeedBps}),!S.isLive)break;const R=Date.now()-g,A=Math.max(0,S.targetDuration*1e3-R);A>0&&await Promise.race([this.delayWithAbort(a,A),l])}return this.stopRecordingResolve=null,h}}const Jo=8*1024*1024,Ub=5,_Y=1e3;function bY(n){return n===403||n===408||n===429||n>=500}class Hm extends Error{constructor(e,t){super(`HTTP ${e} fetching ${t}`),this.status=e}}function IY(n){const e=n?/\/(\d+)$/.exec(n):null;return e?Number(e[1]):0}function Bb(n){return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}class wY{constructor(e){we(this,"abortController",null);this.callbacks=e}start(e){this.abortController=new AbortController,this.runPipeline(e).catch(t=>{t?.name!=="AbortError"&&this.callbacks.onError(String(t))})}cancel(){this.abortController?.abort()}async runPipeline(e){const t=this.abortController.signal,r=e.split("/").pop()?.split("?")[0]||"video.mp4",i=await navigator.storage.getDirectory(),s=`mp4dl_${Date.now()}_${Math.random().toString(36).slice(2,8)}.mp4`,a=await i.getFileHandle(s,{create:!0}),o=await a.createWritable();let l=0,u=0;const c=[],d=h=>{l+=h;const p=Date.now();c.push({t:p,bytes:l});const m=p-2e3;for(;c.length>1&&c[0].t<m;)c.shift();let g=0;if(c.length>=2){const y=c[0],v=(p-y.t)/1e3;g=v>0?(l-y.bytes)/v:0}this.callbacks.onStats?.({bytesDownloaded:l,totalBytes:u,speedBps:g}),this.callbacks.onProgress(u>0?Math.round(l/u*100):0)};let f=!1;try{const h=await this.withRetry(()=>this.probeChunk(e,t),t);if(h.status===206){u=h.totalFromRange,await o.write(Bb(h.data)),d(h.data.byteLength);const m=u>0;let g=h.data.byteLength,y=m?g<u:h.data.byteLength===Jo;for(;y;){if(t.aborted)throw new DOMException("Aborted","AbortError");const v=m?Math.min(g+Jo,u)-1:g+Jo-1,S=await this.withRetry(()=>this.fetchRequiredChunk(e,g,v,t),t);if(S===null||S.byteLength===0)break;await o.write(Bb(S)),d(S.byteLength),g+=S.byteLength,y=m?g<u:S.byteLength===Jo}}else{u=Number(h.resp.headers.get("content-length")??0);const m=h.resp.body?.getReader();if(!m)throw new Error("No response body");for(;;){const{done:g,value:y}=await m.read();if(g)break;y&&(await o.write(y),d(y.byteLength))}}await o.close(),f=!0,this.callbacks.onProgress(100);const p=await a.getFile();this.callbacks.onDone(p,r),setTimeout(()=>{i.removeEntry(s).catch(()=>{})},12e4)}finally{f||(await o.abort().catch(()=>{}),await i.removeEntry(s).catch(()=>{}))}}async probeChunk(e,t){const r=await fetch(e,{signal:t,referrerPolicy:"origin-when-cross-origin",headers:{Range:`bytes=0-${Jo-1}`}});if(r.status!==206){if(!r.ok)throw new Hm(r.status,e);return{status:r.status,data:new Uint8Array(0),totalFromRange:0,resp:r}}return{status:206,data:new Uint8Array(await r.arrayBuffer()),totalFromRange:IY(r.headers.get("content-range")),resp:null}}async fetchRequiredChunk(e,t,r,i){const s=await fetch(e,{signal:i,referrerPolicy:"origin-when-cross-origin",headers:{Range:`bytes=${t}-${r}`}});if(s.status===416)return null;if(s.status!==206)throw s.ok?new Error(`Expected partial content, got HTTP ${s.status}`):new Hm(s.status,e);return new Uint8Array(await s.arrayBuffer())}async withRetry(e,t){for(let r=0;;r++)try{return await e()}catch(i){if(t.aborted||i?.name==="AbortError"||!(!(i instanceof Hm)||bY(i.status))||r>=Ub)throw i;this.callbacks.onRetry?.(r+1,Ub),await this.delayWithAbort(t,_Y*Math.pow(2,r))}}async delayWithAbort(e,t){await new Promise((r,i)=>{const s=setTimeout(r,t);e.addEventListener("abort",()=>{clearTimeout(s),i(new DOMException("Aborted","AbortError"))},{once:!0})})}}const Qf=class Qf{constructor(e){we(this,"sessionDir");we(this,"opfsDir",null);we(this,"videoInit",null);we(this,"videoSegs",[]);
130we(this,"audioInit",null);we(this,"audioSegs",[]);we(this,"segCount",0);we(this,"totalBytes",0);we(this,"active",!1);we(this,"onSegmentCb",null);we(this,"onStopCb",null);we(this,"stopFallbackTimer",null);we(this,"inactivityTimer",null);we(this,"recordingStartMs",0);we(this,"recordingEndMs",0);we(this,"writeChain",Promise.resolve());this.sessionDir=`rec_${e}`,this.handleMessage=this.handleMessage.bind(this)}async start(){this.active=!0,window.addEventListener("message",this.handleMessage);const e=(async()=>{const t=await navigator.storage.getDirectory();this.opfsDir=await t.getDirectoryHandle(this.sessionDir,{create:!0})})();this.writeChain=this.writeChain.then(()=>e),await e}stop(){this.active=!1,this.recordingEndMs=Date.now(),this.clearInactivityTimer(),window.postMessage({__sc:!0,type:"STOP_RECORDING_REQ"},"*"),this.stopFallbackTimer=setTimeout(()=>{const e=()=>{window.removeEventListener("message",this.handleMessage),this.onStopCb?.()};this.writeChain=this.writeChain.then(e).catch(e)},5e3)}onSegment(e){this.onSegmentCb=e}onStop(e){this.onStopCb=e}handleMessage(e){if(!(!e.data||!e.data.__sc)){if(e.data.type==="RECORD_SEGMENT"&&this.active){const t={trackType:e.data.trackType,isInit:e.data.isInit,data:e.data.data};this.writeChain=this.writeChain.then(()=>this.writeSegment(t)).catch(console.warn)}else if(e.data.type==="RECORDING_STOPPED"){this.active=!1,this.recordingEndMs||(this.recordingEndMs=Date.now()),this.clearInactivityTimer();const t=()=>{this.stopFallbackTimer&&(clearTimeout(this.stopFallbackTimer),this.stopFallbackTimer=null),window.removeEventListener("message",this.handleMessage),this.onStopCb?.()};this.writeChain=this.writeChain.then(t).catch(t)}}}clearInactivityTimer(){this.inactivityTimer&&(clearTimeout(this.inactivityTimer),this.inactivityTimer=null)}resetInactivityTimer(){this.clearInactivityTimer(),this.inactivityTimer=setTimeout(()=>{if(!this.active)return;console.warn("[MseReceiver] 30 s inactivity â stream stalled or offline, triggering assembly"),this.active=!1,this.recordingEndMs||(this.recordingEndMs=Date.now());const e=()=>{this.stopFallbackTimer&&(clearTimeout(this.stopFallbackTimer),this.stopFallbackTimer=null),window.removeEventListener("message",this.handleMessage),this.onStopCb?.()};this.writeChain=this.writeChain.then(e).catch(e)},Qf.INACTIVITY_MS)}async writeSegment(e){const{trackType:t,isInit:r,data:i}=e;let s;if(t==="video")if(r){if(this.videoInit)return;s="v_init.mp4",this.videoInit=s}else s=`v_${String(this.videoSegs.length).padStart(6,"0")}.mp4`,this.videoSegs.push(s);else if(r){if(this.audioInit)return;s="a_init.mp4",this.audioInit=s}else s=`a_${String(this.audioSegs.length).padStart(6,"0")}.mp4`,this.audioSegs.push(s);this.segCount===0&&(this.recordingStartMs=Date.now());const o=await(await this.opfsDir.getFileHandle(s,{create:!0})).createWritable();try{await o.write(i),await o.close()}catch(l){throw await o.abort().catch(()=>{}),l}this.segCount++,this.totalBytes+=i.byteLength,this.onSegmentCb?.({count:this.segCount,bytes:this.totalBytes}),this.active&&this.resetInactivityTimer()}async assemble(){if(!this.opfsDir||!this.videoInit)throw new Error("No video segments captured â nothing to assemble");const e=[this.videoInit,...this.videoSegs],t=this.audioInit?[this.audioInit,...this.audioSegs]:void 0,r=this.recordingStartMs>0&&this.recordingEndMs>this.recordingStartMs?(this.recordingEndMs-this.recordingStartMs)/1e3:0,i=await navigator.storage.getDirectory(),s=`${this.sessionDir}_output.mp4`,a=await i.getFileHandle(s,{create:!0}),o=await a.createWritable();try{await _k(this.opfsDir,e,t,o,r),await o.close()}catch(c){throw await o.abort().catch(()=>{}),c}const l=await a.getFile(),u=new Blob([await l.arrayBuffer()],{type:"video/mp4"});return setTimeout(async()=>{try{await i.removeEntry(s)}catch{}try{await i.removeEntry(this.sessionDir,{recursive:!0})}catch{}},5e3),u}};we(Qf,"INACTIVITY_MS",3e4);let X0=Qf;var jD={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():window.ysFixWebmDuration=t()})("fix-webm-duration",function(){var e={172351395:{name:"EBML",type:"Container"},646:{name:"EBMLVersion",type:"Uint"},759:{name:"EBMLReadVersion",type:"Uint"},754:{name:"EBMLMaxIDLength",type:"Uint"},755:{name:"EBMLMaxSizeLength",type:"Uint"},642:{name:"DocType",type:"String"},647:{name:"DocTypeVersion",type:"Uint"},645:{name:"DocTypeReadVersion",type:"Uint"},108:{name:"Void",type:"Binary"},63:{name:"CRC-32",type:"Binary"},190023271:{name:"SignatureSlot",type:"Container"},16010:{name:"SignatureAlgo",type:"Uint"},16026:{name:"SignatureHash",type:"Uint"},16037:{name:"SignaturePublicKey",type:"Binary"},16053:{name:"Signature",type:"Binary"},15963:{name:"SignatureElements",type:"Container"},15995:{name:"SignatureElementList",type:"Container"},9522:{name:"SignedElement",type:"Binary"},139690087:{name:"Segment",type:"Container"},21863284:{name:"SeekHead",type:"Container"},3515:{name:"Seek",type:"Container"},5035:{name:"SeekID",type:"Binary"},5036:{name:"SeekPosition",type:"Uint"},88713574:{name:"Info",type:"Container"},13220:{name:"SegmentUID",type:"Binary"},13188:{name:"SegmentFilename",type:"String"},1882403:{name:"PrevUID",type:"Binary"},1868715:{name:"PrevFilename",type:"String"},2013475:{name:"NextUID",type:"Binary"},1999803:{name:"NextFilename",type:"String"}
130,1092:{name:"SegmentFamily",type:"Binary"},10532:{name:"ChapterTranslate",type:"Container"},10748:{name:"ChapterTranslateEditionUID",type:"Uint"},10687:{name:"ChapterTranslateCodec",type:"Uint"},10661:{name:"ChapterTranslateID",type:"Binary"},710577:{name:"TimecodeScale",type:"Uint"},1161:{name:"Duration",type:"Float"},1121:{name:"DateUTC",type:"Date"},15273:{name:"Title",type:"String"},3456:{name:"MuxingApp",type:"String"},5953:{name:"WritingApp",type:"String"},103:{name:"Timecode",type:"Uint"},6228:{name:"SilentTracks",type:"Container"},6359:{name:"SilentTrackNumber",type:"Uint"},39:{name:"Position",type:"Uint"},43:{name:"PrevSize",type:"Uint"},35:{name:"SimpleBlock",type:"Binary"},32:{name:"BlockGroup",type:"Container"},33:{name:"Block",type:"Binary"},34:{name:"BlockVirtual",type:"Binary"},13729:{name:"BlockAdditions",type:"Container"},38:{name:"BlockMore",type:"Container"},110:{name:"BlockAddID",type:"Uint"},37:{name:"BlockAdditional",type:"Binary"},27:{name:"BlockDuration",type:"Uint"},122:{name:"ReferencePriority",type:"Uint"},123:{name:"ReferenceBlock",type:"Int"},125:{name:"ReferenceVirtual",type:"Int"},36:{name:"CodecState",type:"Binary"},13730:{name:"DiscardPadding",type:"Int"},14:{name:"Slices",type:"Container"},104:{name:"TimeSlice",type:"Container"},76:{name:"LaceNumber",type:"Uint"},77:{name:"FrameNumber",type:"Uint"},75:{name:"BlockAdditionID",type:"Uint"},78:{name:"Delay",type:"Uint"},79:{name:"SliceDuration",type:"Uint"},72:{name:"ReferenceFrame",type:"Container"},73:{name:"ReferenceOffset",type:"Uint"},74:{name:"ReferenceTimeCode",type:"Uint"},47:{name:"EncryptedBlock",type:"Binary"},106212971:{name:"Tracks",type:"Container"},46:{name:"TrackEntry",type:"Container"},87:{name:"TrackNumber",type:"Uint"},13253:{name:"TrackUID",type:"Uint"},3:{name:"TrackType",type:"Uint"},57:{name:"FlagEnabled",type:"Uint"},8:{name:"FlagDefault",type:"Uint"},5546:{name:"FlagForced",type:"Uint"},28:{name:"FlagLacing",type:"Uint"},11751:{name:"MinCache",type:"Uint"},11768:{name:"MaxCache",type:"Uint"},254851:{name:"DefaultDuration",type:"Uint"},216698:{name:"DefaultDecodedFieldDuration",type:"Uint"},209231:{name:"TrackTimecodeScale",type:"Float"},4991:{name:"TrackOffset",type:"Int"},5614:{name:"MaxBlockAdditionID",type:"Uint"},4974:{name:"Name",type:"String"},177564:{name:"Language",type:"String"},6:{name:"CodecID",type:"String"},9122:{name:"CodecPrivate",type:"Binary"},362120:{name:"CodecName",type:"String"},13382:{name:"AttachmentLink",type:"Uint"},1742487:{name:"CodecSettings",type:"String"},1785920:{name:"CodecInfoURL",type:"String"},438848:{name:"CodecDownloadURL",type:"String"},42:{name:"CodecDecodeAll",type:"Uint"},12203:{name:"TrackOverlay",type:"Uint"},5802:{name:"CodecDelay",type:"Uint"},5819:{name:"SeekPreRoll",type:"Uint"},9764:{name:"TrackTranslate",type:"Container"},9980:{name:"TrackTranslateEditionUID",type:"Uint"},9919:{name:"TrackTranslateCodec",type:"Uint"},9893:{name:"TrackTranslateTrackID",type:"Binary"},96:{name:"Video",type:"Container"},26:{name:"FlagInterlaced",type:"Uint"},5048:{name:"StereoMode",type:"Uint"},5056:{name:"AlphaMode",type:"Uint"},5049:{name:"OldStereoMode",type:"Uint"},48:{name:"PixelWidth",type:"Uint"},58:{name:"PixelHeight",type:"Uint"},5290:{name:"PixelCropBottom",type:"Uint"},5307:{name:"PixelCropTop",type:"Uint"},5324:{name:"PixelCropLeft",type:"Uint"},5341:{name:"PixelCropRight",type:"Uint"},5296:{name:"DisplayWidth",type:"Uint"},5306:{name:"DisplayHeight",type:"Uint"},5298:{name:"DisplayUnit",type:"Uint"},5299:{name:"AspectRatioType",type:"Uint"},963876:{name:"ColourSpace",type:"Binary"},1029411:{name:"GammaValue",type:"Float"},230371:{name:"FrameRate",type:"Float"},97:{name:"Audio",type:"Container"},53:{name:"SamplingFrequency",type:"Float"},14517:{name:"OutputSamplingFrequency",type:"Float"},31:{name:"Channels",type:"Uint"},15739:{name:"ChannelPositions",type:"Binary"},8804:{name:"BitDepth",type:"Uint"},98:{name:"TrackOperation",type:"Container"},99:{name:"TrackCombinePlanes",type:"Container"},100:{name:"TrackPlane",type:"Container"},101:{name:"TrackPlaneUID",type:"Uint"},102:{name:"TrackPlaneType",type:"Uint"},105:{name:"TrackJoinBlocks",type:"Container"},109:{name:"TrackJoinUID",type:"Uint"},64:{name:"TrickTrackUID",type:"Uint"},65:{name:"TrickTrackSegmentUID",type:"Binary"},70:{name:"TrickTrackFlag",type:"Uint"},71:{name:"TrickMasterTrackUID",type:"Uint"},68:{name:"TrickMasterTrackSegmentUID",type:"Binary"},11648:{name:"ContentEncodings",type:"Container"},8768:{name:"ContentEncoding",type:"Container"},4145:{name:"ContentEncodingOrder",type:"Uint"},4146:{name:"ContentEncodingScope",type:"Uint"},4147:{name:"ContentEncodingType",type:"Uint"},4148:{name:"ContentCompression",type:"Container"}
130,596:{name:"ContentCompAlgo",type:"Uint"},597:{name:"ContentCompSettings",type:"Binary"},4149:{name:"ContentEncryption",type:"Container"},2017:{name:"ContentEncAlgo",type:"Uint"},2018:{name:"ContentEncKeyID",type:"Binary"},2019:{name:"ContentSignature",type:"Binary"},2020:{name:"ContentSigKeyID",type:"Binary"},2021:{name:"ContentSigAlgo",type:"Uint"},2022:{name:"ContentSigHashAlgo",type:"Uint"},206814059:{name:"Cues",type:"Container"},59:{name:"CuePoint",type:"Container"},51:{name:"CueTime",type:"Uint"},55:{name:"CueTrackPositions",type:"Container"},119:{name:"CueTrack",type:"Uint"},113:{name:"CueClusterPosition",type:"Uint"},112:{name:"CueRelativePosition",type:"Uint"},50:{name:"CueDuration",type:"Uint"},4984:{name:"CueBlockNumber",type:"Uint"},106:{name:"CueCodecState",type:"Uint"},91:{name:"CueReference",type:"Container"},22:{name:"CueRefTime",type:"Uint"},23:{name:"CueRefCluster",type:"Uint"},4959:{name:"CueRefNumber",type:"Uint"},107:{name:"CueRefCodecState",type:"Uint"},155296873:{name:"Attachments",type:"Container"},8615:{name:"AttachedFile",type:"Container"},1662:{name:"FileDescription",type:"String"},1646:{name:"FileName",type:"String"},1632:{name:"FileMimeType",type:"String"},1628:{name:"FileData",type:"Binary"},1710:{name:"FileUID",type:"Uint"},1653:{name:"FileReferral",type:"Binary"},1633:{name:"FileUsedStartTime",type:"Uint"},1634:{name:"FileUsedEndTime",type:"Uint"},4433776:{name:"Chapters",type:"Container"},1465:{name:"EditionEntry",type:"Container"},1468:{name:"EditionUID",type:"Uint"},1469:{name:"EditionFlagHidden",type:"Uint"},1499:{name:"EditionFlagDefault",type:"Uint"},1501:{name:"EditionFlagOrdered",type:"Uint"},54:{name:"ChapterAtom",type:"Container"},13252:{name:"ChapterUID",type:"Uint"},5716:{name:"ChapterStringUID",type:"String"},17:{name:"ChapterTimeStart",type:"Uint"},18:{name:"ChapterTimeEnd",type:"Uint"},24:{name:"ChapterFlagHidden",type:"Uint"},1432:{name:"ChapterFlagEnabled",type:"Uint"},11879:{name:"ChapterSegmentUID",type:"Binary"},11964:{name:"ChapterSegmentEditionUID",type:"Uint"},9155:{name:"ChapterPhysicalEquiv",type:"Uint"},15:{name:"ChapterTrack",type:"Container"},9:{name:"ChapterTrackNumber",type:"Uint"},0:{name:"ChapterDisplay",type:"Container"},5:{name:"ChapString",type:"String"},892:{name:"ChapLanguage",type:"String"},894:{name:"ChapCountry",type:"String"},10564:{name:"ChapProcess",type:"Container"},10581:{name:"ChapProcessCodecID",type:"Uint"},1293:{name:"ChapProcessPrivate",type:"Binary"},10513:{name:"ChapProcessCommand",type:"Container"},10530:{name:"ChapProcessTime",type:"Uint"},10547:{name:"ChapProcessData",type:"Binary"},39109479:{name:"Tags",type:"Container"},13171:{name:"Tag",type:"Container"},9152:{name:"Targets",type:"Container"},10442:{name:"TargetTypeValue",type:"Uint"},9162:{name:"TargetType",type:"String"},9157:{name:"TagTrackUID",type:"Uint"},9161:{name:"TagEditionUID",type:"Uint"},9156:{name:"TagChapterUID",type:"Uint"},9158:{name:"TagAttachmentUID",type:"Uint"},10184:{name:"SimpleTag",type:"Container"},1443:{name:"TagName",type:"String"},1146:{name:"TagLanguage",type:"String"},1156:{name:"TagDefault",type:"Uint"},1159:{name:"TagString",type:"String"},1157:{name:"TagBinary",type:"Binary"}};function t(c,d){c.prototype=Object.create(d.prototype),c.prototype.constructor=c}function r(c,d){this.name=c||"Unknown",this.type=d||"Unknown"}r.prototype.updateBySource=function(){},r.prototype.setSource=function(c){this.source=c,this.updateBySource()},r.prototype.updateByData=function(){},r.prototype.setData=function(c){this.data=c,this.updateByData()};function i(c,d){r.call(this,c,d||"Uint")}t(i,r);function s(c){return c.length%2===1?"0"+c:c}i.prototype.updateBySource=function(){this.data="";for(var c=0;c<this.source.length;c++){var d=this.source[c].toString(16);this.data+=s(d)}},i.prototype.updateByData=function(){var c=this.data.length/2;this.source=new Uint8Array(c);for(var d=0;d<c;d++){var f=this.data.substr(d*2,2);this.source[d]=parseInt(f,16)}},i.prototype.getValue=function(){return parseInt(this.data,16)},i.prototype.setValue=function(c){this.setData(s(c.toString(16)))};function a(c,d){r.call(this,c,d||"Float")}t(a,r),a.prototype.getFloatArrayType=function(){return this.source&&this.source.length===4?Float32Array:Float64Array},a.prototype.updateBySource=function(){var c=this.source.reverse(),d=this.getFloatArrayType(),f=new d(c.buffer);this.data=f[0]},a.prototype.updateByData=function(){var c=this.getFloatArrayType(),d=new c([this.data]),f=new Uint8Array(d.buffer);this.source=f.reverse()},a.prototype.getValue=function(){return this.data},a.prototype.setValue=function(c){this.setData(c)};function o(c,d){r.call(this,c,d||"Container")}t(o,r),o.prototype.readByte=function(){return this.source[this.offset++]},o.prototype.readUint=function(){for(var c=this.readByte(),d=8-c.toString(2).length,f=c-(1<<7-d),h=0;h<d;h++)f*=256,f+=this.readByte();return f},o.prototype.updateBySource=function(){for(this.data=[],this.offset=0;this.offset<this.source.length;this.offset=f){var c=this.readUint(),d=this.readUint(),f=Math.min(this.offset+d,this.source.length),h=this.source.slice(this.offset,f),p=e[c]||{name:"Unknown",type:"Unknown"},m=r;switch(p.type){case"Container":m=o;break;case"Uint":m=i;break;case"Float":m=a;break}var g=new m(p.name,p.type);g.setSource(h),this.data.push({id:c,idHex:c.toString(16),data:g})}},o.prototype.writeUint=function(c,d){for(var f=1,h=128;c>=h&&f<8;f++,h*=128);if(!d)for(var p=h+c,m=f-1;m>=0;m--){var g=p%256;this.source[this.offset+m]=g,p=(p-g)/256}this.offset+=f},o.prototype.writeSections=function(c){this.offset=0;for(var d=0;d<this.data.length;d++){var f=this.data[d],h=f.data.source,p=h.length;this.writeUint(f.id,c),this.writeUint(p,c),c||this.source.set(h,this.offset),this.offset+=p}return this.offset},o.prototype.updateByData=function(){var c=this.writeSections("draft");this.source=new Uint8Array(c),this.writeSections()},o.prototype.getSectionById=function(c){for(var d=0;d<this.data.length;d++){var f=this.data[d];if(f.id===c)return f.data}return null};function l(c){o.call(this,"File","File"),this.setSource(c)}t(l,o),l.prototype.fixDuration=function(c,d){var f=d&&d.logger;f===void 0?f=function(y){console.log(y)}:f||(f=function(){});var h=this.getSectionById(139690087);
130if(!h)return f("[fix-webm-duration] Segment section is missing"),!1;var p=h.getSectionById(88713574);if(!p)return f("[fix-webm-duration] Info section is missing"),!1;var m=p.getSectionById(710577);if(!m)return f("[fix-webm-duration] TimecodeScale section is missing"),!1;var g=p.getSectionById(1161);if(g)if(g.getValue()<=0)f(`[fix-webm-duration] Duration section is present, but the value is ${g.getValue()}`),g.setValue(c);else return f(`[fix-webm-duration] Duration section is present, and the value is ${g.getValue()}`),!1;else f("[fix-webm-duration] Duration section is missing"),g=new a("Duration","Float"),g.setValue(c),p.data.push({id:1161,data:g});return m.setValue(1e6),p.updateByData(),h.updateByData(),this.updateByData(),!0},l.prototype.toBlob=function(c){return new Blob([this.source.buffer],{type:c||"video/webm"})};function u(c,d,f,h){if(typeof f=="object"&&(h=f,f=void 0),!f)return new Promise(function(m){u(c,d,m,h)});try{var p=new FileReader;p.onloadend=function(){try{var m=new l(new Uint8Array(p.result));m.fixDuration(d,h)&&(c=m.toBlob(c.type))}catch{}f(c)},p.readAsArrayBuffer(c)}catch{f(c)}}return u.default=u,u})})(jD);var RY=jD.exports;const AY=Hb(RY);async function $b(n,e){return e<=0?n:n.type.includes("webm")?AY(n,e):LY(n,e)}async function LY(n,e){const t=await n.arrayBuffer(),r=new DataView(t);let i=1e3;return Q0(r,0,t.byteLength,(s,a)=>{if(s==="mvhd"){const o=r.getUint8(a+8);i=r.getUint32(o===0?a+20:a+28,!1)}}),Q0(r,0,t.byteLength,(s,a)=>{if(s==="mvhd")Gb(r,a,e,i);else if(s==="tkhd")CY(r,a,e,i);else if(s==="mdhd"){const o=r.getUint8(a+8),l=r.getUint32(o===0?a+20:a+28,!1);Gb(r,a,e,l)}}),new Blob([t],{type:n.type})}function Q0(n,e,t,r){let i=e;for(;i+8<=t;){let s=n.getUint32(i,!1);const a=String.fromCharCode(n.getUint8(i+4),n.getUint8(i+5),n.getUint8(i+6),n.getUint8(i+7));if(s===0&&(s=t-i),s<8)break;r(a,i),(a==="moov"||a==="trak"||a==="mdia"||a==="edts")&&Q0(n,i+8,i+s,r),i+=s}}function Gb(n,e,t,r){const i=n.getUint8(e+8),s=Math.round(t*r/1e3);i===0?n.setUint32(e+24,s,!1):(n.setUint32(e+32,0,!1),n.setUint32(e+36,s,!1))}function CY(n,e,t,r){const i=n.getUint8(e+8),s=Math.round(t*r/1e3);i===0?n.setUint32(e+28,s,!1):(n.setUint32(e+36,0,!1),n.setUint32(e+40,s,!1))}function kY(n){return n>=1e9?(n/1e9).toFixed(1)+" GB":n>=1e6?(n/1e6).toFixed(1)+" MB":n>=1e3?(n/1e3).toFixed(1)+" KB":n+" B"}function jb(n){const e=Math.floor(n/3600),t=Math.floor(n%3600/60),r=Math.floor(n%60);return e>0?`${e}:${String(t).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${t}:${String(r).padStart(2,"0")}`}function DY({token:n,mode:e,pageTitle:t}){const[r,i]=P.useState("waiting"),[s,a]=P.useState(0),[o,l]=P.useState(0),[u,c]=P.useState(0),[d,f]=P.useState(null),[h,p]=P.useState(""),[m,g]=P.useState("recording"),[y,v]=P.useState(!1),S=P.useRef("recording"),x=P.useRef(null),T=P.useRef([]),w=P.useRef("video/webm"),I=P.useRef(0),R=P.useRef(null),A=P.useRef(null);P.useEffect(()=>{if(e==="mse"){const U=new X0(n);U.onSegment(({count:N,bytes:D})=>{i("recording"),a(N),l(D),I.current||(I.current=Date.now(),R.current=setInterval(()=>c(Math.floor((Date.now()-I.current)/1e3)),1e3))}),U.onStop(async()=>{clearInterval(R.current),i("assembling");try{const N=await U.assemble();Na("MSE recording assembled",{segments:s,bytes:o}),f(N),i("done")}catch(N){kr(N,{tags:{recorder:"mse",phase:"assemble"}}),Rs("MSE assemble failed",{error:String(N)}),p(String(N)),i("error")}}),U.start().catch(N=>{kr(N,{tags:{recorder:"mse",phase:"start"}}),Rs("MSE receiver failed to start",{error:String(N)}),p(String(N)),i("error")}),x.current=U}else{T.current=[];const U=N=>{if(!(!N.data||!N.data.__sc)){if(N.data.type==="SCREEN_CAPTURE_STARTED")N.data.mimeType&&(w.current=N.data.mimeType),i("recording"),I.current=Date.now(),R.current=setInterval(()=>c(Math.floor((Date.now()-I.current)/1e3)),1e3);else if(N.data.type==="SCREEN_CHUNK"){const D=N.data.chunk;
130if(typeof D=="string"&&D.length>0){const M=atob(D),L=new Uint8Array(M.length);for(let G=0;G<M.length;G++)L[G]=M.charCodeAt(G);const O=L.buffer;T.current.push(O);const B=T.current.reduce((G,j)=>G+j.byteLength,0);l(B),a(G=>G+1)}}else if(N.data.type==="RECORDING_STOPPED"){A.current&&(clearTimeout(A.current),A.current=null),clearInterval(R.current);const D=N.data.mimeType||w.current,M=N.data.durationMs??0,L=new Blob(T.current,{type:D});T.current=[],i("assembling"),$b(L,M).then(O=>{f(O),i("done")}).catch(()=>{f(L),i("done")})}else if(N.data.type==="SCREEN_CAPTURE_ERROR"){clearInterval(R.current);const D=N.data.error||"Screen capture failed";kr(new Error(D),{tags:{recorder:"screen",phase:"capture"}}),Rs("Screen capture error",{error:D}),p(D),i("error")}}};return window.addEventListener("message",U),()=>{window.removeEventListener("message",U),clearInterval(R.current)}}return()=>{clearInterval(R.current)}},[n,e]),P.useEffect(()=>{if(t&&m==="recording"){const U=t.replace(/[\\/:*?"<>|]/g,"").trim().slice(0,200)||"recording";g(U),S.current=U}},[t]),P.useEffect(()=>{const U=t||"StreamCatcher";switch(r){case"recording":document.title=`ð´ ${jb(u)} · ${U}`;break;case"stopping":document.title=`â¼ Stopping⦠· ${U}`;break;case"assembling":document.title=`â³ Assembling⦠· ${U}`;break;case"done":document.title=`â
Done · ${U}`;break;case"error":document.title=`â Error · ${U}`;break;default:document.title=`StreamCatcher · ${U}`}},[r,u,t]);const b=()=>{clearInterval(R.current),e==="mse"?x.current&&(x.current.stop(),i("stopping")):(window.postMessage({__sc:!0,type:"STOP_RECORDING_REQ"},"*"),i("stopping"),A.current=setTimeout(()=>{A.current=null;const U=T.current;if(U.length===0){const L="No data captured";kr(new Error(L),{tags:{recorder:"screen",phase:"stop-fallback"}}),Rs("Screen recording stopped with no data",{}),p(L),i("error");return}const N=w.current,D=u*1e3,M=new Blob(U,{type:N});T.current=[],i("assembling"),$b(M,D).then(L=>{Na("Screen recording assembled via fallback",{durationMs:D}),f(L),i("done")}).catch(L=>{pa("fixVideoDuration failed in fallback, using raw blob",{error:String(L)}),f(M),i("done")})},5e3))},C=()=>{if(!d)return;const U=e==="screen"?d?.type.includes("mp4")?"mp4":"webm":"mp4",N=m.replace(/[\\/:*?"<>|]/g,"").trim().slice(0,200)||"recording";Na("Recording download succeeded",{mode:e,ext:U,sizeMb:+(d.size/1048576).toFixed(2),elapsedSecs:u});const D=URL.createObjectURL(d),M=document.createElement("a");M.href=D,M.download=`${N}.${U}`,M.click(),URL.revokeObjectURL(D)},k=e==="mse"?"Stream Capture":"Tab Record",$=e==="mse"?"#1a73e8":"#188038";return _.jsxs("div",{className:"app",children:[_.jsxs("div",{className:"downloader",style:{marginBottom:16},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[_.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",flexShrink:0,background:r==="recording"?"#d93025":"#9aa0a6",boxShadow:r==="recording"?"0 0 0 3px rgba(217,48,37,0.25)":"none",animation:r==="recording"?"recPulse 1.2s ease-in-out infinite":"none"}}),_.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:$},children:k})]}),_.jsxs("div",{className:"filename-row",children:[_.jsx("input",{className:"filename-input",disabled:!y,value:m,title:t||m,onChange:U=>g(U.target.value),onBlur:()=>v(!1),onKeyDown:U=>{U.key==="Enter"&&v(!1),U.key==="Escape"&&(g(S.current),v(!1))},spellCheck:!1}),y?_.jsxs(_.Fragment,{children:[_.jsx("button",{className:"btn-icon btn-icon-confirm",title:"Save",onMouseDown:U=>U.preventDefault(),onClick:()=>v(!1),children:_.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:_.jsx("polyline",{points:"20 6 9 17 4 12"})})}),_.jsx("button",{className:"btn-icon btn-icon-cancel",title:"Cancel",onMouseDown:U=>U.preventDefault(),onClick:()=>{g(S.current),v(!1)},children:_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),_.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):_.jsx("button",{className:"btn-icon",title:"Rename",onClick:()=>{S.current=m,v(!0)},children:"âï¸"})]}),_.jsxs("div",{className:"downloader-status",children:[r==="waiting"&&(e==="mse"?_.jsxs(_.Fragment,{children:[_.jsx("strong",{children:"Switch to the source tab and play the video."}),_.jsx("br",{}),_.jsx("span",{style:{fontWeight:400,fontSize:"0.875rem",color:"var(--text-muted)"},children:"Segments will be captured as they are fed to the player'
130s MediaSource."})]}):_.jsxs(_.Fragment,{children:[_.jsx("strong",{children:"Starting screen captureâ¦"}),_.jsx("br",{}),_.jsx("span",{style:{fontWeight:400,fontSize:"0.875rem",color:"var(--text-muted)"},children:"Allow the tab capture prompt if one appears."})]})),r==="recording"&&_.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#d93025"},children:[_.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:"#d93025",flexShrink:0}}),"Recording"]}),r==="stopping"&&"Stoppingâ¦",r==="assembling"&&"Assembling MP4 â please waitâ¦",r==="done"&&_.jsx("span",{style:{color:"#22c55e"},children:"Done! Ready to download."}),r==="error"&&_.jsxs("span",{style:{color:"#f87171"},children:["Error: ",h]})]}),(r==="recording"||r==="stopping"||r==="assembling"||r==="done")&&_.jsxs("div",{style:{display:"flex",gap:20,fontSize:"0.875rem",color:"var(--text-muted)"},children:[_.jsxs("span",{children:[_.jsx("strong",{style:{color:"var(--text)"},children:jb(u)})," elapsed"]}),_.jsxs("span",{children:[_.jsx("strong",{style:{color:"var(--text)"},children:s})," ",e==="mse"?"segments":"chunks"]}),_.jsxs("span",{children:[_.jsx("strong",{style:{color:"var(--text)"},children:kY(o)})," captured"]})]}),_.jsxs("div",{className:"downloader-controls",children:[(r==="recording"||r==="waiting")&&_.jsx("button",{className:"btn btn-danger",onClick:b,disabled:r==="waiting",children:"Stop Recording"}),r==="done"&&d&&_.jsx("button",{className:"btn btn-primary",onClick:C,children:"Download"})]})]}),_.jsxs("div",{className:"downloader",children:[_.jsx("strong",{children:e==="mse"?"Tips for Stream Capture":"Tips for Tab Record"}),e==="mse"?_.jsxs("ul",{style:{paddingLeft:18,fontSize:"0.875rem",color:"var(--text-muted)",lineHeight:1.6,display:"flex",flexDirection:"column",gap:4},children:[_.jsx("li",{children:"Works with any player that uses the MSE API (HLS.js, Dash.js, Shaka, native)."}),_.jsxs("li",{children:["For best results, start recording ",_.jsx("em",{children:"before"})," pressing play."]}),_.jsx("li",{children:"Seek-heavy playback may produce gaps; consider playing linearly."}),_.jsx("li",{children:"Stop recording after the video ends, or wait â assembly triggers automatically after 30 s of inactivity."})]}):_.jsxs("ul",{style:{paddingLeft:18,fontSize:"0.875rem",color:"var(--text-muted)",lineHeight:1.6,display:"flex",flexDirection:"column",gap:4},children:[_.jsx("li",{children:"Records whatever is rendered in the tab."}),_.jsx("li",{children:"Maximize the video player before recording for the best output quality."}),_.jsx("li",{children:"Tab audio is captured automatically alongside the video."}),_.jsx("li",{children:"Output is saved as MP4, compatible with most browsers and video editors."})]})]}),_.jsx("style",{children:` 131 @keyframes recPulse { 132 0% { box-shadow: 0 0 0 0 rgba(217,48,37,0.45); } 133 70% { box-shadow: 0 0 0 6px rgba(217,48,37,0); } 134 100% { box-shadow: 0 0 0 0 rgba(217,48,37,0); } 135 } 136 `})]})}const PY=()=>{try{const n=JSON.parse(localStorage.getItem("dl-settings")??"{}");return{concurrency:typeof n.concurrency=="number"?Math.min(5,Math.max(1,n.concurrency)):3,autoSave:typeof n.autoSave=="boolean"?n.autoSave:!0}}catch{return{concurrency:3,autoSave:!0}}};function OY(){try{const n=window.location.hash.slice(1),e=new URLSearchParams(n.replace(/\+/g,"%2B")).get("d");if(!e)return[];const t=decodeURIComponent(escape(atob(e)));return JSON.parse(t).streams??[]}catch{return[]}}function MY(){try{const n=window.location.hash.slice(1),e=new URLSearchParams(n.replace(/\+/g,"%2B")),t=e.get("r");if(!t)return null;const r=e.get("mode")==="screen"?"screen":"mse";let i="";const s=e.get("title");s&&(i=decodeURIComponent(escape(atob(s))));const a=e.get("src")||"";return{token:t,mode:r,pageTitle:i,sourceDomain:a}}catch{return null}}function Jc(n,e){const t=URL.createObjectURL(n),r=document.createElement("a");r.href=t,r.download=e,r.click(),URL.revokeObjectURL(t)}function FY(n){return/^HTTP \d+ fetching /.test(n)||/^Expected partial content, got HTTP \d+/.test(n)}function Vm(n){return FY(n)?"This video link appears to have expired or the source is unavailable. Reload the source page and try again.":n}const NY=n=>n.replace(/[\\/:*?"<>|]/g,"").replace(/\s+/g," ").trim().slice(0,240)||"video",UY=()=>{const[n]=P.useState(()=>OY()),[e,t]=P.useState({status:"idle",percent:0,error:null,variants:[]}),[r,i]=P.useState(!1),[s,a]=P.useState("video"),[o,l]=P.useState(""),[u,c]=P.useState(PY),[d,f]=P.useState(null),[h,p]=P.useState(null),[m,g]=P.useState(null),[y,v]=P.useState("hls"),S=P.useRef("video"),x=P.useRef(u),T=P.useRef(null),w=P.useRef(null),I=P.useRef(null),R=P.useRef(null),A=P.useRef(!1);P.useEffect(()=>{x.current=u,localStorage.setItem("dl-settings",JSON.stringify(u)),I.current?.setConcurrency(u.concurrency)},[u]);const b="StreamCatcher - HLS & Video Downloader";P.useEffect(()=>{const{status:W,percent:z}=e;W==="done"?document.title=`â ${b}`:r?document.title=`â¸ï¸ ${z}% - ${b}`:W==="downloading"||W==="fetching"||W==="muxing"?document.title=`${z}% - ${b}`:document.title=b},[e.status,e.percent,r]);const C=W=>{c(z=>({...z,...W}))},k=W=>{a(W),S.current=W}
136,$=e.status!=="idle"&&e.status!=="done"&&e.status!=="cancelled"&&e.status!=="error",U=W=>{i(!1);const z=NY(W.pageTitle||new URL(W.pageUrl||"https://streamcatcher.online").hostname);if(a(z),l(W.pageUrl||""),S.current=z,W.type==="mp4"){g(W.url),v("mp4"),t({status:"fetching",percent:0,error:null,variants:[]});const Y=new wY({onProgress:V=>t(J=>({...J,status:"downloading",percent:V,error:null})),onStats:V=>t(J=>({...J,...V,progressUnknown:V.totalBytes===0})),onDone:(V,J)=>{Na("MP4 download succeeded",{url:W.url,sizeMb:+(V.size/1048576).toFixed(2),autoSave:x.current.autoSave}),x.current.autoSave?Jc(V,S.current+".mp4"):f(V),t(ae=>({...ae,status:"done",percent:100}))},onError:V=>{kr(new Error(V),{tags:{downloader:"mp4"}}),Rs("MP4 download failed",{url:W.url,error:V}),t(J=>({...J,status:"error",error:Vm(V)}))},onRetry:(V,J)=>{pa("MP4 download retrying",{url:W.url,attempt:V,maxAttempts:J}),t(ae=>({...ae,error:`Connection issue â retrying (${V}/${J})â¦`}))}});R.current=Y,Y.start(W.url)}else{T.current=W.url,w.current=null,p(null),g(W.url),v("hls"),t({status:"fetching",percent:0,error:null,variants:[]});const Y=new Nb({onProgress:V=>t(J=>({...J,status:"downloading",percent:V})),onStats:V=>t(J=>({...J,...V})),onQualityOptions:N,onDone:(V,J)=>{Na("HLS download succeeded",{url:W.url,sizeMb:+(V.size/1048576).toFixed(2),autoSave:x.current.autoSave}),x.current.autoSave?Jc(V,S.current+".mp4"):f(V),t(ae=>({...ae,status:"done",percent:100}))},onError:V=>{kr(new Error(V),{tags:{downloader:"hls"}}),Rs("HLS download failed",{url:W.url,error:V}),t(J=>({...J,status:"error",error:Vm(V)}))},onSoftError:V=>{pa("HLS soft error (paused)",{url:W.url,error:V}),i(!0),t(J=>({...J,error:V}))},onFailedSegments:V=>{pa("HLS segments failed",{url:W.url,count:V}),t(J=>({...J,status:"partial",failedSegmentCount:V}))},onMuxing:()=>t(V=>({...V,status:"muxing"})),onRecordingStart:()=>t(V=>({...V,status:"recording"}))},{concurrency:x.current.concurrency});I.current=Y,Y.start(W.url)}},N=W=>{const z=[...W].sort((V,J)=>J.bandwidth-V.bandwidth),Y=w.current??z[0].uri;w.current=null,p(Y),t(V=>({...V,status:"downloading",variants:z})),I.current?.selectQuality(Y)},D=W=>{I.current?.cancel(),I.current=null,i(!1),p(W),w.current=W,t(Y=>({...Y,status:"fetching",percent:0,error:null}));const z=new Nb({onProgress:Y=>t(V=>({...V,status:"downloading",percent:Y})),onStats:Y=>t(V=>({...V,...Y})),onQualityOptions:N,onDone:(Y,V)=>{Na("HLS download succeeded (variant change)",{sizeMb:+(Y.size/1048576).toFixed(2),autoSave:x.current.autoSave}),x.current.autoSave?Jc(Y,S.current+".mp4"):f(Y),t(J=>({...J,status:"done",percent:100}))},onError:Y=>{kr(new Error(Y),{tags:{downloader:"hls",action:"variant-change"}}),Rs("HLS variant download failed",{error:Y}),t(V=>({...V,status:"error",error:Vm(Y)}))}
136,onSoftError:Y=>{pa("HLS soft error after variant change",{error:Y}),i(!0),t(V=>({...V,error:Y}))},onFailedSegments:Y=>{pa("HLS segments failed after variant change",{count:Y}),t(V=>({...V,status:"partial",failedSegmentCount:Y}))},onMuxing:()=>t(Y=>({...Y,status:"muxing"})),onRecordingStart:()=>t(Y=>({...Y,status:"recording"}))},{concurrency:x.current.concurrency});I.current=z,z.start(T.current)};P.useEffect(()=>{!A.current&&n.length>0&&(A.current=!0,U(n[0]))},[]);const M=()=>{r?(I.current?.resume(),i(!1),t(W=>({...W,error:null}))):(I.current?.pause(),i(!0))},L=()=>{I.current?.retryFailed(),t(W=>({...W,status:"downloading",error:null}))},O=()=>{I.current?.saveAnyway(),t(W=>({...W,status:"downloading",error:null,failedSegmentCount:void 0}))},B=()=>{I.current?.stopAndSave()},G=()=>{I.current?.cancel(),R.current?.cancel(),I.current=null,R.current=null,i(!1),f(null),p(null),g(null),w.current=null,t({status:"cancelled",percent:0,error:null,variants:[]})},j=e.status!=="idle";return _.jsxs(_.Fragment,{children:[!$&&e.status!=="done"&&_.jsx(Nj,{streams:n,onSelect:U}),j&&_.jsx(O9,{state:{...e,status:r?"downloading":e.status},paused:r,filename:s,pageUrl:o,variants:e.variants??[],selectedVariantUri:h,onFilenameChange:k,onPauseResume:M,onCancel:G,onVariantChange:D,onRetryFailed:L,onSaveAnyway:O,onStopAndSave:B,previewUrl:m,previewType:y}),e.status==="done"&&_.jsxs("div",{className:"done-panel",children:[_.jsx("p",{className:"done-msg",children:"Download complete!"}),d&&_.jsx("button",{className:"btn btn-primary",onClick:()=>{Jc(d,s+".mp4"),f(null)},children:"Save File"}),_.jsx("button",{className:"btn btn-secondary",onClick:()=>{f(null),t(W=>({...W,status:"idle"}))},children:"Download Another"})]}),n.length>0&&_.jsx(M9,{settings:u,onChange:C})]})};function BY(){const n=MY();return n?n.sourceDomain&&"".split(",").map(r=>r.trim()).filter(Boolean).some(r=>n.sourceDomain===r||n.sourceDomain.endsWith("."+r))?_.jsxs("div",{style:{padding:"60px 24px",textAlign:"center",color:"#c62828",fontFamily:"system-ui, sans-serif"},children:[_.jsx("div",{style:{fontSize:"2rem",marginBottom:"12px"},children:"ð«"}),_.jsx("div",{style:{fontWeight:600,fontSize:"1rem",marginBottom:"6px"},children:"Recording not supported"}),_.jsx("div",{style:{fontSize:"0.85rem",color:"#5f6368"},children:"This site is not supported for recording."})]}):_.jsx(DY,{token:n.token,mode:n.mode,pageTitle:n.pageTitle}):_.jsx(UY,{})}const $Y=()=>_.jsxs("div",{className:"static-page",children:[_.jsx("h1",{children:"Terms & Conditions"}),_.jsxs("p",{className:"static-intro",children:["Welcome to ",_.jsx("strong",{children:"StreamCatcher - HLS & Video Downloader"})," (referred to as âthe Extensionâ). These Terms & Conditions (âTermsâ) govern your use of the Extension and its companion web application. By installing or using the Extension, you agree to be bound by these Terms. If you do not agree, please uninstall the Extension and discontinue use."]}),_.jsx("h2",{children:"1. Acceptance of Terms"}),_.jsx("p",{children:"By installing, accessing, or using StreamCatcher - HLS & Video Downloader, you confirm that you have read, understood, and agree to be bound by these Terms and all applicable laws and regulations."}),_.jsx("h2",{children:"2. Service Description"}),_.jsx("p",{children:"StreamCatcher - HLS & Video Downloader is a browser extension that detects HLS (â.m3u8â) streams and MP4 video URLs on web pages you visit, and allows you to download video content to your device. The Extension is provided free of charge. We make no express or implied warranties about its performance, availability, or fitness for a particular purpose. You use it voluntarily and at your own risk."}),_.jsx("h2",{children:"3. Permitted Use"}),_.jsx("p",{children:"You may only use the Extension to download video content that you have a legal right to access and store, including:"}),_.jsxs("ul",{children:[_.jsx("li",{children:"Content you own or have created yourself."}),_.jsx("li",{children:"Content explicitly licensed for download by the rights holder."}),_.jsx("li",{children:"Content in the public domain or published under an open license (e.g., Creative
136Commons)."}),_.jsx("li",{children:"Content you are permitted to download under a paid subscription or an explicit platform policy."})]}),_.jsx("h2",{children:"4. Prohibited Conduct"}),_.jsxs("p",{children:["You agree ",_.jsx("strong",{children:"not"})," to use the Extension to:"]}),_.jsxs("ul",{children:[_.jsx("li",{children:"Download, reproduce, or distribute copyrighted content without the rights holderâs authorisation."}),_.jsx("li",{children:"Circumvent any digital rights management (DRM) or technological protection measures."}),_.jsx("li",{children:"Violate the Terms of Service of any third-party website or streaming platform."}),_.jsx("li",{children:"Download content that is illegal, harmful, defamatory, or violates any applicable law."}),_.jsx("li",{children:"Reverse-engineer, decompile, or modify the Extension beyond what is permitted by applicable law."}),_.jsx("li",{children:"Use the Extension for any commercial purpose without prior written consent."})]}),_.jsx("h2",{children:"5. Copyright & Intellectual Property"}),_.jsx("p",{children:"The Extension, including its source code, icons, interface design, and accompanying web application, is protected by copyright and other intellectual property laws. You may not copy, modify, sublicense, or distribute any part of the Extension without explicit written permission."}),_.jsx("p",{children:"We do not claim any ownership of the video content you download. You are solely responsible for ensuring that your downloading activity complies with applicable copyright law and the terms of service of the content provider."}),_.jsx("h2",{children:"6. Privacy"}),_.jsxs("p",{children:["Our handling of any data related to your use of the Extension is described in our"," ",_.jsx(si,{to:"/privacy",className:"static-link",children:"Privacy Policy"}),". By using the Extension, you acknowledge and consent to those practices."]}),_.jsx("h2",{children:"7. Disclaimer of Warranties"}),_.jsx("p",{children:"The Extension is provided âas isâ and âas availableâ without warranties of any kind, either express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement. We do not warrant that the Extension will be uninterrupted, error-free, or free of viruses or other harmful components."}),_.jsx("h2",{children:"8. Limitation of Liability"}),_.jsx("p",{children:"To the maximum extent permitted by applicable law, we shall not be liable for any direct, indirect, incidental, special, or consequential damages arising from your use of or inability to use the Extension, including but not limited to loss of data, loss of profits, or any other losses, even if we have been advised of the possibility of such damages."}),_.jsx("h2",{children:"9. Modifications to the Extension and Terms"}),_.jsx("p",{children:"We reserve the right to modify, suspend, or discontinue the Extension at any time without notice. We may also update these Terms at any time. The revised Terms will be effective upon publication. Your continued use of the Extension after any changes constitutes acceptance of the updated Terms. We encourage you to review these Terms periodically."}),_.jsx("h2",{children:"10. Termination"}),_.jsx("p",{children:"We reserve the right to terminate or restrict your access to the Extension at our sole discretion, without notice, if we reasonably believe you have violated these Terms or any applicable law."}),_.jsx("h2",{children:"11. Governing Law"}),_.jsx("p",{children:"These Terms shall be governed by and construed in accordance with applicable law. Any disputes arising under these Terms shall be subject to the exclusive jurisdiction of the competent courts."}),_.jsx("h2",{children:"12. Contact"}),_.jsx("p",{children:"If you have any questions or concerns about these Terms, please contact us via the support link in the Chrome Web Store listing."}),_.jsx("p",{className:"static-updated",children:"Last updated: April 2026"})]}),GY=()=>_.jsxs("div",{className:"static-page",children:[_.jsx("h1",{children:"Privacy Policy"}),_.jsxs("p",{className:"static-intro",children:[_.jsx("strong",{children:"StreamCatcher - HLS & Video Downloader"})," takes your privacy seriously. This Privacy Policy explains how we handle information in connection with your use of the Extension and its companion web application. By using the Extension, you acknowledge that you have read and agree to this policy."]}),_.jsx("p",{className:"static-intro",children:"This policy applies solely to the Extension and this website. It does not apply to any third-party websites or services that may be linked from here."}),_.jsx("h2",{children:"1. Information We Do Not Collect"}),_.jsxs("p",{children:["StreamCatcher - HLS & Video Downloader is designed to work entirely within your browser. We do ",_.jsx("strong",{children:"not"})," collect, transmit, or store:"]}),_.jsxs("ul",{children:[_.jsx("li",{children:"Your name, email address, or any personally identifiable information."}),_.jsx("li",{children:"The URLs of pages you visit or videos you download."}),_.jsx("li",{children:"Your browsing history or any usage analytics from inside the Extension."}),_.jsx("li",{children:"Any video content you download â all processing happens locally on your device."})]}),_.jsx("h2",{children:"2. Local Processing Only"}),_.jsx("p",{children:"All HLS stream parsing, segment downloading, and MP4 assembly happen entirely within your browser. No video data, stream URLs, or metadata are sent to our servers or any third party as part of the download process."}),_.jsx("h2",{children:"3. Permissions"}),_.jsx("p",{children:"The Extension requests only the permissions required to detect and download video streams. These permissions are used strictly for their stated purpose and are never used to access unrelated browsing activity. You can review the Extensionâs declared permissions at any time in your browserâs extension management page."}),_.jsx("h2",{children:"4. Web Application"}),_.jsx("p",{children:"The companion web application (this site) is used to display the download UI. Standard web server logs may record your IP address and browser type as part of routine hosting operations. This information is not linked to any individual and is not shared with third parties except as required by law."}),_.jsx("h2",{children:"5. Cookies"}),_.jsx("p",{children:"This website does not use tracking cookies or advertising cookies. Any cookies set are strictly functional and do not store personal information."}),_.jsx("h2",{children:"6. Third-Party Services"}),_.jsx("p",{children:"We do not currently integrate third-party analytics, advertising, or tracking services into the Extension or this web application. If this changes in the future, this policy will be updated accordingly before any such service is activated."}),_.jsx("h2",{children:"7. Disclosure of Information"}),_.jsx("p",{children:"We may disclose information only in the following limited circumstances:"}),_.jsxs("ul",{children:[_.jsx("li",{children:"When required by law, court order, or government authority."}),_.jsx("li",{children:"To protect the rights, property, or safety of users or the public."}),_.jsx("li",{children:"With your explicit consent."})]}),_.jsx("h2",{children:"8. Childrenâs Privacy"}),_.jsx("p",{children:"The Extension is not directed at children under the age of 13. We do not knowingly collect any information from children."}),_.jsx("h2",{children:"9. Changes to This Policy"}),_.jsx("p",{children:"We may update this Privacy Policy at any time. The updated version will be published on this page with a revised date. Continued use of the Extension after any changes constitutes your acceptance of the updated policy."}),_.jsx("h2",{children:"10. Contact"}),_.jsx("p",{children:"If you have questions or concerns about this Privacy Policy, please contact us via the support link in the Chrome Web Store listing."}),_.jsxs("p",{children:["For information on how your use of the Extension is governed, please also review our"," ",_.jsx(si,{to:"/terms",className:"static-link",children:"Terms & Conditions"}),"."]}),_.jsx("p",{className:"static-updated",children:"Last updated: April 2026"})]}),jY=()=>{const[n,e]=P.useState("idle"),[t,r]=P.useState(""),[i,s]=P.useState(""),[a,o]=P.useState(""),l=P.useRef(null),u=i.trim().length>0&&a.trim().length>0,c=async d=>{d.preventDefault(),e("submitting"),r("");const f=new FormData(d.currentTarget);f.append("access_key","9797b0b8-4b78-43c1-91ea-669edd07b307");try{const p=await(await fetch("https://api.web3forms.com/submit",{method:"POST",body:f})).json();p.success?(e("success"),s(""),o(""),l.current?.reset()):(e("error"),r(p.message??"Submission failed. Please try again."))}catch{e("error"),r("Network error. Please check your connection and try again.")}};return _.jsxs("div",{className:"static-page",children:[_.jsx("h1",{children:"Feedback"}),_.jsx("p",{className:"static-intro",children:"Found a bug, have a suggestion, or something not working as expected? Let me know â every message is read."}),_.jsxs("p",{className:"static-intro",children:["Note: some videos are protected and ",_.jsx("strong",{children:"cannot be downloaded"})," regardless of the tool used. If you're having a problem with a specific source, please include the page URL in your message."]}),n==="success"?_.jsxs("div",{className:"feedback-card feedback-success",children:[_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_.jsx("circle",{cx:"12",cy:"12",r:"10"}),_.jsx("polyline",{points:"9 12 11 14 15 10"})]}),_.jsx("p",{children:"Thanks for your feedback!"}),_.jsx("button",{className:"btn btn-secondary",onClick:()=>e("idle"),children:"Send Another"})]}):_.jsx("div",{className:"feedback-card",children:_.jsxs("form",{ref:l,className:"feedback-form",onSubmit:c,noValidate:!0,children:[_.jsx("input",{type:"checkbox",name:"botcheck",className:"feedback-honeypot",tabIndex:-1,"aria-hidden":"true"}),_.jsxs("div",{className:"feedback-field",children:[_.jsx("label",{htmlFor:"fb-name",className:"feedback-label",children:"Name"}),_.jsx("input",{id:"fb-name",className:"feedback-input",type:"text",name:"name",placeholder:"Your name",required:!0,maxLength:120,autoComplete:"name",value:i,onChange:d=>s(d.target.value)})]}),_.jsxs("div",{className:"feedback-field",children:[_.jsxs("label",{htmlFor:"fb-email",className:"feedback-label",children:["Email ",_.jsx("span",{className:"feedback-optional",children:"(optional)"})]}),_.jsx("input",{id:"fb-email",className:"feedback-input",type:"email",name:"email",placeholder:"[email protected]",maxLength:254,autoComplete:"email"})]}),_.jsxs("div",{className:"feedback-field",children:[_.jsx("label",{htmlFor:"fb-type",className:"feedback-label",children:"Type"}),_.jsxs("select",{id:"fb-type",className:"feedback-input feedback-select",name:"subject",children:[_.jsx("option",{value:"Bug report",children:"Bug report"}),_.jsx("option",{value:"Feature request",children:"Feature request"}),_.jsx("option",{value:"Download issue",children:"Download issue"}),_.jsx("option",{value:"Other",children:"Other"})]})]}),_.jsxs("div",{className:"feedback-field",children:[_.jsx("label",{htmlFor:"fb-message",className:"feedback-label",children:"Message"}),_.jsx("textarea",{id:"fb-message",className:"feedback-input feedback-textarea",
136name:"message",placeholder:"Describe the issue or idea in as much detail as you likeâ¦",required:!0,maxLength:4e3,rows:6,value:a,onChange:d=>o(d.target.value)})]}),n==="error"&&_.jsx("div",{className:"error-msg",children:t}),_.jsx("button",{type:"submit",className:"btn btn-primary feedback-submit",disabled:!u||n==="submitting",children:n==="submitting"?"Sendingâ¦":"Send Feedback"})]})})]})};vL(document.getElementById("root")).render(_.jsx(P.StrictMode,{children:_.jsx(B4,{fallback:_.jsx("p",{children:"Something went wrong"}),showDialog:!0,children:_.jsx(y5,{children:_.jsx(K6,{children:_.jsxs(ya,{element:_.jsx(Dj,{}),children:[_.jsx(ya,{index:!0,element:_.jsx(BY,{})}),_.jsx(ya,{path:"terms",element:_.jsx($Y,{})}),_.jsx(ya,{path:"privacy",element:_.jsx(GY,{})}),_.jsx(ya,{path:"feedback",element:_.jsx(jY,{})})]})})})})}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.